/* Shortbus Quizzes — static, no build step, no CDNs */

:root {
  --bg: #eef2f6;
  --bg-elev: #ffffff;
  --ink: #14202e;
  --muted: #5b6b7c;
  --line: #d5dde5;
  --primary: #0d4a6e;
  --primary-2: #16729a;
  --primary-soft: #e6f1f7;
  --accent: #c45c26;
  --accent-soft: #f8e8dc;
  --ok: #1f7a4d;
  --ok-soft: #e5f6ed;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --warn: #8a5a00;
  --shadow: 0 10px 30px rgba(15, 27, 45, 0.08);
  --shadow-sm: 0 2px 8px rgba(15, 27, 45, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --wrap: 1120px;
  --header-h: 72px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9e8f2 0%, transparent 55%),
    radial-gradient(900px 400px at 110% 0%, #f3e3d6 0%, transparent 50%),
    var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

button, input, select { font: inherit; color: inherit; }

a { color: var(--primary-2); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0.75rem; top: 0.75rem; }

.wrap {
  width: min(100% - 2rem, var(--wrap));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(238, 242, 246, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-mark { flex: none; display: flex; }
.brand-mark svg { display: block; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-weight: 750;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-tag {
  font-size: 0.78rem;
  color: var(--muted);
}

.header-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 48%;
}

main {
  flex: 1;
  padding: 1.75rem 0 3rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }

/* Panels & typography */
.panel { animation: rise 0.28s ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.lede {
  margin: 0 0 1.75rem;
  color: var(--muted);
  max-width: 46rem;
  font-size: 1.05rem;
}

.loading-panel, .error-panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.error-panel { border-color: #f0c2bd; background: #fff8f7; }

.sample-note {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #8a3d12;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Quiz cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.15rem;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  cursor: pointer;
  text-align: left;
  padding: 0;
  width: 100%;
}

.quiz-card:hover,
.quiz-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #b9c9d6;
}

.quiz-card-image {
  height: 150px;
  background: #d7e3ec;
  overflow: hidden;
}
.quiz-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.quiz-card-image.is-placeholder {
  display: grid;
  place-items: center;
  background:
    linear-gradient(160deg, #d7e8f2, #f0e6dc);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
}

.quiz-card-body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.quiz-card h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.quiz-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  flex: 1;
}
.quiz-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 650;
}
.chip-accent { background: var(--accent-soft); color: #8a3d12; }
.chip-muted { background: #eef1f4; color: var(--muted); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }

.last-score {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  line-height: 1.2;
  text-decoration: none;
  min-height: 44px;
}
.btn:hover { background: var(--primary-2); }
.btn:focus-visible,
.quiz-card:focus-visible,
.opt:focus-visible,
.nav-dot:focus-visible,
.preset:focus-visible,
.count-custom input:focus-visible {
  outline: 3px solid #8ec8e6;
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: #e8eef3; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #a44918; }
.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-soft:hover { background: #d4e7f2; }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* Count picker */
.count-panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.65rem;
  max-width: 40rem;
}
.count-panel .lede { margin-bottom: 1.1rem; }

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.75rem 0 1.1rem;
}
.preset {
  min-width: 4.4rem;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}
.preset:hover { border-color: var(--primary-2); }
.preset.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.count-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.count-custom input {
  width: 5.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #fff;
}

.back-link {
  display: inline-flex;
  margin-bottom: 1rem;
  background: none;
  border: 0;
  color: var(--primary-2);
  cursor: pointer;
  padding: 0;
  font-weight: 650;
}
.back-link:hover { text-decoration: underline; }

/* Quiz layout */
.quiz-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.quiz-top h1 { margin: 0; font-size: 1.25rem; }
.progress-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.progress {
  height: 8px;
  background: #dce4eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.1rem;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  width: 0%;
  transition: width 0.25s ease;
}

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 1.25rem;
  align-items: start;
}
.quiz-layout.no-map { grid-template-columns: minmax(0, 1fr); }

.question-card,
.map-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.question-card { padding: 1.25rem 1.3rem 1.35rem; }

.question-text {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.4;
}

.q-image {
  margin: 0 0 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  max-width: 200px;
  background: #f4f7fa;
}
.q-image img { width: 100%; cursor: zoom-in; }

.multi-hint {
  margin: -0.35rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
}

.options { display: grid; gap: 0.55rem; }
.opt {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  min-height: 48px;
}
.opt:hover { border-color: #b7c8d6; background: #f8fbfc; }
.opt.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.opt-key {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  background: #eef3f7;
  color: var(--primary);
  font-weight: 750;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
  margin-top: 0.05rem;
}
.opt.is-selected .opt-key { background: var(--primary); color: #fff; }
.opt-label { flex: 1; padding-top: 0.1rem; }

.quiz-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.15rem;
}
.navigator {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  flex: 1;
}
.nav-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
  padding: 0;
}
.nav-dot.is-current {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.nav-dot.is-answered:not(.is-current) {
  background: var(--primary-soft);
  border-color: #9dc0d4;
  color: var(--primary);
}

/* Pinned map */
.map-card {
  position: sticky;
  top: calc(var(--header-h) + 0.85rem);
  padding: 0.7rem;
  overflow: hidden;
}
.map-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0 0.2rem;
}
.map-card h2 {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.map-toggle { display: none; }
.map-frame {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #dce7ef;
  cursor: zoom-in;
}
.map-frame img { width: 100%; height: auto; }
.map-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.lightbox[hidden] { display: none; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 20, 30, 0.72);
}
.lightbox-frame {
  position: relative;
  margin: 0;
  width: min(100%, 1100px);
  max-height: calc(100vh - 2.5rem);
  background: #fff;
  border-radius: 16px;
  overflow: auto;
  padding: 0.75rem 0.75rem 1rem;
  box-shadow: var(--shadow);
}
.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.lightbox-title { margin: 0; font-size: 1rem; }
.lightbox-frame img { width: 100%; cursor: zoom-out; }

/* Results */
.results-hero {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem 1.5rem 1.5rem;
  margin-bottom: 1.25rem;
  text-align: center;
}
.score-number {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0.2rem 0 0.2rem;
}
.score-sub { margin: 0; color: var(--muted); }
.pass-badge {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-weight: 750;
  font-size: 0.85rem;
}
.pass-badge.is-pass { background: var(--ok-soft); color: var(--ok); }
.pass-badge.is-fail { background: var(--bad-soft); color: var(--bad); }

.review-list { display: grid; gap: 0.85rem; }
.review-item {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  border-left: 5px solid var(--line);
}
.review-item.is-correct { border-left-color: var(--ok); }
.review-item.is-wrong { border-left-color: var(--bad); }
.review-item h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  line-height: 1.4;
}
.review-flags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.review-ans { margin: 0.15rem 0; font-size: 0.92rem; }
.review-ans strong { font-weight: 750; }
.review-ans.correct { color: var(--ok); }
.review-ans.wrong { color: var(--bad); }
.explanation {
  margin: 0.65rem 0 0;
  padding: 0.65rem 0.75rem;
  background: #f5f8fb;
  border-radius: 10px;
  color: #334155;
  font-size: 0.92rem;
}
.skipped { color: var(--warn); font-weight: 700; }

/* Mobile map */
@media (max-width: 820px) {
  .quiz-layout {
    grid-template-columns: 1fr;
  }
  .map-card {
    position: sticky;
    top: var(--header-h);
    z-index: 15;
    order: -1;
    padding: 0.5rem;
    border-radius: 0 0 14px 14px;
  }
  .map-card.is-expanded {
    position: relative;
    top: auto;
  }
  .map-frame { max-height: 22vh; }
  .map-frame img { max-height: 22vh; object-fit: cover; object-position: center 25%; width: 100%; }
  .map-card.is-expanded .map-frame,
  .map-card.is-expanded .map-frame img {
    max-height: 46vh;
    object-fit: contain;
    object-position: center;
    background: #eef4f8;
  }
  .question-card { scroll-margin-top: calc(var(--header-h) + 8.5rem); }
  .map-toggle { display: inline-flex; }
  .map-hint { display: none; }
}

@media (max-width: 560px) {
  .wrap { width: min(100% - 1.25rem, var(--wrap)); }
  .header-inner { min-height: 64px; }
  :root { --header-h: 64px; }
  .brand-tag { display: none; }
  .quiz-controls { flex-direction: column; align-items: stretch; }
  .quiz-controls .btn { width: 100%; }
  .navigator { order: -1; }
}

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