:root {
  --ink: #18312f;
  --muted: #687b77;
  --soft: #8c9a96;
  --paper: #ffffff;
  --canvas: #f3f6f4;
  --line: #dfe7e3;
  --line-strong: #ccd9d3;
  --brand: #157f6c;
  --brand-dark: #0e5f52;
  --brand-soft: #e5f4ef;
  --navy: #163b3a;
  --accent: #e9a34a;
  --danger: #c95252;
  --danger-soft: #fff0ee;
  --success: #278366;
  --success-soft: #e9f6ef;
  --warning-soft: #fff7e8;
  --shadow: 0 10px 35px rgba(24, 49, 47, .06);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(21, 127, 108, .2);
  outline-offset: 2px;
}
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 244px;
  padding: 30px 20px 22px;
  display: flex;
  flex-direction: column;
  color: #dceae5;
  background:
    radial-gradient(circle at 10% 0%, rgba(62, 157, 132, .18), transparent 35%),
    var(--navy);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 34px; }
.brand-mark {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--navy);
  background: #8ad4bd;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 25px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.brand strong { display: block; color: white; font-size: 21px; letter-spacing: 2px; line-height: 1.2; }
.brand small { display: block; margin-top: 5px; color: #9dbbb3; font-size: 11px; letter-spacing: .5px; }
.main-nav { display: grid; gap: 8px; }
.nav-item {
  position: relative;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  border-radius: 12px;
  color: #acc5be;
  background: transparent;
  text-align: left;
  transition: .2s ease;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: rgba(115, 201, 174, .15); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -20px;
  width: 3px;
  height: 24px;
  border-radius: 0 3px 3px 0;
  background: #7ed1b7;
}
.nav-item svg { width: 19px; }
.nav-count {
  margin-left: auto;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #d8eee7;
  background: rgba(255,255,255,.1);
  font-size: 11px;
}
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: #e9a34a; }
.sidebar-bottom { margin-top: auto; }
.local-note {
  margin: 20px 4px 14px;
  padding: 15px 12px;
  display: flex;
  gap: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 13px;
  background: rgba(255,255,255,.035);
}
.local-note svg { width: 18px; color: #82c7b2; }
.local-note strong, .local-note span { display: block; }
.local-note strong { color: #d9e9e4; font-size: 12px; }
.local-note span { margin-top: 2px; color: #88a9a1; font-size: 10px; }
.text-button { padding: 3px; border: 0; background: transparent; color: var(--brand); }
.text-button:hover { text-decoration: underline; }
.text-button.subtle { width: 100%; color: #789b91; font-size: 11px; }
.sidebar-scrim { display: none; }
.workspace { min-height: 100vh; margin-left: 244px; }
.topbar {
  height: 88px;
  padding: 0 clamp(24px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(204, 217, 211, .65);
  background: rgba(243, 246, 244, .88);
  backdrop-filter: blur(12px);
}
.topbar-title span, .topbar-title small { display: block; }
.topbar-title span { font-size: 17px; font-weight: 700; }
.topbar-title small { margin-top: 1px; color: var(--muted); font-size: 12px; }
.mobile-menu { display: none !important; }
#app { max-width: 1440px; margin: 0 auto; padding: 34px clamp(24px, 4vw, 56px) 60px; }

.button {
  min-height: 43px;
  padding: 10px 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 650;
  font-size: 14px;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { color: white; background: var(--brand); box-shadow: 0 5px 15px rgba(21,127,108,.16); }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }
.button.secondary:hover { border-color: #a9c3b9; background: #fbfdfc; }
.button.ghost { color: var(--brand); background: var(--brand-soft); }
.button.danger { color: white; background: var(--danger); }
.button.compact { min-height: 38px; padding: 7px 14px; font-size: 13px; }
.button.large { min-height: 51px; padding: 12px 25px; border-radius: 13px; font-size: 15px; }
.button svg { width: 17px; height: 17px; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
}
.icon-button:hover { background: var(--brand-soft); }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.section-heading { margin: 32px 0 16px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 0; font-size: 19px; line-height: 1.4; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.section-heading:first-child { margin-top: 0; }

.hero {
  position: relative;
  min-height: 260px;
  padding: clamp(28px, 4vw, 46px);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  align-items: center;
  gap: 30px;
  overflow: hidden;
  border: 0;
  color: white;
  background:
    radial-gradient(circle at 88% 12%, rgba(139, 216, 190, .23), transparent 27%),
    linear-gradient(120deg, #163b3a, #1a5550);
}
.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -140px;
  width: 390px;
  height: 390px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
  box-shadow: 0 0 0 48px rgba(255,255,255,.025), 0 0 0 96px rgba(255,255,255,.02);
}
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--brand); font-size: 12px; font-weight: 750; letter-spacing: 1.5px; }
.hero .eyebrow { color: #99d8c4; }
.eyebrow::before { content: ""; width: 20px; height: 2px; background: currentColor; }
.hero h1 { max-width: 580px; margin: 13px 0 12px; font-size: clamp(28px, 3.1vw, 40px); line-height: 1.3; letter-spacing: .5px; }
.hero p { max-width: 570px; margin: 0; color: #b9d2cb; font-size: 14px; }
.hero-actions { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 11px; }
.hero .button.primary { color: #153c37; background: #8bd5bd; box-shadow: none; }
.hero .button.primary:hover { background: #a3e3ce; }
.hero .button.secondary { border-color: rgba(255,255,255,.2); color: #e4f1ed; background: rgba(255,255,255,.06); }
.hero-side { position: relative; z-index: 1; justify-self: end; width: min(100%, 285px); }
.hero-progress { padding: 23px; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: rgba(255,255,255,.07); backdrop-filter: blur(8px); }
.hero-progress-label { display: flex; justify-content: space-between; color: #b9d4cc; font-size: 12px; }
.hero-progress-value { margin: 8px 0 13px; font-size: 35px; font-weight: 750; line-height: 1.2; }
.hero-progress-value small { font-size: 14px; font-weight: 500; color: #b9d4cc; }
.progress-track { height: 7px; overflow: hidden; border-radius: 10px; background: #e5ebe8; }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .35s ease; }
.hero .progress-track { background: rgba(255,255,255,.13); }
.hero .progress-track > span { background: #8bd5bd; }
.hero-progress-note { margin-top: 12px; color: #a8c7be; font-size: 11px; }

.stat-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { padding: 21px; display: flex; align-items: center; gap: 15px; box-shadow: none; }
.stat-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: var(--brand); background: var(--brand-soft); }
.stat-icon.orange { color: #b57528; background: var(--warning-soft); }
.stat-icon.red { color: var(--danger); background: var(--danger-soft); }
.stat-icon.blue { color: #507a9b; background: #edf4f9; }
.stat-card strong { display: block; font-size: 25px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; }
.topic-list { padding: 8px 22px 18px; }
.topic-row { padding: 13px 0; border-bottom: 1px solid #edf1ef; }
.topic-row:last-child { border-bottom: 0; }
.topic-row-head { margin-bottom: 8px; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.topic-row-head span:last-child { color: var(--muted); font-size: 12px; }
.topic-row .progress-track { height: 5px; }
.source-list { padding: 8px 22px 20px; }
.source-item { padding: 15px 0; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #edf1ef; }
.source-item:last-child { border-bottom: 0; }
.source-index { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: var(--brand); background: var(--brand-soft); font-size: 11px; font-weight: 750; }
.source-item strong, .source-item small { display: block; }
.source-item strong { font-size: 13px; }
.source-item small { color: var(--muted); font-size: 11px; }
.source-item > span:last-child { margin-left: auto; font-size: 13px; font-weight: 700; }
.notice {
  margin-top: 20px;
  padding: 15px 18px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid #eddfbf;
  border-radius: 13px;
  color: #755a2d;
  background: var(--warning-soft);
  font-size: 13px;
}
.notice svg { margin-top: 2px; width: 18px; }
.notice.info { border-color: #cfe1db; color: #35675b; background: var(--brand-soft); }
.notice strong { display: block; }
.notice p { margin: 2px 0 0; }
.empty-state { padding: 60px 24px; text-align: center; color: var(--muted); }
.empty-state-icon { width: 64px; height: 64px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 20px; color: var(--brand); background: var(--brand-soft); }
.empty-state-icon svg { width: 29px; height: 29px; }
.empty-state h2, .empty-state h3 { margin: 0 0 8px; color: var(--ink); }
.empty-state p { max-width: 450px; margin: 0 auto 20px; }

.filter-card { margin-bottom: 18px; padding: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; box-shadow: none; }
.search-box { position: relative; flex: 1 1 260px; }
.search-box svg { position: absolute; left: 13px; top: 50%; width: 17px; color: var(--soft); transform: translateY(-50%); }
.search-box input { width: 100%; padding-left: 40px; }
input, select {
  min-height: 41px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: white;
}
input::placeholder { color: #96a49f; }
select { max-width: 190px; cursor: pointer; }
.filter-count { margin-left: auto; padding: 0 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.learn-layout, .exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 20px; }
.question-card { overflow: hidden; }
.question-top { padding: 20px 26px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #e8eeeb; background: #fbfcfb; }
.question-position { font-size: 13px; font-weight: 700; }
.question-position strong { margin-right: 3px; font-size: 22px; }
.question-top .progress-track { flex: 1; height: 5px; }
.question-actions-top { display: flex; gap: 5px; }
.question-actions-top .icon-button { width: 35px; height: 35px; border: 0; background: transparent; color: var(--muted); }
.question-actions-top .icon-button.active { color: #b87825; background: var(--warning-soft); }
.question-body { padding: 28px clamp(22px, 3vw, 34px) 30px; }
.badges { margin-bottom: 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.badge { padding: 3px 9px; display: inline-flex; align-items: center; border-radius: 6px; color: #4f6b64; background: #edf2ef; font-size: 11px; font-weight: 650; }
.badge.topic { color: var(--brand-dark); background: var(--brand-soft); }
.badge.warning { color: #946324; background: var(--warning-soft); }
.badge.hardware { color: #6d5c8b; background: #f2eff8; }
.question-stem { margin: 0 0 24px; white-space: pre-line; font-size: 17px; font-weight: 650; line-height: 1.85; }
.options { display: grid; gap: 11px; }
.option {
  width: 100%;
  min-height: 57px;
  padding: 14px 17px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: white;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.option:hover:not(:disabled) { border-color: #8ebdae; background: #fbfefd; }
.option-key {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  border: 1px solid #d4dfda;
  border-radius: 8px;
  color: #6d7e79;
  background: #f7f9f8;
  font-size: 12px;
  font-weight: 750;
}
.option.multiple .option-key { border-radius: 6px; }
.option-text { padding-top: 1px; white-space: pre-line; line-height: 1.7; }
.option.selected { border-color: var(--brand); background: #f0f9f6; box-shadow: inset 0 0 0 1px var(--brand); }
.option.selected .option-key { border-color: var(--brand); color: white; background: var(--brand); }
.option.correct { border-color: #77b89c; background: var(--success-soft); }
.option.correct .option-key { border-color: var(--success); color: white; background: var(--success); }
.option.wrong { border-color: #dc9d98; background: var(--danger-soft); }
.option.wrong .option-key { border-color: var(--danger); color: white; background: var(--danger); }
.option:disabled { cursor: default; }
.option-mark { margin-left: auto; padding-left: 8px; font-size: 12px; font-weight: 700; }
.option-mark.correct { color: var(--success); }
.option-mark.wrong { color: var(--danger); }
.answer-hint { margin: 13px 0 0; color: var(--muted); font-size: 12px; }
.question-footer { margin-top: 25px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.question-footer-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.feedback { margin-top: 23px; padding: 20px; border-radius: 14px; background: #f5f8f6; }
.feedback.correct { border-left: 3px solid var(--success); background: var(--success-soft); }
.feedback.wrong { border-left: 3px solid var(--danger); background: var(--danger-soft); }
.feedback.pending { border-left: 3px solid var(--accent); background: var(--warning-soft); }
.feedback-title { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; font-weight: 750; }
.feedback.correct .feedback-title { color: var(--success); }
.feedback.wrong .feedback-title { color: var(--danger); }
.correct-answer { margin-bottom: 12px; font-size: 14px; }
.explanation { white-space: pre-line; color: #435c56; font-size: 14px; line-height: 1.85; }
.explanation-label { margin: 12px 0 5px; color: var(--ink); font-size: 12px; font-weight: 750; }
.explanation-image { display: block; max-width: 100%; max-height: 520px; margin: 15px auto 5px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.question-side { padding: 20px; box-shadow: none; }
.question-side h3 { margin: 0 0 5px; font-size: 14px; }
.question-side > p { margin: 0 0 15px; color: var(--muted); font-size: 11px; }
.question-map { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; max-height: 410px; overflow: auto; }
.map-button {
  aspect-ratio: 1;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  font-size: 11px;
}
.map-button:hover { border-color: var(--brand); }
.map-button.current { border-color: var(--brand); color: white; background: var(--brand); }
.map-button.done:not(.current) { border-color: #b9dacc; color: var(--brand-dark); background: var(--brand-soft); }
.map-button.flagged:not(.current) { border-color: #e6c382; color: #996821; background: var(--warning-soft); }
.question-jump { margin-top: 14px; display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.question-jump input { min-width: 0; min-height: 36px; padding: 6px 9px; font-size: 12px; }
.question-jump .button { min-height: 36px; padding: 6px 11px; }
.map-legend { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 10px; }
.map-legend span { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 8px; height: 8px; border: 1px solid var(--line-strong); border-radius: 2px; }
.legend-dot.done { border-color: #b9dacc; background: var(--brand-soft); }
.legend-dot.flagged { border-color: #e6c382; background: var(--warning-soft); }
.side-tip { margin-top: 18px; padding: 13px; border-radius: 10px; color: var(--muted); background: #f5f7f6; font-size: 11px; }
.question-nav { margin-top: 18px; display: flex; justify-content: space-between; gap: 12px; }

.exam-intro { display: grid; grid-template-columns: 1fr 1.25fr; gap: 22px; }
.exam-pitch { padding: 34px; color: white; background: linear-gradient(145deg, #173c3a, #23665a); border: 0; }
.exam-pitch h1 { margin: 12px 0; font-size: 30px; line-height: 1.35; }
.exam-pitch p { color: #b8d2ca; }
.exam-rules { margin: 25px 0 0; padding: 0; display: grid; gap: 14px; list-style: none; }
.exam-rules li { display: flex; align-items: center; gap: 10px; color: #d9e9e4; font-size: 13px; }
.exam-rules svg { width: 17px; color: #8bd5bd; }
.exam-form { padding: 30px; }
.exam-form h2 { margin: 0 0 4px; font-size: 20px; }
.exam-form > p { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-field { display: grid; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label, .form-field > span { color: #506761; font-size: 12px; font-weight: 650; }
.form-field input, .form-field select { width: 100%; max-width: none; }
.form-hint { color: var(--muted); font-size: 11px; }
.checkbox-row { margin: 21px 0; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.checkbox-row input { min-height: auto; width: 17px; height: 17px; margin-top: 3px; accent-color: var(--brand); }
.checkbox-row strong, .checkbox-row small { display: block; }
.checkbox-row strong { font-size: 13px; }
.checkbox-row small { color: var(--muted); font-size: 11px; }
.exam-form .button { width: 100%; }
.exam-timer-card { margin-bottom: 18px; padding: 17px 22px; display: flex; align-items: center; gap: 18px; box-shadow: none; }
.exam-timer { display: flex; align-items: center; gap: 9px; font-size: 21px; font-weight: 750; font-variant-numeric: tabular-nums; }
.exam-timer.urgent { color: var(--danger); }
.exam-timer-card .progress-track { flex: 1; }
.exam-progress-text { color: var(--muted); font-size: 12px; white-space: nowrap; }
.exam-submit-top { margin-left: auto; }
.exam-question .question-body { min-height: 400px; }
.exam-question .question-stem { font-size: 17px; }

.result-hero { padding: 32px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 30px; }
.score-ring {
  --score: 0deg;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--brand) var(--score), #e6eeea 0);
  position: relative;
}
.score-ring::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: white; }
.score-ring > div { position: relative; z-index: 1; text-align: center; }
.score-ring strong { display: block; font-size: 35px; line-height: 1.1; }
.score-ring span { color: var(--muted); font-size: 11px; }
.result-copy h1 { margin: 0 0 8px; font-size: 27px; }
.result-copy p { margin: 0; color: var(--muted); }
.result-actions { display: flex; flex-direction: column; gap: 9px; }
.result-stats { margin-top: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.result-stat { padding: 18px; text-align: center; box-shadow: none; }
.result-stat strong { display: block; font-size: 23px; }
.result-stat span { color: var(--muted); font-size: 12px; }
.result-stat.danger strong { color: var(--danger); }
.result-detail { margin-top: 20px; padding: 22px; box-shadow: none; }
.result-topic-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 30px; }
.review-list { display: grid; gap: 14px; }
.review-item { padding: 23px; box-shadow: none; }
.review-item-head { display: flex; align-items: center; gap: 8px; }
.review-item-head .badges { margin: 0; }
.review-item-index { margin-left: auto; color: var(--soft); font-size: 11px; }
.review-item h3 { margin: 12px 0; white-space: pre-line; font-size: 15px; line-height: 1.75; }
.review-answer { padding: 11px 14px; border-radius: 9px; color: #426057; background: #f3f7f5; font-size: 12px; }
.review-item-footer { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-item-actions { display: flex; gap: 8px; }
.tabs { margin-bottom: 18px; display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.tab { min-height: 38px; padding: 7px 18px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 13px; }
.tab.active { color: var(--brand-dark); background: var(--brand-soft); font-weight: 700; }
.review-toolbar { margin-bottom: 17px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.review-toolbar h2 { margin: 0; font-size: 18px; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td { padding: 14px 12px; border-bottom: 1px solid #e9efec; text-align: left; font-size: 12px; }
.history-table th { color: var(--muted); font-weight: 600; }
.history-table tr:last-child td { border-bottom: 0; }
.history-score { color: var(--brand); font-size: 16px; font-weight: 750; }
.history-wrap { overflow-x: auto; padding: 8px 18px 15px; }

.dialog {
  width: min(92vw, 430px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(9, 34, 30, .25);
}
.dialog::backdrop { background: rgba(12, 32, 29, .5); backdrop-filter: blur(3px); }
.dialog form { padding: 30px; text-align: center; }
.dialog-icon { width: 50px; height: 50px; margin: 0 auto 15px; display: grid; place-items: center; border-radius: 15px; color: var(--brand); background: var(--brand-soft); font-size: 23px; font-weight: 750; }
.dialog h2 { margin: 0 0 9px; font-size: 20px; }
.dialog p { margin: 0; white-space: pre-line; color: var(--muted); font-size: 13px; }
.dialog-actions { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  max-width: min(90vw, 500px);
  padding: 11px 18px;
  border-radius: 10px;
  color: white;
  background: #183c37;
  box-shadow: 0 10px 35px rgba(0,0,0,.18);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .learn-layout, .exam-layout { grid-template-columns: minmax(0, 1fr) 230px; }
  .hero { grid-template-columns: 1.35fr 1fr; }
  .result-hero { grid-template-columns: auto 1fr; }
  .result-actions { grid-column: 1 / -1; flex-direction: row; }
}

@media (max-width: 850px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 20px 0 60px rgba(9,34,30,.2); }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(11,34,30,.4); }
  body.nav-open .sidebar-scrim { display: block; }
  .workspace { margin-left: 0; }
  .mobile-menu { display: inline-grid !important; }
  .topbar { height: 75px; padding: 0 20px; justify-content: flex-start; }
  .topbar > .button { margin-left: auto; }
  #app { padding: 24px 20px 45px; }
  .hero { grid-template-columns: 1fr; }
  .hero-side { display: none; }
  .dashboard-grid, .exam-intro { grid-template-columns: 1fr; }
  .learn-layout, .exam-layout { grid-template-columns: 1fr; }
  .question-side { order: 2; }
  .question-map { grid-template-columns: repeat(10, 1fr); max-height: none; }
  .map-button { aspect-ratio: auto; min-height: 31px; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .topbar-title small { display: none; }
  .topbar > .button { padding: 7px 10px; }
  .topbar > .button svg { display: none; }
  #app { padding: 18px 13px 35px; }
  .hero { min-height: auto; padding: 27px 23px; border-radius: 17px; }
  .hero h1 { font-size: 27px; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions .button { padding: 10px 12px; }
  .stat-grid { gap: 10px; }
  .stat-card { padding: 15px; gap: 10px; }
  .stat-icon { width: 35px; height: 35px; border-radius: 10px; }
  .stat-icon svg { width: 17px; }
  .stat-card strong { font-size: 21px; }
  .section-heading { align-items: flex-start; }
  .question-top { padding: 14px 16px; }
  .question-body { padding: 22px 17px; }
  .question-stem { font-size: 16px; }
  .option { padding: 12px; gap: 10px; }
  .question-footer { align-items: stretch; flex-direction: column; }
  .question-footer-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .question-footer-actions .button.primary:last-child { grid-column: 1 / -1; }
  .question-map { grid-template-columns: repeat(6, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .exam-form, .exam-pitch { padding: 24px; }
  .exam-timer-card { flex-wrap: wrap; gap: 10px; }
  .exam-timer-card .progress-track { order: 3; flex-basis: 100%; }
  .exam-submit-top { padding: 7px 11px; }
  .result-hero { padding: 24px; grid-template-columns: 1fr; text-align: center; }
  .score-ring { margin: 0 auto; }
  .result-actions { flex-direction: column; }
  .result-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .result-topic-grid { grid-template-columns: 1fr; }
  .review-toolbar { align-items: flex-start; flex-direction: column; }
  .review-item { padding: 18px; }
  .review-item-footer { align-items: flex-start; flex-direction: column; }
  .filter-card { padding: 12px; }
  .filter-card select { flex: 1 1 45%; max-width: none; }
  .filter-count { width: 100%; text-align: right; }
}

@media print {
  .sidebar, .topbar, .result-actions, .question-nav, .filter-card, .question-side, .toast { display: none !important; }
  .workspace { margin: 0; }
  #app { max-width: none; padding: 0; }
  body { background: white; }
  .card { box-shadow: none; break-inside: avoid; }
  .review-item { margin-bottom: 12px; }
}
