/* Kartkjøring styles (moved out of kartkjoring-vNN.html in v133). Loaded with <link> from the version file. */
:root {
  --bg: #0b0e13;
  --panel: rgba(13, 17, 24, 0.88);
  --line: rgba(255, 255, 255, 0.12);
  --text: #e8ecf2;
  --dim: #8b95a5;
  --accent: #ffd23f; /* rally yellow */
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: var(--bg); font-family: system-ui, sans-serif; color: var(--text); }
#app { position: fixed; inset: 0; }
canvas { display: block; }

/* ---------- Start screen ---------- */
#start {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #16202e 0%, #0b0e13 70%);
}
#start .card {
  width: min(420px, 92vw);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px 26px;
  backdrop-filter: blur(6px);
  max-height: 92vh; overflow-y: auto;
}
#start h1 {
  font-size: 26px; letter-spacing: 0.5px; margin-bottom: 4px;
  font-weight: 800;
}
#start h1 em { color: var(--accent); font-style: normal; }
#start p.sub { color: var(--dim); font-size: 13px; margin-bottom: 20px; line-height: 1.5; }
#start p.vifDay { color: #fff; background: linear-gradient(90deg, #1f49c9, #1f49c9 70%, #d62828); border-radius: 8px; padding: 8px 12px; margin-top: -10px; } /* v99 */
#start p.vifDay[hidden] { display: none; }
#start label { display: block; font-size: 12px; color: var(--dim); margin: 14px 0 6px; letter-spacing: 0.4px; text-transform: uppercase; }
#start input, #start select {
  width: 100%; padding: 11px 12px; font-size: 14px;
  background: #0f1420; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; outline: none;
}
#start input[type="color"] { padding: 4px; height: 46px; cursor: pointer; }
#carNameBox[hidden] { display: none; }
#start .paintRow { display: flex; gap: 6px; align-items: stretch; }
#start .paintRow input[type="color"] { flex: 1 1 auto; min-width: 56px; width: auto; }
#start .installHint { margin-top: 12px; font-size: 13px; line-height: 1.45; color: var(--dim); text-align: center; }
#start .installHint[hidden], #start button.installBtn[hidden] { display: none; }
#start button.installBtn { margin-top: 10px; background: transparent; color: var(--accent); border: 1px solid var(--accent); }
#start .paintBtn { /* v70: not the big yellow start button (#start button) */
  flex: 0 0 46px; width: 46px; height: 46px; margin: 0; padding: 0;
  border-radius: 8px; border: 2px solid var(--line); background: #0f1420; color: var(--text);
  font-size: 21px; line-height: 1; cursor: pointer; opacity: 0.75;
}
#start .paintBtn.on { border-color: var(--accent); background: #2a2410; opacity: 1; }
#start input:focus, #start select:focus { border-color: var(--accent); }
#start label.check {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 0; text-transform: none; letter-spacing: 0; font-size: 12px;
  cursor: pointer;
}
#start label.check input { width: auto; accent-color: var(--accent); }
#start .row { display: flex; gap: 12px; }
#start .row > div { flex: 1; }
#start button {
  width: 100%; margin-top: 22px; padding: 13px;
  font-size: 15px; font-weight: 700; letter-spacing: 0.3px;
  background: var(--accent); color: #141000;
  border: none; border-radius: 8px; cursor: pointer;
}
#start button:active { transform: translateY(1px); }
/* v98: NO/EN switch in the corner of the start card */
#start .card { position: relative; }
#start button.langBtn { position: absolute; top: 14px; right: 16px; width: auto; margin: 0; padding: 5px 11px; font-size: 13px; font-weight: 600; background: transparent; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; }
#start button.langBtn:hover { color: #fff; border-color: var(--accent); }
/* v96: the start place picker: search and folding categories over the (hidden) select */
#start #place { display: none; }
#start #placeCurrent { margin-top: 0; padding: 11px 12px; font-size: 14px; font-weight: 600; text-align: left; background: #0f1420; color: var(--text); border: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#start #placeCurrent span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#placePanel { margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; background: #0f1420; max-height: min(56vh, 480px); overflow: auto; padding: 6px; }
#placePanel[hidden] { display: none; }
#start #placeSearch { position: sticky; top: 0; z-index: 1; margin-bottom: 4px; }
#placePanel details { border-bottom: 1px solid var(--line); }
#placePanel details:last-child { border-bottom: none; }
#placePanel summary { cursor: pointer; padding: 9px 6px; font-weight: 700; font-size: 14px; list-style: none; display: flex; justify-content: space-between; }
#placePanel summary::-webkit-details-marker { display: none; }
#placePanel summary::after { content: '▸'; color: var(--dim); margin-left: 8px; }
#placePanel details[open] summary::after { content: '▾'; }
#placePanel summary .n { color: var(--dim); font-weight: 400; margin-left: auto; }
#start .pp-item { display: block; width: 100%; margin: 0; padding: 8px 10px; text-align: left; background: transparent; color: var(--text); font-weight: 500; font-size: 13.5px; letter-spacing: 0; border-radius: 6px; }
#start .pp-item:hover { background: #1b2433; }
#start .pp-item.on { background: #2a2410; outline: 1px solid var(--accent); }
#placePanel .pp-sub { font-size: 11px; color: var(--dim); text-transform: uppercase; margin: 8px 8px 2px; letter-spacing: 0.4px; }
#placePanel .pp-none { padding: 10px; color: var(--dim); font-size: 13px; }
/* v82: the start button sticks to the bottom of the card, so it is always in view; two columns on wide screens */
#start #startBtn { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -14px 18px rgb(13, 17, 24), 0 30px 0 6px rgb(13, 17, 24); } /* v83: last in the card, so the shadow only covers the bottom padding */
@media (min-width: 820px) {
  #start .card { width: min(900px, 94vw); padding: 26px 30px; }
  #start .cols { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "login place" "extras place"; gap: 0 30px; align-items: start; }
  #start .cols > .col:nth-child(1) { grid-area: login; } #start .cols > .col:nth-child(2) { grid-area: place; } #start .cols > .extras { grid-area: extras; }
  #start .col > label:first-child, #start .col > #placeRow > label:first-child { margin-top: 0; }
}
#start .hint { margin-top: 14px; font-size: 12px; color: var(--dim); line-height: 1.5; }
#start a { color: var(--accent); }
#start details.guide {
  margin-top: 16px; font-size: 12px; color: var(--dim); line-height: 1.6;
  background: #0f1420; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px;
}
#start details#tokenGuide { margin: 8px 0 4px; }
#start details.guide summary { cursor: pointer; color: var(--text); font-weight: 600; }
#start details.guide ol { margin: 10px 0 6px; padding-left: 20px; }
#start details.guide li { margin-bottom: 6px; }
#start details.guide b { color: var(--text); font-weight: 600; }

