/* Royaume — Kingdom Expeditions · warm medieval parchment */

[hidden] { display: none !important; }

:root {
  --parchment: #F4E4C1;
  --parchment-2: #E8D4A8;
  --parchment-3: #D9C392;
  --ink: #2D1810;
  --ink-2: #6B4423;
  --ink-3: #8B6B4A;
  --gold: #C9A649;
  --gold-light: #E4C374;
  --gold-deep: #8A6A20;
  --red: #A82828;
  --red-deep: #6B1818;
  --green: #6A8A4A;
  --green-deep: #3E5E2A;
  --blue: #3D7DB5;
  --stone: #8A8579;
  --wood: #A67B4F;
  --corrupt: #4B2D5E;
  --fog: #1A0F08;
  --font-title: 'Cinzel', 'IM Fell English', serif;
  --font-ui: 'Manrope', system-ui, sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: #1A0F08; color: var(--ink); font-family: var(--font-ui); overflow: hidden; user-select: none; }

.app {
  width: 100vw; height: 100vh;
  display: flex;
  flex-direction: row;
  background: radial-gradient(ellipse at center, var(--parchment) 0%, var(--parchment-2) 60%, var(--parchment-3) 100%);
  position: relative;
  overflow: hidden;
}
.main-col {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  min-height: 0;
}
.app::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(107,68,35,0.02) 0px, rgba(107,68,35,0.02) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(-45deg, rgba(107,68,35,0.02) 0px, rgba(107,68,35,0.02) 1px, transparent 1px, transparent 5px);
  pointer-events: none; z-index: 1;
}

/* ───── TOP BAR ───── */
.topbar {
  position: relative; z-index: 10;
  background: linear-gradient(180deg, var(--parchment-2) 0%, var(--parchment) 100%);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 2px 12px rgba(45,24,16,0.15), 0 0 0 1px rgba(201,166,73,0.3);
}
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 4px;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold-light) 50%, var(--gold) 80%, transparent);
  opacity: 0.6;
}
.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
}
.tb-center { display: flex; align-items: center; gap: 14px; justify-content: center; }
.tb-left { justify-self: start; }
.tb-right { justify-self: end; display: flex; align-items: center; gap: 10px; }

.res-group { display: flex; gap: 6px; }
.pop-group { display: flex; gap: 6px; padding-left: 12px; border-left: 1px solid rgba(107,68,35,0.25); }
.res-slot {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 8px;
  background: rgba(217,195,146,0.3);
  border: 1px solid rgba(107,68,35,0.15);
  transition: background 150ms, transform 150ms;
  cursor: help;
}
.res-slot:hover { background: rgba(228,195,116,0.4); transform: translateY(-1px); border-color: rgba(201,166,73,0.5); }
.res-icon { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(45,24,16,0.25)); transition: transform 200ms; image-rendering: pixelated; }
.res-slot:hover .res-icon { transform: scale(1.08) rotate(-3deg); }
.res-value-wrap { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.res-value { font-family: var(--font-num); font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.res-delta { font-size: 10px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.res-slot.flash-plus .res-value { animation: flashPlus 700ms ease-out; }
.res-slot.flash-minus .res-value { animation: flashMinus 700ms ease-out; }
@keyframes flashPlus {
  0% { color: var(--ink); transform: scale(1); }
  30% { color: var(--gold); transform: scale(1.3); text-shadow: 0 0 14px var(--gold-light); }
  100% { color: var(--ink); transform: scale(1); }
}
@keyframes flashMinus {
  0% { color: var(--ink); transform: scale(1); }
  30% { color: var(--red); transform: scale(1.15); }
  100% { color: var(--ink); transform: scale(1); }
}

.divider { width: 1px; height: 42px; background: linear-gradient(180deg, transparent, rgba(107,68,35,0.3), transparent); }

.pop-slot { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 8px; background: rgba(217,195,146,0.3); border: 1px solid rgba(107,68,35,0.15); }
.pop-icon-wrap { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 24px; }

.king-slot {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 12px 5px 6px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(228,195,116,0.25), rgba(201,166,73,0.15));
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: all 150ms;
}
.king-slot:hover { background: linear-gradient(180deg, rgba(228,195,116,0.4), rgba(201,166,73,0.25)); transform: translateY(-1px); }
.king-portrait {
  width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--gold-light), var(--gold) 60%, var(--gold-deep));
  border: 2px solid var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 2px 6px rgba(138,106,32,0.4);
}
.crown { font-size: 22px; color: var(--ink); text-shadow: 0 1px 0 rgba(255,255,255,0.3); }
.king-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.king-age { font-size: 10px; color: var(--ink-3); letter-spacing: 0.5px; text-transform: uppercase; }
.king-state { font-family: var(--font-title); font-size: 15px; font-weight: 600; }
.king-good .king-state { color: var(--green-deep); }
.king-moyen .king-state { color: #B8832A; }
.king-mauvais .king-state { color: #C75F1C; }
.king-critical .king-state { color: var(--red); animation: criticalPulse 1s ease-in-out infinite; }
@keyframes criticalPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ───── STAGE ───── */
.stage { position: relative; min-height: 0; display: flex; overflow: hidden; height: 100%; z-index: 2; }
.stage > .map-scroller { flex: 1; min-width: 0; height: 100%; }

/* ───── MAP ───── */
.map-scroller {
  position: relative; overflow: hidden; cursor: grab;
  background: radial-gradient(ellipse at 50% 50%, var(--parchment) 0%, var(--parchment-2) 40%, var(--parchment-3) 70%, #8B6B4A 100%);
}
.map-scroller.panning { cursor: grabbing; }
.map-scroller.selecting { cursor: crosshair; }
.map-canvas { position: absolute; left: 0; top: 0; }
#selection-layer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.map-grid { position: absolute; left: 0; top: 0; background-image: linear-gradient(rgba(107,68,35,0.10) 1px, transparent 1px), linear-gradient(90deg, rgba(107,68,35,0.10) 1px, transparent 1px); }
.map-grid.hidden { display: none; }

/* Biome tint + paths drawn on a low-res canvas, scaled up with bilinear filtering
   for smooth transitions between biomes. */
.biome-canvas {
  position: absolute; left: 0; top: 0;
  pointer-events: none;
  z-index: 0;
  image-rendering: auto;
  filter: blur(2px);
}

/* Settings menu (top-right) */
.settings-wrap { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.debug-btn { font-size: 20px; line-height: 1; }
.debug-btn:hover { background: rgba(228,195,116,0.6); transform: translateY(-1px) rotate(-8deg); }
.debug-btn.open { background: rgba(201,166,73,0.5); }
.debug-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 440px;
  background: var(--parchment);
  border: 1px solid var(--gold-deep); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(45,24,16,0.28);
  padding: 10px;
  z-index: 40;
  animation: settingsPop 180ms ease-out;
}
.debug-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 320px; overflow-y: auto; }
.debug-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 6px;
  border-radius: 6px;
  background: rgba(228,195,116,0.14);
  border: 1px solid rgba(107,68,35,0.12);
}
.debug-row-main {
  display: grid;
  grid-template-columns: 1fr 70px 1fr auto auto;
  align-items: center;
  gap: 6px;
}
.debug-row-penalty {
  display: grid;
  grid-template-columns: auto 1fr 70px 1fr;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px dashed rgba(107,68,35,0.15);
  font-size: 11px;
}
.debug-row-penalty-label {
  color: var(--ink-2); font-style: italic; padding-left: 2px;
  white-space: nowrap;
}
.debug-row-penalty select,
.debug-row-penalty input[type="number"] {
  font-family: inherit; font-size: 11px; color: var(--ink);
  background: var(--parchment);
  border: 1px solid rgba(107,68,35,0.3); border-radius: 4px;
  padding: 3px 5px;
  width: 100%;
  box-sizing: border-box;
}
.debug-row-penalty input[type="number"] { text-align: right; }
.debug-row-penalty select:disabled,
.debug-row-penalty input:disabled {
  opacity: 0.35; cursor: not-allowed;
}
.debug-row select,
.debug-row input[type="number"] {
  font-family: inherit; font-size: 12px; color: var(--ink);
  background: var(--parchment);
  border: 1px solid rgba(107,68,35,0.3); border-radius: 4px;
  padding: 4px 6px;
  width: 100%;
  box-sizing: border-box;
}
.debug-row input[type="number"] { text-align: right; }
.debug-row-permonth {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.debug-row-permonth input { margin: 0; cursor: pointer; }
.debug-row-del {
  background: none; border: none;
  font-size: 14px; cursor: pointer;
  padding: 2px 4px;
  color: var(--ink-2);
  border-radius: 4px;
  transition: background 120ms, color 120ms;
}
.debug-row-del:hover { background: rgba(170,40,40,0.15); color: #a22; }
.debug-add {
  width: 100%;
  padding: 6px 10px;
  font-family: inherit; font-size: 12px; color: var(--ink);
  background: rgba(228,195,116,0.3);
  border: 1px dashed var(--gold-deep); border-radius: 6px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 120ms;
}
.debug-add:hover { background: rgba(228,195,116,0.55); }
.debug-footer {
  display: flex; justify-content: space-between; gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(107,68,35,0.18);
}
.debug-reset,
.debug-close {
  font-family: inherit; font-size: 12px;
  padding: 6px 12px; border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--gold-deep);
}
.debug-reset { background: rgba(170,40,40,0.1); color: #a22; border-color: rgba(170,40,40,0.3); }
.debug-reset:hover { background: rgba(170,40,40,0.2); }
.debug-close { background: var(--gold); color: var(--ink); }
.debug-close:hover { background: var(--gold-deep); color: var(--parchment); }
.debug-empty {
  font-size: 12px; color: var(--ink-3); font-style: italic;
  text-align: center; padding: 12px;
}
.exp-penalty {
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(170,40,40,0.08);
  border: 1px solid rgba(170,40,40,0.25);
  color: #8b2b2b;
  font-size: 11px;
}

.settings-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(244,228,193,0.5);
  border: 2px solid var(--gold-deep); border-radius: 8px;
  color: var(--ink); cursor: pointer;
  transition: transform 200ms, background 150ms;
}
.settings-btn:hover { background: rgba(228,195,116,0.6); transform: translateY(-1px); }
.settings-btn.open { background: rgba(201,166,73,0.5); }
.settings-icon { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; transition: transform 250ms ease; }
.settings-btn:hover .settings-icon { transform: rotate(35deg); }
.settings-btn.open .settings-icon { transform: rotate(60deg); }
.settings-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 280px;
  background: var(--parchment);
  border: 1px solid var(--gold-deep); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(45,24,16,0.28);
  padding: 10px;
  z-index: 40;
  animation: settingsPop 180ms ease-out;
}
@keyframes settingsPop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.settings-title {
  font-family: var(--font-title); font-size: 12px; letter-spacing: 1.2px;
  color: var(--ink-2); text-transform: uppercase;
  padding: 4px 8px 8px; border-bottom: 1px solid rgba(107,68,35,0.18);
  margin-bottom: 6px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 8px 8px; border-radius: 6px;
  cursor: pointer;
  transition: background 120ms;
}
.settings-row:hover { background: rgba(228,195,116,0.22); }
.settings-label { font-size: 13px; color: var(--ink); line-height: 1.3; }
.settings-check {
  appearance: none; -webkit-appearance: none;
  flex-shrink: 0;
  width: 36px; height: 20px; border-radius: 11px;
  background: rgba(107,68,35,0.25);
  border: 1px solid rgba(107,68,35,0.35);
  position: relative; cursor: pointer;
  transition: background 180ms;
}
.settings-check::after {
  content: ''; position: absolute; top: 1px; left: 1px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--parchment);
  box-shadow: 0 1px 3px rgba(45,24,16,0.3);
  transition: left 180ms ease, background 180ms;
}
.settings-check:checked { background: var(--gold); border-color: var(--gold-deep); }
.settings-check:checked::after { left: 17px; background: #fff; }

/* Hint shown briefly after mode toggle */
.map-hint {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--parchment);
  padding: 8px 14px; border-radius: 20px;
  font-family: var(--font-title); font-size: 12px; letter-spacing: 0.8px;
  z-index: 15; pointer-events: none;
  opacity: 0; transition: opacity 250ms;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.map-hint.show { opacity: 0.95; }

.influence-halo {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(228,195,116,0.22) 0%, rgba(201,166,73,0.12) 50%, transparent 75%);
  box-shadow: inset 0 0 40px rgba(201,166,73,0.15);
  pointer-events: none;
  animation: haloPulse 4s ease-in-out infinite;
}
@keyframes haloPulse { 0%,100% { opacity: 0.85; } 50% { opacity: 1; } }

