/* public/css/game.css — warm game skin (UI-1), large touch targets */
:root {
  color-scheme: light;
  /* UI-1 "Finbuu Çarşısı": cream day theme, navy chrome, amber accent */
  --bg: #fff4dd; --panel: #fffdf7; --panel-2: #fdf0d6; --line: #efdcb8;
  --text: #1d2b53; --muted: #656a83; --accent: #f5a300; --accent-ink: #1d2b53; --accent-deep: #b97900;
  --good: #14866f; --bad: #d4402b; --warn: #b86e00;
  --nav: #1d2b53; --nav-ink: #fff4dd; --nav-dim: rgba(255, 244, 221, .72);
  --series-1: #1f6fd0; --series-2: #e8502f;
  --font-head: "Baloo 2", "Nunito", system-ui, sans-serif; --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px; --nav-h: 64px; --shadow: 0 3px 12px rgba(29, 43, 83, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1630; --panel: #1a2447; --panel-2: #222e58; --line: #31407a;
    --text: #f6edd8; --muted: #aab2d0; --accent: #ffb703; --accent-ink: #1d2b53; --accent-deep: #c88a00;
    --good: #3ccfb4; --bad: #ff7a62; --warn: #ffc247;
    --nav: #0a1029; --nav-ink: #fff4dd; --nav-dim: rgba(255, 244, 221, .7);
    --series-1: #4a9bff; --series-2: #ff7a4a; --shadow: 0 3px 12px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1630; --panel: #1a2447; --panel-2: #222e58; --line: #31407a;
    --text: #f6edd8; --muted: #aab2d0; --accent: #ffb703; --accent-ink: #1d2b53; --accent-deep: #c88a00;
    --good: #3ccfb4; --bad: #ff7a62; --warn: #ffc247;
    --nav: #0a1029; --nav-ink: #fff4dd; --nav-dim: rgba(255, 244, 221, .7);
    --series-1: #4a9bff; --series-2: #ff7a4a; --shadow: 0 3px 12px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box }
html, body { margin: 0; height: 100%; font-family: var(--font-body); font-size: 15px;
  background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent }
button, input, select, textarea { font: inherit; color: inherit; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; min-height: 44px }
button { cursor: pointer; transition: background .15s, transform .05s }
button:hover { background: var(--line) }
button:active { transform: scale(.97) }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600 }
button.primary:hover { filter: brightness(1.06) }
button.lockedBtn { filter: blur(.6px); opacity: .55 }
.muted { color: var(--muted) }

header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line) }
header h1 { font-size: 1.1rem; margin: 0; white-space: nowrap; display: flex; flex-direction: column; line-height: 1.15 }
header h1 small { font-size: .62rem; font-weight: 500; color: var(--muted); letter-spacing: .02em }
#day { font-size: .85rem; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
#menuBtn { font-size: 1.2rem; padding: 6px 12px }
#roomBar { display: none; gap: 8px; align-items: center; padding: 6px 14px; background: var(--panel-2); font-size: .85rem; flex-wrap: wrap }
#roomBar button { min-height: 34px; padding: 6px 10px }

main { display: grid; grid-template-columns: 1fr 360px; gap: 12px; padding: 12px; height: calc(100% - 58px) }
#stage { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 340px; background: #dff0fc; box-shadow: var(--shadow); touch-action: none; user-select: none }
canvas#cv { display: block; width: 100%; height: 100% }

/* HUD: money / customers / employees bars */
#hud { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none }
.chip { pointer-events: auto; background: color-mix(in srgb, var(--panel) 92%, transparent); border-radius: 12px; padding: 6px 10px 7px;
  min-width: 104px; box-shadow: var(--shadow); font-size: .78rem; line-height: 1.2 }
.chip .k { color: var(--muted); display: flex; justify-content: space-between; gap: 6px }
.chip .v { font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; white-space: nowrap }
.chip .v .pos { color: var(--good) } .chip .v .neg { color: var(--bad) }
.chip .bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px }
.chip .bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s }

/* Advisor: suggested next move with OK / Next / Auto */
#advisor { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(560px, calc(100% - 24px));
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; display: flex; gap: 10px; align-items: center }
#advisor[hidden] { display: none }
#advText { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px }
#advText b { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
#advText small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.advBtns { display: flex; gap: 6px }
.advBtns button { min-height: 40px; padding: 8px 12px; white-space: nowrap }
#advAuto.on { background: var(--good); border-color: var(--good); color: #fff }

#joy { position: absolute; left: 18px; bottom: 18px; width: 160px; height: 112px; border-radius: 56px !important; border-radius: 50%;
  background: color-mix(in srgb, var(--panel) 55%, transparent); border: 2px solid color-mix(in srgb, var(--panel) 80%, transparent); touch-action: none }
#joy[hidden] { display: none }
#knob.run { background: var(--warn) }
#themeBtn { font-size: 1.1rem; padding: 6px 12px }
#knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: var(--accent); opacity: .85 }
#actBtn { position: absolute; right: 18px; bottom: 26px; width: 84px; height: 84px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; border: 0; box-shadow: var(--shadow) }
#actBtn[hidden] { display: none }
#hint { position: absolute; bottom: 86px; left: 50%; transform: translateX(-50%); font-size: .78rem; background: rgba(30, 35, 50, .55); color: #fff; padding: 4px 10px; border-radius: 999px; white-space: nowrap; pointer-events: none }

#side { display: flex; flex-direction: column; gap: 12px; overflow: auto }
.card { background: var(--panel); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow) }
.card h3, .card h4 { margin: 0 0 8px; font-size: 1rem }
.card h4 { font-size: .85rem; color: var(--muted); font-weight: 600 }
.card ul, .card ol { margin: 0; padding-left: 18px; font-size: .9rem; line-height: 1.55 }
#log { list-style: none; padding: 0 } #log li { padding: 5px 0; border-bottom: 1px solid var(--line) }
.locked { filter: blur(.5px); opacity: .55; display: inline-block; margin: 3px; padding: 6px 10px; background: var(--panel-2); border-radius: 999px; font-size: .8rem; cursor: pointer }
.row { display: flex; gap: 8px; flex-wrap: wrap } .row > * { flex: 1 1 auto }
textarea { width: 100%; resize: vertical; min-height: 70px }
.stat { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line) }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 4px } .bar > i { display: block; height: 100%; background: var(--accent) }

/* Finance panel */
#finCompany { width: 100%; margin-bottom: 10px }
.kpiGroup { margin-bottom: 10px }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px }
.kpi { background: var(--panel-2); border-radius: 10px; padding: 8px }
.kpi span { display: block; font-size: .72rem; color: var(--muted) }
.kpi b { font-size: 1rem; font-variant-numeric: tabular-nums }
.kpi i { font-style: normal; font-size: .7rem; margin-left: 3px }
.kpi .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle }
figure { margin: 10px 0 0 } figcaption { font-size: .8rem; color: var(--muted); margin-bottom: 4px }
.chartBox { position: relative; height: 140px }
figure.empty .chartBox { display: none }
figure.empty::after { content: attr(data-empty); display: block; padding: 14px; text-align: center; font-size: .8rem; color: var(--muted); background: var(--panel-2); border-radius: 10px }
details { margin-top: 10px; font-size: .85rem } summary { cursor: pointer; color: var(--muted) }
#finTable { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums }
#finTable th, #finTable td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line) }
#finTable th:first-child, #finTable td:first-child { text-align: left }

