/* ============================================================
   Velocity · Car Logo Quiz — web edition
   Dark navy / glowing-gold theme, phone-like responsive shell
   ============================================================ */
:root {
  --bg: #0C111B;
  --tint: #141C2B;
  --card: #161922;
  --card-2: #1B1F2B;
  --stroke: rgba(255,255,255,0.08);
  --accent: #F5C70D;
  --accent-deep: #D9A800;
  --text: #FFFFFF;
  --text-2: rgba(255,255,255,0.55);
  --wrong: #D93D3D;
  --font-rounded: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 460px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-rounded);
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(120% 80% at 50% -10%, var(--tint) 0%, transparent 60%);
  background-attachment: fixed;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; -webkit-user-drag: none; user-select: none; }
::selection { background: var(--accent); color: #000; }

/* ---- phone shell ---- */
#phone {
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  background-image: radial-gradient(110% 60% at 50% 0%, rgba(20,28,43,0.95) 0%, transparent 55%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#app { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* device frame on larger screens */
@media (min-width: 720px) {
  body { display: flex; align-items: center; justify-content: center; padding: 24px 0; }
  #phone {
    height: min(900px, calc(100dvh - 48px));
    min-height: 0;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 40px 120px rgba(0,0,0,0.65), 0 0 0 10px rgba(255,255,255,0.02);
  }
}

/* safe-area padding for notched phones */
.safe-top { padding-top: max(12px, env(safe-area-inset-top)); }
.safe-bottom { padding-bottom: max(20px, env(safe-area-inset-bottom)); }

/* ---- shared atoms ---- */
.mono {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
  color: var(--text-2);
}
.glow { box-shadow: 0 0 28px rgba(245,199,13,0.45); }
.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
}
.row-accent { position: relative; }
.row-accent::before {
  content: ""; position: absolute; left: -1px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; border-radius: 2px; background: var(--accent);
}

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { width: 0; }

/* ============================== START ============================== */
.start { padding: 0 24px; text-align: center; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 0; flex: 0 0 auto;
}
.topbar .brand-name { font-size: 19px; font-weight: 800; }
.play-badge {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center; color: #000;
  font-size: 12px;
}
.icon-btn-plain { color: var(--text-2); font-size: 20px; padding: 6px; margin-left: auto; }

.start-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 0; overflow-y: auto; padding: 8px 0 4px; }
.app-logo { height: 130px; max-width: 78%; object-fit: contain; filter: drop-shadow(0 0 26px rgba(245,199,13,0.32)); margin-bottom: 6px; }
.pill {
  display: inline-block; font-size: 11px; padding: 8px 16px; border-radius: 999px;
  color: var(--accent); border: 1px solid rgba(245,199,13,0.6);
  background: rgba(245,199,13,0.08);
}
.headline { font-size: 42px; font-weight: 800; line-height: 1.04; margin: 20px 0 0; }
.headline .gold { color: var(--accent); display: inline-block; border-bottom: 4px solid var(--accent); padding-bottom: 2px; }
.subhead { color: var(--text-2); font-size: 15px; margin-top: 16px; line-height: 1.4; }

.modes { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.mode-btn {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 16px 20px; border-radius: 16px; width: 100%;
}
.mode-btn .m-ico { width: 30px; font-size: 20px; flex: 0 0 auto; text-align: center; }
.mode-btn .m-text { flex: 1; min-width: 0; }
.mode-btn .m-title { font-size: 16px; font-weight: 800; }
.mode-btn .m-sub { font-size: 11px; font-weight: 500; opacity: 0.75; margin-top: 3px; }
.mode-btn .m-arrow { font-size: 15px; font-weight: 800; }
.mode-btn.filled {
  color: #000;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 26px rgba(245,199,13,0.4);
}
.mode-btn.outline { color: var(--text); background: var(--card); border: 1px solid var(--stroke); }
.mode-btn:active { transform: scale(0.985); }

.start-nav { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 26px; flex: 0 0 auto; }
.nav-card {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 15px 18px; border-radius: 16px; width: 100%;
  background: var(--card); border: 1px solid var(--stroke);
}
.nav-card .n-ico { color: var(--accent); font-size: 19px; width: 26px; text-align: center; flex: 0 0 auto; }
.nav-card .n-title { font-size: 16px; font-weight: 800; }
.nav-card .n-sub { font-size: 9px; margin-top: 3px; }
.nav-card .n-chev { margin-left: auto; color: var(--text-2); font-weight: 800; }

/* ============================== GAME ============================== */
.game { padding: 12px 0 0; gap: 14px; }
.game-top { display: flex; align-items: center; padding: 0 20px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--stroke);
  color: var(--text-2); font-size: 17px; display: grid; place-items: center;
}
.score-chip { display: flex; align-items: center; gap: 6px; color: var(--accent); margin: 0 auto; }
.score-chip .s-num { font-size: 18px; font-weight: 800; }
.game-top .right { display: flex; gap: 10px; }