.cell { position: absolute; display: flex; align-items: center; justify-content: center; pointer-events: auto; cursor: pointer; }
.cell:hover { filter: brightness(1.1); }
.cell.selectable::after { content:''; position:absolute; inset:3px; border-radius:4px; border:1px dashed rgba(201,166,73,0); transition: border-color 150ms; }
.cell:hover::after { border-color: rgba(201,166,73,0.6); }

.cell.harvested { opacity: 0.45; }
.cell.corrupt { background: rgba(75,45,94,0.25); }

.fog-tile { position: absolute; background: radial-gradient(circle, rgba(26,15,8,0.65) 0%, rgba(26,15,8,0.92) 100%); pointer-events: none; }

.castle-sprite { position: absolute; z-index: 3; pointer-events: none; filter: drop-shadow(0 4px 8px rgba(45,24,16,0.4)); }
.building-sprite { position: absolute; z-index: 3; pointer-events: none; font-size: 22px; display:flex; align-items:center; justify-content:center; filter: drop-shadow(0 2px 3px rgba(45,24,16,0.3)); background: rgba(244,228,193,0.5); border: 1px solid var(--gold-deep); border-radius: 4px; }

/* Darken overlay: 4 rects around selection */
.sel-dim-overlay { position: absolute; background: rgba(26,15,8,0.38); pointer-events: none; z-index: 4; }

.selection-rect {
  position: absolute;
  border: 2px dashed var(--gold);
  background-color: rgba(228,195,116,0.12);
  background-image: repeating-linear-gradient(45deg, rgba(201,166,73,0.28) 0px, rgba(201,166,73,0.28) 6px, transparent 6px, transparent 12px);
  background-clip: padding-box;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(201,166,73,0.5), inset 0 0 30px rgba(228,195,116,0.15);
  pointer-events: none;
}
.selection-rect.live { pointer-events: none; }
.selection-rect.active {
  border-style: solid;
  border-color: var(--gold-deep);
  border-width: 3px;
  background-color: rgba(228,195,116,0.08);
  background-image: none;
  box-shadow: 0 0 0 1px rgba(138,106,32,0.5), 0 0 18px rgba(201,166,73,0.35), inset 0 0 24px rgba(228,195,116,0.1);
}

/* Label "W × H cases" */
.sel-dim {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  font-family: var(--font-num); font-size: 13px; font-weight: 700;
  background: var(--gold); color: var(--ink);
  padding: 3px 10px; border-radius: 4px;
  border: 1.5px solid var(--gold-deep);
  white-space: nowrap;
  pointer-events: none;
}
.sel-dim.top { top: -32px; }
.sel-dim.bottom { bottom: -32px; }

/* Resize handles + move handle */
.sel-handle {
  position: absolute; width: 14px; height: 14px;
  background: var(--gold); border: 2px solid var(--ink);
  border-radius: 3px; z-index: 6;
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}
.sel-handle:hover { background: var(--gold-light); transform: translate(-50%, -50%) scale(1.15); }
.sel-handle.h-n, .sel-handle.h-s { cursor: ns-resize; }
.sel-handle.h-e, .sel-handle.h-w { cursor: ew-resize; }
.sel-handle.h-ne, .sel-handle.h-sw { cursor: nesw-resize; }
.sel-handle.h-nw, .sel-handle.h-se { cursor: nwse-resize; }
.sel-move {
  position: absolute; width: 28px; height: 28px;
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2));
  border: 2px solid var(--gold-deep); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: move; z-index: 6;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
  font-size: 15px; color: var(--ink);
  pointer-events: auto;
}
.sel-move:hover { background: var(--parchment); }

.caravan { position: absolute; width: 24px; height: 24px; z-index: 6; pointer-events: none; display:flex; align-items:center; justify-content:center; font-size: 18px; filter: drop-shadow(0 0 6px var(--gold-light)); transition: left 200ms linear, top 200ms linear; }
/* During out/return phases the rAF loop sets position every frame, so the
   transition would fight the animation — disable it then. */
.caravan.flowing { transition: none; }

/* Planned expedition route — organic curve from castle to zone */
.exp-route {
  position: absolute; left: 0; top: 0;
  pointer-events: none; z-index: 4;
  overflow: visible;
}
.exp-route-halo {
  fill: none;
  stroke: rgba(228, 195, 116, 0.35);
  stroke-width: 8;
  stroke-linecap: round;
}
.exp-route-line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 8 6;
  filter: drop-shadow(0 1px 2px rgba(45,24,16,0.45));
  animation: routeMarch 1.4s linear infinite;
}
.exp-route.active .exp-route-line {
  stroke-dasharray: none;
  stroke-width: 3;
  animation: none;
}
@keyframes routeMarch {
  to { stroke-dashoffset: -28; }
}