#drawer { position: fixed; inset: 0 0 0 auto; width: min(320px, 85vw); background: var(--panel); z-index: 40; padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top)); transform: translateX(100%); transition: transform .25s; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow) }
#drawer.open { transform: none }
#scrim { position: fixed; inset: 0; background: rgba(20, 25, 40, .35); z-index: 30; display: none } #scrim.show { display: block }
#drawer label { font-size: .8rem; color: var(--muted) }

#modal { position: fixed; inset: 0; background: rgba(20, 25, 40, .35); display: none; align-items: center; justify-content: center; z-index: 50 }
#modalBody { width: min(500px, 94vw); max-height: 86vh; overflow: auto; display: flex; flex-direction: column; gap: 8px }
.co { background: var(--panel-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px }
.co h4 { margin: 0; color: var(--text); font-size: .95rem }
.co p { margin: 0; font-size: .85rem; color: var(--muted) }
.co .mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px }
.co .mini .kpi { background: var(--panel) }
.co canvas.spark { width: 100%; height: 44px }
.rec { border: 2px solid var(--accent); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: color-mix(in srgb, var(--accent) 6%, var(--panel)) }
.rec small { color: var(--muted) }
.rec button { width: 100% }
.others { display: flex; flex-wrap: wrap; gap: 6px } .others button { flex: 1 1 140px; min-height: 40px; font-size: .9rem }
.mode { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px }
.mode p { margin: 0; font-size: .85rem; color: var(--muted) }
.mode.disabled { filter: blur(.6px); opacity: .5 }
#toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: rgba(30, 35, 50, .9); color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 60; display: none; max-width: 90vw; text-align: center }

nav { display: none }
@media (max-width: 820px) {
  main { display: block; padding: 0; height: auto }
  #stage { border-radius: 0; height: calc(100dvh - 58px - var(--nav-h)); min-height: 300px; box-shadow: none }
  #side { position: fixed; left: 0; right: 0; bottom: var(--nav-h); max-height: 72dvh; background: var(--bg); border-radius: var(--radius) var(--radius) 0 0;
    padding: 12px; z-index: 25; transform: translateY(110%); transition: transform .25s; box-shadow: 0 -8px 24px rgba(20, 25, 40, .15) }
  #side.open { transform: none }
  #side .card { display: none } #side .card.active { display: block }
  nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line); z-index: 26 }
  nav button { flex: 1; background: none; border: 0; border-radius: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .7rem; min-height: 0; padding: 4px }
  nav button span { font-size: 1.25rem } nav button.active { color: var(--accent) }
  #modal { align-items: flex-end }
  #modalBody { width: 100%; border-radius: var(--radius) var(--radius) 0 0; padding-bottom: max(16px, env(safe-area-inset-bottom)) }
  #day { display: none }
  #hud { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 5px; top: 6px; left: 6px; right: 6px }
  #hud::-webkit-scrollbar { display: none }
  .chip { flex: 0 0 auto; min-width: 82px; padding: 4px 8px 5px; font-size: .68rem }
  .chip .v { font-size: .82rem }
  #advisor { top: 62px; bottom: auto; flex-wrap: wrap; gap: 6px; padding: 8px 10px; width: calc(100% - 12px) }
  #advText { flex-basis: 100% }
  #advText b { font-size: .88rem }
  #advText small { display: none }
  .advBtns { flex: 1 }
  .advBtns button { flex: 1; min-height: 38px; padding: 6px 8px; font-size: .85rem }
  #toast { bottom: calc(var(--nav-h) + 150px) }
  #hint { display: none }
}

/* ---------- Sprint 3 ---------- */
header #boardBtn, header #helpBtn { font-size: 1.1rem; padding: 6px 12px }
#status { position: absolute; right: 10px; bottom: 10px; font: 600 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(30, 35, 50, .72); color: #e8eaf0; padding: 5px 8px; border-radius: 8px; pointer-events: none; white-space: nowrap }
#status .warn { color: #ffd166 } #status .bad { color: #ff8a80 }
#status[hidden] { display: none }

#board { position: absolute; inset: 70px 12px 12px; max-width: 760px; margin: 0 auto; background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 5 }
#board[hidden] { display: none }
.boardHead { display: flex; gap: 8px; align-items: center } .boardHead h3 { flex: 1; margin: 0 }
.boardHead select, .boardHead button { min-height: 38px; padding: 6px 10px }
.boardScroll { overflow: auto; flex: 1 }
#boardTable { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums }
#boardTable th { position: sticky; top: 0; background: var(--panel); text-align: right; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line) }
#boardTable td { text-align: right; padding: 7px 6px; border-bottom: 1px solid var(--line) }
#boardTable th:nth-child(2), #boardTable td:nth-child(2), #boardTable th:nth-child(3), #boardTable td:nth-child(3) { text-align: left }
#boardTable tbody tr { cursor: pointer } #boardTable tbody tr:hover { background: var(--panel-2) }
#boardTable tr.mine td { font-weight: 700 }
#boardTable td .medal { font-size: 1rem }

#innerBar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center;
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 10px; max-width: calc(100% - 24px) }
#innerBar[hidden] { display: none }
#innerBar b { padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw }
#innerBar button { min-height: 40px; padding: 6px 12px }

.idCard { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; background: linear-gradient(135deg, #eef4ff, #f7f8fc);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .idCard { background: var(--panel-2) } }
:root[data-theme="dark"] .idCard { background: var(--panel-2) }
.idCard canvas { width: 84px; height: 84px; border-radius: 12px; background: #dff0fc }
.idCard dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .82rem }
.idCard dt { color: var(--muted) } .idCard dd { margin: 0; font-weight: 600 }
.idCard .idTitle { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); font-size: .75rem; font-weight: 700 }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px }
.choices button.sel { outline: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)) }
.wizNav { display: flex; gap: 8px } .wizNav button { flex: 1 }
.steps { display: flex; gap: 4px } .steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line) } .steps i.on { background: var(--accent) }

#chatList { list-style: none; padding: 0; max-height: 260px; overflow: auto; font-size: .88rem; margin: 6px 0 }
#chatList li { padding: 5px 0; border-bottom: 1px solid var(--line) } #chatList li b { margin-right: 4px }
#chatList li.sys { color: var(--muted); font-style: italic }
.chatRow input { flex: 1 1 60% } .chatRow button { flex: 0 0 auto }
.poll { background: var(--panel-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px }
.poll b { font-size: .95rem }
.poll button { text-align: left; position: relative; overflow: hidden; min-height: 40px }
.poll button .fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--series-1) 22%, transparent); pointer-events: none }
.poll button span { position: relative }
.dept p { margin: 0 }

