/* Dryv look: Midnight and Champagne. Calm surfaces, one gold accent, the Dial
   logo, and a slow fall of leaves behind everything. Red only for mistakes.
   Midnight is the default; Light is paper with midnight ink. Figtree for text. */
:root {
  --paper: #F4F2EE; --card: #FFFFFF; --ink: #0E1A2B; --muted: #5E6673; --faint: #E7E2D9;
  --btn: #0E1A2B; --on-btn: #F4EBDD; --sign: #8C6D3F; --sign-deep: #6E5530; --sign-soft: #EFE7D8; --gold: #8C6D3F;
  --red: #C8243C; --red-ink: #B01830; --red-soft: #F8E3E5; --line: #D5CFC4; --glow: rgba(214,194,159,.28); --glow2: rgba(14,26,43,.05);
  --leaf: 140,109,63;
  --shadow: 0 1px 2px rgba(14,26,43,.06), 0 16px 40px -20px rgba(14,26,43,.22);
  --shadow-lift: 0 1px 2px rgba(14,26,43,.06), 0 24px 48px -20px rgba(14,26,43,.3);
  --r-card: 24px; --r-btn: 999px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1A2B; --card: #15233A; --ink: #F4EBDD; --muted: #A9A396; --faint: #22324B;
    --btn: #D6C29F; --on-btn: #0E1A2B; --sign: #D6C29F; --sign-deep: #BFA77E; --sign-soft: #1D2C45; --gold: #D6C29F;
    --red: #FF6B7F; --red-ink: #FF8C9C; --red-soft: #3A1A28; --line: #2E3E58; --glow: rgba(214,194,159,.10); --glow2: rgba(214,194,159,.05);
    --leaf: 214,194,159;
    --shadow: 0 16px 40px -20px rgba(0,0,0,.7); --shadow-lift: 0 24px 48px -20px rgba(0,0,0,.85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #0E1A2B; --card: #15233A; --ink: #F4EBDD; --muted: #A9A396; --faint: #22324B;
    --btn: #D6C29F; --on-btn: #0E1A2B; --sign: #D6C29F; --sign-deep: #BFA77E; --sign-soft: #1D2C45; --gold: #D6C29F;
    --red: #FF6B7F; --red-ink: #FF8C9C; --red-soft: #3A1A28; --line: #2E3E58; --glow: rgba(214,194,159,.10); --glow2: rgba(214,194,159,.05);
    --leaf: 214,194,159;
    --shadow: 0 16px 40px -20px rgba(0,0,0,.7); --shadow-lift: 0 24px 48px -20px rgba(0,0,0,.85);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.45 'Figtree', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
main {
  max-width: 520px; margin: 0 auto; min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 20px;
}
.screen { display: flex; flex-direction: column; gap: 20px; flex: 1; animation: in .32s cubic-bezier(.2,.8,.2,1) both; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1, h2, h3, .display { font-family: 'Figtree', sans-serif; font-weight: 800; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 34px; line-height: 1.05; }
h2 { font-size: 21px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.25; font-family: 'Figtree', sans-serif; font-weight: 700; letter-spacing: 0; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { color: var(--muted); font-size: 15px; }
.spacer { flex: 1; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.row > .grow, .card.link > .grow { flex: 1; min-width: 0; }
.row > a.ghost { display: inline-flex; align-items: center; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: transparent; color: var(--ink); border: 0; cursor: pointer; margin-left: -10px;
}
.icon-btn.right { margin-left: 0; margin-right: -10px; }
.icon-btn svg { width: 24px; height: 24px; }
.top-title { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }

/* cards */
.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px; }
.card.link { display: flex; align-items: center; gap: 12px; text-decoration: none; cursor: pointer; transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s; }
.card.link:active { transform: scale(.985); }
@media (hover: hover) { .card.link:hover { box-shadow: var(--shadow-lift); } }
.chev { width: 20px; height: 20px; color: var(--muted); flex: none; }

/* buttons */
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: var(--r-btn);
  min-height: 52px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s, background-color .18s, opacity .18s;
}
button:active:not(:disabled), .btn:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--sign); outline-offset: 2px; }
.primary { background: var(--btn); color: var(--on-btn); box-shadow: 0 14px 28px -14px rgba(0,0,0,.55); font-size: 18px; min-height: 60px; }
.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.soft { background: var(--sign-soft); color: var(--ink); }
.ghost { background: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; font-weight: 600; }
.danger { color: var(--red-ink); }
.full { width: 100%; }
.btn svg, button svg { width: 20px; height: 20px; flex: none; }

/* score tile */
.score-row { display: flex; gap: 18px; align-items: center; }
.score {
  font-family: 'Figtree', sans-serif; font-weight: 800; font-size: 96px; line-height: 1; letter-spacing: -.03em;
  background: linear-gradient(180deg, #FFD23F 0%, var(--sign) 55%, var(--sign-deep) 100%); color: #141414;
  border-radius: 22px; padding: 18px 22px 10px; min-width: 150px; text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.1), 0 20px 34px -18px rgba(242,169,0,.85);
  animation: pop .5s cubic-bezier(.2,1.4,.4,1) both;
}
.score.none { font-size: 64px; padding: 26px 22px 18px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.score-note { font-size: 19px; color: var(--muted); line-height: 1.35; }

/* fixes */
.fix { display: flex; gap: 14px; align-items: flex-start; }
.num {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red-soft); color: var(--red-ink); font-weight: 700; font-size: 16px;
}
.fix .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fix .watch { align-self: flex-start; margin-top: 10px; min-height: 46px; font-size: 16px; }
.list { display: flex; flex-direction: column; gap: 12px; }
.good { background: var(--sign-soft); border-radius: 16px; padding: 14px 16px; }

/* readiness ring */
.ring { position: relative; width: 104px; height: 104px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: 'Figtree', sans-serif; font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: var(--faint); }
.ring .fill { stroke: var(--sign); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }

.big-pct { font-family: 'Figtree', sans-serif; font-weight: 800; font-size: 104px; line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.bar { height: 14px; border-radius: 7px; background: var(--faint); overflow: hidden; }
.bar > div { height: 100%; background: var(--sign); border-radius: 7px; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.bar.thin { height: 6px; }

.checklist { padding: 6px 18px; }
.check-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--faint); }
.check-item:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--sign); }
.dot.practise { background: var(--red); }
.dot.not-seen, .dot.not-checked { background: var(--line); }
.chip { font-size: 14px; font-weight: 600; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.chip.ready { background: var(--sign-soft); color: var(--sign); }
.chip.practise { background: var(--red-soft); color: var(--red-ink); }
.chip.not-seen, .chip.not-checked { background: var(--faint); color: var(--muted); }

/* drive list */
.drive-score { font-family: 'Figtree', sans-serif; font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; }
.badge-wait { font-size: 13px; font-weight: 600; background: var(--sign-soft); padding: 4px 10px; border-radius: 999px; }

/* forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; }
label.field span { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=email], input[type=password], input[type=number], input[type=file] {
  font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px; min-height: 50px; width: 100%;
}
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.consent input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.error { color: var(--red-ink); font-size: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--faint); }
.seg { display: flex; background: var(--faint); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 40px; border-radius: 9px; background: transparent; color: var(--ink); font-weight: 600; font-size: 15px; padding: 0 8px; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: var(--shadow); }

/* onboarding */
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step .ic { width: 46px; height: 46px; flex: none; border-radius: 16px; background: var(--sign-soft); color: var(--gold); display: grid; place-items: center; }
.step .ic svg { width: 22px; height: 22px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--gold); }
.brand .dial { display: block; }
.brand .wordmark { display: block; }

