:root {
  /* "Practice iCST" theme, shared with app.css: cool grey page, white cards, indigo accent, teal status. */
  --bg: #f3f5fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #5b6477;
  --border: #e1e6ef;
  --accent: #4f46e5;
  --brand: #4338ca;
  --teal: #0f766e;
  --teal-bg: #e6f6f3;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px rgb(15 23 42 / 0.06);
  --hero-from: #eef2ff;
  --hero-to: #e0f2fe;
  --preview-bg: #eef2ff;
  --practice-bg: #fef2f2;
  --practice-text: #b91c1c;
  --timed-bg: #e8f7ee;
  --timed-text: #166534;
  /* Example polygon cards stay white with a light shape in both themes, like the dice. */
  --card-bg: #ffffff;
  --card-border: #cbd5e1;
  --shape-fill: #eef2ff;
  --shape-stroke: #1e1b4b;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
}

/* Dark theme: follows the computer unless the header switch chose light or dark (theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1020;
    --surface: #171b2e;
    --text: #e6e8f2;
    --muted: #a0a8bf;
    --border: #2b3150;
    --accent: #5b5ef0;
    --brand: #a5b4fc;
    --teal: #2dd4bf;
    --teal-bg: #12332f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    --hero-from: #1a1f3d;
    --hero-to: #10243a;
    --preview-bg: #1d2244;
    --practice-bg: #3a1d24;
    --practice-text: #fca5a5;
    --timed-bg: #12301f;
    --timed-text: #4ade80;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1020;
  --surface: #171b2e;
  --text: #e6e8f2;
  --muted: #a0a8bf;
  --border: #2b3150;
  --accent: #5b5ef0;
  --brand: #a5b4fc;
  --teal: #2dd4bf;
  --teal-bg: #12332f;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  --hero-from: #1a1f3d;
  --hero-to: #10243a;
  --preview-bg: #1d2244;
  --practice-bg: #3a1d24;
  --practice-text: #fca5a5;
  --timed-bg: #12301f;
  --timed-text: #4ade80;
}

* { box-sizing: border-box; }

/* iPhone and iPad: keep text at its set size when turned sideways, and let buttons react to every tap
   (no double-tap zoom, which would get in the way of quick answers). */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, label, summary { touch-action: manipulation; }

body {
  margin: 0;
  background: var(--bg);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px max(16px, calc((100% - 920px) / 2 + 16px));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  display: grid;
  grid-template-columns: repeat(2, 5px);
  gap: 5px;
  place-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  transform: rotate(-8deg);
}

.logo-mark i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
}

.hero {
  background: linear-gradient(135deg, var(--hero-from) 0%, var(--hero-to) 100%);
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 44px 16px 40px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--brand);
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.85;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.lead {
  max-width: 60ch;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--teal);
  font-weight: 600;
  font-size: 0.9rem;
}

.status-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}

/* Picture on the left, text on the right; stacked on narrow screens. */
.test-card {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.test-card + .test-card { margin-top: 20px; }

.card-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--preview-bg);
}

.preview-dice {
  display: flex;
  align-items: center;
  gap: 14px;
}

.preview-die { width: 88px; height: auto; display: block; }

.preview-polygons {
  display: flex;
  align-items: center;
  gap: 14px;
}

.preview-card { width: 84px; height: auto; display: block; }

.preview-map .map-svg { display: block; width: auto; height: 220px; }
/* The example map has no page background behind it. */
.preview-map .svg-bg { fill: transparent; }

.preview-vs {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.card-body {
  display: flex;
  flex-direction: column;
  padding: 22px 24px 18px;
}

.card-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

/* Practice in red, timed in green; borderless so the colour carries the label. */
.chip-practice { background: var(--practice-bg); border-color: transparent; color: var(--practice-text); }
.chip-timed { background: var(--timed-bg); border-color: transparent; color: var(--timed-text); }

.card-body h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.card-tag {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand);
}

.card-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
}

.card-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.card-start:hover,
.card-start:focus-visible { background: var(--brand); }
.card-start span { transition: transform 0.15s ease; }
.card-start:hover span { transform: translateX(2px); }

@media (max-width: 640px) {
  .test-card { grid-template-columns: 1fr; }
  .hero-inner { padding: 32px 16px 28px; }
  .preview-die { width: 72px; }
}

/* Example polygon cards follow the theme (CSS wins over the SVG's own colours). */
.poly-card { fill: var(--card-bg); stroke: var(--card-border); }
.poly-shape { fill: var(--shape-fill); stroke: var(--shape-stroke); }

.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.theme-toggle:hover { border-color: var(--accent); }