/* ---------- HUD ---------- */
#hud {
  position: fixed; left: 16px; bottom: 16px; z-index: 10;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 16px;
  display: none; align-items: baseline; gap: 8px;
  font-variant-numeric: tabular-nums;
}
#speed { font-size: 25px; font-weight: 800; color: var(--accent); min-width: 78px; text-align: right; } /* v121: smaller */
#hud { padding: 6px 11px !important; gap: 6px !important; left: 12px !important; bottom: 12px !important; border-radius: 10px !important; }
#hud .unit { font-size: 11px; color: var(--dim); }
/* v98: compass: which way you are heading */
#hud .compass { display: flex; align-items: center; gap: 5px; align-self: center; margin-left: 4px; padding-left: 9px; border-left: 1px solid var(--line); }
#hud .compass b { font-size: 16px; font-weight: 800; color: #fff; min-width: 34px; text-align: center; }
#hud #compassDeg { font-size: 11px; color: var(--dim); min-width: 30px; }
/* v120: height above sea level, and above the ground in the air */
#hud .alt { display: flex; align-items: baseline; gap: 4px; align-self: center; margin-left: 2px; padding-left: 9px; border-left: 1px solid var(--line); white-space: nowrap; }
#hud .alt b { font-size: 15px; font-weight: 800; color: #fff; }
#hud #altAgl { font-size: 12px; color: #9fe3ff; margin-left: 6px; }
@media (max-width: 520px) { #speed { min-width: 48px; font-size: 22px; } #hud { padding: 5px 9px !important; gap: 4px !important; } #hud #compassDeg { display: none; } #hud .compass, #hud .alt { padding-left: 9px; margin-left: 2px; } #hud .alt { flex-wrap: wrap; max-width: 120px; } #hud .alt b { font-size: 14px; } #hud #altAgl { flex-basis: 100%; margin-left: 0; font-size: 11px; } }
#hud #compassNeedle { display: inline-block; font-size: 11px; color: #ff5a4f; transition: transform 0.15s linear; }

#status {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 10; display: none;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 16px; font-size: 12px; color: var(--dim);
}

