:root {
  --ink: #16332e;
  --muted: #657a74;
  --paper: #fbfaf5;
  --surface: #ffffff;
  --surface-soft: #f1f6ef;
  --line: #dce6df;
  --brand: #0a7b67;
  --brand-dark: #075d50;
  --brand-pale: #d8eee7;
  --lime: #d9ef79;
  --sun: #ffcc5c;
  --coral: #ff8068;
  --blue: #5797d1;
  --danger: #c84e43;
  --shadow: 0 16px 40px rgba(28, 61, 52, 0.1);
  --shadow-small: 0 6px 18px rgba(28, 61, 52, 0.08);
  --radius: 24px;
  --radius-small: 14px;
  color-scheme: light;
  font-family: "Avenir Next", "Nunito Sans", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 2%, rgba(217, 239, 121, 0.4), transparent 30rem),
    radial-gradient(circle at 94% 24%, rgba(87, 151, 209, 0.15), transparent 25rem),
    var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: 0.28;
  background-image: radial-gradient(rgba(10, 123, 103, 0.16) 0.8px, transparent 0.8px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a, label { touch-action: manipulation; }

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: calc(8px + env(safe-area-inset-top));
  left: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.boot-screen, .error-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.boot-mascot {
  display: block;
  font-size: 6rem;
  animation: bob 1.8s ease-in-out infinite;
}

.site-shell { min-height: 100vh; }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid rgba(220, 230, 223, 0.8);
  background: rgba(251, 250, 245, 0.88);
  backdrop-filter: blur(16px);
}

.header-inner {
  width: min(1180px, calc(100% - 32px));
  height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 6px;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand);
  font-size: 1.6rem;
  box-shadow: 0 7px 0 #075b4e;
  transform: rotate(-4deg);
}

.brand em { color: var(--brand); font-style: normal; }
.brand-text { white-space: nowrap; }

.desktop-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.nav-link {
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 10px 15px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active { background: var(--brand-pale); color: var(--brand-dark); }

.sound-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
  font-size: 1.15rem;
  box-shadow: var(--shadow-small);
}

.grade-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 5px 4px 13px;
  background: white;
  box-shadow: var(--shadow-small);
}

.grade-picker-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.grade-picker select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 28px 5px 11px;
  background: var(--brand-pale);
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 850;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 46px 0 112px;
  animation: rise 350ms ease both;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 475px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  padding: clamp(34px, 6vw, 76px);
  border-radius: 36px;
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 27px;
  pointer-events: none;
}

.hero::before {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  right: -120px;
  top: -180px;
  border: 78px solid rgba(217, 239, 121, 0.16);
  border-radius: 50%;
}

.hero-copy { position: relative; z-index: 2; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero .eyebrow {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--lime);
}

.hero-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.hero-badges .eyebrow { margin: 0 0 20px; }
.hero-grade { margin-bottom: 20px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: 6px 11px; background: rgba(255,255,255,.1); color: white; font-size: .77rem; font-weight: 900; }

.hero h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(2.75rem, 6vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: -0.065em;
}

.hero h1 span { color: var(--lime); }

