/* Territoires — worldmap edition */

.ter-page { padding-top: 64px; }

/* Hero — unified pattern: left-heavy dark vignette for text legibility,
   fading right so the image breathes. */
.ter-hero {
  position: relative;
  /* Tighter bottom — the stat bar already provides visual breathing room
     and the map section follows directly. */
  padding: 120px 0 36px;
  background:
    linear-gradient(180deg, transparent 0%, transparent 55%, rgba(0,0,0,1) 100%),
    linear-gradient(90deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.85) 30%, rgba(0,0,0,0.60) 55%, rgba(0,0,0,0.20) 80%, rgba(0,0,0,0.35) 100%),
    url('/images/territoire.png') center / cover no-repeat,
    #000;
  overflow: hidden;
  text-align: left;
}
.ter-hero .container { position: relative; z-index: 1; }
.ter-title { font-size: clamp(32px, 5vw, 50px); font-weight: 800; color: #fff; margin-top: 4px; }
.ter-sub   { font-size: 15px; color: var(--muted); margin-top: 12px; max-width: 700px; line-height: 1.6; }

/* Stat bar (top of hero) */
.ter-statbar {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 10px; margin-top: 24px;
}
.ter-stat {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}
.ter-stat-num { font-size: 24px; color: #fff; font-weight: 800; line-height: 1.05; }
.ter-stat-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; margin-top: 4px; }
.ter-stat-good .ter-stat-num { color: #f1c40f; }
.ter-stat-evil .ter-stat-num { color: #ff8888; }
.ter-stat-free .ter-stat-num { color: var(--blue); }
.ter-stat-occupied .ter-stat-num { color: var(--gold-lt); }

/* Section */
.ter-section { padding: 16px 0 60px; }

/* Layout: map + sidebar */
.ter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  margin-bottom: 36px;
}
@media (max-width: 980px) {
  .ter-layout { grid-template-columns: 1fr; }
}

.ter-mapwrap { min-width: 0; }

/* World tabs */
.ter-worldtabs {
  display: flex; gap: 6px;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 12px;
}
.ter-worldtab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.ter-worldtab:hover { color: var(--text); background: rgba(255,255,255,0.02); }
.ter-worldtab.active {
  color: var(--gold-lt);
  background: var(--card);
  border-color: var(--border2);
  position: relative; top: 1px;
}
.ter-worldtab-count {
  font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.06);
  padding: 1px 8px; border-radius: 999px;
}

/* Filters */
.ter-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.ter-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.ter-filter:hover { color: var(--text); border-color: var(--border); }
.ter-filter.active {
  color: #fff;
  background: rgba(201,147,58,0.12);
  border-color: var(--gold-lt);
}
.ter-filter-count {
  font-size: 10px; font-weight: 700;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px; border-radius: 999px;
  margin-left: 4px;
}

.ter-filter-spacer { flex: 1; min-width: 8px; }

.ter-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  padding: 6px 8px;
}
.ter-toggle input { display: none; }
.ter-toggle-slider {
  width: 32px; height: 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border2);
  border-radius: 10px;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.ter-toggle-slider::before {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%; background: #ccc;
  transition: transform 0.15s, background 0.15s;
}
.ter-toggle input:checked + .ter-toggle-slider {
  background: rgba(201,147,58,0.3); border-color: var(--gold);
}
.ter-toggle input:checked + .ter-toggle-slider::before {
  transform: translateX(14px); background: var(--gold-lt);
}
.ter-toggle-lbl { font-size: 12px; color: var(--text); font-weight: 600; }