@media (max-width: 820px) {
  #status { top: 52px; bottom: auto; right: 6px; font-size: 10px }
  #board { inset: 56px 6px 6px }
  #innerBar { bottom: 140px }
  header #boardBtn { padding: 6px 10px }
}
#side .card[hidden] { display: none !important }
@media (max-width: 820px) { #status { top: auto; bottom: 4px; right: auto; left: 50%; transform: translateX(-50%) } }
@media (max-width: 820px) {
  body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden }
  main { flex: 1; min-height: 0 }
  #stage { height: calc(100% - var(--nav-h)) }
  #roomBar { padding: 4px 10px; font-size: .78rem; flex-wrap: nowrap }
  #roomBar b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
  #roomBar button { min-height: 30px; padding: 4px 8px; font-size: .78rem }
}

/* ---------- Sprint 4 ---------- */
#clockBox { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-size: .85rem }
#clock { width: 40px; height: 40px }
.quest { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .85rem }
.quest .row1 { display: flex; justify-content: space-between; gap: 8px }
.quest.done { color: var(--good) }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px }
.badge2 { text-align: center; font-size: .66rem; padding: 6px 2px; border-radius: 10px; background: var(--panel-2); line-height: 1.2 }
.badge2 span { display: block; font-size: 1.4rem }
.badge2.locked { filter: grayscale(1); opacity: .45 }
.teamRow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: .88rem }
.teamRow .dot, .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: 0 0 auto }
.teamRow b { flex: 1 }
.teamRow button { min-height: 34px; padding: 4px 10px }
.real table { width: 100%; border-collapse: collapse; font-size: .8rem; font-variant-numeric: tabular-nums }
.real td { padding: 4px 2px; border-bottom: 1px solid var(--line) } .real td:last-child { text-align: right; font-weight: 600 }
.real a { color: var(--accent) } .real small { color: var(--muted) }
.est { color: var(--warn); font-size: .7rem; margin-left: 3px }
@media (max-width: 820px) { #clockBox b { display: none } #clock { width: 34px; height: 34px } }
/* Demo Day */
.bmc { display: grid; grid-template-columns: 1fr 1fr; gap: 6px }
.bmcCell { display: flex; flex-direction: column; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: .82rem }
.bmcCell textarea { min-height: 64px; font-size: .82rem; padding: 6px 8px }
.bmc-valueProps { grid-column: 1 / -1; border-color: var(--accent) }
@media (min-width: 900px) {
  #modalBody:has(.bmc) { width: min(980px, 96vw) }
  .bmc { grid-template-columns: repeat(5, 1fr); grid-auto-flow: dense }
  .bmc-keyPartners { grid-column: 1; grid-row: 1 / 3 } .bmc-keyActivities { grid-column: 2; grid-row: 1 } .bmc-keyResources { grid-column: 2; grid-row: 2 }
  .bmc-valueProps { grid-column: 3; grid-row: 1 / 3 } .bmc-customerRelationships { grid-column: 4; grid-row: 1 } .bmc-channels { grid-column: 4; grid-row: 2 }
  .bmc-customerSegments { grid-column: 5; grid-row: 1 / 3 } .bmc-costStructure { grid-column: 1 / 3; grid-row: 3 } .bmc-revenueStreams { grid-column: 3 / 6; grid-row: 3 }
}
.slide { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #3b2f63, #2a78d6); color: #fff; border-radius: 14px; padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; overflow: auto }
.slide h2 { margin: 0; font-size: 1.4rem } .slide p { margin: 0; font-size: .95rem } .slide .lead { font-size: 1.05rem; opacity: .9 }
.slide small { color: #d8d4ff !important } .slide .kpi { background: rgba(255,255,255,.14) } .slide .kpi span { color: #e9e4ff } .slide canvas.spark { background: rgba(255,255,255,.9); border-radius: 8px }
.co .slide p, .slide p { color: #fff } .slide .lead { color: #e9e4ff }

/* ---- Sprint 6: talk button, emoji, collapsible panels ---- */
#talkBtn { position: absolute; right: 112px; bottom: 26px; width: 84px; height: 84px; border-radius: 50%; background: var(--good); color: #fff; font-weight: 700; border: 0; box-shadow: var(--shadow); font-size: .8rem }
#talkBtn[hidden] { display: none }
.emojiBar { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 }
.emojiBtn { min-height: 38px; min-width: 38px; padding: 2px 6px; font-size: 1.15rem; background: var(--panel-2) }
#chatList li.dm { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 8px; padding: 2px 6px }
.card > h3.fold { cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between }
.card > h3.fold::after { content: '▾'; color: var(--muted); font-size: .85em }
.card.collapsed > h3.fold::after { content: '▸' }
.card.collapsed > *:not(h3) { display: none !important }
#hudBtn { position: absolute; top: 8px; right: 8px; min-height: 30px; padding: 2px 10px; opacity: .8; z-index: 3 }
body.noHud #hud { display: none }
body.noAdv #advisor { display: none }
@media (min-width: 821px) {
  body.noSide #side { display: none }
  body.noSide main { grid-template-columns: 1fr !important }
}
@media (max-width: 820px) { .deskOnly { display: none } }

/* ---- Sprint 7: speed, pickers, timeline, advisor ---- */
#speedBtn { font-weight: 700; padding: 6px 10px; min-height: 40px }
#speedBtn[hidden] { display: none }
#speedBtn.fast { background: color-mix(in srgb, var(--warn) 25%, var(--panel-2)); border-color: var(--warn) }
#speedBtn.slow { background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)) }
#speedBtn:disabled { opacity: .75; cursor: default }
.pickBig { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: 6px 0 0 }
#modalBody input[type=range] { width: 100%; padding: 0; min-height: 36px; accent-color: var(--accent) }
#modalBody input[type=number] { width: 100%; margin: 6px 0 }
#log { list-style: none; padding: 0; margin: 0; position: relative }
#log .dayHdr { font-weight: 700; font-size: .78rem; color: var(--muted); padding: 10px 0 4px; border: 0; text-transform: uppercase; letter-spacing: .03em }
#log .tlItem { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0 5px 10px; margin-left: 8px; border-left: 2px solid var(--line); border-bottom: 0; font-size: .88rem }
#log .tlDot { margin-left: -17px; margin-top: 4px; width: 12px; height: 12px; background: var(--accent); border: 3px solid var(--panel); border-radius: 50%; flex: 0 0 12px }
#advChip { display: none; position: absolute; left: 8px; bottom: 8px; z-index: 6; border-radius: 999px; padding: 4px 12px; min-height: 38px }
body.noAdv #advChip:not([hidden]) { display: block }
#advCount { display: block }
#advMin { padding: 6px 10px; min-width: 40px }

/* ---- Sprint 8a: products + wizard modes ---- */
.prodList { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 }
.prodRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel-2); border-radius: 10px; padding: 8px 10px }
.prodName { display: flex; flex-direction: column; min-width: 0; flex: 1 }
.prodPrice { font-size: .85rem; color: var(--muted) } .prodPrice s { opacity: .7 }
.prodPrice .disc { color: var(--good); font-style: normal; font-weight: 700 }
.prodActs { display: flex; gap: 6px } .prodActs button { min-height: 38px; padding: 4px 10px }

/* ---- Sprint 8b: selected state for option buttons (accountant level, utility switches) ---- */
button.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); font-weight: 700 }

