/* Fonts are served with the game (see tools/vendor.mjs). */
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url('vendor/fonts/barlow-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url('vendor/fonts/barlow-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url('vendor/fonts/barlow-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url('vendor/fonts/barlow-condensed-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url('vendor/fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url('vendor/fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-display: swap; src: url('vendor/fonts/playfair-display-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-weight: 900; font-display: swap; src: url('vendor/fonts/playfair-display-latin-900-normal.woff2') format('woff2'); }

/* Red Dot City — UI layer over the 3D canvas.
   Layout: floating HUD strip on top, MRT-style tool chips along the bottom,
   camera buttons on the right edge, sheets for panels. One light "signage" look. */
:root {
  --ink: #18232f;
  --ink-2: #3a4754;
  --muted: #66717c;
  --paper: #fbfaf6;
  --paper-2: #efece4;
  --line: rgba(24, 35, 47, 0.14);
  --accent: #d42e12;
  --good: #009645;
  --warn: #e08a00;
  --bad: #c62a10;
  --info: #005ec4;
  --glass: rgba(251, 250, 246, 0.92);
  --shadow: 0 6px 20px rgba(16, 28, 40, 0.18), 0 1px 3px rgba(16, 28, 40, 0.12);
  --display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 12px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bfe3ee; color: var(--ink); font: 15px/1.4 var(--body); -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
#ui > * { pointer-events: auto; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

/* ---------- HUD ---------- */
.hud {
  position: absolute; top: calc(8px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r));
  display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; pointer-events: none;
}
.hud > * { pointer-events: auto; }
.plate {
  background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 6px 12px; display: flex; align-items: center; gap: 12px; min-height: 44px;
}
.city-plate { gap: 10px; }
.city-plate .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 3px rgba(212, 46, 18, 0.18); }
.city-name { font: 700 19px/1.05 var(--display); letter-spacing: 0.01em; white-space: nowrap; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
.city-date { font: 500 13px/1.1 var(--body); color: var(--muted); white-space: nowrap; }
.stat { display: flex; flex-direction: column; line-height: 1.05; }
.stat .k { font: 600 10px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat .v { font: 700 19px/1.15 var(--display); white-space: nowrap; }
.stat .v.neg { color: var(--bad); }
.rci { display: flex; gap: 3px; align-items: center; height: 34px; }
.rci .bar { width: 12px; height: 34px; position: relative; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.rci .bar i { position: absolute; left: 0; right: 0; }
.rci .bar::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, 0.25); }
.rci .lbl { position: absolute; bottom: -1px; left: 0; right: 0; text-align: center; font: 700 9px/1 var(--display); color: rgba(0, 0, 0, 0.55); z-index: 1; }
.speed { display: flex; gap: 2px; padding: 4px; }
.speed button { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font: 700 14px/1 var(--display); color: var(--ink-2); }
.speed button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.menu-btn { width: 44px; justify-content: center; padding: 0; font: 700 20px/1 var(--display); }
.spacer { flex: 1; }
.weather { font: 600 12px/1.1 var(--body); color: var(--muted); white-space: nowrap; }
.weather .neg { color: var(--bad); }
.util { flex-direction: column; justify-content: center; align-items: stretch; gap: 4px; }
.gauge { display: grid; grid-template-columns: 40px 76px auto; align-items: center; gap: 7px; cursor: pointer; }
.gauge .k { font: 600 10px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.gauge .track { height: 8px; border-radius: 4px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.gauge .track i { display: block; height: 100%; border-radius: 4px; background: var(--good); transition: width 0.4s; }
.gauge .n { font: 700 14px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 52px; }
.gauge[data-level='warn'] .track i { background: var(--warn); }
.gauge[data-level='bad'] .track i { background: var(--bad); }
.gauge[data-level='bad'] .n { color: var(--bad); }

/* ---------- Toasts ---------- */
.toasts { position: absolute; top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--paper); border-radius: 10px; box-shadow: var(--shadow); padding: 9px 12px 9px 14px;
  border-left: 5px solid var(--info); font-size: 14px; display: flex; gap: 8px; align-items: center; animation: toast-in 0.25s ease-out;
}
.toast.good { border-color: var(--good); } .toast.warn { border-color: var(--warn); } .toast.bad { border-color: var(--bad); }
.toast span { flex: 1; }
.toast button { font: 600 12px/1 var(--body); color: var(--info); padding: 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Toolbar ---------- */
.toolbar {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 calc(8px + var(--safe-r)) calc(8px + var(--safe-b)) calc(8px + var(--safe-l));
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toolbar > * { pointer-events: auto; }
.tray, .cats { max-width: 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; }
.tray::-webkit-scrollbar, .cats::-webkit-scrollbar { display: none; }
.cat { flex: none; display: flex; align-items: center; gap: 7px; padding: 6px 10px 6px 6px; border-radius: 11px; min-height: 44px; white-space: nowrap; }
.cat[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.code { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 6px; border-radius: 13px; color: #fff; font: 700 13px/1 var(--display); letter-spacing: 0.03em; background: var(--c, var(--ink)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.cat .name { font: 600 14px/1 var(--body); }
.tool { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 7px 10px; border-radius: 11px; min-width: 92px; text-align: left; position: relative; }
.tool .name { font: 600 13px/1.15 var(--body); white-space: nowrap; }
.tool .cost { font: 500 12px/1 var(--body); color: var(--muted); }
.tool[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.tool[aria-pressed='true'] .cost { color: rgba(255, 255, 255, 0.7); }
.tool:disabled { opacity: 0.42; cursor: not-allowed; }
.tool .lock { font-size: 11px; color: var(--muted); }

/* ---------- Desktop / tablet palette ---------- */
.palette {
  position: absolute; left: calc(8px + var(--safe-l)); top: calc(62px + var(--safe-t)); display: none; flex-direction: column; gap: 6px; padding: 6px;
  background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 14px; box-shadow: var(--shadow);
}
.pal-grid { display: grid; grid-template-columns: repeat(2, 44px); gap: 4px; }
.pal-btn { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; position: relative; }
.pal-btn:hover { background: var(--paper-2); }
.pal-btn[aria-pressed='true'] { background: #fff; box-shadow: inset 0 0 0 2px var(--ink); }
.pal-btn.multi::after { content: ''; position: absolute; right: 3px; bottom: 3px; border: 3.5px solid transparent; border-right-color: var(--ink-2); border-bottom-color: var(--ink-2); border-radius: 1px; }
.pal-btn.dim svg { opacity: 0.4; }
.pal-sep { height: 1px; background: var(--line); margin: 0 4px; }
.flyout { position: absolute; min-width: 230px; max-width: calc(100vw - 120px); background: var(--paper); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.fly-title { font: 600 11px/1 var(--body); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding: 6px 8px 5px; }
.fly-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 8px; text-align: left; min-height: 42px; }
.fly-item .name { font: 600 14px/1.2 var(--body); }
.fly-item .cost, .fly-item .lock { font: 500 12px/1 var(--body); color: var(--muted); white-space: nowrap; }
.fly-item:hover:not(:disabled), .fly-item:focus-visible { background: var(--paper-2); }
.fly-item[aria-checked='true'] { background: var(--ink); color: var(--paper); }
.fly-item[aria-checked='true'] .cost, .fly-item[aria-checked='true'] .name small { color: rgba(255, 255, 255, 0.7); }
.fly-item:disabled { opacity: 0.45; cursor: not-allowed; }
.ico { display: grid; place-items: center; height: 26px; }
.ico svg { display: block; }
.fly-item[aria-checked='true'] .ico, .tool[aria-pressed='true'] .ico { background: var(--paper); border-radius: 7px; padding: 2px; width: 30px; height: 30px; margin: -2px; }

/* ---------- Camera controls ---------- */
.camctl { position: absolute; right: calc(8px + var(--safe-r)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; }
.camctl button { width: 44px; height: 44px; border-radius: 12px; background: var(--glass); box-shadow: var(--shadow); display: grid; place-items: center; font: 700 18px/1 var(--display); color: var(--ink-2); }
.camctl button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.camctl svg { width: 22px; height: 22px; }

/* ---------- Pointer tooltip & legend ---------- */
.tip { position: absolute; pointer-events: none !important; background: var(--ink); color: var(--paper); padding: 5px 9px; border-radius: 8px; font: 600 13px/1.2 var(--body); white-space: nowrap; transform: translate(-50%, -140%); box-shadow: var(--shadow); }
.tip.bad { background: var(--bad); }
@media (max-width: 760px) { .tip { white-space: normal; max-width: 220px; } }
.legend { position: absolute; left: calc(8px + var(--safe-l)); top: calc(64px + var(--safe-t)); background: var(--glass); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 10px; font: 600 12px/1.3 var(--body); display: flex; gap: 8px; align-items: center; }
.legend .ramp { width: 90px; height: 10px; border-radius: 5px; }
.legend button { color: var(--info); font-weight: 600; }

/* ---------- Sheets / panels ---------- */
.scrim { position: absolute; inset: 0; background: rgba(12, 22, 32, 0.35); display: grid; place-items: center; padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); }
.sheet { background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); width: min(640px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.sheet header { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet header h2 { margin: 0; font: 700 24px/1.1 var(--display); flex: 1; text-wrap: balance; }
.sheet .close { width: 40px; height: 40px; border-radius: 10px; font: 600 22px/1 var(--body); color: var(--muted); }
.sheet .body { padding: 14px 16px 18px; overflow: auto; -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 9px 12px; font: 600 14px/1 var(--body); color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected='true'] { color: var(--ink); border-color: var(--accent); }
h3 { font: 700 15px/1.2 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
h3:first-child { margin-top: 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .label { flex: 1; min-width: 0; }
.row .label small { display: block; color: var(--muted); font-size: 12.5px; }
.row .val { font: 700 16px/1 var(--display); white-space: nowrap; }
.line-chip { flex: none; min-width: 34px; padding: 4px 6px; border-radius: 6px; color: #fff; font: 700 13px/1 var(--display); text-align: center; letter-spacing: 0.04em; }
.muted { color: var(--muted); }
.row input[type='range'] { width: min(46vw, 220px); accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger td { padding: 4px 0; border-bottom: 1px solid var(--line); }
.ledger td:last-child { text-align: right; font-weight: 600; }
.ledger tr.total td { border-bottom: 0; font: 700 16px/1.3 var(--display); }
.pos { color: var(--good); } .neg { color: var(--bad); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 11px; font: 600 15px/1 var(--body); background: var(--paper-2); color: var(--ink); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: #c9c5bb; transition: background 0.15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--info); outline-offset: 2px; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { padding: 8px 12px; border-radius: 8px; font: 600 14px/1 var(--body); color: var(--ink-2); min-height: 36px; }
.seg button[aria-pressed='true'] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
input[type='text'], select { font: 500 15px/1 var(--body); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); min-height: 42px; }
.chart { width: 100%; height: 120px; display: block; }
.chart-wrap { margin-bottom: 14px; }
.chart-wrap .cap { display: flex; justify-content: space-between; font: 600 13px/1.2 var(--body); color: var(--ink-2); margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 8px; }
.kv div { background: var(--paper-2); border-radius: 10px; padding: 8px 10px; }
.kv .k { font: 600 11px/1.2 var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kv .v { font: 700 21px/1.2 var(--display); }
.slot { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.slot .label { flex: 1; min-width: 0; }
.slot .label b { font: 700 17px/1.2 var(--display); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .label small { color: var(--muted); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font: 700 11px/1.5 var(--display); letter-spacing: 0.05em; text-transform: uppercase; background: var(--paper-2); color: var(--ink-2); }
.pill.chill { background: #d7efe0; color: #0b6b3a; }
.pill.classic { background: #f9dcd5; color: #9a2410; }
.query { position: absolute; left: calc(8px + var(--safe-l)); bottom: calc(150px + var(--safe-b)); width: min(320px, calc(100% - 70px)); background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; }
.query h4 { margin: 0 0 6px; font: 700 19px/1.15 var(--display); padding-right: 28px; }
.query .close { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); font-size: 20px; }
.query dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 13.5px; }
.query dt { color: var(--muted); }
.query dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- New city screen ---------- */
.newcity { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 440px) 1fr; pointer-events: none; }
.newcity > * { pointer-events: auto; }
.newcity .panel { background: var(--paper); height: 100%; overflow: auto; padding: calc(22px + var(--safe-t)) 22px calc(22px + var(--safe-b)) calc(22px + var(--safe-l)); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.brand h1 { margin: 0; width: 100%; max-width: 360px; }
.brand h1 img { display: block; width: 100%; height: auto; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lab { font: 600 12px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field .help { font-size: 13px; color: var(--muted); margin: 0; }
.namebox { display: flex; gap: 6px; }
.namebox input { flex: 1; min-width: 0; font: 700 20px/1 var(--display); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode { text-align: left; border-radius: 12px; padding: 12px; background: var(--paper-2); display: flex; flex-direction: column; gap: 4px; border: 2px solid transparent; }
.mode b { font: 700 20px/1 var(--display); }
.mode small { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.mode[aria-pressed='true'] { border-color: var(--ink); background: #fff; }
.continue { display: flex; gap: 8px; flex-wrap: wrap; }
.nc-form { display: flex; flex-direction: column; gap: 14px; }
.nc-switch { align-self: stretch; }
.nc-switch button { flex: 1; }
.scn-list { display: flex; flex-direction: column; gap: 10px; }
.scn { border-radius: 12px; padding: 12px 14px; background: var(--paper-2); border: 2px solid transparent; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.scn[aria-pressed='true'] { border-color: var(--ink); background: #fff; }
.scn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scn-head b { font: 700 20px/1 var(--display); }
.scn p { margin: 0; font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
.scn ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.45; }
.scn .btn { align-self: flex-start; }
.tag { font: 700 11px/1 var(--body); letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 7px; border-radius: 6px; background: #dfe9d8; color: #1f5b24; }
.tag.medium { background: #f7e7c6; color: #7a4d00; }
.tag.hard { background: #f6d6cf; color: #8a1e0a; }
.goal-chip { display: flex; flex-direction: column; justify-content: center; gap: 4px; cursor: pointer; min-width: 120px; }
.goal-chip .k { font: 600 10px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.goal-chip .t { font: 700 14px/1 var(--display); white-space: nowrap; }
.progress { height: 8px; border-radius: 4px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 4px; background: var(--good); transition: width 0.4s; }
.goal-check { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.goal-check:last-child { border-bottom: 0; }
.goal-check .top { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.goal-check .top b { font: 700 15px/1.2 var(--display); white-space: nowrap; }
.tutorial { position: absolute; left: calc(76px + var(--safe-l)); bottom: calc(16px + var(--safe-b)); width: min(360px, calc(100% - 24px)); background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; z-index: 5; border-left: 4px solid var(--accent); }
.tutorial b { font: 700 19px/1.1 var(--display); }
.tutorial p { margin: 0; font-size: 14px; line-height: 1.4; }
.tutorial .btns { margin-top: 4px; flex-wrap: wrap; }
.tutorial .btn { min-height: 36px; padding: 0 12px; font-size: 14px; }
.tut-top { display: flex; justify-content: space-between; align-items: center; }
.tut-top .k { font: 600 10px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.tut-top .dots { display: flex; gap: 4px; }
.tut-top .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tut-top .dots i.done { background: var(--good); }
.tut-top .dots i.now { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); }
.tut-start { align-self: stretch; border: 2px dashed var(--line); background: transparent; }
.nc-starts { display: flex; flex-direction: column; gap: 8px; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 46, 18, 0.55); } 50% { box-shadow: 0 0 0 6px rgba(212, 46, 18, 0); } }
.pal-btn.pulse, .cat.pulse { animation: pulse 1.4s ease-in-out infinite; outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 760px), (max-height: 559px) { .tutorial { left: calc(12px + var(--safe-l)); right: calc(68px + var(--safe-r)); width: auto; bottom: calc(76px + var(--safe-b)); } } /* clear of the camera buttons on the right */
@media (prefers-reduced-motion: reduce) { .pal-btn.pulse, .cat.pulse { animation: none; } }
.fly-item .name small { display: block; font: 500 12px/1.2 var(--body); color: var(--muted); margin-top: 1px; }
.tool .info { display: block; font: 500 11px/1.15 var(--body); color: var(--muted); }
#ui > .town-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; } /* a full-screen layer: clicks must reach the map */
.town-label { position: absolute; left: 0; top: 0; pointer-events: auto; font: 700 13px/1 var(--display); letter-spacing: 0.03em; color: #fff; padding: 3px 7px; border-radius: 6px; background: rgba(24, 35, 47, 0.55); white-space: nowrap; }
.town-label:hover { background: rgba(24, 35, 47, 0.85); }
#ui.photo-on > *:not(.photo-strip) { display: none !important; }
.photo-strip { position: absolute; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%); width: min(620px, calc(100% - 16px)); display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: var(--r); box-shadow: var(--shadow); pointer-events: auto; }
.ph-panel { display: flex; flex-direction: column; gap: 8px; }
.ph-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ph-row .k { font: 600 10px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.ph-slider { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ph-slider .k { width: 38px; }
.ph-slider input { flex: 1; min-width: 0; accent-color: var(--accent); }
.ph-slider .n { font: 700 13px/1 var(--display); min-width: 38px; text-align: right; }
.ph-switch { display: flex; align-items: center; gap: 8px; }
.ph-rides { display: flex; flex-wrap: wrap; gap: 4px; }
.ph-rides .btn, .ph-main .btn { min-height: 36px; padding: 0 12px; font-size: 14px; }
.ph-note { font-size: 13px; color: var(--muted); }
.ph-main { justify-content: center; }
.paper { font-family: Georgia, 'Times New Roman', serif; color: #1d1b18; background: #f7f3ea; margin: -4px -2px 0; padding: 14px 16px 16px; border-radius: 8px; }
.paper .masthead { border-bottom: 3px double #1d1b18; padding-bottom: 6px; margin-bottom: 10px; text-align: center; }
.paper .masthead .name { font: 900 clamp(26px, 6vw, 38px)/1 'Playfair Display', Georgia, serif; letter-spacing: 0.01em; }
.paper .masthead .meta { display: flex; justify-content: space-between; font: 600 11px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 8px; border-top: 1px solid #1d1b18; padding-top: 5px; }
.paper h3 { font: 900 clamp(22px, 5vw, 30px)/1.08 'Playfair Display', Georgia, serif; margin: 0 0 6px; color: inherit; text-transform: none; letter-spacing: 0; }
.paper h4 { color: inherit; text-transform: none; letter-spacing: 0; }
.paper h4 { font: 700 17px/1.15 'Playfair Display', Georgia, serif; margin: 0 0 4px; }
.paper p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.45; }
.paper .lead { border-bottom: 1px solid #b9b2a4; padding-bottom: 8px; margin-bottom: 10px; }
.paper .cols { display: grid; grid-template-columns: 1fr 170px; gap: 14px; }
.paper .stories section { border-bottom: 1px solid #d8d1c3; padding-bottom: 6px; margin-bottom: 8px; }
.paper .stories section:last-child { border-bottom: 0; }
.paper aside { border-left: 1px solid #b9b2a4; padding-left: 12px; display: flex; flex-direction: column; gap: 10px; }
.paper .box b { font: 700 11px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; }
.paper .box p { margin: 3px 0 0; font-size: 13.5px; }
.paper .box .big { font: 900 28px/1 'Playfair Display', Georgia, serif; }
.paper .letter { border-top: 3px double #1d1b18; margin-top: 8px; padding-top: 8px; }
.paper .letter b { font: 700 11px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; }
.paper .letter p { font-style: italic; margin: 4px 0 2px; }
.paper .letter small { color: #6b655a; }
@media (max-width: 560px) { .paper .cols { grid-template-columns: 1fr; } .paper aside { border-left: 0; padding-left: 0; border-top: 1px solid #b9b2a4; padding-top: 8px; } }
.ach { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ach .badge { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); color: var(--muted); font: 700 16px/1 var(--display); }
.ach.got .badge { background: var(--accent); color: #fff; }
.ach small { display: block; color: var(--muted); font-size: 12.5px; }
.ach:not(.got) b { color: var(--muted); }
.newcity .peek-area { pointer-events: none !important; }
.peek-hint { position: absolute; bottom: calc(18px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 14px; font: 600 15px/1.2 var(--body); box-shadow: var(--shadow); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font: 700 22px/1 var(--display); color: var(--ink); }

@media (max-width: 760px) {
  .newcity { grid-template-columns: 1fr; grid-template-rows: auto; }
  .newcity .panel { height: auto; max-height: 100%; }
  .newcity .peek-area { display: none; }
  .brand h1 { max-width: 280px; }
  .city-name { font-size: 17px; max-width: 42vw; }
  .stat .v { font-size: 17px; }
  .plate { padding: 5px 9px; gap: 9px; }
  .hide-sm { display: none !important; }
  .query { bottom: calc(160px + var(--safe-b)); }
  .tool { min-width: 0; width: 92px; }
  .tool .name { white-space: normal; font-size: 12.5px; }
  .cat .name { display: none; }
  .cat { padding: 6px 4px; min-height: 40px; }
  .cats { gap: 2px; padding: 4px; }
  .code { min-width: 30px; }
  .toasts { top: calc(118px + var(--safe-t)); }
  .legend { top: calc(118px + var(--safe-t)); }
}
@media (max-width: 420px) {
  .speed button { width: 32px; height: 32px; }
  .rci .bar { width: 10px; }
}
@media (max-width: 1120px) { .weather-plate { display: none; } }
/* Narrow desktops in a scenario: the goal chip takes the weather plate's place. */
@media (max-width: 1240px) { .hud.has-goal .weather-plate { display: none; } }
/* Tablets: room for the utility gauges, the weather shows in the city overview. */
@media (min-width: 761px) and (max-width: 1000px) {
  .hide-md { display: none !important; }
  .gauge { grid-template-columns: 40px 56px auto; }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Desktop and tablet: icon palette on the left replaces the bottom bar and camera buttons. */
@media (min-width: 761px) and (min-height: 560px) {
  .palette { display: flex; }
  .toolbar, .camctl { display: none; }
  .query { left: auto; right: calc(8px + var(--safe-r)); bottom: calc(8px + var(--safe-b)); }
  .legend { top: auto; bottom: calc(10px + var(--safe-b)); left: 50%; transform: translateX(-50%); }
}