.progress-wrap { padding: 0 22px; }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.progress-head .mono { font-size: 10px; }
.bar { height: 5px; border-radius: 999px; background: var(--stroke); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; box-shadow: 0 0 8px rgba(245,199,13,0.5); transition: width .3s ease; }
.finish-btn {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; font-weight: 700;
  color: var(--accent); padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(245,199,13,0.6);
}

.game-scroll { flex: 1; min-height: 0; padding: 4px 0; }
.logo-card {
  margin: 0 20px; height: 188px; background: #fff; border-radius: 22px;
  display: grid; place-items: center; padding: 24px;
  box-shadow: 0 16px 30px rgba(0,0,0,0.5);
}
.logo-card img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.choices { display: flex; flex-direction: column; gap: 11px; padding: 16px 20px 0; }
.choice {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-radius: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--stroke);
  font-size: 17px; font-weight: 700; color: var(--text);
  transition: background .15s, color .15s, opacity .15s;
}
.choice:active { transform: scale(0.99); }
.choice .ci { font-size: 18px; }
.choice.correct { background: var(--accent); border-color: var(--accent); color: #000; box-shadow: 0 0 16px rgba(245,199,13,0.5); }
.choice.wrong { background: var(--wrong); border-color: var(--wrong); color: #fff; }
.choice.dimmed { opacity: 0.4; }
.choice.locked { pointer-events: none; }

.car-reveal { margin: 16px 20px 0; height: 188px; border-radius: 16px; overflow: hidden; border: 1px solid var(--stroke); animation: fade .3s ease; }
.car-reveal img { width: 100%; height: 100%; object-fit: cover; }

.next-wrap { padding: 12px 20px; flex: 0 0 auto; }
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 17px; border-radius: 15px; color: #000;
  font-size: 16px; font-weight: 800;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 22px rgba(245,199,13,0.42);
}
.btn-primary:active { transform: scale(0.99); }
.slide-up { animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================== GAME OVER ============================== */
.over { padding: 0 24px; align-items: center; justify-content: center; text-align: center; gap: 0; }
.over .pill { margin-bottom: 6px; }
.score-hero { font-size: 70px; font-weight: 800; color: var(--accent); margin-top: 22px; text-shadow: 0 0 30px rgba(245,199,13,0.35); line-height: 1; }
.score-hero .small { font-size: 34px; color: var(--text-2); }
.over .caption { font-size: 16px; font-weight: 600; margin-top: 6px; }
.breakdown {
  display: flex; align-items: stretch; width: 100%; max-width: 360px;
  margin-top: 28px; padding: 18px 0; border-radius: 18px;
  background: var(--card); border: 1px solid var(--stroke);
}
.breakdown .stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.breakdown .stat .v { font-size: 24px; font-weight: 800; }
.breakdown .stat .mono { font-size: 9px; }
.breakdown .divider { width: 1px; background: var(--stroke); align-self: center; height: 38px; }
.over-actions { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; margin-top: 30px; }
.btn-outline {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px; border-radius: 15px; color: var(--text);
  font-size: 16px; font-weight: 600; border: 1px solid var(--stroke); background: transparent;
}
.btn-text { color: var(--text-2); font-size: 15px; font-weight: 600; padding: 12px; }

/* ============================== MODAL / SHEET ============================== */
#modal-root { position: absolute; inset: 0; pointer-events: none; z-index: 50; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5);
  pointer-events: auto; animation: fade .2s ease;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; top: 14px;
  background: var(--bg); pointer-events: auto;
  border-radius: 22px 22px 0 0; border-top: 1px solid var(--stroke);
  display: flex; flex-direction: column; overflow: hidden;
  animation: sheetUp .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-bar {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--stroke); flex: 0 0 auto;
}
.sheet-bar .grip { position: absolute; left: 50%; top: 7px; transform: translateX(-50%); width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.18); }
.sheet-title { font-size: 17px; font-weight: 800; }
.sheet-done { color: var(--accent); font-weight: 700; font-size: 16px; }
.sheet-ico-btn { color: var(--text-2); font-size: 19px; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* info */
.info-body { padding: 24px; }
.info-logo { height: 96px; margin: 0 auto 18px; display: block; object-fit: contain; }
.info-h1 { font-size: 23px; font-weight: 800; margin: 0 0 18px; }
.info-sec { margin-bottom: 22px; }
.info-sec .mono { font-size: 11px; color: var(--accent); display: block; margin-bottom: 8px; }
.info-sec p { font-size: 15px; line-height: 1.5; margin: 0; color: rgba(255,255,255,0.85); white-space: pre-line; }

/* browser (garage / discover) */
.browser-body { padding: 12px 0 28px; }
.search-wrap { padding: 6px 16px 4px; }
.search {
  width: 100%; padding: 11px 14px; border-radius: 12px; font-size: 15px;
  background: var(--card); border: 1px solid var(--stroke); color: var(--text);
}
.search::placeholder { color: var(--text-2); }
.garage-header {
  display: flex; align-items: center; gap: 12px; margin: 10px 16px 4px;
  padding: 16px 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--stroke);
}
.garage-header .g-num { font-size: 34px; font-weight: 800; color: var(--accent); }
.garage-header .g-tot { font-size: 18px; font-weight: 700; color: var(--text-2); margin-left: 4px; }
.garage-header .mono { font-size: 9px; margin-top: 2px; display: block; }
.ring { width: 56px; height: 56px; margin-left: auto; flex: 0 0 auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--card); border: 1px solid var(--stroke); color: var(--text);
}
.chip .c-count { font-family: var(--font-mono); font-size: 11px; font-weight: 800; color: var(--accent); }
.chip.active { background: var(--accent); color: #000; border-color: transparent; }
.chip.active .c-count { color: rgba(0,0,0,0.65); }
.toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 4px 16px 8px; }
.sort-select {
  font-size: 12px; padding: 7px 10px; border-radius: 10px; color: var(--text-2);
  background: var(--card); border: 1px solid var(--stroke);
}
.list { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px; }
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--stroke); text-align: left; width: 100%;
}
.list-row .thumb { width: 60px; height: 60px; border-radius: 12px; background: #fff; padding: 8px; flex: 0 0 auto; display: grid; place-items: center; }
.list-row .thumb img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.list-row .lr-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.list-row .lr-seal { color: var(--accent); font-size: 12px; }
.list-row .lr-meta { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.list-row .lr-acc { margin-left: auto; font-family: var(--font-mono); font-weight: 800; font-size: 13px; color: var(--accent); }
.list-row .lr-chev { color: var(--text-2); font-weight: 800; margin-left: auto; }
.list-row .lr-acc + .lr-chev { margin-left: 10px; }
.empty { text-align: center; padding: 60px 40px; color: var(--text-2); }
.empty .e-ico { font-size: 50px; }
.empty .e-h { font-size: 20px; font-weight: 800; color: var(--text); margin: 14px 0 8px; }
.empty p { font-size: 14px; line-height: 1.5; margin: 0; }
.no-match { text-align: center; color: var(--text-2); font-size: 14px; padding: 40px 0; }

/* detail */
.detail-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; align-items: center; }
.detail-logo { width: 100%; height: 220px; background: #fff; border-radius: 24px; display: grid; place-items: center; padding: 30px; box-shadow: 0 16px 30px rgba(0,0,0,0.5); }
.detail-logo img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.detail-name { font-size: 30px; font-weight: 800; text-align: center; }
.detail-country { font-size: 11px; color: var(--accent); margin-top: 6px; }
.detail-car { width: 100%; height: 220px; border-radius: 20px; overflow: hidden; border: 1px solid var(--stroke); box-shadow: 0 12px 24px rgba(0,0,0,0.4); }
.detail-car img { width: 100%; height: 100%; object-fit: cover; }
.fact-grid { display: flex; gap: 10px; width: 100%; }
.fact { flex: 1; padding: 16px 8px; border-radius: 14px; text-align: center; background: var(--card); border: 1px solid var(--stroke); }
.fact .v { font-size: 18px; font-weight: 800; }
.fact .mono { font-size: 9px; margin-top: 6px; }
.hq-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--stroke); }
.hq-row .hq-ico { color: var(--accent); }
.hq-row span.t { font-size: 14px; color: rgba(255,255,255,0.85); }
.blurb { font-size: 15px; line-height: 1.5; color: rgba(255,255,255,0.85); text-align: center; }
.detail-note { font-size: 14px; color: var(--text-2); text-align: center; line-height: 1.5; }
.stats-card { width: 100%; padding: 16px 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--stroke); text-align: center; }
.stats-card .mono { color: var(--accent); font-size: 10px; display: block; margin-bottom: 12px; }
.stats-card .stats-row { display: flex; align-items: stretch; }
.stats-card .stat { flex: 1; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.stats-card .stat .v { font-size: 20px; font-weight: 800; }
.stats-card .stat .mono { color: var(--text-2); font-size: 8px; margin: 0; }
.stats-card .divider { width: 1px; background: var(--stroke); height: 34px; align-self: center; }
.stats-card .since { font-size: 12px; color: var(--text-2); margin-top: 12px; }
.reset-link { color: var(--wrong); font-size: 13px; font-weight: 600; padding: 10px; margin-top: 2px; }

/* install / add-to-home-screen instructions */
.ios-step { font-size: 15px; line-height: 1.6; color: rgba(255,255,255,0.9); margin: 0 0 16px; }
.ios-step b { color: var(--text); font-weight: 700; }
.ios-step svg { width: 1.15em; height: 1.15em; vertical-align: -0.25em; color: var(--accent); margin: 0 1px; }
.ios-note { font-size: 13px; line-height: 1.5; color: var(--text-2); margin: 6px 0 0; }

/* first-visit "Add to Home Screen" banner */
#phone.has-banner #app { padding-bottom: 92px; }
.a2hs {
  position: absolute; z-index: 40;
  left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px 11px 11px; border-radius: 16px;
  background: var(--card-2); border: 1px solid var(--stroke);
  box-shadow: 0 14px 36px rgba(0,0,0,0.55);
  animation: a2hsUp .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes a2hsUp { from { transform: translateY(140%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.a2hs .a2hs-ico { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; object-fit: contain; background: #0C111B; border: 1px solid var(--stroke); }
.a2hs .a2hs-text { flex: 1; min-width: 0; }
.a2hs .a2hs-title { font-size: 14px; font-weight: 800; }
.a2hs .a2hs-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a2hs .a2hs-cta {
  flex: 0 0 auto; font-size: 13px; font-weight: 800; color: #000;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  padding: 9px 16px; border-radius: 999px;
}
.a2hs .a2hs-cta:active { transform: scale(0.97); }
.a2hs .a2hs-x { flex: 0 0 auto; color: var(--text-2); font-size: 20px; line-height: 1; padding: 4px 6px; }

/* Hide the native (unstyled) scrollbars inside the app shell — scrolling still
   works, but the grey bar that doesn't match the dark theme is gone. */
.start-mid, .scroll, .game-scroll, .sheet-body, .chips, #app {
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* legacy Edge */
}
.start-mid::-webkit-scrollbar,
.scroll::-webkit-scrollbar,
.game-scroll::-webkit-scrollbar,
.sheet-body::-webkit-scrollbar,
.chips::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* On desktop the phone column fits the viewport, so the page itself never
   needs the browser's own scrollbar. */
@media (min-width: 720px) { html, body { overflow: hidden; } }