/* Proximity markers along the route */
.exp-marker {
  position: absolute;
  width: 24px; height: 24px;
  margin-left: -12px; margin-top: -12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-num); font-weight: 800; font-size: 16px;
  color: #fff;
  border-radius: 50%;
  border: 2px solid rgba(26,15,8,0.55);
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
  z-index: 6;
  pointer-events: none;
  text-shadow: 0 1px 1px rgba(0,0,0,0.6);
  animation: markerPop 280ms cubic-bezier(.2,1.4,.4,1) both;
}
.exp-marker-red {
  background: radial-gradient(circle at 35% 30%, #ff7a6c, #c93625 70%);
}
.exp-marker-green {
  background: radial-gradient(circle at 35% 30%, #9ad876, #3f8f3f 70%);
}
@keyframes markerPop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.exp-marker.exp-marker-fading {
  animation: markerFade 220ms ease-in forwards;
}
@keyframes markerFade {
  to { transform: scale(1.6); opacity: 0; }
}

.bubble {
  position: absolute;
  font-family: var(--font-num); font-weight: 700; font-size: 14px;
  pointer-events: none; z-index: 7;
  animation: bubbleRise 1400ms ease-out forwards;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  white-space: nowrap;
  transform: translateX(-50%);
}
.bubble-good { color: var(--gold-light); }
.bubble-bad { color: #FF6060; }
.bubble-event { color: var(--parchment); background: rgba(75,45,94,0.9); padding: 2px 8px; border-radius: 10px; font-size: 11px; }
@keyframes bubbleRise {
  0% { transform: translate(-50%, 0) scale(0.5); opacity: 0; }
  20% { transform: translate(-50%, -8px) scale(1.15); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -40px) scale(1); opacity: 0; }
}

.cloud-puff { position: absolute; z-index: 6; pointer-events: none; font-size: 28px; animation: puff 800ms ease-out forwards; transform: translate(-50%, -50%); }
@keyframes puff { 0% { opacity: 0; transform: translate(-50%,-50%) scale(0.3); } 30% { opacity: 1; transform: translate(-50%,-50%) scale(1.2); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); } }

/* ───── SIDEBAR (LEFT) ───── */
.sidebar { width: 340px; flex-shrink: 0; height: 100vh; background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-2) 100%); border-right: 2px solid var(--gold); box-shadow: inset -1px 0 0 rgba(228,195,116,0.3), 6px 0 14px rgba(45,24,16,0.28); display: flex; flex-direction: column; z-index: 20; min-height: 0; }

/* Top : minimap / zone-info */
.sb-top { flex-shrink: 0; border-bottom: 2px solid var(--gold-deep); background: linear-gradient(180deg, rgba(228,195,116,0.18), transparent); padding: 10px 12px 12px; }
.minimap-head { padding: 0 0 8px 0 !important; }
.minimap-head .hint { font-family: var(--font-ui); font-size: 10px; text-transform: none; letter-spacing: 0.2px; color: var(--ink-3); font-weight: 500; }
/* Fixed-size box shared by minimap and zone-info */
.minimap-wrap, .zone-info { width: 100%; height: 280px; background: rgba(107,68,35,0.15); border: 2px solid var(--gold-deep); border-radius: 4px; overflow: hidden; position: relative; }
.minimap-wrap { image-rendering: pixelated; cursor: crosshair; }
#minimap { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.minimap-viewport { position: absolute; border: 1.5px solid var(--red); box-shadow: 0 0 0 1px rgba(244,228,193,0.4); pointer-events: none; }

/* Zone info panel (replaces minimap during selection) */
.zone-info { padding: 10px 12px; display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(244,228,193,0.5), rgba(228,195,116,0.15)); }
.zone-info .zi-head { font-family: var(--font-title); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink); padding: 0 0 8px; border-bottom: 1px solid rgba(201,166,73,0.4); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.zone-info .zi-dim { font-family: var(--font-num); color: var(--ink-2); font-size: 13px; }
.zone-info .zi-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.zone-info .zi-subhead { font-family: var(--font-title); font-size: 10px; color: var(--ink-3); letter-spacing: 0.8px; text-transform: uppercase; }
.zone-info .zi-res { display:flex; flex-wrap: wrap; gap: 6px; }
.zone-info .zi-res-chip { display:inline-flex; align-items:center; gap:5px; background: rgba(228,195,116,0.45); border: 1.5px solid var(--gold-deep); border-radius: 14px; padding: 3px 10px 3px 4px; font-family: var(--font-num); font-weight:700; font-size: 14px; color: var(--ink); }
.zone-info .zi-res-chip img { width: 24px; height: 24px; image-rendering: pixelated; filter: drop-shadow(0 1px 1px rgba(45,24,16,0.25)); }
.zone-info .zi-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.zone-info .zi-tag { display:inline-flex; align-items:center; gap:4px; background: rgba(244,228,193,0.5); border: 1px solid rgba(201,166,73,0.35); border-radius: 4px; padding: 4px 8px; font-size: 12px; }
.zone-info .zi-tag.danger { background: rgba(168,40,40,0.12); border-color: rgba(168,40,40,0.4); color: var(--red-deep); font-weight: 700; }
.zone-info .zi-tag b { font-family: var(--font-num); }

/* Middle : journal + splitter + construction */
.sb-middle { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-journal { flex: 3 1 0; min-height: 80px; }
.panel-build { flex: 2 1 0; min-height: 36px; border-top: 1px solid rgba(107,68,35,0.25); }
.panel-build.collapsed { flex: 0 0 38px !important; }
.panel-build.collapsed .panel-scroll { display: none; }
.panel-build.collapsed .build-head-chevron { transform: rotate(-90deg); }
.panel-build.collapsed .build-head-grip { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px; font-family: var(--font-title); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink); flex-shrink: 0; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 0 14px 10px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(107,68,35,0.25); border-radius: 3px; }

/* Build panel banner header — clickable, hoverable, with resize grip on the right */
.build-head {
  position: relative;
  padding: 9px 14px !important;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(228,195,116,0.45), rgba(201,166,73,0.28));
  border-top: 1px solid rgba(228,195,116,0.7);
  border-bottom: 1px solid rgba(107,68,35,0.35);
  box-shadow: inset 0 1px 0 rgba(255,240,200,0.4), 0 1px 2px rgba(45,24,16,0.1);
  user-select: none;
  transition: background 180ms, box-shadow 180ms;
}
.build-head:hover {
  background: linear-gradient(180deg, rgba(228,195,116,0.65), rgba(201,166,73,0.42));
  box-shadow: inset 0 1px 0 rgba(255,240,200,0.55), 0 2px 4px rgba(45,24,16,0.18);
}
.build-head-title { flex: 1; }
.build-head-chevron {
  font-size: 13px;
  color: var(--ink-2);
  transition: transform 200ms ease;
  margin-right: 6px;
}
.build-head-grip {
  width: 14px; height: 14px;
  background:
    repeating-linear-gradient(45deg, rgba(107,68,35,0.55) 0 2px, transparent 2px 4px);
  border-radius: 2px;
  cursor: ns-resize;
  opacity: 0.7;
  transition: opacity 150ms;
}
.build-head:hover .build-head-grip { opacity: 1; }