#poi {
  position: fixed; top: 52px; left: 50%; transform: translateX(-50%);
  z-index: 10; display: none;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 16px; font-size: 13px; color: var(--text);
}

#raceBanner {
  margin-bottom: 18px; padding: 12px 14px; border-radius: 10px;
  background: #0f1420; border: 1px solid #b1c948;
}
#raceBanner .rb-title { font-size: 17px; font-weight: 800; }
#raceBanner .rb-group { color: var(--dim); font-size: 12px; margin-top: 2px; }
#raceBanner .rb-rules { color: var(--dim); font-size: 12px; line-height: 1.5; margin-top: 8px; }
#raceBanner label { margin-top: 10px; }
.rb-board { margin-top: 10px; }
.rb-board .lb { margin: 0; padding-left: 22px; font-size: 13px; line-height: 1.7; }
.rb-board .lb li { display: flex; gap: 10px; }
.rb-board .lb li::marker { color: #b1c948; font-weight: 700; }
.rb-board .lb li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.rb-board .lb li.me { color: #b1c948; }
.rb-board .lb-empty { font-size: 12px; color: var(--dim); }
#missionCard .rb-board .lb { color: #1f2933; }
#missionCard .rb-board .lb li.me { color: #4069a7; font-weight: 700; }
#missionCard .rb-board .lb-empty { color: #6b7684; }
#missionCard .race-time { font-size: 18px; }
#missionCard .race-time b { font-size: 26px; color: #4069a7; font-variant-numeric: tabular-nums; }
#missionCard .race-submit { display: flex; gap: 8px; margin-top: 10px; }
#missionCard .race-submit input { flex: 1; padding: 9px 12px; border: 1px solid #d5dbe3; border-radius: 8px; font-size: 14px; }
#missionCard .race-submit button { padding: 9px 14px; border-radius: 8px; border: 0; background: #b1c948; color: #1f2933; font-weight: 700; cursor: pointer; }
#raceHud {
  position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 10;
  background: var(--panel); border: 1px solid #b1c948; border-radius: 999px;
  padding: 8px 18px; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums;
}
#raceHud .rh-limit {
  display: inline-block; min-width: 26px; text-align: center; padding: 1px 6px; border-radius: 999px;
  background: #fff; color: #111; font-weight: 800; font-size: 13px; border: 3px solid #d62828;
}
#raceHud .rh-off { color: #ff8a65; font-size: 12px; }
#mission {
  position: fixed; top: 90px; left: 50%; transform: translateX(-50%); z-index: 10;
  background: var(--panel); border: 1px solid #b1c948; border-radius: 999px;
  padding: 7px 16px; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums;
}
#adHint {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 11;
  background: #ffd23f; color: #141000; border: 0; border-radius: 999px;
  padding: 9px 18px; font-size: 14px; font-weight: 700; cursor: pointer;
}
#missionBtn {
  position: fixed; left: 16px; bottom: 84px; z-index: 10;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; cursor: pointer;
}
#missionMenu {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 15;
  width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(6px);
  max-height: calc(100vh - 24px); overflow-y: auto; /* v110: never taller than the screen */
}
#missionMenu .mm-title { font-weight: 700; margin-bottom: 4px; }
#missionMenu .mm-title + .mm-title, #missionMenu button + .mm-title, #missionMenu button + details, #missionMenu details + .mm-title { margin-top: 12px; }
/* v110: the routes are folded away, one line per destination */
#missionMenu details { margin-top: 6px; }
#missionMenu summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
#missionMenu details details { margin: 2px 0 0 10px; }
#missionMenu details details summary { font-weight: 600; font-size: 13px; color: var(--dim); }
#missionMenu .mm-close { position: sticky; bottom: -12px; margin-top: 10px; background: #1b2232; }
/* ---------- v49: "Vis veien" route guide ---------- */
#guideHud {
  position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 11; width: min(560px, 94vw);
  background: #ffffff; color: #1f2933; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-left: 8px solid #b1c948;
}
#guideHud[hidden] { display: none; }
#guideHud .gh-icon { font-size: 34px; width: 42px; text-align: center; color: #4069a7; flex: none; }
#guideHud .gh-main { flex: 1; min-width: 0; }
#guideHud .gh-in { font-size: 13px; color: #6b7684; }
#guideHud .gh-text { font-size: 17px; font-weight: 700; line-height: 1.25; }
#guideHud .gh-sub { font-size: 12px; color: #6b7684; margin-top: 2px; }
#guideHud .gh-btns { display: flex; flex-direction: column; gap: 4px; flex: none; }
#guideHud button { border: 1px solid #d5dbe3; background: #fff; color: #1f2933; border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
#guideHud button.on { background: #4069a7; color: #fff; border-color: #4069a7; }
/* v72: phones. One slim strip instead of a card over half the screen: the text on one line,
   the buttons in a row, the minimap and the help panel left free */