/* camera setup + recording (always dark: calm in the car) */
.dark-screen { --paper: #08111D; --card: #15233A; --ink: #F4EBDD; --muted: #A9A396; --faint: #22324B; --btn: #D6C29F; --on-btn: #0E1A2B; --line: #2E3E58; --sign: #D6C29F; --sign-soft: #1D2C45; --gold: #D6C29F; color-scheme: dark; }
body.dark { background: #0B1014; color: #F1F4F7; }
.previews { display: grid; grid-template-columns: 1fr; gap: 10px; }
.preview { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.preview.driver { aspect-ratio: 4 / 3; width: 62%; justify-self: center; }
.preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview .label, .tag { position: absolute; top: 10px; left: 10px; background: rgba(20,20,20,.78); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 14px; font-weight: 600; }

.tag.right { left: auto; right: 10px; top: auto; bottom: 10px; }
.status-line { display: flex; gap: 12px; align-items: center; font-size: 17px; }
.status-line svg { width: 22px; height: 22px; flex: none; }
.status-line.ok svg { color: var(--sign); }
.status-line.no svg { color: var(--muted); }
.rec { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; }
.rec::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: #E5484D; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.timer { font-family: 'Figtree', sans-serif; font-weight: 800; font-size: 88px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.hold { position: relative; overflow: hidden; }
.hold .fillbar { position: absolute; inset: 0; background: var(--sign); transform-origin: left; transform: scaleX(0); }
.hold span { position: relative; }
.note { background: var(--sign-soft); color: var(--ink); border-radius: 14px; padding: 12px 14px; font-size: 15px; }

/* replay */
.replay-videos { display: flex; flex-direction: column; gap: 8px; }
.replay-videos .preview.road { aspect-ratio: 16 / 9; }
.timeline { display: flex; align-items: center; gap: 14px; }
.play { width: 56px; height: 56px; border-radius: 50%; padding: 0; min-height: 0; background: var(--btn); color: var(--on-btn); flex: none; }
.play svg { width: 24px; height: 24px; }
.track-wrap { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.track { position: relative; height: 10px; border-radius: 5px; background: var(--faint); }
.track .mark { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--red); }
.track .head { position: absolute; top: 0; bottom: 0; background: var(--sign); border-radius: 5px; }
.track .pos { position: absolute; top: -5px; width: 3px; height: 20px; background: var(--ink); border-radius: 2px; margin-left: -1px; }
.track-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.tip { background: var(--sign-soft); border-radius: 14px; padding: 14px 16px; }

/* progress */
.progress-big { display: flex; flex-direction: column; gap: 14px; }

details.more summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.event { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--faint); }
.event:last-child { border-bottom: 0; }
.event .when { width: 44px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; flex: none; }
.event.bad .title { color: var(--red-ink); }
.event .watch-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--btn); color: var(--on-btn); padding: 12px 18px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lift); z-index: 10; max-width: calc(100% - 32px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Depth and motion: 3D objects, tactile presses, smooth screen changes.
   ===================================================================== */
:root { --r-btn: 999px; --spring: cubic-bezier(.34, 1.56, .64, 1); --ease: cubic-bezier(.2, .8, .2, 1); }

/* presses: a quick squash, then a springy release */
button, .btn, .card.link, .hero { -webkit-tap-highlight-color: transparent; }
button:active:not(:disabled), .btn:active { transform: scale(.95); transition-duration: .08s; }
button, .btn { transition: transform .45s var(--spring), box-shadow .2s, background-color .2s, opacity .2s; }
.primary { box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 18px 30px -16px rgba(0,0,0,.6); }
.primary:active:not(:disabled) { box-shadow: 0 6px 14px -10px rgba(0,0,0,.6); }

/* cards lean toward your finger */
[data-tilt] { --rx: 0deg; --ry: 0deg; }
.card.link { transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .6s var(--spring), box-shadow .25s; will-change: transform; }
.card.link.tilting { transition: transform .12s linear, box-shadow .25s; }
.card.link:active { transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) scale(.97); transition-duration: .1s; }

