@import url('https://fonts.googleapis.com/css2?family=Cormorant:ital@1&display=swap');

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Dark base so a page never flashes white before the body::before background image
   loads. Each page also inlines this in <head> (applies on first paint, before this
   stylesheet is fetched). */
html { background-color: #0a0f05; }

:root {
  --primary: #16a34a;
  --primary-dark: #166534;
  --primary-light: #dcfce7;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);
  --transition: .2s ease;
}

body {
  font-family: 'Barlow Condensed', 'Highway Gothic', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  font-synthesis: none;
  letter-spacing: 0.05em;
  isolation: isolate;
  min-height: 100vh; min-height: 100svh; min-height: 100dvh; color: var(--gray-800); line-height: 1.6;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url('Images/Forrest BG Dark.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
  z-index: -1;
  pointer-events: none;
}
/* State-specific backgrounds — body gets a state-<cc> class pre-paint (index.html).
   .state-<cc>::before is more specific than body::before, so it overrides the default forest. */
.state-ca::before { background-image: url('Images/Backgrounds/DL_Beach.webp'); }
.state-fl::before { background-image: url('Images/Backgrounds/DL_Tropical.webp'); }
.state-tx::before { background-image: url('Images/Backgrounds/DL_Shrubland.webp'); }
.state-il::before { background-image: url('Images/Backgrounds/DL_Deciduous.webp'); }
.state-ga::before { background-image: url('Images/Backgrounds/DL_Deciduous.webp'); }
.state-mi::before { background-image: url('Images/Backgrounds/DL_Deciduous.webp'); }
.state-nc::before { background-image: url('Images/Backgrounds/DL_Deciduous.webp'); }
.state-nyc::before { background-image: url('Images/Backgrounds/DL_Coniferous.webp'); }
.state-oh::before { background-image: url('Images/Backgrounds/DL_Grasslands.webp'); }
.state-pa::before { background-image: url('Images/Backgrounds/DL_Coniferous.webp'); }
/* form controls do not inherit font-family by default */
button, input, select, textarea { font-family: inherit; }

/* Brand text — top left, clickable link */
#brand-text { position: fixed; top: 1.2rem; left: calc(1.5rem + 210px); color: #fff; font-size: 1.1rem; letter-spacing: .03em; z-index: 40; text-shadow: 0 1px 6px rgba(0,0,0,.5); pointer-events: auto; cursor: pointer; user-select: none; text-decoration: none; }
#brand-text:hover { opacity: .85; }

/* === WELCOME SCREEN HEADING === */
#welcome-screen h2 { font-size: 2.8rem; margin-bottom: .5rem; letter-spacing: -.02em; }

/* === HEADER - GRAPHIC TITLE (top layer) === */
.header { text-align: center; padding: 0 0 1.5rem; position: relative; overflow: visible; z-index: 30; max-width: 800px; margin: 0 auto; }

/* ── Top Navigation Bar (shared across all pages) ─────────────────────── */
.top-bar { display:flex; align-items:center; justify-content:space-between; padding:.6rem 1.25rem; background:rgba(0,0,0,.6); border-radius:8px; max-width:800px; margin:0 auto; position:relative; z-index:9999; }
.top-bar-brand { display:inline-flex; align-items:center; gap:.45rem; color:#fff; font-size:1.4rem; letter-spacing:.03em; text-decoration:none; transition:opacity .2s ease; pointer-events:auto; cursor:pointer; user-select:none; }
/* Brand logo renders at 100% of its original file size (no scaling) */
.brand-logo { height:auto; width:auto; }
.top-bar-brand .brand-logo { height:26px; width:auto; }
.top-bar-brand:hover { opacity:.85; }
.top-bar-auth { display:flex; align-items:center; gap:.4rem; padding:.35rem .85rem; border-radius:99px; background:rgba(255,255,255,.1); transition:background var(--transition); cursor:pointer; user-select:none; }
.top-bar-auth:hover { background:rgba(255,255,255,.2); }
.top-bar-auth-icon { color:#fff; filter:brightness(0) invert(1); font-size:1rem; line-height:1; display:inline-block; }
.top-bar-auth-label { color:#fff; font-size:.85rem; letter-spacing:.02em; text-shadow:0 1px 3px rgba(0,0,0,.3); white-space:nowrap; }
#lang-current-label { white-space:nowrap; }
.top-bar-admin { display:inline-flex; align-items:center; gap:.35rem; padding:.35rem .65rem; border-radius:99px; background:rgba(255,255,255,.1); color:#fff; font-size:.85rem; letter-spacing:.02em; text-decoration:none; transition:background var(--transition); user-select:none; }
.top-bar-admin .admin-gear { flex-shrink:0; opacity:.95; }
.top-bar-admin:hover { background:rgba(255,255,255,.22); }
.top-bar-right { display:flex; align-items:center; gap:.5rem; }
/* "About" info icon — circle with a lowercase i */
.top-bar-info { display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.1); color:#fff; text-decoration:none; transition:background var(--transition), transform var(--transition); user-select:none; flex-shrink:0; }
.top-bar-info:hover { background:rgba(255,255,255,.22); transform:scale(1.06); }
.top-bar-info.active { background:var(--primary); }
.top-bar-info svg { display:block; }
/* "Leaderboard" crown icon */
.top-bar-crown { display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.1); color:#fff; text-decoration:none; transition:background var(--transition), transform var(--transition); user-select:none; flex-shrink:0; }
.top-bar-crown:hover { background:rgba(255,255,255,.22); transform:scale(1.06); }
.top-bar-crown.active { background:var(--primary); }
.top-bar-crown svg { display:block; }
/* "Buy Me A Coffee" mug icon */
.top-bar-coffee { display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.1); color:#fff; text-decoration:none; transition:background var(--transition), transform var(--transition); user-select:none; flex-shrink:0; }
.top-bar-coffee:hover { background:rgba(255,255,255,.22); transform:scale(1.06); }
.top-bar-coffee.active { background:var(--primary); }
.top-bar-coffee svg { display:block; }
/* "Home" house icon — routes to the user's chosen state page */
.top-bar-home { display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.1); color:#fff; text-decoration:none; transition:background var(--transition), transform var(--transition); user-select:none; flex-shrink:0; }
.top-bar-home:hover { background:rgba(255,255,255,.22); transform:scale(1.06); }
.top-bar-home.active { background:var(--primary); }
.top-bar-home svg { display:block; }
/* Language selector — custom dropdown consistent with the top bar pills */
.top-bar-lang { position:relative; }
.top-bar-lang-btn { display:inline-flex; align-items:center; gap:.4rem; padding:.35rem .85rem; border-radius:99px; background:rgba(255,255,255,.1); color:#fff; font-size:.85rem; letter-spacing:.02em; border:none; cursor:pointer; transition:background var(--transition); user-select:none; }
/* Language button shows a small flag icon instead of written text */
#lang-current-label { display:inline-flex; align-items:center; }
.lang-flag { width:20px; height:14px; border-radius:3px; box-shadow:0 0 0 1px rgba(255,255,255,.3); flex-shrink:0; }
.top-bar-lang-btn:hover { background:rgba(255,255,255,.2); }
.top-bar-lang-btn:focus-visible { outline:2px solid rgba(255,255,255,.6); outline-offset:1px; }
.top-bar-lang-btn svg { flex-shrink:0; opacity:.7; transition:transform .18s ease; }
.top-bar-lang.open .top-bar-lang-btn > svg { transform:rotate(180deg); }
.lang-menu { display:none; position:absolute; top:calc(100% + 8px); right:0; min-width:132px; margin:0; padding:.3rem; list-style:none; background:rgba(15,20,28,.97); border:1px solid rgba(255,255,255,.12); border-radius:12px; box-shadow:0 12px 32px rgba(0,0,0,.45); z-index:10000; }
.top-bar-lang.open .lang-menu { display:block; }
.lang-menu li[role="option"] { display:flex; align-items:center; gap:.5rem; padding:.45rem .7rem; border-radius:8px; color:#fff; font-size:.85rem; letter-spacing:.02em; cursor:pointer; white-space:nowrap; }
.lang-menu li[role="option"]:hover, .lang-menu li[role="option"]:focus { background:rgba(255,255,255,.12); outline:none; }
.lang-menu li[role="option"][aria-selected="true"] { color:#4ade80; font-weight:700; }
.banner-img { width: 800px; max-width: 100%; height: auto; display: block; margin: 0 auto; border-radius: 16px; filter: drop-shadow(0 14px 50px rgba(0,0,0,.9)); }
.header::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, #1b3a29 0%, #1f4d30 40%, #166534 100%); opacity: .06; pointer-events: none; }
.header h1 { font-size: 3.2rem; color: transparent; background: linear-gradient(90deg, #15803d, #7b1fa2, #e91e63); -webkit-background-clip: text; background-clip: text; letter-spacing: -.04em; text-transform: uppercase; position: relative; display: inline-block; padding: .4rem 1.5rem; border-radius: 12px; box-shadow: 0 4px 20px rgba(22,163,74,.3), inset 0 -2px 0 rgba(0,0,0,.1); text-shadow: 0 2px 8px rgba(0,0,0,.25); border: 2px solid rgba(22,163,74,.15); }
.header h1::after { content: 'DRIVER\'S EDUCATION KNOWLEDGE EXAM'; position: absolute; top: 0; left: 0; right: 0; color: transparent; background: linear-gradient(90deg, #ffeb3b, #ffc107); -webkit-background-clip: text; background-clip: text; filter: blur(24px) brightness(1.6); opacity: .5; pointer-events: none; }
.subtitle { color: var(--gray-500); font-size: 1.1rem; margin-top: .8rem; letter-spacing: .08em; text-transform: uppercase; padding: .3rem 1rem; background: rgba(26,35,126,.06); border-radius: 99px; display: inline-block; }

/* === DASHBOARD CONTENT — centered, max-width 899px === */
/* Screen must sit above the header's z-index (30) so the banner's drop-shadow
   does not paint over the welcome heading and dashboard content */
#user-dashboard-screen { position: relative; z-index: 31; }
#dash-content-wrapper { max-width: 800px; margin: 0 auto; padding: 1rem 1.5rem 3rem; text-align: center; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
#dash-content-wrapper h2 { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.5); margin-bottom: .5rem; }
#dash-content-wrapper h3 { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.4); }

/* === SCREENS === */
.screen { display: none; opacity: 0; transform: translateY(16px); transition: opacity .4s ease, transform .4s ease; }
.screen.active { display: block; opacity: 1; transform: translateY(0); }

/* === START EXAM LOGO FLY-THROUGH TRANSITION (extruded 2-slab logo) === */
#logo-transition {
  position: fixed; inset: 0; z-index: 20000;
  display: none; align-items: center; justify-content: center;
  pointer-events: auto; perspective: 1000px;
}
#logo-transition.active { display: flex; }

/* Darken layer — fades independently so the logo itself never becomes translucent.
   The road-sign collage fades in with it, so the screen swap still dissolves (no pop)
   while the screen fills with signs instead of plain black. */
#logo-transition::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: rgba(0, 0, 0, .85); opacity: 0; transition: opacity .6s ease;
}
#logo-transition.dark::before { opacity: 1; }

/* Road-sign backdrop — a single full-screen image (Images/RoadSignBG.png) that fades UP
   once while the logo flies in (random --lt-in-dur, set inline), holds at full opacity
   through the center pause, then fades OUT once when the logo flies out (random --lt-out-dur). */
#logo-transition .lt-bg {
  position: absolute; inset: 0; z-index: 0;
  opacity: 0;
  transition: opacity var(--lt-out-dur, .8s) ease;
}
#logo-transition.dark .lt-bg {
  opacity: 1;
  transition: opacity var(--lt-in-dur, .8s) ease;
}
#logo-transition .lt-bg img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
@media (prefers-reduced-motion: reduce) {
  #logo-transition .lt-sign { transition: none; }
}

/* The stack is the unit that moves/rotates: front image + masked slabs behind.
   JS sets exact off-screen start/end transforms inline before first paint; base value is a no-JS fallback */
#logo-transition .lt-stack {
  position: relative; display: inline-block; transform-style: preserve-3d;
  transform: translateX(-75vw) rotateY(45deg);
  transition: transform 1s cubic-bezier(.45, .05, .55, .95); will-change: transform;
}

#logo-transition .lt-stack img { display: block; height: 100vh; height: 100svh; height: 100dvh; width: auto; }

/* Thickness: 2 alpha-masked slabs stepped back 1px each in Z (built by JS) */
#logo-transition .lt-slab {
  position: absolute; inset: 0; background: #2f3439;
  -webkit-mask-image: url('Images/ClayLogoClean.png'); mask-image: url('Images/ClayLogoClean.png');
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
#logo-transition .lt-slab.lt-back { background: #1b1f24; }

/* === CARDS === */
.card, .question-card, .results-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); text-align: center;
  padding: 2.5rem; max-width: 720px; margin: 1.5rem auto; animation: fadeUp .45s ease both;
}
/* Landing page: welcome card spans the full 800px content column */
.card { max-width: 800px; }

/* Welcome card sits directly on the forest background — no white box, radius or shadow */
#welcome-screen .card {
  background: transparent; border-radius: 0; box-shadow: none;
  margin-top: .4rem; padding: .5rem 1.5rem .75rem;
}
/* Blue street-sign panel behind the welcome content (matches .sign-blue titles) */
#welcome-screen .clay-card-body {
  --sign-bg: #0048A9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .45rem;
  background: var(--sign-bg); color: #fff; border-radius: 10px;
  padding: 1.6rem 2.2rem;
  box-shadow: inset 0 0 0 3px var(--sign-bg), inset 0 0 0 5px rgba(255,255,255,.9), 0 3px 12px rgba(0,0,0,.4);
}
#welcome-screen .clay-card-body h2 { font-size: 3rem; color: #fff; font-style: italic; margin-bottom: .45rem; text-shadow: 2px 3px 0 rgba(0,0,0,.95); }
#welcome-screen .clay-card-body p { font-size: 1.4rem; line-height: 1.4; color: rgba(255,255,255,.95); text-shadow: 1px 2px 0 rgba(0,0,0,.9); }
#welcome-screen .clay-card-body label { font-size: 1.25rem; margin-top: .7rem; margin-bottom: .35rem; color: #fff; text-shadow: 1px 2px 0 rgba(0,0,0,.9); }
#welcome-screen .clay-card-body input[type="text"] { padding: .7rem 1.1rem; font-size: 1.2rem; color: #fff; background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.45); }
#welcome-screen .clay-card-body input[type="text"]::placeholder { color: rgba(255,255,255,.6); }
#welcome-screen .clay-card-body input[type="text"]:focus { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
#welcome-screen .clay-card-body .quiz-length-selector { flex-wrap: nowrap; gap: .6rem; margin-top: .9rem; }
/* Length + Start buttons — street-sign design language (Flashcards/Lessons/Scenarios) */
#welcome-screen .clay-card-body .length-btn,
#welcome-screen .clay-card-body #start-exam-btn {
  --sign-bg: #1a5d2a;
  border: none; border-radius: 10px; color: var(--gray-800);
  font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  transition: transform .2s ease, box-shadow .2s ease;
}
#welcome-screen .clay-card-body .length-btn {
  padding: .7rem 1.6rem; font-size: 1.05rem; background: var(--gray-900); color: var(--gray-500); cursor: pointer;
  /* dark gray button with the dimmed sign line (inverted frame) */
  box-shadow: inset 0 0 0 4px var(--gray-900), inset 0 0 0 6px rgba(255,255,255,.4), 0 4px 16px rgba(0,0,0,.45);
}
#welcome-screen .clay-card-body .length-btn:hover { transform: scale(1.05); }
#welcome-screen .clay-card-body .length-btn.active {
  /* selected: green sign button with white line around the edge */
  background: var(--sign-bg); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.4);
  box-shadow: inset 0 0 0 4px var(--sign-bg), inset 0 0 0 6px rgba(255,255,255,.9), 0 4px 16px rgba(0,0,0,.45);
}
#welcome-screen .clay-card-body #start-exam-btn {
  padding: .85rem 2.2rem; font-size: 1.3rem; margin-top: 1rem; cursor: pointer;
  background: var(--sign-bg); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.4);
  box-shadow: inset 0 0 0 4px var(--sign-bg), inset 0 0 0 6px rgba(255,255,255,.9), 0 4px 16px rgba(0,0,0,.45);
}
#welcome-screen .clay-card-body #start-exam-btn:hover { transform: scale(1.05); box-shadow: inset 0 0 0 4px var(--sign-bg), inset 0 0 0 6px rgba(255,255,255,.9), 0 6px 20px rgba(0,0,0,.55); }