@media (max-width: 640px), (max-height: 520px) {
  #guideHud { top: 6px; gap: 8px; padding: 5px 8px; border-left-width: 5px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); opacity: 0.94; }
  #guideHud .gh-icon { font-size: 22px; width: 24px; }
  #guideHud .gh-in, #guideHud .gh-sub { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #guideHud .gh-text { font-size: 14px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #guideHud .gh-btns { flex-direction: row; gap: 3px; }
  #guideHud button { padding: 3px 7px; font-size: 11px; }
  #guideHud.mini .gh-in, #guideHud.mini .gh-sub, #guideHud.mini .gh-btns { display: none; }
}
@media (max-height: 520px) { /* landscape phone: between the minimap and the help panel */
  #guideHud { left: 186px; right: 200px; width: auto; transform: none; }
  #guideHud .gh-sub { display: none; }
}
@media (max-width: 640px) and (min-height: 521px) { /* portrait phone: under the minimap */
  #guideHud { top: 182px; left: 8px; right: 8px; width: auto; transform: none; }
  #taskHud { top: 184px; } /* v131 */
}
#missionMenu button {
  display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left;
  background: #0f1420; color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; margin-top: 4px; font-size: 14px; cursor: pointer;
}
#missionMenu button span { margin-left: auto; color: var(--dim); font-size: 12px; }
#missionMenu button b { color: #b1c948; }
#missionMenu .mm-close { justify-content: center; color: var(--dim); }
#missionCard {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 15;
  width: min(440px, 92vw); background: #ffffff; color: #1f2933; border-radius: 14px;
  overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
#missionCard img { display: block; width: 100%; height: 190px; object-fit: cover; }
#missionCard .mc-body { padding: 16px 18px 14px; }
#missionCard .mc-kicker { color: #4069a7; font-weight: 700; font-size: 13px; }
#missionCard h3 { font-size: 20px; margin: 4px 0 6px; }
#missionCard p { font-size: 14px; line-height: 1.5; color: #3c4653; }
#missionCard .mc-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
#missionCard .mc-actions[hidden] { display: none; } /* v84: the quiz's next/continue buttons only after an answer */
#missionCard .mc-actions a, #missionCard .mc-actions button {
  border-radius: 8px; padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid #d5dbe3; background: #fff; color: #1f2933; text-decoration: none;
}
#missionCard .mc-actions a { background: #4069a7; color: #fff; border-color: #4069a7; }
#missionCard[data-kind="cup"] .mc-kicker { color: #c4520f; }
#missionCard[data-kind="cup"] .race-time b { color: #c4520f; }
#missionCard[data-kind="cup"] .mc-actions a { background: #E8681A; border-color: #E8681A; }
#missionCard[data-kind="cup"] .mc-foot { border-top-color: #F5A800; }
#missionCard[data-kind="v100"] { background: linear-gradient(180deg, #fffaf0, #fff); }
#missionCard[data-kind="v100"] .mc-kicker { color: #a57a1c; }
#missionCard[data-kind="v100"] .mc-actions button:first-child { background: #d8b04a; border-color: #b8892c; color: #1d2a1f; }
/* v104: delivery jobs */
#missionCard .job-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
#missionCard .job-grid button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid #d5dbe3; background: #f6f8fb; color: #1f2933; cursor: pointer; font: inherit; }
#missionCard .job-grid button:hover { border-color: #4069a7; background: #eef3fa; }
#missionCard .job-grid b { font-size: 15px; }
#missionCard .job-grid span { font-size: 12px; color: #4069a7; font-weight: 600; }
#missionCard .job-grid small { font-size: 11.5px; color: #52606d; line-height: 1.35; }
#missionCard .mc-note { font-size: 12px; color: #52606d; margin: 10px 0 0; }
@media (max-width: 520px) { #missionCard .job-grid { grid-template-columns: 1fr; } }
#jobSms { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 40; width: min(340px, calc(100vw - 32px)); background: rgba(250,250,252,0.97); color: #1f2933; border-radius: 16px; padding: 10px 14px 12px; box-shadow: 0 8px 28px rgba(0,0,0,0.35); font: 13px/1.4 system-ui, sans-serif; pointer-events: none; }
#jobSms[hidden] { display: none; }
#jobSms .sms-top { display: flex; justify-content: space-between; color: #6b7684; font-size: 11px; margin-bottom: 3px; }
#jobBar { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 30; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: calc(100vw - 32px); }
#jobBar[hidden] { display: none; }
#jobBar .jb-want { flex-basis: 100%; text-align: center; background: rgba(0,0,0,0.6); color: #fff; padding: 6px 12px; border-radius: 10px; font: 600 15px system-ui, sans-serif; }
#jobBar button { background: #fff; color: #1f2933; border: 2px solid #ff7eb6; border-radius: 12px; padding: 8px 12px; font: 600 14px system-ui, sans-serif; cursor: pointer; }
#jobBar button b { color: #e0447f; margin-right: 3px; }
#missionCard .v100-list { margin: 6px 0 4px; padding-left: 0; list-style: none; font-size: 13px; line-height: 1.55; columns: 2; column-gap: 14px; color: #3c4653; }
#missionCard .v100-list li { break-inside: avoid; }
#missionCard .v100-list b { color: #a57a1c; display: inline-block; min-width: 34px; }
#missionCard .v100-plaque { margin: 10px auto; padding: 14px; text-align: center; border: 3px double #b8892c; border-radius: 10px; background: #1d2a1f; color: #d8b04a; font: 600 15px Georgia, serif; }
#missionCard .v100-plaque b { font-size: 30px; color: #fff3c4; }
@media (max-width: 520px) { #missionCard .v100-list { columns: 1; } }
#missionCard .mc-foot { margin-top: 12px; font-size: 12px; color: #6b7684; border-top: 3px solid #b1c948; padding-top: 8px; }
/* ---------- driving school (v32) ---------- */
#schoolHud {
  position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 10;
  background: var(--panel); border: 1px solid #4fa3ff; border-radius: 999px;
  padding: 7px 8px 7px 16px; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 10px; white-space: nowrap; max-width: 96vw;
}
#schoolHud .sh-limit {
  display: inline-block; min-width: 30px; text-align: center; padding: 2px 5px; border-radius: 999px;
  background: #fff; color: #111; font-weight: 800; font-size: 13px; border: 3px solid #d62828;
}
#schoolHud .sh-err { color: #ff8a65; font-weight: 700; }
#schoolHud .sh-ok { color: #8fd18f; }
#schoolHud button {
  border: 1px solid var(--line); background: rgba(255,255,255,0.08); color: var(--text);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