/* Expedition panel in sidebar (replaces sb-middle) */
.sb-exp { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

/* Stats footer */
.sb-foot { flex-shrink: 0; border-top: 2px solid var(--gold-deep); background: linear-gradient(0deg, rgba(228,195,116,0.15), transparent); padding: 8px 12px 10px; }

.mini-clear { background: none; border: 1px solid rgba(107,68,35,0.3); color: var(--ink-3); width: 20px; height: 20px; border-radius: 3px; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mini-clear:hover { background: rgba(139,46,46,0.08); color: var(--red-deep); border-color: rgba(139,46,46,0.35); }

.stats-list { display:flex; flex-direction: column; gap: 6px; font-size: 12px; }
.stat-row { display:flex; justify-content: space-between; padding: 4px 8px; background: rgba(244,228,193,0.5); border-radius: 4px; border: 1px solid rgba(201,166,73,0.3); }
.stat-row b { font-family: var(--font-num); }

.hist-empty { padding: 12px 0; font-size: 12px; color: var(--ink-3); text-align: center; font-style: italic; }
.hist-entry { background: rgba(244,228,193,0.5); border: 1px solid rgba(201,166,73,0.35); border-left: 3px solid var(--green); border-radius: 4px; padding: 6px 8px; font-size: 12px; }
.hist-entry.clickable { cursor: pointer; transition: background 120ms; }
.hist-entry.clickable:hover { background: rgba(228,195,116,0.4); }
.hist-entry.mixed { border-left-color: #B8832A; }
.hist-entry.bad { border-left-color: var(--red-deep); }
.hist-top { display:flex; align-items:center; gap:6px; margin-bottom: 2px; }
.hist-title { font-family: var(--font-title); font-size: 11px; font-weight: 600; color: var(--ink); flex:1; }
.hist-when { font-family: var(--font-num); font-size: 10px; color: var(--ink-3); }
.hist-text { color: var(--ink-2); font-size: 11px; line-height: 1.35; }

#build-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding-top: 8px; align-content: start; }

.build-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "glyph name"
    "glyph cost"
    "btn   btn";
  align-items: center;
  gap: 3px 8px;
  background: rgba(244,228,193,0.5);
  border: 1px solid rgba(201,166,73,0.4);
  border-radius: 8px;
  padding: 8px 9px 9px;
  transition: border-color 150ms, transform 150ms, box-shadow 150ms;
  position: relative;
  cursor: help;
}
.build-item:hover:not(.cant) {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(138,106,32,0.2);
}
.build-item.cant { opacity: 0.55; }

.build-glyph {
  grid-area: glyph;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--parchment);
  border: 1.5px solid var(--gold-deep);
  border-radius: 6px;
  font-size: 24px;
  box-shadow: inset 0 2px 4px rgba(138,106,32,0.15);
}
.build-name {
  grid-area: name;
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.4px;
  text-align: left;
  align-self: end;
  line-height: 1.15;
}
.build-cost {
  grid-area: cost;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  align-self: start;
}
.bc {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 700;
  padding: 1px 6px 1px 3px;
  border-radius: 4px;
  line-height: 1;
}
.bc img { width: 16px; height: 16px; image-rendering: pixelated; }
.bc.ok { background: rgba(228,195,116,0.38); color: var(--ink); }
.bc.no { background: rgba(139,46,46,0.14); color: var(--red-deep); text-decoration: line-through; }

.build-btn {
  grid-area: btn;
  margin-top: 6px;
  width: 100%;
  background: linear-gradient(180deg, #f5dc8f, #d9b560);
  border: 1px solid #a8822e;
  color: #3a2710;
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,245,210,0.7), 0 1px 2px rgba(45,24,16,0.18);
  transition: transform 120ms, box-shadow 150ms, background 180ms;
}
.build-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #f8e5a4, #e2bf6a);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,245,210,0.9), 0 3px 6px rgba(45,24,16,0.22);
}
.build-btn:active:not(:disabled) { transform: translateY(0); box-shadow: inset 0 1px 2px rgba(45,24,16,0.2); }
.build-btn:disabled {
  background: linear-gradient(180deg, rgba(217,195,146,0.55), rgba(180,158,115,0.45));
  border-color: rgba(107,68,35,0.3);
  color: rgba(60,45,30,0.5);
  cursor: not-allowed;
  box-shadow: none;
}
.build-btn.placing {
  background: linear-gradient(180deg, #d06363, #9f3a3a);
  color: #fdf4da;
  border-color: #7a2a2a;
}
.build-btn.placing:hover:not(:disabled) { background: linear-gradient(180deg, #dc7a7a, #ad4848); }

.placing-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); padding: 8px 14px; background: var(--ink); color: var(--parchment); border-radius: 4px; font-family: var(--font-title); font-size: 13px; z-index: 50; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.cell.buildable { outline: 2px dashed rgba(106,138,74,0.7); outline-offset: -3px; }
.cell.buildable:hover { background: rgba(106,138,74,0.25); }

/* ───── TIMELINE ───── */
.timeline {
  position: relative; z-index: 10;
  background: linear-gradient(0deg, var(--parchment-2) 0%, var(--parchment) 100%);
  border-top: 2px solid var(--gold);
  height: 72px;
  display: flex; align-items: stretch;
  padding: 10px 16px;
  gap: 14px;
  box-shadow: 0 -2px 12px rgba(45,24,16,0.15);
}
.timeline-season { flex: 0 0 auto; display: flex; align-items: stretch; gap: 0; }
.timeline-future { flex: 1; display: flex; align-items: stretch; gap: 6px; margin-left: 6px; }

/* Chevron-shaped month slot — right side points into the next, left side
   has a matching notch so slots interlock. */
.tl-season-slot {
  --fill: 0;
  position: relative;
  width: 76px;
  padding: 0 18px 0 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-ui);
  color: var(--ink-2);
  background: linear-gradient(180deg, rgba(244,228,193,0.75), rgba(228,195,116,0.4));
  border: 1px solid rgba(107,68,35,0.35);
  border-right: none;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%);
  margin-right: -14px;
  cursor: help;
  transition: filter 180ms, transform 120ms;
  overflow: hidden;
}
.tl-season-slot:first-child { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); padding-left: 12px; }
.tl-season-slot::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(201,166,73,0.55) 0 6px, rgba(228,195,116,0.75) 6px 12px);
  transform-origin: left center;
  transform: scaleX(var(--fill));
  transition: transform 180ms linear;
  pointer-events: none;
  z-index: 0;
}
.tl-season-slot > * { position: relative; z-index: 1; }
.tl-season-slot.past { filter: grayscale(0.7) brightness(0.88); color: var(--ink-3); }
.tl-season-slot.past::before { background: repeating-linear-gradient(45deg, rgba(107,68,35,0.25) 0 6px, rgba(107,68,35,0.12) 6px 12px); transform: scaleX(1); }
.tl-season-slot.current {
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(228,195,116,0.9), 0 2px 6px rgba(45,24,16,0.2);
}
.tl-season-slot.current .tl-month-num { color: var(--red-deep); font-weight: 700; }
.tl-season-slot:hover { filter: brightness(1.06); transform: translateY(-1px); }
.tl-month-num { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; }
.tl-month-glyph { font-size: 18px; line-height: 1; margin-top: 2px; }

