/* Oil Change Quest: overlay UI. Mobile-first, dark, in the motoryk.com palette. */
:root {
  --bg: #0a0e1a;
  --bg-2: #101622;
  --surface: rgba(16, 22, 34, 0.9);
  --surface-2: #1a2233;
  --surface-3: #242e42;
  --line: rgba(199, 207, 255, 0.12);
  --text: #e2e4f6;
  --muted: #a7aabb;
  --primary: #0d59f2;
  --primary-2: #699cff;
  --amber: #f59e0b;
  --ok: #4ade80;
  --bad: #ff716c;
  --oil-old: #6b3a0c;
  --oil-new: #d89526;
  --radius: 16px;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --top-h: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary-2); outline-offset: 2px; border-radius: 10px; }

#app { position: fixed; inset: 0; height: 100dvh; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#scene.is-shaking { animation: shake 0.45s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 1px, 0); }
  20%, 80% { transform: translate3d(4px, -2px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 2px, 0); }
  40%, 60% { transform: translate3d(6px, -1px, 0); }
}

/* ── top bar ─────────────────────────────────────────────────────────── */
#topbar {
  position: absolute; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--sat)) calc(12px + var(--sar)) 8px calc(12px + var(--sal));
  min-height: calc(var(--top-h) + var(--sat));
  background: linear-gradient(to bottom, rgba(10, 14, 26, 0.85), rgba(10, 14, 26, 0));
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { display: block; width: 84px; height: 36px; flex: none; overflow: hidden; }
.brand img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 48%; transform: scale(1.65); }
.mode-pill {
  font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; background: rgba(13, 89, 242, 0.22); color: var(--primary-2); border: 1px solid rgba(105, 156, 255, 0.35);
}
.mode-pill:empty { display: none; }
[data-mode="quest"] .mode-pill { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border-color: rgba(245, 158, 11, 0.4); }
.progress { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 60px; }
.progress__track { flex: 1; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.progress__bar { height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: transform 0.5s ease; }
.progress__label { font-family: var(--font-head); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
[data-screen]:not([data-screen="game"]) .progress, [data-screen]:not([data-screen="game"]) .mode-pill, [data-screen]:not([data-screen="game"]) .score { visibility: hidden; }
[data-screen="loading"] #btn-menu, [data-screen="start"] #btn-menu { visibility: hidden; }
.score { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.score b { color: var(--text); font-family: var(--font-head); font-variant-numeric: tabular-nums; }
.score__k { display: none; }
.score > span:first-child::before { content: '★ '; color: #fbbf24; }
.score > span:last-child::before { content: '✗ '; color: var(--bad); }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: rgba(26, 34, 51, 0.8); border: 1px solid var(--line);
}
.icon-btn svg, .ctl svg, .btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ── chips (status) ──────────────────────────────────────────────────── */
#chips {
  position: absolute; z-index: 15; left: calc(12px + var(--sal)); top: calc(var(--top-h) + var(--sat) + 4px);
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; max-width: 62vw;
}
.chip {
  font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 10px;
  background: rgba(16, 22, 34, 0.86); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: pop-in 0.25s ease-out;
}
.chip b { font-family: var(--font-head); font-variant-numeric: tabular-nums; color: #fff; }
.chip[data-kind="ok"] { border-color: rgba(74, 222, 128, 0.45); color: #bbf7d0; }
.chip[data-kind="bad"] { border-color: rgba(255, 113, 108, 0.6); color: #fecaca; background: rgba(60, 14, 16, 0.85); }
.chip[data-kind="time"] { color: #fde68a; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.97); } }

/* ── pins (3D labels) ────────────────────────────────────────────────── */
#pins { position: absolute; inset: 0; z-index: 12; pointer-events: none; overflow: hidden; }
.pin { position: absolute; left: 0; top: 0; will-change: transform; }
.pin__dot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary-2); box-shadow: 0 0 0 3px rgba(105, 156, 255, 0.3); }
.pin__label {
  position: absolute; left: 0; bottom: 12px; transform: translateX(-50%); white-space: nowrap;
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 8px;
  background: rgba(10, 14, 26, 0.88); border: 1px solid rgba(105, 156, 255, 0.45); animation: pop-in 0.25s ease-out;
}
.pin[data-kind="ok"] .pin__dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3); }
.pin[data-kind="ok"] .pin__label { border-color: rgba(74, 222, 128, 0.55); color: #bbf7d0; }
.pin[data-kind="bad"] .pin__dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 113, 108, 0.35); animation: pulse 0.9s infinite; }
.pin[data-kind="bad"] .pin__label { border-color: rgba(255, 113, 108, 0.7); color: #fecaca; background: rgba(60, 14, 16, 0.9); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 113, 108, 0); } }

/* ── gauge ───────────────────────────────────────────────────────────── */
.gauge {
  position: absolute; z-index: 15; right: calc(12px + var(--sar)); top: calc(var(--top-h) + var(--sat) + 4px);
  display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 14px;
  background: rgba(16, 22, 34, 0.86); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.gauge svg { width: 54px; height: 54px; }
.gauge__bezel { fill: #9aa3ad; }
.gauge__glass { fill: #0b0f15; }
#gauge-oil { fill: var(--oil-old); transition: fill 0.4s; }
.gauge__mark { stroke: #e8eaf2; stroke-width: 3; stroke-linecap: round; }
.gauge__ring { fill: none; stroke: transparent; stroke-width: 5; }
.gauge.is-alert .gauge__ring { stroke: var(--bad); animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { stroke: transparent; } }
.gauge__text { display: flex; flex-direction: column; line-height: 1.15; }
.gauge__k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.gauge__text b { font-family: var(--font-head); font-size: 16px; }
.gauge[data-state="ok"] .gauge__text b { color: var(--ok); }
.gauge[data-state="low"] .gauge__text b, .gauge[data-state="empty"] .gauge__text b { color: #fbbf24; }
.gauge[data-state="over"] .gauge__text b { color: var(--bad); }

/* ── service log card ────────────────────────────────────────────────── */
.log-card {
  position: absolute; z-index: 16; right: calc(12px + var(--sar)); top: calc(var(--top-h) + var(--sat) + 4px);
  width: min(260px, 70vw); padding: 12px 14px; border-radius: 14px;
  background: rgba(16, 22, 34, 0.92); border: 1px solid rgba(74, 222, 128, 0.45); animation: pop-in 0.3s ease-out;
}
.log-card__head { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); }
.log-card .tick { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #052e16; font-weight: 700; font-size: 13px; }
.log-card ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.log-card li { padding: 3px 0; border-top: 1px solid var(--line); }
.log-card li:first-child { border-top: 0; }
.log-card .spec { font-size: 12px; }

/* ── dock + sheets ───────────────────────────────────────────────────── */
.dock {
  position: absolute; z-index: 18; left: 0; right: 0; bottom: 0;
  padding: 0 calc(10px + var(--sar)) calc(10px + var(--sab)) calc(10px + var(--sal));
  display: flex; justify-content: center; pointer-events: none;
}
.sheet {
  pointer-events: auto; width: 100%; max-width: 560px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 14px 16px 14px; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  animation: sheet-in 0.32s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px); } }
/* The site's sticky app bar (js/android-promo.js, phones: ~60px + the safe
   area) slides in over the bottom edge. While it is up, lift the dock and the
   full-screen cards above it so it never covers an answer button. */
.dock { transition: padding-bottom 0.3s ease; }
html.mk-bar-on .dock { padding-bottom: calc(74px + var(--sab)); }
html.mk-bar-on .screen { padding-bottom: calc(80px + var(--sab)); }
.sheet--bad { border-color: rgba(255, 113, 108, 0.5); }
.kicker { font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary-2); }
.kicker--bad { color: var(--bad); }
.sheet__title { font-family: var(--font-head); font-size: 20px; line-height: 1.2; margin: 2px 0 4px; }
.sheet__text { margin: 0; font-size: 15px; color: #cfd3e6; }
.spec { color: #fde68a; font-weight: 700; }
.spec--missing { color: #fbbf24; font-weight: 600; font-style: italic; white-space: normal; }

.controls { display: flex; gap: 8px; margin-top: 12px; }
.ctl {
  min-width: 52px; height: 48px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line); font-weight: 700;
}
.ctl:disabled { opacity: 0.35; cursor: default; }
.ctl--primary { flex: 1; background: var(--primary); border-color: transparent; color: #fff; }
.ctl .i-play { display: none; }
.ctl[data-state="paused"] .i-play { display: block; }
.ctl[data-state="paused"] .i-pause { display: none; }

.options { display: grid; gap: 8px; margin-top: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; text-align: left;
  padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 15px; font-weight: 600; line-height: 1.3; transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.opt:hover:not(:disabled) { background: var(--surface-3); border-color: rgba(105, 156, 255, 0.5); }
.opt:active:not(:disabled) { transform: scale(0.99); }
.opt__key {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px;
  font-family: var(--font-head); font-size: 14px; background: rgba(13, 89, 242, 0.25); color: var(--primary-2);
}
.opt.is-wrong { border-color: rgba(255, 113, 108, 0.55); color: #fca5a5; }
.opt.is-wrong:disabled { opacity: 0.55; text-decoration: line-through; text-decoration-color: rgba(255, 113, 108, 0.7); }
.opt.is-wrong .opt__key { background: rgba(255, 113, 108, 0.2); color: var(--bad); }
.opt.is-right { border-color: rgba(74, 222, 128, 0.7); background: rgba(22, 101, 52, 0.4); }
.opt.is-right .opt__key { background: var(--ok); color: #052e16; }
.hint { margin: 8px 2px 0; font-size: 12px; color: var(--muted); }
.hint--keys { display: none; }
@media (hover: hover) and (pointer: fine) { .hint--keys { display: block; } }

/* ── buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface-3); font-weight: 700; font-size: 16px;
  text-decoration: none; transition: filter 0.15s, transform 0.1s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.99); }
.btn--block { width: 100%; }
.btn--primary { background: var(--primary); border-color: transparent; color: #fff; }
.btn--ghost { background: rgba(26, 34, 51, 0.75); }
.btn--cta { background: linear-gradient(135deg, #f59e0b, #f97316); color: #1c1003; border-color: transparent; }
#btn-next-quest { margin-top: 12px; }

/* ── toast + flash ───────────────────────────────────────────────────── */
.toast {
  position: absolute; z-index: 25; left: 50%; top: 38%; transform: translate(-50%, -50%);
  font-family: var(--font-head); font-weight: 700; font-size: 34px; color: var(--ok); text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  opacity: 0; pointer-events: none;
}
.toast[data-kind="bad"] { color: var(--bad); }
.toast.is-on { animation: toast 1.1s ease-out; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -90%); } }
#flash { position: absolute; inset: 0; z-index: 11; pointer-events: none; opacity: 0; }
#flash[data-kind="bad"] { background: radial-gradient(ellipse at center, rgba(255, 59, 48, 0) 45%, rgba(255, 59, 48, 0.5) 100%); }
#flash.is-on { animation: flash 0.9s ease-out; }
@keyframes flash { 15% { opacity: 1; } 100% { opacity: 0; } }

/* ── screens ─────────────────────────────────────────────────────────── */
.screen {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center;
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal));
  background: radial-gradient(ellipse at 50% 120%, rgba(13, 89, 242, 0.16), rgba(10, 14, 26, 0) 60%), rgba(10, 14, 26, 0.55);
  overflow-y: auto;
}
.screen--loading { background: var(--bg); }
.screen__card {
  width: 100%; max-width: 420px; text-align: center; padding: 22px 20px 20px; border-radius: 24px;
  background: rgba(16, 22, 34, 0.82); border: 1px solid var(--line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); animation: sheet-in 0.4s cubic-bezier(.2,.8,.2,1);
}
.screen--loading .screen__card { background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.logo { display: block; width: 168px; height: 72px; margin: 0 auto 4px; object-fit: cover; object-position: 50% 46%; transform: scale(1.5); }
.eyebrow { margin: 0; font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.screen__title { font-family: var(--font-head); font-size: 30px; line-height: 1.1; margin: 6px 0 8px; }
.screen__lead { margin: 0 0 18px; color: #cfd3e6; }
.stack { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.stack .meta { margin: 0; }
.tip { margin: 18px auto 0; max-width: 320px; font-size: 14px; color: var(--muted); }
.tip a { color: var(--primary-2); }
.loadbar { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 18px auto 8px; max-width: 280px; }
.loadbar__fill { height: 100%; width: 100%; transform-origin: left; transform: scaleX(0.04); background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: transform 0.35s ease; }
.loadbar__pct { font-family: var(--font-head); font-size: 13px; color: var(--muted); }
.screen--loading.is-error .loadbar, .screen--loading.is-error .loadbar__pct { display: none; }
.screen--loading.is-error .tip { color: var(--text); }

.badge { width: 104px; margin: 0 auto 2px; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45)); animation: badge-in 0.7s cubic-bezier(.2,1.4,.4,1); }
@keyframes badge-in { from { transform: scale(0.4) rotate(-20deg); opacity: 0; } }
.badge__ribbon { fill: #0d59f2; }
.badge__outer { fill: var(--medal-a, #f8d26a); }
.badge__inner { fill: var(--medal-b, #d9a521); }
.badge__drop { fill: #1b1206; opacity: 0.85; }
.badge__shine { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: 0.7; }
[data-tier="silver"] { --medal-a: #e5e7eb; --medal-b: #a8b0bc; }
[data-tier="bronze"] { --medal-a: #e7a77a; --medal-b: #b56a3a; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 16px; }
.stats > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 8px 4px; }
.stats dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stats dd { margin: 2px 0 0; font-family: var(--font-head); font-size: 20px; }
.stats__max { font-size: 12px; color: var(--muted); margin-left: 2px; }

.debug { position: fixed; z-index: 99; left: 8px; bottom: calc(8px + var(--sab)); font: 11px/1.3 monospace; color: #9f9; background: rgba(0, 0, 0, 0.6); padding: 3px 6px; border-radius: 4px; pointer-events: none; }

/* ── wider screens / landscape: the dock becomes a side card ─────────── */
@media (orientation: landscape) and (min-width: 640px) {
  .dock {
    left: auto; top: calc(var(--top-h) + var(--sat)); bottom: 0; width: min(420px, 44vw);
    align-items: flex-end; padding: 0 calc(12px + var(--sar)) calc(12px + var(--sab)) 0;
  }
  .sheet { max-height: 100%; overflow-y: auto; }
  .gauge { right: auto; left: calc(12px + var(--sal)); top: auto; bottom: calc(12px + var(--sab)); }
  .log-card { right: auto; left: calc(12px + var(--sal)); top: auto; bottom: calc(12px + var(--sab)); }
  #chips { max-width: 40vw; }
}
@media (orientation: landscape) and (max-height: 520px) {
  :root { --top-h: 48px; }
  .sheet { padding: 10px 12px; border-radius: 16px; }
  .sheet__title { font-size: 17px; }
  .sheet__text, .opt { font-size: 14px; }
  .opt { min-height: 46px; padding: 7px 10px; }
  .options { gap: 6px; margin-top: 6px; }
  .controls { margin-top: 8px; }
  .ctl, .btn { min-height: 44px; height: 44px; }
  .screen__card { padding: 14px 16px; }
  .screen__title { font-size: 24px; }
  .logo { display: none; }
  .badge { width: 64px; }
  .stats { margin-bottom: 10px; }
}
@media (min-width: 900px) and (min-height: 600px) {
  .sheet__title { font-size: 22px; }
  .sheet__text { font-size: 16px; }
  .screen__card { max-width: 440px; }
}
@media (max-width: 360px) {
  .brand { width: 64px; }
  .sheet__title { font-size: 18px; }
  .opt { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ── v2: bike line, notes, credits, desktop gate ─────────────────────── */
.bike-line { margin: -4px 0 8px; font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--primary-2); letter-spacing: 0.02em; }
.note { margin: 10px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.linkbtn {
  display: inline-block; margin: 10px auto 0; padding: 8px 12px; min-height: 36px; border: 0; background: none;
  font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--text); }
.modal {
  position: absolute; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(5, 8, 15, 0.6); padding: 0 calc(10px + var(--sar)) calc(10px + var(--sab)) calc(10px + var(--sal));
}
.modal__sheet {
  width: 100%; max-width: 560px; max-height: 82dvh; overflow-y: auto; background: #121a2a; border: 1px solid var(--line);
  border-radius: 20px; padding: 14px 16px 18px; animation: sheet-in 0.3s cubic-bezier(.2,.8,.2,1);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.credits { font-size: 14px; color: #cfd3e6; }
.credits p { margin: 10px 0 0; line-height: 1.45; }
.credits a { color: var(--primary-2); }
.credits .links { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.credits .links a { font-weight: 700; padding: 6px 0; }
.credits .fine { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 14px; }
.screen--desktop { background: radial-gradient(ellipse at 50% 120%, rgba(13, 89, 242, 0.22), rgba(10, 14, 26, 0) 60%), var(--bg); }
.screen__card--wide { max-width: 640px; }
.desk { display: flex; align-items: center; gap: 28px; text-align: left; margin: 14px 0 6px; }
.desk__qr { flex: none; width: 196px; height: 196px; padding: 12px; background: #fff; border-radius: 16px; }
.desk__qr svg { display: block; width: 100%; height: 100%; }
.desk__title { font-family: var(--font-head); font-size: 22px; margin: 0 0 6px; }
.desk__url { margin: 0; font-size: 13px; color: var(--muted); word-break: break-all; }
.gauge[data-state="leaning"] .gauge__text b { color: #fbbf24; }

/* Phones in portrait: menu cards sit at the bottom so the bike stays in view above them. */
@media (orientation: portrait) {
  .screen:not(.screen--loading):not(.screen--desktop) {
    align-items: end;
    background: linear-gradient(to bottom, rgba(10, 14, 26, 0) 0%, rgba(10, 14, 26, 0.15) 32%, rgba(10, 14, 26, 0.78) 68%);
  }
  .screen:not(.screen--loading):not(.screen--desktop) .logo { display: none; }
  .screen:not(.screen--loading):not(.screen--desktop) .screen__card { padding-top: 18px; }
}
@media (orientation: portrait) and (max-height: 700px) {
  .screen__title { font-size: 26px; }
  .screen__lead { margin-bottom: 12px; font-size: 15px; }
  .badge { width: 72px; }
}
.score > span { white-space: nowrap; }
@media (max-width: 420px) {
  #topbar { gap: 8px; padding-left: calc(10px + var(--sal)); padding-right: calc(10px + var(--sar)); }
  .brand { width: 66px; }
  .mode-pill { padding: 3px 8px; font-size: 11px; }
  .progress { min-width: 40px; gap: 6px; }
  .progress__label { min-width: 0; font-size: 12px; }
  .score { gap: 7px; font-size: 12px; }
  .icon-btn { width: 40px; height: 40px; }
}
.stats dd { white-space: nowrap; }
@media (max-width: 380px) { .stats dd { font-size: 18px; } .stats__max { font-size: 11px; } }

/* ── finish: enjoyed? / Garage Club / share ─────────────────────────── */
.enjoy { margin-top: 2px; padding: 10px; border-radius: 14px; background: rgba(26, 34, 51, 0.6); border: 1px solid var(--line); }
.enjoy__ask { margin: 0 0 8px; font-family: var(--font-head); font-weight: 700; font-size: 16px; }
.enjoy__btns .btn { min-height: 44px; font-size: 15px; }
.enjoy__thanks { margin: 0; font-size: 14px; color: var(--ok); }
.enjoy[hidden], .enjoy__btns[hidden] { display: none; }
.improve { display: grid; gap: 6px; text-align: left; }
.improve label { font-size: 13px; color: var(--muted); }
.improve__row { display: flex; gap: 8px; }
.improve__row input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line);
  background: #0e1422; color: var(--text); font: inherit; font-size: 15px;
}
.improve__row .btn { min-height: 44px; padding: 0 14px; }
.club {
  display: grid; gap: 4px; text-align: left; text-decoration: none; padding: 12px 14px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(13, 89, 242, 0.22), rgba(105, 156, 255, 0.08)); border: 1px solid rgba(105, 156, 255, 0.45);
}
.club__title { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: #fff; }
.club__title::after { content: ' →'; color: var(--primary-2); }
.club__line { font-size: 13px; line-height: 1.4; color: #cfd3e6; }
.club--hero { padding: 16px; border-width: 2px; box-shadow: 0 8px 30px rgba(13, 89, 242, 0.25); animation: pop-in 0.3s ease-out; }
.club--hero .club__title { font-size: 19px; }
.club--hero .club__line { font-size: 14px; }
.club--small { padding: 9px 12px; }
.club--small .club__title { font-size: 15px; }
.club--small .club__line { font-size: 12px; }

/* ── safety alarm (car quest) ───────────────────────────────────────── */
.alarm {
  position: absolute; z-index: 19; left: calc(12px + var(--sal)); right: calc(12px + var(--sar)); top: calc(var(--top-h) + var(--sat) + 52px);
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px;
  background: rgba(60, 10, 12, 0.94); border: 2px solid #ff3b30; box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.6);
  animation: alarm 1s ease-in-out infinite;
}
.alarm[hidden] { display: none; }
.alarm__icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #ff3b30; color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 22px; }
.alarm__title { display: block; font-family: var(--font-head); font-size: 16px; color: #fff; }
.alarm__line { margin: 3px 0 0; font-size: 13px; line-height: 1.4; color: #fecaca; }
@keyframes alarm { 50% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); border-color: #ff8a80; } }
@media (orientation: landscape) and (min-width: 640px) { .alarm { right: auto; width: min(460px, 50vw); } }

/* ── dipstick gauge (car) ───────────────────────────────────────────── */
.gauge--stick svg { width: 92px; height: 37px; }
.gauge__blade { fill: #b8bcc2; }
.gauge--stick #gauge-oil { fill: var(--oil-new); }
.gauge--stick .gauge__mark { stroke: #101622; stroke-width: 3; }
.gauge--stick.is-alert .gauge__ring { stroke: var(--bad); }

/* picture-in-picture turn view (drain bolt from below / filter from its end) */
.inset {
  position: absolute; z-index: 14; pointer-events: none; border-radius: 14px;
  border: 2px solid rgba(255, 176, 32, 0.9); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
.inset span {
  position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); white-space: nowrap;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: #ffb020; color: #1c1003;
}

.enjoy__btns .btn { padding: 0 10px; white-space: nowrap; }
@media (max-width: 380px) { .enjoy__btns .btn { font-size: 14px; } }

/* ── share with a friend · more quests · next quest ─────────────────── */
.btn--quiet { min-height: 44px; background: transparent; border-color: rgba(255, 255, 255, 0.16); font-size: 15px; font-weight: 600; color: #dfe3f2; }
.btn--quiet svg { width: 18px; height: 18px; }
.share-toast {
  position: fixed; z-index: 45; left: 50%; bottom: calc(28px + var(--sab)); transform: translate(-50%, 12px);
  padding: 10px 18px; border-radius: 999px; background: #15803d; color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.share-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.more { margin-top: 12px; text-align: left; }
.more__title { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.more__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qcard { display: grid; align-content: start; gap: 2px; padding: 9px 11px; border-radius: 14px; text-decoration: none; background: rgba(26, 34, 51, 0.75); border: 1px solid var(--line); }
.qcard__title { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: #fff; }
.qcard__title::after { content: ' →'; color: var(--primary-2); }
.qcard__line { font-size: 12px; line-height: 1.35; color: var(--muted); }
.next {
  display: grid; gap: 2px; text-align: left; text-decoration: none; padding: 11px 14px; border-radius: 16px;
  background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.5);
}
.next__k { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber); }
.next__title { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: #fff; }
.next__title::after { content: ' →'; color: var(--amber); }
.next__line { font-size: 13px; line-height: 1.4; color: #cfd3e6; }
@media (orientation: portrait) and (max-height: 700px) { .more__row .qcard__line { display: none; } }