#schoolWarn {
  position: fixed; top: 130px; left: 50%; transform: translateX(-50%); z-index: 11;
  background: #d62828; color: #fff; border-radius: 10px; padding: 8px 16px;
  font-size: 15px; font-weight: 700; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
#schoolHud[hidden], #schoolWarn[hidden] { display: none; }
/* ---------- v52: digging panel ---------- */
#digHud { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 11; width: min(560px, 94vw);
  background: var(--panel); border: 1px solid #F5A800; border-radius: 12px; padding: 8px 10px; font-size: 13px; color: var(--text); }
#digHud[hidden] { display: none; }
#digHud .dg-row { display: flex; gap: 6px; flex-wrap: wrap; }
#digHud button { border: 1px solid var(--line); background: rgba(255,255,255,0.08); color: var(--text); border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
#digHud button[hidden] { display: none; }
#digHud .dg-tasks { margin-top: 6px; }
#digHud .dg-help { margin-top: 3px; color: var(--dim); font-size: 12px; }
#digHud .dg-levers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
#digHud .dg-levers[hidden] { display: none; }
#digHud .dg-levers button { padding: 12px 4px; border-radius: 10px; font-size: 14px; touch-action: none; }
#schoolHud .sh-blink { opacity: 0.25; font-size: 15px; cursor: pointer; }
#schoolHud .sh-blink.on { opacity: 1; color: #ffb000; animation: shBlink 0.6s steps(1) infinite; }
@keyframes shBlink { 50% { opacity: 0.2; } }
#missionCard .qz-sign { width: 110px; margin: 6px auto 2px; padding: 12px; background: #8f9aa8; border-radius: 12px; box-sizing: content-box; }
#missionCard .qz-sign svg { width: 100%; height: auto; display: block; }
#missionCard .qz-opt { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; margin-top: 6px; padding: 9px 12px; border: 1px solid #d5dbe3; border-radius: 8px; background: #fff; color: #1f2933; font-size: 14px; cursor: pointer; }
#missionCard .qz-opt span { min-width: 20px; height: 20px; border-radius: 999px; background: #edf0f4; font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; flex: none; }
#missionCard .qz-opt:hover:not(:disabled) { border-color: #4069a7; }
#missionCard .qz-opt.right { background: #e3f6e6; border-color: #1f9d3a; }
#missionCard .qz-opt.wrong { background: #fde6e6; border-color: #d62828; }
#missionCard .qz-why { margin-top: 10px; }
/* ---------- police chase (v34) ---------- */
#chaseHud {
  position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 10;
  background: var(--panel); border: 1px solid #3b82f6; border-radius: 999px;
  padding: 7px 16px; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 10px; white-space: nowrap; max-width: 96vw;
}
#chaseHud[hidden] { display: none; }
#taskHud { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; flex-direction: column; gap: 4px; align-items: center; pointer-events: none; }
#taskHud[hidden] { display: none; }
#ferryTip { position: fixed; z-index: 30; pointer-events: none; max-width: 290px; background: var(--panel); border: 1px solid #6ec8ff;
  border-radius: 10px; padding: 8px 12px; font-size: 13px; line-height: 1.45; color: var(--text); box-shadow: 0 6px 20px rgba(0,0,0,0.35); }
