/* Metro Blocks City HUD and in-game panels. Menus and dialogs are styled by css/shell.css from data/theme.json.
   Colours are variables: keep them in step with theme.json "colors". */
:root {
  --bg: #1a2026;           /* page, darkest panels */
  --bg2: #252d35;          /* panels, buttons */
  --bg3: #313b45;          /* raised buttons */
  --panel: rgba(26, 32, 38, .92);
  --text: #e4e8ec;
  --muted: #9aa6b2;
  --accent: #ffcc33;       /* selected / primary */
  --ink: #1a2026;
  --good: #5fd36a;
  --bad: #ff6f5e;
  --r: #5fd36a; --c: #5aa8ff; --i: #f2c94c;
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; touch-action: none; }
#game canvas { display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: var(--text); background: var(--bg3); border: 0; border-radius: 9px; padding: 6px 12px; cursor: pointer; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: .45; cursor: default; filter: none; }
button.primary { background: var(--accent); color: var(--ink); font-weight: 700; }
button.danger { background: var(--bad); color: #fff; font-weight: 700; }
button.link { background: none; color: var(--muted); text-decoration: underline; padding: 4px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg .f { fill: currentColor; stroke: none; }
img.ki { width: 26px; height: 26px; vertical-align: middle; }
.icon { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; }
.icon.small { width: 28px; height: 28px; font-size: 18px; }
.good { color: var(--good); } .bad { color: var(--bad); }

/* top bar */
#hud { zoom: var(--gs-text, 1); }
#btn-menu { width: 42px; height: 42px; flex: 0 0 auto; }
#top { position: fixed; left: 8px; right: 8px; top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; pointer-events: none; z-index: 5; }
#top > * { pointer-events: auto; }
#lvl-name, #clock, .chip { background: var(--panel); padding: 6px 10px; border-radius: var(--radius); font-weight: 700; white-space: nowrap; height: 40px; display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.chip img.ki { width: 24px; height: 24px; }
#money { color: var(--text); }
#money small { color: var(--good); font-weight: 600; font-size: 11px; margin-left: 2px; }
#money small.neg { color: var(--bad); }
#money.bad b { color: var(--bad); }
#happy.good b { color: var(--good); } #happy.bad b { color: var(--bad); }
#rci { display: flex; gap: 4px; background: var(--panel); border-radius: var(--radius); padding: 4px 8px; height: 40px; align-items: flex-end; cursor: pointer; }
#rci .d { position: relative; width: 14px; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
#rci .d::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid rgba(255,255,255,.25); }
#rci .d i { position: absolute; left: 1px; right: 1px; bottom: 50%; max-height: 50%; border-radius: 3px 3px 0 0; transition: height .3s; }
#rci .d.neg i { bottom: auto; top: 50%; border-radius: 0 0 3px 3px; opacity: .55; }
#rci .dR i { background: var(--r); } #rci .dC i { background: var(--c); } #rci .dI i { background: var(--i); }
#rci .d span { position: absolute; bottom: -2px; font-size: 9px; font-weight: 800; color: var(--muted); }
#rci .d i { height: 0; }
#clock { min-width: 74px; justify-content: center; }
.grow { flex: 1; pointer-events: none !important; }
#speed { display: flex; background: var(--panel); border-radius: var(--radius); padding: 4px; gap: 4px; height: 40px; }
#speed .sp { padding: 4px 8px; background: transparent; display: inline-flex; align-items: center; gap: 2px; }
#speed .sp svg { width: 16px; height: 16px; }
#speed .sp.on { background: var(--accent); color: var(--ink); }

/* goals */
#goals { position: fixed; left: 8px; top: 58px; display: grid; gap: 5px; z-index: 4; pointer-events: none; }
.goal { background: var(--panel); border-radius: var(--radius); padding: 5px 10px 6px 6px; display: grid; grid-template-columns: 26px auto auto; align-items: center; column-gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 190px; }
.goal img { width: 26px; height: 26px; grid-row: span 2; object-fit: contain; }
.goal .gl { font-size: 13px; }
.goal .gn { text-align: right; color: var(--accent); }
.goal i { display: block; grid-column: 2 / 4; height: 4px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
.goal i b { display: block; height: 100%; width: 0; background: var(--accent); }
.goal.done i b { background: var(--good); }
.goal.done .gn { color: var(--good); }
.goal.sandbox, .goal.limit { grid-template-columns: auto; min-width: 0; color: var(--muted); font-weight: 600; font-size: 12px; }

/* data views */
#views { position: fixed; right: 8px; top: 58px; display: grid; gap: 4px; z-index: 4; }
.vw { width: 52px; height: 48px; padding: 2px; display: grid; place-items: center; background: var(--panel); }
.vw img.ki, .vw svg { width: 22px; height: 22px; }
.vw small { font-size: 9px; color: var(--muted); }
.vw.on { background: var(--accent); color: var(--ink); } .vw.on small { color: var(--ink); }
#legend { position: fixed; left: 50%; transform: translateX(-50%); top: 56px; background: var(--panel); padding: 6px 10px; border-radius: 10px; font-size: 12px; color: var(--muted); max-width: 300px; z-index: 4; pointer-events: none; }
#legend b { color: var(--text); }

/* bottom: hint, tray, toolbar */
#bottom { position: fixed; left: 0; right: 0; bottom: calc(8px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 5; pointer-events: none; }
#bottom > * { pointer-events: auto; }
#hint { background: var(--panel); padding: 6px 12px; border-radius: 10px; max-width: min(720px, calc(100vw - 16px)); color: var(--muted); font-size: 13px; text-align: center; pointer-events: none !important; }
#hint b { color: var(--text); } #hint .cost { color: var(--accent); font-weight: 700; margin: 0 4px; }
#dragcost { background: var(--accent); color: var(--ink); padding: 4px 12px; border-radius: 10px; font-weight: 700; pointer-events: none !important; }
#dragcost b.bad { color: #a01d10; }
#tray, #toolbar { display: flex; gap: 6px; background: var(--panel); padding: 6px; border-radius: 16px; max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: thin; }
#tools { display: flex; gap: 6px; }
.tool { position: relative; min-width: 64px; height: 66px; padding: 2px 4px; display: grid; grid-template-rows: 1fr auto; place-items: center; flex: 0 0 auto; background: var(--bg2); }
.tool img { max-width: 54px; max-height: 42px; object-fit: contain; pointer-events: none; }
.tool img.ki { width: 32px; height: 32px; }
.tool .ti svg { width: 28px; height: 28px; }
.tool small { font-weight: 700; font-size: 11px; white-space: nowrap; }
.tool.item { height: 78px; grid-template-rows: 1fr auto auto; min-width: 72px; }
.tool em { font-style: normal; font-size: 10px; color: var(--accent); font-weight: 700; }
.tool.poor em { color: var(--bad); }
.tool.on, .tool.open { background: var(--accent); color: var(--ink); }
.tool.on em { color: var(--ink); }

/* info panel */
#panel { position: fixed; right: 68px; top: 58px; width: 290px; max-width: calc(100vw - 16px); background: var(--panel); border-radius: 14px; padding: 10px 12px; z-index: 6; border: 1px solid rgba(255,255,255,.06); }
.ph { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
#panel-status { color: var(--muted); margin: 4px 0 6px; }
#panel-body p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 3px 0; }
.row label { color: var(--muted); font-size: 12px; }
.why { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.why span { background: rgba(95,211,106,.16); border-radius: 8px; padding: 2px 7px; font-size: 12px; }
.why span.neg { background: rgba(255,111,94,.22); }
p.bad { color: var(--bad) !important; }
.bar { height: 6px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; margin: 4px 0 6px; }
.bar b { display: block; height: 100%; background: var(--accent); }
#panel-acts { display: flex; gap: 6px; margin-top: 8px; }
#panel-acts .act { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
#panel-acts img.ki { width: 18px; height: 18px; }
.small { font-size: 12px; }

/* inside shell dialogs (briefing, help, budget, pause) */
.goals-big { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.goals-big div { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.22); border: 1px solid var(--line, #34404b); border-radius: 10px; padding: 4px 12px 4px 4px; }
.goals-big img, .goals-big img.ki { width: 38px; height: 38px; object-fit: contain; }
.tips { margin: 10px 0 0; padding-left: 20px; color: var(--text); font-size: calc(15px * var(--gs-text, 1)); }
.tips li { margin: 4px 0; }
.gs-p.small, p.small { font-size: calc(13px * var(--gs-text, 1)); color: var(--muted); }
.center { text-align: center; }
b.acc { color: var(--accent); }
table.keys { border-collapse: collapse; width: 100%; font-size: calc(14px * var(--gs-text, 1)); }
table.keys td { padding: 4px 6px; border-bottom: 1px solid #34404b; } table.keys td:first-child { color: var(--accent); white-space: nowrap; font-weight: 700; }
.pause-goals { display: grid; gap: 7px; margin: 12px 4px 2px; text-align: left; }
.pg { display: grid; grid-template-columns: 22px 1fr auto; column-gap: 8px; align-items: center; font-weight: 700; color: var(--text); }
.pg img { width: 22px; height: 22px; object-fit: contain; }
.pg em { font-style: normal; color: var(--muted); font-weight: 500; }
.pg i { grid-column: 2 / 4; height: 6px; border-radius: 4px; background: rgba(0,0,0,.35); overflow: hidden; }
.pg i b { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.pg.done i b { background: var(--good); }
.taxes { display: grid; gap: 6px; margin: 10px 0; }
.tax { display: grid; grid-template-columns: 190px 1fr 44px; align-items: center; gap: 8px; color: var(--text); }
.tax span { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.tax input { width: 100%; accent-color: var(--accent); }
.tax b { text-align: right; font-variant-numeric: tabular-nums; }
table.budget { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: calc(14px * var(--gs-text, 1)); color: var(--text); }
table.budget th { text-align: right; color: var(--muted); font-weight: 600; font-size: 12px; }
table.budget td { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
table.budget td:not(:first-child) { text-align: right; }
table.budget tr.tot td { font-weight: 800; border-bottom: 0; }
.chart { margin-top: 10px; background: rgba(0,0,0,.22); border-radius: 10px; padding: 8px; }
.chart svg { width: 100%; height: 64px; }
.chart small { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chart i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; }
/* the Metro Blocks banner is a yellow street sign: dark ink on it (the shell default is light text) */
.gs-banner { aspect-ratio: 963 / 180; width: min(440px, 86%); padding-top: 0; transform: translate(-50%, -55%); }
.gs-banner span { color: #1a2026; text-shadow: 0 1px 0 rgba(255,255,255,.45); }
.gs-results.gs-lost .gs-banner span { color: #7a1a10; }
/* shell stars + locks in the Metro Blocks art (assets/ui/star_*.png, lock.png) */
.gs-stars i, .gs-res-stars i { clip-path: none; background: transparent url(../assets/ui/star_off.png) center/contain no-repeat; width: 18px; height: 18px; }
.gs-stars i.on, .gs-res-stars i.on { background: transparent url(../assets/ui/star_on.png) center/contain no-repeat; }
.gs-res-stars i { width: 58px; height: 58px; }
.gs-res-stars i:nth-child(2) { transform: translateY(-10px) scale(1.12); }
.gs-lock { width: 46px; height: 52px; margin-left: -23px; top: 30px; background: url(../assets/ui/lock.png) center/contain no-repeat; border-radius: 0; }
.gs-levels-foot .gs-stars i { width: 20px; height: 20px; vertical-align: -3px; }

@media (max-width: 1100px) { #lvl-name { display: none; } }
/* phones */
@media (max-width: 760px) {
  #top { gap: 4px; left: 4px; right: 4px; top: 4px; }
  #lvl-name, #clock, .chip, #rci, #speed { height: 34px; }
  #btn-menu { width: 36px; height: 36px; }
  .chip { padding: 4px 7px; font-size: 13px; } .chip img.ki { width: 18px; height: 18px; }
  #money small { display: none; }
  #clock { display: none; }
  #speed .sp { padding: 2px 6px; font-size: 12px; }
  #speed .sp svg { display: none; } #speed .sp[data-s="0"] svg { display: inline; }
  #rci { padding: 3px 6px; } #rci .d { width: 10px; }
  #goals { top: 84px; }
  .goal { padding: 3px 8px 4px 4px; grid-template-columns: 20px auto auto; min-width: 150px; }
  .goal img { width: 20px; height: 20px; } .goal .gl { font-size: 11px; }
  #views { top: 44px; } .vw { width: 42px; height: 40px; } .vw small { display: none; }
  #legend { top: auto; bottom: calc(150px + var(--safe-b)); max-width: calc(100vw - 16px); }
  .tool { min-width: 52px; height: 56px; } .tool img { max-width: 44px; max-height: 34px; } .tool small { font-size: 10px; }
  .tool.item { height: 68px; min-width: 60px; }
  #hint { font-size: 12px; } #hint .help { display: none; }
  #hud:has(#tray:not([hidden])) #goals { display: none; }
  #panel { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(150px + var(--safe-b)); max-height: 45vh; overflow-y: auto; }
  .tax { grid-template-columns: 130px 1fr 38px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .tool { height: 50px; } .tool img { max-height: 26px; } .tool.item { height: 60px; }
  #panel { top: 48px; bottom: auto; max-height: calc(100vh - 140px); overflow-y: auto; }
}