/* Payment slot — arrow-shaped, distinct tone */
.tl-pay {
  position: relative;
  padding: 0 14px 0 22px;
  min-width: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(180deg, rgba(208,99,99,0.35), rgba(159,58,58,0.25));
  border: 1px solid rgba(159,58,58,0.55);
  border-left: none;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%);
  color: var(--ink);
  font-family: var(--font-ui);
  cursor: help;
}
.tl-pay-label { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.tl-pay-costs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.tl-pay-chip {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600;
  padding: 1px 5px; border-radius: 3px;
  background: rgba(244,228,193,0.6);
  border: 1px solid rgba(107,68,35,0.25);
}
.tl-pay-chip img { image-rendering: pixelated; }

/* Upcoming-season slots (right half — simpler) */
.tl-future-slot {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  font-family: var(--font-ui);
  color: var(--ink-2);
  background: rgba(244,228,193,0.35);
  border: 1px dashed rgba(107,68,35,0.3);
  border-radius: 5px;
  padding: 4px 8px;
  cursor: help;
  transition: filter 180ms;
}
.tl-future-slot:hover { filter: brightness(1.05); }
.tl-f-glyph { font-size: 16px; line-height: 1; }
.tl-f-name { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; }

/* ───── EXPEDITION PANEL (in sidebar) ───── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sb-exp { animation: panelIn 260ms cubic-bezier(.2,.8,.2,1); }
.exp-modal {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 12px 14px 14px;
  background: transparent;
}
@keyframes panelIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
.exp-header { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid rgba(201,166,73,0.4); }
.exp-header h2 { margin: 0; font-family: var(--font-title); font-size: 16px; color: var(--ink); letter-spacing: 2px; text-transform: uppercase; }
.exp-ornament { color: var(--gold); font-size: 20px; }

.exp-summary { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding: 8px 10px; background: rgba(228,195,116,0.15); border: 1px solid rgba(201,166,73,0.3); border-radius: 4px; }
.sum-item { display: flex; flex-direction: column; }
.sum-label { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.8px; }
.sum-value { font-family: var(--font-num); font-size: 13px; font-weight: 700; color: var(--ink); }
.sum-value em { font-style: normal; color: var(--ink-3); font-size: 12px; font-weight: 400; }

.exp-section { margin-bottom: 14px; }
.sec-head { display: flex; align-items: center; gap: 8px; font-family: var(--font-title); font-size: 12px; color: var(--ink-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.sec-head strong { color: var(--ink); font-size: 14px; }
.exp-fixed { font-size: 12px; color: var(--ink-2); padding: 6px 10px; background: rgba(228,195,116,0.10); border: 1px solid rgba(201,166,73,0.25); border-radius: 4px; }
.exp-good { color: #2f6f2f; font-weight: 600; }
.exp-warn { color: #b13a2a; font-weight: 600; }
.exp-losses-preview .exp-fixed { background: rgba(201,64,64,0.10); border-color: rgba(201,64,64,0.35); }

/* Expedition departure scene — same visual language as the peuple panel */
.exp-scene {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 8px;
  border: 1.5px solid rgba(201,166,73,0.45);
  overflow: hidden;
  background: linear-gradient(180deg, #f6e4b8 0%, #f0d495 60%, #c8a45c 100%);
  box-shadow: inset 0 -8px 18px rgba(107,68,35,0.18), inset 0 2px 6px rgba(255,255,255,0.35);
  margin-bottom: 8px;
}
.exp-sky {
  position: absolute; left: 0; right: 0; top: 0;
  height: 60%;
  background:
    radial-gradient(circle at 18% 30%, rgba(255,255,255,0.65) 0 6px, transparent 7px),
    radial-gradient(circle at 26% 26%, rgba(255,255,255,0.55) 0 9px, transparent 11px),
    radial-gradient(circle at 78% 22%, rgba(255,255,255,0.55) 0 8px, transparent 10px),
    radial-gradient(circle at 84% 26%, rgba(255,255,255,0.45) 0 7px, transparent 9px);
  pointer-events: none;
  animation: peupleClouds 60s linear infinite;
}
.exp-hills {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 55%;
  background:
    radial-gradient(ellipse 60% 80% at 20% 100%, #6d8a3a 0 60%, transparent 62%),
    radial-gradient(ellipse 70% 90% at 70% 100%, #5d7a30 0 60%, transparent 62%),
    radial-gradient(ellipse 50% 70% at 100% 100%, #506b28 0 60%, transparent 62%),
    linear-gradient(180deg, transparent 0%, #4d6826 50%, #3e561d 100%);
  pointer-events: none;
}
.exp-hills::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 16%;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(60,40,16,0.35) 100%);
}
/* Wagon: pixel-arty horse-drawn covered cart, walking right→left on a loop */
.exp-wagon {
  position: absolute;
  bottom: 18px;
  width: 56px;
  height: 30px;
  background: #c8a45c;
  border: 1.5px solid #6b3f1f;
  border-radius: 6px 6px 2px 2px;
  box-shadow: 1px 2px 0 rgba(0,0,0,0.18);
  pointer-events: none;
  animation: expWagonWalk 18s linear infinite;
  z-index: 1;
}
.exp-wagon::before {
  /* canvas top: lighter dome */
  content: '';
  position: absolute;
  left: 4px; right: 4px;
  top: -8px;
  height: 12px;
  background: #f6e4b8;
  border: 1.5px solid #6b3f1f;
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 -2px 0 rgba(107,68,35,0.18);
}
.exp-wagon::after {
  /* horse silhouette pulling */
  content: '';
  position: absolute;
  left: -22px; bottom: 1px;
  width: 18px; height: 14px;
  background: #5d3b1a;
  border-radius: 30% 50% 30% 30% / 60% 60% 30% 30%;
  box-shadow: -3px 0 0 -2px #5d3b1a, 0 4px 0 -1px rgba(0,0,0,0.18);
}
@keyframes expWagonWalk {
  0%   { transform: translateX(-80px); }
  100% { transform: translateX(calc(100% + 30px)); }
}
.exp-sprites {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Counters under the scene */
.exp-counts {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.exp-count {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(228,195,116,0.15);
  border: 1px solid rgba(201,166,73,0.35);
  border-radius: 4px;
  font-size: 12px;
}
.exp-count .ec-icon { font-size: 16px; }
.exp-count .ec-num { font-family: var(--font-num); font-size: 16px; font-weight: 700; color: var(--ink); }
.exp-count .ec-cap { color: var(--ink-3); font-size: 11px; margin-left: 6px; }

.jauge { position: relative; height: 32px; background: rgba(107,68,35,0.12); border: 1.5px solid var(--ink-2); border-radius: 6px; cursor: ew-resize; overflow: visible; user-select: none; }
.jauge-fill { position: absolute; top: 0; bottom: 0; }
.jauge-fill.exp { left: 0; background: linear-gradient(180deg, var(--gold-light), var(--gold)); }
.jauge-fill.fighters { left: 0; background: linear-gradient(180deg, #C94040, var(--red)); }
.jauge-handle { position: absolute; top: -4px; bottom: -4px; width: 6px; background: var(--ink); border: 1.5px solid var(--gold-light); border-radius: 3px; transform: translateX(-50%); box-shadow: 0 2px 6px rgba(0,0,0,0.3); cursor: ew-resize; }
.jauge-labels { position: absolute; top: 6px; left: 8px; right: 8px; display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ink); pointer-events: none; text-shadow: 0 1px 2px rgba(244,228,193,0.8); }
.jauge-labels strong { font-family: var(--font-num); font-size: 14px; }
.jauge .jauge-cap {
  position: absolute; top: -3px; bottom: -3px; width: 0;
  border-left: 2px dashed rgba(107,68,35,0.55);
  pointer-events: none;
  z-index: 1;
}
.sec-sub {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 6px;
}

/* Per-cell assignment overlay over the selected zone */
.exp-assign { z-index: 4; }
.exp-cell {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  pointer-events: none;
  transition: background 80ms linear, border-color 80ms linear;
}
.exp-cell-civ {
  background: rgba(228,195,116,0.32);
  border: 1.5px solid rgba(228,195,116,0.85);
  box-shadow: inset 0 0 6px rgba(255,230,160,0.35);
}
.exp-cell-sol {
  background: rgba(201,64,64,0.32);
  border: 1.5px solid rgba(201,64,64,0.85);
  box-shadow: inset 0 0 6px rgba(255,140,140,0.35);
}
.exp-cell-idle {
  background: rgba(60,40,30,0.18);
  border: 1px dashed rgba(60,40,30,0.4);
}

/* Single combined gauge — civils + soldats + slack (château) */
.jauge2 {
  position: relative;
  height: 30px;
  background: rgba(107,68,35,0.10);
  border: 1.5px solid var(--ink-2);
  border-radius: 6px;
  user-select: none;
  cursor: ew-resize;
  overflow: visible;
}
.jauge2 .j2-track {
  position: absolute; inset: 0;
  border-radius: 5px;
  pointer-events: none;
}
.jauge2 .j2-tick {
  position: absolute; top: 4px; bottom: 4px; width: 1px;
  background: rgba(107,68,35,0.18);
  transform: translateX(-0.5px);
}
.jauge2 .j2-fill {
  position: absolute; top: 0; bottom: 0;
  pointer-events: none;
  transition: width 60ms linear, left 60ms linear;
}
.jauge2 .j2-civils {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}
.jauge2 .j2-soldiers {
  background: linear-gradient(180deg, #C94040, var(--red));
  box-shadow: inset 1px 0 0 rgba(255,255,255,0.35);
}
.jauge2 .j2-cap {
  position: absolute; top: -3px; bottom: -3px; width: 0;
  border-left: 2px dashed rgba(107,68,35,0.5);
  pointer-events: none;
}
.jauge2 .j2-handle {
  position: absolute; top: -5px; bottom: -5px; width: 8px;
  background: var(--ink);
  border: 1.5px solid var(--gold-light);
  border-radius: 3px;
  transform: translateX(-50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: ew-resize;
  transition: left 60ms linear;
}
.jauge2 .j2-handle::before,
.jauge2 .j2-handle::after {
  content: '';
  position: absolute;
  left: 2px; right: 2px;
  height: 1px;
  background: rgba(244,228,193,0.55);
}
.jauge2 .j2-handle::before { top: 35%; }
.jauge2 .j2-handle::after  { top: 60%; }
.jauge2-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
}
.sec-sub {
  float: right;
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
}

.cost-row { display: flex; gap: 8px; padding: 4px 0; flex-wrap: wrap; }
.cost-badge { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: rgba(228,195,116,0.2); border: 1px solid rgba(201,166,73,0.4); border-radius: 6px; }
.cost-badge img { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.cost-val { font-family: var(--font-num); font-weight: 700; font-size: 15px; color: var(--red); }
.cost-have { font-family: var(--font-num); font-size: 10px; color: var(--ink-3); }
.cost-badge.insufficient { border-color: var(--red); background: rgba(168,40,40,0.15); animation: shake 400ms; }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-3px);} 75% { transform: translateX(3px);} }

.exp-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(201,166,73,0.4); }
.btn { font-family: var(--font-title); font-size: 12px; padding: 8px 14px; border: 2px solid var(--ink-2); border-radius: 5px; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; transition: all 180ms; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(107,68,35,0.1); color: var(--ink); }
.btn-primary { background: linear-gradient(180deg, var(--gold-light), var(--gold)); border-color: var(--gold-deep); color: var(--ink); box-shadow: 0 4px 0 var(--gold-deep), 0 6px 12px rgba(138,106,32,0.4); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 0 var(--gold-deep), 0 8px 16px rgba(138,106,32,0.5); }
.btn-primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-deep); }
.btn-primary:disabled { background: var(--parchment-3); border-color: var(--ink-3); color: var(--ink-3); cursor: not-allowed; box-shadow: none; }

/* ───── FLYING RESOURCES ───── */
.flight-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.flying { position: absolute; display: flex; flex-direction: column; align-items: center; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4)); will-change: transform; }
.flying .fly-icon { width: 36px; height: 36px; object-fit: contain; image-rendering: pixelated; }
.sign-plus .fly-icon { width: 44px; height: 44px; filter: drop-shadow(0 0 12px var(--gold-light)); }
.fly-label { font-family: var(--font-num); font-weight: 700; font-size: 13px; padding: 1px 7px; border-radius: 10px; margin-top: -4px; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.sign-minus .fly-label { background: var(--red); color: white; }
.sign-plus .fly-label { background: var(--gold); color: var(--ink); font-size: 14px; }

/* ───── CEREMONY ───── */
.ceremony-backdrop { position: fixed; inset: 0; background: rgba(26,15,8,0.75); z-index: 300; display: flex; align-items: center; justify-content: center; animation: fadeIn 300ms; }
.ceremony { background: linear-gradient(180deg, var(--parchment), var(--parchment-2)); border: 4px double var(--gold); border-radius: 10px; width: 540px; max-height: 85vh; overflow-y: auto; padding: 28px 34px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); animation: panelIn 400ms cubic-bezier(.2,.8,.2,1); }
.ceremony h2 { font-family: var(--font-title); text-align: center; font-size: 24px; color: var(--ink); letter-spacing: 3px; margin: 0 0 20px; }
.ceremony-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed rgba(107,68,35,0.2); animation: lineFade 400ms ease-out backwards; }
@keyframes lineFade { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
.ceremony-line b { font-family: var(--font-num); }
.ceremony-line .costs { display:flex; gap: 6px; align-items: center; }
.ceremony-line .costs img { width: 18px; height: 18px; image-rendering: pixelated; }
.ceremony-verdict { text-align: center; margin-top: 20px; padding: 20px; border-radius: 8px; font-family: var(--font-title); font-size: 22px; letter-spacing: 2px; }
.ceremony-verdict.ok { background: rgba(106,138,74,0.15); border: 2px solid var(--green); color: var(--green-deep); }
.ceremony-verdict.bad { background: rgba(168,40,40,0.15); border: 2px solid var(--red); color: var(--red-deep); animation: shake 500ms; }

/* ───── GAME OVER ───── */
.gameover-backdrop { position: fixed; inset: 0; background: rgba(26,15,8,0.92); z-index: 400; display: flex; align-items: center; justify-content: center; animation: fadeIn 600ms; }
.gameover { background: linear-gradient(180deg, var(--parchment), var(--parchment-2)); border: 4px double var(--red); border-radius: 10px; width: 520px; padding: 36px; text-align: center; box-shadow: 0 30px 80px rgba(168,40,40,0.5); }
.gameover h1 { font-family: var(--font-title); font-size: 32px; color: var(--red-deep); letter-spacing: 4px; margin: 0 0 8px; }
.gameover h2 { font-family: var(--font-title); font-size: 16px; color: var(--ink-2); margin: 0 0 20px; font-weight: 400; }
.go-stats { background: rgba(228,195,116,0.2); border: 1px solid var(--gold); border-radius: 6px; padding: 16px; margin-bottom: 20px; text-align: left; }
.go-stat { display:flex; justify-content:space-between; padding: 4px 0; }

/* ───── TOASTS ───── */
.toast-wrap { position: fixed; top: 80px; right: 16px; z-index: 250; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--parchment); border: 2px solid var(--gold); border-left-width: 6px; border-radius: 6px; padding: 10px 16px; min-width: 240px; max-width: 320px; box-shadow: 0 8px 24px rgba(45,24,16,0.3); animation: toastIn 250ms cubic-bezier(.2,.8,.2,1); }
.toast.good { border-left-color: var(--green); }
.toast.bad { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
.toast strong { font-family: var(--font-title); font-size: 14px; color: var(--ink); letter-spacing: 0.5px; display: block; margin-bottom: 2px; }
.toast span { font-size: 12px; color: var(--ink-2); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
.toast.fade-out { animation: toastOut 300ms forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ───── Cell tooltip ───── */
.cell-tooltip { position: absolute; background: var(--parchment); border: 1px solid var(--gold); border-radius: 4px; padding: 6px 10px; font-size: 12px; pointer-events: none; z-index: 90; box-shadow: 0 2px 8px rgba(45,24,16,0.2); min-width: 120px; transform: translate(12px, -100%); }
.cell-tooltip-title { font-family: var(--font-title); font-size: 13px; font-weight: 600; color: var(--ink); }
.cell-tooltip-sub { font-family: var(--font-num); font-size: 10px; color: var(--ink-3); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════
   COUR ROYALE — SIDEBAR DROITE
   ═══════════════════════════════════════════════════════════════ */

.sidebar-right {
  width: 340px;
  flex-shrink: 0;
  height: 100%;
  background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-2) 100%);
  border-left: 2px solid var(--gold);
  box-shadow: inset 1px 0 0 rgba(228,195,116,0.3), -6px 0 14px rgba(45,24,16,0.28);
  display: flex;
  flex-direction: column;
  z-index: 3;
  min-height: 0;
  position: relative;
  transition: width 260ms cubic-bezier(.4,.0,.2,1);
}
.sidebar-right.collapsed {
  width: 40px;
}
.sidebar-right.collapsed .sb-r-head,
.sidebar-right.collapsed .sb-r-body {
  display: none;
}
.sidebar-right.collapsed .sb-r-reopen {
  display: flex !important;
}

.sb-r-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 16px;
  border-bottom: 2px solid var(--gold-deep);
  background: linear-gradient(180deg, rgba(228,195,116,0.35), rgba(201,166,73,0.12));
  box-shadow: inset 0 1px 0 rgba(255,240,200,0.4);
}
.sb-r-title {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink);
}
.sb-r-collapse {
  background: none;
  border: 1px solid rgba(107,68,35,0.3);
  color: var(--ink-2);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.sb-r-collapse:hover {
  background: rgba(228,195,116,0.5);
  border-color: var(--gold);
  color: var(--ink);
}

.sb-r-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Reopen tab, only visible when collapsed. Fills the collapsed sidebar width. */
.sb-r-reopen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  padding: 16px 0;
  cursor: pointer;
  color: var(--ink-2);
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  transition: background 140ms, color 140ms;
}
.sb-r-reopen:hover {
  color: var(--ink);
  background: rgba(228,195,116,0.25);
}
.sb-r-reopen-ico { font-size: 20px; filter: drop-shadow(0 2px 3px rgba(45,24,16,0.25)); }
.sb-r-reopen-lbl {
  font-weight: 700;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  line-height: 1;
}

