/* CEO CITY — UI implementation of "CEO City UI.dc.html" (claude.ai/design)
   Design system: Itim (Thai-first rounded display + UI) · cream panels on ink
   outlines with chunky offset shadows · flat bright palette. */

/* Itim bundled locally (fonts/) so it works offline — no Google Fonts CDN.
   Single weight (400); heavier weights render as synthetic bold. */
@font-face { font-family: 'Itim'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/itim-thai.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Itim'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/itim-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Itim'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/itim-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #21303A;
  --cream: #FFF8EC;
  --grass: #7CC356;
  --sky: #8ED4F2;
  --dimgreen: #5f8f47;
  --green: #53B94E;
  --green-t: #3C9A37;
  --yellow: #FFD95C;
  --blue: #5FB8EF;
  --blue-d: #2A78B8;
  --orange: #FF9F1C;
  --house: #FFB05C;
  --purple: #B584E8;
  --purple-d: #8A5FC0;
  --coral: #FF6B57;
  --coral-l: #FF8177;
  --red: #C0392B;
  --red-t: #E05545;
  --mut: #8A9086;
  --mut2: #6B7B72;
  --mut3: #5B6E63;
  --track: #E7E1D2;
  --track2: #F1ECDD;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body { font-family: 'Itim', system-ui, sans-serif; color: var(--ink); background: var(--ink); }
.fredoka { font-family: 'Itim', sans-serif; }
.hidden { display: none !important; }

/* ── screens ─────────────────────────────── */
.screen { position: fixed; inset: 0; overflow: hidden; }
#s-title, #s-province { background: var(--sky) url(assets/background.webp) center/cover no-repeat; }
#s-title .iso-wrap { display: none; }   /* real backdrop image replaces the CSS iso placeholder */
#s-game { background: var(--grass); }
#s-election { background: var(--ink); }

/* ── shared components ───────────────────── */
.panel {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
}
.btn {
  font-family: 'Itim', sans-serif; font-weight: 600;
  border: 3px solid var(--ink); border-radius: 14px;
  text-align: center; cursor: pointer; user-select: none;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .05s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn-green { background: var(--green); color: #fff; }
.btn-cream { background: var(--cream); color: var(--ink); }
.btn-white { background: #fff; color: var(--ink); }
.btn-purple { background: var(--purple-d); color: #fff; }
.pill {
  display: inline-block; font-size: 11px; font-weight: 800;
  border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px;
}
.bar {
  height: 9px; border: 2px solid var(--ink); border-radius: 99px;
  background: #fff; overflow: hidden;
}
.bar > div { height: 100%; }
.xbtn {
  width: 34px; height: 34px; border: 2.5px solid var(--ink); border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; cursor: pointer; flex: none;
}

/* satisfaction ring */
.ring { position: relative; flex: none; }
.ring svg { display: block; width: 100%; height: 100%; }
.ring-txt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'Itim', sans-serif; font-weight: 600; color: var(--ink);
}

/* 3D viewport (Three.js) */
#c3d { position: absolute; inset: 0; z-index: 0; touch-action: none; }
#c3d canvas { display: block; }

/* juice: floating cost/gain deltas that rise from the edited tile */
.float-pop {
  position: absolute; transform: translate(-50%, -50%);
  font: 700 20px 'Itim', sans-serif; white-space: nowrap;
  pointer-events: none; z-index: 5; text-shadow: 0 2px 5px rgba(0, 0, 0, .35);
  animation: float-up 1s ease-out forwards;
}
.float-pop.spend { color: var(--red-t); }
.float-pop.gain  { color: var(--green-t); }
@keyframes float-up {
  0%   { opacity: 0; transform: translate(-50%, -40%)  scale(.6); }
  20%  { opacity: 1; transform: translate(-50%, -65%)  scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -165%) scale(1); }
}
/* juice: HUD numbers pulse when they change */
@keyframes val-bump { 0%, 100% { transform: none; } 30% { transform: scale(1.22); } }
.bump { animation: val-bump .35s ease-out; }

/* isometric CSS placeholder (title screen backdrop only) */
.iso-wrap { position: absolute; left: 54%; top: 56%; transform: translate(-50%,-50%) scale(1.9,1.1) rotate(45deg); }
.iso-grid { width: 512px; display: flex; flex-wrap: wrap; transform: scale(1,.577); }
.iso-grid > div { width: 32px; height: 32px; }
.viewport-hint {
  position: absolute; left: 52%; top: 44%; transform: translateX(-50%);
  font: 600 12px ui-monospace, Menlo, monospace; color: rgba(255,255,255,.85);
  background: rgba(33,48,58,.45); padding: 4px 10px; border-radius: 8px; white-space: nowrap;
  pointer-events: none;
}

/* ── title screen ────────────────────────── */
#s-title .iso-wrap { left: 50%; top: 62%; transform: translate(-50%,-50%) scale(1.5,0.9) rotate(45deg); opacity: .9; }
.title-fade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(142,212,242,0) 30%, rgba(142,212,242,.55) 70%); }
/* manual-update prompt: a banner pinned top-centre over everything */
.update-banner {
  position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  z-index: 40; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px);
  background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
  padding: 8px 10px 8px 16px; font: 700 13px 'Itim', sans-serif; color: var(--ink);
}
.update-banner .btn { font-size: 15px; padding: 8px 18px; border-radius: 12px; flex: none; }

/* feedback lives in the top-right corner (the bottom menu already has enough buttons) */
.corner-btn {
  position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 8;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink);
  font: 700 14px 'Itim', sans-serif; color: var(--ink); padding: 8px 16px; cursor: pointer; user-select: none;
}
.corner-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.corner-btn.corner-left { left: 12px; right: auto; }

