/* ============================================================
   فلسفة — بنك أسئلة مباراة التعليم
   ============================================================ */

:root {
  --font-ui: "Tajawal", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-display: "Amiri", "Times New Roman", serif;

  --bg: #f6f2e9;
  --bg-soft: #fbf8f1;
  --surface: #fffdf8;
  --surface-2: #f2ece0;
  --surface-3: #ece3d3;
  --ink: #1f1b14;
  --ink-soft: #4a443a;
  --muted: #7d7567;
  --line: #e4dac9;
  --line-strong: #d5c8b2;

  --gold: #9c742c;
  --gold-bright: #c99f4d;
  --gold-soft: #f1e5c9;
  --gold-line: #e0cfa8;

  --ink-card: #1c2430;
  --ink-card-2: #232e3d;
  --cream: #f4ecdd;

  --green: #1d7a4d;
  --green-bg: #e7f4ec;
  --green-line: #b9ddc8;
  --red: #b03a2e;
  --red-bg: #fbeae7;
  --red-line: #edc5be;

  --shadow-sm: 0 1px 2px rgba(52, 42, 22, 0.05);
  --shadow-md: 0 18px 40px -24px rgba(52, 42, 22, 0.35);
  --shadow-lg: 0 32px 80px -40px rgba(38, 30, 14, 0.45);

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f1419;
  --bg-soft: #131a21;
  --surface: #161e26;
  --surface-2: #1c2630;
  --surface-3: #243039;
  --ink: #f1ece2;
  --ink-soft: #d5cec1;
  --muted: #98a1ab;
  --line: #27323c;
  --line-strong: #35424e;

  --gold: #d8b56a;
  --gold-bright: #e7c884;
  --gold-soft: #352d1e;
  --gold-line: #4a3e28;

  --ink-card: #e8e1d3;
  --ink-card-2: #d9d1c1;
  --cream: #20262c;

  --green: #6cc79a;
  --green-bg: #14281f;
  --green-line: #24503a;
  --red: #ef9287;
  --red-bg: #2d1a18;
  --red-line: #552b27;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 40px -24px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 32px 80px -40px rgba(0, 0, 0, 0.8);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 88% -8%, rgba(201, 159, 77, 0.14), transparent 60%),
    radial-gradient(700px 500px at -10% 12%, rgba(29, 122, 77, 0.07), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--gold-bright); color: #1c1608; }

.is-hidden { display: none !important; }

/* ---------- decorative background ---------- */
.page-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.decor-ring {
  position: absolute;
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  opacity: 0.5;
}
.decor-ring.r1 { width: 620px; height: 620px; inset-inline-start: -260px; top: 12%; }
.decor-ring.r2 { width: 380px; height: 380px; inset-inline-start: -140px; top: 26%; opacity: 0.35; }
.decor-glyph {
  position: absolute;
  inset-inline-end: -40px;
  bottom: -110px;
  font-family: var(--font-display);
  font-size: 420px;
  line-height: 1;
  color: var(--ink);
  opacity: 0.035;
  user-select: none;
}

/* ---------- header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #1c2430;
  color: #e7c884;
  border: 1px solid rgba(231, 200, 132, 0.28);
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  box-shadow: var(--shadow-md);
}
.brand-text { display: flex; flex-direction: column; text-align: start; line-height: 1.25; }
.brand-text strong { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: 0.2px; }
.brand-text small { color: var(--muted); font-size: 12px; font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-chip {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }
.icon-btn .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="light"] .ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: none; }

/* ---------- main ---------- */
.app-main {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 32px) 64px;
}
.screen { display: none; animation: screenIn 0.45s cubic-bezier(0.22, 0.8, 0.28, 1) both; }
.screen.is-active { display: block; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- hero ---------- */
.hero { max-width: 760px; margin-bottom: 36px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  padding: 6px 14px;
  border-radius: 999px;
  margin: 0 0 20px;
}
.eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 72px);
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 18px;
  letter-spacing: -0.5px;
}
.hero h1 em { color: var(--gold); font-style: normal; }
.hero-sub { font-size: 17px; color: var(--ink-soft); max-width: 640px; margin: 0 0 26px; }
.ltr { unicode-bidi: isolate; direction: ltr; }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.stat {
  display: flex;
  align-items: baseline;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 14px;
  box-shadow: var(--shadow-sm);
}
.stat strong { font-size: 19px; font-weight: 800; color: var(--ink); }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ---------- resume ---------- */
.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  margin-bottom: 18px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-md);
  animation: screenIn 0.4s both;
}
.resume-info { display: flex; flex-direction: column; gap: 2px; }
.resume-kicker { font-size: 11.5px; font-weight: 800; color: var(--gold); letter-spacing: 0.4px; }
.resume-info strong { font-size: 15.5px; }
.resume-info small { color: var(--muted); font-size: 12.5px; }
.resume-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- mode cards ---------- */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.mode-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink);
  text-align: start;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.mode-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.mode-card:active { transform: translateY(-1px); }
