/* ===== Design tokens =====
   Palette: asphalt (#15181B), road-marking yellow (#F2B705),
            sign-red (#C8102E), sign-blue (#1257A6),
            plate off-white (#EDEDE7), muted (#7C8592)
   Display: Oswald (road-sign condensed) — headings, numbers
   Body: Manrope — everything readable
   Utility: Roboto Mono — question index, stats
*/

:root {
  --asphalt: #15181B;
  --asphalt-2: #1E2226;
  --yellow: #F2B705;
  --red: #C8102E;
  --blue: #1257A6;
  --plate: #EDEDE7;
  --plate-dim: #C9CAC4;
  --muted: #7C8592;
  --line: #2C3136;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--asphalt);
  color: var(--plate);
  font-family: 'Manrope', sans-serif;
  min-height: 100vh;
}

/* animated road-marking line at very top, ambient signature detail */
.road-line {
  height: 4px;
  width: 100%;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 28px, transparent 28px 48px);
  background-size: 200% 100%;
  animation: dash-move 6s linear infinite;
}
@keyframes dash-move {
  from { background-position: 0 0; }
  to { background-position: -200px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .road-line { animation: none; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-mark {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--yellow);
  border: 2px solid var(--yellow);
  border-radius: 6px;
  padding: 2px 8px;
}
.brand-sub {
  font-family: 'Oswald', sans-serif;
  font-weight: 500;
  font-size: 15px;
  color: var(--plate-dim);
  letter-spacing: 0.01em;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.lang-btn {
  font-family: 'Roboto Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-btn:hover { color: var(--plate); }
.lang-btn.active { background: var(--yellow); color: var(--asphalt); font-weight: 700; }

main { padding: clamp(16px, 4vw, 48px); }
.stage { max-width: 720px; margin: 0 auto; }

/* ===== Hub / landing ===== */
.hub-plate {
  background: var(--asphalt-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 44px);
  position: relative;
}
.eyebrow {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: var(--yellow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hub-plate h1 {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
  margin: 10px 0 12px;
  line-height: 1.15;
}
.hub-plate p { color: var(--plate-dim); font-size: 15px; line-height: 1.6; max-width: 46ch; }

.hub-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.btn-primary {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  background: var(--yellow);
  color: var(--asphalt);
  border: none;
  border-radius: 6px;
  padding: 13px 28px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(242,183,5,0.25); }
.btn-primary:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.btn-ghost {
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 14px;
  background: transparent;
  color: var(--plate-dim);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 18px;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--muted); color: var(--plate); }
.btn-ghost:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.jump-row { display: flex; align-items: center; gap: 10px; }
.jump-row[hidden] { display: none; }
.jump-row label { font-size: 13px; color: var(--muted); }
.jump-row input {
  width: 84px;
  background: var(--asphalt);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--plate);
  font-family: 'Roboto Mono', monospace;
  padding: 8px 10px;
  font-size: 14px;
}

.hub-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 1px;
  background: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  background: var(--asphalt-2);
  padding: 18px 16px;
  text-align: center;
}
.stat-num {
  display: block;
  font-family: 'Roboto Mono', monospace;
  font-size: 26px;
  font-weight: 500;
  color: var(--yellow);
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== Quiz ===== */
.progress-track {
  position: relative;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  margin-bottom: 22px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--yellow);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.progress-car {
  position: absolute;
  top: -11px;
  left: 0%;
  transform: translateX(-50%);
  font-size: 16px;
  transition: left 0.25s ease;
}

.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.q-index { font-family: 'Roboto Mono', monospace; color: var(--muted); font-size: 13px; }

.q-card {
  background: var(--asphalt-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 32px);
}
.q-text {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: clamp(19px, 3vw, 24px);
  line-height: 1.35;
  margin: 0 0 20px;
}

.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.media-gallery[hidden] { display: none; }
.gallery-item {
  width: 100%;
  display: block;
  max-height: 320px;
  object-fit: contain;
  background: #0F1113;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.media-caption {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: var(--blue);
  margin: -12px 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.media-missing {
  margin-bottom: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--muted);
  font-family: 'Roboto Mono', monospace;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--asphalt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 16px;
  cursor: pointer;
  text-align: left;
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  color: var(--plate);
  transition: border-color 0.12s, background 0.12s;
}
.option:hover { border-color: var(--muted); }
.option:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.option-mark {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option.correct { border-color: var(--yellow); background: rgba(242,183,5,0.08); }
.option.correct .option-mark { background: var(--yellow); color: var(--asphalt); border-color: var(--yellow); }
.option.wrong { border-color: var(--red); background: rgba(200,16,46,0.08); }
.option.wrong .option-mark { background: var(--red); color: var(--plate); border-color: var(--red); }
.option.disabled { cursor: default; }

.q-text mark {
  background: rgba(242,183,5,0.22);
  color: var(--yellow);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
}

.example-block {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(18,87,166,0.08);
  border: 1px solid rgba(18,87,166,0.35);
}
.example-label {
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.example-block p { margin: 6px 0 0; color: var(--plate-dim); font-size: 14px; line-height: 1.6; }
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.explain-label {
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.explain p { margin: 6px 0 0; color: var(--plate-dim); font-size: 14px; line-height: 1.6; }

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  gap: 12px;
}
.nav-mid { font-size: 13px; color: var(--muted); font-family: 'Roboto Mono', monospace; }

.foot {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 12px;
  font-family: 'Roboto Mono', monospace;
}

@media (max-width: 560px) {
  .hub-stats { grid-template-columns: 1fr; }
  .quiz-nav { flex-wrap: wrap; }
  .nav-mid { order: 3; width: 100%; text-align: center; }
}

.example-block {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(18, 87, 166, 0.08);
  border: 1px solid rgba(18, 87, 166, 0.35);
}
.example-label {
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.example-block p { margin: 6px 0 0; color: var(--plate); font-size: 14px; line-height: 1.6; }

.keyword {
  color: var(--yellow);
  font-weight: 700;
}

.uncertain-badge {
  display: inline-block;
  margin-left: 8px;
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ===== Header additions ===== */
.topbar-right { display: flex; align-items: center; gap: 14px; }
.btn-login {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 14px;
  background: transparent;
  color: var(--plate);
  border: 1px solid var(--yellow);
  border-radius: 6px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-login:hover { background: var(--yellow); color: var(--asphalt); }

/* ===== Mode selection cards (replace old single start button) ===== */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 26px;
}
@media (min-width: 560px) {
  .mode-cards { grid-template-columns: 1fr 1fr; }
}
.mode-card {
  text-align: left;
  background: var(--asphalt);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mode-card:hover { border-color: var(--muted); transform: translateY(-1px); }
.mode-card-primary { border-color: var(--yellow); background: rgba(242,183,5,0.06); }
.mode-card-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--plate);
}
.mode-card-sub { font-size: 13px; color: var(--muted); }

/* ===== Results screen ===== */
.results-plate { text-align: center; }
.results-plate h1 {
  font-family: 'Roboto Mono', monospace;
  font-size: 48px;
  color: var(--yellow);
  margin: 12px 0;
}
.results-plate .hub-actions { justify-content: center; }

/* ===== Footer ===== */
.foot-inner { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.foot-brand {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  color: var(--yellow);
  letter-spacing: 0.04em;
}

/* ===== Login modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  background: var(--asphalt-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
}
.modal-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none; border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--plate); }
.modal-title {
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
  margin: 0 0 18px;
  color: var(--plate);
}
.modal-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.modal-input, .modal-textarea {
  width: 100%;
  background: var(--asphalt);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--plate);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  padding: 10px 12px;
}
.modal-textarea { min-height: 70px; resize: vertical; }
.modal-submit { width: 100%; margin-top: 18px; }
.modal-hint { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.5; }
.modal-error {
  background: rgba(200,16,46,0.12);
  border: 1px solid var(--red);
  color: var(--plate);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

/* ===== Admin panel ===== */
.admin { max-width: 720px; margin: 0 auto; padding: clamp(16px, 4vw, 48px); }
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.admin-topbar div { display: flex; gap: 10px; }
.admin-title { font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 18px; color: var(--yellow); }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.admin-tab {
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
}
.admin-tab.active { background: var(--yellow); color: var(--asphalt); border-color: var(--yellow); }
.admin-card {
  background: var(--asphalt-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.admin-card h3 { margin: 0 0 12px; font-family: 'Oswald', sans-serif; font-size: 16px; }
.admin-row { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-row .modal-input { flex: 1; min-width: 160px; }
.admin-generated {
  margin-top: 12px;
  background: rgba(242,183,5,0.08);
  border: 1px solid var(--yellow);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'Roboto Mono', monospace;
  font-size: 13px;
}
.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--asphalt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
}
.user-row .btn-ghost { padding: 6px 12px; font-size: 12px; }