.hero-copy > p:not(.eyebrow) {
  max-width: 620px;
  margin: 24px 0 30px;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 2vw, 1.23rem);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 15px;
  padding: 13px 20px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 5px 0 var(--brand-dark);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--brand-dark); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--brand-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-lime { background: var(--lime); color: var(--brand-dark); box-shadow: 0 5px 0 #99b747; }
.btn-lime:hover { box-shadow: 0 7px 0 #99b747; }
.btn-secondary { background: white; color: var(--ink); box-shadow: 0 5px 0 #dbe4de; }
.btn-secondary:hover { box-shadow: 0 7px 0 #dbe4de; }
.btn-ghost { border: 1px solid var(--line); background: transparent; color: var(--ink); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-soft); box-shadow: none; }
.btn-danger { background: var(--danger); box-shadow: 0 5px 0 #8f3933; }
.btn-block { width: 100%; }

.hero-visual {
  position: relative;
  z-index: 2;
  min-height: 310px;
  display: grid;
  place-items: center;
}

.mascot-stage {
  width: min(330px, 90%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.mascot-main { font-size: clamp(8rem, 16vw, 12rem); filter: drop-shadow(0 20px 10px rgba(0, 0, 0, 0.15)); animation: bob 3s ease-in-out infinite; }

.float-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 16px;
  padding: 10px 14px;
  background: white;
  color: var(--ink);
  font-weight: 850;
  box-shadow: var(--shadow-small);
}

.float-card.one { top: 8%; left: 0; transform: rotate(-5deg); }
.float-card.two { right: 0; bottom: 12%; transform: rotate(4deg); }

.float-symbol {
  position: absolute;
  display: grid;
  place-items: center;
  color: var(--lime);
  font-weight: 950;
  text-shadow: 0 8px 18px rgba(0,0,0,.15);
}
.float-symbol.plus { right: 3%; top: 13%; font-size: 2.8rem; transform: rotate(12deg); }
.float-symbol.star { left: 6%; bottom: 14%; font-size: 2.2rem; }
.float-symbol.book { right: 14%; bottom: -2%; width: 55px; height: 44px; border-radius: 8px 8px 14px 14px; background: var(--sun); color: var(--brand-dark); transform: rotate(-8deg); box-shadow: 0 7px 0 #d29e2f; }

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 22px;
}

.stat-tile {
  position: relative;
  min-height: 118px;
  overflow: hidden;
  padding: 22px 22px 18px 66px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.stat-tile small { display: block; color: var(--muted); font-weight: 750; }
.stat-tile strong { display: block; margin-top: 4px; font-size: 1.85rem; letter-spacing: -0.04em; }
.stat-tile em { display: block; color: #91a19c; font-size: .72rem; font-style: normal; font-weight: 700; }
.stat-icon { position: absolute; left: 17px; top: 20px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; font-weight: 950; }
.stat-icon.green { background: #dff3ea; color: var(--brand); }
.stat-icon.blue { background: #e4f0fb; color: #3476b2; }
.stat-icon.orange { background: #fff0dc; color: #c66a28; }
.stat-icon.purple { background: #eee7f8; color: #7553aa; }

.section { margin-top: 66px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-heading h1, .section-heading h2 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.7rem); letter-spacing: -0.045em; line-height: 1.1; }
.section-heading p { max-width: 620px; margin: 8px 0 0; color: var(--muted); }

.subject-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.subject-card {
  position: relative;
  min-height: 245px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-small);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.subject-card:hover { transform: translateY(-5px); border-color: var(--subject-color, var(--brand)); box-shadow: var(--shadow); }
.subject-card::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 5px; background: var(--subject-color); }
.subject-card-glow { position: absolute; width: 155px; height: 155px; right: -72px; bottom: -68px; border-radius: 50%; background: color-mix(in srgb, var(--subject-color) 13%, white); pointer-events: none; transition: transform 220ms ease; }
.subject-card:hover .subject-card-glow { transform: scale(1.2); }
.subject-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: color-mix(in srgb, var(--subject-color) 16%, white); font-size: 2rem; }
.subject-card h3 { margin: 23px 0 6px; font-size: 1.3rem; letter-spacing: -0.025em; }
.subject-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.subject-card .card-arrow { position: absolute; right: 22px; top: 25px; color: var(--subject-color); font-size: 1.35rem; transition: transform 180ms ease; }
.subject-card:hover .card-arrow { transform: translateX(4px); }
.mini-progress { width: 100%; height: 7px; margin-top: auto; border-radius: 999px; background: #edf1ed; overflow: hidden; }
.mini-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--subject-color); }
.progress-label { width: 100%; display: flex; justify-content: space-between; margin-top: 7px !important; font-size: 0.78rem !important; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card { padding: 28px; border-radius: var(--radius); background: var(--surface-soft); }
.feature-card span { font-size: 2rem; }
.feature-card h3 { margin: 18px 0 8px; }
.feature-card p { margin: 0; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 12px; margin: 26px 0; }

.grade-switcher {
  display: grid;
  grid-template-columns: repeat(5, minmax(104px, 1fr));
  gap: 9px;
  margin: 26px 0;
  border: 1px solid var(--line);
  border-radius: 21px;
  padding: 8px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow-small);
}

.grade-tab {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}
.grade-tab span { color: #9aaba6; font-size: .7rem; font-weight: 950; }
.grade-tab:hover { background: var(--surface-soft); color: var(--ink); }
.grade-tab.active { background: var(--brand); color: white; box-shadow: 0 5px 0 var(--brand-dark); }
.grade-tab.active span { color: var(--lime); }
.search-field { position: relative; flex: 1; }
.search-field span { position: absolute; top: 50%; left: 16px; transform: translateY(-50%); }
.search-field input, .select-field {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  padding: 12px 16px;
  color: var(--ink);
}
.search-field input { padding-left: 46px; }
.select-field { width: auto; min-width: 175px; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; color: var(--muted); font-size: 0.9rem; }
.breadcrumb button { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 4px; font-weight: 750; }

.subject-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  border-radius: 30px;
  padding: 38px;
  background: var(--subject-color);
  color: white;
}
.subject-hero-icon { width: 120px; height: 120px; display: grid; place-items: center; border-radius: 28px; background: rgba(255, 255, 255, 0.18); font-size: 4rem; }
.subject-hero h1 { margin: 0; font-size: clamp(2.3rem, 6vw, 4.2rem); line-height: 1; letter-spacing: -0.055em; }
.subject-hero p { max-width: 690px; margin: 14px 0 0; color: rgba(255, 255, 255, 0.82); }
.subject-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 21px; }
.subject-hero-chips span { border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: 6px 11px; background: rgba(255,255,255,.12); color: white; font-size: .78rem; font-weight: 850; }

.topic-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.topic-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 20px;
  background: white;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-small);
}
.topic-card:hover { border-color: var(--subject-color); transform: translateY(-2px); }
.topic-card > span:nth-child(2) { min-width: 0; }
.topic-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: color-mix(in srgb, var(--subject-color) 14%, white); font-size: 1.6rem; }
.topic-card strong { display: block; overflow-wrap: anywhere; font-size: 1.07rem; }
.topic-card small { color: var(--muted); overflow-wrap: anywhere; }

.setup-layout { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 28px; align-items: start; }
.setup-summary, .setup-panel, .quiz-panel, .result-panel, .dashboard-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: white;
  box-shadow: var(--shadow-small);
}
.setup-summary { position: sticky; top: 100px; padding: 30px; text-align: center; }
.setup-summary { overflow: hidden; background: linear-gradient(155deg, color-mix(in srgb, var(--subject-color) 10%, white), white 58%); }
.setup-orbit { position: absolute; width: 260px; height: 260px; top: -170px; right: 0; border: 40px solid color-mix(in srgb, var(--subject-color) 12%, transparent); border-radius: 50%; }
.setup-summary .big-icon { display: block; font-size: 6rem; }
.setup-summary h1 { margin: 14px 0 5px; }
.setup-summary p { color: var(--muted); }
.setup-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 20px; }
.setup-facts span { border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; background: white; color: var(--muted); font-size: .72rem; font-weight: 800; }
.setup-panel { padding: clamp(24px, 5vw, 40px); }
.choice-group { margin-bottom: 30px; }
.choice-group legend, .choice-title { display: block; margin-bottom: 12px; font-weight: 900; font-size: 1.05rem; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.difficulty-grid { grid-template-columns: repeat(4, 1fr); }
.choice-input { position: absolute; opacity: 0; pointer-events: none; }
.choice-label { min-height: 72px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 16px; padding: 10px; background: white; cursor: pointer; text-align: center; font-weight: 800; }
.choice-input:checked + .choice-label { border-color: var(--brand); background: var(--brand-pale); color: var(--brand-dark); }
.choice-input:focus-visible + .choice-label { outline: 3px solid var(--sun); outline-offset: 2px; }
.availability-note { margin: -12px 0 25px; color: var(--muted); font-size: 0.9rem; }
.exam-blueprint { margin: 8px 0 28px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-soft); }
.exam-blueprint-head { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, var(--brand-pale), white); }
.exam-blueprint-head > span { padding: 18px; text-align: center; }
.exam-blueprint-head > span + span { border-left: 1px solid var(--line); }
.exam-blueprint-head strong, .exam-blueprint-head small { display: block; }
.exam-blueprint-head strong { color: var(--brand-dark); font-size: 1.2rem; }
.exam-blueprint-head small { margin-top: 3px; color: var(--muted); }
.exam-blueprint ul { display: grid; gap: 0; margin: 0; padding: 8px 18px; list-style: none; }
.exam-blueprint li { display: flex; justify-content: space-between; gap: 20px; padding: 11px 3px; border-bottom: 1px dashed var(--line); }
.exam-blueprint li:last-child { border-bottom: 0; }
.exam-blueprint li span { color: var(--muted); }

