/* L-Test — night-road signage system.
   Palette: asphalt darks, lane-paint white, L-plate yellow, guide-sign green, regulatory red. */

:root {
  --asphalt: #17181b;
  --asphalt-2: #1f2126;
  --line: #2d3036;
  --paint: #f2f0e9;
  --steel: #9aa0a8;
  --plate: #ffce00;
  --guide-green: #0f7b4a;
  --guide-green-hi: #23a468;
  --reg-red: #d63a2f;
  --sign-white: #fcfbf7;
  --sign-black: #131518;
  --display: "Overpass", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Overpass Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--asphalt);
  color: var(--paint);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button { font-family: inherit; cursor: pointer; }

:focus-visible { outline: 3px solid var(--plate); outline-offset: 2px; border-radius: 6px; }

/* ---------- header ---------- */

.topbar {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }

.plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--plate);
  color: var(--sign-black);
  font-weight: 800;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.plate-sm { width: 34px; height: 34px; font-size: 22px; line-height: 1; padding-top: 3px; }

.brand-text { display: flex; flex-direction: column; }

.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.14em;
  line-height: 1.1;
}

.brand-sub { font-size: 12px; color: var(--steel); letter-spacing: 0.02em; }

.lang-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--asphalt-2);
  flex-shrink: 0;
}

.lang-toggle button {
  border: 0;
  background: transparent;
  color: var(--steel);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 7px 14px 5px;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--plate);
  color: var(--sign-black);
}

/* ---------- layout ---------- */

#app {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 20px 48px;
  flex: 1;
}

.foot {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 28px;
  color: var(--steel);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
}

/* ---------- home ---------- */

.home { text-align: center; padding-top: 40px; }

.plate-hero {
  width: 120px;
  height: 120px;
  font-size: 78px;
  border-radius: 14px;
  margin: 0 auto 28px;
  box-shadow: 0 0 0 6px rgba(255, 206, 0, 0.12), 0 18px 50px -18px rgba(255, 206, 0, 0.35);
}

/* retroreflective sweep, once on load */
.plate-hero::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,0.75) 50%, transparent 58%);
  transform: translateX(-120%);
  animation: sheen 1.4s ease-out 0.4s 1 forwards;
}

@keyframes sheen { to { transform: translateX(120%); } }

.home h1 {
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}

.home .lede { color: var(--steel); margin: 0 auto 30px; max-width: 46ch; }

.stat-row {
  display: flex;
  justify-content: center;
  gap: 10px 26px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--steel);
  text-transform: uppercase;
  margin-bottom: 36px;
}

.stat-row b { color: var(--plate); font-weight: 700; }

.home-actions { display: flex; flex-direction: column; gap: 12px; max-width: 360px; margin: 0 auto; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 15px 22px 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-plate { background: var(--plate); color: var(--sign-black); }
.btn-plate:hover { box-shadow: 0 8px 24px -8px rgba(255, 206, 0, 0.5); }

.btn-outline {
  background: transparent;
  color: var(--paint);
  border: 2px solid var(--line);
}
.btn-outline:hover { border-color: var(--steel); }

.btn-ghost {
  background: transparent;
  color: var(--steel);
  border: 0;
  font-size: 14px;
  padding: 10px;
}
.btn-ghost:hover { color: var(--paint); }

.btn small { display: block; font-weight: 600; font-size: 12px; opacity: 0.75; letter-spacing: 0.02em; }

/* ---------- quiz : road progress ---------- */

.roadbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 26px;
}

.road {
  position: relative;
  flex: 1;
  height: 18px;
  background: var(--asphalt-2);
  border-radius: 9px;
  border: 1px solid var(--line);
  overflow: hidden;
}

