:root {
  --ink: #183536;
  --ink-deep: #10292b;
  --muted: #697977;
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --surface-soft: #ebe7dd;
  --line: #dcd7cc;
  --accent: #d26a43;
  --accent-dark: #ad5334;
  --teal: #1f5a59;
  --teal-soft: #dce9e4;
  --danger: #a94836;
  --shadow: 0 18px 50px rgba(28, 49, 48, 0.08);
  --content: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(24, 53, 54, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 53, 54, 0.022) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

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

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

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(210, 106, 67, 0.3);
  outline-offset: 3px;
}

button {
  cursor: pointer;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(24, 53, 54, 0.08);
  background: rgba(245, 241, 232, 0.9);
  backdrop-filter: blur(16px);
}

.site-header-inner {
  width: min(var(--content), calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.site-brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fffaf2;
  background: var(--ink);
  border-radius: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 800;
}

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

.site-brand strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 17px;
  line-height: 1.2;
}

.site-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.desktop-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.desktop-nav a {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  border-radius: 9px;
  font-size: 14px;
  font-weight: 650;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  color: var(--ink);
  background: rgba(24, 53, 54, 0.06);
}

.site-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.quiet-link,
.text-button,
.danger-text-button {
  min-height: 42px;
  padding: 0;
  border: 0;
  display: inline-flex;
  align-items: center;
  color: var(--teal);
  background: transparent;
  font-weight: 750;
}

.danger-text-button {
  color: var(--danger);
}

.small-primary,
.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0 17px;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.small-primary,
.primary-button {
  color: #fffaf3;
  background: var(--accent);
}

.small-primary:hover,
.primary-button:hover {
  background: var(--accent-dark);
}

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

.small-primary:active,
.primary-button:active,
.secondary-button:active,
.favorite-button:active {
  transform: scale(0.985);
}

