:root { --bg: #1b1530; --card: #2a2346; --ink: #fff; --muted: #b9b3cf; --acc: #ff2d95; --gold: #ffd166; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { overflow: hidden; overscroll-behavior: none; }
#game { display: block; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); touch-action: none; user-select: none; -webkit-user-select: none; }
/* top/right/bottom/left instead of `inset` and margins instead of flex `gap`: old Chrome (< 87 / < 84) on cheap phones */
#ui { position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(circle at 20% 0%, #3b2a6b 0, transparent 50%), radial-gradient(circle at 100% 30%, #5a1f4a 0, transparent 45%), var(--bg); }
.screen { max-width: 480px; margin: 0 auto; padding: 18px 16px 40px; }
/* (fixed size first for browsers without clamp(); then sized from the width left beside the 16 px
   margins and a possible scrollbar, so the one-line title fits any screen, even 240 px wide) */
h1 { font-size: 30px; font-size: clamp(16px, calc((100vw - 56px) / 9.6), 46px); white-space: nowrap; max-width: 100%; overflow: hidden; margin: 8px 0 0; letter-spacing: 1px; font-weight: 900; font-style: italic;
  background: linear-gradient(90deg, #ff2d95, #ffd166 50%, #2de2e6); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 20px; margin: 18px 0 10px; }
h3 { font-size: 16px; margin: 16px 0 8px; }
.sub { color: var(--muted); margin: 4px 0 0; }
.small { font-size: 13px; line-height: 1.4; }
.muted { color: var(--muted); }
.center { text-align: center; }
.promise { background: rgba(255, 209, 102, .1); border: 1px solid rgba(255, 209, 102, .5); border-radius: 14px; padding: 10px 14px; margin-top: 14px; }
.promise h2 { margin: 0 0 4px; color: var(--gold); font-size: 16px; }
.promise ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.45; }
.cities { display: grid; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mastered { background: rgba(255, 209, 102, .15); border: 1px solid var(--gold); border-radius: 14px; padding: 10px; margin: 10px 0; }
.mastered p { margin: 4px 0 0; }
/* "not enough room" during a round (any device, measured in js/ui.js): says why, with its own way out */
/* (centred with auto margins, not justify-content: on a very short screen the content then starts at the top
   and scrolls, instead of being cut off above) */
#rotate { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 20; background: var(--bg); color: #fff; font-size: 40px; align-items: center; justify-content: flex-start; flex-direction: column; text-align: center; padding: 12px 16px; overflow-y: auto; }
#rotate > :first-child { margin-top: auto; }
#rotate > :last-child { margin-bottom: auto; }
#rotate p { font-size: 17px; font-weight: 700; margin: 8px 0 0; max-width: 560px; }
#rotate .row { margin-top: 12px; justify-content: center; }
/* sideways pause, phone upright again: the pause menu steps aside for a big 3-2-1 over the street (tap = go on now) */
.modal.counting { background: rgba(0, 0, 0, .25); cursor: pointer; }
.modal.counting .sheet { display: none; }
.modal .count { font-size: 96px; font-weight: 900; color: #fff; text-shadow: 0 0 12px #000, 0 0 4px #000; text-align: center; line-height: 1.1; }
.modal .count small { display: block; font-size: 18px; font-weight: 700; margin-top: 8px; }
body.playing #rotate { display: none; }
/* body.side: the game's area is too wide and low to play in (js/main.js) */
body.playing.side #rotate { display: flex; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
/* focus ring only for keyboard users (body.kbd is set on Tab, cleared on a tap: works on old
   Chrome/WebView without :focus-visible); headings and the ad box get focus only for screen readers */
:focus { outline: none; }
body.kbd :focus { outline: 3px solid var(--gold); outline-offset: 2px; }
body.kbd [tabindex="-1"]:focus { outline: none; }
.inapp { background: rgba(45, 226, 230, .12); border: 1px solid rgba(45, 226, 230, .5); border-radius: 12px; padding: 8px 12px; margin: 12px 0 0; }
.daily { background: linear-gradient(135deg, rgba(255, 45, 149, .18), rgba(45, 226, 230, .14)); border: 1px solid rgba(255, 255, 255, .25); border-radius: 14px; padding: 10px 14px; margin-top: 14px; }
.daily h2 { margin: 0 0 4px; color: #fff; font-size: 16px; }
.daily .small { margin: 0; }
/* (minmax(0, 1fr): columns never grow past the screen; a long city name wraps instead) */
.routes.daily-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route b { overflow-wrap: break-word; word-wrap: break-word; max-width: 100%; }
.daily-btn { background: var(--acc); }
.city { background: var(--card); border-radius: 16px; padding: 12px 14px; position: relative; border-left: 5px solid var(--acc); }
.city h3 { margin: 6px 0 0; font-size: 20px; }
/* white text (city colours like Nairobi's pink are too faint for small text on the card); the city colour stays as a bar */
.city .role { margin: 2px 0; color: #fff; font-weight: 700; font-size: 14px; border-left: 3px solid var(--acc); padding-left: 6px; }
.city.soon { opacity: .55; border-left-color: #666; }
.flag { display: inline-flex; border-radius: 3px; overflow: hidden; vertical-align: middle; }
.flag i { width: 9px; height: 14px; display: block; }
.routes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.route { background: var(--acc); color: #111; border: 0; border-radius: 12px; padding: 10px 4px; font: inherit; display: flex; flex-direction: column; align-items: center; min-height: 52px; }
.route span { font-size: 12px; margin-top: 2px; }
.route.locked { background: #3a3358; color: #888; }
.pill { display: inline-block; background: #444; color: #ddd; border-radius: 99px; padding: 3px 10px; font-size: 12px; margin-top: 6px; }
.pill.gold { background: var(--gold); color: #111; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; margin: 8px -4px; align-items: center; }
.row > * { margin: 4px; }
.row .btn { flex: 1 1 auto; }
.btn { display: inline-block; text-align: center; text-decoration: none; background: var(--gold); color: #111; border: 0; border-radius: 12px; padding: 12px 14px; font: inherit; font-weight: 700; min-height: 44px; cursor: pointer; }
.btn.alt { background: #3e3566; color: #fff; }
.btn.ghost { background: transparent; color: #fff; border: 1px solid #5d5487; width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .55; }
.modal, .ad-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
/* 100% of the pop-up layer (not vh: on phones vh ignores the address bar, so the sheet's ends went off-screen) */
.sheet { background: var(--card); border-radius: 18px; padding: 16px; max-width: 420px; width: 100%; max-height: 100%; overflow-y: auto; }
.sheet .btn { width: 100%; margin-top: 8px; }
.sheet .row .btn { width: auto; }
.how li { margin-bottom: 8px; line-height: 1.4; }
.share-img { width: 100%; border-radius: 12px; display: block; }
.field { display: block; margin: 10px 0; font-size: 14px; }
.field input, .field select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px; border-radius: 10px; border: 1px solid #5d5487; background: #15112a; color: #fff; font: inherit; }
textarea { font-family: monospace; margin-top: 6px; }
.field input, .field select, textarea { font-size: 16px; } /* 16 px: iPhones don't zoom the page on focus */
.check { display: flex; align-items: center; min-height: 44px; margin: 4px 0; font-size: 15px; } /* whole row is the finger target */
.check input { width: 22px; height: 22px; margin: 0 10px 0 0; flex: none; }
.battle { display: grid; gap: 6px; }
/* (the name column may shrink, so a row fits even a 240 px screen) */
.bar-row { display: grid; grid-template-columns: 18px 30px minmax(0, 92px) 1fr 52px; align-items: center; gap: 6px; font-size: 14px; }
.bar-row > :nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { background: #15112a; border-radius: 6px; height: 14px; overflow: hidden; }
.bar i { display: block; height: 100%; }
.btotal { text-align: right; font-weight: 700; }
.you-line { margin: -2px 0 4px 56px; color: var(--gold); }
.runs { padding-left: 0; list-style: none; }
.runs li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #3a3358; font-size: 14px; }
.results { text-align: center; }
.results .big { font-size: 72px; font-weight: 900; color: var(--gold); line-height: 1; margin: 10px 0; }
.stats { margin: 12px auto; border-collapse: collapse; min-width: 260px; max-width: 100%; }
@media (max-width: 300px) { .stats { min-width: 0; width: 100%; } .stats td { padding: 6px 4px; } }
.stats td { padding: 6px 8px; border-bottom: 1px solid #3a3358; text-align: left; }
.stats td:last-child { text-align: right; font-weight: 700; }
.stats.pts { margin-top: 4px; }
.stats .sum td { border-bottom: 0; border-top: 2px solid #6a6290; font-size: 1.1em; }
.extras { margin-top: 16px; background: rgba(255, 255, 255, .05); border-radius: 14px; padding: 10px; }
.extras h3 { margin: 2px 0 4px; font-size: 14px; }
.ad-box { background: #fff; color: #111; border-radius: 16px; padding: 14px; max-width: 360px; width: 100%; max-height: 100%; overflow-y: auto; text-align: center; }
.ad-tag { display: inline-block; background: #111; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.ad-art { border-radius: 12px; padding: 30px 12px; margin: 10px 0; display: flex; flex-direction: column; }
.ad-art b { font-size: 22px; margin-bottom: 6px; }
.ad-box .btn { width: 100%; }
body.kbd .ad-box :focus { outline-color: #111; } /* the gold ring is too faint on the white ad box */