/* portrait lock (browser mode): cover the screen when a touch device is held in landscape */
.rotate-hint { display: none; }
@media (orientation: landscape) and (pointer: coarse) {
  .rotate-hint { display: flex; position: fixed; inset: 0; z-index: 9999;
    align-items: center; justify-content: center; background: var(--sky); padding: 24px; }
}
.rotate-hint-card { text-align: center; font: 800 20px 'Itim', sans-serif; color: var(--ink); max-width: 320px; }
.rotate-hint-emoji { font-size: 64px; margin-bottom: 8px; animation: rotate-nudge 1.8s ease-in-out infinite; }
@keyframes rotate-nudge { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(78deg); } }

.title-stack { position: absolute; left: 0; right: 0; top: 5%; display: flex; flex-direction: column; align-items: center; padding: 0 16px; }
/* the logo art already carries the name + tagline, so it replaces both */
.title-logo-img { width: min(380px, 82vw); height: auto; display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.22)); }
.title-menu { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 14px; width: min(320px, 86vw); }
.title-menu .btn { padding: 12px 0; font-size: 20px; }
.title-menu .btn-primary { font-size: 24px; padding: 14px 0; border-radius: 16px; }
/* six secondary buttons — a flex row squeezed them to 2-line ellipsis mush;
   a 3-col grid lays them out as a tidy 3×2 (or 3×N as conditional buttons hide) */
.title-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.title-row .btn { font-size: 13px; line-height: 1.15; padding: 10px 4px; min-height: 44px;
  display: flex; align-items: center; justify-content: center; text-align: center; }
.title-ver { position: absolute; right: 20px; bottom: 16px; font: 600 12px ui-monospace, monospace;
  color: rgba(33,48,58,.8); text-shadow: 0 1px 2px rgba(255,255,255,.7);   /* readable over the backdrop image */
  text-align: right; line-height: 1.4; }   /* version + save-note on their own lines so neither clips */