.site-main {
  width: min(var(--content), calc(100% - 40px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding-bottom: 84px;
}

.toast {
  position: fixed;
  top: 88px;
  left: 50%;
  z-index: 80;
  width: min(460px, calc(100% - 32px));
  min-height: 48px;
  padding: 10px 12px 10px 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #244e46;
  background: #e2eee8;
  border: 1px solid #c6dbd1;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.toast button {
  min-width: 44px;
  min-height: 32px;
  padding: 0 8px;
  color: var(--teal);
  background: transparent;
  border: 0;
}

.mobile-nav {
  display: none;
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.home-hero {
  min-height: 590px;
  padding: 72px 0 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.95fr);
  align-items: center;
  gap: 72px;
}

.home-hero-copy h1 {
  margin: 12px 0 20px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.home-hero-copy > p {
  max-width: 580px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.85;
}

.hero-search {
  max-width: 630px;
  margin-top: 32px;
  padding: 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.14);
  border-radius: 13px;
  box-shadow: 0 12px 32px rgba(28, 49, 48, 0.07);
}

.hero-search input {
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.hero-search button {
  min-width: 82px;
  min-height: 48px;
  color: #fffaf3;
  background: var(--ink);
  border: 0;
  border-radius: 9px;
  font-weight: 750;
}

.hero-actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.home-hero-board {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  padding: 28px;
  color: #f8f3e9;
  background: var(--ink-deep);
  border-radius: 26px 5px 26px 5px;
  box-shadow: 0 34px 80px rgba(16, 41, 43, 0.2);
}

.home-hero-board::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
}

.board-path {
  position: relative;
  z-index: 1;
  color: rgba(248, 243, 233, 0.5);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.board-formula {
  position: relative;
  z-index: 1;
  margin-top: 32px;
}

.board-formula span,
.board-formula strong {
  display: block;
}

.board-formula span {
  color: #f0a17d;
  font-weight: 750;
}

.board-formula strong {
  margin-top: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 500;
}

.board-axis {
  position: absolute;
  z-index: 1;
  right: 28px;
  bottom: 66px;
  left: 28px;
  height: 210px;
}

.axis-x,
.axis-y,
.vector-a,
.vector-proj {
  position: absolute;
  display: block;
  transform-origin: left center;
}

.axis-x {
  left: 12%;
  right: 6%;
  bottom: 24%;
  height: 1px;
  background: rgba(255, 255, 255, 0.34);
}

.axis-y {
  left: 45%;
  bottom: 8%;
  width: 1px;
  height: 82%;
  background: rgba(255, 255, 255, 0.22);
}

.vector-a,
.vector-proj {
  left: 45%;
  bottom: 24%;
  height: 3px;
}

.vector-a {
  width: 42%;
  background: #f0a17d;
  transform: rotate(-42deg);
}

.vector-proj {
  width: 31%;
  background: #7fb1aa;
}

.vector-a::after,
.vector-proj::after {
  position: absolute;
  top: 50%;
  right: -1px;
  width: 9px;
  height: 9px;
  content: "";
  transform: translateY(-50%) rotate(45deg);
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
}

.vector-a::after {
  color: #f0a17d;
}

.vector-proj::after {
  color: #7fb1aa;
}

.board-note {
  position: absolute;
  z-index: 1;
  bottom: 24px;
  left: 28px;
  color: rgba(248, 243, 233, 0.54);
  font-size: 12px;
}

.home-summary {
  min-height: 110px;
  padding: 22px 0;
  display: grid;
  grid-template-columns: 180px 180px minmax(0, 1fr);
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.home-summary > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.home-summary strong {
  font-family: Georgia, serif;
  font-size: 32px;
}

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

.home-summary .summary-statement {
  justify-self: end;
}

.content-section,
.home-method {
  padding-top: 72px;
}

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

.section-heading h2 {
  margin: 5px 0 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.25;
}

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

.knowledge-card {
  min-height: 286px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 16px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.knowledge-card:hover {
  transform: translateY(-3px);
  border-color: rgba(24, 53, 54, 0.22);
  box-shadow: var(--shadow);
}

.knowledge-card-main {
  flex: 1;
}

.knowledge-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.knowledge-card-meta span {
  padding: 3px 8px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 750;
}

.knowledge-card h3 {
  margin: 16px 0 9px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
  line-height: 1.42;
}

.knowledge-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.knowledge-card-foot {
  margin-top: 22px;
  padding-top: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(24, 53, 54, 0.08);
}

.learning-chip {
  padding: 3px 8px;
  color: var(--muted);
  background: #efede7;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 750;
}

.learning-chip.learning {
  color: #87512f;
  background: #f4e3d7;
}

.learning-chip.completed {
  color: #356357;
  background: #dfebe5;
}

.learning-chip.review {
  color: #944536;
  background: #f5dfda;
}

.card-time {
  color: var(--muted);
  font-size: 11px;
}

.card-arrow {
  margin-left: auto;
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
}

.card-remove {
  min-height: 32px;
  padding: 0 5px;
  color: var(--danger);
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 700;
}

.knowledge-card-foot form + .card-arrow {
  margin-left: 0;
}

.method-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.method-list article {
  min-height: 210px;
  padding: 28px 30px;
  border-right: 1px solid var(--line);
}

.method-list article:last-child {
  border-right: 0;
}

.method-list span {
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 13px;
}

.method-list h3 {
  margin: 28px 0 8px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
}

.method-list p {
  margin: 0;
  color: var(--muted);
}

.directory-head {
  padding: 64px 0 30px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.directory-head.compact {
  padding-bottom: 28px;
}

.directory-head h1 {
  margin: 7px 0 4px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(42px, 6vw, 62px);
  line-height: 1.16;
}

.directory-head p {
  margin: 0;
  color: var(--muted);
}

.result-count {
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.filter-panel {
  margin-bottom: 28px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 14px;
}

.filter-search > label,
.compact-field label,
.web-field label,
.state-form label {
  display: block;
  margin-bottom: 6px;
  color: #3d5554;
  font-size: 12px;
  font-weight: 750;
}

.filter-search > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.filter-search input,
.filter-search button,
.compact-field select,
.web-field input,
.web-field select,
.web-field textarea,
.state-form select {
  color: var(--ink);
  background: #fffefa;
  border: 1px solid var(--line);
}

.filter-search input {
  min-width: 0;
  min-height: 46px;
  padding: 0 13px;
  border-radius: 9px 0 0 9px;
}

.filter-search button {
  min-width: 76px;
  min-height: 46px;
  color: #fffaf3;
  background: var(--ink);
  border-radius: 0 9px 9px 0;
  font-weight: 750;
}

.filter-row {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
  align-items: end;
  gap: 12px;
}

.compact-field select,
.state-form select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 9px;
}

.favorite-filter {
  min-height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
}

.favorite-filter input {
  width: 17px;
  height: 17px;
}

.filter-submit {
  white-space: nowrap;
}

.directory-grid {
  padding-bottom: 20px;
}

.empty-state {
  min-height: 330px;
  padding: 48px 24px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  background: rgba(255, 253, 248, 0.58);
  border: 1px dashed #c9c5ba;
  border-radius: 16px;
}

.empty-state.small {
  min-height: 150px;
}

.empty-state h2,
.empty-state h3 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 28px;
}

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

.error-page {
  min-height: calc(100vh - 180px);
  padding: 48px 20px;
  display: grid;
  place-items: center;
  text-align: center;
}

.error-page h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 38px;
}

.error-page p {
  margin: 8px 0 20px;
  color: var(--muted);
}

.auth-shell {
  min-height: calc(100vh - 156px);
  padding: 58px 0;
  display: grid;
  place-items: center;
}

.web-auth-card {
  width: min(470px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.auth-intro h1 {
  margin: 6px 0 8px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 38px;
}

.auth-intro p {
  margin: 0;
  color: var(--muted);
}

.web-form {
  margin-top: 26px;
  display: grid;
  gap: 16px;
}

.web-field input,
.web-field select,
.web-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border-radius: 9px;
}

.web-field textarea {
  padding-top: 11px;
  resize: vertical;
  line-height: 1.65;
}

.web-field.has-error input,
.web-field.has-error textarea {
  border-color: var(--danger);
  background: #fff9f7;
}

.field-message,
.field-hint {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.field-message {
  color: var(--danger);
  font-weight: 700;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 64px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 58px;
  height: 46px;
  color: var(--teal);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 750;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.form-alert {
  margin-top: 20px;
  padding: 11px 13px;
  color: var(--danger);
  background: #f7e5df;
  border-radius: 9px;
  font-weight: 700;
}

.auth-divider {
  margin: 24px 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  content: "";
  background: var(--line);
}

.wechat-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #235a43;
  background: #e4efe6;
  border: 1px solid #c8ddcb;
  border-radius: 9px;
  font-weight: 750;
}

.wechat-mark {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: #e4efe6;
  background: #347a59;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 12px;
}

.wechat-pending {
  margin-top: 22px;
  padding: 11px 13px;
  color: var(--muted);
  background: #f1eee7;
  border-radius: 9px;
  text-align: center;
  font-size: 11px;
}

.auth-switch {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
}

.auth-switch a {
  color: var(--teal);
  font-weight: 750;
}

.profile-head {
  padding: 64px 0 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-avatar {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  color: #fffaf2;
  background: var(--teal);
  border-radius: 22px 6px 22px 6px;
  font-family: "Songti SC", serif;
  font-size: 30px;
  font-weight: 800;
}

.profile-head h1 {
  margin: 3px 0 0;
  font-family: "Songti SC", serif;
  font-size: 34px;
}

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

.profile-logout {
  margin-left: auto;
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--ink-deep);
  border-radius: 18px;
}

.profile-stat-grid a {
  min-height: 118px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
}

.profile-stat-grid a:last-child {
  border-right: 0;
}

.profile-stat-grid strong {
  color: #fffaf2;
  font-family: Georgia, serif;
  font-size: 32px;
}

.profile-stat-grid span {
  color: rgba(255, 250, 242, 0.58);
  font-size: 12px;
}

.profile-menu {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-menu a,
.profile-menu-static {
  min-height: 92px;
  padding: 19px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 13px;
}

.profile-menu span,
.profile-menu-static span,
.profile-menu strong,
.profile-menu-static strong,
.profile-menu small {
  display: block;
}

.profile-menu strong,
.profile-menu-static strong {
  font-size: 16px;
}

.profile-menu small,
.profile-menu-static small {
  margin-top: 2px;
  color: var(--muted);
}

.profile-menu b,
.profile-menu-static b {
  margin-left: auto;
  color: var(--teal);
  font-size: 12px;
}

.profile-recent {
  padding-top: 52px;
}

.wrong-filter {
  margin-bottom: 18px;
  display: flex;
  gap: 8px;
}

.wrong-filter button {
  min-height: 40px;
  padding: 0 15px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-weight: 700;
}

.wrong-filter button.active {
  color: #fffaf2;
  background: var(--ink);
  border-color: var(--ink);
}

.wrong-list {
  display: grid;
  gap: 12px;
}

.wrong-card {
  padding: 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 14px;
}

.wrong-card.is-mastered {
  background: rgba(255, 253, 248, 0.64);
}

.wrong-image {
  width: 126px;
  height: 92px;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-soft);
}

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

.wrong-body p {
  margin: 7px 0;
}

.wrong-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.wrong-status {
  padding: 2px 7px;
  color: var(--danger);
  background: #f5e1dc;
  border-radius: 5px;
  font-weight: 750;
}

.is-mastered .wrong-status {
  color: #396658;
  background: #dfebe5;
}

.wrong-knowledge {
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
}

.wrong-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.web-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(16, 41, 43, 0.3);
}

.web-dialog::backdrop {
  background: rgba(16, 41, 43, 0.62);
  backdrop-filter: blur(3px);
}

.wrong-form {
  padding: 26px;
  display: grid;
  gap: 17px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-head h2 {
  margin: 2px 0 0;
  font-family: "Songti SC", serif;
  font-size: 29px;
}

.dialog-close {
  min-width: 48px;
  min-height: 44px;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 5px;
}

.detail-page {
  padding-top: 36px;
}

.detail-hero {
  padding: 36px;
  color: #f8f3e9;
  background: var(--ink-deep);
  border-radius: 22px 5px 22px 5px;
}

.detail-path {
  color: rgba(248, 243, 233, 0.5);
  font-size: 12px;
}

.detail-hero-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 46px;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.detail-badges span {
  padding: 4px 8px;
  color: #f5b08f;
  background: rgba(240, 161, 125, 0.1);
  border: 1px solid rgba(240, 161, 125, 0.25);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 750;
}

.detail-hero h1 {
  max-width: 760px;
  margin: 14px 0 6px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(38px, 5.2vw, 62px);
  line-height: 1.2;
}

.detail-subtitle {
  margin: 0;
  color: rgba(248, 243, 233, 0.7);
  font-size: 17px;
}

.detail-summary {
  max-width: 800px;
  margin: 24px 0 0;
  color: rgba(248, 243, 233, 0.82);
  font-size: 16px;
}

.detail-actions {
  align-self: start;
  padding: 18px;
  color: var(--ink);
  background: #f8f3e9;
  border-radius: 13px;
}

.detail-actions > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.detail-actions .primary-button {
  width: 100%;
}

.favorite-button {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-weight: 750;
}

.favorite-button.active {
  color: #8e492f;
  background: #f6e4d9;
  border-color: #e9bda9;
}

.favorite-button span {
  margin-right: 6px;
  color: var(--accent);
  font-size: 18px;
}

.state-form {
  margin-top: 15px;
}

.detail-relations {
  margin-top: 28px;
  padding-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-relations div {
  display: flex;
  gap: 12px;
}

.detail-relations strong {
  flex: 0 0 auto;
  color: #f5b08f;
  font-size: 11px;
}

.detail-relations span {
  color: rgba(248, 243, 233, 0.62);
  font-size: 12px;
}

.anchor-nav {
  position: sticky;
  top: 84px;
  z-index: 25;
  margin: 18px 0 0;
  padding: 8px;
  overflow-x: auto;
  display: flex;
  gap: 3px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(14px);
  scrollbar-width: none;
}

.anchor-nav::-webkit-scrollbar {
  display: none;
}

.anchor-nav a {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.anchor-nav a:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.detail-section {
  padding: 66px 0 10px;
  scroll-margin-top: 118px;
}

.detail-section-head {
  margin-bottom: 24px;
}

.detail-section-head > span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.detail-section-head h2 {
  margin: 5px 0 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(31px, 4vw, 44px);
  line-height: 1.25;
}

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

.goal-grid article {
  min-height: 150px;
  padding: 22px;
  background: var(--surface);
  border-left: 3px solid var(--teal);
}

.goal-grid article > span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.goal-grid h3 {
  margin: 8px 0 5px;
  font-size: 18px;
}

.goal-grid p {
  margin: 0;
  color: var(--muted);
}

.projection-lab {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.projection-canvas {
  min-height: 420px;
  padding: 18px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(24, 53, 54, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 53, 54, 0.04) 1px, transparent 1px),
    #f8f5ed;
  background-size: 30px 30px;
}

.projection-canvas svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.projection-canvas text {
  fill: var(--muted);
  font-family: inherit;
  font-size: 13px;
}

.projection-axis {
  stroke: #c1c5bd;
  stroke-width: 1.5;
}

.projection-vector-b,
.projection-vector-a,
.projection-vector-result,
.projection-vector-perp {
  stroke-linecap: round;
}

.projection-vector-b {
  stroke: var(--teal);
  stroke-width: 4;
}

.projection-vector-a {
  stroke: var(--accent);
  stroke-width: 5;
}

.projection-vector-result,
.projection-vector-perp {
  stroke: #76979a;
  stroke-width: 4;
}

.projection-guide {
  stroke: #9daaa8;
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
}

.projection-angle {
  fill: none;
  stroke: #d29a76;
  stroke-width: 2;
}

.projection-controls {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 21px;
  border-left: 1px solid rgba(24, 53, 54, 0.08);
}

.lab-reading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.lab-reading span,
.lab-reading strong,
.lab-reading small {
  display: block;
}

.lab-reading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.lab-reading strong {
  margin-top: 4px;
  color: var(--teal);
  font-family: Georgia, serif;
  font-size: 39px;
  line-height: 1.1;
}

.is-negative .lab-reading strong {
  color: var(--accent);
}

.lab-reading small {
  margin-top: 4px;
  color: var(--muted);
}

.projection-controls label > span {
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.projection-controls output {
  color: var(--accent);
  font-weight: 800;
}

.projection-controls input[type="range"] {
  width: 100%;
  height: 28px;
  accent-color: var(--teal);
}

.projection-metrics {
  padding: 12px;
  display: grid;
  gap: 7px;
  background: var(--surface-soft);
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
}

.projection-metrics span {
  display: flex;
  justify-content: space-between;
}

.projection-metrics b {
  color: var(--ink);
}

.lab-note,
.visual-hint {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.visual-hint {
  padding: 13px 15px;
  background: #eee9df;
  border-radius: 9px;
}

.visual-hint strong {
  margin-right: 8px;
  color: var(--ink);
}

.concept-lab {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 16px;
}

.concept-stage {
  min-height: 330px;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #f8f5ed;
}

.concept-universe-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.concept-members {
  margin: 17px 0 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.concept-members span {
  min-width: 46px;
  min-height: 42px;
  padding: 6px 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.concept-members span.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.concept-members span.active.out {
  background: var(--accent);
  border-color: var(--accent);
}

.concept-stage > strong {
  font-family: Georgia, "Songti SC", serif;
  font-size: 29px;
}

.concept-stage > p {
  margin: 8px 0 0;
  color: var(--muted);
}

.concept-modes {
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  border-left: 1px solid var(--line);
}

.concept-modes button {
  min-height: 48px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  text-align: left;
  font-weight: 700;
}

.concept-modes button.active {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: #c8dcd4;
}

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

.formula-list article {
  min-height: 130px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 28px;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.09);
  border-radius: 12px;
}

.formula-list article > div span,
.formula-list article > div strong {
  display: block;
}

.formula-list article > div span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.formula-list article > div strong {
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 24px;
  font-weight: 600;
}

.formula-list article > p {
  margin: 0;
  color: var(--muted);
}

.formula-list article > small {
  grid-column: 2;
  margin-top: -18px;
  color: var(--danger);
}

.route-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.route-list li {
  min-height: 126px;
  padding: 24px 8px;
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.route-list li > span {
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 24px;
}

.route-list h3,
.route-list p {
  margin: 0;
}

.route-list h3 {
  font-size: 18px;
}

.route-list p {
  margin-top: 5px;
  color: var(--muted);
}

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

.mistake-list article {
  min-height: 128px;
  padding: 20px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  background: #f7e9e3;
  border: 1px solid #ebcfc4;
  border-radius: 12px;
}

.mistake-list article > span {
  align-self: start;
  padding: 3px 7px;
  color: var(--danger);
  background: #fff8f5;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
}

.mistake-list h3,
.mistake-list p {
  margin: 0;
}

.mistake-list p {
  margin-top: 5px;
  color: #765d56;
}

.practice-card {
  padding: 30px;
  color: #f8f3e9;
  background: var(--ink-deep);
  border-radius: 16px;
}

.practice-card > span {
  color: #f5a783;
  font-size: 11px;
  font-weight: 800;
}

.practice-card h3 {
  max-width: 900px;
  margin: 10px 0 17px;
  font-family: "Songti SC", serif;
  font-size: 24px;
  line-height: 1.65;
}

.practice-prompt {
  color: rgba(248, 243, 233, 0.65);
}

.practice-card details {
  margin-top: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.practice-card summary {
  min-height: 48px;
  padding: 0 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: #f5a783;
  font-weight: 750;
}

.practice-card details > div {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.practice-card > small {
  display: block;
  margin-top: 13px;
  color: rgba(248, 243, 233, 0.48);
}

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

.resource-list > a {
  min-height: 255px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid rgba(24, 53, 54, 0.1);
  border-radius: 13px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.resource-list > a:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.resource-topline {
  display: flex;
  justify-content: space-between;
  color: var(--teal);
  font-size: 10px;
  font-weight: 750;
}

.resource-list h3 {
  margin: 16px 0 4px;
  font-family: "Songti SC", serif;
  font-size: 20px;
  line-height: 1.45;
}

.resource-list p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.resource-list .resource-teacher {
  margin-top: 0;
  font-size: 11px;
}

.resource-open {
  margin-top: auto;
  padding-top: 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1040px) {
  .home-hero {
    grid-template-columns: 1fr 360px;
    gap: 36px;
  }

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

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

  .favorite-filter,
  .filter-submit {
    width: 100%;
  }

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

  .profile-stat-grid a:nth-child(3) {
    border-right: 0;
  }

  .profile-stat-grid a:nth-child(n + 4) {
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }

  .projection-lab {
    grid-template-columns: 1fr;
  }

  .projection-controls {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 800px) {
  .site-header-inner {
    min-height: 62px;
  }

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

  .site-brand small,
  .desktop-nav,
  .site-account {
    display: none;
  }

  .site-main {
    width: min(100% - 28px, var(--content));
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 4px 10px env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(255, 253, 248, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(16px);
  }

  .mobile-nav a {
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
  }

  .mobile-nav a.active {
    color: var(--accent);
  }

  .mobile-nav-icon {
    height: 24px;
    font-family: Georgia, serif;
    font-size: 20px;
    line-height: 1;
  }

  .home-hero {
    min-height: auto;
    padding: 48px 0 40px;
    grid-template-columns: 1fr;
  }

  .home-hero-copy h1 {
    font-size: clamp(44px, 14vw, 64px);
  }

  .home-hero-copy > p {
    font-size: 16px;
  }

  .home-hero-board {
    min-height: 380px;
  }

  .home-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-summary .summary-statement {
    margin-top: 12px;
    grid-column: 1 / -1;
    justify-self: start;
  }

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

  .method-list article {
    min-height: 150px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .directory-head {
    padding-top: 44px;
    align-items: flex-start;
    flex-direction: column;
  }

  .directory-head h1 {
    font-size: 46px;
  }

  .filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .filter-row .compact-field:first-child {
    grid-column: 1 / -1;
  }

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

  .profile-stat-grid a,
  .profile-stat-grid a:nth-child(3) {
    border-right: 1px solid rgba(255, 255, 255, 0.09);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }

  .profile-stat-grid a:nth-child(odd) {
    border-right: 1px solid rgba(255, 255, 255, 0.09);
  }

  .profile-stat-grid a:nth-child(even) {
    border-right: 0;
  }

  .profile-menu {
    grid-template-columns: 1fr;
  }

  .wrong-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

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

  .detail-page {
    padding-top: 18px;
  }

  .detail-hero {
    padding: 24px;
  }

  .detail-hero-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .detail-actions {
    width: 100%;
  }

  .anchor-nav {
    top: 70px;
  }

  .goal-grid,
  .mistake-list {
    grid-template-columns: 1fr;
  }

  .concept-lab {
    grid-template-columns: 1fr;
  }

  .concept-modes {
    overflow-x: auto;
    flex-direction: row;
    justify-content: flex-start;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .concept-modes button {
    min-width: max-content;
  }

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

  .formula-list article > small {
    grid-column: 1;
    margin-top: -12px;
  }
}

@media (max-width: 580px) {
  .site-main {
    width: min(100% - 22px, var(--content));
  }

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

  .knowledge-card {
    min-height: 245px;
    padding: 20px;
  }

  .hero-search {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .hero-search input,
  .hero-search button {
    border-radius: 9px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }

  .home-hero-board {
    min-height: 340px;
    padding: 22px;
  }

  .home-summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .home-summary .summary-statement {
    grid-column: auto;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .filter-row .compact-field:first-child {
    grid-column: auto;
  }

  .web-auth-card {
    padding: 26px 20px;
  }

  .profile-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .profile-logout {
    width: 100%;
    margin-left: 0;
  }

  .profile-logout button {
    width: 100%;
  }

  .profile-stat-grid a {
    min-height: 96px;
    padding: 16px;
  }

  .wrong-card {
    grid-template-columns: 1fr;
  }

  .wrong-image {
    width: 100%;
    height: 180px;
  }

  .wrong-actions {
    grid-column: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .wrong-actions form,
  .wrong-actions button {
    width: 100%;
  }

  .detail-hero {
    margin-right: -4px;
    margin-left: -4px;
    padding: 21px;
  }

  .detail-hero h1 {
    font-size: 38px;
  }

  .detail-relations {
    grid-template-columns: 1fr;
  }

  .anchor-nav {
    margin-right: -4px;
    margin-left: -4px;
  }

  .detail-section {
    padding-top: 52px;
  }

  .projection-canvas {
    min-height: 300px;
    padding: 0;
    overflow: hidden;
  }

  .projection-canvas svg {
    width: 130%;
    max-width: none;
    transform: translateX(-11%);
  }

  .projection-controls {
    padding: 20px;
  }

  .concept-stage {
    min-height: 290px;
    padding: 24px;
  }

  .formula-list article {
    padding: 20px;
  }

  .route-list li {
    grid-template-columns: 45px minmax(0, 1fr);
  }

  .practice-card {
    padding: 22px;
  }
}

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