@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* === EXAM INFO GRID === */
.exam-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin: 1.2rem 0 1.6rem; }
.info-item { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: .75rem 1rem; text-align: center; font-size: .9rem; color: var(--gray-600); transition: transform var(--transition), box-shadow var(--transition); }
.info-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.info-item .icon { display: block; font-size: 1.3rem; margin-bottom: .2rem; }

/* === FORM ELEMENTS === */
label { display: block; color: var(--gray-700); margin-bottom: .4rem; margin-top: 1rem; }
input[type="text"] { width: 100%; padding: .85rem 1rem; border: 2px solid var(--gray-200); border-radius: 8px; font-size: 1rem; transition: border-color var(--transition), box-shadow var(--transition); }
input[type="text"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* === QUIZ LENGTH SELECTOR === */
.quiz-length-selector { display: flex; gap: .6rem; margin-top: 1.2rem; justify-content: center; }
.length-btn { padding: .65rem 1.4rem; font-size: .95rem; border: 2px solid var(--gray-200); border-radius: 99px; background: var(--gray-50); color: var(--gray-600); cursor: pointer; transition: all var(--transition); }
.length-btn:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-light); }
.length-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 10px rgba(37,99,235,.3); }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .75rem 1.8rem; font-size: 1rem; border: none; border-radius: 8px; cursor: pointer; transition: background var(--transition), transform var(--transition), box-shadow var(--transition); user-select: none; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-large { padding: 1rem 2.4rem; font-size: 1.15rem; border-radius: 10px; margin-top: 1.5rem; }
#start-exam-btn { margin-bottom: .8rem; }