.mode-card:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.mode-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--gold);
}
.mode-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mode-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mode-body strong { font-size: 16.5px; font-weight: 800; }
.mode-body span { font-size: 12.8px; color: var(--muted); line-height: 1.5; }
.mode-arrow { margin-inline-start: auto; color: var(--muted); font-size: 20px; transition: transform 0.2s, color 0.2s; }
.mode-card:hover .mode-arrow { transform: translateX(-4px); color: var(--gold); }

.mode-primary {
  background:
    radial-gradient(340px 180px at 85% 0%, rgba(201, 159, 77, 0.22), transparent 70%),
    linear-gradient(145deg, var(--ink-card), var(--ink-card-2));
  border-color: transparent;
  color: var(--cream);
  box-shadow: 0 24px 50px -28px rgba(20, 16, 8, 0.8);
}
.mode-primary .mode-body span { color: rgba(244, 236, 221, 0.68); }
.mode-primary .mode-icon { background: rgba(244, 236, 221, 0.08); border-color: rgba(244, 236, 221, 0.16); color: var(--gold-bright); }
.mode-primary .mode-arrow { color: var(--gold-bright); }
[data-theme="dark"] .mode-primary {
  background:
    radial-gradient(340px 180px at 85% 0%, rgba(216, 181, 106, 0.16), transparent 70%),
    linear-gradient(145deg, #1f2c39, #17222c);
  border: 1px solid rgba(216, 181, 106, 0.28);
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(231, 200, 132, 0.08);
}

/* ---------- settings ---------- */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 2px 26px;
}
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  padding: 2px;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.switch-thumb {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--gold); border-color: var(--gold); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(-18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 3px; }
.settings-hint { font-size: 12px; color: var(--muted); }

/* ---------- series ---------- */
.series-section { margin-top: 6px; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head h2 { font-family: var(--font-display); font-size: 28px; margin: 0 0 4px; font-weight: 700; }
.section-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.section-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.series-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  text-align: start;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.series-card::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold);
  opacity: 0;
  transition: opacity 0.2s;
}
.series-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.series-card:hover::after { opacity: 1; }
.series-top { display: flex; align-items: center; gap: 10px; }
.series-num {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: 10px;
}
.series-name { font-size: 14.5px; font-weight: 700; flex: 1; }
.series-count-badge { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.series-meter { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.series-meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); border-radius: inherit; transition: width 0.6s cubic-bezier(0.22, 0.8, 0.28, 1); }
.series-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }

.source-note { margin-top: 30px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- quiz ---------- */
.quiz-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.quiz-bar-center { display: flex; align-items: center; gap: 10px; min-width: 0; }
.quiz-mode {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.quiz-progress-text { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.star-btn svg { fill: none; }
.star-btn.is-on { color: var(--gold); border-color: var(--gold); }
.star-btn.is-on svg { fill: var(--gold-bright); stroke: var(--gold); }

.progress-wrap { margin-bottom: 18px; }
.progress-track { height: 7px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transition: width 0.45s cubic-bezier(0.22, 0.8, 0.28, 1);
}

.quiz-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}
.question-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3.4vw, 34px);
  box-shadow: var(--shadow-md);
}
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.q-series {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  padding: 4px 11px;
}
.q-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.q-text {
  font-family: var(--font-display);
  font-size: clamp(23px, 2.6vw, 30px);
  font-weight: 700;
  line-height: 1.75;
  margin: 0 0 26px;
  letter-spacing: 0;
}
.q-text .q-num-flag { color: var(--gold); }

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15.5px;
  line-height: 1.65;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
}
.option:hover:not(:disabled) { border-color: var(--gold); background: var(--surface); transform: translateX(-2px); }
.option:disabled { cursor: default; }
.option-letter {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.option-text { padding-top: 2px; }
.option.is-selected { border-color: var(--gold); background: var(--gold-soft); }
.option.is-selected .option-letter { background: var(--gold); border-color: var(--gold); color: #1d1607; }
.option.is-correct { border-color: var(--green-line); background: var(--green-bg); }
.option.is-correct .option-letter { background: var(--green); border-color: var(--green); color: #fff; }
.option.is-wrong { border-color: var(--red-line); background: var(--red-bg); }
.option.is-wrong .option-letter { background: var(--red); border-color: var(--red); color: #fff; }
.option.is-correct .option-text, .option.is-wrong .option-text { font-weight: 700; }
.option .opt-mark { margin-inline-start: auto; font-size: 16px; font-weight: 800; line-height: 1.4; }
.option.is-correct .opt-mark { color: var(--green); }
.option.is-wrong .opt-mark { color: var(--red); }

.feedback {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  animation: feedbackIn 0.3s cubic-bezier(0.22, 0.8, 0.28, 1) both;
}
@keyframes feedbackIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.feedback.is-good { background: var(--green-bg); border-color: var(--green-line); }
.feedback.is-bad { background: var(--red-bg); border-color: var(--red-line); }
.feedback-head { display: flex; align-items: center; gap: 9px; }
.feedback-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.feedback.is-good .feedback-badge { background: var(--green); }
.feedback.is-bad .feedback-badge { background: var(--red); }
.feedback.is-good .feedback-badge::before { content: "✓"; }
.feedback.is-bad .feedback-badge::before { content: "✕"; }
.feedback-head strong { font-size: 15px; }
.feedback.is-good .feedback-head strong { color: var(--green); }
.feedback.is-bad .feedback-head strong { color: var(--red); }
.feedback-answer { margin: 10px 0 0; font-size: 14.5px; font-weight: 700; color: var(--ink); }
.feedback-answer span { color: var(--green); }
.feedback-expl { margin: 8px 0 0; font-size: 13.8px; color: var(--ink-soft); line-height: 1.7; }
.feedback-expl::before { content: "توضيح: "; font-weight: 800; color: var(--muted); }

.quiz-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; }
.kbd-hint { font-size: 11.5px; color: var(--muted); }
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn:focus-visible, .icon-btn:focus-visible, .mode-card:focus-visible, .series-card:focus-visible, .brand:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink-card); color: var(--cream); }
.btn-primary:hover:not(:disabled) { background: var(--ink-card-2); }
[data-theme="dark"] .btn-primary { background: var(--gold); color: #1b1509; }
[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: var(--gold-bright); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: #fffdf6; }
.btn-gold:hover { background: var(--gold-bright); }
.btn-soft { background: var(--surface); border-color: var(--line-strong); color: var(--ink-soft); }
.btn-soft:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); padding: 9px 14px; }
.btn-ghost:hover { color: var(--ink); border-color: var(--line-strong); }
.btn-ghost .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.quiz-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 90px; }
.side-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.side-label { font-size: 11px; font-weight: 800; letter-spacing: 0.5px; color: var(--muted); }
.side-score { display: flex; align-items: baseline; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.side-score strong { font-size: 26px; color: var(--green); line-height: 1; }
.side-score strong.wrong { color: var(--red); }
.side-divider { width: 1px; height: 18px; background: var(--line); margin: 0 4px; align-self: center; }
.side-track { height: 5px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.side-fill { height: 100%; width: 0; background: var(--green); border-radius: inherit; transition: width 0.4s; }
.side-card small { font-size: 11.5px; color: var(--muted); }
.tip-card p { margin: 8px 0 0; font-size: 12.8px; color: var(--ink-soft); line-height: 1.7; }
.tip-card .side-label { color: var(--gold); }

/* ---------- result ---------- */
.result-card {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 46px);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 40px);
  box-shadow: var(--shadow-md);
}
.result-ring-wrap { position: relative; width: 200px; height: 200px; margin: 0 auto; }
.result-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 10; }
.ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 415;
  stroke-dashoffset: 415;
  transition: stroke-dashoffset 1s cubic-bezier(0.22, 0.8, 0.28, 1), stroke 0.3s;
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.ring-center strong { font-family: var(--font-display); font-size: 46px; line-height: 1; color: var(--ink); }
.ring-center span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.result-copy .eyebrow { margin-bottom: 14px; }
.result-copy h2 { font-family: var(--font-display); font-size: clamp(28px, 3.6vw, 40px); margin: 0 0 8px; line-height: 1.25; }
.result-copy > p { margin: 0 0 20px; color: var(--ink-soft); font-size: 14.5px; max-width: 560px; }
.result-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.result-stats > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 14px;
}
.result-stats strong { font-size: 19px; color: var(--green); }
.result-stats strong.wrong { color: var(--red); }
.result-stats span { font-size: 12px; color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.review-block { margin-top: 26px; }
.section-head.compact { margin-bottom: 12px; }
.review-list { display: flex; flex-direction: column; gap: 10px; }
.review-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.review-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  font-size: 14.5px;
  font-weight: 700;
  transition: background 0.2s;
}
.review-item summary::-webkit-details-marker { display: none; }
.review-item summary:hover { background: var(--bg-soft); }
.review-item summary .ri-count {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--red-bg);
  border: 1px solid var(--red-line);
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}
.review-item summary .ri-text { flex: 1; min-width: 0; }
.review-item summary .ri-chevron { color: var(--muted); transition: transform 0.2s; }
.review-item[open] summary .ri-chevron { transform: rotate(180deg); }
.review-body { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.review-line { font-size: 13.8px; line-height: 1.7; }
.review-line b { font-weight: 800; }
.review-line.you b { color: var(--red); }
.review-line.right b { color: var(--green); }
.review-expl { font-size: 13px; color: var(--muted); background: var(--bg-soft); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 10px 12px; }

/* ---------- footer ---------- */
.app-footer {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 32px) 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}
.footer-sep { opacity: 0.6; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 90;
  inset-inline: 0;
  bottom: 26px;
  margin-inline: auto;
  width: max-content;
  max-width: min(90vw, 420px);
  background: var(--ink-card);
  color: var(--cream);
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
[data-theme="dark"] .toast { background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-strong); }
.toast.is-on { opacity: 1; transform: translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .quiz-grid { grid-template-columns: minmax(0, 1fr); }
  .quiz-side { position: static; flex-direction: row; }
  .quiz-side .side-card { flex: 1; }
  .result-card { grid-template-columns: 1fr; text-align: center; }
  .result-copy .eyebrow { margin-inline: auto; }
  .result-copy > p { margin-inline: auto; }
  .result-stats, .result-actions { justify-content: center; }
}