#ferryTip[hidden] { display: none; }
#ferryTip b { color: #6ec8ff; }
#ferryTip .ft-dim { color: var(--dim); font-size: 11px; }
#taskHud .th-row { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px 7px 3px 11px; font-size: 12.5px; white-space: nowrap; display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 40px); overflow: hidden; text-overflow: ellipsis; } /* v118: smaller */
#taskHud .th-more { padding: 1px 3px; } #taskHud .th-more .th-x, #taskHud .th-more-b { width: auto; padding: 0 9px; font-weight: 700; color: var(--text); flex: none; } /* v121: «＋N» sits at the end of the first row */
#taskHud .th-x { pointer-events: auto; cursor: pointer; border: 0; background: rgba(255,255,255,0.1); color: var(--dim); border-radius: 999px; width: 22px; height: 22px; font-size: 13px; line-height: 22px; text-align: center; padding: 0; }
#taskHud .th-x:hover { background: rgba(255,255,255,0.25); color: var(--text); }
#taskHud .th-row.fire { border-color: #ff7a20; }
#taskHud .th-row.post { border-color: #e32d22; }
#taskHud .th-row b { color: var(--accent); }
#taskHud .th-arrow { display: inline-block; color: var(--accent); font-size: 17px; }
#taskHud .th-bar { width: 70px; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.15); overflow: hidden; }
#taskHud .th-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb000, #ff3b1f); }
#chaseHud .ch-arrow { display: inline-block; font-size: 18px; color: #ff4b4b; transition: transform 0.1s linear; }
#chaseHud .ch-bar { width: 90px; height: 10px; border-radius: 999px; background: rgba(255,255,255,0.15); overflow: hidden; }
#chaseHud .ch-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3b82f6, #ff4b4b); }
#chaseHud .ch-score { color: var(--accent); font-weight: 700; }
#schoolWarn.soft { background: #ffb000; color: #141000; }
#missionCard .ls-verdict { font-size: 22px; font-weight: 800; margin: 2px 0 8px; }
#missionCard .ls-verdict.pass { color: #1f9d3a; }
#missionCard .ls-verdict.fail { color: #d62828; }
#missionCard table.ls { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
#missionCard table.ls td { padding: 4px 0; border-bottom: 1px solid #edf0f4; }
#missionCard table.ls td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
#missionCard table.ls tr.serious td { color: #d62828; }
#missionCard .ls-log { font-size: 12px; color: #6b7684; margin-top: 8px; max-height: 96px; overflow: auto; }
#mapWrap { position: fixed; top: 14px; left: 14px; z-index: 10; display: none; }
#mapWrap.big { z-index: 30; }
#minimap {
  display: block; width: 210px; height: 210px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px;
}
#mapWrap.big #minimap { background: rgba(14, 18, 26, 0.93); }
#mapWrap button {
  position: absolute; width: 30px; height: 30px; padding: 0;
  border-radius: 8px; border: 1px solid var(--line);
  background: rgba(14, 18, 26, 0.85); color: #e8ecf2;
  font: 600 17px/1 system-ui, sans-serif; cursor: pointer;
}
#mapWrap button:hover { border-color: var(--accent, #ffd23f); color: #ffd23f; }
#mapExpand { top: 6px; right: 6px; }
#mapZoomIn { bottom: 40px; left: 6px; }
#mapZoomOut { bottom: 6px; left: 6px; }
#mapWrap.big button { width: 40px; height: 40px; font-size: 22px; }
#mapWrap.big #mapZoomIn { bottom: 52px; }

