:root {
  --ink: #20292b;
  --muted: #6d7776;
  --quiet: #9ba3a0;
  --paper: #f3f2ed;
  --surface: #fffefa;
  --surface-soft: #ebeae4;
  --line: #d9d9d1;
  --coral: #d86950;
  --teal: #327c73;
  --indigo: #53617f;
  --gold: #be8b3d;
  --blue: #467ca0;
  --reading-width: 760px;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(216, 105, 80, 0.35);
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header,
.reader-toolbar {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.94);
  backdrop-filter: blur(14px);
}

.site-header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 68px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  font-weight: 720;
  letter-spacing: 0;
}

.brand-page-title {
  display: none;
}

.practice-brand {
  padding: 0;
  background: transparent;
  color: inherit;
}

.practice-back-icon {
  display: none;
}

.practice-draft-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.practice-page.is-session .practice-draft-toggle {
  display: inline-flex;
}

.draft-icon {
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("/vendor/icons/square-pen.svg") center / contain no-repeat;
  mask: url("/vendor/icons/square-pen.svg") center / contain no-repeat;
}

.practice-draft-toggle:hover {
  border-color: var(--coral);
  background: #fff5ed;
  color: var(--coral);
}

.practice-draft-overlay {
  position: fixed;
  inset: 78px 0 0;
  z-index: 25;
  width: 100%;
  height: calc(100vh - 78px);
  display: block;
  background: rgba(242, 244, 240, 0.28);
  cursor: crosshair;
  touch-action: none;
  pointer-events: none;
}

.practice-draft-overlay[hidden] {
  display: none;
}

.practice-draft-overlay.is-open {
  pointer-events: auto;
}

.practice-draft-toolbar {
  position: fixed;
  top: 88px;
  left: 50%;
  z-index: 29;
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.94);
  box-shadow: 0 5px 18px rgba(32, 41, 43, 0.14);
}

.practice-draft-toolbar[hidden] {
  display: none;
}

.practice-draft-tool-list,
.practice-draft-settings {
  display: flex;
  align-items: center;
  gap: 3px;
}