@media (max-width: 640px) {
  .app-header { padding: 12px 16px; }
  .header-chip { display: none; }
  .brand-mark { width: 40px; height: 40px; font-size: 23px; }
  .brand-text strong { font-size: 19px; }
  .brand-text small { font-size: 11px; }
  .hero { margin-bottom: 26px; }
  .hero-sub { font-size: 15px; }
  .hero-stats { gap: 8px; }
  .stat { padding: 7px 11px; }
  .stat strong { font-size: 17px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { padding: 16px; }
  .mode-icon { width: 46px; height: 46px; border-radius: 13px; }
  .mode-card:hover { transform: none; }
  .settings-row { padding-bottom: 20px; }
  .settings-hint { display: none; }
  .section-head { align-items: center; }
  .section-count { display: none; }
  .quiz-bar { gap: 8px; }
  .quiz-bar-center { flex-direction: column; align-items: flex-end; gap: 0; }
  .quiz-mode { font-size: 10.5px; padding: 3px 9px; }
  .quiz-progress-text { font-size: 11.5px; }
  .question-card { padding: 18px 16px; border-radius: 18px; }
  .q-head { margin-bottom: 12px; }
  .q-text { font-size: 21px; line-height: 1.8; margin-bottom: 20px; }
  .option { padding: 12px 13px; font-size: 14.5px; }
  .option-letter { width: 27px; height: 27px; font-size: 13px; }
  .quiz-actions { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
  .quiz-actions .btn { width: 100%; }
  .kbd-hint { text-align: center; font-size: 11px; }
  .quiz-side .tip-card { display: none; }
  .result-card { padding: 24px 18px; }
  .result-ring-wrap { width: 170px; height: 170px; }
  .ring-center strong { font-size: 38px; }
  .resume-banner { flex-direction: column; align-items: stretch; }
  .resume-actions { justify-content: flex-end; }
  .source-note { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