/* Panel Conseil (grid area) */
.panel-conseil {
  flex: 0 0 auto;
  padding: 0;
  border-bottom: 1px solid rgba(107,68,35,0.25);
}
.conseil-head, .cour-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 14px 8px;
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink);
}
.conseil-head-hint, .cour-head-hint {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: none;
  color: var(--ink-3);
}

.conseil-grid-wrap {
  padding: 4px 14px 14px;
}
.conseil-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  background: rgba(107,68,35,0.12);
  border: 1.5px solid var(--gold-deep);
  border-radius: 6px;
  box-shadow: inset 0 2px 6px rgba(45,24,16,0.15);
}

/* Panel Cour (bench area) */
.panel-cour {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.cour-bench-wrap {
  padding: 4px 14px 14px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.cour-bench-wrap::-webkit-scrollbar { width: 6px; }
.cour-bench-wrap::-webkit-scrollbar-thumb { background: rgba(107,68,35,0.25); border-radius: 3px; }
.cour-bench {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  background: rgba(107,68,35,0.08);
  border: 1.5px dashed var(--gold-deep);
  border-radius: 6px;
}

/* Slot (empty or occupied) */
.court-slot {
  aspect-ratio: 1 / 1;
  position: relative;
  background: rgba(244,228,193,0.55);
  border: 1.5px solid rgba(201,166,73,0.5);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 140ms, background 140ms, transform 140ms, box-shadow 140ms;
  cursor: grab;
  overflow: hidden;
}
.court-slot.empty {
  background: rgba(244,228,193,0.2);
  border-style: dashed;
  border-color: rgba(201,166,73,0.35);
  cursor: default;
}
.court-slot.empty::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(107,68,35,0.2);
}
.court-slot.drag-over {
  border-color: var(--gold);
  background: rgba(228,195,116,0.55);
  box-shadow: 0 0 0 2px rgba(201,166,73,0.35), 0 0 10px rgba(228,195,116,0.4);
  transform: scale(1.03);
}
.court-slot.dragging {
  opacity: 0.3;
}
.court-slot:not(.empty):hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(45,24,16,0.18);
}
.court-slot:not(.empty):active { cursor: grabbing; }