#credits {
  position: fixed; right: 8px; bottom: 6px; z-index: 10; display: none;
  font-size: 10px; color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  max-width: 60vw; text-align: right;
}
#credits img { height: 14px; vertical-align: middle; }
#credits a { color: rgba(255,255,255,0.75); }

#help {
  position: fixed; top: 14px; right: 14px; z-index: 10; display: none;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; font-size: 12px; color: var(--dim); line-height: 1.7;
}
#help b { color: var(--text); font-weight: 600; }
#help summary { cursor: pointer; color: var(--text); font-weight: 600; list-style: none; display: flex; gap: 14px; align-items: center; justify-content: space-between; }
#help summary::-webkit-details-marker { display: none; }
#help:not([open]) { padding: 4px 10px; line-height: 1.5; } #help summary { font-size: 12px; gap: 10px; } #help summary .sound-btn { font-size: 13px !important; } /* v121: a small button when closed */
#golfMeter { position: fixed; right: 18px; bottom: 120px; z-index: 30; display: none; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; } /* v117 */
#golfMeter .gm-bar { position: relative; width: 26px; height: 180px; border-radius: 13px; background: rgba(10,12,16,.75); border: 2px solid rgba(255,255,255,.7); overflow: hidden; }
#golfMeter .gm-bar i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, #3dd65a, #ffd23f 70%, #ff5a3c); }
#golfMeter .gm-bar b { position: absolute; left: -2px; right: -2px; height: 3px; background: #fff; box-shadow: 0 0 4px #000; }
#golfMeter .gm-club { font: 700 13px system-ui, sans-serif; color: #fff; background: rgba(10,12,16,.75); padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.golf-card { border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; width: 100%; } .golf-card td, .golf-card th { padding: 3px 8px; border-bottom: 1px solid rgba(0,0,0,.1); text-align: center; }
#spiderSense { position: fixed; inset: 0; pointer-events: none; z-index: 25; opacity: 0; box-shadow: inset 0 0 70px 18px var(--c, #3dff6a); }
#spiderSense.on { animation: spsense .8s ease-out; } @keyframes spsense { 0% { opacity: 0 } 15% { opacity: 1 } 35% { opacity: .3 } 50% { opacity: .9 } 100% { opacity: 0 } }
#speedLines { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,0) 0deg 5deg, rgba(255,255,255,.55) 5deg 5.6deg); -webkit-mask: radial-gradient(circle at 50% 50%, transparent 38%, #000 80%); mask: radial-gradient(circle at 50% 50%, transparent 38%, #000 80%); transition: opacity .2s; }
#spiderBar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 150px; z-index: 30; display: none; gap: 6px; }
#spiderBar button { font: 700 14px system-ui, sans-serif; padding: 8px 10px; border-radius: 12px; border: 2px solid rgba(255,255,255,.7); background: rgba(10,12,16,.8); color: #fff; }
.wx-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 5px 0; }
.wx-row > span { width: 52px; font-size: 12px; color: var(--dim); }
.wx-row button { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.wx-row button.on { background: var(--accent); color: #141000; border-color: var(--accent); font-weight: 700; }
.wx-now { font-weight: 400; font-size: 11px; color: var(--dim); margin-left: 6px; }
#help summary .tog::before { content: '▸ '; }
#help[open] summary .tog::before { content: '▾ '; }
#help[open] summary { margin-bottom: 4px; }
#help a.change-place { color: var(--accent); font-weight: 700; text-decoration: none; }
#help a.change-place:hover { text-decoration: underline; }
#help a.sound-btn { text-decoration: none; margin-left: 6px; font-size: 16px; color: inherit; } /* v56 */
#help .veh { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0 8px; }
#help .veh button {
  padding: 7px 4px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.06); color: var(--text); font-size: 12px; line-height: 1.2; cursor: pointer;
}
#help .veh button:active { background: rgba(255, 210, 63, 0.25); }
#help .veh button.on { border-color: var(--accent); color: var(--accent); }
#help .veh-title { color: var(--text); font-weight: 600; }
body.touch #help { font-size: 14px; max-width: min(420px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow-y: auto; }
body.touch #help .keys { display: none; }
#help[open] { width: min(720px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow-y: auto; } /* v86: one screen */
#help .keys { font-size: 11px; line-height: 1.5; columns: 2; column-gap: 22px; } /* v86: smaller, two columns */
#help .keys-fold { margin: 2px 0 6px; } #help .keys-fold summary { cursor: pointer; color: var(--dim); font-size: 12px; margin-bottom: 4px; } /* v84 */
body.touch #help .keys-fold { display: none; }
body.touch #help .keys-fold.wx-fold { display: block; } /* v103: the weather panel on tablets too (v102 hid it) */
body.touch #help .veh button { padding: 12px 4px; font-size: 14px; }
#placeBtn {
  position: fixed; top: 14px; right: 14px; z-index: 10;
  background: var(--panel); color: var(--accent); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ---------- v77: suggestion box ---------- */
