:root {
  color-scheme: light;
  --paper: #f4f1e9;
  --paper-deep: #e9e4d8;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #15352f;
  --ink-soft: #45615b;
  --muted: #75837f;
  --line: #d9ded7;
  --line-strong: #bdc9c2;
  --green: #1f6658;
  --green-deep: #173c35;
  --green-soft: #dcebe5;
  --orange: #ed6a3a;
  --orange-soft: #fbe4da;
  --gold: #d6a632;
  --gold-soft: #f7ecc9;
  --sky: #dbeaf0;
  --sky-deep: #38677a;
  --red: #be4942;
  --red-soft: #f7dfdc;
  --shadow: 0 12px 30px rgba(23, 60, 53, 0.08);
  --shadow-small: 0 5px 16px rgba(23, 60, 53, 0.07);
  --radius: 8px;
  --sidebar-width: 238px;
  --content-max: 1380px;
  font-family: "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(23, 60, 53, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 60, 53, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

button {
  color: inherit;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

sup,
sub {
  font-size: 0.68em;
  line-height: 0;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 18px 20px;
  color: #f7fbf8;
  background: var(--green-deep);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: var(--green-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 700;
  background: #e8d66b;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(23, 60, 53, 0.15);
}

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

.brand strong {
  overflow: hidden;
  font-size: 17px;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  margin-top: 2px;
  color: rgba(247, 251, 248, 0.56);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: rgba(247, 251, 248, 0.68);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.is-active {
  color: var(--green-deep);
  background: #f2f5eb;
  border-color: rgba(255, 255, 255, 0.26);
}

.nav-item span {
  font-size: 14px;
  font-weight: 650;
}

.nav-item em {
  min-width: 24px;
  padding: 2px 6px;
  color: inherit;
  font-size: 11px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.nav-item.is-active em {
  color: #ffffff;
  background: var(--orange);
}

.sidebar-foot {
  margin-top: auto;
}

.streak-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
}

.streak-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--green-deep);
  background: #e8d66b;
  border-radius: 50%;
}

.streak-icon svg {
  width: 18px;
  height: 18px;
}

.streak-mini small,
.streak-mini strong {
  display: block;
}

.streak-mini small {
  color: rgba(247, 251, 248, 0.55);
  font-size: 10px;
}

.streak-mini strong {
  margin-top: 1px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.sidebar-foot p {
  margin: 12px 4px 0;
  color: rgba(247, 251, 248, 0.42);
  font-size: 10px;
  line-height: 1.6;
}

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.view-root {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 36px 42px 68px;
}

.mobile-header,
.mobile-nav {
  display: none;
}

.mobile-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view {
  animation: view-in 220ms ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-head-copy {
  min-width: 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
}

.page-subtitle {
  max-width: 720px;
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.head-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
}

.button,
.icon-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 750;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

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

.button-primary {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
  box-shadow: var(--shadow-small);
}

.button-primary:hover {
  background: #18584c;
}

.button-orange {
  color: #ffffff;
  background: var(--orange);
  border-color: var(--orange);
  box-shadow: var(--shadow-small);
}

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

.button-ghost {
  color: var(--ink-soft);
  background: transparent;
  border-color: transparent;
}

.button-danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #edc9c5;
}

.button-small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.button-block {
  width: 100%;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  background: transparent;
}

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

.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 22px;
  color: #f7fbf8;
  background: var(--green-deep);
  border: 1px solid var(--green-deep);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding: 30px 32px 28px;
}

.hero-copy::after {
  position: absolute;
  inset: auto 28px 18px auto;
  width: 150px;
  height: 70px;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(transparent 0 47%, rgba(232, 214, 107, 0.18) 47% 49%, transparent 49%),
    linear-gradient(90deg, transparent 0 47%, rgba(232, 214, 107, 0.18) 47% 49%, transparent 49%);
  background-size: 38px 38px;
  mask-image: linear-gradient(90deg, transparent, #000);
}

.hero-copy .eyebrow {
  color: #e8d66b;
}

.hero-copy h1 {
  max-width: 720px;
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 29px;
  line-height: 1.35;
}

.hero-copy p {
  max-width: 650px;
  margin: 12px 0 22px;
  color: rgba(247, 251, 248, 0.68);
  font-size: 13px;
  line-height: 1.75;
}

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

.hero-actions .button-secondary {
  color: #f7fbf8;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.hero-metrics {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 22px;
  background: rgba(0, 0, 0, 0.13);
}

.hero-metric {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-metric:last-child {
  border-bottom: 0;
}

.hero-metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--green-deep);
  background: #e8d66b;
  border-radius: 50%;
}

.hero-metric:nth-child(2) .hero-metric-icon {
  background: #f1a07d;
}

.hero-metric:nth-child(3) .hero-metric-icon {
  background: #b7d7e0;
}

.hero-metric svg {
  width: 19px;
  height: 19px;
}

.hero-metric small,
.hero-metric strong {
  display: block;
}

.hero-metric small {
  color: rgba(247, 251, 248, 0.57);
  font-size: 10px;
}

.hero-metric strong {
  margin-top: 2px;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
  min-height: 88px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: var(--radius);
}

.stat-card:nth-child(2) .stat-icon {
  color: #9b591d;
  background: var(--gold-soft);
}

.stat-card:nth-child(3) .stat-icon {
  color: var(--sky-deep);
  background: var(--sky);
}

.stat-card:nth-child(4) .stat-icon {
  color: var(--red);
  background: var(--red-soft);
}

.stat-card small,
.stat-card strong,
.stat-card span {
  display: block;
}

.stat-card small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.stat-card strong {
  margin-top: 3px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.stat-card span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.stack {
  display: grid;
  align-content: start;
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}

.panel-flat {
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.panel-label {
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 9px 10px;
  background: #faf9f4;
  border: 1px solid #e7e5dc;
  border-radius: var(--radius);
}

.task-row.is-done {
  background: #f2f7f3;
  border-color: #d8e6dc;
}

.task-check {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
}

.task-row.is-done .task-check {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.task-check svg {
  width: 16px;
  height: 16px;
}

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

.task-copy strong {
  font-size: 13px;
}

.task-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.task-value {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.week-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  height: 150px;
  align-items: end;
  padding-top: 8px;
}

.bar-column {
  display: grid;
  height: 100%;
  align-items: end;
  gap: 7px;
  text-align: center;
}

.bar-track {
  position: relative;
  display: flex;
  height: 112px;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background: #eaeee9;
  border-radius: 6px 6px 2px 2px;
}

.bar-fill {
  width: 100%;
  min-height: 3px;
  background: var(--green);
  border-radius: 6px 6px 2px 2px;
  transition: height 320ms ease;
}

.bar-column.is-today .bar-fill {
  background: var(--orange);
}

.bar-column small {
  color: var(--muted);
  font-size: 10px;
}

.bar-column strong {
  display: block;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.guide-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--gold-soft);
  border: 1px solid #ead9a1;
  border-radius: var(--radius);
}

.guide-banner-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.guide-banner-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: #8a5a12;
  background: #ffffff;
  border-radius: 50%;
}

.guide-banner strong,
.guide-banner small {
  display: block;
}

.guide-banner strong {
  font-size: 13px;
}

.guide-banner small {
  margin-top: 4px;
  color: #765f2d;
  font-size: 10px;
  line-height: 1.5;
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(290px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.guide-steps {
  display: grid;
  gap: 11px;
}

.guide-step {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  background: #faf9f4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.guide-step-number {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 850;
  background: var(--green);
  border-radius: 50%;
}

.guide-step:nth-child(2) .guide-step-number {
  background: var(--orange);
}

.guide-step:nth-child(3) .guide-step-number {
  background: var(--sky-deep);
}

.guide-step:nth-child(4) .guide-step-number {
  background: var(--gold);
}

.guide-step:nth-child(5) .guide-step-number {
  background: #7d5e9d;
}

.guide-step h3 {
  margin: 0;
  font-size: 14px;
}

.guide-step p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.guide-step .button {
  margin-top: 10px;
}

.action-tile {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  padding: 11px;
  color: var(--ink);
  text-align: left;
  background: #faf9f4;
  border: 1px solid #e5e4db;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease;
}

.action-tile:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.action-tile > span:first-child {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: var(--radius);
}

.action-tile:nth-child(2) > span:first-child {
  color: #a85c20;
  background: var(--gold-soft);
}

.action-tile:nth-child(3) > span:first-child {
  color: var(--sky-deep);
  background: var(--sky);
}

.action-tile:nth-child(4) > span:first-child {
  color: var(--red);
  background: var(--red-soft);
}

.action-tile strong,
.action-tile small {
  display: block;
}

.action-tile strong {
  font-size: 12px;
}

.action-tile small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.chapter-card {
  min-width: 0;
  min-height: 126px;
  padding: 13px;
  background: #faf9f4;
  border: 1px solid #e5e4db;
  border-radius: var(--radius);
}

.chapter-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chapter-number {
  color: var(--orange);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.chapter-course {
  padding: 3px 6px;
  color: var(--green);
  font-size: 9px;
  font-weight: 750;
  background: var(--green-soft);
  border-radius: 999px;
}

.chapter-course.linear {
  color: var(--sky-deep);
  background: var(--sky);
}

.chapter-card h3 {
  overflow: hidden;
  margin: 11px 0 9px;
  min-height: 38px;
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chapter-card p {
  min-height: 31px;
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-track {
  position: relative;
  height: 6px;
  flex: 1;
  overflow: hidden;
  background: #e4e8e3;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: inherit;
  transition: width 300ms ease;
}

.progress-line span {
  min-width: 30px;
  color: var(--ink-soft);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  background: #f5f4ee;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover,
.chip.is-active {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.chip-count {
  opacity: 0.72;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.select-control,
.input-control {
  min-height: 38px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

.select-control:focus,
.input-control:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 102, 88, 0.1);
}

.memory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(270px, 0.55fr);
  gap: 18px;
  align-items: start;
}

.memory-stage {
  min-width: 0;
}

.session-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
}

.session-track {
  height: 5px;
  flex: 1;
  overflow: hidden;
  background: #dfe5df;
  border-radius: 999px;
}

.session-track span {
  display: block;
  height: 100%;
  background: var(--orange);
  border-radius: inherit;
  transition: width 240ms ease;
}

.memory-card {
  position: relative;
  display: grid;
  min-height: 452px;
  align-content: center;
  overflow: hidden;
  padding: 34px 36px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.memory-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  content: "";
  background: var(--green);
}

.memory-card.is-back::before {
  background: var(--orange);
}

.memory-card-top {
  position: absolute;
  inset: 18px 20px auto 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.memory-card-top span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.memory-card-top em {
  color: var(--green);
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
}

.memory-card-content {
  max-width: 920px;
}

.memory-card-label {
  margin-bottom: 11px;
  color: var(--orange);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.memory-card h2 {
  margin: 0 0 22px;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 29px;
  line-height: 1.4;
}

.memory-prompt,
.memory-answer {
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.9;
}

.memory-answer {
  color: var(--ink);
}

.memory-answer strong {
  color: var(--green);
}

.formula-display {
  margin: 18px 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--green-deep);
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 24px;
  line-height: 1.7;
  text-align: center;
  white-space: nowrap;
  background: #f2f5ef;
  border: 1px solid #dce4dc;
  border-radius: var(--radius);
}

.formula-display.small {
  font-size: 19px;
}

.formula-sub {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.hint-box,
.warning-box {
  margin-top: 18px;
  padding: 12px 14px;
  color: #765210;
  font-size: 12px;
  line-height: 1.65;
  background: var(--gold-soft);
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.warning-box {
  color: #7b312c;
  background: var(--red-soft);
  border-left-color: var(--red);
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.rating-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.rating-button {
  min-height: 76px;
  padding: 11px 10px;
  text-align: center;
  background: #f7f6f1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.rating-button:hover {
  transform: translateY(-1px);
}

.rating-button strong,
.rating-button small {
  display: block;
}

.rating-button strong {
  font-size: 13px;
}

.rating-button small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.rating-button.again {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ebc8c4;
}

.rating-button.fuzzy {
  color: #8a5a12;
  background: var(--gold-soft);
  border-color: #ead9a1;
}

.rating-button.know {
  color: var(--green);
  background: var(--green-soft);
  border-color: #c9dfd5;
}

.empty-state {
  display: grid;
  min-height: 300px;
  place-items: center;
  padding: 30px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty-state-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 50%;
}

.empty-state-icon svg {
  width: 26px;
  height: 26px;
}

.empty-state h2 {
  margin: 0;
  font-size: 19px;
}

.empty-state p {
  max-width: 440px;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.formula-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  margin-bottom: 16px;
}

.search-field {
  position: relative;
}

.search-field svg {
  position: absolute;
  inset: 50% auto auto 13px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px 0 42px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

.search-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 102, 88, 0.1);
}

.formula-count {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.formula-list {
  display: grid;
  gap: 9px;
}

.formula-item {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}

.formula-item summary {
  display: grid;
  grid-template-columns: 38px minmax(150px, 0.52fr) minmax(220px, 1fr) 18px;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 16px;
  list-style: none;
  cursor: pointer;
}

.formula-item summary::-webkit-details-marker {
  display: none;
}

.formula-index {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  background: var(--green-soft);
  border-radius: 50%;
}

.formula-title strong,
.formula-title small {
  display: block;
}

.formula-title strong {
  font-size: 13px;
}

.formula-title small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.formula-preview {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula-item summary > svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 180ms ease;
}

.formula-item[open] summary > svg {
  transform: rotate(90deg);
}

.formula-body {
  padding: 0 18px 18px 70px;
  border-top: 1px solid #ecece6;
}

.formula-body .formula-display {
  margin: 16px 0;
}

.formula-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.pdf-parts {
  margin-top: 13px;
  background: #faf9f4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pdf-parts summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.pdf-parts summary::-webkit-details-marker {
  display: none;
}

.pdf-parts summary::after {
  content: "展开";
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.pdf-parts[open] summary::after {
  content: "收起";
}

.pdf-part-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 0 10px 10px;
}

.pdf-part-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 7px 9px;
  color: var(--ink);
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #e5e4db;
  border-radius: 6px;
}

.pdf-part-link:hover {
  border-color: var(--green);
}

.pdf-part-link strong,
.pdf-part-link small {
  display: block;
}

.pdf-part-link strong {
  font-size: 10px;
}

.pdf-part-link small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.pdf-part-link > span {
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}

.tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  background: #eef4ef;
  border: 1px solid #dce6df;
  border-radius: 999px;
}

.tag.is-locked {
  opacity: 0.42;
  filter: grayscale(0.8);
}

.quiz-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.5fr);
  gap: 18px;
  align-items: start;
}

.quiz-card {
  min-width: 0;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.question-index {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.question-topic {
  padding: 4px 8px;
  color: var(--sky-deep);
  font-size: 9px;
  font-weight: 750;
  background: var(--sky);
  border-radius: 999px;
}

.question-text {
  margin: 0 0 22px;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 20px;
  line-height: 1.75;
}

.option-list {
  display: grid;
  gap: 10px;
}

.option-button {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 13px;
  color: var(--ink);
  text-align: left;
  background: #faf9f4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.option-button:hover:not(:disabled) {
  border-color: var(--green);
}

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

.option-letter {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  background: #eef0eb;
  border-radius: 50%;
}

.option-button.is-correct {
  background: #eaf5ef;
  border-color: #75aa8c;
}

.option-button.is-correct .option-letter {
  color: #ffffff;
  background: #2d7d5f;
}

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

.option-button.is-wrong .option-letter {
  color: #ffffff;
  background: var(--red);
}

.explanation {
  margin-top: 18px;
  padding: 16px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
  background: #f1f6f2;
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.explanation strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.quiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.setup-option {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 76px;
  padding: 13px;
  text-align: left;
  background: #faf9f4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.setup-option:hover,
.setup-option.is-selected {
  border-color: var(--green);
}

.setup-option.is-selected {
  background: #f2f7f3;
}

.setup-option-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: var(--radius);
}

.setup-option:nth-child(2) .setup-option-icon {
  color: var(--sky-deep);
  background: var(--sky);
}

.setup-option strong,
.setup-option small {
  display: block;
}

.setup-option strong {
  font-size: 13px;
}

.setup-option small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.setup-option > svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.range-value {
  min-width: 72px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.mistake-list {
  display: grid;
  gap: 10px;
}

.mistake-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}

.mistake-item.is-mastered {
  opacity: 0.66;
}

.mistake-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 50%;
}

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

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

.mistake-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistake-copy p {
  overflow: hidden;
  margin: 5px 0;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistake-copy small {
  color: var(--muted);
  font-size: 9px;
}

.mistake-actions {
  display: flex;
  gap: 7px;
}

.plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.countdown-panel {
  position: relative;
  overflow: hidden;
  padding: 26px;
  color: #f7fbf8;
  background: var(--green-deep);
  border: 1px solid var(--green-deep);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.countdown-panel::after {
  position: absolute;
  top: -60px;
  right: -30px;
  width: 180px;
  height: 180px;
  content: "";
  border: 26px solid rgba(232, 214, 107, 0.14);
  border-radius: 50%;
}

.countdown-panel .eyebrow {
  color: #e8d66b;
}

.countdown-number {
  position: relative;
  z-index: 2;
  margin: 2px 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 64px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.countdown-panel p {
  position: relative;
  z-index: 2;
  margin: 9px 0 20px;
  color: rgba(247, 251, 248, 0.66);
  font-size: 12px;
  line-height: 1.7;
}

.countdown-panel .progress-track {
  background: rgba(255, 255, 255, 0.18);
}

.countdown-panel .progress-fill {
  background: #e8d66b;
}

.countdown-panel .progress-line span {
  color: rgba(247, 251, 248, 0.78);
}

.phase-list {
  display: grid;
  gap: 10px;
}

.phase-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px;
  background: #faf9f4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.phase-number {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
  background: var(--green-soft);
  border-radius: 50%;
}

.phase-item:nth-child(2) .phase-number {
  color: #8a5a12;
  background: var(--gold-soft);
}

.phase-item:nth-child(3) .phase-number {
  color: var(--red);
  background: var(--red-soft);
}

.phase-item h3 {
  margin: 0;
  font-size: 13px;
}

.phase-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.settings-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field-label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

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

.backup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.resource-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 220px;
  padding: 19px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}

.resource-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.resource-type {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: var(--radius);
}

.resource-card:nth-child(2n) .resource-type {
  color: var(--sky-deep);
  background: var(--sky);
}

.resource-card:nth-child(3n) .resource-type {
  color: #95551a;
  background: var(--gold-soft);
}

.resource-size {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.resource-card h2 {
  margin: 15px 0 7px;
  font-size: 16px;
}

.resource-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 17px;
}

.source-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 15px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
  background: var(--gold-soft);
  border: 1px solid #ead9a1;
  border-radius: var(--radius);
}

.source-note svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #8a5a12;
}

.sheet-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.sheet-dialog::backdrop {
  background: rgba(13, 31, 28, 0.56);
  backdrop-filter: blur(3px);
}

.dialog-card {
  position: relative;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 28px 90px rgba(12, 31, 27, 0.3);
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.dialog-card h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 24px;
}

.timer-face {
  margin: 27px 0;
  color: var(--green-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 72px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.timer-mode {
  margin-top: 10px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.exam-timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
  padding: 9px 12px;
  color: #8a4b20;
  font-size: 11px;
  font-weight: 750;
  background: var(--orange-soft);
  border: 1px solid #efc4b2;
  border-radius: var(--radius);
}

.exam-timer-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.exam-timer-row svg {
  width: 15px;
  height: 15px;
}

.exam-timer-row strong {
  color: var(--red);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.timer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dialog-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 80;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 15px;
  color: #ffffff;
  font-size: 12px;
  line-height: 1.5;
  background: var(--green-deep);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(12, 31, 27, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

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

@media (max-width: 1180px) {
  .view-root {
    padding-inline: 28px;
  }

  .dashboard-grid,
  .memory-layout,
  .quiz-shell,
  .plan-grid,
  .guide-layout {
    grid-template-columns: 1fr;
  }

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

  .sidebar {
    --sidebar-width: 220px;
    width: 220px;
  }

  .main {
    margin-left: 220px;
  }
}

@media (max-width: 900px) {
  body {
    background-size: 24px 24px;
  }

  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    padding-top: 58px;
  }

  .mobile-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 30;
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    padding: 8px max(14px, env(safe-area-inset-left)) 8px max(14px, env(safe-area-inset-right));
    background: rgba(255, 253, 248, 0.95);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .brand-mobile {
    color: var(--ink);
  }

  .brand-mobile .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 21px;
  }

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

  .brand-mobile small {
    color: var(--muted);
    font-size: 8px;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255, 253, 248, 0.97);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .mobile-nav-item {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 48px;
    place-items: center;
    gap: 2px;
    padding: 3px 1px;
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
  }

  .mobile-nav-item svg {
    width: 19px;
    height: 19px;
  }

  .mobile-nav-item span {
    overflow: hidden;
    max-width: 100%;
    font-size: 9px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-item em {
    position: absolute;
    top: 0;
    left: calc(50% + 7px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    color: #ffffff;
    font-size: 8px;
    font-style: normal;
    line-height: 16px;
    text-align: center;
    background: var(--orange);
    border-radius: 999px;
  }

  .mobile-nav-item.is-active {
    color: var(--green);
  }

  .view-root {
    padding: 22px 16px calc(92px + env(safe-area-inset-bottom));
  }

  .page-head {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .page-title {
    font-size: 27px;
  }

  .page-subtitle {
    font-size: 12px;
  }

  .head-actions {
    display: none;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 24px 20px 20px;
  }

  .hero-copy h1 {
    font-size: 23px;
  }

  .hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 12px;
  }

  .hero-metric {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
    min-height: 104px;
    padding: 10px 5px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 0;
  }

  .hero-metric:last-child {
    border-right: 0;
  }

  .hero-metric-icon {
    width: 34px;
    height: 34px;
  }

  .hero-metric strong {
    font-size: 17px;
  }

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

  .stat-card {
    min-height: 78px;
  }

  .dashboard-grid,
  .memory-layout,
  .quiz-shell,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .memory-card {
    min-height: 432px;
    padding: 52px 22px 28px;
  }

  .memory-card h2 {
    font-size: 24px;
  }

  .formula-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .formula-toolbar .search-field {
    grid-column: 1 / -1;
  }

  .formula-count {
    justify-content: flex-end;
  }

  .formula-item summary {
    grid-template-columns: 34px minmax(0, 1fr) 16px;
    gap: 10px;
  }

  .formula-preview {
    display: none;
  }

  .formula-body {
    padding-left: 16px;
  }

  .setup-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .guide-banner {
    align-items: flex-start;
  }

  .mistake-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .mistake-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 560px) {
  .stat-strip {
    gap: 8px;
  }

  .stat-card {
    display: block;
    min-height: 96px;
    padding: 12px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
  }

  .stat-card strong {
    font-size: 19px;
  }

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

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .hero-copy::after {
    display: none;
  }

  .hero-actions .button {
    flex: 1 1 120px;
  }

  .task-row {
    grid-template-columns: 34px 1fr;
  }

  .task-value {
    grid-column: 2;
  }

  .rating-panel {
    gap: 7px;
  }

  .rating-button {
    min-height: 72px;
    padding-inline: 5px;
  }

  .rating-button strong {
    font-size: 11px;
  }

  .quiz-card {
    padding: 20px 16px;
  }

  .question-text {
    font-size: 18px;
  }

  .formula-display {
    padding-inline: 12px;
    font-size: 20px;
  }

  .formula-display.small {
    font-size: 17px;
  }

  .guide-banner {
    display: block;
  }

  .guide-banner .button {
    width: 100%;
    margin-top: 12px;
  }

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

  .timer-face {
    font-size: 62px;
  }

  .toast {
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

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

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #10201d;
  --paper-deep: #162b27;
  --surface: #182c28;
  --surface-strong: #1d3530;
  --ink: #edf6f2;
  --ink-soft: #b9cdc7;
  --muted: #839b95;
  --line: #314a44;
  --line-strong: #47645d;
  --green: #53b79e;
  --green-deep: #0b1715;
  --green-soft: #21453d;
  --orange-soft: #4b2c22;
  --gold-soft: #493d20;
  --sky: #233f4a;
  --sky-deep: #9bc6d5;
  --red-soft: #4a2827;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  --shadow-small: 0 5px 16px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] body {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(201, 230, 221, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 230, 221, 0.04) 1px, transparent 1px);
}

html[data-theme="dark"] .sidebar {
  background: #0b1715;
}

html[data-theme="dark"] .task-row,
html[data-theme="dark"] .chapter-card,
html[data-theme="dark"] .action-tile,
html[data-theme="dark"] .option-button,
html[data-theme="dark"] .setup-option,
html[data-theme="dark"] .phase-item,
html[data-theme="dark"] .rating-button,
html[data-theme="dark"] .subject-progress {
  background: #1b312c;
  border-color: #304b44;
}

html[data-theme="dark"] .task-row.is-done,
html[data-theme="dark"] .setup-option.is-selected {
  background: #203d36;
}

html[data-theme="dark"] .formula-display,
html[data-theme="dark"] .explanation,
html[data-theme="dark"] .source-note {
  background: #1c3832;
  border-color: #34534a;
}

html[data-theme="dark"] .formula-item,
html[data-theme="dark"] .mistake-item,
html[data-theme="dark"] .resource-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .quiz-card,
html[data-theme="dark"] .memory-card,
html[data-theme="dark"] .empty-state {
  background: var(--surface);
  border-color: var(--line);
}

html[data-theme="dark"] .mobile-header,
html[data-theme="dark"] .mobile-nav {
  background: rgba(16, 32, 29, 0.96);
  border-color: var(--line);
}

html[data-theme="dark"] .input-control,
html[data-theme="dark"] .select-control,
html[data-theme="dark"] .search-field input {
  color: var(--ink);
  background: #142722;
  border-color: var(--line-strong);
}

html[data-theme="dark"] .progress-track,
html[data-theme="dark"] .session-track,
html[data-theme="dark"] .bar-track {
  background: #2a443d;
}
