/* HUD: plain HTML over the canvas. The map itself never touches the DOM. */
:root {
  --ink: #1e2430;
  --muted: #5d6b7e;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(30, 36, 48, 0.12);
  --accent: #ffd23f;
  font: 13px/1.4 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #c7e0f2; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }

.panel {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.panel h2 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.panel h2 + dl { margin-top: 0; }
.panel dl + h2 { margin-top: 10px; }

#stats { top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; width: 290px; max-width: calc(100vw - 20px); }
#stats .stats-head { display: flex; align-items: center; gap: 8px; }
#stats .stats-head h2 { margin: 0; }
#stats .stats-summary { display: none; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
#stats-toggle { margin-left: auto; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: 700 15px/1 ui-sans-serif, -apple-system, sans-serif; cursor: pointer; }
#stats-toggle:hover { background: var(--accent); }
#stats-body { margin-top: 4px; }
#stats.collapsed { width: auto; padding: 6px 8px 6px 12px; }
#stats.collapsed #stats-body { display: none; }
#stats.collapsed .stats-summary { display: inline; }
#stats dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin: 0; }
#stats dt { color: var(--muted); }
#stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

#controls { top: calc(70px + env(safe-area-inset-top, 0px)); right: 10px; display: grid; grid-template-columns: auto auto; gap: 6px 8px; align-items: center; }
#controls label { color: var(--muted); }
#controls select { font: inherit; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
#controls .check { grid-column: 1 / -1; color: var(--ink); display: flex; gap: 6px; align-items: center; }
#controls kbd { font: inherit; font-size: 11px; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--muted); }

#find { top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(380px, calc(100vw - 20px)); padding: 6px; }
#search { width: 100%; font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
#results { display: flex; flex-direction: column; color: var(--muted); }
#results:not(:empty) { padding-top: 6px; }
#results button { font: inherit; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 6px; color: var(--ink); cursor: pointer; }
#results button:hover, #results button:focus-visible { background: rgba(255, 210, 63, 0.35); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#status { position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); margin: 0; font-weight: 700; font-size: 15px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--ink); background: var(--panel); box-shadow: 0 3px 0 var(--ink); max-width: calc(100vw - 32px); text-align: center; }
#status:empty { display: none; }

#pick[hidden] { display: none; }
#pick { left: 50%; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; min-width: 240px; padding-right: 36px; }
#pick strong { font-size: 16px; }
#pick span { color: var(--muted); }
#pick-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }

#help { position: fixed; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); margin: 0; color: var(--ink); opacity: 0.7; font-size: 12px; white-space: nowrap; }

:focus-visible { outline: 2px solid #2e7cb8; outline-offset: 2px; }

#clock { top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; }
#clock strong { font-size: 15px; font-variant-numeric: tabular-nums; }
#clock #clock-icon { font-size: 15px; width: 18px; text-align: center; }
#clock #clock-period { color: var(--muted); min-width: 64px; }
#clock .clock-buttons { display: flex; gap: 2px; }
#clock button { font: inherit; font-size: 12px; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
#clock button:hover, #clock button[aria-current="true"] { background: var(--accent); }
#clock #clock-run { width: 26px; padding: 3px 0; }
#controls { top: calc(56px + env(safe-area-inset-top, 0px)); }
body.night .panel { background: rgba(236, 240, 252, 0.88); }
#sound[hidden] { display: none; }
#sound { position: fixed; left: calc(10px + env(safe-area-inset-left, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); width: 38px; height: 38px; padding: 7px; border-radius: 50%; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
#sound:hover { background: var(--accent); }
#sound:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
#sound svg { width: 100%; height: 100%; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#sound .speaker { fill: currentColor; }
#sound .mute, #sound[aria-pressed="false"] .waves { display: none; }
#sound[aria-pressed="false"] .mute { display: inline; }
#sound[aria-pressed="false"] { opacity: 0.75; }
@media (pointer: coarse) {
  body.playing #sound { bottom: calc(176px + env(safe-area-inset-bottom, 0px)); }
  body.playing #clock { top: calc(10px + env(safe-area-inset-top, 0px)); bottom: auto; right: auto; left: 10px; }
}
body.playing #clock .clock-buttons, body.playing #clock #clock-period { display: none; }

@media (max-width: 640px) {
  #stats { width: auto; right: 10px; font-size: 11px; }
  #stats dl { grid-template-columns: repeat(2, auto 1fr); }
  #stats-body > h2, #stats-body > dl:last-of-type { display: none; }
  #controls { top: auto; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); right: 10px; left: 10px; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); font-size: 12px; }
  #controls select { width: 100%; min-width: 0; }
  #pick { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
  #help { display: none; }
  #find { top: auto; bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }
  #sound { bottom: calc(176px + env(safe-area-inset-bottom, 0px)); }
  #clock { top: auto; bottom: calc(176px + env(safe-area-inset-bottom, 0px)); right: 10px; font-size: 12px; gap: 5px; }
  #clock #clock-period { display: none; }
  #stats { top: calc(10px + env(safe-area-inset-top, 0px)); }
}

/* playing a character (control.js, drive-hud.js): speedometer in a corner, a fading key hint at the top, joystick on touch */
#drive-corner[hidden], #drive-hint[hidden], #pad[hidden], #speedo[hidden], #walk-badge[hidden] { display: none; }
#drive-corner { position: fixed; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
#speedo { position: relative; width: 176px; height: 176px; border-radius: 50%; background: rgba(255, 255, 255, 0.92); border: 2.5px solid var(--ink); box-shadow: 0 5px 0 var(--ink); }
#speedo svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#speedo .face { fill: none; }
#speedo .track { fill: none; stroke: rgba(30, 36, 48, 0.12); stroke-width: 9; stroke-linecap: round; }
#speedo .redline { fill: none; stroke: #f05a4f; stroke-width: 9; opacity: 0.35; }
#speedo .progress { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; }
#speedo line { stroke: var(--ink); stroke-linecap: round; }
#speedo line.major { stroke-width: 3; }
#speedo line.minor { stroke-width: 1.5; opacity: 0.6; }
#speedo text { font: 700 13px ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: var(--ink); text-anchor: middle; }
#speedo .needle path { fill: #f05a4f; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
#speedo .hub { fill: var(--ink); }
#speedo .speedo-readout { position: absolute; left: 0; right: 0; top: 118px; display: flex; justify-content: center; align-items: baseline; gap: 3px; }
#speedo .speedo-readout strong { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
#speedo .speedo-readout span { font-size: 11px; font-weight: 700; color: var(--muted); }
#speedo .speedo-name { position: absolute; left: 0; right: 0; bottom: 12px; margin: 0; text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); }
#speedo .speedo-gear { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); font-weight: 900; font-size: 13px; color: #fff; background: #f05a4f; border: 2px solid var(--ink); border-radius: 6px; padding: 0 5px; }
#speedo .speedo-gear[hidden] { display: none; }
#speedo.crash { animation: crash 0.4s; }
@keyframes crash { 0%, 100% { transform: none; } 25% { transform: translateX(-4px) rotate(-2deg); background: #ffd6d2; } 75% { transform: translateX(4px) rotate(2deg); } }
/* life (drive-hud.js › life, hurt, down) */
#life { align-self: stretch; display: flex; align-items: center; gap: 7px; background: rgba(255, 255, 255, 0.92); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); border-radius: 14px; padding: 6px 11px; }
#life .icon { flex: none; width: 20px; height: 20px; }
#life .icon svg { width: 100%; height: 100%; fill: #f05a4f; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
#life .bar { position: relative; flex: 1; height: 13px; border: 2px solid var(--ink); border-radius: 7px; background: rgba(30, 36, 48, 0.1); overflow: hidden; }
#life .bar i { position: absolute; inset: 0 auto 0 0; background: #f05a4f; transition: width 0.3s; }
#life[data-level="ok"] .bar i { background: #3fbf6f; }
#life[data-level="mid"] .bar i { background: #f5a524; }
#life[data-level="low"] .icon { animation: heartbeat 0.8s infinite; }
#life strong { min-width: 26px; text-align: right; font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums; }
@keyframes heartbeat { 0%, 40%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 28% { transform: scale(1.1); } }
/* sinking in the sea (control.js › waterFade, water.js): the screen goes dark blue, under the HUD */
#water-fade { position: fixed; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, #0b4a6e 0%, #052335 70%, #020f18 100%); }
#water-fade[hidden] { display: none; }
#hurt-edge { position: fixed; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px 40px rgba(220, 30, 30, 0.85); z-index: 5; }
#hurt-edge.hit { animation: hurt-flash 0.7s ease-out; }
#hurt-edge.low:not(.hit) { animation: hurt-low 1.6s ease-in-out infinite; }
@keyframes hurt-flash { 0% { opacity: var(--hit, 0.6); } 100% { opacity: 0; } }
@keyframes hurt-low { 0%, 100% { opacity: 0.12; } 50% { opacity: 0.38; } }
body.down #map { filter: grayscale(0.9) brightness(0.85); transition: filter 1.2s; }
#down[hidden] { display: none; }
#down { position: fixed; left: 0; right: 0; top: calc(70px + env(safe-area-inset-top, 0px)); display: flex; justify-content: center; pointer-events: none; z-index: 6; animation: down-in 0.8s ease-out; }
#down .card { display: flex; flex-direction: column; align-items: center; gap: 2px; background: rgba(255, 255, 255, 0.94); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); border-radius: 18px; padding: 10px 22px; text-align: center; }
#down strong { font-size: 20px; font-weight: 900; color: #e0453b; }
#down span { font-size: 15px; font-weight: 700; }
#down em { font-style: normal; font-size: 12px; color: var(--muted); }
@keyframes down-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }

/* fuel and the vehicle's state, beside the speedometer (drive-hud.js › condition) */
#drive-corner .drive-row { display: flex; align-items: flex-end; gap: 10px; }
#gauges[hidden], #gauges .gauge-line[hidden], #gauges .arrow[hidden] { display: none; }
#gauges { width: 178px; display: flex; flex-direction: column; gap: 7px; background: rgba(255, 255, 255, 0.92); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); border-radius: 16px; padding: 9px 11px; }
#gauges .gauge { display: flex; align-items: center; gap: 7px; }
#gauges .icon { flex: none; width: 20px; height: 20px; }
#gauges .icon svg { width: 100%; height: 100%; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#gauges .bar { position: relative; flex: 1; height: 13px; border: 2px solid var(--ink); border-radius: 7px; background: rgba(30, 36, 48, 0.1); overflow: hidden; }
#gauges .bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); transition: width 0.25s linear, background 0.3s; }
#gauges .bar b { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(30, 36, 48, 0.35); }
#gauges .bar .q1 { left: 25%; } #gauges .bar .q2 { left: 50%; } #gauges .bar .q3 { left: 75%; }
#gauges .ends { display: flex; gap: 5px; font-size: 10px; font-weight: 900; color: var(--muted); }
#gauges .ends em { font-style: normal; }
#gauges .fuel.low .bar i { background: #f5a524; }
#gauges .fuel.reserve .bar i { background: #f05a4f; }
#gauges .fuel.reserve .icon { animation: blink 0.9s steps(1) infinite; }
#gauges .fuel.reserve .icon svg { stroke: #f05a4f; }
#gauges .fuel.filling .bar i { background: #3fbf6f; transition: width 0.1s linear; }
#gauges .breath[hidden], #gauges .fuel[hidden] { display: none; } /* the bicycle: no tank, the breath instead */
#gauges .breath .bar i { background: #5cc8f0; transition: width 0.15s linear; }
#gauges .breath.straining .bar i { background: #f5a524; }
#gauges .breath.spent .bar i { background: #f05a4f; }
#gauges .breath.spent .icon, #gauges .breath.spent .value { animation: blink 0.6s steps(1) infinite; color: #f05a4f; }
#gauges .breath .value { min-width: 34px; text-align: right; font-size: 11px; font-weight: 900; }
#gauges .health .value { min-width: 34px; text-align: right; font-size: 11px; font-weight: 900; font-variant-numeric: tabular-nums; }
#gauges .health[data-level="ok"] .bar i { background: #3fbf6f; }
#gauges .health[data-level="worn"] .bar i { background: #b8cf3a; }
#gauges .health[data-level="hurt"] .bar i { background: #f5a524; }
#gauges .health[data-level="bad"] .bar i { background: #f05a4f; }
#gauges .health[data-level="bad"] .icon, #gauges .health[data-level="wreck"] .value { animation: blink 0.9s steps(1) infinite; }
#gauges .health[data-level="wreck"] .value { color: #f05a4f; min-width: 0; white-space: nowrap; }
#gauges .gauge-line { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 800; }
#gauges .gauge-line.filling { color: #2a9a55; }
#gauges .arrow { flex: none; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); }
#gauges .arrow svg { width: 13px; height: 13px; fill: #fff; }
@keyframes blink { 50% { opacity: 0.25; } }
#walk-badge { display: flex; flex-direction: column; align-items: flex-end; background: rgba(255, 255, 255, 0.92); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); border-radius: 16px; padding: 8px 14px; }
#walk-badge strong { font-size: 14px; }
#walk-badge span { font-size: 20px; font-weight: 900; }
#drive-note { margin: 0; max-width: 260px; text-align: right; font-weight: 700; color: #fff; background: var(--ink); border-radius: 10px; padding: 6px 10px; opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
#drive-note.on { opacity: 1; transform: none; }
#drive-hint { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); margin: 0; font-size: 12px; color: var(--ink); background: rgba(255, 255, 255, 0.8); border-radius: 12px; padding: 4px 12px; width: max-content; max-width: max(280px, calc(100vw - 640px)); text-align: center; transition: opacity 0.8s; pointer-events: none; }
#drive-hint.fade { opacity: 0; }
@media (pointer: coarse) {
  /* the joystick and the buttons take the bottom: the speedometer goes to the top right, smaller */
  #drive-corner { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); flex-direction: column-reverse; }
  #speedo { width: 128px; height: 128px; }
  #speedo .speedo-readout { top: 84px; }
  #speedo .speedo-readout strong { font-size: 19px; }
  #speedo .speedo-name { bottom: 6px; font-size: 9px; }
  #speedo .speedo-gear { top: 40px; }
  #drive-corner .drive-row { align-items: flex-start; }
  #gauges { width: 150px; padding: 7px 9px; gap: 5px; }
  #drive-hint { bottom: auto; top: calc(150px + env(safe-area-inset-top, 0px)); }
}
#pad { position: fixed; inset: auto 0 calc(16px + env(safe-area-inset-bottom, 0px)) 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 18px; pointer-events: none; }
#pad .stick { pointer-events: auto; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); border: 2px solid rgba(30, 36, 48, 0.4); display: grid; place-items: center; touch-action: none; }
#pad .knob { width: 56px; height: 56px; border-radius: 50%; background: var(--ink); opacity: 0.75; transition: transform 0.05s; }
#pad .pad-buttons { pointer-events: auto; display: flex; flex-direction: column; gap: 10px; }
#pad button { font: inherit; font-weight: 700; font-size: 15px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--ink); background: rgba(255, 255, 255, 0.9); color: var(--ink); touch-action: none; }
#pad button:active { background: var(--accent); }
body.playing #find, body.playing #controls, body.playing #help, body.playing #results { display: none; }
@media (max-width: 640px) { body.playing #stats { display: none; } }

/* deliveries (jobs.js): the card of the delivery under way and the wallet in the corner (drive-hud.js), the phone (phone.js) */
#job-card[hidden], #job-card .job-food[hidden], #job-card .job-hold[hidden], #phone[hidden], #phone-button[hidden], #phone-button .dot[hidden] { display: none; }
#job-card { align-self: stretch; width: 260px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 6px; background: rgba(255, 255, 255, 0.94); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); border-radius: 16px; padding: 9px 11px; }
#job-card .job-head { display: flex; align-items: center; gap: 8px; }
#job-card .icon { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 9px; background: #ff8c26; }
#job-card[data-stage="dropoff"] .icon { background: #ff6bb8; }
#job-card .icon svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
#job-card .job-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
#job-card .job-who em { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
#job-card .job-who strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#job-card .job-time { font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
#job-card .job-time.tight { color: #e08a00; }
#job-card .job-time.late { color: #f05a4f; animation: blink 0.9s steps(1) infinite; }
#job-card .job-line { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 12px; }
#job-card .job-line b { font-weight: 900; font-variant-numeric: tabular-nums; }
#job-card .job-dish { color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#job-card .arrow { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); }
#job-card .arrow svg { width: 15px; height: 15px; fill: #fff; }
#job-card .job-food { display: flex; align-items: center; gap: 7px; font-size: 11px; }
#job-card .job-food .bar { position: relative; flex: 1; height: 11px; border: 2px solid var(--ink); border-radius: 6px; background: rgba(30, 36, 48, 0.1); overflow: hidden; }
#job-card .job-food .bar i { position: absolute; inset: 0 auto 0 0; background: #3fbf6f; transition: width 0.3s; }
#job-card .job-food[data-level="worn"] .bar i { background: #b8cf3a; }
#job-card .job-food[data-level="hurt"] .bar i { background: #f5a524; }
#job-card .job-food[data-level="bad"] .bar i { background: #f05a4f; }
#job-card .job-food b { font-weight: 900; min-width: 74px; text-align: right; font-variant-numeric: tabular-nums; }
#job-card .job-hold { position: relative; height: 18px; border: 2px solid var(--ink); border-radius: 9px; overflow: hidden; background: rgba(30, 36, 48, 0.08); }
#job-card .job-hold i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
#job-card .job-hold span { position: relative; display: block; text-align: center; font-size: 11px; font-weight: 900; line-height: 14px; }
#wallet { display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.92); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); border-radius: 999px; padding: 4px 12px 4px 6px; }
#wallet .icon { width: 22px; height: 22px; }
#wallet .icon svg { width: 100%; height: 100%; fill: var(--accent); stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#wallet strong { font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
#wallet.debt strong { color: #f05a4f; }
#wallet .stars { font-size: 12px; font-weight: 800; color: #c98a00; }
#wallet .stars:empty { display: none; }

#phone-button { position: fixed; left: calc(56px + env(safe-area-inset-left, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); width: 38px; height: 38px; padding: 6px; border-radius: 50%; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
#phone-button:hover, #phone-button[aria-pressed="true"] { background: var(--accent); }
#phone-button svg { width: 100%; height: 100%; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#phone-button .dot { position: absolute; top: -3px; right: -3px; width: 13px; height: 13px; border-radius: 50%; background: #f05a4f; border: 2px solid var(--ink); }
#phone { position: fixed; left: calc(10px + env(safe-area-inset-left, 0px)); bottom: calc(58px + env(safe-area-inset-bottom, 0px)); width: 310px; max-width: calc(100vw - 20px); max-height: calc(100vh - 80px); display: flex; padding: 9px; border-radius: 30px; background: var(--ink); box-shadow: 0 6px 0 rgba(30, 36, 48, 0.5); }
#phone .screen { flex: 1; min-height: 0; overflow-y: auto; border-radius: 22px; background: #f6f8fb; padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 10px; }
#phone .app-head { display: flex; align-items: center; gap: 8px; }
#phone .brand { flex: 1; display: flex; align-items: baseline; gap: 6px; }
#phone .brand strong { font-size: 21px; font-weight: 900; letter-spacing: -0.02em; color: #ff6a1a; }
#phone .brand span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
#phone .money { display: flex; align-items: baseline; gap: 3px; background: var(--accent); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 10px; }
#phone .money strong { font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
#phone .money span { font-size: 10px; font-weight: 800; }
#phone .money.debt { background: #ffd2cd; }
#phone .money.debt strong { color: #d43a2f; }
#phone button { font: inherit; font-weight: 800; font-size: 12px; padding: 6px 11px; border-radius: 10px; border: 2px solid var(--ink); background: var(--accent); color: var(--ink); box-shadow: 0 2px 0 var(--ink); cursor: pointer; white-space: nowrap; }
#phone button:hover:not(:disabled) { filter: brightness(1.06); }
#phone button:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
#phone button:disabled { opacity: 0.45; cursor: default; }
#phone button.secondary { background: #fff; }
#phone button.close { padding: 0; width: 26px; height: 26px; border-radius: 50%; background: #fff; font-size: 16px; line-height: 1; }
#phone .rating { margin: -4px 0 0; font-size: 12px; font-weight: 800; color: #c98a00; }
#phone .block { display: flex; flex-direction: column; gap: 7px; }
#phone h3 { margin: 0; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
#phone .offer { position: relative; display: flex; flex-direction: column; gap: 4px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px 10px; overflow: hidden; }
#phone .current .offer { background: #fff4e6; }
#phone .route { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; font-size: 13px; line-height: 1.2; }
#phone .route .to { color: var(--muted); font-weight: 900; }
#phone .route .here { color: #e2560e; }
#phone .facts { margin: 0; display: flex; flex-wrap: wrap; gap: 3px 9px; font-size: 11px; color: var(--muted); font-weight: 700; }
#phone .facts strong { color: var(--ink); font-size: 12px; }
#phone .facts .late { color: #f05a4f; }
#phone .offer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
#phone .pay { font-size: 15px; font-weight: 900; color: #2a9a55; }
#phone .expire { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(30, 36, 48, 0.08); }
#phone .expire i { position: absolute; inset: 0 auto 0 0; background: #ff8c26; }
#phone .empty { margin: 0; font-size: 12px; color: var(--muted); font-style: italic; }
#phone .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px; }
#phone .row .facts { flex-direction: column; flex: 1; min-width: 0; }
#phone .owned { font-size: 12px; font-weight: 900; color: #2a9a55; }
#phone .history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
#phone .history li { display: flex; align-items: center; gap: 6px; }
#phone .history .stars { color: #e0a000; letter-spacing: -1px; }
#phone .history .who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-weight: 700; }
#phone .history b { color: #2a9a55; font-variant-numeric: tabular-nums; }
#phone .history b.zero { color: #f05a4f; }
#phone .phone-hint { margin: 0; text-align: center; font-size: 10px; color: var(--muted); }
body.phone-open #stats { display: none; }
@media (pointer: coarse) {
  #phone-button { left: calc(10px + env(safe-area-inset-left, 0px)); bottom: calc(222px + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; }
  #phone { left: 10px; right: 10px; width: auto; top: calc(56px + env(safe-area-inset-top, 0px)); bottom: calc(176px + env(safe-area-inset-bottom, 0px)); max-height: none; }
  #job-card { width: 210px; padding: 7px 9px; }
}

/* the big button over a vehicle that can be pushed (control.js › placePrompt): it bobs, an arrow points at the vehicle */
#act-prompt[hidden] { display: none; }
#act-prompt { position: fixed; left: 0; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 9px 14px 9px 11px; border: 3px solid var(--ink); border-radius: 16px; background: var(--accent); color: var(--ink); box-shadow: 0 5px 0 var(--ink); font: 900 17px/1 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0.01em; cursor: pointer; touch-action: none; margin-top: -14px; }
#act-prompt::after { content: ''; position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); border: 9px solid transparent; border-top: 11px solid var(--ink); }
#act-prompt > * { animation: prompt-bob 0.9s ease-in-out infinite; }
#act-prompt svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#act-prompt kbd { font: 900 13px/1 ui-monospace, monospace; padding: 4px 7px; border: 2px solid var(--ink); border-radius: 7px; background: #fff; box-shadow: 0 2px 0 var(--ink); }
#act-prompt:hover { background: #ffe066; }
#act-prompt:active { box-shadow: 0 2px 0 var(--ink); }
@keyframes prompt-bob { 50% { transform: translateY(-3px); } }
@media (pointer: coarse) { #act-prompt { font-size: 19px; padding: 12px 18px 12px 14px; } }

/* the game without ?dev=1 (main.js › setDev, F3 toggles): no telemetry, no settings form (nor its catalog link), no long
   help line; the long key help of drive-hud.js only after H. A short hint comes once instead (#tip, main.js › tipOnce) */
body:not(.dev) #stats, body:not(.dev) #controls, body:not(.dev) #help { display: none; }
body:not(.dev):not(.hint-on) #drive-hint { display: none; }
#tip[hidden] { display: none; }
#tip { position: fixed; z-index: 30; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); margin: 0; width: max-content; max-width: calc(100vw - 32px); padding: 7px 16px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); font-size: 14px; font-weight: 700; text-align: center; pointer-events: none; transition: opacity 0.8s; }
#tip.fade { opacity: 0; }
/* on a phone the open phone (which Jogar opens) would sit under the pad's buttons: those come back when it closes */
@media (pointer: coarse) { body.phone-open #pad .pad-buttons { display: none; } }
@media (pointer: coarse) { #tip { top: calc(62px + env(safe-area-inset-top, 0px)); } }

/* the start screen (index.html #intro, intro.js): a card over the map, which loads behind it; the suggestions push
   the Jogar button down (over it, a tap on Jogar would pick a suggestion instead) */
#intro[hidden] { display: none; }
#intro { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px)); overflow-y: auto; background: radial-gradient(ellipse at 50% 40%, rgba(199, 224, 242, 0.15), rgba(30, 36, 48, 0.55)); }
body.intro #find, body.intro #clock, body.intro #sound, body.intro #status, body.intro #pick { display: none; }
.intro-card { position: relative; width: min(440px, 100%); padding: 26px 26px 18px; border-radius: 28px; border: 3px solid var(--ink); background: #fffdf5; box-shadow: 0 8px 0 var(--ink); text-align: center; }
#intro-title { margin: 0; font-size: 76px; line-height: 1; font-weight: 900; letter-spacing: -0.04em; color: #ff6a1a; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); transform: rotate(-3deg); }
#intro-tagline { margin: 16px auto 20px; max-width: 330px; font-size: 17px; line-height: 1.35; font-weight: 700; color: var(--ink); }
#intro-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
#intro-form label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.intro-field { position: relative; }
#intro-city { width: 100%; font: inherit; font-size: 18px; font-weight: 600; padding: 12px 14px; border-radius: 14px; border: 2.5px solid var(--ink); background: #fff; color: var(--ink); box-shadow: inset 0 3px 0 rgba(30, 36, 48, 0.08); }
#intro-city::placeholder { color: #8a96a6; font-weight: 500; }
#intro-results:empty { display: none; }
#intro-results { margin-top: 6px; display: flex; flex-direction: column; padding: 4px; border-radius: 14px; border: 2px dashed rgba(30, 36, 48, 0.3); background: #fff8dc; max-height: 220px; overflow-y: auto; }
#intro-results button { display: flex; align-items: baseline; gap: 4px; font: inherit; font-size: 16px; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 9px; color: var(--ink); cursor: pointer; }
#intro-results button span { color: var(--muted); font-size: 13px; font-weight: 700; }
#intro-results button:hover, #intro-results button[aria-selected="true"] { background: rgba(255, 210, 63, 0.5); }
#intro-results .none { margin: 0; padding: 9px 10px; color: var(--muted); }
#intro-play { margin-top: 6px; font: inherit; font-size: 30px; font-weight: 900; letter-spacing: -0.01em; padding: 13px 18px; border-radius: 18px; border: 3px solid var(--ink); background: var(--accent); color: var(--ink); box-shadow: 0 6px 0 var(--ink); cursor: pointer; }
#intro-play:hover:not(:disabled) { filter: brightness(1.05); }
#intro-play:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
#intro-play:disabled { opacity: 0.75; cursor: progress; }
#intro-status { margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; }
#intro-status:empty { min-height: 0; }
#intro-explore { margin-top: 10px; font: inherit; font-size: 14px; font-weight: 600; border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 6px 10px; cursor: pointer; }
#intro-explore:hover { color: var(--ink); }
@media (max-width: 480px) {
  .intro-card { padding: 22px 18px 14px; border-radius: 24px; }
  #intro-title { font-size: 64px; }
  #intro-tagline { font-size: 16px; margin: 14px auto 16px; }
}

/* share the city (main.js › share): a round button beside the sound and the phone, only while playing */
#share { position: fixed; left: calc(102px + env(safe-area-inset-left, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); width: 38px; height: 38px; padding: 7px; border-radius: 50%; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
#share:hover { background: var(--accent); }
#share:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
#share svg { width: 100%; height: 100%; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body:not(.playing) #share, body.down #share { display: none; }
@media (pointer: coarse) {
  #share { left: calc(10px + env(safe-area-inset-left, 0px)); bottom: calc(274px + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; padding: 9px; }
  body.phone-open #share { display: none; }
}

/* celular: touch screens (iPhone, Android; scripts/mobile.js checks this block in portrait and landscape) */
@supports (height: 100dvh) { #phone { max-height: calc(100dvh - 80px); } } /* iOS: 100vh is taller than what shows */
@media (pointer: coarse) {
  /* no page zoom (pinch, double tap) and no text selection or callout over the HUD: the map's own pinch is the canvas's */
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
  input { -webkit-user-select: text; user-select: text; }
  .panel, #pad, #drive-corner, #drive-hint, #clock, #sound, #phone-button, #phone, #act-prompt, #pick, #down { touch-action: none; }
  #phone .screen, #stats-body { touch-action: pan-y; overscroll-behavior: contain; }
  /* iOS zooms the page into any input whose text is under 16 px */
  #search { font-size: 16px; }
  /* fingers: every button at least 40 px */
  #sound { width: 44px; height: 44px; padding: 9px; }
  #phone-button { bottom: calc(230px + env(safe-area-inset-bottom, 0px)); }
  #phone button { min-height: 40px; padding: 8px 14px; font-size: 13px; }
  #phone button.close { width: 40px; height: 40px; min-height: 40px; font-size: 20px; }
  /* the phone's header (coins, ×) stays on top while the list scrolls: in landscape it is the only way to close it */
  #phone .app-head { position: sticky; top: -12px; z-index: 1; margin: -12px -12px 0; padding: 12px 12px 6px; background: #f6f8fb; }
  #clock button { min-height: 40px; min-width: 40px; }
  /* the phone over the touch buttons (it closes with its × or the phone button); the joystick stays free below it */
  #phone { z-index: 7; }
  /* the telemetry (a developer panel) and the keyboard help never cover the joystick */
  body.playing #stats, #help { display: none; }
  body.playing #clock { left: calc(10px + env(safe-area-inset-left, 0px)); }
  #pad { padding: 0 calc(18px + env(safe-area-inset-right, 0px)) 0 calc(18px + env(safe-area-inset-left, 0px)); }
}
/* portrait: the gauges go under the speedometer, so the clock (top left) and the key hint keep their corner */
@media (pointer: coarse) and (orientation: portrait) {
  #drive-corner .drive-row { flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
  #drive-hint { left: calc(10px + env(safe-area-inset-left, 0px)); transform: none; top: calc(76px + env(safe-area-inset-top, 0px)); max-width: calc(100vw - 190px); text-align: left; }
}
/* the search above the on-screen keyboard (--kb: device.js) */
@media (pointer: coarse) and (max-width: 640px) {
  #find { bottom: calc(118px + env(safe-area-inset-bottom, 0px) + var(--kb, 0px)); }
}
/* landscape (a phone on its side, ≤ 500 px tall): all smaller; the delivery card goes left under the clock, the phone
   and sound buttons beside the joystick, the touch buttons in two columns, the phone on the left */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #drive-corner { top: calc(8px + env(safe-area-inset-top, 0px)); gap: 6px; }
  #speedo { width: 88px; height: 88px; border-width: 2px; box-shadow: 0 3px 0 var(--ink); }
  #speedo .speedo-readout { top: 54px; }
  #speedo .speedo-readout strong { font-size: 15px; }
  #speedo .speedo-readout span, #speedo svg text, #speedo .speedo-name { display: none; }
  #speedo .speedo-gear { top: 22px; font-size: 11px; }
  #gauges { width: 132px; padding: 5px 8px; gap: 4px; }
  #life { padding: 3px 9px; }
  #wallet { padding: 2px 10px 2px 4px; }
  #drive-note { max-width: 220px; font-size: 12px; }
  #job-card { position: fixed; left: calc(10px + env(safe-area-inset-left, 0px)); top: calc(64px + env(safe-area-inset-top, 0px)); width: 240px; }
  #drive-hint { top: calc(10px + env(safe-area-inset-top, 0px)); max-width: calc(100vw - 600px); }
  #pad { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  #pad .stick { width: 120px; height: 120px; }
  #pad .knob { width: 48px; height: 48px; }
  #pad .pad-buttons { flex-flow: column wrap-reverse; align-content: flex-start; max-height: 150px; gap: 6px; }
  #pad button { min-height: 42px; padding: 8px 12px; font-size: 14px; }
  #sound, body.playing #sound { left: calc(160px + env(safe-area-inset-left, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  #phone-button { left: calc(160px + env(safe-area-inset-left, 0px)); bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  #phone { top: calc(8px + env(safe-area-inset-top, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); right: auto; width: min(400px, 60vw); }
}

/* celular com apps (phone.js): the strip peeking out at the bottom left while it is closed, the phone with its status
   bar (clock, balance, sound, share, ×), the home screen of apps (Corre, Loja, Banco, Notificações) and each app; the
   big balance of the driving HUD (drive-hud.js › wallet). The old round phone button (#phone-button) is gone: the
   rules for it above are dead, these come after and win. App colors in --app (.app-<id>). */
.app-corre { --app: #ff6a1a; }
.app-loja { --app: #e94fa0; }
.app-banco { --app: #1f9d57; }
.app-notas { --app: #3d8fe0; }

/* the balance, big: on a desktop at the top right under the clock; on touch in the corner's column */
#wallet { position: relative; gap: 8px; padding: 5px 16px 5px 6px; border-width: 3px; box-shadow: 0 5px 0 var(--ink); background: #fffbea; }
#wallet .icon { width: 32px; height: 32px; }
#wallet strong { font-size: 27px; line-height: 1; letter-spacing: -0.02em; }
#wallet .stars { font-size: 14px; font-weight: 900; color: #b37a00; padding: 1px 7px; border-radius: 999px; background: #ffe8a3; border: 2px solid var(--ink); }
#wallet.gain { animation: wallet-gain 0.5s ease-out; }
#wallet.loss { animation: wallet-loss 0.45s ease-out; }
#wallet .deltas { position: absolute; right: 14px; top: -4px; width: 0; height: 0; pointer-events: none; }
#wallet .delta { position: absolute; right: 0; bottom: 0; font: 900 24px/1 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; white-space: nowrap; color: #3fd27a; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); animation: delta-up 1.5s ease-out forwards; }
#wallet .delta.down { color: #ff5f52; }
@keyframes delta-up { 0% { opacity: 0; transform: translateY(8px) scale(0.7); } 14% { opacity: 1; transform: translateY(-4px) scale(1.15); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-44px) scale(1); } }
@keyframes wallet-gain { 30% { transform: scale(1.08); background: #d8f8e2; } }
@keyframes wallet-loss { 30% { transform: translateX(-3px); background: #ffe0dc; } 60% { transform: translateX(3px); } }
@media not all and (pointer: coarse) {
  #wallet { position: fixed; top: calc(58px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); }
}

/* the strip: the top of the phone peeking out at the bottom left (a desktop: from the bottom edge) */
#phone-strip[hidden], #phone-strip .strip-badge[hidden] { display: none; }
#phone-strip { position: fixed; z-index: 4; left: calc(16px + env(safe-area-inset-left, 0px)); bottom: 0; width: 300px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px)); border: 0; border-radius: 28px 28px 0 0; background: var(--ink); color: var(--ink); font: inherit; text-align: left; cursor: pointer; touch-action: none; box-shadow: 0 -3px 0 rgba(255, 255, 255, 0.35); transition: transform 0.15s; }
#phone-strip:hover { transform: translateY(-4px); }
#phone-strip:focus-visible { outline: 3px solid #2e7cb8; outline-offset: 2px; }
#phone-strip .strip-top { position: relative; display: flex; justify-content: center; align-items: center; height: 12px; }
#phone-strip .strip-notch { width: 62px; height: 8px; border-radius: 4px; background: #3d4656; }
#phone-strip .strip-up { position: absolute; left: 50%; top: -24px; transform: translateX(-50%); width: 40px; height: 20px; display: grid; place-items: center; border-radius: 12px 12px 0 0; background: var(--ink); }
#phone-strip .strip-up svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; animation: strip-bob 1.6s ease-in-out infinite; }
#phone-strip .strip-badge { position: absolute; right: 4px; top: -3px; min-width: 22px; height: 22px; padding: 0 5px; display: grid; place-items: center; border-radius: 11px; border: 2px solid var(--ink); background: #f05a4f; color: #fff; font-size: 12px; font-weight: 900; box-shadow: 0 0 0 2px #fff; }
#phone-strip .strip-notes { display: flex; flex-direction: column; gap: 5px; padding: 7px 8px; border-radius: 18px 18px 6px 6px; background: #f6f8fb; }
#phone-strip .strip-note { display: grid; grid-template-columns: 22px auto minmax(0, 1fr) auto; align-items: center; gap: 6px; font-size: 12px; line-height: 1.2; }
#phone-strip .strip-note b { font-weight: 900; white-space: nowrap; }
#phone-strip .strip-note > span:not(.note-icon) { color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#phone-strip .strip-note i { font-style: normal; font-size: 10px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
#phone-strip .strip-note.unread b { color: #d2490a; }
#phone-strip .strip-note.empty { display: block; text-align: center; color: var(--muted); font-weight: 800; padding: 2px 0; }
#phone-strip .note-icon { width: 22px; height: 22px; border-radius: 7px; border-width: 2px; }
#phone-strip .note-icon svg { width: 14px; height: 14px; }
#phone-strip.ping { animation: strip-ping 0.45s ease-in-out 3; }
#phone-strip.ping .strip-notes { animation: strip-flash 0.45s ease-in-out 3; }
@keyframes strip-ping { 50% { transform: translateY(-7px); background: #ff8c26; } }
@keyframes strip-flash { 50% { background: #fff3c4; } }
@keyframes strip-bob { 50% { transform: translateY(-2px); } }

/* the phone open: a bezel, the display (status bar, the screen that scrolls, the home pill) */
#phone { z-index: 7; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); width: 340px; height: min(660px, calc(100vh - 20px)); max-height: none; flex-direction: column; padding: 8px; border-radius: 36px; box-shadow: 0 6px 0 rgba(30, 36, 48, 0.45), inset 0 0 0 2px #3d4656; animation: phone-up 0.2s ease-out; }
@supports (height: 100dvh) { #phone { height: min(660px, calc(100dvh - 20px)); max-height: none; } }
#phone:focus { outline: none; }
@keyframes phone-up { from { transform: translateY(50px); opacity: 0; } }
#phone .display { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 28px; overflow: hidden; background: #f6f8fb; }
#phone .status-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 7px 8px 7px 16px; background: #fff; border-bottom: 2px solid var(--line); cursor: grab; touch-action: none; }
#phone .status-time { min-width: 44px; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
#phone .notch { flex: 1; display: flex; justify-content: center; }
#phone .notch::before { content: ''; width: 64px; height: 20px; border-radius: 10px; background: var(--ink); }
#phone .status-money { display: flex; align-items: center; gap: 3px; padding: 1px 9px 1px 2px; border: 2px solid var(--ink); border-radius: 999px; background: var(--accent); font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
#phone .status-money .coin { width: 20px; height: 20px; }
#phone .status-money .coin svg { width: 100%; height: 100%; fill: #fff3b0; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
#phone .status-money.debt { background: #ffd2cd; color: #d43a2f; }
#phone .status-tools { display: flex; align-items: center; gap: 5px; }
#phone .status-tools #sound, #phone .status-tools #share { position: static; width: 30px; height: 30px; min-height: 0; padding: 5px; border: 2px solid var(--ink); border-radius: 50%; background: #fff; color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
#phone .status-tools #share { display: block; }
body.down #phone .status-tools #share { display: none; }
#phone .status-tools #sound:hover, #phone .status-tools #share:hover { background: var(--accent); }
#phone button.close { width: 30px; height: 30px; font-size: 18px; }
#phone .screen { border-radius: 0; background: transparent; padding: 12px 12px 10px; }
#phone .home-bar { flex: none; display: flex; justify-content: center; padding: 2px 0 4px; }
#phone button.home-pill { position: relative; width: 140px; height: 20px; padding: 0; border: 0; background: none; box-shadow: none; cursor: pointer; }
#phone button.home-pill::before { content: ''; position: absolute; left: 15px; right: 15px; top: 8px; height: 5px; border-radius: 3px; background: var(--ink); }

/* the home screen: a sky wallpaper, the clock widget, big app icons */
#phone .screen[data-screen="home"] { background: linear-gradient(175deg, #6bd1f7 0%, #9fe2fb 48%, #ffeaa6 100%); }
#phone .home { min-height: 100%; display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
#phone .widget { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 10px 10px; border: 2.5px solid var(--ink); border-radius: 22px; background: rgba(255, 255, 255, 0.82); box-shadow: 0 4px 0 var(--ink); }
#phone .w-time { font-size: 46px; font-weight: 900; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
#phone .w-where { font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; }
#phone .home .phone-hint { margin-top: auto; }
#phone .apps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 8px; padding: 2px 6px; }
#phone button.app { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; border: 0; background: none; box-shadow: none; white-space: normal; font-size: 13px; }
#phone button.app:hover:not(:disabled) { filter: none; }
#phone button.app:hover .app-icon { transform: translateY(-2px); }
#phone button.app:active:not(:disabled) { transform: none; }
#phone button.app:active .app-icon { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
#phone .app-icon { width: 78px; height: 78px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 24px; background: var(--app); box-shadow: 0 5px 0 var(--ink), inset 0 -7px 0 rgba(0, 0, 0, 0.12); transition: transform 0.1s; }
#phone .app-icon svg, #phone .app-mark svg, #phone .note-icon svg { width: 44px; height: 44px; fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 0 rgba(30, 36, 48, 0.55)); }
#phone .app-name { font-weight: 900; color: var(--ink); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9); }
#phone .app .badge, #phone .note-icon + .badge { position: absolute; top: -6px; left: calc(50% + 24px); min-width: 26px; height: 26px; padding: 0 6px; display: grid; place-items: center; border: 2.5px solid var(--ink); border-radius: 13px; background: #f05a4f; color: #fff; font-size: 13px; font-weight: 900; }

/* an app's bar: voltar, the app's mark and name; the Corre app's tabs */
#phone .app-bar { position: sticky; top: -12px; z-index: 1; display: flex; align-items: center; gap: 9px; margin: -12px -12px 0; padding: 9px 12px; background: #fff; border-bottom: 2.5px solid var(--ink); }
#phone button.back { flex: none; width: 34px; height: 34px; padding: 3px; display: grid; place-items: center; border-radius: 50%; background: #fff; }
#phone button.back svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
#phone .app-mark { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--app); }
#phone .app-mark svg { width: 22px; height: 22px; filter: none; }
#phone .app-title { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
#phone .app-title h2 { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: -0.02em; color: var(--app); }
#phone .app-title span { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
#phone .tabs { display: flex; gap: 5px; padding: 4px; border-radius: 13px; background: rgba(30, 36, 48, 0.08); }
#phone button.tab { flex: 1; border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
#phone button.tab[aria-selected="true"] { border-color: var(--ink); background: #fff; color: var(--ink); box-shadow: 0 2px 0 var(--ink); }

/* Corre › perfil: the reputation */
#phone .rep { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 2.5px solid var(--ink); border-radius: 18px; background: #fff4e6; box-shadow: 0 4px 0 var(--ink); text-align: center; }
#phone .rep-stars { display: flex; flex-direction: column; align-items: center; }
#phone .rep-stars strong { font-size: 44px; font-weight: 900; line-height: 1; letter-spacing: -0.02em; }
#phone .rep-stars .stars { font-size: 24px; letter-spacing: 2px; color: #e0a000; -webkit-text-stroke: 1px var(--ink); }
#phone .rep-sub { margin: 0; font-size: 11px; font-weight: 700; color: var(--muted); }
#phone .rep-grid { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#phone .rep-grid div { padding: 6px 8px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; text-align: left; }
#phone .rep-grid dt { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
#phone .rep-grid dd { margin: 0; font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Loja */
#phone .row.item { justify-content: flex-start; }
#phone .item-icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 12px; background: #ff8c26; }
#phone .item-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* Loja › veículos: the one in use stands out; what it costs and how many deliveries are left */
#phone .row.vehicle.using { background: #e9f8ef; }
#phone .row.vehicle .item-icon { background: #8fd3ff; }
#phone .row.vehicle .buy { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
#phone .row.vehicle .left { font-size: 10px; font-weight: 800; color: var(--muted); white-space: nowrap; }
#phone .row.goal { background: #fff4e6; }
#phone .soon { margin: 0; padding: 12px; border: 2px dashed rgba(30, 36, 48, 0.3); border-radius: 14px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }

/* Banco: the balance, the day, the statement */
#phone .balance { display: flex; flex-direction: column; gap: 3px; padding: 11px 14px 12px; border: 3px solid var(--ink); border-radius: 20px; background: var(--accent); box-shadow: 0 5px 0 var(--ink); }
#phone .balance.debt { background: #ffd2cd; }
#phone .balance-label { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; }
#phone .balance-value { margin: 0; display: flex; align-items: center; gap: 7px; }
#phone .balance-value .coin { width: 36px; height: 36px; }
#phone .balance-value .coin svg { width: 100%; height: 100%; fill: #fff3b0; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
#phone .balance-value strong { font-size: 46px; font-weight: 900; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
#phone .balance.debt .balance-value strong { color: #c8352a; }
#phone .balance-value span { align-self: flex-end; padding-bottom: 6px; font-size: 13px; font-weight: 800; }
#phone .balance-note { margin: 0; font-size: 11px; font-weight: 800; }
#phone .day { margin-top: 5px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#phone .day div { display: flex; flex-direction: column; padding: 4px 9px; border: 2px solid var(--ink); border-radius: 12px; background: rgba(255, 255, 255, 0.85); }
#phone .day span { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
#phone .day b { font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
#phone .day .in b { color: #1f8a4a; }
#phone .day .out b { color: #d43a2f; }
#phone .statement { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
#phone .statement-day { padding: 5px 2px 0; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
#phone .entry { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 9px 6px 7px; border: 2px solid var(--ink); border-radius: 13px; background: #fff; }
#phone .entry-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: #d4f5df; }
#phone .entry.minus .entry-icon { background: #ffdeda; }
#phone .entry.kind-start .entry-icon, #phone .entry.kind-carry .entry-icon, #phone .entry.kind-tip .entry-icon { background: #ffe79a; }
#phone .entry-icon svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#phone .entry-what { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
#phone .entry-what strong { font-size: 13px; font-weight: 900; }
#phone .entry-what span { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#phone .entry-what span:empty { display: none; }
#phone .entry-what .entry-when { font-size: 10px; color: #8a96a6; }
#phone .entry-money { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
#phone .entry-money b { font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; color: #1f8a4a; }
#phone .entry.minus .entry-money b { color: #d43a2f; }
#phone .entry.kind-start .entry-money b, #phone .entry.kind-carry .entry-money b { color: var(--ink); }
#phone .entry-money span { font-size: 10px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Notificações (and the strip's icons) */
#phone .notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#phone button.note { width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 7px 10px 7px 7px; border-radius: 14px; background: #fff; text-align: left; white-space: normal; font-weight: 700; }
#phone button.note.unread { background: #fff6d6; box-shadow: 0 2px 0 var(--ink), inset 4px 0 0 #ff8c26; }
.note-icon { display: grid; place-items: center; border: 2px solid var(--ink); background: var(--app, #8a96a6); }
#phone .note-icon { width: 34px; height: 34px; border-radius: 11px; }
#phone .note-icon svg { width: 20px; height: 20px; filter: none; }
#phone-strip .note-icon svg { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#phone .note-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
#phone .note-text strong { font-size: 13px; font-weight: 900; }
#phone .note-text span { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
#phone .note time { align-self: start; font-size: 10px; font-weight: 800; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* touch: fingers (every button ≥ 40 px), the phone above the joystick, the strip over it in portrait */
@media (pointer: coarse) {
  #wallet { padding: 3px 12px 3px 5px; }
  #wallet .icon { width: 26px; height: 26px; }
  #wallet strong { font-size: 22px; }
  #wallet .stars { font-size: 12px; }
  #wallet .delta { font-size: 20px; }
  #phone { left: calc(10px + env(safe-area-inset-left, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); width: auto; height: auto; top: calc(56px + env(safe-area-inset-top, 0px)); bottom: calc(176px + env(safe-area-inset-bottom, 0px)); }
  #phone .status-bar { padding: 5px 6px 5px 14px; }
  #phone .notch::before { width: 48px; }
  #phone .status-tools #sound, #phone .status-tools #share, #phone button.close, #phone button.back { width: 40px; height: 40px; min-height: 40px; padding: 8px; }
  #phone button.home-pill { height: 40px; min-height: 40px; }
  #phone button.home-pill::before { top: 18px; }
  #phone .app-bar { padding: 6px 12px; }
  #phone-strip { left: calc(10px + env(safe-area-inset-left, 0px)); bottom: calc(172px + env(safe-area-inset-bottom, 0px)); width: min(196px, calc(100vw - 170px)); padding: 5px 6px 7px; border-radius: 22px; box-shadow: 0 4px 0 rgba(30, 36, 48, 0.4); }
  #phone-strip:hover { transform: none; }
  #phone-strip .strip-notes { border-radius: 16px; padding: 6px 7px; }
  #phone-strip .strip-note { grid-template-columns: 22px minmax(0, 1fr) auto; font-size: 11px; }
  #phone-strip .strip-note > span:not(.note-icon) { display: none; }
  #phone-strip .strip-note b { overflow: hidden; text-overflow: ellipsis; }
}
/* landscape (a phone on its side): the strip smaller, one notification, beside the joystick from the bottom edge */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #wallet { padding: 2px 10px 2px 4px; }
  #wallet .icon { width: 22px; height: 22px; }
  #wallet strong { font-size: 18px; }
  #phone { top: calc(8px + env(safe-area-inset-top, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); right: auto; width: min(400px, 60vw); height: auto; }
  #phone-strip { left: calc(150px + env(safe-area-inset-left, 0px)); bottom: 0; width: min(220px, calc(100vw - 480px)); padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)); border-radius: 18px 18px 0 0; }
  #phone-strip .strip-notes { padding: 4px 7px; border-radius: 12px 12px 4px 4px; }
  #phone-strip .strip-note:nth-child(n + 2) { display: none; }
  #phone-strip .strip-up { top: -20px; height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  #phone, #phone-strip.ping, #phone-strip.ping .strip-notes, #phone-strip .strip-up svg, #wallet.gain, #wallet.loss { animation: none; }
  #wallet .delta { animation: delta-fade 1.5s linear forwards; }
  @keyframes delta-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
}

/* navegação: marcadores dos lugares (markers.js), minimapa (minimap.js), alertas (alerts.js), mapa grande (control.js ›
   overview). O minimapa fica no canto inferior direito no computador (o painel do velocímetro anda para a esquerda);
   no celular esse canto é dos botões de toque: em pé fica no alto à esquerda (o relógio desce para baixo dele e o
   painel da direita desce junto, abrindo uma faixa no alto para os alertas, um por vez); deitado, embaixo, ao lado dos
   botões redondos. Os alertas ficam no alto, no centro. */
#minimap[hidden], #alerts[hidden], #map-back[hidden], .poi[hidden] { display: none; }
#minimap { position: fixed; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 150px; height: 150px; padding: 0; border-radius: 50%; border: 3px solid var(--ink); background: #bfe8c4; box-shadow: 0 5px 0 var(--ink); overflow: hidden; cursor: pointer; touch-action: manipulation; }
#minimap canvas { display: block; width: 100%; height: 100%; border-radius: 50%; }
#minimap:hover { box-shadow: 0 5px 0 var(--ink), 0 0 0 3px var(--accent); }
#minimap:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media not all and (pointer: coarse) { #drive-corner { right: calc(182px + env(safe-area-inset-right, 0px)); } }
@media (pointer: coarse) {
  #minimap { right: auto; left: calc(10px + env(safe-area-inset-left, 0px)); bottom: calc(330px + env(safe-area-inset-bottom, 0px)); width: 120px; height: 120px; }
}
@media (pointer: coarse) and (orientation: portrait) {
  #minimap { bottom: auto; top: calc(62px + env(safe-area-inset-top, 0px)); width: 112px; height: 112px; }
  body.playing #clock { top: calc(184px + env(safe-area-inset-top, 0px)); }
  #drive-corner { top: calc(62px + env(safe-area-inset-top, 0px)); }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #minimap { left: calc(160px + env(safe-area-inset-left, 0px)); bottom: calc(78px + env(safe-area-inset-bottom, 0px)); /* acima da faixa do celular (phone.js), que ocupa o rodapé ao lado do joystick */ width: 96px; height: 96px; border-width: 2.5px; box-shadow: 0 3px 0 var(--ink); }
}

#poi-layer { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
body.phone-open #poi-layer, body.down #poi-layer { display: none; }
.poi { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; will-change: transform; color: var(--ink); }
.poi-pin { position: absolute; left: -17px; top: -46px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 2.5px solid var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); }
.poi-pin::after { content: ''; position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); border: 5px solid transparent; border-top: 7px solid var(--ink); }
.poi-pin svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.poi-dist { position: absolute; left: 0; top: -7px; transform: translateX(-50%); white-space: nowrap; font: 900 12px/1 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #fff; background: var(--ink); border-radius: 8px; padding: 3px 6px; font-variant-numeric: tabular-nums; }
.poi[data-kind="fuel"] { color: #ef4f45; } .poi[data-kind="fuel"] .poi-pin { background: #ef4f45; }
.poi[data-kind="repair"] { color: #2f7fe0; } .poi[data-kind="repair"] .poi-pin { background: #2f7fe0; }
.poi[data-kind="hospital"] { color: #ef4f45; } .poi[data-kind="hospital"] .poi-pin svg { fill: #ef4f45; stroke: #ef4f45; stroke-width: 1; }
.poi[data-kind="pickup"] { color: #ff8c26; } .poi[data-kind="pickup"] .poi-pin { background: #ff8c26; }
.poi[data-kind="dropoff"] { color: #ff6bb8; } .poi[data-kind="dropoff"] .poi-pin { background: #ff6bb8; }
.poi[data-kind="player"] .poi-pin { background: var(--accent); } .poi[data-kind="player"] .poi-pin svg { fill: var(--ink); stroke: var(--ink); }
.poi.focus .poi-pin::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid currentColor; animation: poi-pulse 1.3s ease-out infinite; }
.poi.focus .poi-dist { font-size: 13px; padding: 4px 7px; }
.poi.near { opacity: 0.55; }
.poi-arrow { display: none; }
.poi.edge .poi-pin { top: -17px; }
.poi.edge .poi-pin::after { display: none; }
.poi.edge .poi-dist { top: 23px; }
.poi.edge .poi-arrow { display: block; position: absolute; left: 0; top: 0; width: 0; height: 0; }
.poi.edge .poi-arrow::after { content: ''; position: absolute; left: 21px; top: -8px; border: 8px solid transparent; border-left: 11px solid var(--ink); }
@keyframes poi-pulse { from { transform: scale(0.85); opacity: 0.9; } to { transform: scale(1.35); opacity: 0; } }

#alerts { position: fixed; z-index: 8; left: 50%; top: calc(62px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); width: max-content; max-width: min(460px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.alert { display: flex; align-items: center; gap: 8px; padding: 5px 9px 5px 5px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 3px 0 var(--ink); font-size: 14px; font-weight: 800; line-height: 1.2; animation: alert-in 0.35s ease-out; }
.alert-icon { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 9px; background: #eef2f6; }
.alert-icon svg { width: 19px; height: 19px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.alert-dist[hidden] { display: none; }
.alert-dist { flex: none; display: flex; align-items: center; gap: 5px; padding-left: 8px; border-left: 2px solid rgba(30, 36, 48, 0.18); white-space: nowrap; font-weight: 900; font-variant-numeric: tabular-nums; }
.alert-dist .arrow { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); }
.alert-dist .arrow svg { width: 13px; height: 13px; fill: #fff; }
.alert[data-level="warn"] { background: #ffd23f; animation: alert-in 0.35s ease-out, alert-nudge 10s ease-in-out 0.35s infinite; }
.alert[data-level="warn"] .alert-icon { background: #fff3c4; }
.alert[data-level="urgent"] { background: #f05a4f; color: #fff; animation: alert-in 0.35s ease-out, alert-urgent 1.2s ease-in-out 0.35s infinite; }
.alert[data-level="urgent"] .alert-icon { background: #fff; }
.alert[data-level="urgent"] .alert-dist { border-color: rgba(255, 255, 255, 0.45); }
.alert[data-level="urgent"] .alert-dist .arrow { background: #fff; }
.alert[data-level="urgent"] .alert-dist .arrow svg { fill: #f05a4f; }
#alert-edge { position: fixed; inset: 0; z-index: 5; pointer-events: none; opacity: 0; box-shadow: inset 0 0 90px 22px rgba(240, 50, 40, 0.85); }
#alert-edge.on { animation: alert-edge 1.4s ease-in-out infinite; }
body.down #alert-edge, body:not(.playing) #alert-edge, body:not(.playing) #alerts { display: none; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-10px) scale(0.96); } }
@keyframes alert-nudge { 0%, 7%, 100% { transform: none; } 2.5% { transform: scale(1.08); } 5% { transform: scale(0.97); } }
@keyframes alert-urgent { 50% { transform: scale(1.04); } }
@keyframes alert-edge { 0%, 100% { opacity: 0.12; } 50% { opacity: 0.7; } }
@media (prefers-reduced-motion: reduce) {
  .alert, .alert[data-level], #alert-edge.on, .poi.focus .poi-pin::before { animation: none; }
  #alert-edge.on { opacity: 0.45; }
}
@media (pointer: coarse) and (orientation: portrait) {
  #alerts { left: calc(10px + env(safe-area-inset-left, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); transform: none; top: calc(6px + env(safe-area-inset-top, 0px)); width: auto; max-width: none; align-items: stretch; }
  .alert { font-size: 12.5px; padding: 4px 7px 4px 4px; gap: 6px; }
  .alert-text { flex: 1; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } /* at most 2 lines: a 3rd would touch the minimap and the speedometer at 62px (a long restaurant name on a 360 px screen) */
  .alert-icon { width: 26px; height: 26px; }
  .alert-dist { padding-left: 6px; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #alerts { top: calc(8px + env(safe-area-inset-top, 0px)); max-width: 250px; }
  .alert { font-size: 12px; padding: 3px 7px 3px 3px; gap: 6px; }
  .alert-icon { width: 24px; height: 24px; }
}

#map-back { position: fixed; z-index: 9; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 12px 20px; border: 3px solid var(--ink); border-radius: 16px; background: var(--accent); color: var(--ink); box-shadow: 0 5px 0 var(--ink); font: 900 17px/1 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer; touch-action: manipulation; }
#map-back:active { box-shadow: 0 2px 0 var(--ink); }
#map-back kbd { font: 900 13px/1 ui-monospace, monospace; padding: 4px 7px; border: 2px solid var(--ink); border-radius: 7px; background: #fff; box-shadow: 0 2px 0 var(--ink); }
/* the big map: only the map, the alerts and the way back */
body.overview #pad, body.overview #minimap, body.overview #act-prompt, body.overview #drive-corner, body.overview #clock, body.overview #sound, body.overview #phone-button, body.overview #share { display: none; }

/* balões: as falas dos NPCs (speech.js), um canvas 2D só, sobre o mapa e abaixo do HUD (ordem do DOM, sem z-index) */
#speech { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