/* Unit card inside a slot */
.unit-card {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  pointer-events: none; /* slot handles events */
}
.unit-portrait {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: radial-gradient(circle at 35% 30%, var(--parchment), var(--parchment-2) 65%, var(--parchment-3));
  border: 2px solid var(--gold-deep);
  box-shadow: inset 0 2px 3px rgba(138,106,32,0.2), 0 1px 3px rgba(45,24,16,0.22);
}
.unit-name {
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unit-stars {
  display: flex;
  gap: 1px;
  height: 8px;
  font-size: 8px;
  line-height: 1;
  color: var(--gold-deep);
}
.unit-stars .star.on { color: var(--gold); text-shadow: 0 0 3px rgba(201,166,73,0.6); }

/* Rarity halos */
.court-slot.rarity-common  { border-color: rgba(107,68,35,0.55); }
.court-slot.rarity-rare    { border-color: var(--blue); box-shadow: inset 0 0 0 1px rgba(61,125,181,0.2); }
.court-slot.rarity-legendary {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(201,166,73,0.4), 0 0 8px rgba(228,195,116,0.35);
}
.court-slot.rarity-rare .unit-portrait { border-color: var(--blue); }
.court-slot.rarity-legendary .unit-portrait {
  border-color: var(--gold);
  background: radial-gradient(circle at 35% 30%, #FFF6D8, var(--gold-light) 60%, var(--gold));
}

/* Fragility ring */
.unit-portrait.fragile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed rgba(168,40,40,0.5);
  pointer-events: none;
}
.unit-portrait { position: relative; }

/* Bench units: 20% passive visualisation — slightly dimmed */
.cour-bench .court-slot:not(.empty) {
  background: rgba(244,228,193,0.35);
}
.cour-bench .court-slot:not(.empty) .unit-portrait {
  filter: saturate(0.8) brightness(0.97);
}

/* Floating tooltip */
.unit-tooltip {
  position: fixed;
  z-index: 420; /* above report (310), ceremony (300), and drag ghost */
  background: var(--parchment);
  border: 2px solid var(--gold);
  border-radius: 6px;
  padding: 10px 12px;
  min-width: 200px;
  max-width: 260px;
  box-shadow: 0 8px 20px rgba(45,24,16,0.3);
  font-size: 12px;
  color: var(--ink-2);
  pointer-events: none;
  animation: toastIn 180ms cubic-bezier(.2,.8,.2,1);
}
.unit-tooltip .ut-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.unit-tooltip .ut-rarity {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid rgba(107,68,35,0.3);
  background: rgba(244,228,193,0.7);
}
.unit-tooltip .ut-rarity.common    { color: var(--ink-2); }
.unit-tooltip .ut-rarity.rare      { color: var(--blue); border-color: var(--blue); }
.unit-tooltip .ut-rarity.legendary { color: var(--gold-deep); border-color: var(--gold); background: rgba(228,195,116,0.4); }
.unit-tooltip .ut-role {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.unit-tooltip .ut-effect { margin-top: 4px; line-height: 1.4; }
.unit-tooltip .ut-effect b { color: var(--ink); font-family: var(--font-title); font-size: 11px; letter-spacing: 0.4px; }
.unit-tooltip .ut-stars { font-family: var(--font-num); color: var(--gold-deep); font-size: 10px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(201,166,73,0.3); }

/* Drag ghost */
.unit-drag-ghost {
  position: fixed;
  z-index: 410; /* above report (310) and tooltip (420 hides while dragging) */
  pointer-events: none;
  width: 70px; height: 70px;
  border-radius: 8px;
  background: var(--parchment);
  border: 2px solid var(--gold);
  /* Lift shadow — bigger and softer to suggest the slot is hovering above the card. */
  box-shadow:
    0 14px 28px rgba(45,24,16,0.45),
    0 22px 40px rgba(45,24,16,0.25),
    0 0 0 1px rgba(228,195,116,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  transform: translate(-50%, -50%) rotate(-3deg) scale(1.06);
  opacity: 0.95;
  transition: filter 140ms, background 140ms, border-color 140ms;
}
/* Banish state: dragging a court unit outside the right sidebar */
.unit-drag-ghost.banish {
  background: rgba(180, 60, 50, 0.92);
  border-color: rgba(120, 30, 20, 0.95);
  filter: hue-rotate(-20deg) drop-shadow(0 0 16px rgba(220,80,60,0.7));
  color: rgba(255,235,225,1);
}
.unit-drag-ghost.banish::after {
  content: '🗑️';
  position: absolute;
  top: -22px;
  right: -10px;
  font-size: 22px;
  background: rgba(255,255,255,0.95);
  border: 2px solid rgba(180,60,50,1);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
/* Founder marker on the unit slot itself */
.court-slot[data-founder="1"]::after {
  content: '⚜';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 12px;
  color: var(--gold-deep);
  text-shadow: 0 0 4px rgba(228,195,116,0.7);
  pointer-events: none;
  z-index: 2;
}
.ut-founder {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--gold-deep);
  margin: 4px 0 6px;
  padding: 4px 8px;
  background: linear-gradient(180deg, rgba(255,240,200,0.95), rgba(228,195,116,0.7));
  border-radius: 4px;
  text-align: center;
  text-transform: uppercase;
}
/* While a court unit is being dragged, hide the hover tooltip so it doesn't fight the ghost. */
body.court-dragging .unit-tooltip { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   COUR ROYALE — Écran de rapport post-expédition
   The overlay uses a low-opacity backdrop so the right sidebar (Conseil / Cour)
   stays readable: the player drags from the report's bench directly into a
   slot. Drops that displace a unit push the evicted back to the bench.
   ═══════════════════════════════════════════════════════════════ */
.court-offer-backdrop {
  position: fixed; inset: 0;
  background: transparent;
  z-index: 310; /* above ceremony (300), below game-over (400) */
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 88px; /* sits below the topbar with a small breathing gap */
  animation: fadeIn 260ms;
  /* Backdrop never blocks input — only the card itself catches events. */
  pointer-events: none;
}
.court-offer-backdrop > * { pointer-events: auto; }
/* Highlighted aura when units await placement on the bench. */
.exp-report.has-offer {
  box-shadow: 0 0 0 2px rgba(228,195,116,0.7), 0 0 32px rgba(228,195,116,0.55), 0 8px 24px rgba(0,0,0,0.35);
  animation: erOfferPulse 2.4s ease-in-out infinite;
}
@keyframes erOfferPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(228,195,116,0.7), 0 0 24px rgba(228,195,116,0.45), 0 8px 24px rgba(0,0,0,0.35); }
  50%      { box-shadow: 0 0 0 2px rgba(228,195,116,0.85), 0 0 40px rgba(228,195,116,0.7), 0 8px 24px rgba(0,0,0,0.35); }
}
/* X close button in the report corner. */
.exp-report .er-close {
  position: absolute;
  top: 8px; right: 10px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--ink-2);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.exp-report .er-close:hover { background: rgba(107,68,35,0.12); border-color: rgba(107,68,35,0.3); color: var(--ink); }
.exp-report { position: relative; }
/* Countdown ring in the bottom-right corner of the card. */
.exp-report .er-countdown {
  position: absolute;
  right: 10px; bottom: 10px;
  width: 22px; height: 22px;
  pointer-events: none;
  opacity: 0.75;
}
.exp-report .er-countdown svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.exp-report .er-countdown circle.bg { fill: var(--parchment); stroke: rgba(107,68,35,0.3); stroke-width: 2; }
.exp-report .er-countdown circle.fg { fill: none; stroke: var(--gold-deep); stroke-width: 2.5; stroke-linecap: round; transition: stroke-dashoffset 100ms linear; }

.exp-report {
  width: 460px; max-width: 92vw;
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2));
  border: 4px double var(--gold);
  border-radius: 12px;
  padding: 20px 26px 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55);
  animation: panelIn 420ms cubic-bezier(.2,.8,.2,1);
}
.exp-report .er-header {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 14px;
}
.exp-report .er-header h2 {
  font-family: var(--font-title);
  font-size: 22px; font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--ink);
  margin: 0;
}
.exp-report .er-orn {
  font-size: 18px; opacity: 0.6;
}
.exp-report .er-gains {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 20px;
  padding: 12px 10px;
  background: rgba(244,228,193,0.55);
  border: 1px solid rgba(201,166,73,0.35);
  border-radius: 8px;
  margin-bottom: 10px;
}
.exp-report .er-gain {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-num);
  font-size: 16px; font-weight: 700;
  color: var(--ink);
}
.exp-report .er-gain img { width: 22px; height: 22px; image-rendering: pixelated; }
.exp-report .er-meager {
  font-style: italic; color: var(--ink-3); font-size: 13px;
}
.exp-report .er-losses {
  text-align: center; font-size: 12px; color: var(--red-deep);
  margin-bottom: 10px;
}
.exp-report .er-list {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(244,228,193,0.4);
  border: 1px solid rgba(201,166,73,0.25);
}
.exp-report .er-list-title {
  font-family: var(--font-title);
  font-size: 11px; letter-spacing: 1px;
  color: var(--ink-2);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.exp-report .er-row {
  display: flex; justify-content: space-between;
  font-size: 12px;
  color: var(--ink-2);
  padding: 3px 0;
}
.exp-report .er-row .er-row-sub {
  font-size: 11px; color: var(--ink-3); font-family: var(--font-num); font-weight: 600;
}
.exp-report .er-row.er-good .er-row-sub { color: var(--gold-deep); }
.exp-report .er-row.er-bad { color: var(--red-deep); }
.exp-report .er-row.er-warn { color: #8a6d2a; }

.exp-report .er-bench-panel {
  margin-top: 14px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(228,195,116,0.22), rgba(228,195,116,0.10));
  border: 2px solid var(--gold);
  border-radius: 10px;
}
.exp-report .er-bench-title {
  font-family: var(--font-title);
  font-size: 13px; letter-spacing: 0.6px;
  color: var(--ink);
  text-align: center;
  margin-bottom: 2px;
}
.exp-report .er-bench-hint {
  font-size: 11px; color: var(--ink-3); font-style: italic;
  text-align: center;
  margin-bottom: 8px;
}
.exp-report .er-bench-hint b { color: var(--ink-2); font-style: normal; }
.exp-report .er-bench {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding: 4px;
}
.exp-report .er-actions {
  display: flex; justify-content: center;
  margin-top: 16px;
}
.exp-report .er-actions .btn { min-width: 140px; }

/* Live deployment highlight on conseil slots while the expé panel is open */
.court-slot.will-deploy {
  outline: 3px solid var(--gold);
  outline-offset: -1px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.4) inset, 0 0 18px rgba(228,195,116,0.45);
  position: relative;
}
.court-slot.will-deploy::after {
  content: '⚔';
  position: absolute;
  top: -5px; right: -5px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gold-deep);
  color: var(--parchment);
  font-size: 10px; line-height: 16px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Injured portrait: desaturated + warning aura */
.unit-portrait.injured {
  filter: grayscale(0.65) brightness(0.9);
}
.unit-portrait.injured::after {
  content: '🩹';
  position: absolute;
  bottom: -4px; right: -4px;
  font-size: 14px;
  pointer-events: none;
}