/* extruded slab: thin layers stacked behind a face */
.slab { position: relative; transform-style: preserve-3d; }
.slab-sides, .slab-face { position: absolute; inset: 0; border-radius: inherit; transform-style: preserve-3d; }
.slab-sides i { position: absolute; inset: 0; border-radius: inherit; background: var(--side, #B07D00); transform: translateZ(calc(var(--z) * -1.6px)); }
.slab-sides i:last-child { box-shadow: 0 30px 40px -18px rgba(0,0,0,.45); }
.slab-face { display: grid; place-items: center; transform: translateZ(0); }

.hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: inherit; padding: 6px 0 4px; }
.hero-text { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; max-width: 320px; }
.hero-link { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 15px; color: var(--gold); }
.hero-link .chev { color: currentColor; width: 18px; height: 18px; }

/* summary score: a solid yellow block that flips into place */
.score-stage { --rx: 0deg; --ry: 0deg; perspective: 700px; flex: none; }
.slab.score-block { width: 150px; height: 128px; border-radius: 36px; --side: #8C6D3F; transform: rotateX(calc(8deg + var(--rx))) rotateY(calc(-12deg + var(--ry))); transition: transform .9s var(--spring); animation: flipin 1s var(--spring) both; }
.score-stage.tilting .slab.score-block { transition: transform .15s linear; }
.slab.score-block .slab-face { background: #D6C29F; box-shadow: inset 0 2px 0 rgba(255,255,255,.45), inset 0 -8px 20px rgba(110,85,48,.25); }
.score-num { font-family: 'Figtree', sans-serif; font-weight: 800; font-size: 86px; line-height: 1; letter-spacing: -.04em; color: #0E1A2B; padding-top: 4px; font-variant-numeric: tabular-nums; }
.slab.score-block.none .score-num { font-size: 60px; }
.score-num.wide { font-size: 70px; letter-spacing: -.05em; }
@keyframes flipin { from { transform: rotateX(-80deg) rotateY(-12deg) translateY(20px); opacity: 0; } to { transform: rotateX(8deg) rotateY(-12deg); opacity: 1; } }

/* screen changes: slide and settle, like turning a page in depth */
.screen.enter { animation: in .45s var(--ease) both; }
.screen:not(.enter) { animation: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .42s; animation-timing-function: var(--ease); }
::view-transition-old(root) { animation-name: vt-out; }
::view-transition-new(root) { animation-name: vt-in; }
:root[data-nav="back"]::view-transition-old(root) { animation-name: vt-out-back; }
:root[data-nav="back"]::view-transition-new(root) { animation-name: vt-in-back; }
::view-transition-group(*) { animation-duration: .5s; animation-timing-function: var(--spring); }
@keyframes vt-out { to { opacity: 0; transform: translateX(-12%) scale(.96); } }
@keyframes vt-in { from { opacity: 0; transform: translateX(16%) scale(1.02); } }
@keyframes vt-out-back { to { opacity: 0; transform: translateX(14%) scale(1.02); } }
@keyframes vt-in-back { from { opacity: 0; transform: translateX(-12%) scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  .slab.score-block { transform: none !important; }
}

/* soft colour glows behind the page and the hero object */
body::before { content: ''; position: fixed; inset: -20vh -20vw auto; height: 70vh; pointer-events: none; z-index: -1;
  background: radial-gradient(40% 50% at 25% 40%, var(--glow), transparent 70%), radial-gradient(35% 45% at 80% 30%, var(--glow2), transparent 70%); }
body.dark::before { display: none; }
h1, h2 { font-weight: 700; letter-spacing: -.025em; }
h1 { font-size: 36px; }
.primary { box-shadow: 0 14px 28px -14px rgba(0,0,0,.6); font-weight: 600; letter-spacing: .02em; }
.secondary { border-color: var(--line); background: var(--card); }
.card { border: 1px solid color-mix(in srgb, var(--line) 35%, transparent); }
.drive-score { color: var(--sign); }
.icon-btn { border-radius: 999px; background: var(--card); box-shadow: var(--shadow); margin: 0; }
.top .icon-btn.right { margin: 0; }

/* Home hero: the Dial, big, with its needle on your readiness */
.dial-hero { color: var(--gold); display: flex; align-items: center; justify-content: center; gap: 22px; padding: 4px 0; }
.dial-hero .dial { flex: none; filter: drop-shadow(0 14px 24px rgba(0,0,0,.28)); }
:root[data-theme="light"] .dial-hero .dial { filter: drop-shadow(0 10px 18px rgba(14,26,43,.12)); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .dial-hero .dial { filter: drop-shadow(0 10px 18px rgba(14,26,43,.12)); } }
.dial .needle { transform-box: view-box; transform-origin: 36px 50px; transform: rotate(var(--needle)); transition: transform 1.6s cubic-bezier(.2,.9,.25,1.15); }
.dial.start .needle { transform: rotate(72deg); }
.dial-hero .pct { font-weight: 200; font-size: 76px; line-height: 1; color: var(--ink); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.dial-hero .pct small { font-size: 28px; color: var(--gold); font-weight: 300; margin-left: 2px; }
.dial-hero .lbl { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.dial.ready { --needle-color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .dial .needle { transition: none; } }

/* Falling leaves live behind the page */
#leaves { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
main { position: relative; z-index: 1; }
