/* Touch controls (iteration 64, src/touch/touch.js, docs/MOBILE-CONTROLS.md). Everything here is scoped to body.touch,
   which is only set on a touch device (or when Settings → Touch says Always): desktop never sees any of it.
   Sizes are the spec's Medium phone sizes × --tc-s (the size setting × 1.25 on a tablet). */
:root {
  --tc-sal: env(safe-area-inset-left, 0px); --tc-sar: env(safe-area-inset-right, 0px);
  --tc-sab: env(safe-area-inset-bottom, 0px); --tc-sat: env(safe-area-inset-top, 0px);
  --tc-s: 1; --tc-op: .5;
  --tc-gw: 96px; /* GAS: a round pad this wide at Medium (64c; was 88 × 128) */
}
body {
  --tc-eL: calc(16px + var(--tc-sal)); --tc-eR: calc(16px + var(--tc-sar));
  --tc-eB: calc(14px + var(--tc-sab)); --tc-eT: calc(8px + var(--tc-sat));
}
body.tc-tablet { --tc-eB: calc(15vh + var(--tc-sab)); } /* tablets: raised to where thumbs rest when it's held by the sides */
#tc-probe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding: var(--tc-sat) var(--tc-sar) var(--tc-sab) var(--tc-sal); }
canvas#game { touch-action: none; }
#touch { display: none; }
body.touch #touch { display: block; }
body.touch { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; touch-action: none; }
#touch .tc-off, #touch .hidden { display: none !important; }

/* ------------------------------------------------------------------ the controls */
#touch > * { position: fixed; z-index: 12; touch-action: none; user-select: none; -webkit-user-select: none; }
#tc-lzone { z-index: 11; left: 0; top: calc(var(--tc-eT) + 100px); bottom: 0; width: 44%; }
body.tc-mirror #tc-lzone { left: auto; right: 0; }
#tc-stick { width: calc(136px * var(--tc-s)); height: calc(136px * var(--tc-s)); margin: calc(-68px * var(--tc-s)) 0 0 calc(-68px * var(--tc-s)); border-radius: 50%;
  border: 2px solid rgba(255,248,231,.45); background: radial-gradient(circle, rgba(21,16,12,.35), rgba(21,16,12,.6)); opacity: var(--tc-op); pointer-events: none; transition: opacity .15s; box-sizing: border-box; }
#tc-stick.live { opacity: .95; }
#tc-stick.rest { opacity: calc(var(--tc-op) * .45); transform: scale(.66); } /* smaller and faint until the thumb lands (64b) */
#tc-stick { transition: opacity .15s, transform .12s; }
#tc-stick .tc-knob { position: absolute; left: 50%; top: 50%; width: calc(62px * var(--tc-s)); height: calc(62px * var(--tc-s)); margin: calc(-31px * var(--tc-s)) 0 0 calc(-31px * var(--tc-s)); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--gold-hi), var(--gold) 60%, #b57d0a); box-shadow: 0 3px 10px rgba(0,0,0,.5); }
#tc-stick.run .tc-knob { background: radial-gradient(circle at 40% 35%, #fff, var(--gold-hi) 50%, var(--red)); }

.tc-pad { border-radius: 18px; border: 2px solid rgba(255,248,231,.4); background: rgba(21,16,12,.6); display: grid; place-items: center; text-align: center; box-sizing: border-box;
  font-family: var(--display); font-size: calc(13px * var(--tc-s)); letter-spacing: 1px; color: var(--text); opacity: var(--tc-op); transition: opacity .1s, transform .08s, background .1s; line-height: 1.1; }
.tc-pad.down { opacity: .97; transform: scale(.96); }
.tc-pad small { display: block; font-family: var(--body, "Trebuchet MS", sans-serif); font-size: calc(9px * var(--tc-s)); letter-spacing: 1.5px; opacity: .75; font-weight: 700; margin-top: 2px; }
#touch svg { width: calc(28px * var(--tc-s)); height: calc(28px * var(--tc-s)); fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#touch svg.f { fill: currentColor; stroke: none; }

#tc-gas { right: var(--tc-eR); bottom: var(--tc-eB); width: calc(var(--tc-gw) * var(--tc-s)); height: calc(var(--tc-gw) * var(--tc-s)); border-radius: 50%; color: var(--ink); background: rgba(242,176,30,.55); border-color: var(--gold-hi); }
#tc-gas.down { background: var(--gold-hi); }
/* the boost cue: a small double chevron centred over GAS (64c: it replaced the dashed BOOST tab); slide up onto it */
#tc-boost { right: calc(var(--tc-eR) + (var(--tc-gw) - 44px) / 2 * var(--tc-s)); width: calc(44px * var(--tc-s)); bottom: calc(var(--tc-eB) + var(--tc-gw) * var(--tc-s) + 2px); height: calc(30px * var(--tc-s));
  box-sizing: border-box; color: var(--gold-hi); display: grid; place-items: center; opacity: var(--tc-op); pointer-events: none; }
#tc-brake { right: calc(var(--tc-eR) + var(--tc-gw) * var(--tc-s) + 12px); bottom: var(--tc-eB); width: calc(78px * var(--tc-s)); height: calc(96px * var(--tc-s)); }
#tc-brake.down { background: rgba(200,36,31,.85); }
body.tc-mirror #tc-gas { right: auto; left: var(--tc-eL); }
body.tc-mirror #tc-boost { right: auto; left: calc(var(--tc-eL) + (var(--tc-gw) - 44px) / 2 * var(--tc-s)); }
body.tc-mirror #tc-brake { right: auto; left: calc(var(--tc-eL) + var(--tc-gw) * var(--tc-s) + 12px); }