/* ---- Sprint 9: ads ---- */
#adBanner { display: none; padding: 4px 8px; background: var(--bg) }
#adBanner canvas { display: block; width: 100%; max-width: 360px; margin: 0 auto; border-radius: 8px }
body.hasAd #adBanner { display: block }
@media (max-width: 820px) { body.hasAd #stage { height: calc(100dvh - 58px - var(--nav-h) - 62px) } }
.adPreview { width: 100%; max-width: 420px; display: block; margin: 8px auto; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line) }
.adField { display: block; margin: 6px 0 } .adField input[type=color] { width: 100%; min-height: 40px; padding: 2px }

/* ---- Narrow phones: keep every header button visible (speed, clock, board, theme, menu) ---- */
header h1 { min-width: 0; flex: 1 1 auto }
header h1 small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100% }
#speedBtn { white-space: nowrap }
@media (max-width: 480px) {
  header { gap: 6px; padding: 6px 8px; flex-wrap: nowrap }
  header button { padding: 6px 8px; min-width: 38px; min-height: 38px }
  header #boardBtn, #helpBtn, #themeBtn, #menuBtn { font-size: 1rem }
  #speedBtn { padding: 6px 6px; font-size: .78rem }
  #clockBox b { display: none }
  header h1 { font-size: 1rem }
}

/* ---- Sprint 10: rental bar ---- */
#vehBar { padding: 4px 12px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px }
#vehBar[hidden] { display: none }
.vehRow { display: flex; align-items: center; gap: 10px; font-size: .82rem } .vehRow span { white-space: nowrap }
.vehRow .bar { flex: 1; margin: 0; height: 8px } .vehRow.low .bar > i { background: var(--bad) }

/* ---- Sprint 11a: city map + minimap ---- */
#mapOverlay { position: fixed; inset: 0; z-index: 60; background: rgba(10, 14, 24, .55); display: grid; place-items: center; padding: 12px }
#mapOverlay[hidden] { display: none }
.mapCard { width: min(100%, 760px); max-height: 94dvh; overflow: auto }
.mmHead { display: flex; align-items: center; justify-content: space-between; gap: 8px } .mmHead h3 { margin: 0 }
.mmHead button { min-height: 34px; padding: 2px 10px }
.trMap { width: 100%; height: auto; display: block; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-radius: 12px; margin: 8px 0 }
.trLand { fill: var(--panel-2); stroke: var(--muted); stroke-width: 1.2 } .trSea { fill: color-mix(in srgb, var(--accent) 10%, var(--panel)); stroke: var(--muted); stroke-width: .8 }
.trCity { cursor: pointer } .trCity circle { stroke: var(--panel); stroke-width: 2 } .trCity text { font: 600 11px system-ui, sans-serif; fill: var(--text); paint-order: stroke; stroke: var(--panel); stroke-width: 3px }
.trCity.open circle { fill: var(--good) } .trCity.premium circle { fill: var(--warn) } .trCity.soon circle { fill: var(--muted) }
.trCity.sel circle { stroke: var(--accent); stroke-width: 4 } .trCity:focus-visible circle, .trCity:hover circle { stroke: var(--accent) }
.mapStatus { margin: 4px 0; font-weight: 600 } .mapLegend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-bottom: 8px }
#mapBtn { position: absolute; top: 8px; right: 52px; z-index: 3; min-height: 30px; padding: 2px 10px; opacity: .9 }
#mapBtn[hidden], #minimap[hidden] { display: none }
#minimap { position: absolute; top: 44px; right: 8px; z-index: 7; width: min(360px, calc(100% - 16px)); background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; max-height: 70%; display: flex; flex-direction: column; gap: 6px }
#mmCv { width: 100%; height: 72px; display: block; border-radius: 8px; background: var(--panel-2); cursor: pointer }
#mmList { overflow: auto; display: flex; flex-direction: column; gap: 4px } .mmItem { text-align: left; min-height: 36px; padding: 4px 10px; font-size: .85rem }

/* ---- Sprint 11b: travel overlay ---- */
#travelOverlay { position: fixed; inset: 0; z-index: 70; background: rgba(10, 14, 24, .72); display: grid; place-items: center; padding: 16px }
#travelOverlay[hidden] { display: none }
.travelCard { width: min(100%, 420px); text-align: center }
.travelIcon { font-size: 3rem; animation: travelBounce 1s ease-in-out infinite } @keyframes travelBounce { 50% { transform: translateY(-6px) } }
.travelCard .bar { height: 10px; margin: 12px 0 }

/* ---- Sprint 12: home ---- */
.lifeBar { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: .85rem } .lifeBar span { min-width: 96px }
.lifeBar .bar { flex: 1; margin: 0; height: 10px } .lifeBar b { min-width: 28px; text-align: right }
.lifeBar .bar > i.bad { background: var(--bad) } .lifeBar .bar > i.good { background: var(--good) }

/* ---- Sprint 13b: resume + away summary ---- */
.resumeBox { border: 2px solid var(--accent) !important }
.awayDelta { font-variant-numeric: tabular-nums; color: var(--good) } .awayDelta.neg { color: var(--bad) }

