:root {
  color-scheme: light;
  --paper: #f4efe4;
  --paper-deep: #e9e0cf;
  --ink: #182321;
  --muted: #66716d;
  --line: rgba(24, 35, 33, 0.14);
  --teal: #0b6b63;
  --teal-dark: #084d48;
  --orange: #e76532;
  --white: #fffdf8;
  --shadow: 0 24px 60px rgba(32, 39, 34, 0.12);
  font-family:
    "Aptos", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(24, 35, 33, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 35, 33, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(231, 101, 50, 0.45);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.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;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.58;
  pointer-events: none;
}

.ambient-one {
  width: 34rem;
  height: 34rem;
  top: -20rem;
  right: -10rem;
  background: radial-gradient(circle, rgba(11, 107, 99, 0.2), transparent 68%);
}

.ambient-two {
  width: 30rem;
  height: 30rem;
  bottom: -20rem;
  left: -12rem;
  background: radial-gradient(circle, rgba(231, 101, 50, 0.16), transparent 68%);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(22rem, 0.85fr);
  gap: clamp(2rem, 7vw, 7rem);
  align-items: center;
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0;
}

.auth-manifesto h1,
.hero-row h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(3.5rem, 8vw, 7.5rem);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 0.92;
}

.auth-lead {
  max-width: 37rem;
  margin: 2rem 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.85;
}

.manifesto-note {
  display: grid;
  gap: 0.35rem;
  max-width: 32rem;
  padding: 1.2rem 0 0 1.25rem;
  border-left: 3px solid var(--orange);
}

.manifesto-note span,
.manifesto-note small {
  color: var(--muted);
}

.manifesto-note strong {
  font-size: 1.05rem;
}

.auth-card {
  padding: clamp(1.5rem, 4vw, 2.7rem);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-card h2 {
  margin: 0 0 2rem;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 2.35rem;
}

.auth-card form,
.auth-card label {
  display: grid;
  gap: 0.65rem;
}

.auth-card form {
  gap: 1.15rem;
}

.auth-card label > span,
.auth-card legend {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input:not([type]) {
  width: 100%;
}

.auth-card input,
.search-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.auth-card input {
  min-height: 3.2rem;
  padding: 0 1rem;
}

.auth-card input:focus,
.search-field input:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 4px rgba(11, 107, 99, 0.1);
}

fieldset {
  padding: 0;
  border: 0;
  margin: 0;
}

fieldset legend {
  margin-bottom: 0.65rem;
}

.class-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.class-option {
  position: relative;
}

.class-option input {
  position: absolute;
  opacity: 0;
}

.class-option span {
  display: grid;
  min-height: 3rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink) !important;
  cursor: pointer;
}

.class-option input:checked + span {
  border-color: var(--teal);
  background: rgba(11, 107, 99, 0.08);
  color: var(--teal-dark) !important;
}