.practice-draft-tool-list {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.practice-draft-tool-list::-webkit-scrollbar {
  display: none;
}

.draft-tool,
.draft-action-button,
.draft-clear-button {
  min-width: 36px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.draft-tool-icon {
  width: 17px;
  height: 17px;
  display: block;
  background: currentColor;
  -webkit-mask: var(--draft-tool-icon) center / contain no-repeat;
  mask: var(--draft-tool-icon) center / contain no-repeat;
}

.draft-icon-pen { --draft-tool-icon: url("/vendor/icons/pen.svg"); }
.draft-icon-select { --draft-tool-icon: url("/vendor/icons/mouse-pointer-2.svg"); }
.draft-icon-eraser { --draft-tool-icon: url("/vendor/icons/eraser.svg"); }
.draft-icon-line { --draft-tool-icon: url("/vendor/icons/minus.svg"); }
.draft-icon-curve { --draft-tool-icon: url("/vendor/icons/spline.svg"); }
.draft-icon-triangle { --draft-tool-icon: url("/vendor/icons/triangle.svg"); }
.draft-icon-circle { --draft-tool-icon: url("/vendor/icons/circle.svg"); }
.draft-icon-parabola { --draft-tool-icon: url("/vendor/icons/chart-spline.svg"); }
.draft-icon-hyperbola { --draft-tool-icon: url("/vendor/icons/infinity.svg"); }
.draft-icon-axes { --draft-tool-icon: url("/vendor/icons/axis-3d.svg"); }
.draft-icon-undo { --draft-tool-icon: url("/vendor/icons/undo-2.svg"); }
.draft-icon-flip-horizontal { --draft-tool-icon: url("/vendor/icons/flip-horizontal-2.svg"); }
.draft-icon-flip-vertical { --draft-tool-icon: url("/vendor/icons/flip-vertical-2.svg"); }
.draft-icon-clear { --draft-tool-icon: url("/vendor/icons/trash-2.svg"); }
.draft-icon-fill { --draft-tool-icon: url("/vendor/icons/paint-bucket.svg"); }

.draft-tool-divider {
  width: 1px;
  height: 20px;
  flex: 0 0 auto;
  margin: 0 3px;
  background: var(--line);
}

.draft-symbol-tool {
  min-width: 34px;
  font-family: "Times New Roman", "Cambria Math", serif;
  font-size: 16px;
  font-weight: 600;
}

.draft-symbol-tool[data-tool^="symbol-sin"],
.draft-symbol-tool[data-tool^="symbol-cos"],
.draft-symbol-tool[data-tool^="symbol-tan"] {
  font-size: 12px;
  font-style: italic;
}

.draft-tool:hover,
.draft-tool.is-active,
.draft-action-button:not(:disabled):hover,
.draft-clear-button:hover {
  border-color: var(--coral);
  background: #fff5ed;
  color: var(--coral);
}

.draft-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.practice-draft-settings {
  flex: 0 0 auto;
  padding-left: 4px;
  border-left: 1px solid var(--line);
}

.draft-color-control,
.draft-size-control {
  display: inline-flex;
  align-items: center;
}

.draft-color-control input {
  width: 26px;
  height: 26px;
  padding: 2px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.draft-size-control input {
  width: 66px;
  accent-color: var(--teal);
}

.draft-clear-button {
  min-width: 40px;
}

body.theme-night .practice-draft-toolbar {
  background: rgba(41, 52, 50, 0.95);
}

.practice-draft-context-menu {
  position: fixed;
  z-index: 31;
  width: 136px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.96);
  box-shadow: 0 6px 20px rgba(32, 41, 43, 0.16);
}

.practice-draft-context-menu[hidden] {
  display: none;
}

.practice-draft-context-menu button,
.draft-selected-color {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.draft-menu-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  display: block;
  background: currentColor;
  -webkit-mask: var(--draft-tool-icon) center / contain no-repeat;
  mask: var(--draft-tool-icon) center / contain no-repeat;
}

.practice-draft-context-menu button:hover,
.practice-draft-context-menu button[aria-pressed="true"],
.draft-selected-color:hover {
  border-color: var(--coral);
  background: #fff5ed;
  color: var(--coral);
}

.practice-draft-context-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.draft-selected-color {
  grid-column: 1 / -1;
  justify-content: space-between;
  padding: 0 7px;
}

.draft-selected-color input {
  width: 23px;
  height: 23px;
  padding: 2px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

body.theme-night .practice-draft-context-menu {
  background: rgba(41, 52, 50, 0.96);
}

.home-header-stats {
  display: none;
}

.formula-header-summary,
.mathematician-header-summary,
.practice-header-summary {
  display: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  position: relative;
  display: inline-block;
  border: 1px solid var(--ink);
  background: var(--coral);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: var(--ink);
}

.brand-mark::before {
  width: 14px;
  height: 1px;
  left: 6px;
  top: 13px;
}

.brand-mark::after {
  width: 1px;
  height: 14px;
  left: 13px;
  top: 6px;
}

.header-meta,
.reader-actions,
.toolbar-actions,
.reader-controls,
.jump-control {
  display: flex;
  align-items: center;
}

.header-meta {
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
}

.header-rule {
  width: 34px;
  height: 1px;
  background: var(--coral);
}

.header-link {
  color: var(--coral);
  font-weight: 750;
}

.header-link:hover {
  color: var(--teal);
}

.mobile-nav {
  display: none;
}

.home-main {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 76px;
}

.library-intro {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 70px;
  align-items: end;
  padding: 10px 0 64px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.library-intro h1 {
  max-width: 620px;
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
}

.library-intro h1 em {
  color: var(--teal);
  font-style: normal;
}

.library-note {
  display: grid;
  gap: 18px;
  padding-bottom: 5px;
}

.library-note p {
  margin: 0;
  color: var(--muted);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 16px;
  line-height: 1.75;
}

.stat-strip {
  display: flex;
  gap: 26px;
  padding-top: 6px;
}

.stat {
  display: grid;
  gap: 3px;
}

.stat strong {
  font-size: 21px;
  line-height: 1;
}

.stat span {
  color: var(--quiet);
  font-size: 11px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 36px 0 18px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 28px;
  letter-spacing: 0;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.practice-launch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: 8px 0 26px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.practice-launch .eyebrow {
  margin-bottom: 8px;
}

.practice-launch h2,
.practice-launch p {
  margin: 0;
}

.practice-launch h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 23px;
}

.practice-launch p:not(.eyebrow) {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.practice-launch-button,
.practice-start-button,
.practice-submit-button,
.practice-next-button,
.practice-secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.practice-launch-button:hover,
.practice-start-button:hover,
.practice-submit-button:hover,
.practice-next-button:hover {
  border-color: var(--coral);
  background: var(--coral);
}

.practice-launch-button span,
.practice-start-button span,
.practice-next-button span {
  margin-left: 8px;
  font-size: 16px;
  line-height: 0;
}

.practice-page {
  min-height: 100vh;
  background: var(--paper);
}

.practice-main {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 52px 0 80px;
}

.practice-topline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.practice-topline h1 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 48px;
  line-height: 1;
}

.practice-topline > p {
  max-width: 270px;
  margin: 0 0 2px;
  color: var(--muted);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 15px;
  line-height: 1.7;
}

.practice-setup,
.practice-session,
.practice-finished {
  margin-top: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.practice-setup {
  padding: 30px;
}

.practice-setup-head,
.practice-session-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}

.practice-setup-head h2,
.practice-session-head h2,
.practice-finished h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 25px;
  line-height: 1.35;
}

.practice-setup-head p:not(.eyebrow),
.practice-session-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.practice-pool-count {
  display: grid;
  min-width: 76px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  text-align: right;
}

.practice-pool-count strong {
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 28px;
  line-height: 1;
}

.practice-pool-count span {
  margin-top: 5px;
  font-size: 11px;
}

.practice-message {
  margin: 20px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--coral);
  background: #fff5ed;
  color: var(--coral);
  font-size: 12px;
}

.practice-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.practice-field,
.practice-fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.practice-field > span,
.practice-fieldset legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.practice-field select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.practice-field select:disabled {
  color: var(--quiet);
  background: var(--surface-soft);
}

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

.practice-scope-button {
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.practice-scope-button:hover,
.practice-scope-button.is-active {
  border-color: var(--coral);
  background: #fff5ed;
  color: var(--coral);
  font-weight: 700;
}

.practice-start-button {
  align-self: end;
  min-height: 42px;
}

.practice-session {
  padding: 26px;
}

.practice-meta-line,
.practice-progress-line,
.practice-actions,
.practice-finished-actions {
  display: flex;
  align-items: center;
}

.practice-meta-line {
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.practice-kind {
  padding: 3px 7px;
  background: var(--surface-soft);
  color: var(--coral);
  font-size: 11px;
  font-weight: 700;
}

.practice-session-head h2 {
  margin-top: 10px;
  font-size: 22px;
}

.practice-timer-wrap {
  min-width: 92px;
  padding: 8px 0 8px 16px;
  border-left: 1px solid var(--line);
  text-align: right;
}

.practice-timer-wrap span {
  display: block;
  color: var(--quiet);
  font-size: 11px;
}

.practice-timer-wrap strong {
  display: block;
  margin-top: 5px;
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 20px;
  letter-spacing: 0;
}

.practice-progress-line {
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.practice-session > .practice-progress-line {
  margin-top: 0;
}

.practice-question-context {
  display: grid;
  gap: 2px;
  margin-top: 14px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 10px;
  line-height: 1.5;
}

.practice-question-context strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.practice-question-card {
  margin-top: 20px;
  padding: 22px;
  background: var(--surface-soft);
}

.practice-question-content {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.practice-prompt {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
  line-height: 1.85;
}

.practice-prompt .exercise-question-line {
  white-space: pre-wrap;
}

.practice-figure {
  margin-top: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.practice-figure summary {
  padding: 9px 11px;
  color: var(--teal);
  cursor: pointer;
  font-family: var(--font-family, "Noto Sans SC", sans-serif);
  font-size: 12px;
  font-weight: 700;
}

.practice-question-image {
  display: block;
  width: 100%;
  max-height: 620px;
  border-top: 1px solid var(--line);
  object-fit: contain;
  object-position: center top;
}

.practice-answer-field {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.practice-answer-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.practice-answer-field textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 15px;
  line-height: 1.7;
}

.practice-answer-field textarea:disabled {
  color: var(--muted);
  background: var(--paper);
}

.practice-actions {
  justify-content: end;
  gap: 8px;
  margin-top: 14px;
}

.practice-submit-button:disabled,
.practice-next-button:disabled,
.practice-start-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.practice-next-button {
  border-color: var(--teal);
  background: var(--teal);
}

.practice-feedback {
  margin-top: 18px;
  padding: 14px;
  border-left: 3px solid var(--teal);
  background: var(--surface);
}

.practice-feedback.no-answer {
  border-left-color: var(--gold);
}

.practice-feedback > strong {
  color: var(--teal);
  font-size: 13px;
}

.practice-feedback.no-answer > strong {
  color: var(--gold);
}

.practice-feedback p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.practice-answer-content {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

.practice-answer-content .exercise-question-line {
  white-space: pre-wrap;
}

.practice-answer-content .exercise-answer-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
}

.practice-timeout {
  margin: 12px 0 0;
  color: var(--coral);
  font-size: 12px;
}

.practice-finished {
  padding: 44px 30px;
  text-align: center;
}

.practice-finished h2 {
  margin-top: 8px;
}

.practice-finished-stats {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}

.practice-finished-stats strong {
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 32px;
}

.practice-finished-actions {
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
}

.practice-secondary-button {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.practice-secondary-button:hover {
  border-color: var(--coral);
  background: #fff5ed;
  color: var(--coral);
}

.formula-main {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 76px;
}

.formula-intro {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 70px;
  align-items: end;
  padding: 10px 0 54px;
  border-bottom: 1px solid var(--line);
}

.formula-intro h1 {
  max-width: 620px;
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 800;
  line-height: 1.05;
}

.formula-intro h1 em {
  color: var(--teal);
  font-style: normal;
}

.formula-note {
  display: grid;
  gap: 13px;
  padding-bottom: 5px;
}

.formula-note p,
.formula-note strong {
  margin: 0;
}

.formula-note p {
  color: var(--muted);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 16px;
  line-height: 1.75;
}

.formula-note strong {
  color: var(--coral);
  font-size: 13px;
}

.formula-workbench {
  padding-top: 28px;
}

.formula-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.formula-search input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.formula-search input::placeholder {
  color: var(--quiet);
}

.formula-categories {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.formula-category {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.formula-category:hover,
.formula-category.is-active {
  border-color: var(--coral);
  background: #fff5ed;
  color: var(--coral);
}

.formula-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  border: 1px solid var(--line);
  background: var(--line);
}

.formula-card {
  min-width: 0;
  min-height: 286px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--surface);
}

.formula-card:hover {
  background: #fdf8f1;
}

.formula-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.formula-index {
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.formula-category-label {
  color: var(--quiet);
  font-size: 11px;
}

.formula-card h3 {
  margin: 16px 0 7px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 18px;
  line-height: 1.45;
}

.formula-purpose,
.formula-conditions {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.formula-conditions {
  margin-top: 9px;
  color: var(--quiet);
}

.formula-condition-math {
  margin-left: 4px;
  color: var(--muted);
}

.formula-condition-math mjx-container {
  margin: 0 !important;
}

.formula-display {
  min-height: 66px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  margin: 16px 0 13px;
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  background: var(--surface-soft);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.7;
  white-space: nowrap;
}

.formula-display mjx-container {
  margin: 0 !important;
}

.formula-empty {
  grid-column: 1 / -1;
  padding: 80px 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.mathematician-main {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 76px;
}

.mathematician-intro {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 70px;
  align-items: end;
  padding: 10px 0 54px;
  border-bottom: 1px solid var(--line);
}

.mathematician-intro h1 {
  max-width: 620px;
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 800;
  line-height: 1.05;
}

.mathematician-intro h1 em {
  color: var(--teal);
  font-style: normal;
}

.mathematician-note {
  display: grid;
  gap: 13px;
  padding-bottom: 5px;
}

.mathematician-note p,
.mathematician-note strong {
  margin: 0;
}

.mathematician-note p {
  color: var(--muted);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 16px;
  line-height: 1.75;
}

.mathematician-note strong {
  color: var(--coral);
  font-size: 13px;
}

.mathematician-workbench {
  padding-top: 28px;
}

.mathematician-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.mathematician-eras {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.mathematician-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  border: 1px solid var(--line);
  background: var(--line);
}

.mathematician-card {
  min-width: 0;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--surface);
}

.mathematician-card:hover {
  background: #fdf8f1;
}

.mathematician-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.mathematician-index {
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.mathematician-era-label {
  color: var(--quiet);
  font-size: 11px;
}

.mathematician-card h3 {
  margin: 16px 0 3px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 22px;
  line-height: 1.45;
}

.mathematician-english-name {
  margin: 0 0 17px;
  color: var(--quiet);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}

.mathematician-card h4 {
  margin: 13px 0 5px;
  color: var(--coral);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.mathematician-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.mathematician-formulas {
  margin-top: auto;
  padding-top: 15px;
}

.mathematician-formula {
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}

.mathematician-formula + .mathematician-formula {
  margin-top: 12px;
}

.mathematician-formula h5 {
  margin: 0 0 4px;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 14px;
  line-height: 1.5;
}

.mathematician-formula > p:not(.formula-conditions) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.mathematician-formula .formula-display {
  min-height: 52px;
  margin: 9px 0 0;
  padding: 8px 10px;
  font-size: 16px;
}

.mathematician-formula .formula-conditions {
  margin-top: 7px;
  font-size: 11px;
}

.mathematician-empty {
  grid-column: 1 / -1;
  padding: 80px 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.book-card {
  min-height: 280px;
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 28px;
  background: var(--surface);
  transition: background 160ms ease, transform 160ms ease;
}

.book-card:hover {
  z-index: 1;
  background: #fdf8f1;
  transform: translateY(-2px);
}

.book-cover {
  width: 148px;
  aspect-ratio: 0.707 / 1;
  overflow: hidden;
  background: var(--surface-soft);
  box-shadow: 9px 10px 0 rgba(32, 41, 43, 0.08);
}

.book-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.book-cover-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 15px;
  color: white;
  background: var(--teal);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
}

.accent-coral .book-cover-fallback { background: var(--coral); }
.accent-teal .book-cover-fallback { background: var(--teal); }
.accent-indigo .book-cover-fallback { background: var(--indigo); }
.accent-gold .book-cover-fallback { background: var(--gold); }
.accent-blue .book-cover-fallback { background: var(--blue); }

.book-info {
  min-width: 0;
  display: flex;
  min-height: 224px;
  flex-direction: column;
  justify-content: space-between;
}

.book-kicker {
  margin: 0 0 13px;
  color: var(--coral);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.book-info h3 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: 0;
}

.book-publisher {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.book-bottom {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
}

.book-meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.book-progress {
  color: var(--teal);
}

.read-button,
.back-button,
.outline-button,
.text-button,
.icon-button,
.theme-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.read-button {
  min-height: 36px;
  padding: 0 14px;
  border-color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.read-button:hover,
.back-button:hover,
.outline-button:hover,
.text-button:hover,
.icon-button:hover,
.theme-choice:hover {
  border-color: var(--coral);
  background: #fff5ed;
}

.loading-state,
.error-state {
  padding: 90px 20px;
  color: var(--muted);
  text-align: center;
}

.reader-page {
  min-height: 100vh;
  background: var(--paper);
}

.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 10px clamp(15px, 3vw, 36px);
}

.reader-actions {
  min-width: 0;
  gap: 12px;
}

.back-button {
  min-height: 36px;
  padding: 0 11px;
  font-size: 13px;
  white-space: nowrap;
}

.reader-book-title {
  overflow: hidden;
  color: var(--muted);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-progress {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 110px;
  color: var(--ink);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.reader-progress input {
  width: 48px;
  height: 30px;
  padding: 0 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: right;
  appearance: textfield;
}

.reader-progress input:hover,
.reader-progress input:focus {
  border-color: var(--line);
  background: var(--surface);
}

.reader-progress input::-webkit-inner-spin-button,
.reader-progress input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.toolbar-actions {
  justify-content: end;
  gap: 7px;
}

.outline-button,
.text-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.icon-button {
  width: 34px;
  height: 34px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.reader-layout {
  position: relative;
  min-height: calc(100vh - 70px);
}

.reader-content {
  min-height: calc(100vh - 70px);
  padding: 34px 20px 100px;
  background: #dcdad3;
}

.reader-content-head {
  width: min(var(--reading-width), 100%);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 18px;
  color: #6c6e68;
  font-size: 12px;
}

.reader-content-head strong {
  color: var(--ink);
  font-weight: 700;
}

.page-stack {
  width: min(var(--reading-width), 100%);
  display: grid;
  gap: 18px;
  margin: 0 auto;
}

.page-frame {
  position: relative;
  width: 100%;
  min-height: 220px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 20px rgba(32, 41, 43, 0.11);
}

.page-frame.is-loading {
  aspect-ratio: 595.275 / 841.89;
}

.page-canvas-wrap {
  width: 100%;
  min-height: 100%;
}

.page-canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
}

.page-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #a4a6a0;
  font-size: 12px;
}

.toc-panel {
  position: fixed;
  inset: 70px auto 0 0;
  z-index: 15;
  width: min(330px, calc(100vw - 48px));
  overflow-y: auto;
  padding: 28px 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.98);
  box-shadow: 18px 0 35px rgba(32, 41, 43, 0.08);
  transform: translateX(-102%);
  transition: transform 200ms ease;
}

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

.exercise-panel {
  position: fixed;
  inset: 70px 0 0 auto;
  z-index: 15;
  width: min(470px, calc(100vw - 48px));
  overflow-y: auto;
  padding: 28px 24px;
  border-left: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.98);
  box-shadow: -18px 0 35px rgba(32, 41, 43, 0.08);
  transform: translateX(102%);
  transition: transform 200ms ease;
}

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

.exercise-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.exercise-kicker {
  margin: 0 0 6px;
  color: var(--coral);
  font-size: 11px;
  font-weight: 700;
}

.exercise-head h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 22px;
}

.exercise-list {
  display: grid;
  gap: 18px;
  padding-top: 16px;
}

.exercise-empty,
.exercise-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.exercise-summary {
  padding-bottom: 2px;
  color: var(--coral);
  font-weight: 700;
}

.exercise-chapter {
  display: grid;
  gap: 8px;
}

.exercise-chapter h3 {
  margin: 4px 0 0;
  padding: 9px 10px;
  border-left: 3px solid var(--coral);
  background: var(--surface-soft);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 15px;
}

.exercise-group {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.exercise-section-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 4px;
  background: transparent;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.exercise-section-button:hover {
  color: var(--coral);
}

.exercise-questions {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exercise-question {
  width: 100%;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  padding: 5px 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: left;
}

.exercise-question:hover {
  background: #fff5ed;
  color: var(--ink);
}

.exercise-question-number {
  color: var(--coral);
  font-weight: 700;
  text-align: right;
}

.exercise-question-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.exercise-question-line {
  display: block;
}

.exercise-question-images {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.exercise-question-image {
  display: block;
  width: 100%;
  height: 168px;
  border: 1px solid var(--line);
  background: var(--surface);
  object-fit: cover;
  object-position: center top;
}

.exercise-answer {
  margin: 7px 0 2px 30px;
  border-left: 2px solid var(--teal);
  background: var(--surface-soft);
}

.exercise-answer summary {
  padding: 7px 10px;
  color: var(--teal);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style-position: inside;
}

.exercise-answer-content {
  display: grid;
  gap: 7px;
  padding: 0 10px 10px;
  overflow: hidden;
}

.exercise-answer-content .exercise-question-line {
  color: var(--ink);
}

.exercise-answer-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.toc-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.toc-head h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 22px;
}

.toc-list {
  display: grid;
  gap: 5px;
  padding-top: 16px;
}

.toc-item {
  width: 100%;
  display: block;
  padding: 8px 8px;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

.toc-item:hover {
  border-left-color: var(--coral);
  background: #fff5ed;
  color: var(--ink);
}

.toc-level-0 {
  margin-top: 12px;
  padding: 10px 10px 9px;
  border-left: 3px solid var(--coral);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.toc-level-1 { padding-left: 20px; }
.toc-level-2 { padding-left: 32px; color: var(--quiet); font-size: 12px; }

.toc-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.jump-control {
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.jump-control input {
  width: 56px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
}

.theme-menu {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 30;
  display: none;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(32, 41, 43, 0.12);
}

.theme-menu.is-open {
  display: flex;
}

.theme-choice {
  width: 30px;
  height: 30px;
  font-size: 0;
}

.theme-choice[data-theme="paper"] { background: #f6f0e4; }
.theme-choice[data-theme="ink"] { background: #d5ddd9; }
.theme-choice[data-theme="night"] { background: #263332; }

body.theme-ink {
  --paper: #dbe3df;
  --surface: #f2f5f0;
}

body.theme-ink .reader-content { background: #c6d0ca; }

body.theme-night {
  --ink: #edf0e8;
  --muted: #aab4ad;
  --quiet: #84928a;
  --paper: #202928;
  --surface: #293432;
  --surface-soft: #33403d;
  --line: #46504c;
}

body.theme-night .site-header,
body.theme-night .reader-toolbar,
body.theme-night .toc-panel,
body.theme-night .exercise-panel,
body.theme-night .theme-menu,
body.theme-night .book-card,
body.theme-night .practice-setup,
body.theme-night .practice-session,
body.theme-night .practice-finished,
body.theme-night .formula-card,
body.theme-night .mathematician-card {
  background: #293432;
}

body.theme-night .reader-content { background: #171e1d; }
body.theme-night .book-card:hover,
body.theme-night .formula-card:hover,
body.theme-night .mathematician-card:hover { background: #30403b; }

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

@media (max-width: 900px) {
  .library-intro {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .formula-intro {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .mathematician-intro {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .library-note {
    max-width: 520px;
  }

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

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

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

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

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

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

  .reader-progress {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    margin-top: -2px;
  }

  .toolbar-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .practice-main {
    width: min(100% - 32px, 920px);
  }

  .practice-topline {
    align-items: start;
    flex-direction: column;
    gap: 18px;
  }

  .practice-topline > p {
    max-width: 520px;
  }
}

@media (max-width: 760px) {
  :root {
    --mobile-nav-height: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  html {
    scroll-padding-top: 52px;
    scroll-padding-bottom: calc(var(--mobile-nav-height) + 16px);
  }

  body {
    padding-bottom: var(--mobile-nav-height);
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: var(--mobile-nav-height);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    border-top: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 -3px 14px rgba(32, 41, 43, 0.04);
  }

  .mobile-nav a {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav a[aria-current="page"] {
    color: var(--teal);
    font-weight: 700;
  }

  .mobile-nav a[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    width: 24px;
    height: 2px;
    background: currentColor;
  }

  .mobile-nav a:focus-visible {
    outline-offset: -4px;
  }

  .nav-icon {
    width: 21px;
    height: 21px;
    background: currentColor;
    -webkit-mask: var(--nav-icon) center / contain no-repeat;
    mask: var(--nav-icon) center / contain no-repeat;
  }

  .nav-icon-books { --nav-icon: url("/vendor/icons/book-open.svg"); }
  .nav-icon-practice { --nav-icon: url("/vendor/icons/square-pen.svg"); }
  .nav-icon-people { --nav-icon: url("/vendor/icons/users-round.svg"); }
  .nav-icon-formulas { --nav-icon: url("/vendor/icons/sigma.svg"); }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 52px;
    padding: 0 16px;
  }

  .header-meta {
    display: none;
  }

  .brand {
    gap: 9px;
    font-size: 14px;
  }

  .brand-site-name {
    display: none;
  }

  .brand-page-title {
    display: inline;
  }

  .practice-session-active .mobile-nav {
    display: none;
  }

  .practice-draft-overlay {
    inset: 52px 0 0;
    height: calc(100vh - 52px);
  }

  .practice-draft-toolbar {
    top: 59px;
    left: 8px;
    right: 8px;
    max-width: none;
    flex-wrap: wrap;
    justify-content: space-between;
    transform: none;
  }

  .practice-draft-tool-list {
    width: 100%;
  }

  .practice-draft-settings {
    width: 100%;
    justify-content: flex-end;
    overflow-x: auto;
    padding-top: 4px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .practice-page.is-session .practice-brand .brand-mark {
    display: none;
  }

  .practice-page.is-session .practice-brand .practice-back-icon {
    width: 28px;
    height: 28px;
    display: inline-block;
    border: 1px solid var(--ink);
    background: var(--coral);
  }

  .practice-page.is-session .practice-brand .practice-back-icon::before {
    content: "←";
    display: block;
    color: var(--ink);
    font-size: 20px;
    font-weight: 400;
    line-height: 26px;
    text-align: center;
  }

  .home-header-stats {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-left: auto;
    color: var(--muted);
  }

  .formula-header-summary,
  .mathematician-header-summary,
  .practice-header-summary {
    min-width: 0;
    display: grid;
    flex: 1;
    gap: 1px;
    margin-left: 10px;
    color: var(--muted);
    text-align: right;
  }

  .formula-header-summary span,
  .mathematician-header-summary span,
  .practice-header-summary span {
    overflow: hidden;
    font-size: 10px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .formula-header-summary strong,
  .mathematician-header-summary strong,
  .practice-header-summary strong {
    color: var(--coral);
    font-size: 10px;
    line-height: 1.3;
  }

  .practice-header-summary {
    display: flex;
    align-items: baseline;
    justify-content: end;
    gap: 6px;
  }

  .practice-header-summary span {
    color: var(--quiet);
  }

  .home-header-stats .stat {
    display: flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
  }

  .home-header-stats .stat strong {
    color: var(--ink);
    font-size: 14px;
  }

  .home-header-stats .stat span {
    font-size: 10px;
  }

  .home-main,
  .formula-main,
  .mathematician-main,
  .practice-main {
    width: min(100% - 28px, 1160px);
    padding: 18px 0 24px;
  }

  .library-intro,
  .formula-intro,
  .mathematician-intro,
  .practice-topline {
    gap: 8px;
    padding: 0 0 16px;
  }

  .library-intro {
    display: none;
  }

  .formula-page .formula-intro {
    display: none;
  }

  .formula-page .formula-workbench {
    padding-top: 0;
  }

  .mathematician-page .mathematician-intro,
  .practice-page .practice-topline {
    display: none;
  }

  .mathematician-page .mathematician-workbench {
    padding-top: 0;
  }

  .library-intro h1,
  .formula-intro h1,
  .mathematician-intro h1,
  .practice-topline h1 {
    font-size: 24px;
    line-height: 1.35;
    letter-spacing: 0;
  }

  .library-intro > div:first-child,
  .formula-intro > div:first-child,
  .mathematician-intro > div:first-child,
  .practice-topline > div:first-child,
  .library-intro .eyebrow,
  .formula-intro .eyebrow,
  .mathematician-intro .eyebrow,
  .practice-topline .eyebrow,
  .library-note > p {
    display: none;
  }

  .library-intro h1 em,
  .formula-intro h1 em,
  .mathematician-intro h1 em {
    display: inline-block;
    margin-left: 8px;
  }

  .mathematician-intro h1 em {
    font-size: 16px;
    font-weight: 600;
  }

  .library-note,
  .formula-note,
  .mathematician-note {
    gap: 6px;
    padding: 0;
  }

  .formula-note p,
  .mathematician-note p,
  .practice-topline > p {
    max-width: none;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.6;
  }

  .formula-note strong,
  .mathematician-note strong {
    font-size: 12px;
  }

  .stat-strip {
    gap: 18px;
    padding: 0;
  }

  .stat {
    display: flex;
    align-items: baseline;
    gap: 5px;
  }

  .stat strong {
    font-size: 15px;
  }

  .section-heading {
    padding: 18px 0 12px;
  }

  .home-main .section-heading {
    display: none;
  }

  .section-heading h2 {
    font-size: 19px;
  }

  .section-heading > p {
    display: none;
  }

  .formula-workbench,
  .mathematician-workbench {
    min-width: 0;
    padding-top: 14px;
  }

  .formula-toolbar,
  .mathematician-toolbar {
    position: sticky;
    top: 52px;
    z-index: 10;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 12px;
    background: var(--paper);
    box-shadow: 0 1px 0 var(--line);
  }

  .formula-search input {
    font-size: 16px;
  }

  .formula-category {
    min-height: 40px;
  }

  .formula-list,
  .mathematician-list {
    margin-top: 12px;
  }

  .formula-conditions {
    overflow-x: auto;
    overflow-wrap: anywhere;
  }

  .practice-setup-head .eyebrow {
    display: none;
  }

  .practice-setup,
  .practice-session {
    margin-top: 20px;
    padding: 18px 16px;
  }

  .practice-setup-head,
  .practice-session-head {
    gap: 16px;
  }

  .practice-setup-head h2,
  .practice-session-head h2 {
    font-size: 20px;
  }

  .practice-setup-head {
    align-items: start;
  }

  .practice-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
    margin-top: 14px;
    padding-top: 14px;
  }

  .practice-fieldset {
    grid-column: 1 / -1;
  }

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

  .practice-start-button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .practice-question-card {
    padding: 16px;
  }

  .practice-session-head {
    flex-direction: column;
  }

  .practice-session .practice-timer-wrap {
    display: none;
  }

  .practice-timer-wrap {
    width: 100%;
    padding: 10px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
    text-align: left;
  }

  .practice-progress-line {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .practice-prompt {
    font-size: 15px;
  }

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

  .practice-submit-button,
  .practice-next-button {
    width: 100%;
  }

  .practice-launch {
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    padding: 12px 0;
  }

  .practice-launch .eyebrow,
  .practice-launch p:not(.eyebrow) {
    display: none;
  }

  .practice-launch h2 {
    font-size: 15px;
    line-height: 1.5;
  }

  .practice-launch-button {
    flex-shrink: 0;
    min-height: 40px;
    padding: 0 10px;
  }

  .practice-finished {
    margin-top: 20px;
    padding: 34px 18px;
  }

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

  .practice-secondary-button {
    width: 100%;
  }

  .book-card {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
    padding: 16px 12px;
  }

  .book-cover {
    width: 80px;
  }

  .formula-card {
    min-height: 0;
    padding: 20px 16px;
  }

  .mathematician-card {
    min-height: 0;
    padding: 20px 16px;
  }

  .book-info {
    min-height: 132px;
  }

  .book-kicker {
    margin-bottom: 5px;
    letter-spacing: 0;
  }

  .book-publisher {
    margin-top: 5px;
  }

  .book-info h3 {
    font-size: 16px;
  }

  .book-bottom {
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
  }

  .read-button {
    min-height: 40px;
    padding: 0 10px;
  }

  .reader-toolbar {
    height: 96px;
    min-height: 96px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 34px 36px;
    gap: 8px;
    padding: 8px 12px;
  }

  .reader-progress {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .reader-book-title {
    min-width: 0;
    font-size: 12px;
  }

  .outline-button,
  .text-button {
    padding: 0 8px;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
    gap: 4px;
  }

  .reader-content {
    padding: 18px 8px 70px;
  }

  .page-stack {
    gap: 9px;
  }

  .reader-content-head {
    padding: 0 4px;
  }

  .toc-panel {
    inset: 96px auto var(--mobile-nav-height) 0;
  }

  .exercise-panel {
    inset: 96px 0 var(--mobile-nav-height) auto;
    width: min(450px, calc(100vw - 24px));
    padding: 22px 16px;
  }

  .theme-menu {
    top: 96px;
    right: 12px;
  }
}
