:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f7f9fb;
  --surface-hover: #f8fbfd;
  --ink: #17212b;
  --ink-soft: #35424e;
  --option-ink: #26333f;
  --muted: #64717d;
  --line: #d8e0e7;
  --line-strong: #bcc8d2;
  --primary: #1f5f99;
  --primary-button: #1f5f99;
  --primary-button-hover: #174b7a;
  --primary-soft: #eaf2f8;
  --primary-border: #b9d1e3;
  --primary-border-strong: #99b8cf;
  --teal: #0f766e;
  --teal-soft: #e6f4f2;
  --success: #18794e;
  --success-button: #18794e;
  --success-soft: #e8f5ed;
  --success-border: #76b894;
  --danger: #b42318;
  --danger-button: #b42318;
  --danger-button-hover: #8f1c13;
  --danger-soft: #fcecea;
  --danger-border: #e0a49f;
  --warning: #8a5b00;
  --warning-soft: #fff4d6;
  --track: #e4e9ee;
  --header-bg: rgba(255, 255, 255, 0.98);
  --backdrop: rgba(20, 31, 41, 0.48);
  --on-accent: #ffffff;
  --shadow: 0 10px 30px rgba(24, 42, 58, 0.08);
  --header-height: 68px;
  --sidebar-width: 304px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-synthesis: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111416;
  --surface: #191d20;
  --surface-muted: #22272b;
  --surface-hover: #242c31;
  --ink: #f1f3f4;
  --ink-soft: #d2d8dc;
  --option-ink: #e4e8ea;
  --muted: #a8b1b8;
  --line: #333b40;
  --line-strong: #4b565e;
  --primary: #7eb8e7;
  --primary-button: #286fa5;
  --primary-button-hover: #3582b9;
  --primary-soft: #1b3040;
  --primary-border: #365f7d;
  --primary-border-strong: #5c8daf;
  --teal: #61c8ba;
  --teal-soft: #173936;
  --success: #67d391;
  --success-button: #237747;
  --success-soft: #183a28;
  --success-border: #3f8b5d;
  --danger: #ff8178;
  --danger-button: #a63831;
  --danger-button-hover: #bd463e;
  --danger-soft: #431f1d;
  --danger-border: #9b4c46;
  --warning: #e4b84f;
  --warning-soft: #3f351b;
  --track: #30373c;
  --header-bg: rgba(25, 29, 32, 0.98);
  --backdrop: rgba(0, 0, 0, 0.7);
  --on-accent: #ffffff;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(31, 95, 153, 0.28);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 7px;
  color: var(--on-accent);
  background: var(--primary-button);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-copy {
  display: grid;
  line-height: 1.25;
}

.brand-copy strong {
  font-size: 17px;
}

.brand-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.header-actions,
.dialog-actions,
.summary-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button {
  min-height: 42px;
  gap: 8px;
  padding: 8px 15px;
}