/* Dots used in legend & filters */
.ter-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.4);
  flex-shrink: 0;
}
.ter-dot.good     { background: #f1c40f; }
.ter-dot.evil     { background: #ff6b6b; }
.ter-dot.neutral  { background: #d8d8d8; }
.ter-dot.free     { background: var(--blue); }
.ter-dot.city     { background: rgba(110,168,212,0.4); border-color: var(--blue); }

/* World view (one per world tab) */
.ter-world { display: none; }
.ter-world.active { display: block; }

.ter-mapbox {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
  touch-action: pinch-zoom;       /* native pinch on mobile */
  user-select: none;
}
.ter-mapbox.dragging { cursor: grabbing; }
.ter-mapimg {
  display: block; width: 100%; height: auto;
  -webkit-user-drag: none;
  user-select: none;
}
.ter-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.ter-svg .ter-zone, .ter-svg .ter-landmark { pointer-events: auto; }

/* Minimap image (under the rect overlay) */
.ter-svg .ter-mini {
  pointer-events: none;
  filter: saturate(0.85) brightness(0.92);
  transition: filter 0.15s, opacity 0.15s;
}

/* Zone (territory) base style */
.ter-zone rect {
  fill: rgba(255,255,255,0.0);     /* transparent — let minimap show */
  stroke: rgba(255,255,255,0.50);
  stroke-width: 1.5;
  transition: fill 0.15s, stroke 0.15s, opacity 0.15s;
  cursor: pointer;
}
.ter-zone .ter-label {
  fill: rgba(255,255,255,0.0);    /* hidden by default; toggle shows */
  font-family: 'Inter', sans-serif;
  font-size: 9px; font-weight: 600;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0,0,0,0); stroke-width: 0;
}
body.show-labels .ter-zone .ter-label { fill: rgba(255,255,255,0.95); }
.ter-svg .ter-label-city {
  fill: rgba(255,255,255,0.95);
  font-family: 'Inter', sans-serif;
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.06em;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0,0,0,0.85); stroke-width: 2.5;
}
.ter-svg .ter-label-bg {
  fill: rgba(255,255,255,0.85);
  font-family: 'Inter', sans-serif;
  font-size: 8.5px; font-weight: 600;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0,0,0,0.75); stroke-width: 1.8;
}

/* Tier color tints (semi-transparent so minimap is still visible) */
.ter-zone.t-free      rect { fill: rgba( 110, 168, 212, 0.00); stroke: rgba(110,168,212,0.55); }
.ter-zone.t-normal    rect { fill: rgba(255,255,255, 0.10); stroke: rgba(255,255,255,0.85); }
.ter-zone.t-vaillant   rect { fill: rgba(108, 182, 255, 0.28); stroke: rgba(108, 182, 255, 1.00); }
.ter-zone.t-justicier  rect { fill: rgba(208, 216, 224, 0.32); stroke: rgba(208, 216, 224, 1.00); }
.ter-zone.t-hero       rect { fill: rgba(241, 196,  15, 0.42); stroke: rgba(241, 196,  15, 1.00); }
.ter-zone.t-malfaiteur rect { fill: rgba(240, 151,  74, 0.28); stroke: rgba(240, 151,  74, 1.00); }
.ter-zone.t-criminel   rect { fill: rgba(193, 132, 255, 0.32); stroke: rgba(193, 132, 255, 1.00); }
.ter-zone.t-meurtrier  rect { fill: rgba(255, 136, 136, 0.42); stroke: rgba(255, 136, 136, 1.00); }

.ter-zone:hover rect {
  fill-opacity: 0.05 !important;   /* hover clears the tint to show minimap clean */
  stroke-width: 2.5;
}
.ter-zone:hover .ter-mini {
  filter: saturate(1.15) brightness(1.05);
}
.ter-zone.is-selected rect {
  stroke-width: 3;
  filter: drop-shadow(0 0 6px var(--gold));
}

/* Filter dimming — fade non-matching zones (rect + minimap) */
.ter-mapwrap[data-active-filter="good"]    .ter-zone:not(.f-good)    rect,
.ter-mapwrap[data-active-filter="evil"]    .ter-zone:not(.f-evil)    rect,
.ter-mapwrap[data-active-filter="neutral"] .ter-zone:not(.f-neutral) rect,
.ter-mapwrap[data-active-filter="free"]    .ter-zone:not(.f-free)    rect {
  fill-opacity: 0.04;
  stroke-opacity: 0.20;
}
.ter-mapwrap[data-active-filter="good"]    .ter-zone:not(.f-good)    .ter-mini,
.ter-mapwrap[data-active-filter="evil"]    .ter-zone:not(.f-evil)    .ter-mini,
.ter-mapwrap[data-active-filter="neutral"] .ter-zone:not(.f-neutral) .ter-mini,
.ter-mapwrap[data-active-filter="free"]    .ter-zone:not(.f-free)    .ter-mini {
  opacity: 0.25;
  filter: grayscale(0.7) saturate(0.4) brightness(0.6);
}