/* Streak aura — subtle glow scaling with star count (veterans shine) */
.court-slot[data-stars="2"] .unit-portrait {
  box-shadow: 0 0 8px rgba(228,195,116,0.35);
}
.court-slot[data-stars="3"] .unit-portrait {
  box-shadow: 0 0 10px rgba(228,195,116,0.55);
}
.court-slot[data-stars="4"] .unit-portrait,
.court-slot[data-stars="5"] .unit-portrait {
  box-shadow: 0 0 14px rgba(228,195,116,0.75), 0 0 2px rgba(255,230,160,0.8) inset;
  animation: streakPulse 2.6s ease-in-out infinite;
}
@keyframes streakPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(228,195,116,0.55), 0 0 2px rgba(255,230,160,0.6) inset; }
  50%      { box-shadow: 0 0 18px rgba(255,210,120,0.85), 0 0 3px rgba(255,230,160,0.95) inset; }
}

/* ═══════════════════════════════════════════════════════════════
   LE PEUPLE — village vivant
   ═══════════════════════════════════════════════════════════════ */
.panel-peuple {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-top: 1px solid rgba(107,68,35,0.18);
}
.peuple-head {
  background: linear-gradient(180deg, rgba(107,68,35,0.10) 0%, rgba(107,68,35,0.04) 100%);
}
.peuple-head-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-1);
}
.peuple-scene-wrap {
  padding: 8px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.peuple-scene {
  position: relative;
  width: 100%;
  height: 110px;
  border-radius: 8px;
  border: 1.5px solid rgba(201,166,73,0.45);
  overflow: hidden;
  background: linear-gradient(180deg, #f6e4b8 0%, #f0d495 60%, #c8a45c 100%);
  box-shadow: inset 0 -8px 18px rgba(107,68,35,0.18), inset 0 2px 6px rgba(255,255,255,0.35);
}
.peuple-sky {
  position: absolute; left: 0; right: 0; top: 0;
  height: 60%;
  background:
    radial-gradient(circle at 18% 30%, rgba(255,255,255,0.65) 0 6px, transparent 7px),
    radial-gradient(circle at 26% 26%, rgba(255,255,255,0.55) 0 9px, transparent 11px),
    radial-gradient(circle at 22% 32%, rgba(255,255,255,0.5) 0 7px, transparent 9px),
    radial-gradient(circle at 78% 22%, rgba(255,255,255,0.55) 0 8px, transparent 10px),
    radial-gradient(circle at 84% 26%, rgba(255,255,255,0.45) 0 7px, transparent 9px);
  pointer-events: none;
  animation: peupleClouds 60s linear infinite;
}
@keyframes peupleClouds {
  0% { transform: translateX(0); }
  100% { transform: translateX(-12%); }
}
.peuple-hills {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 55%;
  background:
    radial-gradient(ellipse 60% 80% at 20% 100%, #6d8a3a 0 60%, transparent 62%),
    radial-gradient(ellipse 70% 90% at 70% 100%, #5d7a30 0 60%, transparent 62%),
    radial-gradient(ellipse 50% 70% at 100% 100%, #506b28 0 60%, transparent 62%),
    linear-gradient(180deg, transparent 0%, #4d6826 50%, #3e561d 100%);
  pointer-events: none;
}
.peuple-hills::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 16%;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(60,40,16,0.35) 100%);
}
.peuple-houses, .peuple-sprites {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 100%;
  pointer-events: none;
}
/* Pixel-art-ish little house */
.p-house {
  position: absolute;
  bottom: 18px;
  width: 22px;
  height: 22px;
  background: #c08552;
  border: 1.5px solid #6b3f1f;
  border-radius: 1px 1px 0 0;
  box-shadow: 1px 1px 0 rgba(0,0,0,0.18);
  image-rendering: pixelated;
}
.p-house::before {
  /* roof */
  content: '';
  position: absolute;
  left: -3px; right: -3px;
  top: -10px;
  height: 12px;
  background: #7a3d22;
  clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.18));
}
.p-house::after {
  /* door */
  content: '';
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 7px; height: 11px;
  background: #4a2814;
  border-radius: 2px 2px 0 0;
}
/* Caserne: stone walls + flag */
.p-house.barracks {
  background: #9a8e7a;
  border-color: #4a4035;
  height: 26px;
  width: 26px;
}
.p-house.barracks::before {
  background: #4a4035;
  height: 8px;
  top: -8px;
  clip-path: polygon(0% 100%, 12% 0%, 88% 0%, 100% 100%);
}
.p-house.barracks .p-flag {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 2px;
  height: 14px;
  background: #4a2814;
  transform: translateX(-50%);
}
.p-house.barracks .p-flag::after {
  content: '';
  position: absolute;
  left: 2px; top: 0;
  width: 8px; height: 5px;
  background: #b54a3a;
  clip-path: polygon(0 0, 100% 0, 80% 50%, 100% 100%, 0 100%);
  animation: peupleFlagWave 2.2s ease-in-out infinite;
  transform-origin: left center;
}
@keyframes peupleFlagWave {
  0%, 100% { transform: skewX(-3deg); }
  50%      { transform: skewX(8deg); }
}

/* Sprites (civilians + soldiers) */
.p-sprite {
  position: absolute;
  bottom: 16px;
  width: 8px;
  height: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  image-rendering: pixelated;
  animation-name: peupleWalk, peupleBob;
  animation-duration: var(--walk-dur, 14s), 0.4s;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
  animation-direction: alternate, alternate;
  animation-delay: var(--walk-delay, 0s), 0s;
}
.p-sprite .p-head {
  width: 5px; height: 5px;
  background: #f1c499;
  border: 1px solid #6b3f1f;
  border-radius: 50%;
}
.p-sprite .p-body {
  width: 7px; height: 7px;
  margin-top: 1px;
  border: 1px solid #6b3f1f;
}
.p-sprite.civ .p-body { background: var(--civ-color, #6f9bd8); }
.p-sprite.sol .p-body { background: #6e7470; }
.p-sprite.sol .p-head { background: #d8b88a; }
.p-sprite.sol::after {
  /* spear */
  content: '';
  position: absolute;
  right: -2px; top: -3px;
  width: 1px; height: 16px;
  background: #4a2814;
}
@keyframes peupleWalk {
  0%   { left: var(--walk-from, 8%); transform: scaleX(1); }
  49%  { transform: scaleX(1); }
  50%  { transform: scaleX(-1); }
  100% { left: var(--walk-to, 88%); transform: scaleX(-1); }
}
@keyframes peupleBob {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -1px; }
}

.peuple-counts {
  display: flex;
  gap: 12px;
  justify-content: space-around;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--ink-1);
}
.peuple-count {
  display: flex; align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(244,228,193,0.5);
  border: 1px solid rgba(201,166,73,0.4);
  border-radius: 5px;
  flex: 1;
  justify-content: center;
}
.peuple-count.full {
  border-color: rgba(180,80,60,0.45);
  background: rgba(220,180,160,0.4);
}
.pc-icon { font-size: 14px; }
.pc-sep { color: var(--ink-3); margin: 0 2px; }

/* Drop target highlight */
.peuple-scene.drop-target {
  outline: 3px solid rgba(228,195,116,0.85);
  outline-offset: -2px;
  box-shadow: inset 0 0 24px rgba(228,195,116,0.45), 0 0 18px rgba(228,195,116,0.4);
}
.peuple-scene.drop-invalid {
  outline: 3px solid rgba(180,80,60,0.7);
  outline-offset: -2px;
}

/* Encounter card on the offer bench (v3) — overlays cost + archetype badges */
.court-slot.encounter {
  position: relative;
  overflow: visible;
}
.enc-arch {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(107,68,35,0.4);
  z-index: 2;
  pointer-events: auto;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.enc-arch.arch-sol { background: rgba(180,180,200,0.92); }
.enc-cost {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 5px;
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-1);
  background: rgba(255,236,180,0.95);
  border: 1px solid rgba(180,140,60,0.7);
  border-radius: 6px;
  z-index: 2;
  pointer-events: auto;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.enc-cost.cant {
  background: rgba(220,170,160,0.9);
  color: rgba(140,40,30,0.95);
  border-color: rgba(180,80,60,0.7);
}
.enc-cost.free {
  background: linear-gradient(180deg, rgba(255,240,200,0.95), rgba(228,195,116,0.92));
  font-size: 10px;
  letter-spacing: 0.04em;
}
.enc-cost-amt { line-height: 1; }
.court-slot.forced-refused {
  filter: grayscale(0.9) brightness(0.85);
  opacity: 0.6;
  cursor: not-allowed !important;
}
.court-slot.forced-refused .unit-card { opacity: 0.5; }
.enc-forced {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  font-family: 'Manrope', sans-serif;
  font-size: 9px;
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(140,40,30,0.95);
  background: rgba(255,255,255,0.85);
  border-radius: 4px;
  padding: 2px 0;
  z-index: 3;
}
/* When a forced-refused card has the forced overlay, hide the cost badge so they don't stack */
.court-slot.forced-refused .enc-cost { display: none; }