.button svg {
  width: 18px;
  height: 18px;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button.primary {
  color: var(--on-accent);
  background: var(--primary-button);
}

.button.primary:hover:not(:disabled) {
  background: var(--primary-button-hover);
}

.button.secondary,
.icon-button {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}

.button.secondary:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.button.danger {
  color: var(--on-accent);
  background: var(--danger-button);
}

.button.danger:hover:not(:disabled) {
  background: var(--danger-button-hover);
}

.button.text-button {
  min-height: 36px;
  padding: 5px 0;
  color: var(--primary);
  background: transparent;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.mobile-filter-button,
.mobile-reset-button,
.mobile-drawer-header {
  display: none;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - var(--header-height));
}

.control-panel {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 22px 20px 26px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.control-section {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.section-label,
.section-label-row {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.section-label {
  margin-bottom: 9px;
}

.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-label-row .section-label {
  margin: 0;
}

.section-label-row > span {
  color: var(--muted);
  font-weight: 600;
}

.module-select-shell {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.module-select-shell > svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.module-select-shell select {
  min-width: 0;
  width: 100%;
  height: 42px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  appearance: none;
}

.module-select-shell:focus-within {
  border-color: var(--primary-border-strong);
}

.module-summary {
  margin: 8px 1px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.segmented-control {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.segmented-control.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-control.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented-control button {
  display: inline-flex;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.segmented-control.three-up button:last-child,
.segmented-control.two-up button:nth-child(2n) {
  border-right: 0;
}

.segmented-control.three-up button {
  border-bottom: 0;
}

.segmented-control.two-up button:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.segmented-control button[aria-pressed="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.segmented-control button:disabled {
  color: var(--line-strong);
  background: var(--surface-muted);
  cursor: not-allowed;
  opacity: 0.72;
}

.segmented-control button svg {
  width: 15px;
  height: 15px;
}

.stage-section {
  padding-bottom: 14px;
}

.stage-list {
  display: grid;
  gap: 5px;
}

.stage-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.stage-button.stage-all-button {
  grid-template-columns: 28px minmax(0, 1fr) auto;
}

.stage-button:hover {
  background: var(--surface-muted);
}

.stage-button[aria-pressed="true"] {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.stage-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: var(--surface);
}

.stage-button[aria-pressed="true"] .stage-index {
  border-color: var(--primary);
  color: var(--on-accent);
  background: var(--primary-button);
}

.stage-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.stage-chevron {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--muted);
  transition: transform 150ms ease;
}

.stage-chevron svg {
  width: 14px;
  height: 14px;
}

.stage-button[aria-expanded="true"] .stage-chevron {
  transform: rotate(180deg);
}

.question-directory {
  display: grid;
  gap: 2px;
  max-height: min(420px, 48vh);
  margin: 3px 0 8px 37px;
  padding: 2px 0 2px 8px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
}

.directory-question {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.directory-question:hover {
  background: var(--surface-muted);
}

.directory-question.is-current {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.directory-number {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.directory-prompt {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-status {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--line-strong);
}

.directory-status svg {
  width: 14px;
  height: 14px;
}

.directory-question[data-status="correct"] .directory-status {
  color: var(--success);
}

.directory-question[data-status="wrong"] .directory-status {
  color: var(--danger);
}

.progress-section {
  margin-top: 4px;
}

.progress-track,
.session-progress {
  overflow: hidden;
  background: var(--track);
}

.progress-track {
  height: 7px;
  border-radius: 4px;
}

.progress-track span,
.session-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 220ms ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 16px 0 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.stats-grid div {
  display: grid;
  min-height: 62px;
  place-items: center;
  align-content: center;
  background: var(--surface);
}

.stats-grid dt {
  color: var(--muted);
  font-size: 11px;
}

.stats-grid dd {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.data-note {
  margin: 20px 0 0;
  color: #7b8792;
  font-size: 11px;
  text-align: center;
}

.quiz-workspace {
  width: min(900px, calc(100% - 64px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.app-layout.is-essay .objective-only {
  display: none;
}

.app-layout.is-essay .quiz-workspace {
  width: min(1180px, calc(100% - 64px));
}

.essay-workspace {
  display: grid;
  gap: 22px;
}

.essay-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.essay-kicker,
.essay-section-heading > span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.essay-header h1 {
  margin: 3px 0 7px;
  font-size: 28px;
  line-height: 1.35;
}

.essay-meta,
.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.essay-meta span,
.keyword-row span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.essay-switch-actions {
  display: flex;
  gap: 8px;
}

.essay-directory {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.essay-directory button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.essay-directory button:last-child {
  border-right: 0;
}

.essay-directory button:hover,
.essay-directory button[aria-selected="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.essay-directory button > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 900;
  background: var(--surface);
}

.essay-directory button strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.essay-directory button svg {
  width: 16px;
  height: 16px;
}

.essay-step-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.essay-step-tabs button {
  min-height: 46px;
  padding: 8px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.essay-step-tabs button:last-child {
  border-right: 0;
}

.essay-step-tabs button:hover,
.essay-step-tabs button[aria-selected="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.essay-step-content {
  min-width: 0;
}

.essay-section-heading h2 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.4;
}

.essay-prompt-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.essay-material-sheet,
.essay-task-panel,
.essay-thesis-view,
.essay-outline-view,
.essay-model-view,
.essay-review-view {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.essay-material-list {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.essay-material-list p {
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 3px solid var(--primary-border-strong);
  color: var(--ink-soft);
  line-height: 1.9;
}

.essay-task {
  margin: 22px 0 16px;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.8;
}

.essay-task-panel ul,
.pitfall-panel ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.essay-task-panel li,
.pitfall-panel li {
  margin: 7px 0;
}

.thesis-path {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.thesis-path article {
  min-width: 0;
  padding: 20px;
  background: var(--surface-muted);
}

.thesis-path article > span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.thesis-path h3 {
  margin: 4px 0 6px;
  font-size: 16px;
}

.thesis-path p,
.rubric-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.thesis-statement {
  margin-top: 22px;
  padding: 20px;
  border-left: 4px solid var(--primary);
  background: var(--primary-soft);
}

.thesis-statement span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.thesis-statement p {
  margin: 7px 0 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.85;
}

.keyword-row {
  margin-top: 18px;
}

.outline-track {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.outline-track button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 86px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: left;
  background: var(--surface);
  cursor: pointer;
}

.outline-track button:hover {
  border-color: var(--primary-border-strong);
  background: var(--surface-hover);
}

.outline-index {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 6px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 900;
}

.outline-copy {
  min-width: 0;
}

.outline-copy small,
.outline-copy strong {
  display: block;
}

.outline-copy small {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.outline-copy strong {
  margin-top: 1px;
}

.outline-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.outline-track button > svg {
  width: 18px;
  color: var(--muted);
}

.essay-model-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 20px;
  align-items: start;
  margin-top: 24px;
}

.model-paragraphs {
  display: grid;
  gap: 10px;
}

.model-paragraphs button {
  width: 100%;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-soft);
  text-align: left;
  background: var(--surface);
  cursor: pointer;
}

.model-paragraphs button:hover,
.model-paragraphs button[aria-pressed="true"] {
  border-color: var(--primary-border-strong);
  background: var(--primary-soft);
}

.model-paragraphs button > span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
}

.model-paragraphs button p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  line-height: 1.95;
}

.model-paragraphs button:first-child p {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.paragraph-analysis {
  position: sticky;
  top: calc(var(--header-height) + 18px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.analysis-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.analysis-heading span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.analysis-heading strong {
  font-size: 15px;
}

.paragraph-analysis dl {
  margin: 0;
}

.paragraph-analysis dl > div {
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}

.paragraph-analysis dl > div:last-child {
  border-bottom: 0;
}

.paragraph-analysis dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.paragraph-analysis dd {
  margin: 5px 0 0;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.paragraph-analysis .reusable-line {
  background: var(--warning-soft);
}

.rubric-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 12px;
}

.rubric-note svg,
.pitfall-panel svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.rubric-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.rubric-list article {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
}

.rubric-list article > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rubric-list article span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.rubric-list p {
  margin-top: 9px;
  font-size: 13px;
}

.pitfall-panel {
  margin-top: 20px;
  padding: 18px;
  border-left: 4px solid var(--danger);
  background: var(--danger-soft);
}

.pitfall-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--danger);
  font-size: 15px;
}

.quiz-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.quiz-topline > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.question-position {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.question-stage {
  overflow: hidden;
  max-width: 360px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-type {
  padding: 4px 9px;
  border-radius: 4px;
  color: var(--teal);
  background: var(--teal-soft);
  white-space: nowrap;
}

.session-progress {
  height: 4px;
  margin-bottom: 18px;
  border-radius: 2px;
}

.question-panel {
  min-height: 500px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-heading {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 15px;
}

.question-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.question-heading h1 {
  min-width: 0;
  margin: 3px 0 0;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.65;
}

.question-context {
  margin: 24px 0 0 57px;
}

.graphic-question {
  margin: 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.graphic-question img {
  display: block;
  width: 100%;
  max-height: 440px;
  margin: 0 auto;
  object-fit: contain;
}

.material-table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.material-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  color: var(--ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.material-table caption {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.material-table th,
.material-table td {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}

.material-table tr:last-child > * {
  border-bottom: 0;
}

.material-table tr > *:last-child {
  border-right: 0;
}

.material-table thead th {
  color: var(--ink);
  background: var(--primary-soft);
  font-weight: 800;
}

.material-table tbody th {
  color: var(--ink);
  background: var(--surface-muted);
  font-weight: 700;
}

.option-list {
  display: grid;
  gap: 11px;
  margin-top: 28px;
}

.option-button {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--option-ink);
  text-align: left;
  background: var(--surface);
  cursor: pointer;
}

.option-button:hover:not(:disabled) {
  border-color: var(--primary-border-strong);
  background: var(--surface-hover);
}

.option-key {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  background: var(--surface-muted);
}

.option-text {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.option-state {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: transparent;
}

.option-state svg {
  width: 19px;
  height: 19px;
}

.option-button.is-selected:not(.is-correct):not(.is-wrong) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.option-button.is-selected:not(.is-correct):not(.is-wrong) .option-key {
  border-color: var(--primary);
  color: var(--on-accent);
  background: var(--primary-button);
}

.option-button.is-correct {
  border-color: var(--success-border);
  background: var(--success-soft);
}

.option-button.is-correct .option-key {
  border-color: var(--success);
  color: var(--on-accent);
  background: var(--success-button);
}

.option-button.is-correct .option-state {
  color: var(--success);
}

.option-button.is-wrong {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.option-button.is-wrong .option-key {
  border-color: var(--danger);
  color: var(--on-accent);
  background: var(--danger-button);
}

.option-button.is-wrong .option-state {
  color: var(--danger);
}

.option-button:disabled {
  cursor: default;
}

.multiple-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.answer-feedback {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.feedback-status {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
}

.feedback-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
}

.feedback-icon svg {
  width: 23px;
  height: 23px;
}

.answer-feedback.is-correct .feedback-icon {
  color: var(--success);
  background: var(--success-soft);
}

.answer-feedback.is-wrong .feedback-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.feedback-status strong {
  font-size: 17px;
}

.feedback-status p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.explanation-block {
  margin-top: 18px;
  padding: 15px 16px;
  border-left: 3px solid var(--primary);
  background: var(--surface-muted);
}

.explanation-block > span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.explanation-block p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  line-height: 1.75;
}

.question-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.modal {
  width: min(680px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(18, 34, 48, 0.22);
}

.modal::backdrop {
  background: var(--backdrop);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.modal-header span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.modal-header h2 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.4;
}

.profile-modal {
  width: min(560px, calc(100% - 32px));
}

.profile-content {
  display: grid;
  gap: 18px;
  padding: 22px 24px 26px;
}

.profile-status {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.profile-status-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
}

.profile-status-icon svg {
  width: 20px;
  height: 20px;
}

.profile-status strong {
  display: block;
  font-size: 14px;
}

.profile-status p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.profile-status[data-status="saved"] .profile-status-icon {
  border-color: var(--success-border);
  color: var(--success);
  background: var(--success-soft);
}

.profile-status[data-status="saving"] .profile-status-icon {
  border-color: var(--primary-border);
  color: var(--primary);
  background: var(--primary-soft);
}

.profile-status[data-status="error"] .profile-status-icon {
  border-color: var(--danger-border);
  color: var(--danger);
  background: var(--danger-soft);
}

#profile-button.is-linked {
  border-color: var(--success-border);
  color: var(--success);
}

.profile-create-view .button {
  width: 100%;
}

.profile-link-view {
  display: grid;
  gap: 8px;
}

.profile-link-view label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.profile-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.profile-link-row input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  font-size: 12px;
}

.retry-sync-button {
  justify-self: start;
  margin-top: 4px;
}

.profile-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--danger-border);
  border-radius: 6px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 13px;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  max-width: min(420px, calc(100% - 24px));
  padding: 10px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.knowledge-goal {
  margin: 22px 24px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--teal);
  color: #40505b;
  background: var(--teal-soft);
}

.knowledge-list {
  display: grid;
  gap: 14px;
  margin: 20px 24px 28px;
  padding-left: 22px;
}

.knowledge-list li {
  padding-left: 4px;
  line-height: 1.75;
}

.confirm-modal {
  width: min(420px, calc(100% - 32px));
  padding: 28px;
  text-align: center;
}

.confirm-icon,
.summary-icon,
.empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
}

.confirm-icon {
  color: var(--warning);
  background: var(--warning-soft);
}

.confirm-icon svg,
.summary-icon svg,
.empty-icon svg {
  width: 27px;
  height: 27px;
}

.confirm-modal h2 {
  margin: 16px 0 4px;
  font-size: 21px;
}

.confirm-modal p {
  margin: 0;
  color: var(--muted);
}

.confirm-modal .dialog-actions {
  justify-content: center;
  margin-top: 24px;
}

.summary-panel,
.empty-panel {
  min-height: 500px;
  padding: 54px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-icon,
.empty-icon {
  color: var(--success);
  background: var(--success-soft);
}

.summary-panel > span {
  display: block;
  margin-top: 16px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

.summary-panel h1,
.empty-panel h1 {
  margin: 4px 0 0;
  font-size: 25px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(520px, 100%);
  margin: 30px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-stats div {
  display: grid;
  min-height: 92px;
  place-items: center;
  align-content: center;
  border-right: 1px solid var(--line);
}

.summary-stats div:last-child {
  border-right: 0;
}

.summary-stats span {
  color: var(--muted);
  font-size: 12px;
}

.summary-stats strong {
  margin-top: 2px;
  font-size: 24px;
}

.summary-actions {
  justify-content: center;
  flex-wrap: wrap;
}

.empty-panel p {
  margin: 8px 0 26px;
  color: var(--muted);
}

.drawer-backdrop {
  display: none;
}

@media (max-width: 900px) {
  :root {
    --header-height: 64px;
  }

  .app-header {
    padding: 0 14px;
  }

  .brand-copy span {
    display: none;
  }

  .mobile-filter-button,
  .mobile-reset-button,
  .mobile-drawer-header {
    display: inline-flex;
  }

  .mobile-drawer-header {
    display: flex;
  }

  .mobile-reset-button {
    width: 100%;
    margin-top: 18px;
  }

  .header-actions .button {
    min-height: 40px;
    padding: 7px 11px;
  }

  .app-layout {
    display: block;
  }

  .control-panel {
    position: fixed;
    z-index: 60;
    top: 0;
    left: 0;
    width: min(340px, calc(100% - 44px));
    height: 100vh;
    padding-top: 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 48px rgba(18, 34, 48, 0.16);
  }

  .control-panel.is-open {
    transform: translateX(0);
  }

  .mobile-drawer-header {
    position: sticky;
    top: 0;
    z-index: 2;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    margin: 0 -20px 20px;
    padding: 0 16px 0 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .drawer-backdrop:not([hidden]) {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: block;
    background: var(--backdrop);
  }

  .quiz-workspace {
    width: min(760px, calc(100% - 32px));
    padding-top: 24px;
  }

  .app-layout.is-essay .quiz-workspace {
    width: min(760px, calc(100% - 32px));
  }

  .essay-directory {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .essay-directory button:nth-child(3) {
    border-right: 0;
  }

  .essay-directory button:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .essay-prompt-layout,
  .essay-model-layout {
    grid-template-columns: 1fr;
  }

  .paragraph-analysis {
    position: static;
  }

  .rubric-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rubric-list article:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  .app-header {
    gap: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .header-actions {
    gap: 6px;
  }

  #reset-button {
    display: none;
  }

  .header-actions .button span {
    display: none;
  }

  .header-actions .button,
  .header-actions .icon-button {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
  }

  .quiz-workspace {
    width: calc(100% - 20px);
    padding: 17px 0 30px;
  }

  .app-layout.is-essay .quiz-workspace {
    width: calc(100% - 20px);
  }

  .essay-workspace {
    gap: 15px;
  }

  .essay-header {
    gap: 12px;
  }

  .essay-header h1 {
    font-size: 22px;
  }

  .essay-directory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .essay-directory button,
  .essay-directory button:nth-child(3) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .essay-directory button:nth-child(2n) {
    border-right: 0;
  }

  .essay-directory button:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .essay-step-tabs {
    display: flex;
    overflow-x: auto;
  }

  .essay-step-tabs button {
    min-width: 106px;
    flex: 1 0 auto;
  }

  .essay-material-sheet,
  .essay-task-panel,
  .essay-thesis-view,
  .essay-outline-view,
  .essay-model-view,
  .essay-review-view {
    padding: 20px 16px;
  }

  .thesis-path,
  .rubric-list {
    grid-template-columns: 1fr;
  }

  .rubric-list article:last-child {
    grid-column: auto;
  }

  .outline-track button {
    grid-template-columns: 36px minmax(0, 1fr) 16px;
    gap: 10px;
    padding: 12px;
  }

  .outline-index {
    width: 36px;
    height: 36px;
  }

  .model-paragraphs button {
    padding: 15px 13px;
  }

  .quiz-topline {
    align-items: flex-start;
    gap: 8px;
  }

  .quiz-topline > div {
    display: grid;
    gap: 1px;
  }

  .question-stage {
    max-width: 230px;
  }

  .question-panel {
    min-height: 440px;
    padding: 22px 17px;
  }

  .question-heading {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 11px;
  }

  .question-number {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .question-heading h1 {
    margin-top: 1px;
    font-size: 18px;
    line-height: 1.65;
  }

  .question-context {
    margin: 18px 0 0;
  }

  .graphic-question {
    padding: 8px;
  }

  .graphic-question img {
    max-height: 360px;
  }

  .material-table {
    min-width: 580px;
    font-size: 12px;
  }

  .material-table th,
  .material-table td {
    padding: 9px 10px;
  }

  .option-list {
    gap: 9px;
    margin-top: 22px;
  }

  .option-button {
    grid-template-columns: 32px minmax(0, 1fr) 20px;
    gap: 10px;
    min-height: 54px;
    padding: 9px 10px;
  }

  .option-key {
    width: 32px;
    height: 32px;
  }

  .question-navigation {
    gap: 10px;
  }

  .question-navigation .button {
    flex: 1;
  }

  .feedback-status {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .feedback-icon {
    width: 38px;
    height: 38px;
  }

  .explanation-block {
    padding: 13px;
  }

  .modal {
    width: calc(100% - 18px);
    max-height: calc(100vh - 18px);
  }

  .modal-header {
    padding: 18px;
  }

  .profile-content {
    padding: 18px;
  }

  .knowledge-goal {
    margin: 18px 18px 0;
  }

  .knowledge-list {
    margin: 18px 18px 24px;
  }

  .summary-panel,
  .empty-panel {
    min-height: 440px;
    padding: 44px 18px;
  }

  .summary-stats {
    margin: 26px auto;
  }

  .summary-stats div {
    min-height: 80px;
  }

  .summary-stats strong {
    font-size: 21px;
  }
}

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