/* Sprint 14: sales roleplay */
.pitchHead { display: flex; align-items: center; gap: 10px; margin: 6px 0 }
.pitchFace { font-size: 34px }
.pitchLine { font-style: italic; margin: 10px 0; padding: 10px 12px; background: rgba(255,255,255,.07); border-radius: 10px }
.pitchReact { margin: 4px 0; font-weight: 600 }
.pitchReact.best { color: #4ade80 } .pitchReact.ok { color: #facc15 } .pitchReact.poor { color: #f87171 }
.pitchReward { font-weight: 700; color: #4ade80 }
#modalBody .prodList button { text-align: left; white-space: normal }
.pitchHead small { display: block }

/* Sprint 15: help + tutorial */
.helpLog { max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin: 8px 0; padding: 4px }
.helpMsg { padding: 8px 12px; border-radius: 12px; max-width: 92%; font-size: .92rem }
.helpMsg.bot { background: rgba(127,127,127,.15); align-self: flex-start }
.helpMsg.me { background: var(--accent, #2563eb); color: #fff; align-self: flex-end }
.helpMsg.bot > span { display: block; margin-bottom: 4px }
.helpChips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px } .helpChips button { font-size: .8rem; padding: 4px 10px; text-align: left }
#tutBox { position: absolute; left: 10px; bottom: 120px; width: 250px; max-width: calc(100% - 20px); padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--panel) 94%, transparent); color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,.2); font-size: .85rem; z-index: 5 }
#tutBox .tutHead { display: flex; align-items: center; gap: 8px } #tutBox .tutHead small { margin-left: auto } #tutBox .tutHead button { padding: 0 6px; min-height: 24px }
#tutBox ul { list-style: none; margin: 6px 0 0; padding: 0 } #tutBox li { padding: 2px 0 } #tutBox li.done { opacity: .55; text-decoration: line-through }
@media (max-width: 760px) { #tutBox { bottom: 150px; width: 210px; font-size: .78rem } }

/* Sprint 17b: planner */
.gantt { overflow-x: auto; max-height: 40vh; overflow-y: auto; margin: 8px 0; border: 1px solid rgba(127,127,127,.25); border-radius: 10px }
.gRow { display: flex; align-items: center; border-bottom: 1px solid rgba(127,127,127,.15); min-height: 34px }
.gLabel { flex: 0 0 150px; position: sticky; left: 0; background: var(--panel, #fff); z-index: 2; padding: 2px 8px; font-size: .8rem; display: flex; flex-direction: column }
.gTrack { position: relative; height: 26px; flex: 0 0 auto }
.gBar { position: absolute; top: 5px; height: 16px; border-radius: 6px; opacity: .9 }
.gToday { position: absolute; top: 0; bottom: 0; width: 2px; background: #f59e0b; z-index: 1 }
.gTick { position: absolute; top: 4px; font-size: .65rem; opacity: .6; font-style: normal }
.gActs { flex: 0 0 auto; display: flex; gap: 4px; padding: 0 6px; position: sticky; right: 0; background: var(--panel, #fff); z-index: 2 } .gActs button { padding: 2px 8px; min-height: 26px }
.calGrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 8px 0 }
.calCell { display: flex; flex-direction: column; align-items: center; min-height: 46px; padding: 4px; font-size: .8rem } .calCell.today { outline: 2px solid #f59e0b }
.calCell em { display: flex; gap: 2px; margin-top: 2px } .calCell em i { width: 7px; height: 7px; border-radius: 50% }
.calDetail { min-height: 40px; font-size: .85rem; margin-bottom: 6px }
.planF { display: flex; flex-direction: column; gap: 2px; flex: 0 1 auto !important }

/* ===== UI-1 skin: sticker buttons, navy chrome, game fonts ===== */
h1, h2, h3, h4, .chip .v, nav b, .kpi b, .mmHead b, .tutHead b { font-family: var(--font-head); letter-spacing: .01em }
h3 { font-weight: 800 } h4 { font-weight: 700 }
.chip .v, .kpi, .mini, #clockTxt, td, .pitchReward { font-variant-numeric: tabular-nums }
button { border-bottom-width: 3px; border-radius: 12px; font-weight: 700; transition: background .15s, transform .06s, box-shadow .06s }
button:hover { background: var(--line) }
button:active { transform: translateY(2px); border-bottom-width: 1px; margin-bottom: 2px }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-deep); font-family: var(--font-head); font-size: 1.02em; letter-spacing: .01em }
button.primary:hover { filter: brightness(1.05); background: var(--accent) }
button:disabled { opacity: .55; cursor: not-allowed }
input, select, textarea { border-radius: 12px; border-bottom-width: 2px }
.card, .chip, .co, .mode { border-radius: var(--radius) }
.bar > i { background: linear-gradient(90deg, var(--accent), #ffd166) }
.bar > i.good { background: var(--good) } .bar > i.bad { background: var(--bad) }

header { background: var(--nav); color: var(--nav-ink); border-bottom: 3px solid var(--accent); box-shadow: 0 3px 12px rgba(0, 0, 0, .18) }
header h1 { font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; color: var(--accent); letter-spacing: .02em }
header h1 small { font-family: var(--font-body); color: var(--nav-dim); font-weight: 600 }
header #day, header .muted { color: var(--nav-dim) }
header button { background: rgba(255, 244, 221, .12); border-color: rgba(255, 244, 221, .18); color: var(--nav-ink) }
header button:hover { background: rgba(255, 244, 221, .22) }
header #clockTxt { color: var(--nav-ink) }
nav { background: var(--nav) !important; border-top: 3px solid var(--accent) !important }
nav button { color: var(--nav-dim); border-radius: 0; font-weight: 700 }
nav button:hover { background: rgba(255, 244, 221, .08) }
nav button.active { color: var(--accent) !important; background: rgba(255, 183, 3, .14) }
#roomBar { background: var(--panel-2); border-bottom: 1px solid var(--line) }
#modal > div, #modalBody { border-radius: var(--radius) }
#toast { font-weight: 700 }

/* ===== UI-2: compact mobile header, drawer redesign, nav polish ===== */
#hdrStats { display: none; align-items: center; gap: 6px; margin-left: auto; min-width: 0 }
.hpill { display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 244, 221, .12); border: 1px solid rgba(255, 244, 221, .18); border-radius: 999px; padding: 3px 10px; font-size: .85rem; color: var(--nav-ink); white-space: nowrap; position: relative; overflow: hidden }
.hpill b { font-family: var(--font-head); font-variant-numeric: tabular-nums; font-size: .95rem }
.hpill .hxp { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 244, 221, .18) } .hpill .hxp u { display: block; height: 100%; background: var(--accent); text-decoration: none }
@media (max-width: 820px) {
  header { gap: 6px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)) }
  header h1 small, #clockBox, #helpBtn, #boardBtn, #themeBtn { display: none }
  header h1 { font-size: 1.15rem }
  #hdrStats:not([hidden]) { display: flex }
  #speedBtn { padding: 4px 8px; min-height: 36px; min-width: 0 } #menuBtn { min-height: 36px; padding: 4px 10px }
  nav button { position: relative; transition: color .15s }
  nav button span { transition: transform .15s, background .15s; border-radius: 999px; padding: 0 12px; line-height: 1.5 }
  nav button.active span { background: rgba(255, 183, 3, .22); transform: translateY(-1px) }
  nav button.unread::after { content: ""; position: absolute; top: 6px; left: calc(50% + 10px); width: 10px; height: 10px; border-radius: 50%; background: var(--bad); border: 2px solid var(--nav) }
}
@media (max-width: 380px) { .hpill { padding: 2px 7px; font-size: .78rem } #hdrLvl b + .hxp { display: block } }
@media (prefers-reduced-motion: reduce) { #drawer, nav button span { transition: none } }

#drawer { background: var(--panel); padding: 0; gap: 0; overflow-y: auto; width: min(340px, 88vw); border-left: 3px solid var(--accent) }
#drawer > * { margin-left: 16px; margin-right: 16px }
#dwProfile { margin: 0; padding: 18px 16px 14px; padding-top: max(18px, env(safe-area-inset-top)); background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; gap: 8px }
#dwProfile .dwHead { display: flex; flex-direction: column } #dwProfile .dwHead b { font-family: var(--font-head); font-size: 1.25rem; color: var(--accent) } #dwProfile .muted { color: var(--nav-dim) }
#dwProfile .bar { background: rgba(255, 244, 221, .2) } .dwStats { display: flex; justify-content: space-between; font-weight: 700; font-size: .88rem }
.dwGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; margin-bottom: 6px }
.dwGrid button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; min-height: 68px; font-size: .78rem; text-align: center }
.dwGrid button span { font-size: 1.5rem; line-height: 1.1 } .dwGrid button b { font-family: var(--font-head); font-weight: 700; line-height: 1.1 }
#drawer h3 { margin-top: 12px; margin-bottom: 6px }
.dwRow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; margin-bottom: 4px } .dwRow label { flex: 1 } .dwRow select, .dwRow button { flex: 1.4; min-width: 0 }
#drawer #toggleStatus { margin-top: 8px } #drawer #closeDrawer { margin-top: 10px; margin-bottom: max(16px, env(safe-area-inset-bottom)) }
#scrim { background: rgba(10, 16, 41, .5); backdrop-filter: blur(2px) }

/* ===== UI-3: desktop left rail + single-focus side panel ===== */
@media (min-width: 821px) {
  :root { --hdr-h: 61px; --rail-w: 72px }
  nav { display: flex; flex-direction: column; align-items: stretch; gap: 4px; position: fixed; left: 0; top: var(--hdr-h); bottom: 0; width: var(--rail-w); padding: 10px 6px; background: var(--nav) !important; border-top: 0 !important; border-right: 3px solid var(--accent); z-index: 15 }
  nav button { position: relative; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 2px 6px; min-height: 58px; background: none; border: 0; border-radius: 14px; color: var(--nav-dim); font-size: .66rem }
  nav button span { font-size: 1.45rem; line-height: 1.15 } nav button b { font-weight: 700 }
  nav button:hover { background: rgba(255, 244, 221, .1); color: var(--nav-ink) }
  nav button.active { background: rgba(255, 183, 3, .18); color: var(--accent) !important; box-shadow: inset 3px 0 0 var(--accent) }
  nav button::after { content: attr(data-key); position: absolute; top: 3px; right: 6px; font-size: .58rem; opacity: .45; font-weight: 800 }
  nav button.unread::before { content: ""; position: absolute; top: 8px; left: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); border: 2px solid var(--nav) }
  nav button[data-tab="menu"] { margin-top: auto }
  main { padding-left: calc(var(--rail-w) + 12px) }
  /* one focus at a time: the street view shows the overview (chat + finance + profile), other tabs show their own card */
  #side .card { display: none }
  #side[data-view="street"] .card[data-panel="chat"], #side[data-view="street"] .card[data-panel="finance"], #side[data-view="street"] .card[data-panel="profile"],
  #side[data-view="finance"] .card[data-panel="finance"], #side[data-view="chat"] .card[data-panel="chat"], #side[data-view="profile"] .card[data-panel="profile"],
  #side[data-view="events"] .card[data-panel="events"], #side[data-view="guide"] .card[data-panel="guide"], #side[data-view="ideas"] .card[data-panel="ideas"] { display: block }
  #side[data-view]:not([data-view="street"]) .card.collapsed > *:not(h3) { display: revert !important }
}

/* ===== UI-4: bottom sheet, tab animations, glow ===== */
#sheetHandle { display: none }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
@keyframes glowUp { 0% { box-shadow: 0 0 0 0 rgba(255, 183, 3, .85); transform: scale(1) } 35% { box-shadow: 0 0 0 7px rgba(255, 183, 3, 0); transform: scale(1.1) } 100% { box-shadow: none; transform: scale(1) } }
@keyframes glowDown { 0% { box-shadow: 0 0 0 0 rgba(255, 107, 74, .7) } 40% { box-shadow: 0 0 0 6px rgba(255, 107, 74, 0) } 100% { box-shadow: none } }
.hpill.glowUp { animation: glowUp .7s ease-out } .hpill.glowDown { animation: glowDown .6s ease-out }
@media (min-width: 821px) { #side .card { animation: cardIn .18s ease-out } }
@media (max-width: 820px) {
  #side { padding-top: 0; border-top: 3px solid var(--accent); touch-action: pan-y; overscroll-behavior: contain }
  #sheetHandle { display: flex; justify-content: center; padding: 10px 0 8px; cursor: grab; touch-action: none; position: sticky; top: 0; z-index: 2; background: var(--bg) }
  #sheetHandle i { width: 44px; height: 5px; border-radius: 3px; background: var(--line); display: block }
  #side { transition: transform .28s cubic-bezier(.2, .9, .3, 1.05) }
  #side .card.active { animation: cardIn .22s ease-out }
}
@media (prefers-reduced-motion: reduce) { #side .card, #side .card.active, .hpill.glowUp, .hpill.glowDown { animation: none !important } #side { transition: none !important } }

/* ===== Sprint 20: support buildings ===== */
#modalBody.wideBody { width: min(820px, 96vw) }
.ossList { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; margin: 6px 0 }
.ossTool { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); overflow: hidden } .ossTool.open { border-color: var(--accent) }
.ossHead { width: 100%; text-align: left; background: none; border: 0; border-radius: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px; min-height: 0 }
.ossHead b { font-family: var(--font-head); font-size: 1.02rem } .ossDesc { flex-basis: 100%; color: var(--muted); font-weight: 500 }
.ossDetail { padding: 4px 12px 12px; border-top: 1px dashed var(--line) } .ossDetail ol { margin: 4px 0; padding-left: 20px }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .7rem; font-weight: 800; background: var(--line) }
.tag.lic.osi { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good) } .tag.lic.fair-code, .tag.lic.source-available { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn) }
.extLink { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--line); color: var(--text); font-weight: 700; font-size: .8rem; text-decoration: none } .extLink:hover { background: var(--accent); color: var(--accent-ink) }
.gfWrap { display: grid; grid-template-columns: 230px 1fr; gap: 12px; margin: 8px 0 }
.gfTower { display: flex; flex-direction: column; gap: 3px; max-height: 52vh; overflow: auto }
.gfFloor { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; min-height: 36px; font-size: .82rem; border-radius: 8px }
.gfFloor i { font-style: normal; font-family: var(--font-head); width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 50%; background: var(--line); font-size: .85rem }
.gfFloor.seen i { background: var(--good); color: #fff } .gfFloor.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-deep) } .gfFloor.on i { background: var(--accent-ink); color: var(--accent) }
.gfPanel { background: var(--panel-2); border-radius: 12px; padding: 12px 14px } .gfPanel h3 { margin: 2px 0 6px }
@media (max-width: 640px) { .gfWrap { grid-template-columns: 1fr } .gfTower { max-height: 26vh } }

/* Sprint 21b: tool install */
.ossInstall { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line) } .ossInstall select { flex: 1 1 140px } .ossInstall small { flex-basis: 100% }
.ossTool.dim { opacity: .6 }