#suggestBox { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(5, 8, 12, 0.6); }
#suggestBox[hidden] { display: none; }
#suggestBox .sb-card { width: min(560px, 94vw); max-height: 90vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 10px; color: var(--text); backdrop-filter: blur(8px); }
#suggestBox .sb-head { display: flex; align-items: center; justify-content: space-between; font-size: 18px; font-weight: 800; }
#suggestBox .sb-x { background: none; border: none; color: var(--dim); font-size: 20px; cursor: pointer; width: auto; margin: 0; padding: 4px 8px; }
#suggestBox .sb-intro { font-size: 13px; color: var(--dim); margin: 6px 0 10px; line-height: 1.45; }
#suggestBox input, #suggestBox textarea { width: 100%; box-sizing: border-box; background: #0f1420; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 15px; margin-bottom: 8px; }
#suggestBox textarea { min-height: 70px; resize: vertical; }
#suggestBox .sb-send { width: 100%; padding: 11px; border: none; border-radius: 9px; background: var(--accent); color: #1a1405; font-weight: 800; font-size: 15px; cursor: pointer; }
#suggestBox .sb-send:disabled { opacity: 0.5; cursor: default; }
#suggestBox .sb-msg { font-size: 13px; min-height: 18px; margin: 6px 0 4px; color: var(--accent); }
#suggestBox .sb-list { overflow-y: auto; margin-top: 4px; border-top: 1px solid var(--line); padding-top: 6px; }
#suggestBox .sb-item { padding: 9px 2px; border-bottom: 1px solid var(--line); }
#suggestBox .sb-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--dim); flex-wrap: wrap; }
#suggestBox .sb-text { font-size: 15px; margin-top: 3px; line-height: 1.4; overflow-wrap: anywhere; }
#suggestBox .sb-reply { font-size: 13px; margin-top: 4px; color: #b9e3a6; }
#suggestBox .sb-st { border-radius: 999px; padding: 1px 8px; font-weight: 700; font-size: 11px; color: #10141c; }
#suggestBox .st-innmeldt { background: #aab4c3; } #suggestBox .st-lest { background: #7fb3ff; } #suggestBox .st-under { background: #ffd23f; }
#suggestBox .st-utfort { background: #6fd18a; } #suggestBox .st-avvist { background: #f08a8a; }
#help .suggest-open { display: block; width: 100%; margin: 10px 0 2px; padding: 7px; border-radius: 8px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; font-size: 13px; }

/* ---------- Touch controls ---------- */
#touch { position: fixed; inset: 0; z-index: 9; display: none; pointer-events: none; }
#touch .btn {
  position: absolute; pointer-events: auto;
  width: 74px; height: 74px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid var(--line);
  color: var(--text); font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#touch .btn:active { background: rgba(255, 210, 63, 0.25); }
#tLeft  { left: 20px;  bottom: 110px; }
#tRight { left: 110px; bottom: 110px; }
#tGas   { right: 20px; bottom: 170px; background: rgba(80, 200, 120, 0.15); }
#tBrake { right: 20px; bottom: 80px;  background: rgba(230, 80, 80, 0.15); }
#touch #tAction { right: 110px; bottom: 125px; font-size: 15px; display: none; background: rgba(120, 160, 255, 0.18); }
#touch #tTilt { left: 74px; bottom: 196px; width: 54px; height: 54px; font-size: 12px; font-weight: 600; line-height: 1.1; text-align: center; }
#touch #tTilt.on { background: rgba(255, 210, 63, 0.3); border-color: var(--accent); }
#touch #tTilt[hidden] { display: none; }
#touch #tFace { left: 12px; bottom: 196px; width: 54px; height: 54px; font-size: 12px; font-weight: 600; line-height: 1.1; text-align: center; } /* v126 */
#touch #tFace.on { background: rgba(255, 210, 63, 0.3); border-color: var(--accent); }