#tc-action { right: calc(var(--tc-eR) + var(--tc-gw) * var(--tc-s) + 11px); bottom: calc(var(--tc-eB) + 96px * var(--tc-s) + 16px); width: calc(80px * var(--tc-s)); height: calc(80px * var(--tc-s)); border-radius: 50%;
  background: rgba(12,107,62,.85); border-color: rgba(255,248,231,.7); font-size: calc(12px * var(--tc-s)); padding: 0 6px; }
#tc-action .tc-lbl { display: block; max-width: calc(70px * var(--tc-s)); overflow: hidden; }
#tc-action.dim { background: rgba(21,16,12,.6); }
#tc-action.big { width: calc(104px * var(--tc-s)); height: calc(104px * var(--tc-s)); font-size: calc(17px * var(--tc-s)); bottom: calc(var(--tc-eB) + 24px); right: var(--tc-eR); background: rgba(158,59,34,.88); }
#tc-action .tc-ring { position: absolute; inset: -6px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--gold-hi) calc(var(--p, 0) * 1turn), transparent 0); -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%); mask: radial-gradient(circle, transparent 62%, #000 63%); }
#tc-action .tc-sub { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 7px; font: 700 calc(9px * var(--tc-s)) "Trebuchet MS", sans-serif; letter-spacing: 1px; white-space: nowrap; color: var(--cloth, #f7ead3); opacity: .85; text-shadow: 0 1px 2px #000; }
body.tc-mirror #tc-action { right: auto; left: calc(var(--tc-eL) + var(--tc-gw) * var(--tc-s) + 11px); }
body.tc-mirror #tc-action.big { left: var(--tc-eL); }

.tc-steer { bottom: var(--tc-eB); width: calc(92px * var(--tc-s)); height: calc(92px * var(--tc-s)); border-radius: 50%; }
#tc-steerL { left: var(--tc-eL); } #tc-steerR { left: calc(var(--tc-eL) + 92px * var(--tc-s) + 14px); }
body.tc-mirror #tc-steerL { left: auto; right: calc(var(--tc-eR) + 92px * var(--tc-s) + 14px); } body.tc-mirror #tc-steerR { left: auto; right: var(--tc-eR); }

/* boxing: four big pads, two per thumb; the cued one glows */
.tc-bx { bottom: var(--tc-eB); width: calc(104px * var(--tc-s)); height: calc(104px * var(--tc-s)); border-radius: 50%; }
#tc-bxL { left: var(--tc-eL); } #tc-bxR { left: calc(var(--tc-eL) + 104px * var(--tc-s) + 14px); }
#tc-bxB { right: calc(var(--tc-eR) + 104px * var(--tc-s) + 14px); } #tc-bxP { right: var(--tc-eR); background: rgba(200,36,31,.75); }
.tc-bx.cue { box-shadow: 0 0 0 4px var(--gold-hi), 0 0 24px var(--gold); opacity: 1; }
#touch[data-layout="boxing"] #tc-action { bottom: calc(var(--tc-eB) + 104px * var(--tc-s) + 18px); right: var(--tc-eR); }
/* the dance-off and gigs: four lanes, ← ↓ on the left thumb, ↑ → on the right (dance-mat order) */
.tc-dn { bottom: var(--tc-eB); width: calc(92px * var(--tc-s)); height: calc(92px * var(--tc-s)); border-radius: 22px; }
#tc-dnL { left: var(--tc-eL); } #tc-dnD { left: calc(var(--tc-eL) + 92px * var(--tc-s) + 12px); }
#tc-dnU { right: calc(var(--tc-eR) + 92px * var(--tc-s) + 12px); } #tc-dnR { right: var(--tc-eR); }
/* the studio: three beat cards, then one TAP pad */
#tc-tap { right: var(--tc-eR); bottom: var(--tc-eB); width: calc(120px * var(--tc-s)); height: calc(120px * var(--tc-s)); border-radius: 50%; background: rgba(242,176,30,.8); color: var(--ink); font-size: calc(18px * var(--tc-s)); }
#tc-beats { left: 50%; transform: translateX(-50%); bottom: var(--tc-eB); display: flex; gap: 12px; }
#tc-beats button { min-height: calc(62px * var(--tc-s)); min-width: calc(120px * var(--tc-s)); border-radius: 14px; border: 1.5px solid rgba(255,248,231,.35); background: var(--panel); color: var(--text);
  font: 700 14px "Trebuchet MS", sans-serif; letter-spacing: .5px; text-transform: none; padding: 6px 10px; box-shadow: none; opacity: .95; }
#tc-beats button b { display: block; font-family: var(--display); font-weight: 400; color: var(--gold-hi); font-size: 16px; }
#tc-beats button:active { background: var(--gold); color: var(--ink); }