/* Fix: cards in the scrolling lists were shrinking to thin lines (flex items default to shrink) */
.ossList > .ossTool { flex: 0 0 auto; min-height: min-content }
.ossList { flex: 0 1 auto; min-height: 0 }
.ossDetail { overflow: visible }
#modalBody > * { flex-shrink: 0 }                 /* modal content must scroll as a whole, never get squeezed */
.ossList { max-height: none; overflow: visible }
.gfTower { max-height: none }
@media (max-width: 640px) { .gfTower { max-height: none } }
.chip .sub { display: block; font-size: .66rem; margin-top: 2px; line-height: 1.15 } .dateChip { min-width: 118px }

/* Sprint 24: driving */
#carHud { position: absolute; top: 150px; right: 10px; z-index: 6; min-width: 210px; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: var(--shadow); font-size: .8rem; display: flex; flex-direction: column; gap: 4px }
#carHud .carRow { display: grid; grid-template-columns: 92px 1fr 36px; align-items: center; gap: 6px } #carHud .carRow b { font-variant-numeric: tabular-nums; text-align: right }
#carBtn { position: absolute; right: 14px; bottom: 150px; z-index: 6; padding: 12px 16px; font-size: 1rem }
@media (max-width: 820px) { #carHud { top: 140px; right: 6px; min-width: 190px } #carBtn { bottom: 230px } }
#carHud[hidden] { display: none }

/* Mobile: every popup gets a ✕ in its top-right corner (modal + bottom sheet) */
.modalX, #sheetClose { display: none }
@media (max-width: 820px) {
  .modalX { display: grid; place-items: center; position: sticky; top: 0; align-self: flex-end; width: 36px; height: 36px; min-height: 36px; padding: 0; margin: -4px -4px -2px 0; z-index: 3; border-radius: 50%; font-size: 1rem; line-height: 1; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(20, 25, 40, .18) }
  #side { position: fixed }
  #sheetClose { display: grid; place-items: center; position: absolute; top: 6px; right: 10px; width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 50%; font-size: .95rem; z-index: 3; background: var(--panel); border: 1px solid var(--line) }
  #side:not(.open) #sheetClose { display: none }
}

/* Sprint 29b: street zoom buttons + world map */
#zoomBox { position: absolute; top: 44%; transform: translateY(-50%); right: 8px; z-index: 3; display: flex; flex-direction: column; gap: 4px }
#zoomBox[hidden] { display: none }
#zoomBox button { width: 36px; min-height: 36px; height: 36px; padding: 0; font-size: 1.05rem; line-height: 1; border-radius: 10px; opacity: .92 }
#stage { touch-action: none }
.worldMap .trCity.wm circle { fill: var(--muted); stroke: var(--panel); stroke-width: 2 }
.worldMap .trCity.wm.open circle { fill: #8c96a8 } .worldMap .trCity.wm.has circle { fill: var(--good) }
.worldMap .trCity.wm.here circle:first-of-type { stroke: var(--accent); stroke-width: 4 }
.worldMap .pulse { fill: none !important; stroke: var(--accent); stroke-width: 2; animation: wmPulse 1.6s ease-out infinite }
@keyframes wmPulse { from { opacity: .9; transform-origin: center; r: 11 } to { opacity: 0; r: 24 } }
.worldMap text.nm { font: 700 11px system-ui, sans-serif; paint-order: stroke; stroke: var(--panel); stroke-width: 3px }
.worldMap text.bd { font: 700 11px system-ui, sans-serif; fill: var(--text); paint-order: stroke; stroke: var(--panel); stroke-width: 3px }
#mapOverlay.wmFade .mapCard { animation: wmIn .45s ease-out }
@keyframes wmIn { from { opacity: 0; transform: scale(1.18) } to { opacity: 1; transform: none } }
@media (max-width: 820px) {
  .worldMap text.nm { font-size: 17px; stroke-width: 4px } .worldMap text.bd { font-size: 16px; stroke-width: 4px }
  .worldMap .trCity.wm circle:first-of-type { r: 12px } .worldMap .trCity.wm.has circle:first-of-type { r: 15px }
}

/* Sprint 32: Guide encyclopedia */
.wikiTop { display: flex; gap: 6px; align-items: center; margin: 6px 0 } .wikiTop input { flex: 1; min-width: 0 } .wikiHam { display: none }
.wikiChips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 } .wikiChips .chip { min-height: 30px; padding: 3px 10px; font-size: .82rem; border-radius: 999px }
.wiki { display: grid; grid-template-columns: 230px 1fr; gap: 12px; margin-top: 6px }
.wikiTree { display: flex; flex-direction: column; gap: 2px; max-height: 56vh; overflow: auto; padding-right: 4px }
.wikiTree .catRow { display: flex; align-items: center; gap: 2px } .wikiTree .arrow { width: 24px; min-height: 28px; padding: 0; background: transparent; border: 0; box-shadow: none; font-size: .9rem }
.wikiTree .catBtn { flex: 1; text-align: left; min-height: 30px; padding: 3px 8px; font-size: .86rem; background: transparent; border: 1px solid transparent; box-shadow: none; white-space: normal }
.wikiTree .catBtn.on { background: color-mix(in srgb, var(--accent) 22%, var(--panel)); border-color: var(--accent); font-weight: 700 }
.wikiMain { min-width: 0; max-height: 56vh; overflow: auto } .wikiMain > * { flex-shrink: 0 }
.wikiRow { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; margin: 4px 0; padding: 8px 10px; white-space: normal; background: var(--panel-2); border: 1px solid var(--line) }
.wikiRow span { font-size: .84rem; opacity: .85 } .wikiMeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px }
.wikiMeta .tag { background: var(--accent); color: #1c1c1c; border-radius: 999px; padding: 1px 10px; font-size: .78rem; font-weight: 700 } .wikiMeta .crumb { min-height: 26px; padding: 1px 8px; font-size: .78rem; background: transparent; border: 1px dashed var(--line); box-shadow: none }
.wikiSteps { margin: 4px 0 10px 1.2em; padding: 0 } .wikiSteps li { margin: 4px 0 }
@media (max-width: 640px) {
  .wikiHam { display: inline-flex } .wiki { grid-template-columns: 1fr } .wikiTree { display: none; max-height: 40vh; border: 1px solid var(--line); border-radius: 10px; padding: 6px }
  .wiki.treeOpen .wikiTree { display: flex } .wikiMain { max-height: none }
}

/* Sprint 32b: Guide button, reachable from anywhere */
#guideBtn { position: absolute; top: 8px; right: 96px; z-index: 3; min-height: 30px; padding: 2px 10px; opacity: .9 }
#guideBtn[hidden] { display: none }

/* Sprint 33: accessibility — color-blind-safe palette (Okabe-Ito), high contrast, text size, reduced motion, strong focus ring */
html:root[data-cb] { --good: #0072b2; --bad: #d55e00; --warn: #9a6a00; --accent: #e69f00; --accent-deep: #8a5d00; --series-1: #0072b2; --series-2: #d55e00 }
@media (prefers-color-scheme: dark) { html:root[data-cb]:not([data-theme="light"]) { --good: #56b4e9; --bad: #f0a060; --warn: #f0e442; --accent: #f0b429 } }
html:root[data-cb][data-theme="dark"] { --good: #56b4e9; --bad: #f0a060; --warn: #f0e442; --accent: #f0b429 }
html:root[data-hc] { --bg: #ffffff; --panel: #ffffff; --panel-2: #f1f1f1; --line: #1a1a1a; --text: #000000; --muted: #1f1f1f; --accent-deep: #6b4600; --nav: #000000; --nav-ink: #ffffff; --nav-dim: #ffffff }
@media (prefers-color-scheme: dark) { html:root[data-hc]:not([data-theme="light"]) { --bg: #000000; --panel: #0b0b0b; --panel-2: #1a1a1a; --line: #ffffff; --text: #ffffff; --muted: #e6e6e6 } }
html:root[data-hc][data-theme="dark"] { --bg: #000000; --panel: #0b0b0b; --panel-2: #1a1a1a; --line: #ffffff; --text: #ffffff; --muted: #e6e6e6 }
html[data-hc] button, html[data-hc] input, html[data-hc] select, html[data-hc] textarea, html[data-hc] .card { border: 2px solid var(--line) }
html[data-text="l"] { font-size: 17px } html[data-text="xl"] { font-size: 19.5px }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important }
:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 2px; border-radius: 6px }
html[data-hc] :focus-visible { outline: 4px solid var(--text) }
.skipLink { position: fixed; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 10px; font-weight: 800; text-decoration: none } .skipLink:focus { top: 8px }
.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.a11yRow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line) } .a11yRow .opts { display: flex; gap: 6px; flex-wrap: wrap }

/* QA sweep: one right-hand button column (guide, map, zoom, world) instead of buttons lying on top of the HUD cards */
#hud { right: 52px }
@media (max-width: 820px) { #hud { right: 52px } }
#zoomBox { top: 60px; transform: none; gap: 5px }
#zoomBox button { position: static !important; width: 38px; min-height: 38px; height: 38px; padding: 0; font-size: 1.05rem; line-height: 1; border-radius: 10px; opacity: .95 }
#zoomBox button[hidden] { display: none }
@media (max-width: 820px) { #zoomBox { top: 50%; transform: translateY(-40%) } }
#advisor { width: min(680px, calc(100% - 24px)) }
@media (min-width: 821px) { #advText b, #advText small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical } }

/* QA sweep: nothing may overprint anything else — hint, tutorial, toast and FPS bar are anchored to the advisor's real height (--advH) */
@media (min-width: 821px) {
  #advisor { bottom: 40px }
  #status { bottom: 8px }
  #hint { bottom: calc(var(--advH, 70px) + 52px) }
  #tutBox { bottom: calc(var(--advH, 70px) + 86px) }
  #toast { bottom: auto; top: 72px }
}
@media (max-width: 820px) { #toast { bottom: auto; top: 66px; max-width: calc(100vw - 24px) } }
@media (max-width: 1180px) { #day { display: none } }
/* landscape phones: the desktop layout is too short for HUD + advisor + tutorial at once */
@media (max-height: 520px) and (min-width: 821px) {
  #tutBox, #advisor { display: none !important }
  body #advChip { display: none !important }
  #hud { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 5px }
  #zoomBox { top: 48px; gap: 3px } #zoomBox button { width: 34px; min-height: 34px; height: 34px }
  #status { display: none }
}
@media (max-height: 520px) and (min-width: 821px) {
  #hint { display: none }
  #hud .chip:nth-child(n+4) { display: none } #hud .chip .bar, #hud .chip .sub { display: none }
  #hud .chip { min-height: 0; padding: 4px 10px }
}

/* QA sweep: tighter, predictable dialog typography (flex column + default margins used to leave 50px gaps under titles); wiki "All" button must not stretch */
#modalBody > h3, #modalBody > h4 { margin: 2px 0 } #modalBody > p { margin: 2px 0 }
.wikiTree > .catBtn { flex: none }
.wikiTree .catRow .catBtn { flex: 1 }

/* toasts must not land on a dialog's title: with a dialog open (desktop) they move to the bottom edge */
body.modalOn #toast { top: auto !important; bottom: 22px !important }

/* inside buildings: street-only helpers (tutorial box, key hint) must not cover the floor plan; the floor bar sits above the FPS strip */
body.inBuilding #tutBox, body.inBuilding #hint { display: none !important }
@media (min-width: 821px) { body.inBuilding #innerBar { bottom: 40px } }
@media (max-width: 820px) { #innerBar { flex-wrap: wrap; justify-content: center; max-width: calc(100% - 16px) } #innerBar b { max-width: none; flex: 1 0 100%; text-align: center; padding: 0 } }
@media (max-height: 520px) { body.inBuilding #hud { display: none } body.inBuilding #innerBar { top: 6px; bottom: auto } }
@media (max-height: 520px) { body.inBuilding #innerBar b { max-width: none; overflow: visible } }

/* Sprint 34: dialog tools (full screen + close) and full-screen dialogs */
.modalTools { display: flex; gap: 6px; justify-content: flex-end; position: sticky; top: 0; z-index: 3; align-self: flex-end; margin: -4px -4px -2px 0 }
.modalTools button { width: 36px; height: 36px; min-height: 36px; padding: 0; margin: 0; display: grid; place-items: center; border-radius: 50%; font-size: 1rem; line-height: 1; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(20, 25, 45, .18) }
.modalTools .modalX { position: static !important; display: none; margin: 0 !important; align-self: auto !important }
@media (max-width: 820px) { .modalTools .modalX { display: grid } }
#modal.full { align-items: stretch !important; justify-content: stretch !important; background: var(--panel) !important }
#modal.full #modalBody { width: 100vw !important; max-width: 100vw !important; height: 100dvh !important; max-height: 100dvh !important; border-radius: 0 !important; box-shadow: none !important; padding: 14px clamp(14px, 4vw, 48px) calc(18px + env(safe-area-inset-bottom)) }
#modal.full .wikiTree, #modal.full .wikiMain { max-height: calc(100dvh - 300px) }
#modal.full .gfTower { max-height: calc(100dvh - 330px) }

/* ---- Sprint 37: sound panel (header 🔊) ---- */
#audioBtn { font-size: 1.1rem; padding: 6px 12px }
.audPanel { position: fixed; top: 58px; right: 10px; z-index: 70; width: min(350px, calc(100vw - 20px)); max-height: calc(100dvh - 70px); overflow: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 10px }
.audHead { display: flex; align-items: center; justify-content: space-between } .audHead button { min-height: 34px; padding: 2px 10px }
.audRow { display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--panel-2); border-radius: 10px }
.audTop { display: flex; align-items: center; gap: 8px }
.audToggle { min-width: 36px; min-height: 36px; padding: 0; border-radius: 50%; font-weight: 800; background: var(--good); color: #fff; border-color: transparent }
.audToggle.off { background: var(--panel); color: var(--muted); border-color: var(--line) }
.audRow input[type=range] { width: 100%; min-height: 28px; accent-color: var(--accent) } .audRow input[type=range]:disabled { opacity: .4 }
.audMeter { height: 10px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; margin: 6px 0 } .audMeter > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--good), var(--warn), var(--bad)); transition: width .06s linear }
.audAll { min-height: 40px }
@media (max-width: 480px) { #audioBtn { display: none } .audPanel { top: 52px; right: 8px; max-height: calc(100dvh - 130px) } }

/* ---- brand mark in the header (desktop/tablet only; phones keep the space for the buttons) ---- */
.brandMark { width: 34px; height: 34px; flex: none; border-radius: 9px }
@media (max-width: 600px) { .brandMark { display: none } }