/* dashed centre line: dim ahead, lit behind */
.road::before,
.road .road-lit {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(90deg, #3a3d43 0 14px, transparent 14px 24px);
  border-radius: 2px;
}

.road .road-lit {
  content: none;
  background: repeating-linear-gradient(90deg, var(--plate) 0 14px, transparent 14px 24px);
  right: auto;
  width: calc((100% - 20px) * var(--p, 0));
  transition: width 0.35s ease;
}

.road .road-car {
  position: absolute;
  top: 50%;
  left: calc(10px + (100% - 20px) * var(--p, 0));
  width: 9px;
  height: 9px;
  background: var(--plate);
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255, 206, 0, 0.7);
  transition: left 0.35s ease;
}

.trip {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--steel);
  white-space: nowrap;
}

.trip .ok { color: var(--guide-green-hi); }
.trip .bad { color: var(--reg-red); }

/* ---------- quiz : question card ---------- */

.qcard { margin-bottom: 20px; }

.q-eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--plate);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.q-title {
  font-size: clamp(19px, 3.4vw, 23px);
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 18px;
}

.q-img {
  background: var(--sign-white);
  border-radius: 12px;
  padding: 10px;
  margin: 0 0 20px;
  text-align: center;
}

.q-img img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}

.options { display: flex; flex-direction: column; gap: 10px; list-style: none; margin: 0; padding: 0; }

.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--sign-white);
  color: var(--sign-black);
  border: 3px solid transparent;
  border-radius: 10px;
  padding: 13px 16px 11px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  transition: transform 0.1s ease, border-color 0.1s ease, opacity 0.25s ease, background 0.2s ease;
}

.opt:hover:not(:disabled) { transform: translateX(4px); border-color: var(--plate); }

.opt-key {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--plate);
  color: var(--sign-black);
  font-weight: 800;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
}

.opt.is-correct {
  background: var(--guide-green);
  color: #fff;
  border-color: var(--guide-green);
}

.opt.is-correct .opt-key { background: #fff; color: var(--guide-green); }

.opt.is-wrong {
  border-color: var(--reg-red);
  color: var(--reg-red);
}

.opt.is-wrong .opt-key { background: var(--reg-red); color: #fff; }

.opt.is-dim { opacity: 0.4; }

.opt:disabled { cursor: default; }

.opt-mark { margin-left: auto; font-size: 18px; font-weight: 800; flex-shrink: 0; }

/* ---------- explanation ---------- */

.explain {
  background: var(--asphalt-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--plate);
  border-radius: 10px;
  padding: 16px 20px 14px;
  margin-top: 20px;
  animation: reveal 0.3s ease;
}

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

.explain-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 8px;
}

.explain.good { border-left-color: var(--guide-green-hi); }
.explain.bad { border-left-color: var(--reg-red); }

.explain .verdict { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.explain.good .verdict { color: var(--guide-green-hi); }
.explain.bad .verdict { color: var(--reg-red); }

.explain p { margin: 0 0 10px; font-size: 15.5px; color: var(--paint); }
.explain p:last-child { margin-bottom: 0; }

.quiz-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}

.key-hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--steel);
  letter-spacing: 0.04em;
}

/* ---------- results ---------- */

.results { text-align: center; padding-top: 36px; }

.verdict-sign {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 240px;
  padding: 28px 40px 22px;
  border-radius: 16px;
  margin-bottom: 26px;
}

.verdict-sign.pass { background: var(--guide-green); color: #fff; }

.verdict-sign.fail {
  background: var(--sign-white);
  color: var(--reg-red);
  box-shadow: inset 0 0 0 8px var(--reg-red);
}

.verdict-sign .verdict-word {
  font-weight: 800;
  font-size: 34px;
  letter-spacing: 0.1em;
  line-height: 1.15;
}

.verdict-sign .verdict-score {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  opacity: 0.9;
}

.results .detail { color: var(--steel); max-width: 44ch; margin: 0 auto 30px; }

.results .home-actions { margin-top: 8px; }

/* ---------- responsive & motion ---------- */

@media (hover: none), (max-width: 480px) {
  .key-hint { display: none; }
}

@media (max-width: 480px) {
  .brand-sub { display: none; }
  .trip { font-size: 12px; }
  .opt { font-size: 15px; }
}

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