.quiz-page { width: min(780px, calc(100% - 28px)); padding-top: 24px; }
.quiz-topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 20px; }
.icon-button { width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; font-size: 1.1rem; }
.quiz-meta { min-width: 0; text-align: center; }
.quiz-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz-meta small { color: var(--muted); }
.quiz-status { display: flex; align-items: center; gap: 8px; }
.score-pill { border-radius: 999px; padding: 9px 14px; background: var(--brand-pale); color: var(--brand-dark); font-weight: 900; white-space: nowrap; }
.countdown-pill { min-width: 72px; border: 1px solid #e7c66e; border-radius: 999px; padding: 8px 12px; background: #fff5d9; color: #79570e; font-variant-numeric: tabular-nums; font-weight: 950; text-align: center; white-space: nowrap; }
.countdown-pill.urgent { border-color: #e99587; background: #ffebe6; color: #9d4036; animation: countdown-pulse 1s ease-in-out infinite; }
.progress-track { height: 11px; margin-bottom: 18px; border-radius: 999px; overflow: hidden; background: #e5ebe6; }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #37ad80); transition: width 300ms ease; }
.quiz-panel { padding: clamp(24px, 6vw, 48px); }
.question-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.question-number { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; background: var(--brand); color: white; font-size: 1.05rem; font-weight: 950; box-shadow: 0 5px 0 var(--brand-dark); }
.question-tags { display: flex; gap: 8px; margin-bottom: 22px; }
.question-heading-row .question-tags { justify-content: flex-end; margin: 0; }
.tag { border-radius: 999px; padding: 5px 10px; background: var(--surface-soft); color: var(--muted); font-size: 0.77rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0.06em; }
.tag-hard { background: #fde8e4; color: #9d4036; }
.tag-medium { background: #fff1ce; color: #8b6718; }
.quiz-panel h1 { min-height: 90px; margin: 0 0 26px; font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.35; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.audio-prompt-button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; margin: -8px 0 20px; border: 1px solid #a8cce8; border-radius: 16px; padding: 14px; background: #eef7ff; color: #245c87; cursor: pointer; font-size: 1rem; font-weight: 900; }
.audio-prompt-button:hover { border-color: #5799ca; background: #e1f1fd; }
.audio-prompt-button small { color: #5680a0; font-weight: 700; }
.option-list { display: grid; gap: 12px; }
.option-button {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  background: white;
  text-align: left;
  cursor: pointer;
  font-weight: 750;
  transition: border 140ms ease, background 140ms ease, transform 140ms ease;
}
.option-button:not(:disabled):hover { border-color: var(--brand); transform: translateX(3px); }
.option-button > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.option-key { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-weight: 900; }
.option-button.selected { border-color: var(--blue); background: #eef7ff; }
.option-button.correct { border-color: var(--brand); background: #e4f5eb; color: var(--brand-dark); }
.option-button.wrong { border-color: var(--danger); background: #fff0ed; color: #913b32; }
.option-button:disabled { cursor: default; }
.answer-mark { font-size: 1.25rem; }
.feedback-box { margin-top: 18px; border-left: 5px solid var(--brand); border-radius: 0 15px 15px 0; padding: 16px 18px; background: var(--surface-soft); animation: rise 220ms ease both; }
.feedback-box.wrong { border-color: var(--coral); background: #fff3ef; }
.feedback-box strong { display: block; margin-bottom: 4px; }
.feedback-box p { margin: 0; color: var(--muted); }
.quiz-actions { display: flex; justify-content: flex-end; margin-top: 20px; }

.result-page { width: min(900px, calc(100% - 28px)); }
.result-panel { overflow: hidden; }
.result-head { position: relative; padding: 42px; background: var(--brand); color: white; text-align: center; }
.result-head { overflow: hidden; }
.result-head::after { content: ""; position: absolute; width: 330px; height: 330px; right: -190px; top: -190px; border: 55px solid rgba(217,239,121,.16); border-radius: 50%; }
.confetti-dot { position: absolute; width: 13px; height: 13px; border-radius: 4px; background: var(--sun); transform: rotate(18deg); }
.confetti-dot.dot-one { left: 12%; top: 22%; }
.confetti-dot.dot-two { right: 15%; top: 52%; background: var(--lime); transform: rotate(55deg); }
.confetti-dot.dot-three { left: 22%; bottom: 14%; background: #7db7e9; transform: rotate(-35deg); }
.result-head > * { position: relative; z-index: 2; }
.result-head h1 { margin: 8px 0; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -0.05em; }
.result-head p { margin: 0 auto; max-width: 560px; color: rgba(255,255,255,.8); }
.result-score { width: 150px; height: 150px; display: grid; place-content: center; margin: 0 auto 18px; border: 12px solid var(--lime); border-radius: 50%; background: white; color: var(--brand-dark); box-shadow: 0 15px 30px rgba(0,0,0,.15); }
.result-score strong { font-size: 2.4rem; line-height: 1; }
.result-score span { font-size: .8rem; font-weight: 850; color: var(--muted); }
.result-body { padding: clamp(24px, 5vw, 42px); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.result-stat { padding: 17px; border-radius: 16px; background: var(--surface-soft); text-align: center; }
.result-stat strong { display: block; font-size: 1.35rem; }
.result-stat small { color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.review-list { display: grid; gap: 10px; margin-top: 18px; }
.review-item { border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.review-item summary { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px; cursor: pointer; font-weight: 750; }
.review-detail { margin: 12px 0 0 31px; color: var(--muted); }
.review-detail p { margin: 5px 0; }

.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.dashboard-panel { padding: 25px; }
.dashboard-panel.wide { grid-column: span 3; }
.dashboard-panel.side { grid-column: span 1; }
.dashboard-panel h2 { margin: 0 0 18px; font-size: 1.22rem; }
.subject-progress-list { display: grid; gap: 14px; }
.subject-progress-row { display: grid; grid-template-columns: minmax(110px, .5fr) 1fr 50px; align-items: center; gap: 12px; }
.subject-progress-row strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 9px; overflow: hidden; border-radius: 99px; background: #e8ede9; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--row-color, var(--brand)); }
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge-item { min-height: 145px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-soft); }
.badge-item.locked { filter: grayscale(1); opacity: .48; }
.badge-item span { font-size: 2rem; }
.badge-item strong { display: block; margin: 8px 0 3px; }
.badge-item small { color: var(--muted); }
.session-list { display: grid; gap: 8px; }
.session-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.session-item:last-child { border-bottom: 0; }
.session-item small { display: block; color: var(--muted); }
.empty-state { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty-state span { display: block; font-size: 4rem; }

.bottom-nav { display: none; }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 9px; }
.toast { max-width: 350px; border-radius: 15px; padding: 14px 18px; background: var(--ink); color: white; box-shadow: var(--shadow); animation: slide-in 240ms ease both; }

.modal-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); background: rgba(12, 40, 34, .5); backdrop-filter: blur(4px); }
.modal { width: min(460px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; border-radius: 24px; padding: 28px; background: white; box-shadow: var(--shadow); }
.modal h2 { margin-top: 0; }
.modal p { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.site-footer {
  width: min(1180px, calc(100% - 32px));
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  padding: 28px 0 46px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.site-footer > div { display: flex; align-items: center; gap: 13px; }
.site-footer p { margin: 0; }
.site-footer strong { color: var(--ink); }
.site-footer small { color: var(--muted); }
.footer-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--brand-pale); font-size: 1.7rem; }
.footer-note { font-size: .78rem; font-weight: 700; text-align: right; }

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes countdown-pulse { 50% { box-shadow: 0 0 0 5px rgba(229, 105, 85, .12); } }

@media (max-width: 980px) {
  .header-inner { gap: 12px; }
  .nav-link { padding-inline: 11px; }
  .subject-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { grid-template-columns: 1fr 0.65fr; }
  .quick-stats, .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-panel.wide, .dashboard-panel.side { grid-column: span 2; }
}

@media (max-width: 840px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { min-height: 275px; }
  .mascot-stage { width: 260px; }
  .mascot-main { font-size: 9rem; }
  .setup-layout { grid-template-columns: 1fr; }
  .setup-summary { position: relative; top: auto; }
}

@media (max-width: 720px) {
  .header-inner { height: 66px; }
  .desktop-nav { display: none; }
  .grade-picker { margin-left: auto; }
  .grade-picker-label { display: none; }
  .grade-picker select { max-width: 100px; }
  .page { width: min(100% - 24px, 620px); padding: 24px 0 100px; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding: 34px 24px; border-radius: 28px; }
  .hero h1 { font-size: clamp(2.5rem, 15vw, 4rem); }
  .hero-visual { min-height: 260px; }
  .mascot-stage { width: 245px; }
  .mascot-main { font-size: 8rem; }
  .float-card { font-size: .8rem; }
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
  .stat-tile { min-height: 100px; padding: 17px; }
  .stat-tile { padding-left: 57px; }
  .stat-icon { left: 13px; top: 16px; }
  .stat-tile strong { font-size: 1.5rem; }
  .section { margin-top: 44px; }
  .section-heading { align-items: start; flex-direction: column; }
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .subject-card { min-height: 218px; padding: 19px; }
  .feature-grid, .topic-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .grade-switcher { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .grade-switcher::-webkit-scrollbar { display: none; }
  .grade-tab { min-width: 105px; scroll-snap-align: start; }
  .select-field { width: 100%; }
  .subject-hero { padding: 28px 23px; }
  .subject-hero-icon { width: 82px; height: 82px; font-size: 2.8rem; }
  .setup-layout { grid-template-columns: 1fr; }
  .setup-summary { position: relative; top: auto; }
  .setup-summary .big-icon { font-size: 4rem; }
  .choice-grid { grid-template-columns: 1fr; }
  .difficulty-grid { grid-template-columns: repeat(2, 1fr); }
  .question-heading-row .question-tags { flex-wrap: wrap; }
  .result-head { padding: 30px 20px; }
  .result-score { width: 130px; height: 130px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-panel.wide, .dashboard-panel.side { grid-column: span 1; }
  .bottom-nav {
    position: fixed;
    z-index: 60;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    min-height: 68px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 5px;
    background: rgba(255,255,255,.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
  }
  .bottom-nav button { border: 0; border-radius: 15px; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 800; }
  .bottom-nav button span { display: block; font-size: 1.25rem; }
  .bottom-nav button.active { background: var(--brand-pale); color: var(--brand-dark); }
  .toast-region { right: 12px; bottom: calc(92px + env(safe-area-inset-bottom)); left: 12px; }
  .toast { width: 100%; max-width: none; }
  .site-footer { width: calc(100% - 24px); align-items: flex-start; flex-direction: column; padding-bottom: calc(105px + env(safe-area-inset-bottom)); }
  .footer-note { text-align: left; }
}

@media (max-width: 440px) {
  .header-inner { width: calc(100% - 20px); gap: 8px; }
  .brand { padding: 2px; }
  .brand-text { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .sound-button { width: 40px; height: 40px; flex: 0 0 40px; }
  .grade-picker { padding: 3px; }
  .grade-picker select { max-width: 90px; padding-inline: 10px 24px; }
  .subject-grid { grid-template-columns: 1fr; }
  .subject-card { min-height: 190px; }
  .quick-stats, .result-stats { grid-template-columns: 1fr 1fr; }
  .result-stats .result-stat:last-child { grid-column: span 2; }
  .subject-hero { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
  .result-actions .btn { width: 100%; }
  .badge-grid { grid-template-columns: 1fr; }
  .quiz-topbar { gap: 8px; }
  .quiz-status { flex-direction: column; align-items: stretch; gap: 4px; }
  .score-pill, .countdown-pill { padding: 5px 9px; font-size: .78rem; text-align: center; }
  .quiz-panel { padding: 22px 18px; }
  .question-heading-row { align-items: flex-start; }
  .question-number { flex: 0 0 46px; width: 46px; height: 46px; }
  .option-button { gap: 10px; padding: 11px 12px; }
  .review-detail { margin-left: 10px; }
  .modal { padding: 23px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@media (hover: none) {
  .btn:hover, .subject-card:hover, .topic-card:hover, .option-button:not(:disabled):hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
