/* ============================================================
   Knowledge Check — styling
   Daniël Schoonraad personal brand kit v2.1
   Royal Navy + Soft Gold, ivory base, clean treatment.
   ============================================================ */

:root {
  /* Light mode (default) */
  --bg:            #F5F2EB;  /* Ivory */
  --surface:       #FFFFFF;
  --panel:         #FDFBF3;  /* warm off-white tinted panel */
  --text:          #1B3A5C;  /* Royal Navy */
  --text-body:     #2A3744;  /* Charcoal Blue */
  --text-muted:    #7A8694;  /* Mist */
  --text-faint:    #9A937E;
  --gold:          #B8923E;  /* Soft Gold */
  --gold-muted:    #8A7A4F;
  --line:          #E3DDC8;
  --emphasis-bg:   #1B3A5C;  /* navy box on light */
  --emphasis-text: #F5F2EB;
  --correct:       #3D7A50;
  --correct-bg:    #EAF1EC;
  --incorrect:     #B0533A;
  --incorrect-bg:  #F6EBE7;
  --shadow:        rgba(27,58,92,0.10);
  --shadow-lg:     rgba(27,58,92,0.14);

  --radius:        12px;
  --radius-pill:   999px;
  --maxw:          720px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg:            #122438;  /* Deep Navy */
  --surface:       #1B3A5C;  /* Royal Navy */
  --panel:         #1E3E61;  /* lifted navy */
  --text:          #F5F2EB;  /* Ivory */
  --text-body:     #F5F2EB;
  --text-muted:    #A8BACC;  /* Steel Blue */
  --text-faint:    #8299AF;
  --gold:          #D8B96A;  /* Light Gold */
  --gold-muted:    #BFA76F;
  --line:          #2E4A6B;
  --emphasis-bg:   #234E78;  /* lighter navy on dark */
  --emphasis-text: #F5F2EB;
  --correct:       #4F9165;
  --correct-bg:    #1C3A36;
  --incorrect:     #C16A51;
  --incorrect-bg:  #3A2620;
  --shadow:        rgba(0,0,0,0.45);
  --shadow-lg:     rgba(0,0,0,0.55);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

/* ---------- Top bar ---------- */
.topbar {
  width: 100%;
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mark {
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 400;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: 0.01em;
}
.theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { background: var(--panel); }

/* ---------- Layout ---------- */
.app {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px 24px;
}

.credit {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px;
  font-size: 0.78rem;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- Type ---------- */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin: 0 0 14px;
}
h1 {
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 2.1rem;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 16px;
}
h2 {
  font-weight: 400;
  font-size: 1.35rem;
  color: var(--text);
  margin: 0 0 12px;
}
.lead {
  font-size: 1.05rem;
  color: var(--text-body);
  margin: 0 0 32px;
}
p { margin: 0 0 16px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: 0 2px 18px var(--shadow);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 13px 30px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s ease, background 0.2s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--text);     /* navy on light, ivory on dark */
  color: var(--bg);
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) { background: var(--panel); }

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 28px;
}

/* ---------- Module grid (home screen) ---------- */
.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}
@media (max-width: 600px) { .module-grid { grid-template-columns: 1fr; } }

.module-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
  box-shadow: 0 1px 10px var(--shadow);
}
.module-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow-lg); }
.module-subject {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--gold);
}
.module-card h3 { margin: 8px 0 6px; font-weight: 500; font-size: 1.18rem; color: var(--text); }
.module-card p { margin: 0 0 16px; font-size: 0.9rem; color: var(--text-muted); }
.module-meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.82rem; }
.module-best { color: var(--gold); font-weight: 500; }

/* ---------- Mode chooser (start screen) ---------- */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 8px 0 8px;
}
@media (max-width: 560px) { .mode-grid { grid-template-columns: 1fr; } }

.mode-option {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  background: var(--surface);
}
.mode-option:hover { border-color: var(--gold); }
.mode-option.selected {
  border-color: var(--gold);
  background: var(--panel);
}
.mode-option h3 {
  margin: 0 0 6px;
  font-weight: 500;
  font-size: 1rem;
  color: var(--text);
}
.mode-option p { margin: 0; font-size: 0.88rem; color: var(--text-muted); }

/* ---------- Progress ---------- */
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}
.progress-count {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  font-weight: 500;
}
.progress-track {
  height: 4px;
  background: var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 36px;
}
.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

/* ---------- Question ---------- */
.q-prompt {
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 28px;
  line-height: 1.4;
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  background: var(--surface);
}
.option:hover { border-color: var(--gold); }
.option.selected { border-color: var(--gold); background: var(--panel); }
.option input { margin-top: 3px; accent-color: var(--gold); flex: none; }
.option .label { color: var(--text-body); }

/* Locked / answered states (immediate mode) */
.option.is-correct {
  border-color: var(--correct);
  background: var(--correct-bg);
}
.option.is-incorrect {
  border-color: var(--incorrect);
  background: var(--incorrect-bg);
}
.option.disabled { cursor: default; pointer-events: none; }

/* Text input answer */
.text-answer {
  width: 100%;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 1rem;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-body);
}
.text-answer:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ---------- Inline feedback (immediate mode) ---------- */
.feedback {
  margin-top: 24px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border-left: 3px solid var(--gold);
  background: var(--panel);
}
.feedback.correct { border-left-color: var(--correct); }
.feedback.incorrect { border-left-color: var(--incorrect); }
.feedback .verdict {
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0 0 6px;
}
.feedback.correct .verdict { color: var(--correct); }
.feedback.incorrect .verdict { color: var(--incorrect); }
.feedback .explain { margin: 0; font-size: 0.95rem; color: var(--text-body); }
.feedback .right-answer {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---------- Results ---------- */
.score-hero {
  text-align: center;
  padding: 12px 0 32px;
}
.score-ring {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 3.4rem;
  color: var(--text);
  line-height: 1;
}
.score-sub { color: var(--text-muted); margin-top: 8px; }

.review-item {
  border-top: 1px solid var(--line);
  padding: 22px 0;
}
.review-item:first-of-type { border-top: none; }
.review-q {
  font-weight: 500;
  color: var(--text);
  margin: 0 0 10px;
}
.review-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}
.review-tag.correct { color: var(--correct); background: var(--correct-bg); }
.review-tag.incorrect { color: var(--incorrect); background: var(--incorrect-bg); }
.review-line { font-size: 0.92rem; margin: 4px 0; }
.review-line .lbl { color: var(--text-muted); }
.review-line .yours-wrong { color: var(--incorrect); }
.review-line .correct-val { color: var(--correct); }
.review-explain {
  margin-top: 10px;
  font-size: 0.92rem;
  color: var(--text-body);
  background: var(--panel);
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 3px solid var(--gold);
}

/* ---------- History ---------- */
.history {
  margin-top: 40px;
}
.history h2 { font-size: 1.05rem; }
.history-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 8px 0;
}
.history-row .pct { color: var(--text); font-weight: 500; }

.muted { color: var(--text-muted); font-size: 0.9rem; }

@media print {
  :root { color-scheme: light; }
  .topbar, .theme-toggle, .btn-row { display: none; }
}