/* top icons */
#tc-top { top: var(--tc-eT); right: var(--tc-eR); display: flex; gap: 8px; pointer-events: none; }
.tc-icon { width: 46px; height: 46px; min-width: 46px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; background: var(--panel); color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.35); font: 700 20px "Trebuchet MS", sans-serif; letter-spacing: 0; pointer-events: auto; opacity: .92; }
.tc-icon svg { width: 22px !important; height: 22px !important; }
.tc-icon:active, .tc-icon.on { background: var(--gold); color: var(--ink); }
#tc-close { z-index: 45; top: var(--tc-eT); right: var(--tc-eR); background: rgba(21,16,12,.9); border: 1px solid rgba(255,248,231,.3); }
#tc-back { z-index: 45; top: var(--tc-eT); right: calc(var(--tc-eR) + 54px); background: rgba(21,16,12,.9); border: 1px solid rgba(255,248,231,.3); font-size: 28px; line-height: 1; }
#tc-next { z-index: 14; inset: 0; }
#tc-skip, #tc-dskip { min-width: 64px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid rgba(255,248,231,.35); background: rgba(21,16,12,.8); color: #fff;
  font: 700 13px "Trebuchet MS", sans-serif; letter-spacing: .5px; text-transform: none; box-shadow: none; }
#tc-skip { z-index: 22; top: var(--tc-eT); right: var(--tc-eR); }
#tc-dskip { z-index: 22; transform: translateX(-100%); min-height: 44px; }
#tc-radio { display: flex; gap: 6px; transform: translate(-100%, -50%); }
#tc-radio button { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 0; background: var(--panel); color: var(--gold-hi); box-shadow: none; display: grid; place-items: center; }
#tc-radio svg { width: 18px; height: 18px; }

/* the ⋯ quick menu (the world runs at 25 % under it) */
#tc-wheel { z-index: 35; inset: 0; background: radial-gradient(circle, rgba(21,16,12,.55), rgba(21,16,12,.85)); }
#tc-wheel .tc-hub { position: absolute; left: 50%; top: 52%; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%; background: var(--panel); border: 2px solid var(--gold); display: grid; place-items: center;
  font: 700 11px "Trebuchet MS", sans-serif; text-align: center; letter-spacing: 1px; color: var(--text); }
#tc-wheel .tc-it { position: absolute; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; border: 2px solid rgba(255,248,231,.22); background: rgba(21,16,12,.94); color: var(--text);
  display: grid; place-items: center; align-content: center; text-align: center; font: 700 11px "Trebuchet MS", sans-serif; letter-spacing: 0; text-transform: none; padding: 0; box-shadow: none; }
#tc-wheel .tc-it svg { width: 24px; height: 24px; stroke: var(--gold-hi); margin: 0 auto 2px; display: block; }
#tc-wheel .tc-it.hot { background: var(--gold); color: var(--ink); border-color: var(--gold-hi); transform: scale(1.08); }
#tc-wheel .tc-it.hot svg { stroke: var(--ink); }
#tc-wheel .tc-it.dim { opacity: .5; }
#tc-wheel .tc-note { position: absolute; left: 50%; bottom: calc(12px + var(--tc-sab)); transform: translateX(-50%); font: 11px "Trebuchet MS", sans-serif; color: var(--cloth, #f7ead3); opacity: .75; white-space: nowrap; }