/* === LEADERBOARD STYLES === */
.leaderboard-preview { max-width: 800px; margin: 1.5rem auto; padding: 0 .5rem; text-align: center; }
.leaderboard-preview h3 { font-size: 1.6rem; margin-bottom: 1rem; color: var(--gray-800); letter-spacing: -.02em; }
.mini-leader-table, .leader-table { width: 100%; max-width: 800px; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 6px 28px rgba(34,85,17,.45), 0 2px 8px rgba(34,85,17,.25); text-align: left; font-size: 1.05rem; }
/* Identical column spacing/positioning across all Top Leaders tables (content no longer shifts the borders) */
.mini-leader-table, .leader-table { table-layout: fixed; }
.mini-leader-table th:nth-child(1), .leader-table th:nth-child(1) { width: 8%; }
.mini-leader-table th:nth-child(2), .leader-table th:nth-child(2) { width: 44%; }
.mini-leader-table th:nth-child(3), .leader-table th:nth-child(3) { width: 24%; }
.mini-leader-table th:nth-child(4), .leader-table th:nth-child(4) { width: 24%; }
.mini-leader-table th, .mini-leader-table td, .leader-table th, .leader-table td { padding: .7rem 1.1rem; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.leader-table thead tr { background: var(--primary); color: #fff; }
.leader-table thead th { padding: .75rem 1.1rem; font-size: 1rem; letter-spacing: .03em; text-transform: uppercase; }
.mini-leader-table tbody tr:hover, .leader-table tbody tr:hover { background: var(--gray-50); cursor: default; transition: background .15s ease; }
/* Circle graphics removed for cleaner rank display */
.leader-table tbody td:first-child { text-align: center; color: var(--primary-dark); min-width: 42px; }
.mini-leader-table thead, .leader-table thead { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.leaderboard-section { margin-bottom: 2.5rem; text-align: center; max-width: 800px; margin-left: auto; margin-right: auto; }
.leaderboard-section h3 { font-size: 1.6rem; margin-bottom: .8rem; color: #fff !important; letter-spacing: -.02em; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
#leaderboard-screen { padding-bottom: 4rem; position: relative; z-index: 40; }
/* Tighten the gap between the header banner and the leaderboard title */
#app:has(#leaderboard-screen.active) .header { padding-bottom: .25rem; }
#leaderboard-screen h2 { font-size: 3rem; margin-top: 0; margin-bottom: .5rem; text-align: center; letter-spacing: .04em; color: #fff; text-shadow: 0 3px 16px rgba(0,0,0,.5); }
#leaderboard-screen p { text-align:center; color:#fff; margin-bottom:1.5rem; opacity:.92; }

/* === LANDING PAGE — INTERACTIVE LESSONS BOX (between exam card and leaderboards) === */
.landing-flashcards { position: relative; max-width: 800px; margin: .6rem auto 0; padding: 1.6rem 2rem; background: rgba(0, 0, 0, .6); border-radius: var(--radius); text-align: center; box-shadow: 0 6px 28px rgba(34,85,17,.45), 0 2px 8px rgba(34,85,17,.25); }
.landing-flashcards p { color: #fff; font-size: 1.4rem; margin-bottom: 1.1rem; text-shadow: 0 2px 10px rgba(0,0,0,.4); letter-spacing: .01em; }
.landing-fc-actions { display: flex; justify-content: center; align-items: center; gap: .9rem; flex-wrap: wrap; }

/* Decorative stars — three per side of the text/buttons.
   The star nearest the center of each side is the largest;
   script.js gives each a random clockwise/counter-clockwise tilt. */
.fc-star { position: absolute; background: url('Images/Star/DL_Star_Silver_5.webp') center / contain no-repeat; pointer-events: none; user-select: none; animation: fcSpin 8s linear infinite; }
@keyframes fcSpin { to { transform: rotate(360deg); } }
.fc-star.fc-lg { width: 98px; height: 98px; }
.fc-star.fc-md { width: 63px; height: 63px; }
.fc-star.fc-sm { width: 43px; height: 43px; }
.fc-star.l1 { top: 8%; left: 3.5%; }
.fc-star.l2 { top: 50%; left: 7%; margin-top: -39px; }   /* vertically centered */
.fc-star.l3 { bottom: 6%; left: 17%; }
.fc-star.r1 { top: 8%; right: 3.5%; }
.fc-star.r2 { top: 50%; right: 7%; margin-top: -39px; }  /* vertically centered */
.fc-star.r3 { bottom: 6%; right: 17%; }
@media (max-width: 640px) { .fc-star { display: none; } }
.landing-continue-cta { display: inline-block; margin-top: 1rem; color: #dcead0; font-size: 1.05rem; letter-spacing: .02em; text-decoration: none; border-bottom: 1px dashed rgba(220, 234, 208, .5); transition: opacity var(--transition), border-color var(--transition); }
.landing-continue-cta:hover { opacity: .85; border-bottom-style: solid; }

/* === LANDING PAGE — DRIVING FUN FACTS BOX (between learning tools and leaderboards) === */
.landing-fun-facts { position: relative; max-width: 800px; margin: 1.4rem auto 0; text-align: center; }
.ff-wrap { position: relative; }
.ff-card { background: rgba(0, 0, 0, .6); border-radius: 12px; padding: 1.1rem 2.8rem; }
.ff-tag { display: inline-block; margin-bottom: .6rem; padding: .15rem .8rem; border-radius: 999px; background: rgba(255,255,255,.14); color: #cfe0ff; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.ff-text { color: #fff; font-size: 1.15rem; line-height: 1.55; font-family: 'Cormorant', serif; font-style: italic; margin: 0 0 .8rem; text-shadow: 0 2px 10px rgba(0,0,0,.4); min-height: 3.4em; transition: opacity .8s ease; }
.ff-counter { color: rgba(255,255,255,.6); font-size: .9rem; letter-spacing: .04em; }
/* Small left/right arrows flanking the card */
.ff-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; padding: 0; border: none; background: none; color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .2s ease, color .2s ease; z-index: 2; }
.ff-arrow:hover { color: #6ea8ff; transform: translateY(-50%) scale(1.12); }
.ff-arrow-left { left: 0; }
.ff-arrow-right { right: 0; }
@media (max-width: 480px) {
  .ff-arrow { width: 24px; height: 24px; font-size: .9rem; }
  .ff-card { padding: 1rem 2.4rem; }
}

/* === LANDING PAGE MINI LEADERBOARDS === */
.landing-leaderboards { max-width: 800px; margin: 1.8rem auto 3rem; padding: 0 .5rem 2rem; text-align: center; display: flex; flex-direction: column; gap: 2rem; }
.landing-lb-section table th, .landing-lb-section table td { padding-left: 2.4rem !important; text-align: left !important; }
.landing-lb-section h3 { font-size: 1.6rem; margin-bottom: .7rem; color: #fff; letter-spacing: -.01em; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
/* Leaderboard section headers — blue street sign look (color from Images/SignBlue.png) */
.landing-lb-section h3.sign-blue, .leaderboard-section h3.sign-blue {
  display: inline-block; margin: 0 auto .7rem; padding: .5rem 1.8rem;
  background: var(--sign-bg); color: #fff; border-radius: 10px;
  font-size: 1.35rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  box-shadow: inset 0 0 0 3px var(--sign-bg), inset 0 0 0 5px rgba(255,255,255,.9), 0 3px 12px rgba(0,0,0,.4);
}
/* 60% black tables with white text (landing page only) */
.landing-lb-section .mini-leader-table { background: rgba(0, 0, 0, .6); }
.landing-lb-section .mini-leader-table thead { background: rgba(0, 0, 0, .6); }
.landing-lb-section .mini-leader-table th, .landing-lb-section .mini-leader-table td { color: #fff; border-bottom-color: rgba(255, 255, 255, .15); }
.landing-lb-section .mini-leader-table tbody tr:hover { background: rgba(255, 255, 255, .08); }
/* Street sign buttons — street sign style (View Full Leaderboard + lesson buttons) */
.street-sign-btn {
  --sign-bg: #1a5d2a; /* green by default; overridden by .sign-blue */
  background: var(--sign-bg); color: #fff; border: none; border-radius: 10px;
  padding: .8rem 2.4rem; font-size: 1.15rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; text-shadow: 0 1px 3px rgba(0,0,0,.4);
  /* single inner white frame: sign-color gap at the edge, then one white line */
  box-shadow: inset 0 0 0 4px var(--sign-bg), inset 0 0 0 6px rgba(255,255,255,.9), 0 4px 16px rgba(0,0,0,.45);
  transition: transform .2s ease, box-shadow .2s ease;
}
.street-sign-btn:hover {
  background: var(--sign-bg); color: #fff;
  transform: scale(1.08) rotate(-5deg);
  box-shadow: inset 0 0 0 4px var(--sign-bg), inset 0 0 0 6px rgba(255,255,255,.9), 0 6px 20px rgba(0,0,0,.55);
}
/* Blue variant — color sampled from Images/SignBlue.png */
.sign-blue { --sign-bg: #0048A9; }
.landing-lb-full-btn { align-self: center; margin-top: .5rem; }
/* Lesson buttons (Flashcards / Lessons / Scenarios) — same sign style, sized for the row */
.landing-fc-actions .street-sign-btn { font-size: 1.05rem; padding: .65rem 1.8rem; margin: .2rem; }
/* Off-state sign button — the welcome length-buttons' inactive look; secondary actions */
.sign-off-btn {
  background: var(--gray-900); color: var(--gray-500); border: none; border-radius: 10px;
  padding: .8rem 2.4rem; font-size: 1.15rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  box-shadow: inset 0 0 0 4px var(--gray-900), inset 0 0 0 6px rgba(255,255,255,.4), 0 4px 16px rgba(0,0,0,.45);
}
.sign-off-btn:hover { color: #fff; box-shadow: inset 0 0 0 4px var(--gray-900), inset 0 0 0 6px rgba(255,255,255,.75), 0 6px 20px rgba(0,0,0,.55); }

/* === FULL LEADERBOARD SCREEN — match landing page dark (60% black) tables === */
#leaderboard-screen .leader-table { background: rgba(0, 0, 0, .6); }
#leaderboard-screen .leader-table thead, #leaderboard-screen .leader-table thead tr { background: rgba(0, 0, 0, .6); }
#leaderboard-screen .leader-table th, #leaderboard-screen .leader-table td { color: #fff; border-bottom-color: rgba(255, 255, 255, .15); }
#leaderboard-screen .leader-table tbody tr:hover { background: rgba(255, 255, 255, .08); }
#leaderboard-screen .leader-table tbody td:first-child { color: #fff; }
/* Full board shows ~10 rows at a time; scroll for the rest (header stays put) */
#leaderboard-screen .lb-scroll { max-height: 33.5rem; overflow-y: auto; border-radius: var(--radius); box-shadow: 0 6px 28px rgba(34,85,17,.45), 0 2px 8px rgba(34,85,17,.25); }
#leaderboard-screen .lb-scroll .leader-table { box-shadow: none; max-width: none; }
#leaderboard-screen .leader-table thead th { position: sticky; top: 0; z-index: 2; background: #0d2812; }
/* Dark scrollbars so board overflow blends with the dark tables */
#leaderboard-screen .lb-scroll { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; }
#leaderboard-screen .lb-scroll::-webkit-scrollbar { width: 10px; }
#leaderboard-screen .lb-scroll::-webkit-scrollbar-track { background: transparent; }
#leaderboard-screen .lb-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
#leaderboard-screen .lb-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5); border: 2px solid transparent; background-clip: padding-box; }
/* Signed-in user's pinned row — highlighted, real rank shown in # */
#leaderboard-screen .leader-table tbody tr.lb-you-row { background: rgba(74,222,128,.16); }
#leaderboard-screen .leader-table tbody tr.lb-you-row:hover { background: rgba(74,222,128,.24); }
#leaderboard-screen .lb-you-badge { display: inline-block; margin-left: .5rem; padding: .1rem .55rem; border-radius: 99px; background: rgba(74,222,128,.25); color: #86efac; font-size: .65rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; }

/* === QUIZ SCREEN — shifted down 100px (top nav bar stays in place) === */
#quiz-screen { padding-top: 100px; padding-bottom: 200px; }

/* === PROGRESS BAR (image-based) with decorative images above/below === */
.progress-bar-container { position: relative; z-index: 40; background: transparent; padding: 0; display: flex; align-items: center; gap: 1.2rem; }
.above-progress, .below-progress { position: absolute; left: 0; width: 100%; object-fit: contain; pointer-events: none; z-index: 1; }
.above-progress { bottom: 100%; margin-bottom: 0; }
.below-progress { top: 100%; margin-top: 0; -webkit-mask-image: linear-gradient(to bottom, black 75%, transparent 100%); mask-image: linear-gradient(to bottom, black 75%, transparent 100%); }
.progress-bar { flex: 1; height: 64px; background-image: url('Images/ProgressBar.png'); background-size: cover; background-repeat: no-repeat; background-position: center; overflow: visible !important; position: relative; z-index: 2; }
/* Progress percentage — speed-limit sign image with only the number swapped.
   Lives in #quiz-screen (not .progress-bar-container) so its z-index can exceed
   .question-card's 50 and stay on the topmost layer. */
.progress-text { position: absolute; top: 190px; left: calc(60% + 200px); z-index: 60; width: 180px; height: 228px; background: url('Images/SpeedLimit.png') no-repeat center / 100% 100%; filter: drop-shadow(0 4px 10px rgba(0,0,0,.45)); pointer-events: none; }
.progress-text .speed-number { position: absolute; left: 7%; right: 7%; top: calc(52% - 40px); bottom: 6%; display: flex; align-items: center; justify-content: center; text-align: center; font-family: 'Arial Black', Arial, sans-serif; color: #1a1a1a; font-size: 66px; line-height: 1; }

/* === CAR ICON - sits on top of road, faces left→right, enlarged === */
.car-icon { position: absolute; top: -49px; left: calc(var(--car-pct, 0%) + 32px); width: 166px; height: 114px; background-repeat: no-repeat; background-position: center center; background-size: contain; transition: left .5s ease; z-index: 6; pointer-events: none; filter: drop-shadow(0 3px 8px rgba(0,0,0,.5)); }

/* === CATEGORY BADGE (centered) === */
.category-badge { display: inline-block; background: var(--primary-light); color: var(--primary-dark); font-size: .8rem; padding: .35rem .9rem; border-radius: 99px; margin: 0 auto 1rem; text-transform: uppercase; letter-spacing: .04em; }

/* === QUESTION CARD === */
/* z-index must exceed .progress-bar-container (40) so the card stays above its decorative graphics */
.question-card { padding: 2.5rem 3rem; position: relative; z-index: 50; transform: translateY(-20px); }
.question-text { color: var(--gray-800); font-size: 1.25rem; margin-bottom: 1.5rem; line-height: 1.55; }
.nb { white-space: nowrap; }

/* --- STREET SIGN NUMBERING (various styles cycle through) --- */
.q-number { display: flex; align-items: center; justify-content: center; min-height: 120px; font-size: 4.5rem; letter-spacing: -.02em; margin-bottom: .5rem; background: url('Images/QuestionStreetSign.png') no-repeat center / 100% 100%; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.45); transition: transform .3s ease; }
.q-number:hover { transform: scale(1.05) rotate(-2deg); }
.q-number .q-num { transform: translate(150px, -5px); }

/* Highway shield (dark green rectangle, white text) */
.sign-highway { font-size: 4.5rem; background: #166534; color: #fff; padding: .3em .55em; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.2), inset 0 -2px 0 rgba(0,0,0,.15); }

/* Stop sign (red octagon shape via clip-path) */
.sign-stop { font-size: 4rem; background: #c0392b; color: #fff; padding: .3em .6em; clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%); box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* Warning sign (yellow diamond) */
.sign-warning { font-size: 4rem; background: #f39c12; color: #1a1a1a; padding: .3em .6em; clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); box-shadow: 0 2px 8px rgba(0,0,0,.2); }

/* Directional sign (green rectangle - like highway exit signs) */
.sign-directional { font-size: 4.2rem; background: #1e8449; color: #fff; padding: .3em .6em; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.2), inset 0 -2px 0 rgba(0,0,0,.15); font-family: 'Arial Black', sans-serif; }

/* Speed limit sign (white oval/circle with red ring) */
.sign-speed { font-size: 3.8rem; background: #fff; color: #1a1a1a; padding: .2em .45em; border-radius: 50%; border: 5px solid #c0392b; box-shadow: 0 2px 8px rgba(0,0,0,.2); }

.options-container { display: flex; flex-direction: column; gap: .65rem; }
.option-btn { background: var(--gray-50); border: 2px solid var(--gray-300); border-radius: 12px; padding: 1.05rem 1.4rem; text-align: left; font-size: 1.15rem; font-weight: 600; color: var(--gray-800); cursor: pointer; transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform .15s ease; line-height: 1.55; }
.option-btn:hover { border-color: var(--primary); background: #f0f4ff; transform: translateX(4px); }
.option-btn.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* === NAV BUTTONS === */
.nav-buttons { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; max-width: 720px; margin-left: auto; margin-right: auto; padding: 0 .5rem; }

/* Image nav buttons (Previous / Stop / Next) */
.btn-stop, .btn-nav { width: 224px; height: 224px; padding: 0; border-radius: 24px; background: transparent; overflow: visible; }
.btn-stop img, .btn-nav img { width: 192px; height: 192px; object-fit: contain; filter: brightness(.8); transition: filter var(--transition), transform var(--transition); }
.btn-stop:hover img, .btn-nav:hover img { filter: brightness(1); }
#btn-stop:hover img, #btn-next:hover img { transform: scale(1.1) rotate(-15deg); }
.btn-stop:active, .btn-nav:active { transform: none; }
.btn-stop:active img, .btn-nav:active img { transform: translate(3px, 3px) rotate(-10deg); }

/* === RESULTS SCREEN === */
/* Dark forest surface (matches .review-item) so the results card blends with the site instead of a white box */
.results-card { text-align: center; background: rgba(10,31,8,.75); color: #fff; }
/* Pass/fail wordmark lives in the header banner image — no title text on the card */
#result-title { display: none; }
#results-screen { padding-bottom: 3rem; }
.score-display { font-size: 5.75rem; line-height: 1; margin: .8rem 0; letter-spacing: -.03em; font-weight: 800; }
.score-total { font-size: 2.25rem; color: rgba(255,255,255,.7); vertical-align: middle; font-weight: 700; }
#result-message { font-size: 1.05rem; color: rgba(255,255,255,.9); margin-bottom: 2rem; }
#result-callout { display: none; justify-content: center; align-items: center; gap: .5rem; flex-wrap: wrap; margin: -0.8rem auto 1rem; }
.result-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .85rem; border-radius: 99px; font-size: .82rem; font-weight: 700; letter-spacing: .01em; animation: popIn2 .5s cubic-bezier(.34,1.56,.64,1) both; }
.result-badge.best { background: rgba(34,197,94,.16); color: #86efac; border: 1px solid rgba(34,197,94,.50); }
.result-badge.delta-up { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.40); }
.result-badge.delta-down { background: rgba(220,38,38,.16); color: #ff6b8a; border: 1px solid rgba(220,38,38,.50); }
@keyframes popIn2 { from { opacity: 0; transform: scale(.6) translateY(6px); } to { opacity: 1; transform: none; } }

/* === CATEGORIES GRID === */
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: .85rem; margin-top: 1.5rem; text-align: left; }
.cat-row { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-radius: 10px; padding: 1rem 1.2rem; display: flex; align-items: center; gap: .8rem; transition: transform var(--transition), box-shadow var(--transition); }
.cat-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cat-name { flex: 1; font-size: .9rem; color: rgba(255,255,255,.9); line-height: 1.35; }
.cat-bar-track { width: 80px; height: 6px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; flex-shrink: 0; }
.cat-bar-fill { height: 100%; border-radius: 99px; transition: width .8s ease; }
.cat-score { font-size: .85rem; min-width: 42px; text-align: right; }

/* === REVIEW SCREEN === */
#review-title { text-align: center; color: #fff; font-size: 2.5rem; margin-bottom: 1rem; letter-spacing: .04em; }
.review-container { max-width: 720px; margin: 1.5rem auto; display: flex; flex-direction: column; gap: 1rem; padding-bottom: 1rem; }
.review-item { background: rgba(10,31,8,.65); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 1.3rem 1.5rem; text-align: center; animation: fadeUp .4s ease both; color: #fff; }
.review-question { color: #fff; margin-bottom: .6rem; font-size: 1rem; }
.review-your-answer { color: #ff6b8a; font-size: .9rem; margin-bottom: .25rem; }
.review-correct { color: #86efac; font-size: .9rem; }

/* === ACTION BUTTONS === */
.action-buttons { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; max-width: 720px; margin: 1.5rem auto; padding: 0 .5rem; }
#btn-review { min-width: 240px; }
#btn-retake { min-width: 180px; }

/* === CONFETTI CANVAS (behind all content) === */
#confetti-canvas { position: fixed; top: 0; left: 0; width: 100vw; width: 100svw; width: 100dvw; height: 100vh; height: 100svh; height: 100dvh; z-index: 1; pointer-events: none; }

/* === BALLOONS (behind all content) === */
#balloons-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; z-index: 2; }


.balloon { position: absolute; bottom: -120px; width: 56px; height: 74px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; animation: floatUp linear forwards; filter: drop-shadow(0 2px 6px rgba(0,0,0,.18)); }
.balloon::after { content: ''; position: absolute; bottom: -36px; left: 50%; transform: translateX(-50%); width: 1.5px; height: 36px; background: var(--gray-400); opacity: .6; }
@keyframes floatUp { 0% { bottom: -120px; transform: translateX(0) rotate(0deg); } 50% { transform: translateX(18px) rotate(3deg); } 100% { bottom: 110vh; transform: translateX(-12px) rotate(-3deg); } }

/* === THUMBS OVERLAY — full-screen transparent video over everything when the exam ends.
   JS keyframes a .thumbs-stage transform (video + sleeve ride it together): off-screen right →
   resting position (gesture near center) → hold → back off-screen right === */
#thumbs-overlay { position: fixed; inset: 0; z-index: 20000; }
#thumbs-overlay .thumbs-stage { position: absolute; inset: 0; will-change: transform; }
#thumbs-overlay video { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumbs-sleeve { position: absolute; pointer-events: none; }

/* === STAR BURST (pass results) — shoots out from behind the hand, below the thumbs overlay === */
#star-burst { position: fixed; inset: 0; z-index: 19000; pointer-events: none; overflow: hidden; }
.star-fly { position: absolute; will-change: transform, opacity; opacity: 0; animation: starShoot var(--dur, 3s) cubic-bezier(.17,.67,.4,1) var(--delay, 0s) forwards; }
@keyframes starShoot {
  0% { transform: translate(-50%,-50%) scale(.15) rotate(0deg); opacity: 0; }
  12% { opacity: 1; }
  78% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(var(--sc, 1)) rotate(var(--spin, 360deg)); opacity: 0; }
}

/* === PASS OVERLAY TEXT === */
.pass-overlay { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10000; pointer-events: none; animation: popIn .6s cubic-bezier(.34,1.56,.64,1) forwards; opacity: 0; }
.pass-overlay h2 { font-size: 5rem; color: #fff; text-shadow: 0 4px 30px rgba(0,0,0,.3); letter-spacing: .08em; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.4); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .card, .question-card, .results-card { margin: 1rem; padding: 1.5rem; }
  .header h1 { font-size: 1.4rem; }
  .score-display { font-size: 4.25rem; }
  .categories-grid { grid-template-columns: 1fr; }
  .exam-info { grid-template-columns: repeat(2, 1fr); }

  /* Top bar — compact pills + wrap so items never overlap on narrow phones */
  .top-bar { flex-wrap: wrap; row-gap: .3rem; padding: .5rem .75rem; }
  .top-bar-brand { font-size: 1.05rem; }
  .top-bar-brand .brand-logo { height: 20px; }

  /* Landing page — compact chrome + panels on narrow phones */
  .landing-chrome { padding: .6rem .75rem; }
  .landing-brand { font-size: 1.1rem; }
  .landing-brand .brand-logo { height: 22px; }
  #landing-main { padding: .25rem .9rem 3.5rem; }
  .landing-hero h1 { font-size: 2.3rem; }
  .landing-hero p { font-size: 1.15rem; margin-bottom: 1.4rem; }
  .landing-panel { padding: 1.2rem 1rem 1.4rem; }
  .landing-panel h2 { font-size: 1.55rem; }
  .landing-select { max-width: 100%; }
  .top-bar-right { flex-wrap: nowrap; gap: .4rem; }
  .top-bar-info, .top-bar-home, .top-bar-crown, .top-bar-coffee { width: 30px; height: 30px; }
  .top-bar-auth, .top-bar-admin, .top-bar-lang-btn { padding: .3rem .65rem; font-size: .8rem; }

  /* Auth modal tabs — keep the 3-tab row on one line */
  .tab-btn { font-size: .82rem; padding: .5rem 0; }

  /* Welcome card — stack the exam-length sign buttons so they fit narrow screens */
  #welcome-screen .clay-card-body .quiz-length-selector { flex-wrap: wrap; width: 100%; }
  #welcome-screen .clay-card-body .length-btn { width: min(230px, 100%); padding: .65rem 1.2rem; font-size: .95rem; }
  #welcome-screen .clay-card-body #start-exam-btn { width: min(230px, 100%); font-size: 1.15rem; padding: .8rem 1.6rem; }

  /* Achievement hover tooltips are mouse-only — hide them so card edges stay on-screen */
  .achievement-card[data-details]::after, .achievement-card[data-details]::before { display: none; }
}

/* === UTILITY ANIMATIONS === */
@keyframes shakeIn { 0%{transform:translateX(-4px)} 25%{transform:translateX(4px)} 50%{transform:translateX(-3px)} 75%{transform:translateX(2px)} 100%{transform:none} }
@keyframes celebrateBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

/* === JKW FOOTER LOGO (all pages) — pinned to the very bottom of the browser window at any size, 15px from the left edge; no auto-scale, right side runs off-page on narrow screens === */
.jkw-footer { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: flex-start; z-index: 950; pointer-events: none; opacity: .85; }
.jkw-footer img { display: block; height: 26px; width: auto; margin: 0 0 0 15px; filter: grayscale(1) brightness(.5); }
/* Continues the greyscale bar (SVG Layer_2, #b02c2c → #484848 → #242424 at 50% brightness) from the image's right edge to the viewport's right edge at any window width */
.jkw-footer::after { content: ''; position: absolute; left: 1201px; right: 0; top: 0; bottom: 0; background: #242424; clip-path: polygon(6.5px 0, 100% 0, 100% 100%, 0 100%); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* USER ACCOUNT SYSTEM — Auth Modal, Dashboard UI, Achievements, Car Selector
   Implemented per USER_ACCOUNT_SYSTEM.md Sections 6.2–6.7 + Phases 3–8     */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ── Auth Modal (Section 6.2) ─────────────────────────────────────────────── */
.modal-overlay { position:fixed; top:0; left:0; width:100vw; width:100svw; width:100dvw; height:100vh; height:100svh; height:100dvh; background:rgba(0,0,0,.55); z-index:9998; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(3px); }
.modal-content { position:relative; background:#fff; border-radius:16px; padding:2.5rem 2rem; box-shadow:var(--shadow-lg); max-width:400px; width:92%; animation:fadeUp .3s ease both; color:var(--gray-800); }
.modal-sm { min-height:auto; }
.modal-close { position:absolute; top:.75rem; right:.85rem; background:none; border:none; font-size:1.6rem; cursor:pointer; color:var(--gray-400); padding:.2rem .5rem; border-radius:8px; transition:background var(--transition),color var(--transition); }
.modal-close:hover { background:var(--gray-100); color:var(--gray-700); }

/* Tab switching */
.modal-tabs { display:flex; gap:.25rem; margin-bottom:1.5rem; border-radius:10px; overflow:hidden; border:1px solid var(--gray-200); background:var(--gray-100); padding:3px; }
.tab-btn { flex:1; padding:.6rem 0; font-size:.95rem; text-align:center; cursor:pointer; border:none; background:transparent; color:var(--gray-500); white-space:nowrap; transition:background var(--transition),color var(--transition); }
.tab-btn.active { background:#fff; color:var(--primary-dark); box-shadow:var(--shadow-sm); }

.modal-content input[type="text"],
.modal-content input[type="password"] { width:100%; padding:.7rem 1rem; margin-bottom:.75rem; border-radius:9px; border:1.5px solid var(--gray-200); font-size:1rem; transition:border-color var(--transition),box-shadow var(--transition); }
.modal-content input:focus { outline:none; border-color:#8b5cf6; box-shadow:0 0 0 3px rgba(139,92,246,.15); }

/* ── Toast Notifications (Section 6.7) ────────────────────────────────────── */
#toast-container { position:fixed; bottom:1.5rem; right:1.5rem; z-index:99999; display:flex; flex-direction:column-reverse; gap:.5rem; pointer-events:none; }
.toast { padding:.75rem 1.25rem; border-radius:10px; color:#fff; font-size:.95rem; box-shadow:var(--shadow-md); animation:toastIn .3s ease both; pointer-events:auto; max-width:420px; background:#334155; }
.toast-success { background:#16a34a; }
.toast-error { background:#dc2626; }
.toast-info { background:#334155; }
.toast.success { background:#16a34a; }
.toast.info    { background:#6366f1; }
@keyframes toastIn  { from{opacity:0;transform:translateY(12px) scale(.95)} to{opacity:1; transform:none} }

/* ── User Dashboard (Section 6.3 & 6.4) ───────────────────────────────────── */
#user-dashboard-screen h2 { font-size:2.5rem; margin-bottom:1.5rem; color:#fff; letter-spacing:-.02em; }

/* Loading / Error States (Phase 7) */
#dashboard-loading p, #dashboard-error { text-align:center; padding:3rem; background:rgba(0,0,0,.6); border-radius:var(--radius); color:#fff; font-size:1.1rem; }

/* Performance Highlight Cards (Phase 4) */
.highlight-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:1.25rem; margin-bottom:2.5rem; }
.hl-card { background:rgba(0,0,0,.6); border-radius:var(--radius); padding:1.75rem 1.25rem; text-align:center; box-shadow:var(--shadow-md); transition:transform var(--transition),box-shadow var(--transition); color:#fff; }
.hl-card:hover { transform:translateY(-3px); box-shadow:0 8px 30px rgba(0,0,0,.14); }
.hl-card h3 { font-size:.9rem; color:#fff; text-transform:uppercase; letter-spacing:.06em; margin-bottom:.75rem; text-shadow:0 1px 4px rgba(0,0,0,.4); }
.hl-card p  { font-size:2.2rem; color:#fff; line-height:1.1; text-shadow:0 2px 6px rgba(0,0,0,.5); }

/* History Graph Section (Phase 8) */
.history-section { background:rgba(0,0,0,.6); border-radius:var(--radius); padding:2rem; box-shadow:var(--shadow-md); margin-bottom:2.5rem; }
.history-section h3 { font-size:1.15rem; margin-bottom:1rem; color:#fff; text-shadow:0 1px 4px rgba(0,0,0,.4); }
/* Responsive wrapper for the Chart.js canvas — keeps it inside narrow viewports */
.chart-wrap { position:relative; width:100%; max-width:640px; height:250px; margin:0 auto; }

/* Achievements Grid (Phase 7) */
.achievements-section { margin-bottom:2.5rem; border-top:1px solid #fff; padding-top:2rem; }
.achievements-section h3 { font-size:1.15rem; margin-bottom:1rem; color:#fff; text-shadow:0 1px 4px rgba(0,0,0,.4); }
.achievement-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:1rem; }

.achievement-card { background:rgba(0, 0, 0, 0.6); border-radius:var(--radius); padding:1.25rem 1rem; text-align:center; box-shadow:var(--shadow-sm); transition:transform var(--transition),box-shadow var(--transition); opacity:.7; border:2px solid transparent; color:#fff; }
.achievement-card h4 { font-size:.9rem; color:#fff; margin-bottom:.25rem; text-shadow:0 1px 3px rgba(0,0,0,.4); }
.achievement-card p  { font-size:.8rem; color:#fff; line-height:1.3; text-shadow:0 1px 2px rgba(0,0,0,.3); }
.achievement-card.earned { opacity:1; border-color:#fbbf24; background:linear-gradient(135deg,rgba(0,0,0,.8),rgba(0,0,0,.6)); box-shadow:0 2px 16px rgba(251,191,36,.25); }
.achievement-card:hover { transform:translateY(-2px); opacity:.9; }
.achievement-card.earned:hover { opacity:1; }

/* Car Selector (Phase 7) */
.car-selector-section { background:rgba(0, 0, 0, 0.6); border-radius:var(--radius); padding:2rem; box-shadow:var(--shadow-md); margin-bottom:2.5rem; }
.car-selector-section h3 { font-size:1.15rem; margin-bottom:1rem; color:#fff; text-shadow:0 1px 4px rgba(0,0,0,.4); }


.achievement-card { position:relative; background:rgba(0,0,0,.6); border-radius:var(--radius); padding:1.25rem 1rem; text-align:center; box-shadow:var(--shadow-sm); transition:transform var(--transition),box-shadow var(--transition),opacity var(--transition); opacity:.7; border:2px solid transparent; }
.achievement-card.earned { opacity:1; border-color:#fbbf24; background:rgba(0,0,0,.6); box-shadow:0 0 0 1px rgba(251,191,36,.45), 0 0 18px rgba(251,191,36,.35), inset 0 0 14px rgba(251,191,36,.15); }
.achievement-card:hover { transform:translateY(-2px); opacity:.9; }
.achievement-card.earned:hover { opacity:1; }

/* Achievement hover tooltip — requirement details (set via data-details attribute) */
.achievement-card[data-details]::after {
  content: attr(data-details);
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: max-content;
  max-width: 250px;
  background: #0f172a;
  color: #fff;
  font-size: .78rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  text-shadow: none;
  padding: .65rem .85rem;
  border-radius: 10px;
  border: 1px solid rgba(251,191,36,.45);
  box-shadow: 0 10px 28px rgba(0,0,0,.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  z-index: 60;
}
.achievement-card[data-details]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  border: 7px solid transparent;
  border-top-color: #0f172a;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  z-index: 60;
}
.achievement-card[data-details]:hover::after,
.achievement-card[data-details]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.ach-icon { font-size:3rem; margin-bottom:.5rem; display:block; min-height:72px; line-height:1; }
.ach-icon img { max-width:72px; max-height:72px; object-fit:contain; }
.ach-icon-car img { width:100%; max-width:140px; height:auto; }
.achievement-card h4 { font-size:.9rem; color:#fff; margin-bottom:.25rem; text-shadow:0 1px 3px rgba(0,0,0,.4); }
.achievement-card p  { font-size:.8rem; color:#fff; line-height:1.3; text-shadow:0 1px 2px rgba(0,0,0,.3); }

/* Car Selector (Phase 7) */
.car-selector-section { background:rgba(0,0,0,.6); border-radius:var(--radius); padding:2rem; box-shadow:var(--shadow-md); margin-bottom:2.5rem; }
.car-selector-section h3 { font-size:1.15rem; margin-bottom:1rem; color:#fff; text-shadow:0 1px 4px rgba(0,0,0,.4); }
.car-selector { display:flex; flex-wrap:wrap; gap:1.1rem; justify-content:center; align-items:stretch; min-height:120px; padding:.5rem 0; }
.car-option { width:118px; padding:.7rem .5rem .6rem; border-radius:16px; background:rgba(255,255,255,.1); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.5rem; cursor:pointer; transition:transform var(--transition),box-shadow var(--transition),border-color var(--transition); position:relative; overflow:hidden; }
.car-option:hover { transform:scale(1.06); box-shadow:var(--shadow-md); }
.car-option.active { outline:3px solid #fbbf24; outline-offset:-3px; }
.car-option img { width:100px; height:66px; object-fit:contain; pointer-events:none; }
.car-option-label { font-size:.78rem; color:#fff; line-height:1.15; text-shadow:0 1px 3px rgba(0,0,0,.55); letter-spacing:.02em; text-align:center; }

/* ── Progress bar car icon — car image sizing is handled by the base .car-icon rule above ── */

/* ── Danger Zone (Section 6.6) ────────────────────────────────────────────── */
.btn-danger { background:#dc2626; color:#fff; padding:.85rem 2.2rem; font-size:1rem; border:none; border-radius:9px; cursor:pointer; transition:background var(--transition),transform .1s ease; }
.btn-danger:hover { background:#b91c1c; transform:translateY(-1px); }
.btn-danger:active { transform:scale(.97); }

/* ── Dashboard Buttons (sign-out, back-to-home) ───────────────────────────── */
#user-dashboard-screen .btn-primary { min-width:240px; font-size:1.05rem; margin-right:.5rem; }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* LANDING PAGE (site entry) — street-sign panels over the forest background.
   No navigation bar: only brand + language chrome at the top.                 */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* Ambient background cycle (landing.html only): two crossfading panes, each
   scene holds ~16s with a slow zoom drift, 3.5s fade to the next scene.
   The first scene reveals instantly on load (no fade-in); later scenes keep
   the normal fade. Sits above the global body::before forest (same z-index,
   later in tree). */
#bg-cycle { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#bg-cycle .bg-pane { position: absolute; inset: 0; z-index: 1; background-size: cover; background-position: center; opacity: 0; transition: opacity 3.5s ease; will-change: transform, opacity; }
#bg-cycle .bg-pane.bg-instant { transition: none; }
#bg-cycle .bg-pane.bg-top { z-index: 2; }
#bg-cycle .bg-pane.bg-active { opacity: 1; }
#bg-cycle .bg-shade { position: absolute; inset: 0; z-index: 3; background: linear-gradient(rgba(8, 24, 10, .30), rgba(8, 24, 10, .10) 45%, rgba(8, 24, 10, .38)); }
@keyframes bg-kb-in { from { transform: scale(1); } to { transform: scale(1.12); } }
@keyframes bg-kb-out { from { transform: scale(1.12); } to { transform: scale(1); } }
#bg-cycle .bg-pane.kb-in { animation: bg-kb-in 16s ease-in-out forwards; }
#bg-cycle .bg-pane.kb-out { animation: bg-kb-out 16s ease-in-out forwards; }
@media (prefers-reduced-motion: reduce) {
  #bg-cycle .bg-pane { transition: none; animation: none !important; }
}

.landing-chrome { position: relative; z-index: 50; display: flex; align-items: center; justify-content: space-between; max-width: 800px; margin: 0 auto; padding: .9rem 1.25rem; }
.landing-brand { display: inline-flex; align-items: center; gap: .45rem; color: #fff; font-size: 1.4rem; letter-spacing: .03em; text-decoration: none; text-shadow: 0 1px 6px rgba(0,0,0,.5); transition: opacity .2s ease; }
.landing-brand:hover { opacity: .85; }
.landing-brand .brand-logo { height: 28px; width: auto; }

#landing-main { position: relative; max-width: 800px; margin: 0 auto; padding: .25rem 1.5rem 4.5rem; text-align: center; }
.landing-banner { width: auto; height: min(43.7vh, 483px); max-width: 100vw; display: block; margin: -30px auto .45rem; }
.landing-hero h1 { font-size: 3.4rem; color: #fff; letter-spacing: -.02em; line-height: 1.1; margin-bottom: .6rem; text-shadow: 2px 3px 0 rgba(0,0,0,.85); }
.landing-hero p { font-size: 1.35rem; line-height: 1.45; color: rgba(255,255,255,.92); max-width: 640px; margin: 0 auto 2rem; text-shadow: 1px 2px 0 rgba(0,0,0,.7); }
.landing-hero h1, .landing-hero p, #landing-main > .landing-panel { transform: translateY(-20px); }

/* Street-sign panel (green by default; .sign-blue / .sign-warning recolor) */
.landing-panel { --sign-bg: #1a5d2a; background: var(--sign-bg); color: #fff; border-radius: 12px; padding: 1.6rem 2rem 1.8rem; margin-bottom: 1.5rem; box-shadow: inset 0 0 0 3px var(--sign-bg), inset 0 0 0 5px rgba(255,255,255,.9), 0 4px 16px rgba(0,0,0,.45); }
.landing-panel h2 { font-size: 2rem; letter-spacing: .02em; line-height: 1.15; margin-bottom: .35rem; text-shadow: 1px 2px 0 rgba(0,0,0,.75); }
.sign-warning { --sign-bg: #b45309; }

.landing-note { font-size: 1.1rem; line-height: 1.4; color: rgba(255,255,255,.92); text-shadow: 1px 2px 0 rgba(0,0,0,.6); margin: .35rem 0; }
/* Home-state select (account setup) keeps the native dark select */
.landing-select { display: block; width: 100%; max-width: 420px; margin: .85rem auto .25rem; padding: .7rem 1rem; font-size: 1.15rem; color: #fff; background: rgba(0,0,0,.85); border: 2px solid rgba(255,255,255,.45); border-radius: 8px; cursor: pointer; }
.landing-select:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.landing-select option { background: #000; color: #fff; }
.landing-select option:disabled { color: var(--gray-400); }
/* Main state picker: hidden native <select> + custom upward translucent-black menu */
.landing-select-wrap { position: relative; width: 100%; max-width: 420px; margin: .85rem auto .25rem; }
.landing-select-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.landing-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; padding: .7rem 1rem; font-family: inherit; font-size: 1.15rem; letter-spacing: inherit; color: #fff; text-align: left; background: rgba(0,0,0,.85); border: 2px solid rgba(255,255,255,.45); border-radius: 8px; cursor: pointer; }
.landing-select-trigger:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.landing-select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.landing-select-caret { flex: none; color: #fff; transition: transform .15s ease; }
.landing-select-trigger[aria-expanded="true"] .landing-select-caret { transform: rotate(180deg); }
.landing-select-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); max-height: 60vh; overflow-y: auto; margin: 0; padding: .3rem; list-style: none; background: rgba(0,0,0,.85); border: 1px solid rgba(255,255,255,.3); border-radius: 8px; box-shadow: 0 -8px 28px rgba(0,0,0,.5); z-index: 60; }
.landing-select-menu li { padding: .55rem .7rem; font-size: 1.05rem; color: #fff; border-radius: 6px; cursor: pointer; }
.landing-select-menu li:hover { background: rgba(255,255,255,.18); }
.landing-select-menu li.is-selected { background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.landing-go-btn { margin-top: .8rem; }
.landing-home-row { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: .5rem; }
.landing-home-row b { font-size: 1.3rem; text-shadow: 1px 2px 0 rgba(0,0,0,.6); }
.landing-li-actions { display: flex; justify-content: center; gap: .9rem; flex-wrap: wrap; margin-top: .5rem; }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ABOUT PAGE — street-sign panels over the forest background                   */
/* ═══════════════════════════════════════════════════════════════════════════ */
/* Tighten the gap between the header banner and the page title */
#app:has(#about-screen.active), #app:has(#bmc-screen.active) { --tight-header: 1; }
#app:has(#about-screen.active) .header, #app:has(#bmc-screen.active) .header { padding-bottom: .25rem; }
#about-screen { position: relative; z-index: 40; max-width: 800px; margin: 0 auto; padding: .25rem 1.5rem 4.5rem; text-align: center; }
#bmc-screen { position: relative; z-index: 40; max-width: 800px; margin: 0 auto; padding: .25rem 1.5rem 4.5rem; text-align: center; }
.about-hero h1 { font-size: 3rem; color: #fff; letter-spacing: -.02em; text-shadow: 2px 3px 0 rgba(0,0,0,.9); margin-bottom: .6rem; }
.about-hero p { font-size: 1.35rem; line-height: 1.45; color: rgba(255,255,255,.92); text-shadow: 1px 2px 0 rgba(0,0,0,.85); max-width: 640px; margin: 0 auto; }
.about-panel { background: rgba(0,0,0,.55); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 1.25rem 1.5rem 1.5rem; margin-top: 1.25rem; text-align: center; }
.about-panel h2 { display: inline-block; font-size: 1.5rem; letter-spacing: .03em; text-transform: uppercase; color: #fff; background: #0048A9; border-radius: 10px; padding: .35rem 1.4rem; box-shadow: inset 0 0 0 2px #0048A9, inset 0 0 0 4px rgba(255,255,255,.85), 0 3px 10px rgba(0,0,0,.4); margin-bottom: .9rem; }
.about-panel > p { color: rgba(255,255,255,.92); font-size: 1.1rem; line-height: 1.5; text-shadow: 1px 2px 0 rgba(0,0,0,.7); }
.about-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1rem; }
.about-tool { background: rgba(0,0,0,.45); border-radius: 10px; padding: 1rem 1.1rem; text-align: center; box-shadow: inset 0 0 0 3px rgba(0,0,0,.45), inset 0 0 0 5px rgba(255,255,255,.35); }
.about-tool h3 { color: #fff; font-size: 1.2rem; letter-spacing: .04em; text-transform: uppercase; margin-bottom: .35rem; text-shadow: 1px 2px 0 rgba(0,0,0,.7); }
.about-tool p { color: rgba(255,255,255,.85); font-size: 1rem; line-height: 1.4; text-shadow: 1px 1px 0 rgba(0,0,0,.6); }
.about-panel .street-sign-btn { margin-top: .75rem; }
/* BMC QR code — big enough to scan from a phone screen */
.bmc-qr { margin-top: 1.25rem; }
.bmc-qr a { display: inline-block; line-height: 0; border-radius: 14px; box-shadow: 0 4px 18px rgba(0,0,0,.45); }
.bmc-qr img { display: block; width: clamp(200px, 55vw, 280px); height: auto; border-radius: 14px; }
/* Three "where it goes" cards — center the odd one out */
#bmc-screen .about-tools .about-tool:last-child { grid-column: 1 / -1; width: calc(50% - .375rem); margin-inline: auto; }
.about-steps { list-style: none; counter-reset: about-step; text-align: left; max-width: 560px; margin: 1rem auto 0; }
.about-steps li { counter-increment: about-step; position: relative; padding: .55rem .5rem .55rem 3.4rem; color: rgba(255,255,255,.92); font-size: 1.1rem; text-shadow: 1px 2px 0 rgba(0,0,0,.7); }
.about-steps li::before { content: counter(about-step); position: absolute; left: .4rem; top: .3rem; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 2px var(--primary), inset 0 0 0 4px rgba(255,255,255,.85); }
.about-actions { margin-top: 1.75rem; display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* RESPONSIVE + UTILITY ANIMATIONS (existing content preserved above)           */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .card, .question-card, .results-card { margin: 1rem; padding: 1.5rem; }
  .header h1 { font-size: 1.4rem; }
  .score-display { font-size: 4.25rem; }
  .categories-grid { grid-template-columns: 1fr; }
  .exam-info { grid-template-columns: repeat(2, 1fr); }

  /* ── Dashboard Mobile Adjustments ─────────────────────────────── */
  .highlight-cards { grid-template-columns:repeat(2, 1fr); gap:.75rem; }
  .hl-card { padding:1.25rem .75rem; }
  .hl-card p { font-size:1.6rem; }
  .achievement-grid { grid-template-columns:repeat(2, 1fr); }
  .modal-content { padding:1.75rem 1.25rem; max-width:94%; }

  /* ── Nav buttons: scale down so all three fit on narrow screens ── */
  .btn-stop, .btn-nav { width: 96px; height: 96px; border-radius: 16px; }
  .btn-stop img, .btn-nav img { width: 82px; height: 82px; }

  /* ── Progress bar car icon: slightly smaller so the shortened run fits with room to spare ── */
  .car-icon { width: 150px; height: 103px; }

  /* ── Quiz screen: keep category badge centered and progress sign on-screen ── */
  #quiz-screen { text-align: center; }
  .category-badge { max-width: 94%; }
  .q-number { font-size: 3rem; min-height: 92px; }
  .q-number .q-num { transform: translate(105px, -4px); }

  /* ── About page mobile adjustments ── */
  .about-hero h1 { font-size: 2.2rem; }
  .about-tools { grid-template-columns: 1fr; }

  /* ── Landing page logo: smaller than the desktop base rule (defined above this block) ── */
  .landing-banner { height: min(34.5vh, 299px); max-width: 86vw; margin-top: -30px; margin-bottom: .45rem; }
}

/* Progress sign — the desktop left:calc(60% + 200px) placement runs off-screen below ~950px
   (landscape phones, small tablets), so switch to a compact corner sticker there */
@media (max-width: 950px) {
  .progress-text { left: auto; right: 0; top: 238px; width: 96px; height: 124px; }
  .progress-text .speed-number { font-size: 34px; }
}

/* Progress car — the desktop left:calc(pct + 32px) travel runs off the right edge on
   narrow screens (e.g. pct 90% on an 844px landscape phone), so shorten the run there */
@media (max-width: 1024px) {
  .car-icon { left: calc(var(--car-pct, 0%) * .52 + 32px); }
}

/* Mobile phones get compressed WebP versions of the heavy visual assets (Images/mobile/) —
   e.g. banner 2.6MB→34KB, forest bg 1.3MB→61KB, car images ~1MB→~15KB each */
@media (max-width: 768px) {
  body::before { background-image: url('Images/mobile/forrest-bg-dark.webp'); }
  .state-ca::before { background-image: url('Images/mobile/backgrounds/DL_Beach.webp'); }
  .state-fl::before { background-image: url('Images/mobile/backgrounds/DL_Tropical.webp'); }
  .state-tx::before { background-image: url('Images/mobile/backgrounds/DL_Shrubland.webp'); }
  .state-il::before { background-image: url('Images/mobile/backgrounds/DL_Deciduous.webp'); }
  .state-ga::before { background-image: url('Images/mobile/backgrounds/DL_Deciduous.webp'); }
  .state-mi::before { background-image: url('Images/mobile/backgrounds/DL_Deciduous.webp'); }
  .state-nc::before { background-image: url('Images/mobile/backgrounds/DL_Deciduous.webp'); }
  .state-nyc::before { background-image: url('Images/mobile/backgrounds/DL_Coniferous.webp'); }
  .state-oh::before { background-image: url('Images/mobile/backgrounds/DL_Grasslands.webp'); }
  .state-pa::before { background-image: url('Images/mobile/backgrounds/DL_Coniferous.webp'); }
  #logo-transition .lt-slab { -webkit-mask-image: url('Images/mobile/clay-logo-clean.webp'); mask-image: url('Images/mobile/clay-logo-clean.webp'); }

  /* ── Exam screen mobile layout ─────────────────────────────── */
  /* The road image (above-progress) is absolute-positioned ABOVE the 64px bar, so the
     group starts ~72px above the bar. JS pulls #quiz-screen up by the nav height during
     the exam (margin-top), so the images sit at the very top of the page with the
     in-flow nav bar overlapping them — everything still scrolls together. */
  #quiz-screen { padding-top: 4.5rem; }

  /* Mobile only: no sleeve behind the end-of-exam thumbs video (desktop keeps it) */
  .thumbs-sleeve { display: none; }

  /* Car increased by 50% (was 52x36) and rides the road at its new scale */
  .car-icon { width: 78px; height: 54px; top: -24px; }

  /* % complete speed-limit sign — smaller, tucked beside the bar (not over the question card) */
  .progress-text { width: 68px; height: 88px; top: 80px; right: 6px; }
  .progress-text .speed-number { font-size: 24px; }

  /* Mobile only: Sign In button is icon-only (no text) */
  .top-bar-auth { padding: .35rem .7rem; }
  .top-bar-auth .top-bar-auth-label { display: none; }

  /* Tighter text line spacing on the exam screens */
  .question-text { line-height: 1.25; margin-bottom: 1rem; }
  .option-btn { line-height: 1.3; }

  /* Question number 20px further right (mobile offset was 55px) */
  .q-number .q-num { transform: translate(75px, -4px); }

  /* % complete number lower */
  .progress-text .speed-number { top: calc(52% - 10px); }

  /* Car 30px lower (was top:-24px) */
  .car-icon { top: 6px; }
}

@keyframes shakeIn { 0%{transform:translateX(-4px)} 25%{transform:translateX(4px)} 50%{transform:translateX(-3px)} 75%{transform:translateX(2px)} 100%{transform:none} }
@keyframes celebrateBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