/* ── province select ─────────────────────── */
/* ── province select: pan/zoom Thailand map ── */
#s-province { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.mapsel-bar { display: flex; gap: 10px; padding: 14px 16px 10px; align-items: center; z-index: 6; }
.mapsel-bar #btn-prov-back { flex: none; font-size: 15px; padding: 10px 18px; }
.mapsel-search { position: relative; flex: 1; min-width: 0; }
.prov-search {
  width: 100%; padding: 10px 16px; border: 2.5px solid var(--ink); border-radius: 12px;
  background: #fff; font: 600 14px 'Itim', sans-serif; color: var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.prov-search::placeholder { color: var(--mut3); font-weight: 500; }
.mapsel-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; box-shadow: 0 5px 0 var(--ink);
  max-height: min(56vh, 360px); overflow-y: auto; padding: 4px;
}
.mapsel-results.hidden { display: none; }
.mapsel-results .r { padding: 9px 12px; border-radius: 8px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mapsel-results .r:hover { background: #FFF8E9; }
.mapsel-results .r b { font-weight: 800; font-size: 14px; }
.mapsel-results .r .rg { font-size: 11px; font-weight: 700; color: var(--mut3); }
.mapsel-results .none { padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--mut3); }

.mapsel-wrap {
  flex: 1; position: relative; margin: 0 16px 16px; overflow: hidden;
  border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 5px 0 var(--ink);
  background: linear-gradient(160deg, #Bfe6F5, #9FD8EF); touch-action: none; cursor: grab;
}
.mapsel-wrap.dragging { cursor: grabbing; }
.mapsel-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
#mapsel-svg { display: block; overflow: visible; }
#mapsel-svg .prov { fill: #CFE8C9; stroke: #5A7D54; stroke-width: 1.4; cursor: pointer; }
#mapsel-svg .prov:hover { fill: #B9E0B0; }
#mapsel-svg .prov.sel { fill: var(--yellow); stroke: var(--ink); stroke-width: 3; }
#mapsel-svg .pin { fill: var(--coral); stroke: var(--ink); stroke-width: 1.4; pointer-events: none; }
#mapsel-svg .pin.sel { fill: var(--ink); }
.mapsel-hint {
  position: absolute; left: 0; right: 0; bottom: 8px; text-align: center;
  font-size: 11px; font-weight: 700; color: rgba(33,48,58,.62); pointer-events: none;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}

/* difficulty/pace popup + detail card reuse these */
.diff-title { font: 600 15px 'Itim', sans-serif; }
.diff-row { display: flex; gap: 8px; margin-top: 8px; }
.diff-opt {
  flex: 1; text-align: center; padding: 8px 0; border: 2.5px solid var(--ink); border-radius: 12px;
  background: #fff; font-weight: 800; font-size: 13px; cursor: pointer;
}
.diff-opt span { font-weight: 600; font-size: 11px; color: var(--mut2); }
.diff-opt.sel { background: var(--yellow); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.diff-opt.sel span { color: #6B5A1E; }

.otop-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.otop-chip {
  font-size: 11.5px; font-weight: 800; background: #E9D9FB;
  border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px;
}

.prov-detail-card {
  position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 15;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink);
  padding: 14px; display: flex; align-items: center; gap: 16px; animation: pb-in .18s ease;
}
.prov-detail-card.hidden { display: none; }
.pdc-media {
  width: 132px; height: 96px; flex: none; border: 2.5px solid var(--ink); border-radius: 12px;
  overflow: hidden; position: relative;
  background: repeating-linear-gradient(45deg, #EAF4E4, #EAF4E4 8px, #DCEBD2 8px, #DCEBD2 16px);
}
/* photo hidden until it actually loads; the placeholder shows meanwhile / on 404 */
.pdc-media img { width: 100%; height: 100%; object-fit: cover; display: none; }
.pdc-media.has-photo img { display: block; }
.pdc-media.has-photo .pdc-ph { display: none; }
.pdc-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; font: 700 12px 'Itim', sans-serif; color: var(--mut2); padding: 6px; }
/* in-game landmark panel reuses the same media box, full-width */
.pdc-media.insp-lm { width: 100%; height: 128px; margin-bottom: 10px; }
.pdc-body { flex: 1; min-width: 0; }
.pdc-body h2 { font: 700 24px 'Itim', sans-serif; }
.pdc-sub { font-size: 12px; font-weight: 700; color: var(--mut3); margin: 2px 0 8px; }
#btn-choose { flex: none; font-size: 18px; padding: 12px 22px; border-radius: 14px; white-space: nowrap; }
#ov-start .ov-card { width: 520px; }
#ov-start .diff-title:first-of-type { margin-top: 4px; }
#btn-start { font-size: 20px; padding: 14px 0; border-radius: 16px; width: 100%; }

/* ── main game: HUD ──────────────────────── */
.hud-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; align-items: stretch; gap: 10px; z-index: 5; }
.hud-name { display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
.hud-name h2 { font: 700 18px 'Itim', sans-serif; }
.badge-gov { font-size: 11px; color: #fff; background: var(--orange); }
.hud-stats { display: flex; align-items: center; gap: 14px; padding: 8px 18px; }
.stat label { display: block; font-size: 10px; font-weight: 800; color: var(--mut); letter-spacing: .5px; }
.stat .val { font: 600 19px 'Itim', sans-serif; }
.stat .delta { font: 800 12px 'Itim', sans-serif; color: var(--green-t); }
.vsep { width: 2px; height: 30px; background: rgba(33,48,58,.12); }
.stat-month { min-width: 130px; }
.stat-month .bar { margin-top: 5px; }
.hud-spacer { flex: 1; }
.hud-sat { display: flex; align-items: center; gap: 10px; padding: 6px 14px; cursor: pointer; }
.hud-sat .poll-link { font-size: 12px; font-weight: 800; color: var(--green-t); cursor: pointer; }

/* mobile HUD */
.hud-mobile { position: absolute; top: 12px; left: 10px; right: 10px; padding: 8px 12px; z-index: 5; }
.hud-mobile .row1 { display: flex; align-items: center; gap: 10px; }
.hud-mobile .col { flex: 1; min-width: 0; }
.hud-mobile .line1 { display: flex; justify-content: space-between; align-items: baseline; }
.hud-mobile .money { font: 600 16px 'Itim', sans-serif; }
.hud-mobile .money span { font: 800 10px 'Itim', sans-serif; color: var(--green-t); }
.hud-mobile .pop { font-size: 12px; font-weight: 800; }
.hud-mobile .pop span { color: var(--mut); font-size: 10px; }
.hud-mobile .line2 { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.hud-mobile .bar { flex: 1; height: 8px; }
.hud-mobile .mlabel { font-size: 9.5px; font-weight: 800; color: var(--mut); white-space: nowrap; }
.kpi-alert {
  position: absolute; top: 84px; left: 50%; transform: translateX(-50%); z-index: 7;
  max-width: min(560px, 70vw); text-align: center;
  background: var(--red, #E05545); color: #fff;
  font-size: 12.5px; font-weight: 800; letter-spacing: .2px;
  border: 3px solid var(--ink); border-radius: 999px; padding: 7px 18px;
  box-shadow: 0 4px 0 var(--ink); animation: pb-in .2s ease;
}
.kpi-alert b { font-weight: 800; }

.poll-balloon {
  position: absolute; right: 14px; top: 46%; z-index: 6;
  background: #fff; border: 3px solid var(--ink); border-radius: 14px 14px 4px 14px;
  box-shadow: 0 4px 0 var(--ink); padding: 9px 14px; cursor: pointer; max-width: 200px;
  animation: pb-in .25s ease;
}
.poll-balloon:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.poll-balloon .pb-badge { font-size: 10px; font-weight: 800; letter-spacing: .5px; color: var(--green-t); }
.poll-balloon .pb-line { font-size: 12px; font-weight: 700; color: var(--ink); margin-top: 2px; white-space: nowrap; }
@keyframes pb-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── build palette (desktop) ─────────────── */
/* pointer-events:none so the transparent gaps (and the empty area beside a short building list)
   don't swallow map drags — only the actual panels are interactive */
.palette { position: absolute; left: 14px; top: 96px; display: flex; gap: 10px; align-items: flex-start; z-index: 5; pointer-events: none; }
.palette > .panel { pointer-events: auto; }
/* 8 categories can outgrow a short viewport — scroll instead of spilling off-screen */
.cat-col { display: flex; flex-direction: column; gap: 8px; padding: 10px; max-height: calc(100vh - 130px); overflow-y: auto; scrollbar-width: none; }
.cat-col::-webkit-scrollbar { display: none; }
.cat {
  width: 56px; height: 56px; border: 2.5px solid var(--ink); border-radius: 12px;
  background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.cat.sel { background: var(--yellow); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
/* icon-only tabs (label lives in the title tooltip) — big enough to read at a glance */
.cat .chip { width: 40px; height: 40px; border-radius: 9px; border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 24px; line-height: 1; }
/* an OTOP category lists up to 25 buildings — scroll the list, keep the header put */
.bld-panel { width: 250px; padding: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 130px); }
.bld-panel h3 { font: 600 17px 'Itim', sans-serif; margin-bottom: 2px; }
.bld-panel .sub { font-size: 11px; font-weight: 700; color: var(--mut); margin-bottom: 10px; }
.bld-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.bld {
  display: flex; align-items: center; gap: 10px; border: 2.5px solid var(--ink);
  border-radius: 12px; background: #fff; padding: 8px 10px; cursor: pointer;
}
.bld.sel { background: #FFF3CE; }
/* bigger chip so the rendered model reads clearly; img fills it, emoji fallback centres */
.bld .chip {
  width: 54px; height: 54px; border-radius: 10px; border: 2px solid var(--ink); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 26px; line-height: 1;
  background: #EAF2F6; object-fit: contain; overflow: hidden;
}
img.chip { box-shadow: none; }
.bld .meta { flex: 1; min-width: 0; }
/* wrap to two lines rather than ellipsize — cut-off names made the build menu hard to scan */
.bld .nm { font-size: 13px; font-weight: 800; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bld .info { font-size: 10.5px; font-weight: 700; color: var(--mut2); }
.bld .price { font: 600 14px 'Itim', sans-serif; text-align: right; }   /* own line under the name, right-aligned */

/* ── build sheet (mobile) ────────────────── */
/* modal backdrop: covers the map while the sheet is open; a tap closes the sheet
   and never reaches the viewport, so nothing gets built by the dismiss tap */
.sheet-backdrop { position: absolute; inset: 0; z-index: 19; background: rgba(33,48,58,.15); }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--cream); border: 3px solid var(--ink); border-bottom: none;
  border-radius: 24px 24px 0 0; box-shadow: 0 -3px 0 rgba(33,48,58,.2);
  padding: 10px 14px 18px; height: 50vh; display: flex; flex-direction: column;   /* locked at half the screen */
}
.sheet-handle { width: 44px; height: 5px; border-radius: 99px; background: rgba(33,48,58,.25); margin: 0 auto 10px; }
#sheet-close { position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; }
/* only the grid scrolls; handle/close/category-row/sub keep their natural size */
.sheet-handle, .sheet .cat-row, .sheet > .sub { flex: none; }
.cat-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
/* icon-only category pills (label in the title tooltip) — the icon fills the button, no padding */
.cat-pill {
  flex: none; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff;
  padding: 0; overflow: hidden; cursor: pointer;
}
.cat-pill .chip { width: 46px; height: 46px; border: none; border-radius: 0;
  display: flex; align-items: center; justify-content: center; font-size: 25px; line-height: 1; }
.cat-pill.sel .chip { box-shadow: inset 0 0 0 3px var(--yellow); }   /* selected: inner ring, not covered by the colour */
.sheet .sub { font-size: 11px; font-weight: 700; color: var(--mut); margin-bottom: 10px; }
/* align-content:start keeps rows content-sized at the top — without it a single-item
   category (Roads) stretches its one row to fill the 50vh grid into a giant card */
.bld-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px;
  flex: 1 1 auto; overflow-y: auto; min-height: 80px; align-content: start; }
.bld-grid .bld { padding: 8px 9px; gap: 9px; min-width: 0; }
.bld-grid .bld .info { display: none; }
.bld-grid .bld .chip { width: 52px; height: 52px; font-size: 24px; }
.bld-grid .bld .meta { display: flex; flex-direction: column; }
.bld-grid .bld .price { font-size: 12px; }
.bld-grid .bld .nm { display: block; -webkit-line-clamp: unset; }   /* narrow grid cell: wrap the full name, don't clip it */

/* selected-tool bar floats above the bottom bar and outlives the sheet (desktop never shows it) */
.sel-tool {
  position: absolute; left: 12px; right: 12px; z-index: 16;
  bottom: calc(150px + env(safe-area-inset-bottom));
  display: none; align-items: center; gap: 8px;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 8px 12px; box-shadow: 0 4px 0 var(--ink);
}
@media (max-width: 820px) { #sel-tool:not(.hidden) { display: flex; } }
.sel-tool .chip { width: 32px; height: 32px; border-radius: 8px; border: 2px solid var(--ink); flex: none; background-size: cover; background-position: center; }
.sel-tool .txt { flex: 1; font-size: 11px; font-weight: 800; }
.sel-tool .x {
  font-size: 10.5px; font-weight: 800; color: #fff; background: var(--coral);
  border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; cursor: pointer;
}
.sel-tool .rot {
  font-size: 14px; font-weight: 800; color: var(--ink); background: var(--yellow);
  border: 2px solid var(--ink); border-radius: 999px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center; flex: none; cursor: pointer;
}
/* quick-actions pill: undo the last build + re-arm the last building.
   desktop bottom-centre (clear of the minimap/timebar); mobile above the FAB row */
.quick-tools { position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 16;
  display: none; align-items: center; gap: 8px; }
.quick-tools:not(.hidden) { display: flex; }
.qt-btn { display: flex; align-items: center; gap: 7px; cursor: pointer; max-width: 60vw;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 7px 12px;
  box-shadow: 0 4px 0 var(--ink); font-size: 12.5px; font-weight: 800; color: var(--ink); }
.qt-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.qt-btn span:not(.qt-ico):not(.qt-chip) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-ico { font-size: 16px; line-height: 1; }
.qt-chip { width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--ink); flex: none;
  background: #EAF2F6; background-size: cover; background-position: center; }

/* coach arrow when the bubble sits below its target → point up instead of left */
.coach--below .coach-arrow { top: -14px; border: none; border-left: 3px solid var(--ink); border-top: 3px solid var(--ink); }

/* ── inspector ───────────────────────────── */
.inspector { position: absolute; right: 14px; top: 96px; width: 270px; padding: 16px; z-index: 6; }
.insp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.insp-head h3 { font: 600 16px 'Itim', sans-serif; line-height: 1.1; }
.insp-head .kind { font-size: 10.5px; font-weight: 800; color: var(--purple-d); }
.insp-stats { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; font-weight: 700; }
.insp-stats .r { display: flex; justify-content: space-between; align-items: center; }
.insp-stats .k { color: var(--mut2); }
.ok { color: var(--green-t); }
.warn { color: var(--orange); }
.insp-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.insp-actions .btn { font-size: 14px; padding: 9px 0; border-radius: 12px; border-width: 2.5px; box-shadow: 0 3px 0 var(--ink); }
.insp-row { display: flex; gap: 8px; }
.insp-row .btn {
  flex: 1; font-family: 'Itim', sans-serif; font-size: 12px; font-weight: 800;
  padding: 7px 0; box-shadow: none;
}
.danger { color: var(--red) !important; }
.cond-bar { width: 110px; height: 9px; }

/* ── toast / event ───────────────────────── */
.toast {
  position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 8;
  max-width: min(92vw, 560px);
  display: flex; align-items: center; gap: 10px; background: var(--yellow);
  border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
  padding: 9px 16px; max-width: min(720px, calc(100vw - 28px));
}
.toast .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--orange); border: 2.5px solid var(--ink); flex: none; }
.toast .txt { font-size: 13px; font-weight: 800; line-height: 1.35; }
.toast .view {
  font-size: 11px; font-weight: 800; background: var(--cream);
  border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; cursor: pointer; flex: none;
}

/* ── minimap / time ──────────────────────── */
.minimap { position: absolute; left: 14px; bottom: 14px; padding: 8px; border-radius: 14px; z-index: 5; }
.minimap canvas { display: block; width: 96px; height: 96px; border-radius: 6px; image-rendering: pixelated; }
.timebar { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; z-index: 5; }
.timebar .date { font-size: 12px; font-weight: 800; color: var(--mut2); margin-right: 2px; }
.tbtn {
  width: 40px; height: 40px; border: 2.5px solid var(--ink); border-radius: 11px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; cursor: pointer;
}
.tbtn.sel { background: var(--green); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }

/* mobile bottom bar — a column: time controls (toggled by settings) sit above the FAB row.
   The container is transparent to pointers so the empty gaps let map drags through; only the
   real controls capture taps. */
.bbar { position: absolute; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: stretch; gap: 10px; z-index: 10; pointer-events: none; }
.bbar-time, .fab-row { pointer-events: auto; }
.bbar-time { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; border-radius: 14px; }
.bbar-time .tbtn { width: 44px; height: 44px; border-radius: 10px; font-size: 13px; }

/* the four icon FABs (poll · kpi · settings · build) sit in a cream panel frame like the time bar */
.fab-row { display: flex; align-items: center; justify-content: space-around; gap: 8px; padding: 7px 10px; border-radius: 16px; }
.fab {
  width: 54px; height: 54px; border: 2.5px solid var(--ink); border-radius: 13px;
  background: #fff; cursor: pointer; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: translateY(2px); }
.fab svg { width: 28px; height: 28px; }
.fab-build { background: var(--green); color: #fff; }
#poll-btn { color: #C98A00; }       /* amber ballot */
#kpi-btn { color: var(--blue-d); }  /* blue chart */
#settings-btn { color: var(--mut2); }

/* ── overlays ────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 30; background: rgba(33,48,58,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.ov-card {
  position: relative; width: 860px; max-width: 100%; max-height: 92vh; overflow-y: auto;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 0 8px 0 var(--ink); padding: 26px 30px;
}

/* KPI overlay */
.kpi-head { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.kpi-head h2 { font: 700 28px 'Itim', sans-serif; }
.kpi-head .sub { font-size: 13px; font-weight: 700; color: var(--mut2); }
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.kpi {
  display: flex; align-items: center; gap: 12px; border: 2.5px solid var(--ink);
  border-radius: 14px; background: #fff; padding: 10px 14px;
}
.kpi .chip { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--ink); flex: none; }
.kpi .body { flex: 1; min-width: 0; }
.kpi .top { display: flex; justify-content: space-between; align-items: baseline; }
.kpi .nm { font-size: 13.5px; font-weight: 800; }
.kpi .val { font: 600 16px 'Itim', sans-serif; }
.kpi .val span { font: 800 11px 'Itim', sans-serif; }
.kpi .bar { height: 10px; background: var(--track2); margin: 5px 0 3px; }
.kpi .hint { font-size: 10.5px; font-weight: 700; color: var(--mut); }
.advisor-tip {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 12px; padding: 9px 14px;
}
.advisor-tip .txt { flex: 1; font-size: 12.5px; font-weight: 800; line-height: 1.4; }
.advisor-tip .act {
  font-size: 11px; font-weight: 800; background: var(--cream); border: 2px solid var(--ink);
  border-radius: 999px; padding: 3px 12px; cursor: pointer; white-space: nowrap;
}

/* poll overlay */
#ov-poll .ov-card { width: 820px; }
.poll-badge { text-align: center; margin-bottom: 6px; }
.poll-badge span { font-size: 11px; letter-spacing: 1px; color: #fff; background: var(--coral); padding: 4px 14px; }
.poll-title { font: 700 30px 'Itim', sans-serif; text-align: center; margin-bottom: 20px; }
.poll-flex { display: flex; align-items: center; gap: 20px; }
.poll-side { flex: 1; text-align: center; }
.avatar {
  width: 92px; height: 92px; margin: 0 auto 8px; border-radius: 50%; border: 3px solid var(--ink);
  overflow: hidden;
}
.poll-side .nm { font: 600 20px 'Itim', sans-serif; }
.poll-side .num { font: 700 40px 'Itim', sans-serif; }
.num-you { color: var(--green-t); }
.num-rival { color: var(--red-t); }
.poll-mid { flex: 2.2; }
.race { display: flex; height: 34px; border: 3px solid var(--ink); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.race .you { background: var(--green); }
.race .rival { flex: 1; background: var(--coral-l); }
.poll-note { font-size: 12px; font-weight: 700; color: var(--mut2); text-align: center; }
.poll-hist { display: flex; align-items: flex-end; gap: 8px; justify-content: center; margin-top: 14px; height: 70px; }
.poll-hist .col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.poll-hist .b { width: 34px; border: 2.5px solid var(--ink); border-radius: 7px 7px 3px 3px; }
.poll-hist .m { font-size: 9.5px; font-weight: 800; color: var(--mut); }
.quote { display: flex; align-items: center; gap: 10px; margin-top: 18px; background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 10px 14px; }
.quote .av { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--ink); background: repeating-linear-gradient(45deg,#FBE3DE,#FBE3DE 6px,#F5D2CB 6px,#F5D2CB 12px); flex: none; }
.quote .txt { font-size: 13px; font-weight: 700; font-style: italic; }
.poll-cta { text-align: center; margin-top: 18px; }
.poll-cta .btn { display: inline-block; font-size: 18px; padding: 11px 40px; }

/* event overlay */
#ov-event .ov-card { width: 560px; padding: 0; overflow: hidden; }
.ev-head { background: var(--blue); border-bottom: 3px solid var(--ink); padding: 18px 24px; display: flex; align-items: center; gap: 14px; }
.ev-icon {
  width: 46px; height: 46px; border-radius: 12px; background: var(--cream);
  border: 2.5px solid var(--ink); display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; color: var(--blue-d); flex: none;
}
.ev-head h2 { font: 700 24px 'Itim', sans-serif; color: #fff; text-shadow: 0 2px 0 rgba(33,48,58,.35); }
.ev-head .kind { font-size: 12px; font-weight: 800; color: #EAF6FF; }
.ev-body { padding: 20px 24px; }
.ev-desc { font-size: 14px; font-weight: 700; line-height: 1.55; margin-bottom: 14px; }
.ev-choices { display: flex; flex-direction: column; gap: 10px; }
.ev-choice {
  border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  cursor: pointer; box-shadow: 0 3px 0 var(--ink);
}
.ev-choice:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.ev-choice.free { background: var(--track2); box-shadow: none; }
.ev-choice .nm { font-size: 14px; font-weight: 800; }
.ev-choice .sub { font-size: 11.5px; font-weight: 700; color: var(--mut2); }
.ev-choice .cost { font: 600 16px 'Itim', sans-serif; color: var(--red); flex: none; }
.ev-choice .cost.free { color: var(--mut2); }

/* ── election screen ─────────────────────── */
#s-election { display: flex; align-items: center; justify-content: center; padding: 16px; }
.confetti { position: absolute; border: none; }
.elect-card {
  position: relative; width: 760px; max-width: 100%; max-height: 94vh; overflow-y: auto;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 0 10px 0 rgba(0,0,0,.4); padding: 30px 34px; text-align: center;
}
.elect-badge { font-size: 11px; letter-spacing: 1.5px; color: #fff; background: var(--coral); padding: 4px 16px; }
.elect-verdict { font: 700 clamp(34px, 6vw, 52px) 'Itim', sans-serif; margin: 14px 0 2px; }
.elect-verdict.win { color: var(--green-t); }
.elect-verdict.lose { color: var(--red-t); }
.elect-sub { font-size: 15px; font-weight: 700; color: var(--mut2); margin-bottom: 20px; }
.elect-race { display: flex; height: 44px; border: 3px solid var(--ink); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.elect-race > div { display: flex; align-items: center; font: 600 15px 'Itim', sans-serif; color: #fff; white-space: nowrap; }
.elect-race .you { background: var(--green); justify-content: flex-start; padding-left: 18px; }
.elect-race .rival { flex: 1; background: var(--coral-l); justify-content: flex-end; padding-right: 18px; }
.elect-need { font-size: 11.5px; font-weight: 700; color: var(--mut); margin-bottom: 20px; }
.elect-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.elect-stats > div { border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; padding: 12px 8px; }
.elect-stats .v { font: 600 22px 'Itim', sans-serif; }
.elect-stats label { font-size: 10.5px; font-weight: 800; color: var(--mut); }
.elect-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.elect-cta .btn { font-size: 18px; padding: 12px 30px; }

/* ── tutorial coach ──────────────────────── */
.coach-glow { box-shadow: 0 0 0 6px rgba(255,217,92,.9) !important; }
.coach {
  position: absolute; left: 150px; top: 104px; width: 400px; max-width: calc(100vw - 24px);
  background: var(--cream); border: 3px solid var(--ink); border-radius: 18px;
  box-shadow: 0 5px 0 var(--ink); padding: 18px 22px; z-index: 40; cursor: pointer;
}
.coach-arrow {
  position: absolute; left: -14px; top: 34px; width: 22px; height: 22px; background: var(--cream);
  border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg);
}
.coach-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.coach-av {
  width: 44px; height: 44px; border-radius: 50%; border: 2.5px solid var(--ink);
  overflow: hidden; flex: none;
}
.coach-head h3 { font: 600 17px 'Itim', sans-serif; }
.coach-step { font-size: 10.5px; font-weight: 800; color: var(--orange); }
.coach-txt { font-size: 13.5px; font-weight: 700; line-height: 1.55; }
.coach-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.coach-dots { display: flex; gap: 5px; }
.coach-dots div { width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }
.coach-dots div.done { background: var(--ink); border-color: var(--ink); }
.coach-dots div.cur { background: var(--yellow); }
.coach-skip { font-size: 12px; font-weight: 800; color: var(--mut); cursor: pointer; }

/* ── responsive ──────────────────────────── */
.mobile-only { display: none !important; }

@media (max-width: 820px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }
  div.mobile-only { display: block !important; }
  .bbar.mobile-only { display: flex !important; }

  .iso-wrap { left: 50%; top: 52%; transform: translate(-50%,-50%) scale(1.5,0.88) rotate(45deg); }
  .viewport-hint { left: 50%; top: 38%; font-size: 10px; }

  /* province select: map fills the screen, detail card wraps its button full-width */
  .mapsel-bar { padding: 10px 12px 8px; }
  .mapsel-bar #btn-prov-back { font-size: 14px; padding: 10px 14px; }
  .mapsel-wrap { margin: 0 12px calc(12px + env(safe-area-inset-bottom)); }
  .prov-detail-card { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    flex-wrap: wrap; gap: 12px; padding: 12px; }
  .pdc-media { width: 88px; height: 66px; }
  .pdc-body h2 { font-size: 20px; }
  #btn-choose { flex-basis: 100%; text-align: center; }
  #ov-start .ov-card { width: 100%; }

  /* inspector becomes a bottom sheet */
  .inspector {
    left: 0; right: 0; top: auto; bottom: 0; width: auto;
    border-radius: 24px 24px 0 0; border-bottom: none; box-shadow: 0 -3px 0 rgba(33,48,58,.2);
    padding: 10px 16px 18px; z-index: 22;
  }
  .inspector::before {
    content: ""; display: block; width: 44px; height: 5px; border-radius: 99px;
    background: rgba(33,48,58,.25); margin: 0 auto 12px;
  }
  .insp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 12px; }
  .cond-bar { width: 64px; height: 8px; }

  /* overlays become sheets */
  .overlay { align-items: flex-end; padding: 0; }
  .ov-card { border-radius: 24px 24px 0 0; border-bottom: none; box-shadow: none; padding: 18px 16px; }
  #ov-kpi .ov-card { height: calc(100% - 78px); max-height: none; }
  #ov-feedback .ov-card { height: calc(100% - 40px); max-height: none; }   /* tall sheet, body scrolls */
  .kpi-grid { grid-template-columns: 1fr; gap: 8px; }
  .kpi .hint { display: none; }
  .kpi-head h2 { font-size: 20px; }
  .kpi-head .sub { font-size: 11px; }
  #ov-event .ov-card { width: 100%; }
  .poll-flex { flex-wrap: wrap; }
  .poll-mid { flex-basis: 100%; order: 3; }

  /* tutorial coach: narrower + lifted clear of the 50vh build sheet so it never covers the options */
  .coach { left: 12px; right: 12px; top: auto; bottom: calc(50vh + 14px); width: auto; max-width: 320px; margin: 0 auto; }
  .coach-arrow { display: none; }

  /* selected-tool bar sits just above the FAB row, full width */
  .sel-tool { left: 12px; right: 12px; top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* quick-actions ride just above the FAB row too (shown only when no tool is armed, so never clashes with sel-tool) */
  .quick-tools { left: 12px; right: auto; transform: none; bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* event toasts (incl. "Moving…") show at the top, under the red critical-KPI alert,
     so they never cover the map / the building being moved */
  .toast { top: 148px; bottom: auto; left: 12px; right: 12px; transform: none; max-width: none; }

  /* critical-KPI alert spans the full width on a phone */
  .kpi-alert { left: 10px; right: 10px; max-width: none; transform: none; border-radius: 12px; }

  /* iOS home indicator */
  .sheet { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .inspector { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .ov-card { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

  /* readability: nothing under 10.5px */
  .hud-mobile .money { font-size: 18px; }
  .hud-mobile .pop { font-size: 13px; }
  .hud-mobile .mlabel { font-size: 10.5px; }
  .sheet .sub, .sel-tool .txt { font-size: 12px; }
}

/* ── ledger table (in-game overlay + election card) ───────── */
.stat-btn { cursor: pointer; border-radius: 8px; }
.stat-btn:hover { background: rgba(0,0,0,.05); }
.ledger { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.lg-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: baseline;
  padding: 7px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.lg-row > span:not(:first-child) { min-width: 104px; text-align: right; font-variant-numeric: tabular-nums; }
.lg-row:nth-child(even) { background: rgba(0,0,0,.035); }
.lg-head { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; opacity: .55; background: none !important; }
.lg-net { margin-top: 4px; border-top: 2px solid var(--ink); border-radius: 0 0 8px 8px; font-size: 14px; background: none !important; }
.ledger .muted { opacity: .4; }
.elect-ledger { margin: 14px 0 4px; text-align: left; }

/* ── save slots ───────────────────────────────────────────── */
.slots { display: flex; flex-direction: column; gap: 6px; margin-top: 6px;
  max-height: min(58vh, 460px); overflow-y: auto; }
.slot { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff; cursor: pointer; }
.slot:hover { background: #FFF8E9; }
.slot.empty { border-style: dashed; opacity: .72; }
.slot .n { font-weight: 800; width: 26px; opacity: .5; font-variant-numeric: tabular-nums; }
.slot .who { flex: 1; min-width: 0; }
.slot .who b { display: block; font-size: 14px; }
.slot .who span { font-size: 12px; opacity: .62; }
.slot .kill { border: none; background: none; font-size: 15px; cursor: pointer; opacity: .45; padding: 4px 6px; }
.slot .kill:hover { opacity: 1; color: var(--red, #C0392B); }

/* ── achievements ─────────────────────────────────────────── */
.ach { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
.ach .ico { font-size: 22px; width: 30px; text-align: center; }
.ach .who { flex: 1; min-width: 0; }
.ach .who b { display: block; font-size: 14px; }
.ach .who span { font-size: 12px; opacity: .62; }
.ach .got { font-weight: 800; color: #53B94E; }
.ach.locked { opacity: .45; border-style: dashed; }
.ach.locked .ico { filter: grayscale(1); }

/* ── feedback (rate + wall) ───────────────────────────────── */
/* header (title + ✕) stays put; only the body scrolls — the rate form is long */
#ov-feedback .ov-card { width: 560px; display: flex; flex-direction: column; max-height: 90vh; overflow: hidden; }
#ov-feedback .kpi-head { flex: none; }
#feedback-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.fb-tabs { display: flex; gap: 8px; margin: 4px 0 14px; }
.fb-tab { flex: 1; text-align: center; padding: 9px 0; border: 2.5px solid var(--ink); border-radius: 12px;
  background: #fff; font-weight: 800; font-size: 14px; cursor: pointer; }
.fb-tab.sel { background: var(--yellow); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.fb-section { font-weight: 800; font-size: 14px; margin-bottom: 8px; }
.fb-animals { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.fb-animal { aspect-ratio: 1; border: 2.5px solid var(--ink); border-radius: 10px; background: #fff;
  font-size: 22px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.fb-animal.sel { background: var(--yellow); box-shadow: inset 0 -3px 0 rgba(0,0,0,.14); transform: scale(1.05); }
.fb-name { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; padding: 8px 10px 8px 12px;
  background: #FFF8E9; border: 2.5px solid var(--ink); border-radius: 12px; }
.fb-name-emoji { font-size: 26px; line-height: 1; }
.fb-name-text { flex: 1; font-weight: 800; font-size: 16px; }
.fb-reroll { border: 2px solid var(--ink); border-radius: 10px; background: #fff; font-size: 18px;
  width: 38px; height: 38px; cursor: pointer; flex: none; }
.fb-questions { margin: 14px 0; display: flex; flex-direction: column; gap: 12px; }
.fb-q-text { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.fb-faces { display: flex; gap: 6px; }
.fb-face { flex: 1; padding: 6px 0; border: 2px solid var(--ink); border-radius: 10px; background: #fff;
  font-size: 22px; line-height: 1; cursor: pointer; filter: grayscale(.7) opacity(.65); transition: filter .1s, transform .1s; }
.fb-face.sel { filter: none; transform: scale(1.12); background: var(--yellow); }
.fb-comment { width: 100%; box-sizing: border-box; margin-bottom: 14px; padding: 10px 12px;
  border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink);
  font: 600 14px 'Itim', sans-serif; resize: vertical; }
.fb-comment::placeholder { color: var(--mut); font-weight: 600; }
.fb-submit { width: 100%; font-size: 20px; padding: 13px 0; border-radius: 14px; }
/* thank-you */
.fb-thanks { text-align: center; padding: 20px 8px 8px; }
.fb-thanks-emoji { font-size: 60px; line-height: 1; margin-bottom: 8px; }
.fb-thanks h2 { font: 700 26px 'Itim', sans-serif; }
.fb-thanks-sub { font-size: 13px; font-weight: 700; color: var(--mut2); margin: 4px 0 18px; }
/* wall */
.fb-summary { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #FFF8E9; border: 2.5px solid var(--ink); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
.fb-summary-count { font-weight: 800; font-size: 13px; }
.fb-summary-avg { font-weight: 700; font-size: 14px; white-space: nowrap; }
.fb-list { display: flex; flex-direction: column; gap: 6px; }   /* #feedback-body scrolls; no nested scroll here */
.fb-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 2px solid var(--ink);
  border-radius: 10px; background: #fff; }
.fb-row.you { background: #E9F8E4; box-shadow: 0 0 0 2px var(--green); }
.fb-row-emoji { font-size: 24px; line-height: 1; flex: none; }
.fb-row-name { flex: 1; font-weight: 800; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-row-avg { font-weight: 800; font-size: 13px; flex: none; }
.fb-row-time { font-size: 10.5px; font-weight: 700; color: var(--mut3); flex: none; }
.fb-empty { text-align: center; padding: 24px 8px; font-weight: 700; color: var(--mut2); }
/* leaderboard — reuses fb-tabs / fb-wall / fb-row / fb-submit; these are the score-specific bits */
.lb-score { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 14px;
  padding: 12px 16px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--yellow); }
.lb-score label { font-weight: 800; font-size: 14px; }
.lb-score-v { font-weight: 800; font-size: 26px; line-height: 1; }
.lb-name { width: 100%; box-sizing: border-box; padding: 11px 14px; margin-bottom: 12px;
  border: 2.5px solid var(--ink); border-radius: 12px; font: inherit; font-weight: 800; font-size: 17px; }
.lb-rank { font-weight: 800; font-size: 15px; min-width: 28px; text-align: center; flex: none; }
.fb-toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 13px; padding: 8px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; }
.fb-toast.show { opacity: 1; }
@media (max-width: 820px) {
  .fb-animals { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .fb-animal { font-size: 26px; }
  .fb-face { font-size: 24px; }
}