.tc-hint { z-index: 13; background: var(--cloth, #f7ead3); color: var(--ink); font: 700 11px "Trebuchet MS", sans-serif; padding: 5px 9px; border-radius: 8px; pointer-events: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.4); }

/* portrait: turn the phone sideways (the game pauses) */
#tc-rotate { position: fixed; inset: 0; z-index: 100; background: var(--ink); display: none; place-items: center; text-align: center; color: var(--text);
  padding: 24px max(16px, var(--tc-sar)) 24px max(16px, var(--tc-sal)); }
#tc-rotate.on { display: grid; }
#tc-rotate .tc-ph { width: 54px; height: 92px; border: 4px solid var(--gold); border-radius: 12px; margin: 0 auto 22px; animation: tcTurn 2.4s ease-in-out infinite; }
#tc-rotate h2 { font-family: var(--display); font-weight: 400; color: var(--gold-hi); letter-spacing: 1px; margin: 0 0 8px; font-size: 26px; }
#tc-rotate p { margin: 0 auto; max-width: 30ch; line-height: 1.45; color: var(--cloth, #f7ead3); }
@keyframes tcTurn { 0%, 20% { transform: rotate(0); } 50%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { #tc-rotate .tc-ph { animation: none; transform: rotate(-90deg); } .tc-pad { transition: none; } }

/* ------------------------------------------------------------------ the HUD moves out of the thumbs' way */
body.touch #phone { position: fixed; top: var(--tc-eT); left: var(--tc-eL); bottom: auto; width: 84px; height: 84px; padding: 0; border-radius: 50%; overflow: hidden; box-sizing: border-box;
  border: 3px solid var(--gold); transform: none !important; pointer-events: auto; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.45); }
body.touch #phone::before, body.touch #phone .ph-status, body.touch #phone .ph-rep, body.touch #phone .ph-dock, body.touch #phone .ph-home, body.touch #phone .ph-app, body.touch #phone .ph-crack { display: none; }
body.touch #phone .ph-screen { width: 100%; height: 100%; border-radius: 50%; }
body.touch #minimap { width: 100%; height: 100%; object-fit: cover; }
body.touch #hud-topleft { top: var(--tc-eT); left: calc(var(--tc-eL) + 96px); }
body.touch #money { font-size: 20px; }
body.touch #hud-topright { top: var(--tc-eT); right: calc(var(--tc-eR) + 108px); padding: 4px 10px 5px; }
body.touch #clock { font-size: 18px; } body.touch #district { font-size: 10px; }
body.touch #wanted { top: calc(var(--tc-eT) + 54px); right: var(--tc-eR); }
body.touch #speedo { right: var(--tc-eR); bottom: calc(var(--tc-eB) + 172px * var(--tc-s)); }
body.touch #speed { font-size: 30px; }
body.touch #speedo .unit { font-size: 9px; letter-spacing: 2px; }
body.touch #speedo .dmg-label { font-size: 8px; letter-spacing: 1.5px; margin-top: 3px; }
body.touch #dmgbar, body.touch #fuelbar, body.touch #stambar { width: calc(88px * var(--tc-s)); }
body.tc-mirror #speedo { right: auto; left: var(--tc-eL); text-align: left; }
body.tc-mirror #dmgbar, body.tc-mirror #fuelbar, body.tc-mirror #stambar { margin-left: 0; }
body.touch #toasts { top: calc(var(--tc-eT) + 100px); left: var(--tc-eL); width: min(250px, calc(32vw / var(--tz, 1))); min-width: 0; }
body.tc-mirror #toasts { left: auto; right: var(--tc-eR); }
body.touch #objective { top: var(--tc-eT); max-width: calc((100vw - 500px) / var(--tz, 1)); min-width: 220px; padding: 6px 12px; font-size: 13px; }
body.touch #prompt { bottom: 30%; font-size: 15px; max-width: calc(46vw / var(--tz, 1)); padding: 8px 16px; }
body.touch .kg { color: var(--gold); }
body.touch .kg-touch { display: inline-block; padding: 0 6px; border-radius: 8px; background: rgba(12,107,62,.85); color: #fff; font-size: .85em; letter-spacing: .5px; }
body.touch #dialogue:not(.cut) { top: calc(var(--tc-eT) + 2px); bottom: auto; width: min(560px, calc((100vw - 460px) / var(--tz, 1))); min-width: 340px; padding: 8px 10px 8px 8px; gap: 10px; }
body.touch #dialogue .dl-portrait { width: 52px; height: 52px; }
body.touch #dialogue .dl-text { font-size: 15px; }
body.touch #dialogue .dl-gloss { font-size: 12px; }
body.touch #dialogue .dl-hint { font-size: 0; }
body.touch #dialogue .dl-hint::after { content: "tap the box: next line"; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
body.touch #dialogue .dl-choices button { min-height: 44px; font-size: 14px; }
body.touch #callcard { top: calc(var(--tc-eT) + 56px); right: calc(var(--tc-eR) + 104px * var(--tc-s)); transform: scale(.85); transform-origin: top right; cursor: pointer; }
body.touch #callcard .cc-ans { font-size: 0; } body.touch #callcard .cc-ans::after { content: "Tap to answer"; font-size: 13px; }
body.touch #radio-card { top: calc(var(--tc-eT) + 70px); right: 50%; margin-right: -130px; width: 260px; min-width: 0; box-sizing: border-box; text-align: center; }
body.touch #radio-card .rc-key { display: none; }
body.touch.tc-talk #radio-card { display: none; }
/* the mini-games' scoreboard has the top centre: the money and the clock step aside */
body.touch[data-tcl="boxing"] #hud-topleft, body.touch[data-tcl="boxing"] #hud-topright, body.touch[data-tcl="dance"] #hud-topleft, body.touch[data-tcl="dance"] #hud-topright,
body.touch[data-tcl="studio"] #hud-topleft, body.touch[data-tcl="studio"] #hud-topright, body.touch[data-tcl="studio-pick"] #hud-topleft, body.touch[data-tcl="studio-pick"] #hud-topright { display: none; }
body.touch #box-cue .bc-key { font-size: 0; }
body.touch #box-cue .bc-key::after { content: attr(data-touch); font-size: 15px; }
body.touch #table { bottom: calc(var(--tc-eB) + 2px); }
body.touch #table .tb-moves button { min-height: 52px; font-size: 13px; }
body.touch #bigmap .bm-keys { display: none; }

/* menus: tap targets at least 44 px, room for the ✕ */
body.touch .pa-tabs button, body.touch .em-row button, body.touch .em-small, body.touch .hub-app, body.touch .hub-contact button, body.touch .pa-now button, body.touch .pa-retry,
body.touch #settings .st-ctl button, body.touch #settings .st-tabs button, body.touch .sr-item, body.touch .sr-tabs button, body.touch .ps-tabs button, body.touch #pause button, body.touch #title button { min-height: 44px; }
body.touch #settings .st-ctl { flex-wrap: wrap; justify-content: flex-end; }
body.touch #settings input[type=range] { height: 32px; }
body.touch #settings .st-hint, body.touch .pa-hint { display: none; }
body.touch #pause { justify-content: safe center; overflow-y: auto; padding: 8px 0; }
body.touch #pause h2 { font-size: 30px; letter-spacing: 6px; margin: 0 0 8px; }
body.touch #pause .tag, body.touch #pause .kente, body.touch #pause .keys-card { display: none !important; }
body.touch[data-tcl="menu"] #radio-card, body.touch[data-tcl="menu"] #radio-sub { display: none; } /* not through a menu */
body.touch #pause .title-inner { padding: 8px 16px; max-width: 640px; }
body.touch #pause .title-inner > div { display: inline-block; margin: 0 3px; vertical-align: top; }
body.touch #pause .title-inner > div#save-info { display: block; margin: 2px 0 4px; font-size: 12px; }
body.touch #pause .title-inner > div.tc-pause-extra { display: block; }
body.touch #pause #resume { font-size: 17px; padding: 10px 30px; margin-bottom: 8px; }
body.touch #pause button.ghost { font-size: 12px; padding: 6px 14px; }
body.touch #title .controls { display: none; }
body.touch #title .tag { font-size: 15px; margin-bottom: 8px; }
body.touch #pause button.ghost { margin-top: 6px; }
.tc-pause-extra { display: none; }
body.touch .tc-pause-extra { display: block; }
.tc-pause-extra .tc-ios { display: none; font-size: 12px; opacity: .8; margin-top: 8px; max-width: 46ch; }
.tc-pause-extra.ios .tc-ios { display: block; }

/* ================================================================== iteration 64b: the owner's real-phone test
   "The buttons are quite chunky… I can hardly see the game world." Phones (body.tc-phone: touch on, not a tablet) get
   Compact controls (--tc-s = 0.72 by default: every target still ≥ 44 px), and every touch device gets fainter controls
   at rest that brighten under the thumb, and loses the secondary words once the first-run hints have gone. */
.tc-pad { background: rgba(21,16,12,.42); border-color: rgba(255,248,231,.32); font-size: max(11px, calc(13px * var(--tc-s))); }
.tc-pad.down { opacity: .97; }
#tc-action { background: rgba(12,107,62,.7); font-size: max(10.5px, calc(12px * var(--tc-s))); padding: 0 4px; }
#tc-action.dim { background: rgba(21,16,12,.42); }
#tc-action .tc-lbl { max-width: calc(76px * var(--tc-s)); line-height: 1; }
.tc-pad small { font-size: max(8.5px, calc(9px * var(--tc-s))); } /* the mini-game pads' words stay readable at Compact */
#tc-gas small, #tc-brake small { display: none; }           /* HOLD, REVERSE: the first-run hints say it */
#tc-action .tc-sub { display: none; }                       /* hold: get out */
body.tc-hinting #tc-gas small, body.tc-hinting #tc-brake small, body.tc-hinting #tc-action .tc-sub, #tc-action.down .tc-sub { display: block; }
body.tc-phone .tc-icon { width: 44px; height: 44px; min-width: 44px; opacity: .8; background: rgba(21,16,12,.6); font-size: 18px; }
body.tc-phone .tc-icon svg { width: 20px !important; height: 20px !important; }
body.tc-phone #tc-top { gap: 6px; }
body.tc-phone #tc-back { right: calc(var(--tc-eR) + 50px); }

/* ================================================================== iteration 64c: tinted controls (the owner, after 64b)
   "The horn, brake and speed buttons should all have a slight colour to them so they don't look transparent."
   GAS, BRAKE and ACTION get a solid tinted fill (gold, muted red, neutral; ACTION goes green when it offers something),
   a little less faint at rest (--tc-op + a floor), full and brighter under the thumb. Still small, so the world shows
   around them. */
#tc-gas, #tc-brake, #tc-action { opacity: min(1, calc(.3 + var(--tc-op) * .85)); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 2px 6px rgba(0,0,0,.28);
  transition: opacity .1s, transform .08s, background .1s, box-shadow .1s; }
#tc-gas.down, #tc-brake.down, #tc-action.down { opacity: 1; }
#tc-gas { background: radial-gradient(circle at 50% 30%, rgba(255,214,102,.94), rgba(230,162,24,.92) 68%, rgba(166,112,10,.94)); border-color: rgba(255,228,150,.92); color: var(--ink); }
#tc-gas.down { background: radial-gradient(circle at 50% 30%, #fff3c2, var(--gold-hi) 55%, var(--gold)); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 0 14px rgba(255,210,90,.65); }
#tc-brake { background: linear-gradient(180deg, rgba(150,54,44,.92), rgba(104,30,24,.94)); border-color: rgba(246,160,148,.6); color: #fff1ea; text-shadow: 0 1px 1px rgba(0,0,0,.45); }
#tc-brake.down { background: linear-gradient(180deg, #e04a3e, #a8211b); border-color: #ffc2b8; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 0 12px rgba(224,74,62,.6); }
#tc-action.dim { background: radial-gradient(circle at 50% 30%, rgba(84,70,56,.95), rgba(38,31,25,.96)); border-color: rgba(255,214,120,.55); color: #fff4dc; text-shadow: 0 1px 1px rgba(0,0,0,.5); }
#tc-action.dim.down { background: radial-gradient(circle at 50% 30%, #9c8566, #5a4a39); border-color: var(--gold-hi); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 0 12px rgba(255,210,90,.45); }
#tc-action:not(.dim):not(.big) { background: radial-gradient(circle at 50% 30%, rgba(30,140,84,.94), rgba(10,92,52,.95)); border-color: rgba(200,255,220,.7); }
#tc-action:not(.dim):not(.big).down { background: radial-gradient(circle at 50% 30%, #3cc47e, #11804a); }

/* the boost cue: faint and still at rest; bright and nudging up while GAS is held; lit while boosting */
#tc-boost { background: none; border: 0; transition: opacity .12s, color .12s, transform .12s; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.85)); }
#tc-boost svg { width: calc(30px * var(--tc-s)); height: calc(26px * var(--tc-s)); stroke-width: 3; overflow: visible; }
#tc-boost .c2 { opacity: .55; }
body.tc-gason #tc-boost, body.tc-hinting #tc-boost { opacity: .95; }
body.tc-gason:not(.tc-boosting) #tc-boost svg { animation: tcBoostNudge 1s ease-in-out infinite; }
body.tc-boosting #tc-boost { opacity: 1; color: #fff6d6; transform: translateY(-2px) scale(1.15); filter: drop-shadow(0 0 4px var(--gold)) drop-shadow(0 0 7px var(--red)); }
body.tc-boosting #tc-boost .c2 { opacity: 1; }
@keyframes tcBoostNudge { 0%, 100% { transform: translateY(2px); } 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { body.tc-gason:not(.tc-boosting) #tc-boost svg { animation: none; } #tc-boost, #tc-gas, #tc-brake, #tc-action { transition: none; } }

/* ---- the compact HUD: the top row is minimap · money · the mission strip · clock · ⋯ ⏸ */
body.tc-phone #phone { width: 72px; height: 72px; border-width: 2px; }
body.tc-phone #hud-topleft { left: calc(var(--tc-eL) + 80px); }
body.tc-phone #money { font-size: 15px; padding: 3px 9px 5px 8px; border-left-width: 3px; border-radius: 8px; box-shadow: none; }
body.tc-phone #money::after { left: 7px; right: 7px; bottom: 2px; height: 2px; }
body.tc-phone .money-delta { font-size: 12px; }
body.tc-phone #hud-topright { right: calc(var(--tc-eR) + 100px); padding: 3px 8px 4px; border-right-width: 3px; border-radius: 8px; max-width: 92px; }
body.tc-phone #clock { font-size: 15px; line-height: 1.1; }
body.tc-phone #district { font-size: 8px; letter-spacing: 1.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the mission: one slim line (title · objective… · timer); in full for a few seconds when it changes (hud.js OBJ_FULL) */
body.tc-phone #objective { top: var(--tc-eT); display: flex; align-items: center; gap: 7px; box-sizing: border-box; width: max-content; min-width: 0;
  max-width: calc((100vw - 2 * max(var(--tc-eL), var(--tc-eR)) - 430px) / var(--tz, 1)); padding: 4px 10px 5px; border-top-width: 2px; border-radius: 0 0 9px 9px;
  text-align: left; white-space: nowrap; font-size: 12px; background: rgba(21,16,12,.72); box-shadow: none; }
body.tc-phone #objective-title { font-size: 10px; letter-spacing: 1px; flex: none; }
body.tc-phone #objective-text { font-size: 12px; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
body.tc-phone #objective-timer { font-size: 13px; margin: 0; flex: none; font-variant-numeric: tabular-nums; }
body.tc-phone #objective-timer:empty { display: none; }
body.tc-phone #objective.full { flex-wrap: wrap; justify-content: center; text-align: center; row-gap: 1px; }
body.tc-phone #objective.full #objective-text { order: 3; flex: 1 0 100%; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
/* heat: a small pill under ⋯ ⏸, clear of the speed */
body.tc-phone #wanted { top: calc(var(--tc-eT) + 50px); right: var(--tc-eR); font-size: 11px; }
body.tc-phone #wanted .ht-pill { padding: 2px 7px 3px; gap: 5px; border-left-width: 3px; border-radius: 7px; }
body.tc-phone #wanted .ht-label { font-size: 8.5px; letter-spacing: 1px; }
body.tc-phone #wanted .ht-segs { height: 10px; gap: 2px; }
body.tc-phone #wanted .ht-segs i { width: 5px; }
body.tc-phone #wanted .ht-segs i:nth-child(1) { height: 4px; } body.tc-phone #wanted .ht-segs i:nth-child(2) { height: 5.5px; } body.tc-phone #wanted .ht-segs i:nth-child(3) { height: 7px; }
body.tc-phone #wanted .ht-segs i:nth-child(4) { height: 8.5px; } body.tc-phone #wanted .ht-segs i:nth-child(5) { height: 10px; }
body.tc-phone #wanted .ht-bar { width: 104px; height: 6px; } body.tc-phone #wanted .ht-sec { font-size: 14px; min-width: 24px; }
body.tc-phone #wanted.hunt .ht-status { font-size: 10.5px; letter-spacing: .6px; } body.tc-phone #wanted .ht-then { font-size: 9.5px; }
body.tc-phone #wanted .ht-status { font-size: 8px; letter-spacing: 1px; margin-top: 2px; }
body.tc-phone #wanted .ht-search { width: 70px; margin-top: 2px; }
/* speed, fuel, engine, stamina: a small cluster over GAS */
body.tc-phone #speedo { bottom: calc(var(--tc-eB) + (var(--tc-gw) + 34px) * var(--tc-s) + 8px); } /* just over the boost chevron (64c: GAS is shorter now) */
body.tc-phone #speed { font-size: 24px; text-shadow: 0 2px 0 #000; }
body.tc-phone #speedo .unit { font-size: 7.5px; letter-spacing: 1.5px; }
body.tc-phone #speedo .dmg-label { font-size: 7px; letter-spacing: 1px; margin-top: 2px; opacity: .8; }
body.tc-phone #dmgbar, body.tc-phone #fuelbar, body.tc-phone #stambar { height: 4px; margin-top: 1px; border: 0; }
/* notifications: one card at a time (hud.js PHONE_TOASTS), small, under the minimap */
body.tc-phone #toasts { top: calc(var(--tc-eT) + 82px); width: min(190px, calc(26vw / var(--tz, 1))); min-width: 0; gap: 4px; }
body.tc-phone .toast { font-size: 11px; padding: 4px 8px 5px; border-radius: 10px; box-shadow: 0 3px 8px rgba(0,0,0,.3); }
body.tc-phone .toast .nf-head { font-size: 8px; letter-spacing: 1px; gap: 5px; margin-bottom: 1px; }
body.tc-phone .toast .nf-icon { width: 10px; height: 10px; border-radius: 3px; }
body.tc-phone .toast .nf-body { line-height: 1.28; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
body.tc-phone .toast:first-child::after { width: 50px; }
/* the radio: a small station card under the mission strip (◀ ▶ beside it, touch.js), subtitles two short lines at the bottom */
body.tc-phone #radio-card { top: calc(var(--tc-eT) + 62px); width: 240px; margin-right: -120px; padding: 4px 9px; border-right-width: 3px; border-radius: 8px;
  display: flex; align-items: baseline; gap: 7px; white-space: nowrap; text-align: left; }
body.tc-phone #radio-card .rc-top { font-size: 12px; flex: none; }
body.tc-phone #radio-card .rc-fm { font-size: 7.5px; padding: 2px 3px; margin-right: 4px; vertical-align: 2px; }
body.tc-phone #radio-card .rc-tag { display: none; }
body.tc-phone #radio-card .rc-np { font-size: 10px; margin: 0; min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
body.tc-phone #tc-radio { transform: translate(0, -50%); }
body.tc-phone #radio-sub:not(.hidden) { bottom: calc(var(--tc-sab) + 6px); max-width: min(350px, calc((100vw - 2 * max(var(--tc-eL), var(--tc-eR)) - 380px) / var(--tz, 1))); min-width: 0; box-sizing: border-box;
  font-size: 10.5px; line-height: 1.3; padding: 3px 10px 4px; border-bottom-width: 2px; border-radius: 7px; background: rgba(10,8,6,.55);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.tc-phone #radio-sub .rs-st { font-size: 8px; padding: 1px 3px; margin-right: 5px; vertical-align: 1px; }
/* the district: a small, short title under the station card's place (2 s: districtBanner.life) */
body.tc-phone #district-banner { top: calc(var(--tc-eT) + 112px); max-width: calc(52vw / var(--tz, 1)); white-space: nowrap; }
body.tc-phone #district-banner .db-name { font-size: 16px; letter-spacing: 3px; text-shadow: 0 2px 0 #000, 0 0 10px rgba(0,0,0,.7); }
body.tc-phone #district-banner .db-sub { font-size: 9px; letter-spacing: 2px; margin-top: 1px; }
body.tc-phone #district-banner .db-kente { height: 3px; margin-bottom: 4px; }
body.tc-phone #district-banner.show { animation: dbFade 2s ease-out forwards; }
body.tc-phone #district-banner.show .db-kente { animation: dbKentePh 2s ease-out forwards; }
body.tc-phone #district-banner.show .db-name { animation: dbNamePh 2s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes dbKentePh { 0% { width: 0; } 25% { width: 110px; } 100% { width: 110px; } }
@keyframes dbNamePh { 0% { letter-spacing: 8px; filter: blur(3px); } 20% { letter-spacing: 3px; filter: none; } 100% { letter-spacing: 3.5px; } }
/* prompts and the big title cards: smaller; the big card sits below the call card's place */
body.tc-phone #prompt { font-size: 12.5px; padding: 5px 13px; bottom: 33%; }
body.tc-phone #bigmsg { top: 44%; }
body.tc-phone #bigmsg-title { font-size: 26px; }
body.tc-phone #bigmsg-sub { font-size: 12px; }
/* a phone call: a compact card under the clock, left of the heat pill; the station card steps aside (touch.js tc-call) */
body.tc-phone #callcard { top: calc(var(--tc-eT) + 50px); right: calc(var(--tc-eR) + 92px); width: 196px; transform: none; padding: 7px 9px 8px; border-radius: 14px; box-sizing: border-box; }
body.tc-phone #callcard .cc-top { font-size: 8.5px; letter-spacing: 1px; }
body.tc-phone #callcard .cc-who { margin: 5px 0; gap: 8px; }
body.tc-phone #callcard .cc-who canvas { width: 32px; height: 32px; }
body.tc-phone #callcard .cc-name { font-size: 13px; }
body.tc-phone #callcard .cc-sub { font-size: 9.5px; }
body.tc-phone #callcard .cc-btns span { padding: 4px 0; }
body.tc-phone #callcard .cc-ans::after { font-size: 11px; }
body.tc-phone.tc-call #radio-card { display: none; }
body.touch.tc-talk #objective { visibility: hidden; }        /* somebody's talking: the dialogue box has the top centre */
body.touch.tc-talk #callcard { display: none; }             /* on the call: the dialogue box says who it is, and has Skip */
/* the dialogue box: between the money and the clock, smaller type, room on the right for Skip */
body.tc-phone #dialogue:not(.cut) { width: calc((100vw - 2 * max(var(--tc-eL), var(--tc-eR)) - 340px) / var(--tz, 1)); min-width: 0; box-sizing: border-box; padding: 6px 72px 6px 7px; gap: 8px; border-radius: 12px; }
body.tc-phone #dialogue .dl-portrait { width: 40px; height: 40px; }
body.tc-phone #dialogue .dl-name { font-size: 11.5px; }
body.tc-phone #dialogue.phone .dl-name::after { font-size: 9px; }
body.tc-phone #dialogue .dl-text { font-size: 13px; line-height: 1.3; margin-top: 1px; }
body.tc-phone #dialogue .dl-gloss { font-size: 11px; margin-top: 2px; }
body.tc-phone #dialogue .dl-hint::after { font-size: 8.5px; }
body.tc-phone #dialogue .dl-hint { bottom: -14px; }
body.tc-phone #tc-dskip { min-width: 56px; padding: 0 10px; font-size: 12px; }
body.tc-phone #callcard.ended .cc-btns { display: none; }

/* ---- Settings on a touch screen: the touch list first (settings.js), wrapped to the card; room to tap */
body.touch #settings .st-card { padding: 10px 14px 12px; }
body.tc-phone #settings .st-card > .kente { display: none; }
body.tc-phone #settings h2 { font-size: 18px; margin: 2px 0 6px; letter-spacing: 4px; }
body.touch #settings .st-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; font-size: 12.5px; line-height: 1.45; }
body.touch #settings .kc-row { white-space: normal; display: flex; align-items: baseline; gap: 6px; margin-bottom: 3px; }
body.touch #settings .kc-row kbd { flex: none; margin-right: 0; }
body.touch #settings .st-back { min-height: 44px; }
body.tc-phone #settings .st-row { padding: 5px 8px; }
body.tc-phone #settings .st-note { margin-top: 6px; }

/* ---- the big map on a touch screen: the whole screen for the map (bigmap.js), a small fading hint, the legend folds */
body.touch #bigmap .bm-head { top: calc(var(--tc-eT) + 2px); left: var(--tc-eL); }
body.tc-phone #bigmap .bm-kente { width: 70px; height: 4px; margin-bottom: 4px; }
body.tc-phone #bigmap .bm-title { font-size: 16px; letter-spacing: 5px; }
body.tc-phone #bigmap .bm-sub { display: none; }
body.touch #bigmap .bm-hint { font-size: 11px; bottom: calc(var(--tc-sab) + 6px); left: 50%; right: auto; transform: translateX(-50%); white-space: nowrap; max-width: calc(100vw - 2 * max(var(--tc-eL), var(--tc-eR)) - 220px);
  overflow: hidden; text-overflow: ellipsis; background: rgba(10,10,14,.6); padding: 4px 10px; border-radius: 12px; text-shadow: none; animation: bmHintFade 5s ease-in forwards; }
@keyframes bmHintFade { 0%, 70% { opacity: .9; } 100% { opacity: 0; } }
body.touch #bigmap .bm-legend { top: auto; bottom: calc(var(--tc-sab) + 8px); right: var(--tc-eR); width: auto; min-width: 0; padding: 0; line-height: 1.8; font-size: 12px; pointer-events: auto; }
body.touch #bigmap .bm-legend > div:not(.bm-lt) { display: none; padding: 0 12px; }
body.touch #bigmap .bm-legend.open > div:not(.bm-lt) { display: block; }
body.touch #bigmap .bm-legend.open > div:nth-child(2) { padding-top: 8px; }
body.touch #bigmap .bm-legend .bm-lt { min-height: 44px; min-width: 96px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; cursor: pointer; font-size: 11px; }
body.touch #bigmap .bm-legend .bm-lt::after { content: "▴"; letter-spacing: 0; }
body.touch #bigmap .bm-legend.open .bm-lt::after { content: "▾"; }
body.touch #bigmap .bm-legend .lg { width: 14px; height: 14px; margin-right: 8px; }

/* ---- Export / Import save on a touch screen (batch 10 merge: the free-edition panel met 64b's phone layout).
   44 px targets; on a phone no kente band and a shorter code box, so Back fits on a 390 px tall screen. */
body.touch #savexfer button, body.touch #savexfer .sx-file { min-height: 44px; }
body.touch #savexfer .sx-file { display: inline-flex; align-items: center; box-sizing: border-box; }
body.tc-phone #savexfer .sx-card { padding: 8px 16px 10px; }
body.tc-phone #savexfer .sx-card > .kente { display: none; }
body.tc-phone #savexfer h2 { font-size: 18px; margin: 2px 0 4px; letter-spacing: 4px; }
body.tc-phone #savexfer .sx-p { font-size: 12.5px; margin: 2px 0 4px; line-height: 1.35; }
body.tc-phone #savexfer .sx-row { margin: 5px 0; }
body.tc-phone #savexfer .sx-code { height: 60px; }
/* the achievement card on a phone (iteration 67): a slim pill between the thumbs, over the radio subtitles, under the prompt */
body.tc-phone #ach-toast { bottom: calc(var(--tc-sab) + 46px); gap: 8px; max-width: min(330px, calc((100vw - 2 * max(var(--tc-eL), var(--tc-eR)) - 380px) / var(--tz, 1))); padding: 3px 14px 3px 4px; border-radius: 24px; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
body.tc-phone #ach-toast .at-medal { width: 28px; height: 28px; font-size: 14px; box-shadow: 0 0 0 2px #f2b01e, 0 0 8px var(--ac); }
body.tc-phone #ach-toast small { font-size: 7.5px; line-height: 1.1; letter-spacing: 1.5px; }
body.tc-phone #ach-toast b { font-size: 13px; line-height: 1.1; }
body.tc-phone #ach-toast span { font-size: 10px; line-height: 1.2; }
