/* Car City UI: chunky "toy" pixel look. Rounded cream panels with an ink outline and a solid drop edge,
   one clear colour per mode, the city itself always visible behind menus. */
@font-face { font-family: 'Press Start 2P'; src: url('/games/city/fonts/press-start-2p.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'VT323'; src: url('/games/city/fonts/vt323.woff2') format('woff2'); font-display: block; }
:root {
  --bg: #19203d; --night: rgba(22, 20, 42, 0.86); --panel: #2b3563; --panel2: #222a50; --ink: #221e2c; --paper: #fff6e6; --paper2: #f3e6cf; --sub: #c6c3dc; --muted: #6b6478;
  --yellow: #ffd23f; --green: #43c96b; --red: #e5534b; --blue: #4aa3ff; --orange: #ff9b3d; --pink: #ff6fa5; --teal: #3fc7c0;
  --r: 14px; --r-s: 10px; --edge: 0 4px 0 var(--ink); --edge-s: 0 3px 0 var(--ink);
  --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom); --safe-l: env(safe-area-inset-left); --safe-r: env(safe-area-inset-right);
  --pix: 'Press Start 2P', monospace; --txt: 'VT323', monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--paper); overscroll-behavior: none; font-family: var(--txt); }
body { position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#app { position: absolute; inset: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
img.pix { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; image-rendering: pixelated; }
/* everything you can press sinks into its edge */
.big, .btn, .tool, .fab, .icon-btn, .mode, .level, .speed button, .cats button, .seg button, .stepper button, .sheet-x, .round { transition: transform 0.06s, box-shadow 0.06s; }
.big:active, .btn:active, .tool:active, .fab:active, .icon-btn:active, .mode:active, .level:active, .seg button:active, .stepper button:active, .round:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

/* ---------- HUD: floating pills over the map, no heavy bars */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.topbar { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: calc(8px + var(--safe-t)) calc(8px + var(--safe-r)) 6px calc(8px + var(--safe-l)); pointer-events: none; }
.topbar > * { pointer-events: auto; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; background: var(--yellow); border: 3px solid var(--ink); border-radius: var(--r-s); box-shadow: var(--edge-s); }
.icon-btn img { width: 22px; height: 22px; }
#btnPause img { filter: brightness(0.15); }
.pill { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; background: var(--night); border: 3px solid var(--ink); border-radius: var(--r-s); font-family: var(--pix); font-size: 11px; color: var(--paper); }
.pill .ic { width: 20px; height: 20px; }
.pill b { font-weight: normal; }
.pill small { font-family: var(--txt); font-size: 18px; color: var(--green); }
.pill small.neg { color: #ff8a80; }
.pill.money { background: var(--paper); color: var(--ink); box-shadow: var(--edge-s); }
.pill.money small { color: #1f8a46; }
.pill.money small.neg { color: #c2352c; }
.pill.warn { border-color: var(--red); animation: blink 0.8s steps(1) infinite; }
.pill.clock small { color: var(--sub); }
.pill.clock.rush { background: var(--orange); color: var(--ink); }
.pill.clock.rush small { color: var(--ink); }
@keyframes blink { 50% { background: #6a1d1d; } }
.speed { display: flex; margin-left: auto; background: var(--night); border: 3px solid var(--ink); border-radius: var(--r-s); padding: 3px; gap: 3px; }
.speed button { width: 34px; height: 30px; display: grid; place-items: center; border-radius: 7px; }
.speed button img { width: 18px; height: 18px; filter: invert(1); }
.speed button.on { background: var(--green); }
.speed button.on img { filter: none; }
.speed button[data-speed="0"].on { background: var(--pink); }
.goalcard { position: absolute; left: calc(8px + var(--safe-l)); top: var(--hud-h, calc(58px + var(--safe-t))); max-width: min(440px, calc(100% - 72px)); background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r-s); box-shadow: var(--edge-s); padding: 6px 10px; font-size: 19px; line-height: 1.05; }
.goalcard:empty { display: none; }
.goalcard .k { font-family: var(--pix); font-size: 8px; background: var(--ink); color: var(--yellow); padding: 3px 5px; border-radius: 4px; margin-right: 6px; vertical-align: 2px; }
.goalcard .p { color: #2266c4; }
.goalcard .rw { color: #1f8a46; }
.side { position: absolute; right: calc(8px + var(--safe-r)); top: var(--hud-h, calc(58px + var(--safe-t))); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.fab { width: 44px; height: 44px; display: grid; place-items: center; background: var(--paper); border: 3px solid var(--ink); border-radius: 50%; box-shadow: var(--edge-s); }
.fab img { width: 22px; height: 22px; }
.fab.on { background: var(--yellow); }
.fab.move { width: 52px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.fab.move img { width: 20px; height: 20px; }
.fab.move span { font-family: var(--pix); font-size: 6px; color: var(--ink); }
.fab.move.on { background: var(--green); }
.layers { display: flex; flex-direction: column; gap: 3px; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--r-s); box-shadow: var(--edge-s); padding: 4px; }
.layers button { font-family: var(--pix); font-size: 9px; color: var(--ink); padding: 9px 10px; text-align: left; border-radius: 7px; }
.layers button.on { background: var(--yellow); }

/* ---------- traffic puzzles: no economy pills, one big TEST button */
body.testpuzzle .topbar .pill, body.testpuzzle .speed { display: none; }
body.testpuzzle #btnTest { display: block !important; }
.testbtn { margin-left: auto; height: 44px; padding: 0 22px; background: var(--green); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px; box-shadow: var(--edge-s); font-family: var(--pix); font-size: 13px; }
.testbtn::before { content: ''; display: inline-block; width: 0; height: 0; border-left: 10px solid var(--ink); border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-right: 8px; vertical-align: -1px; }
.testbtn.stop { background: var(--pink); }
.testbtn.stop::before { border: 0; width: 10px; height: 12px; background: var(--ink); }
.testbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.big-num { font-family: var(--pix); font-size: 26px !important; color: var(--ink) !important; margin: 10px 0 6px !important; }
.result-bar { position: relative; height: 18px; background: #eadcc3; border: 3px solid var(--ink); border-radius: 9px; overflow: visible; margin: 4px 8px 10px; }
.result-bar i { display: block; height: 100%; background: var(--green); border-radius: 6px; }
.result-bar b { position: absolute; top: -7px; bottom: -7px; width: 4px; margin-left: -2px; background: var(--ink); border-radius: 2px; }

/* ---------- toolbar: a tray at the bottom */
.toolbar { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px calc(8px + var(--safe-r)) calc(8px + var(--safe-b)) calc(8px + var(--safe-l)); background: var(--night); border-top: 3px solid var(--ink); border-radius: 18px 18px 0 0; }
body.ios-browser .toolbar { padding-bottom: 84px; }
.hint { margin: 0 4px 6px; font-size: 18px; line-height: 1; color: var(--sub); min-height: 18px; }
.hint b { color: var(--yellow); font-weight: normal; }
.tools { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.tools::-webkit-scrollbar { display: none; }
.tool { flex: 0 0 auto; width: 74px; height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge-s); }
.tool .ti { width: 32px; height: 32px; object-fit: contain; }
.tool .tn { font-family: var(--pix); font-size: 7px; max-width: 66px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool .tc { font-size: 15px; line-height: 1; color: #1f8a46; max-width: 66px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool.on { background: var(--yellow); transform: translateY(-3px); box-shadow: 0 6px 0 var(--ink); }
.tool.locked { background: #b8b2c4; }
.tool.locked img { opacity: 0.35; }
.tool.locked .tc { color: var(--ink); }
.cats { display: flex; gap: 4px; background: rgba(0, 0, 0, 0.25); border-radius: var(--r-s); padding: 4px; }
.cats button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 1px 5px; border-radius: 8px; font-family: var(--pix); font-size: 7px; color: var(--sub); }
.cats button .ci { width: 22px; height: 22px; object-fit: contain; }
.cats button.on { background: var(--paper); color: var(--ink); }

/* ---------- toast */
.toast { position: absolute; left: 50%; top: calc(110px + var(--safe-t)); transform: translateX(-50%); display: none; background: var(--yellow); color: var(--ink); padding: 9px 12px; border: 3px solid var(--ink); border-radius: var(--r-s); box-shadow: var(--edge-s); font-family: var(--pix); font-size: 9px; line-height: 1.6; text-align: center; max-width: min(90vw, 440px); pointer-events: none; z-index: 40; text-transform: uppercase; }
.toast.show { display: block; animation: pop 0.18s ease-out; }
@keyframes pop { from { transform: translateX(-50%) scale(0.85); } to { transform: translateX(-50%) scale(1); } }
.toast.warn { background: var(--orange); }
.toast.rush { background: var(--pink); }
.toast.good { background: var(--green); }

/* ---------- screens: the living town shows through */
.screen { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: rgba(25, 32, 61, 0.9); overflow-y: auto; touch-action: pan-y; padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); }
.menu { background: linear-gradient(180deg, rgba(25, 32, 61, 0.1) 0%, rgba(25, 32, 61, 0.35) 38%, rgba(25, 32, 61, 0.9) 70%, rgba(25, 32, 61, 0.97) 100%); align-items: center; justify-content: flex-end; gap: 18px; padding: calc(20px + var(--safe-t)) calc(18px + var(--safe-r)) calc(26px + var(--safe-b)) calc(18px + var(--safe-l)); }
.menu-top { position: absolute; top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r)); display: flex; gap: 8px; }
.round { height: 44px; min-width: 44px; padding: 0 12px; display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px; box-shadow: var(--edge-s); font-family: var(--pix); font-size: 9px; }
.round img { width: 20px; height: 20px; }
.logo { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: auto; margin-top: 8vh; }
.logo img { width: 84px; height: 84px; }
.logo h1 { margin: 0; font-family: var(--pix); font-size: clamp(30px, 9vw, 54px); color: var(--yellow); text-shadow: 0 5px 0 var(--ink), 4px 5px 0 var(--ink), -3px 0 0 var(--ink), 3px 0 0 var(--ink), 0 -3px 0 var(--ink); font-weight: normal; letter-spacing: 1px; }
.logo p { margin: 0; font-family: var(--pix); font-size: 8px; color: var(--paper); background: var(--night); padding: 6px 10px; border-radius: 12px; }
.modes { display: grid; gap: 12px; width: min(460px, 100%); }
.mode { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge); }
.mode .mi { width: 56px; height: 56px; border-radius: 12px; border: 3px solid var(--ink); display: grid; place-items: center; background: var(--c, var(--blue)); }
.mode .mi img { width: 36px; height: 36px; object-fit: contain; }
.mode b { display: block; font-family: var(--pix); font-weight: normal; font-size: 14px; margin-bottom: 4px; }
.mode small { display: block; font-size: 18px; line-height: 1; color: var(--muted); }
.mode em { font-style: normal; font-family: var(--pix); font-size: 9px; background: var(--ink); color: var(--yellow); padding: 5px 7px; border-radius: 8px; white-space: nowrap; }
.mode.campaign { --c: var(--orange); }
.mode.puzzles { --c: var(--blue); }
.mode.build { --c: var(--green); }
.mode.hero { background: var(--c); }
.mode.hero .mi { background: var(--paper); }
.mode.hero small { color: var(--ink); opacity: 0.75; }
.menu-btns, .card-list { display: flex; flex-direction: column; gap: 12px; width: min(460px, 100%); }
.card-list { margin: 0 auto; padding: 18px 16px; }
.big { width: 100%; text-align: left; padding: 15px 16px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge); font-family: var(--pix); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.big small { font-family: var(--txt); font-size: 18px; color: var(--muted); }
.big.primary { background: var(--green); }
.big.primary small { color: var(--ink); opacity: 0.75; }
.big.ghost { background: var(--panel); color: var(--paper); }
.big.ghost small { color: var(--sub); }
.big.danger { background: var(--red); color: var(--paper); }
.tiny { font-size: 17px; color: var(--sub); text-align: center; margin: 6px 0; }
.screen-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; position: sticky; top: 0; background: var(--panel2); border-bottom: 3px solid var(--ink); z-index: 1; }
.screen-head .icon-btn { border-radius: 50%; }
.screen-head h2 { margin: 0; flex: 1; font-family: var(--pix); font-size: 15px; font-weight: normal; color: var(--paper); }
.stars-total { display: flex; gap: 6px; align-items: center; font-family: var(--pix); font-size: 11px; background: var(--ink); padding: 6px 10px; border-radius: 12px; color: var(--yellow); }
.stars-total img { width: 18px; height: 18px; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 16px; }
.level { position: relative; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge); padding: 12px; text-align: left; display: flex; flex-direction: column; gap: 8px; min-height: 136px; }
.level .li { height: 52px; display: flex; align-items: flex-end; }
.level .li img { height: 48px; width: auto; }
.level .ln { font-family: var(--pix); font-size: 9px; line-height: 1.5; }
.level .ls { display: flex; gap: 4px; margin-top: auto; }
.level .ls img { width: 20px; height: 20px; }
.level .ls img.off, .stars img.off { opacity: 0.25; filter: grayscale(1); }
.level.locked { background: var(--panel); color: var(--sub); box-shadow: 0 4px 0 #0f1430; border-color: #0f1430; }
.level.locked .li img { height: 30px; opacity: 0.8; }
.level.locked .ls { opacity: 0.3; }
.level.next { outline: 3px solid var(--yellow); outline-offset: 3px; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge-s); font-family: var(--pix); font-size: 11px; }

/* ---------- modal + sheet */
.modal { position: absolute; inset: 0; z-index: 50; background: rgba(16, 12, 34, 0.62); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(440px, 100%); max-height: 90%; overflow-y: auto; background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 20px; box-shadow: 0 6px 0 var(--ink); padding: 20px 18px 18px; text-align: center; touch-action: pan-y; animation: rise 0.2s ease-out; }
@keyframes rise { from { transform: translateY(16px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card h2 { margin: 6px 0 10px; font-family: var(--pix); font-size: 16px; font-weight: normal; line-height: 1.4; }
.modal-card p { font-size: 20px; line-height: 1.1; margin: 8px 0; color: #4a4356; }
.modal-card .bigicon { display: flex; justify-content: center; }
.modal-card .bigicon img { height: 64px; width: auto; }
.modal-card .stars { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.modal-card .stars img { width: 48px; height: 48px; }
.modal-card .goal-list { text-align: left; background: var(--paper2); border: 3px solid var(--ink); border-radius: var(--r-s); padding: 8px 12px; margin: 12px 0; font-size: 20px; line-height: 1.1; }
.modal-card .goal-list div { padding: 3px 0; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn { flex: 1; padding: 13px 8px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r-s); box-shadow: var(--edge-s); font-family: var(--pix); font-size: 10px; text-transform: uppercase; }
.btn.primary, .btn.good { background: var(--green); }
.btn.danger { background: var(--red); color: var(--paper); }
.sheet-wrap { position: absolute; inset: 0; z-index: 45; background: rgba(16, 12, 34, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { position: relative; width: min(520px, 100%); max-height: 80%; overflow-y: auto; background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 14px 18px calc(18px + var(--safe-b)); touch-action: pan-y; animation: up 0.2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0.4; } to { transform: none; opacity: 1; } }
body.ios-browser .sheet { padding-bottom: 96px; }
.grab { width: 48px; height: 6px; background: #d6c9b2; border-radius: 3px; margin: 0 auto 10px; }
.sheet-x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; display: grid; place-items: center; background: var(--paper2); border: 3px solid var(--ink); border-radius: 50%; }
.sheet-x img { width: 16px; height: 16px; }
.sheet h2 { margin: 0 0 10px; font-family: var(--pix); font-size: 13px; font-weight: normal; padding-right: 44px; line-height: 1.5; }
.sheet h3 { font-family: var(--pix); font-size: 9px; font-weight: normal; color: var(--muted); margin: 16px 0 6px; }
.sheet p { margin: 6px 0; font-size: 19px; line-height: 1.05; color: #4a4356; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 2px solid #eadcc3; font-size: 20px; }
.row:last-child { border-bottom: 0; }
.row b { font-weight: normal; font-family: var(--pix); font-size: 10px; }
.pos { color: #1f8a46; } .neg { color: #c2352c; }
.bar { height: 16px; background: #eadcc3; border: 3px solid var(--ink); border-radius: 8px; margin: 6px 0; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; padding: 10px 8px; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--r-s); box-shadow: var(--edge-s); font-family: var(--pix); font-size: 9px; text-transform: uppercase; }
.seg button.on { background: var(--blue); }
.seg button.locked { background: #d8cfdf; color: var(--muted); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 14px; font-family: var(--pix); font-size: 13px; }
.stepper button { width: 44px; height: 44px; background: var(--paper); border: 3px solid var(--ink); border-radius: 50%; box-shadow: var(--edge-s); font-family: var(--pix); font-size: 16px; }
.slider { display: grid; grid-template-columns: 86px 1fr 52px; gap: 8px; align-items: center; padding: 4px 0; font-size: 20px; }
.slider input { width: 100%; height: 30px; }
.slider b { text-align: right; font-weight: normal; font-family: var(--pix); font-size: 10px; }
#rulesCv { width: min(240px, 70vw); aspect-ratio: 1; display: block; margin: 6px auto; border: 3px solid var(--ink); border-radius: var(--r-s); image-rendering: pixelated; touch-action: none; }
.ms { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 2px solid #eadcc3; font-size: 19px; line-height: 1.05; }
.ms .msi img { width: 24px; height: 24px; }
.ms.done { opacity: 0.55; }
.set-sub { display: block; font-family: var(--txt); font-size: 17px; color: var(--muted); text-transform: none; margin-top: 4px; line-height: 1; }

@media (max-width: 560px) {
  .pill { height: 36px; padding: 0 7px; font-size: 9px; gap: 4px; }
  .pill .ic { width: 16px; height: 16px; }
  .pill small { font-size: 15px; }
  .icon-btn { width: 36px; height: 36px; }
  .speed button { width: 28px; height: 26px; }
  .speed button img { width: 15px; height: 15px; }
  .tool { width: 68px; height: 74px; }
  .goalcard { font-size: 17px; }
  .toast { top: calc(var(--hud-h, calc(92px + var(--safe-t))) + 48px); }
  .mode { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 11px 12px; }
  .mode .mi { width: 48px; height: 48px; }
  .mode b { font-size: 12px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .menu { justify-content: center; }
  .logo { margin: 0; flex-direction: row; gap: 14px; }
  .logo img { width: 56px; height: 56px; }
  .modes { grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(860px, 100%); }
  .mode { grid-template-columns: 1fr; justify-items: start; }
}
/* sliders and checkboxes */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 30px; }
input[type=range]::-webkit-slider-runnable-track { height: 12px; background: #eadcc3; border: 3px solid var(--ink); border-radius: 6px; }
input[type=range]::-moz-range-track { height: 6px; background: #eadcc3; border: 3px solid var(--ink); border-radius: 6px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; background: var(--yellow); border: 3px solid var(--ink); border-radius: 50%; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; background: var(--yellow); border: 3px solid var(--ink); border-radius: 50%; }
input[type=checkbox] { -webkit-appearance: none; appearance: none; flex: none; width: 52px; height: 30px; background: #d8cfdf; border: 3px solid var(--ink); border-radius: 15px; position: relative; }
input[type=checkbox]::after { content: ''; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; background: var(--paper); border: 2px solid var(--ink); border-radius: 50%; transition: left 0.12s; }
input[type=checkbox]:checked { background: var(--green); }
input[type=checkbox]:checked::after { left: 22px; }
.want-menu { width: 100%; }
.want-menu .want-btn { width: 100%; font-size: 12px; padding: 14px; border-radius: var(--r); box-shadow: var(--edge); }
.want-menu .want-n { color: var(--sub); }

/* ---------- cozy style: warm, soft palette (same shapes) */
html.cozy {
  --bg: #2b2433; --night: rgba(43, 36, 51, 0.88); --panel: #574a66; --panel2: #3a3046; --ink: #2e2428; --paper: #fff6e8; --paper2: #f4e5d2; --sub: #d8c8c0;
  --yellow: #f2c879; --green: #8cc78a; --red: #d9807a; --blue: #8fb9d6; --orange: #e7a86a; --pink: #e8a3b8;
}
html.cozy .screen { background: rgba(43, 36, 51, 0.9); }
html.cozy .menu { background: linear-gradient(180deg, rgba(43, 36, 51, 0.05) 0%, rgba(43, 36, 51, 0.35) 38%, rgba(43, 36, 51, 0.9) 70%, rgba(43, 36, 51, 0.97) 100%); }
html.cozy #map { filter: saturate(0.8) contrast(0.96) brightness(1.02); }

/* ---------- campaign map: one card per region, missions inside */
#scrCampaign { overflow-y: auto; }
.camp-list { padding: 10px 14px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; max-width: 900px; margin: 0 auto; }
.region { border: 3px solid var(--ink); border-radius: calc(var(--r) + 4px); box-shadow: var(--edge); overflow: hidden; background: var(--panel); }
.region header { display: flex; gap: 12px; align-items: center; padding: 12px 14px; color: var(--ink); border-bottom: 3px solid var(--ink); }
.region header .ri img { height: 44px; width: auto; }
.region h3 { margin: 0 0 4px; font-family: var(--pix); font-size: 13px; font-weight: normal; }
.region header p { margin: 0; font-size: 19px; line-height: 1; }
.region .level-grid { padding: 12px; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.region .level { min-height: 118px; }
.r-valley header { background: #9ee07a; }
.r-desert header { background: #f2cf86; }
.r-jungle header { background: #4fbf7a; }
.r-frost header { background: #dcecff; }
.region.locked { opacity: 0.75; }
.region.locked header { background: var(--paper2); }

/* ---------- shop */
.round.sparks { background: var(--yellow); }
.shop { padding: 4px 14px calc(28px + var(--safe-b)); max-width: 900px; margin: 0 auto; width: 100%; }
.shop-h { font-family: var(--pix); font-weight: normal; font-size: 12px; color: var(--yellow); margin: 22px 2px 10px; line-height: 1.6; }
.shop-h em { display: block; font-style: normal; font-family: var(--txt); font-size: 19px; color: var(--sub); }
.shop-h em b { color: var(--paper); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shop .item { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge); padding: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; min-height: 96px; }
.shop .item img { height: 44px; width: auto; }
.shop .item b { font-family: var(--pix); font-weight: normal; font-size: 10px; line-height: 1.4; }
.shop .item small { font-size: 18px; line-height: 1; color: var(--muted); }
.shop .item.info { background: var(--paper2); box-shadow: none; }
.shop .item.gold { background: var(--yellow); }
.shop .item.owned { opacity: 0.7; }
.shop .item[disabled] { opacity: 0.5; }
.shop .item:active:not([disabled]):not(.info) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.spk { display: inline-flex; align-items: center; gap: 4px; font-family: var(--pix); font-size: 11px; background: var(--ink); color: var(--yellow); padding: 4px 8px; border-radius: 10px; }
.spk img { height: 14px !important; width: 14px !important; }
.own { font-family: var(--pix); font-size: 9px; color: var(--green); }
.shop-skins { display: flex; gap: 10px; align-items: center; margin: 16px 2px; font-size: 20px; }
.shop > .btn { margin-top: 10px; }
.spark-gain { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--pix); font-size: 12px; color: var(--ink); background: var(--yellow); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 12px; margin: 8px auto; width: max-content; }
.spark-gain img { width: 18px; height: 18px; }
.btn img { display: inline-block; vertical-align: middle; width: 18px; height: 18px; margin-right: 4px; }
.mode.daily { --c: var(--pink); }
.mode.daily.done { opacity: 0.75; }

/* ---------- tutorial coach */
.coach { position: absolute; z-index: 15; background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge); padding: 10px 12px; pointer-events: none; animation: coachBob 1s ease-in-out infinite; }
.coach p { margin: 0; font-family: var(--pix); font-size: 10px; line-height: 1.6; }
.coach i { position: absolute; top: -12px; width: 18px; height: 18px; background: var(--yellow); border-left: 3px solid var(--ink); border-top: 3px solid var(--ink); transform: rotate(45deg); }
.coach.above i { top: auto; bottom: -12px; transform: rotate(225deg); }
@keyframes coachBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
/* 4 modes on a phone: keep the logo clear of the top buttons */
.logo { margin-top: max(6vh, 58px); }
@media (max-height: 960px) {
  .menu { gap: 12px; }
  .logo img { width: 56px; height: 56px; }
  .logo h1 { font-size: clamp(28px, 8vw, 40px); }
  .modes { gap: 10px; }
  .mode { padding: 9px 12px; grid-template-columns: 46px minmax(0, 1fr) auto; }
  .mode .mi { width: 46px; height: 46px; }
  .mode .mi img { width: 30px; height: 30px; }
  .mode b { font-size: 12px; }
  .mode small { font-size: 17px; }
}
.menu { justify-content: flex-start; }
@media (max-height: 720px) { .mode small { display: none; } .logo img { display: none; } }

/* ---------- free build: city list */
.city-list { display: flex; flex-direction: column; gap: 10px; }
.city-row { display: flex; gap: 8px; align-items: stretch; }
.city-row .city-go { flex: 1; min-width: 0; text-align: left; }
.city-row .city-go em { font-style: normal; font-size: 8px; background: var(--ink); color: var(--yellow); padding: 3px 6px; border-radius: 6px; vertical-align: middle; }
.city-row .icon-btn { width: 48px; height: auto; background: var(--paper); }
.city-row .city-del { background: #ffd9d4; }
.big[disabled] { opacity: 0.45; }

/* ---------- world cities + visiting */
.big.world { background: var(--yellow); }
.big.world b { display: block; }
.city-row .city-share { background: var(--paper); }
.city-row .city-share.on { background: var(--green); }
.wrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge-s); padding: 8px 10px; margin-bottom: 8px; }
.wrow .rk { font-family: var(--pix); font-size: 11px; text-align: center; }
.wrow b { display: block; font-family: var(--pix); font-weight: normal; font-size: 10px; line-height: 1.5; }
.wrow small { font-size: 17px; color: var(--muted); }
.wrow.feat { background: #fff1c2; }
.wrow .btn { padding: 8px 10px; font-size: 9px; }
.visitbar { position: absolute; left: 10px; right: 10px; bottom: calc(14px + var(--safe-b)); display: flex; gap: 10px; align-items: center; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge); padding: 10px 12px; }
.visitbar > div { flex: 1; min-width: 0; }
.visitbar b { display: block; font-family: var(--pix); font-weight: normal; font-size: 11px; line-height: 1.5; }
.visitbar small { font-size: 18px; color: var(--muted); }
body.visiting .toolbar, body.visiting #pillMoney, body.visiting #goalCard, body.visiting #btnMove { display: none !important; }
/* many categories: the bar scrolls sideways instead of squeezing the labels */
.cats { overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: 1 0 auto; min-width: 62px; padding: 6px 6px 5px; }
.pick { font-family: var(--txt); font-size: 20px; color: var(--ink); background: var(--paper2); border: 3px solid var(--ink); border-radius: 10px; padding: 6px 8px; max-width: 55%; }

/* new city: landscape picker */
.maptypes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; max-height: 55vh; overflow-y: auto; }
.maptype { background: var(--paper2); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r-s); box-shadow: var(--edge-s); padding: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; }
.maptype img { height: 36px; width: auto; }
.maptype b { font-family: var(--pix); font-weight: normal; font-size: 9px; }
.maptype small { font-size: 16px; line-height: 1; color: var(--muted); }

/* citizens + newspaper */
.people { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.person { background: var(--paper2); border: 2px solid var(--ink); border-radius: 10px; padding: 6px 8px; }
.person b { display: block; font-family: var(--pix); font-weight: normal; font-size: 9px; line-height: 1.5; }
.person small { font-size: 17px; line-height: 1; color: var(--muted); }
.wish { margin: 8px 0; padding: 6px 10px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 10px; font-family: var(--pix); font-size: 9px; line-height: 1.6; }
.fab.news.new { background: var(--yellow); animation: coachBob 1s ease-in-out infinite; }
.paper { background: #fbf6ea; color: var(--ink); border: 3px solid var(--ink); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.paper.old { opacity: 0.7; }
.pday { font-family: var(--pix); font-size: 9px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 6px; }
.story b { display: block; font-family: var(--pix); font-weight: normal; font-size: 10px; line-height: 1.5; margin-top: 6px; }
.story p { margin: 2px 0 4px; font-size: 18px; line-height: 1.05; }

/* market + gems */
.gm { display: inline-flex; align-items: center; gap: 3px; background: #1c2547; color: #8fd8ff; border-radius: 8px; padding: 2px 6px; font-family: var(--pix); font-size: 9px; }
.gm::before { content: ''; width: 9px; height: 8px; background: #5cc8ff; clip-path: polygon(20% 0, 80% 0, 100% 35%, 50% 100%, 0 35%); }
.btn.gem { background: #bfe9ff; }
.sellrow { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; }
.sellrow .btn { padding: 6px 8px; font-size: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--ink); border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.order { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--paper2); border: 2px solid var(--ink); border-radius: 10px; padding: 8px; margin-bottom: 6px; }
.order span { display: block; font-size: 18px; }
.order span.ok { color: var(--green); } .order span.no { color: var(--muted); }
.order .btn { padding: 8px 10px; font-size: 9px; white-space: nowrap; }
.gemrow { flex-wrap: wrap; }
.round.sparks img + span + img { margin-left: 8px; }
/* regions */
.region-list { display: flex; flex-direction: column; gap: 10px; }
.regioncard { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--edge); padding: 10px 12px; }
.regioncard .rhead { display: flex; justify-content: space-between; align-items: center; }
.regioncard .rhead b { font-family: var(--pix); font-weight: normal; font-size: 11px; }
.regioncard .rhead .icon-btn { width: 34px; height: 34px; background: #ffd9d4; }
.shuttle { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; margin: 8px 0; font-size: 18px; }
.shuttle .bar { grid-column: 1 / -1; }
.site { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 2px dashed var(--paper2); padding: 6px 0; }
.site b { display: block; font-family: var(--pix); font-weight: normal; font-size: 9px; }
.site small { font-size: 17px; color: var(--muted); }
.site .btn { padding: 8px 12px; font-size: 9px; }
.sendrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
.sendrow b { width: 100%; font-family: var(--pix); font-weight: normal; font-size: 9px; }
.sendrow .btn { padding: 6px 8px; font-size: 8px; }
.gifts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.gifts .btn { padding: 6px 8px; font-size: 8px; }
.maptype.locked { opacity: 0.6; }
.item.pack { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; text-align: left; }
.item.pack img { grid-row: span 2; }
.item.pack small, .item.pack .pack-buy, .item.pack .own { grid-column: 2; }
.pack-buy { display: flex; gap: 6px; flex-wrap: wrap; }
.pack-buy .btn { padding: 6px 10px; font-size: 11px; }
.tester-row { flex-wrap: wrap; gap: 6px; }
.tester-row .btn { flex: 1 1 45%; font-size: 11px; padding: 8px 6px; }
#testerBox { border: 3px dashed var(--ink); border-radius: var(--r-s); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
#testerBox[hidden] { display: none; }
#testerBox .btn-row { flex-wrap: wrap; gap: 6px; }