.primary-button,
.reveal-button {
  border: 0;
  border-radius: 10px;
  color: white;
  background: var(--teal);
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.primary-button:hover,
.reveal-button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.primary-button {
  min-height: 3.2rem;
  padding: 0 1.25rem;
  font-weight: 750;
}

.primary-button.full {
  width: 100%;
  margin-top: 0.2rem;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.form-error {
  min-height: 1.3rem;
  margin: 0;
  color: #a53222;
  font-size: 0.85rem;
}

.privacy-note {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 0 clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 239, 228, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.05rem;
}

.brand small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.account-area {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.student-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.quiet-button,
.text-button,
.back-button,
.nav-item {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.quiet-button,
.text-button {
  color: var(--teal);
  font-weight: 750;
}

.workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  width: min(1380px, 100%);
  min-height: calc(100vh - 74px);
  margin: 0 auto;
}

.sidebar {
  padding: 2.4rem 1.6rem;
  border-right: 1px solid var(--line);
}

.sidebar nav {
  display: grid;
  gap: 0.3rem;
}

.nav-item {
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  color: var(--muted);
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--orange);
  font-weight: 750;
}

.sidebar-rule {
  height: 1px;
  margin: 1.5rem 0;
  background: var(--line);
}

.sidebar-label,
.sidebar-scope,
.sidebar-note {
  margin: 0;
}

.sidebar-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.sidebar-scope {
  margin-top: 0.55rem;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.35;
}

.sidebar-note {
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.7;
}

.content {
  min-width: 0;
  padding: clamp(2rem, 5vw, 4.5rem);
}

.hero-row {
  display: flex;
  gap: 2rem;
  align-items: flex-end;
  justify-content: space-between;
}

.hero-row h1 {
  font-size: clamp(3.2rem, 6vw, 6.4rem);
}

.hero-copy {
  max-width: 42rem;
  margin: 1.2rem 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.review-shortcut {
  display: grid;
  flex: 0 0 11.5rem;
  gap: 0.25rem;
  padding: 1.3rem;
  border-radius: 16px;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
}

.review-shortcut span,
.review-shortcut small {
  color: rgba(255, 255, 255, 0.68);
}

.review-shortcut strong {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 3.5rem;
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 2.5rem 0 4rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stats-grid article {
  display: grid;
  gap: 0.65rem;
  padding: 1.25rem 1.4rem;
  border-right: 1px solid var(--line);
}

.stats-grid article:last-child {
  border-right: 0;
}

.stats-grid span {
  color: var(--muted);
  font-size: 0.76rem;
}

.stats-grid strong {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.7rem;
}

.section-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.section-heading h2,
.answer-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.8rem;
}

.section-heading .eyebrow {
  margin-bottom: 0.35rem;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
}

.chapter-card {
  display: grid;
  min-height: 9.5rem;
  gap: 1rem;
  align-content: space-between;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.58);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.chapter-card:hover,
.chapter-card.active {
  border-color: rgba(11, 107, 99, 0.55);
  background: var(--white);
  transform: translateY(-2px);
}

.chapter-card .chapter-no {
  color: var(--orange);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.chapter-card strong {
  line-height: 1.45;
}

.chapter-card small {
  color: var(--muted);
}

.question-heading {
  margin-top: 4rem;
}

.search-field input {
  width: min(19rem, 50vw);
  min-height: 2.75rem;
  padding: 0 0.9rem;
}

.type-heading {
  margin-bottom: 1rem;
}

.type-heading-note {
  color: var(--muted);
  font-size: 0.76rem;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 3.2rem;
}

.type-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  min-height: 7.4rem;
  align-items: end;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.64);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.type-card:hover,
.type-card.active {
  transform: translateY(-2px);
  border-color: var(--teal);
  background: var(--white);
}

.type-card.choice {
  border-top: 4px solid var(--orange);
}

.type-card.short {
  border-top: 4px solid var(--teal);
}

.type-card.calculation {
  border-top: 4px solid var(--ink);
}

.type-card .type-name {
  display: block;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
}

.type-card .type-caption {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.type-card strong {
  color: var(--ink);
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 2.4rem;
  line-height: 1;
}

.list-hint {
  min-height: 1.2rem;
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.question-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.question-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 5rem;
  padding: 0.9rem 0.3rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.question-row:hover {
  background: rgba(255, 255, 255, 0.48);
}

.question-row .number {
  color: var(--orange);
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.question-row .chapter {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.status-chip {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.status-chip.mastered {
  border-color: rgba(11, 107, 99, 0.35);
  background: rgba(11, 107, 99, 0.08);
  color: var(--teal-dark);
}

.status-chip.unclear {
  border-color: rgba(231, 101, 50, 0.35);
  color: #9a3b1b;
}

.row-meta {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.empty-state {
  padding: 3.5rem 1rem;
  color: var(--muted);
  text-align: center;
}

.question-view {
  max-width: 980px;
  margin: 0 auto;
}

.practice-view,
.review-view,
.knowledge-view {
  max-width: 1040px;
  margin: 0 auto;
}

.practice-hero {
  margin: 2.2rem 0 2rem;
}

.practice-hero h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  letter-spacing: -0.045em;
}

.practice-hero p:last-child {
  max-width: 46rem;
  margin: 0.8rem 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.practice-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.practice-search input {
  width: min(28rem, 64vw);
}

.practice-count {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.review-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1.5rem 0;
}

.review-category {
  display: grid;
  gap: 0.7rem;
  min-height: 7rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.64);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.review-category.active,
.review-category:hover {
  border-color: var(--orange);
  background: var(--white);
}

.review-category strong {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 2rem;
}

.review-category small {
  color: var(--muted);
  line-height: 1.5;
}

.review-meta {
  display: inline-flex;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(231, 101, 50, 0.09);
  color: #9a3b1b;
  font-size: 0.68rem;
  white-space: nowrap;
}

.knowledge-chapter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

.knowledge-chapter {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.62);
  color: var(--muted);
  cursor: pointer;
}

.knowledge-chapter.active,
.knowledge-chapter:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.knowledge-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.knowledge-card {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.72);
}

.knowledge-card-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.knowledge-card h3 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.4;
}

.knowledge-card small {
  color: var(--muted);
  white-space: nowrap;
}

.knowledge-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.knowledge-sections span {
  padding: 0.3rem 0.5rem;
  border-radius: 7px;
  background: rgba(11, 107, 99, 0.065);
  color: var(--teal-dark);
  font-size: 0.7rem;
}

.knowledge-card-footer {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.knowledge-card-footer a {
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.back-button {
  padding: 0.5rem 0;
  color: var(--teal);
  font-weight: 750;
}

.question-header {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin: 2.2rem 0 1.5rem;
}

.question-header h1 {
  margin: 0.2rem 0 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  letter-spacing: -0.04em;
}

.question-header p {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.question-images,
.answer-images {
  display: grid;
  gap: 1rem;
}

.text-question {
  display: grid;
  gap: 1.2rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 12px 34px rgba(32, 39, 34, 0.06);
}

.stem-content {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1.75;
  white-space: pre-wrap;
}

.choice-options {
  display: grid;
  gap: 0.7rem;
}

.choice-option-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  line-height: 1.6;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.choice-option-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-option-card .option-marker {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.choice-option-card:hover,
.choice-option-card.selected {
  border-color: var(--teal);
  background: rgba(11, 107, 99, 0.07);
}

.choice-option-card.selected .option-marker {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.choice-option-card.correct {
  border-color: #39805a;
  background: rgba(57, 128, 90, 0.1);
}

.choice-option-card.correct .option-marker {
  border-color: #39805a;
  background: #39805a;
  color: white;
}

.choice-option-card.wrong {
  border-color: #bd4a39;
  background: rgba(189, 74, 57, 0.09);
}

.choice-option-card.wrong .option-marker {
  border-color: #bd4a39;
  background: #bd4a39;
  color: white;
}

.choice-submit {
  justify-self: start;
  min-width: 10rem;
}

.choice-submit:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.choice-feedback {
  min-height: 1.4rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.choice-feedback.correct {
  color: #26744d;
  font-weight: 750;
}

.choice-feedback.wrong {
  color: #a53222;
  font-weight: 750;
}

.image-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 12px 34px rgba(32, 39, 34, 0.06);
}

.image-card.clipped::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3.5rem;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.96));
  content: "";
  pointer-events: none;
}

.image-card img {
  display: block;
  width: 100%;
  height: auto;
}

.review-warning {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--orange);
  background: rgba(231, 101, 50, 0.06);
  color: #73402d;
  font-size: 0.8rem;
  line-height: 1.6;
}

.reveal-button {
  display: flex;
  width: 100%;
  min-height: 4.2rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.2rem;
  padding: 0 1.3rem;
}

.reveal-button span {
  font-weight: 800;
}

.reveal-button small {
  color: rgba(255, 255, 255, 0.72);
}

.answer-panel {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  animation: rise 260ms ease both;
}

.answer-text {
  margin: 0 0 1.2rem;
  padding: 1.1rem 1.2rem;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.78);
  line-height: 1.85;
  white-space: pre-wrap;
}

.answer-steps {
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0;
  padding-left: 1.4rem;
  line-height: 1.75;
}

.knowledge-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.knowledge-points span {
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(11, 107, 99, 0.25);
  border-radius: 999px;
  background: rgba(11, 107, 99, 0.06);
  color: var(--teal-dark);
  font-size: 0.74rem;
}

.ai-reference {
  margin-top: 1.6rem;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid rgba(11, 107, 99, 0.28);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(11, 107, 99, 0.055), transparent 45%),
    rgba(255, 253, 248, 0.82);
}

.ai-reference-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
}

.ai-reference-heading h3 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.55rem;
}

.reference-status {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(11, 107, 99, 0.1);
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.reference-status.needs_review {
  background: rgba(231, 101, 50, 0.12);
  color: #963d1d;
}

.reference-status.knowledge_base_uncovered {
  background: rgba(24, 35, 33, 0.1);
  color: var(--ink);
}

.ai-reference-disclaimer {
  margin: 0.8rem 0 1rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

.ai-reference-explanation {
  margin: 0;
  line-height: 1.85;
  white-space: pre-wrap;
}

.ai-option-analysis {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.ai-option-row {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  line-height: 1.65;
}

.ai-option-row .label {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(24, 35, 33, 0.08);
  font-weight: 800;
}

.ai-option-row.correct .label {
  background: rgba(57, 128, 90, 0.16);
  color: #26744d;
}

.ai-reference-formulas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.ai-reference-formulas code {
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: rgba(24, 35, 33, 0.07);
  color: var(--ink);
  white-space: pre-wrap;
}

.reference-grounding {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.grounding-card {
  padding: 0.8rem 0.9rem;
  border-left: 3px solid var(--teal);
  background: rgba(255, 255, 255, 0.62);
  font-size: 0.8rem;
  line-height: 1.65;
}

.grounding-card strong {
  display: block;
  margin-bottom: 0.2rem;
}

.grounding-card span {
  color: var(--muted);
}

.reference-caveats {
  margin: 1rem 0 0;
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  background: rgba(231, 101, 50, 0.08);
  color: #7d3a24;
  font-size: 0.8rem;
  line-height: 1.65;
}

.answer-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.source-link {
  color: var(--teal);
  font-weight: 750;
}

.source-copy {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.4rem;
  padding: 1.2rem;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.72);
}

.progress-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-actions div {
  display: flex;
  gap: 0.45rem;
}

.progress-actions button {
  min-height: 2.35rem;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}

.progress-actions button:hover,
.progress-actions button.active {
  border-color: var(--teal);
  background: rgba(11, 107, 99, 0.08);
  color: var(--teal-dark);
}

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 50;
  max-width: min(24rem, calc(100% - 2.4rem));
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-size: 0.82rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1040px) {
  .chapter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auth-shell {
    grid-template-columns: 1fr;
    width: min(760px, calc(100% - 32px));
    gap: 2.5rem;
    padding: 4rem 0;
  }

  .auth-manifesto h1 {
    font-size: clamp(3.7rem, 14vw, 7rem);
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 66px;
    padding: 0 1rem;
  }

  .student-meta {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 66px;
    z-index: 10;
    padding: 0.5rem 0.8rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(244, 239, 228, 0.94);
    backdrop-filter: blur(14px);
  }

  .sidebar nav {
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-item {
    text-align: center;
  }

  .nav-item.active {
    box-shadow: inset 0 -3px 0 var(--orange);
  }

  .sidebar-rule,
  .sidebar-label,
  .sidebar-scope,
  .sidebar-note {
    display: none;
  }

  .content {
    padding: 2rem 1rem 4rem;
  }

  .hero-row {
    align-items: stretch;
    flex-direction: column;
  }

  .review-shortcut {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .review-shortcut strong {
    grid-row: span 2;
    font-size: 3rem;
  }

  .stats-grid {
    margin: 2rem 0 3rem;
  }

  .stats-grid article {
    padding: 1rem 0.75rem;
  }

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

  .type-grid {
    grid-template-columns: 1fr;
  }

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

  .knowledge-list {
    grid-template-columns: 1fr;
  }

  .practice-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .practice-search input {
    width: 100%;
  }

  .type-card {
    min-height: 5.8rem;
  }

  .question-heading {
    align-items: stretch;
    flex-direction: column;
    margin-top: 3rem;
  }

  .search-field input {
    width: 100%;
  }

  .question-row {
    grid-template-columns: 3.6rem minmax(0, 1fr);
  }

  .question-row .status-chip {
    grid-column: 2;
    justify-self: start;
  }

  .question-row .row-meta {
    grid-column: 2;
    justify-content: flex-start;
  }

  .question-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .reveal-button,
  .progress-actions,
  .answer-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .progress-actions div {
    width: 100%;
  }

  .progress-actions button {
    flex: 1;
  }
}

@media (max-width: 430px) {
  .class-options {
    grid-template-columns: 1fr;
  }

  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .chapter-card {
    min-height: 7.5rem;
  }

  .question-header h1 {
    font-size: 2.7rem;
  }
}

@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;
  }
}