/* Cities (landmarks) — minimap visible, blue tint overlay */
.ter-landmark.is-city rect {
  fill: rgba(110, 168, 212, 0.12);
  stroke: rgba(110, 168, 212, 0.85);
  stroke-width: 1.5;
  cursor: default;
}
.ter-landmark.is-bg rect {
  fill: rgba(0, 0, 0, 0);
  stroke: rgba(255,255,255, 0.18);
  stroke-width: 1;
  stroke-dasharray: 3 2;
  cursor: default;
}
.ter-landmark.is-city .ter-mini {
  filter: saturate(0.95) brightness(0.95);
}
.ter-landmark.is-bg .ter-mini {
  filter: saturate(0.55) brightness(0.75);
  opacity: 0.7;
}
body.hide-cities .ter-landmark { display: none; }

/* Tooltip */
.ter-tooltip {
  position: absolute; z-index: 5;
  background: rgba(8, 14, 28, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 180px;
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0,0,0,0.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  transform: translate(-50%, calc(-100% - 8px));
}
.ter-tooltip.visible { opacity: 1; }
.ter-tooltip-name {
  font-size: 13px; font-weight: 700; color: #fff;
  margin-bottom: 4px;
}
.ter-tooltip-region {
  font-size: 10px; color: var(--muted);
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 6px;
}
.ter-tooltip-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 0;
}
.ter-tooltip-row .lbl { color: var(--muted); }
.ter-tooltip-row .val { color: var(--text); font-weight: 600; }
.ter-tooltip-row .val.good     { color: #f1c40f; }
.ter-tooltip-row .val.evil     { color: #ff8888; }
.ter-tooltip-row .val.neutral  { color: #f0f0f0; }
.ter-tooltip-row .val.free     { color: var(--blue); }

/* Legend below map */
.ter-legend {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  padding: 10px 14px;
  margin-top: 8px;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-size: 11px; color: var(--muted);
}
.ter-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ter-legend-mobile { margin-left: auto; opacity: 0.7; font-style: italic; }
@media (min-width: 720px) { .ter-legend-mobile { display: none; } }

/* Sidebar */
.ter-sidebar {
  display: flex; flex-direction: column; gap: 14px;
}
.ter-panel {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 10px; padding: 16px 18px;
}
.ter-panel-title {
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--gold-lt);
  margin-bottom: 12px;
}
.ter-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 0; }

.ter-top-list { list-style: none; padding: 0; margin: 0; }
.ter-top-row {
  display: grid; grid-template-columns: 28px 1fr auto;
  align-items: center; gap: 8px;
  padding: 6px 0; font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.ter-top-row:first-child { border-top: none; }
.ter-top-rank { color: var(--muted); font-weight: 700; font-size: 11px; }
.ter-top-name { color: var(--text); font-weight: 600; }
.ter-top-name.t-vaillant   { color: #6cb6ff; }
.ter-top-name.t-justicier  { color: #d0d8e0; }
.ter-top-name.t-hero       { color: #f1c40f; }
.ter-top-name.t-malfaiteur { color: #e67e22; }
.ter-top-name.t-criminel,  .ter-top-name.t-meurtrier { color: #ff8888; }
.ter-top-name.t-normal { color: #f0f0f0; }
.ter-top-count {
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px; font-weight: 700;
  color: var(--gold-lt);
}

/* Faction bar */
.ter-factionbar {
  display: flex;
  height: 10px; border-radius: 5px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  margin-bottom: 12px;
}
.ter-fb-seg.good     { background: linear-gradient(90deg, #f1c40f, #c9933a); }
.ter-fb-seg.neutral  { background: linear-gradient(90deg, #d8d8d8, #aaa); }
.ter-fb-seg.evil     { background: linear-gradient(90deg, #ff6b6b, #d42e2e); }

.ter-faction-list { list-style: none; padding: 0; margin: 0; }
.ter-faction-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 13px;
}
.ter-faction-list li span:last-child {
  margin-left: auto; font-weight: 700; color: var(--gold-lt);
}

/* Region textual list */
.ter-regions { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--border2); }
.ter-regions-title {
  font-size: 18px; font-weight: 700;
  color: #fff; margin-bottom: 16px;
  letter-spacing: 0.02em;
}
.ter-regions-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.ter-region {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 10px; padding: 14px 16px;
}
.ter-region-head {
  display: block;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.ter-region-name { font-size: 14px; font-weight: 700; color: var(--gold-lt); }
.ter-region-meta { font-size: 11px; color: var(--muted); font-weight: 700; }

.ter-region-list { list-style: none; padding: 0; margin: 0; }
.ter-region-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0;
  font-size: 12.5px;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.ter-region-row:first-child { border-top: none; }
.ter-region-map { font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); }
.ter-region-owner {
  font-weight: 600; max-width: 60%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ter-region-owner.t-vaillant   { color: #6cb6ff; }
.ter-region-owner.t-justicier  { color: #d0d8e0; }
.ter-region-owner.t-hero       { color: #f1c40f; }
.ter-region-owner.t-malfaiteur { color: #e67e22; }
.ter-region-owner.t-criminel,  .ter-region-owner.t-meurtrier { color: #ff8888; }
.ter-region-owner.t-normal { color: #f0f0f0; }
.ter-region-free { color: var(--blue); font-style: italic; }

/* Region textual filter */
.ter-mapwrap[data-active-filter="good"]    ~ .ter-regions .ter-region-row:not([data-faction="good"]),
.ter-mapwrap[data-active-filter="evil"]    ~ .ter-regions .ter-region-row:not([data-faction="evil"]),
.ter-mapwrap[data-active-filter="neutral"] ~ .ter-regions .ter-region-row:not([data-faction="neutral"]),
.ter-mapwrap[data-active-filter="free"]    ~ .ter-regions .ter-region-row:not([data-faction="free"]) {
  opacity: 0.25;
}

/* Stat bar responsive */
@media (max-width: 720px) {
  .ter-statbar { grid-template-columns: repeat(3, 1fr); }
  .ter-stat-num { font-size: 20px; }
  .ter-filters { flex-direction: column; align-items: stretch; gap: 6px; }
  .ter-filter-spacer { display: none; }
}

/* ─── Tooltip owner card (v3 with sprite + tier icon) ─── */
.ter-tooltip-owner-card {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.ter-tooltip-sprite {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.ter-tooltip-owner-info {
  flex: 1 1 auto;
  min-width: 0;
}
.ter-tooltip-owner-name {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ter-tooltip-owner-name.t-vaillant   { color: #6cb6ff; }
.ter-tooltip-owner-name.t-justicier  { color: #d0d8e0; }
.ter-tooltip-owner-name.t-hero       { color: #f1c40f; }
.ter-tooltip-owner-name.t-malfaiteur { color: #f0974a; }
.ter-tooltip-owner-name.t-criminel   { color: #c184ff; }
.ter-tooltip-owner-name.t-meurtrier  { color: #ff8888; }

.ter-tooltip-owner-tier {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.ter-tooltip-owner-tier.good     { color: #f1c40f; }
.ter-tooltip-owner-tier.evil     { color: #e74c3c; }
.ter-tooltip-owner-tier.neutral  { color: #95a5a6; }
.ter-tooltip-tier-icon {
  width: 22px; height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* ─── Tooltip v3.2 : level + job + guild ─── */
.ter-tooltip-techname {
  font-family: monospace;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  padding: 1px 6px;
  border-radius: 3px;
}
.ter-tooltip-owner-stats {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.ter-tooltip-level {
  font-weight: 700;
  color: #f0f0f0;
}
.ter-tooltip-job {
  color: var(--muted);
}
.ter-tooltip-job::before {
  content: "·";
  margin-right: 6px;
  opacity: 0.5;
}
.ter-tooltip-guild {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
}
.ter-tooltip-emblem {
  width: 22px; height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ─── Section "Bonus de Territoire" ─── */
.ter-bonus-section {
  margin-top: 50px;
  padding-top: 40px;
  border-top: 1px solid var(--border2);
}
.ter-bonus-title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
  color: #fff;
  margin: 0 0 12px 0;
}
.ter-bonus-desc {
  font-size: 14px;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.6;
  margin-bottom: 28px;
}

.ter-bonus-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 800px) {
  .ter-bonus-cards { grid-template-columns: 1fr; }
}
.ter-bonus-card {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 20px 22px;
}
.ter-bonus-card--stats { border-color: rgba(85,170,255,0.30); }
.ter-bonus-card--exp   { border-color: rgba(241,196,15,0.35); }
.ter-bonus-card--drop  { border-color: rgba(46,204,113,0.30); }
.ter-bonus-icon {
  font-size: 26px;
  margin-bottom: 10px;
}
.ter-bonus-card-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}
.ter-bonus-card--stats .ter-bonus-card-title { color: #5ab0ff; }
.ter-bonus-card--exp   .ter-bonus-card-title { color: #f1c40f; }
.ter-bonus-card--drop  .ter-bonus-card-title { color: #2ecc71; }
.ter-bonus-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── Portail Territorial ────────────────────────────────────────── */
.ter-portal-section {
  margin-top: 48px;
  margin-bottom: 48px;
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 14px;
}
.ter-portal-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #fff;
}
.ter-portal-desc {
  color: var(--muted);
  max-width: 760px;
  line-height: 1.6;
  margin-bottom: 28px;
}
.ter-portal-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 1100px) {
  .ter-portal-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .ter-portal-cards { grid-template-columns: 1fr; }
}
.ter-portal-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 20px 22px;
}
.ter-portal-card--obtain { border-color: rgba(241,196,15,0.35); }
.ter-portal-card--cast   { border-color: rgba(155,89,182,0.35); }
.ter-portal-card--social { border-color: rgba(85,170,255,0.30); }
.ter-portal-card--rules  { border-color: rgba(231,76,60,0.30); }
.ter-portal-icon {
  font-size: 26px;
  margin-bottom: 10px;
}
.ter-portal-card-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}
.ter-portal-card--obtain .ter-portal-card-title { color: #f1c40f; }
.ter-portal-card--cast   .ter-portal-card-title { color: #b07cd6; }
.ter-portal-card--social .ter-portal-card-title { color: #5ab0ff; }
.ter-portal-card--rules  .ter-portal-card-title { color: #e74c3c; }
.ter-portal-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.ter-portal-card-desc strong { color: #fff; }

/* Screenshots */
.ter-portal-screens-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #aaa;
  margin-bottom: 16px;
}
.ter-portal-screens-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1100px) {
  .ter-portal-screens-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .ter-portal-screens-grid { grid-template-columns: 1fr; }
}
.ter-portal-screen {
  margin: 0;
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.ter-portal-screen img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.ter-portal-screen figcaption {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  background: rgba(0,0,0,0.3);
}

/* Tier table */
.ter-bonus-table-wrap {
  margin-bottom: 24px;
}
.ter-bonus-table-title {
  font-size: 15px; font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 6px 0;
}
.ter-bonus-table-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.ter-bonus-table {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
}
.ter-bonus-tr {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr 1.2fr 1fr;
  gap: 12px;
  padding: 11px 18px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  align-items: center;
}
.ter-bonus-tr:last-child { border-bottom: none; }
.ter-bonus-tr--head {
  background: rgba(255,255,255,0.04);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--muted);
}
.ter-bonus-tr--max {
  background: rgba(241,196,15,0.06);
  font-weight: 700;
}
.ter-bonus-tr--max .ter-bonus-tier-num { color: #f1c40f; }
.ter-bonus-count       { color: var(--text); font-weight: 600; }
.ter-bonus-tier-num    { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.ter-bonus-val         { font-weight: 800; }
.ter-bonus-val--stats  { color: #5ab0ff; }
.ter-bonus-val--exp    { color: #f1c40f; }
.ter-bonus-val--drop   { color: #2ecc71; }

@media (max-width: 700px) {
  .ter-bonus-tr {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .ter-bonus-tr--head { display: none; }
  .ter-bonus-tr {
    border-radius: 8px;
    background: rgba(255,255,255,0.025);
    margin: 6px;
    padding: 10px 14px;
  }
}

.ter-bonus-note {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(241,196,15,0.06);
  border: 1px solid rgba(241,196,15,0.25);
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.ter-bonus-note-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }


/* ----- Zoom hint (shown when user scrolls over map without Ctrl) ----- */
.ter-mapbox { position: relative; }
.ter-mapbox::after {
  content: attr(data-zoom-hint);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,10,20,0.55);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.005em;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 5;
  border-radius: inherit;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.ter-mapbox.show-zoom-hint::after { opacity: 1; }


/* ----- Click-to-activate overlay ----- */
.ter-mapbox { position: relative; }
.ter-mapbox-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.045);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 6;
}
/* Touch / non-hover devices: overlay always visible while inactive */
.ter-mapbox:not(.is-active) .ter-mapbox-overlay {
  opacity: 1;
  pointer-events: auto;
}
@media (hover: hover) {
  .ter-mapbox:not(.is-active) .ter-mapbox-overlay {
    opacity: 0;
    pointer-events: none;
  }
  .ter-mapbox:not(.is-active):hover .ter-mapbox-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}
.ter-mapbox.is-active .ter-mapbox-overlay {
  opacity: 0;
  pointer-events: none;
}

.ter-mapbox-consult-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 26px;
  background: linear-gradient(180deg, #ffffff21, #ffffff42);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 10px;
  color: #302f2d;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ter-mapbox-consult-btn:hover {
  background: linear-gradient(180deg, #ffffff8f, #ffffffa8);
  border-color: rgba(255,255,255,0.7);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.6);
}
.ter-mapbox-consult-btn:active { transform: translateY(0); filter: brightness(1); }
.ter-mapbox-consult-btn svg { display: block; }

/* ===== Regions (revamped) ============================================== */
.ter-regions { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--border2); }
.ter-regions-title {
  font-size: 18px; font-weight: 700;
  color: #fff; margin-bottom: 16px;
  letter-spacing: 0.02em;
}
.ter-regions-grid {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.ter-regions-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.ter-region {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0));
  background-color: var(--card);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
}
.ter-region-head {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ter-region-head:focus-visible {
  outline: 2px solid var(--gold-lt);
  outline-offset: 2px;
  border-radius: 6px;
}
.ter-region-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
}
.ter-region-headline-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ter-region-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(224, 176, 90, 0.08);
  border: 1px solid rgba(224, 176, 90, 0.22);
  color: #fff;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
/* smooth collapse via grid-template-rows */
.ter-region-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ter-region-body-inner {
  overflow: hidden;
  min-height: 0;
}
.ter-region-progress { margin-bottom: 10px; }
.ter-region.is-collapsed .ter-region-chevron { transform: rotate(-90deg); }
.ter-region.is-collapsed .ter-region-body { grid-template-rows: 0fr; }
.ter-region.is-collapsed .ter-region-headline { padding-bottom: 0; }
.ter-region-name {
  font-size: 14px; font-weight: 800; color: var(--gold-lt);
  letter-spacing: 0.02em; margin: 0;
  text-transform: uppercase;
}
.ter-region-counts {
  font-size: 11px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex; gap: 2px; align-items: baseline;
}
.ter-region-counts-occ { color: #fff; font-size: 13px; }
.ter-region-counts-sep { opacity: 0.4; }

.ter-region-progress {
  height: 4px; background: rgba(255,255,255,0.06);
  border-radius: 999px; overflow: hidden;
}
.ter-region-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-lt), var(--gold-dk));
  border-radius: inherit;
  transition: width 0.4s ease;
}

.ter-region-list { list-style: none; padding: 0; margin: 0; }

.ter-region-row {
  display: grid;
  grid-template-columns: 40px 1fr 6px;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-top: 1px solid rgba(255,255,255,0.04);
  position: relative;
  transition: background 0.15s ease;
}
.ter-region-row:first-child { border-top: none; }
.ter-region-row:hover { background: rgba(255,255,255,0.03); border-radius: 6px; }

.ter-region-row-mini {
  width: 40px; height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.06);
  flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center;
}
.ter-region-row-mini img {
  width: 100%; height: 100%;
  object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
  filter: saturate(0.9) contrast(1.05);
  transition: filter 0.18s ease, transform 0.18s ease;
}
.ter-region-row:hover .ter-region-row-mini img {
  filter: saturate(1) contrast(1.1);
  transform: scale(1.05);
}

.ter-region-row-info { min-width: 0; }
.ter-region-row-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.ter-region-row-owner-line, .ter-region-row-meta-line {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ter-region-row-tier { width: 14px; height: 14px; object-fit: contain; flex: 0 0 14px; image-rendering: -webkit-optimize-contrast; }
.ter-region-row-owner {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ter-region-row-meta {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.ter-region-row-free {
  color: #6cc1ff;
  font-style: italic;
  font-weight: 600;
}

/* Tier-coloured owner names + status accent */
.ter-region-row-status {
  width: 6px; align-self: stretch; border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.ter-region-row.t-vaillant   .ter-region-row-owner { color: #6cb6ff; }
.ter-region-row.t-vaillant   .ter-region-row-status { background: #6cb6ff; }
.ter-region-row.t-justicier  .ter-region-row-owner { color: #d0d8e0; }
.ter-region-row.t-justicier  .ter-region-row-status { background: #d0d8e0; }
.ter-region-row.t-hero       .ter-region-row-owner { color: #f1c40f; }
.ter-region-row.t-hero       .ter-region-row-status { background: #f1c40f; box-shadow: 0 0 10px rgba(241,196,15,0.5); }
.ter-region-row.t-malfaiteur .ter-region-row-owner { color: #f0974a; }
.ter-region-row.t-malfaiteur .ter-region-row-status { background: #f0974a; }
.ter-region-row.t-criminel   .ter-region-row-owner { color: #c184ff; }
.ter-region-row.t-criminel   .ter-region-row-status { background: #c184ff; }
.ter-region-row.t-meurtrier  .ter-region-row-owner { color: #ff8888; }
.ter-region-row.t-meurtrier  .ter-region-row-status { background: #ff8888; box-shadow: 0 0 10px rgba(192,57,43,0.6); }
.ter-region-row.t-normal     .ter-region-row-owner { color: #f0f0f0; }
.ter-region-row.is-free      .ter-region-row-status { background: rgba(108,193,255,0.35); }
.ter-region-row.is-free      .ter-region-row-mini   { opacity: 0.6; }

/* ===== End Regions revamp ============================================== */

/* ----- Region header badges (free / taken) ----- */
.ter-region-badges { display: inline-flex; gap: 6px; flex-shrink: 0; }
.ter-region-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1;
}
.ter-region-badge-num {
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  padding: 0 4px;
  border-radius: 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}
.ter-region-badge-lbl { line-height: 1; opacity: 0.85; }

.ter-region-badge--free {
  background: rgba(108,193,255,0.10);
  border: 1px solid rgba(108,193,255,0.28);
  color: #6cc1ff;
}
.ter-region-badge--free .ter-region-badge-num {
  background: rgba(108,193,255,0.18);
  color: #cfe9ff;
}

.ter-region-badge--taken {
  background: rgba(201,147,58,0.10);
  border: 1px solid rgba(201,147,58,0.32);
  color: var(--gold-lt);
}
.ter-region-badge--taken .ter-region-badge-num {
  background: rgba(201,147,58,0.20);
  color: #ffe8b8;
}

/* On mobile, slightly shrink to fit alongside region name */
@media (max-width: 480px) {
  .ter-region-badge-lbl { display: none; }
}


/* ===== Simulator de bonus ============================================== */
.ter-sim {
  margin-top: 28px;
  padding: 22px 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0));
  border: 1px solid var(--border2);
  border-radius: 14px;
}
.ter-sim-head { margin-bottom: 18px; text-align: center; }
.ter-sim-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}
.ter-sim-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.ter-sim-controls { margin-bottom: 22px; }
.ter-sim-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-lt);
  margin-bottom: 10px;
}
.ter-sim-input-row {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 14px;
  align-items: center;
}
.ter-sim-input-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  outline: none;
}
.ter-sim-input-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold-dk));
  border: 2px solid #0d1422;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(201,147,58,0.4);
  transition: transform 0.12s ease;
}
.ter-sim-input-row input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
.ter-sim-input-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold-dk));
  border: 2px solid #0d1422;
  cursor: pointer;
}
.ter-sim-input-row input[type="number"] {
  padding: 9px 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.ter-sim-input-row input[type="number"]:focus {
  border-color: var(--gold);
  background: rgba(0,0,0,0.55);
}

/* Results grid */
.ter-sim-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.ter-sim-result {
  position: relative;
  padding: 16px 14px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border2);
  border-radius: 12px;
  text-align: center;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.ter-sim-result:hover { transform: translateY(-2px); }
.ter-sim-result--stats:hover { border-color: rgba(85,170,255,0.45); }
.ter-sim-result--exp:hover   { border-color: rgba(241,196,15,0.45); }
.ter-sim-result--drop:hover  { border-color: rgba(46,204,113,0.45); }

.ter-sim-result-icon { font-size: 22px; margin-bottom: 4px; line-height: 1; }
.ter-sim-result-num {
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}
.ter-sim-result--stats .ter-sim-result-num { color: #5ab0ff; }
.ter-sim-result--exp   .ter-sim-result-num { color: #f1c40f; }
.ter-sim-result--drop  .ter-sim-result-num { color: #2ecc71; }

.ter-sim-result-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  margin-bottom: 6px;
}
.ter-sim-result-hint {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  font-style: italic;
  line-height: 1.35;
}

.ter-sim-formula {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  line-height: 1.55;
}
.ter-sim-formula strong { color: var(--gold-lt); }

@media (max-width: 600px) {
  .ter-sim { padding: 16px 14px; }
  .ter-sim-results { grid-template-columns: 1fr; }
  .ter-sim-input-row { grid-template-columns: 1fr 80px; }
}


/* ----- Totem visual (live count above slider) ----- */
.ter-sim-totem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px 0 18px;
  margin-bottom: 4px;
}
.ter-sim-totem-sprite {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(201,147,58,0.14) 0%, transparent 65%);
  border-radius: 50%;
  position: relative;
}
.ter-sim-totem-sprite::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(201,147,58,0.18);
  box-shadow: inset 0 0 18px rgba(201,147,58,0.18);
  pointer-events: none;
}
.ter-sim-totem-sprite img {
  width: auto;
  height: 84px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
  transition: transform 0.18s ease;
}
.ter-sim-totem-sprite:hover img { transform: translateY(-2px); }

.ter-sim-totem-count {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}
.ter-sim-totem-num {
  font-size: 44px;
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff 0%, var(--gold-lt) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 0.95;
}
.ter-sim-totem-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 480px) {
  .ter-sim-totem { gap: 12px; }
  .ter-sim-totem-sprite { width: 60px; height: 60px; }
  .ter-sim-totem-sprite img { height: 46px; }
  .ter-sim-totem-num { font-size: 36px; }
}

@media (max-width: 760px) {
  .ter-regions-grid { flex-direction: column; }
  .ter-regions-col { flex: none; width: 100%; }
}
