:root {
  --ink: #241f19;
  --ink-soft: #443e35;
  --muted: #7b7164;
  --faint: #a79d8f;
  --paper: #f3eee4;
  --paper-deep: #ebe3d5;
  --surface: #fffdf8;
  --surface-warm: #faf6ed;
  --line: #ded4c3;
  --line-soft: #ece5d9;
  --cinnabar: #b13b2d;
  --cinnabar-deep: #8f2e23;
  --cinnabar-soft: #f4e4df;
  --jade: #2e695a;
  --jade-soft: #e2eee8;
  --gold: #a87d3d;
  --gold-soft: #f2e7d3;
  --shadow: 0 18px 50px rgba(62, 48, 31, 0.07);
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 87% 8%, rgba(177, 59, 45, 0.06), transparent 22rem),
    linear-gradient(115deg, rgba(255, 255, 255, 0.38), transparent 35%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(79, 65, 45, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 65, 45, 0.018) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
  pointer-events: none;
}

body.lang-en h1,
body.lang-en h2,
body.lang-en .plan-name,
body.lang-en .case-card-body strong,
body.lang-en .library-item h3,
body.lang-en .glossary-card h3 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(177, 59, 45, 0.55);
  outline-offset: 3px;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 88px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  align-items: center;
  padding: 22px 10px 18px;
  background: #27231d;
  color: rgba(255, 253, 248, 0.62);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--surface);
  text-decoration: none;
}

.brand-seal {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px 8px 8px 2px;
  background: var(--cinnabar);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  color: #fff9ed;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
}

.brand-name {
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.25em;
}

.primary-nav {
  display: flex;
  width: 100%;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 11px 3px;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font-size: 11px;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

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

.nav-item.is-active {
  background: rgba(255, 253, 248, 0.1);
  color: #fff9ed;
}

.nav-item.is-active::before {
  position: absolute;
  left: -10px;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--cinnabar);
  content: "";
}

.nav-icon svg {
  width: 21px;
  height: 21px;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.mini-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: rgba(255, 253, 248, 0.46);
  font-size: 10px;
}

.mini-progress-ring {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #27231d 55%, transparent 57%),
    conic-gradient(var(--gold) 0 68%, rgba(255, 255, 255, 0.12) 68%);
  color: #f9f0e2;
  font-size: 9px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff9ed;
  font-family: var(--serif);
}

.main-shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 15;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px clamp(20px, 3vw, 48px);
  border-bottom: 1px solid rgba(222, 212, 195, 0.78);
  background: rgba(243, 238, 228, 0.88);
  backdrop-filter: blur(18px);
}

.mobile-brand {
  display: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb strong {
  color: var(--ink);
  font-weight: 600;
}

.breadcrumb-separator {
  color: #c3b8a8;
}

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

.quick-search {
  position: relative;
  display: flex;
  width: clamp(200px, 22vw, 300px);
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.7);
  transition:
    border 180ms ease,
    background 180ms ease;
}

.quick-search:focus-within {
  border-color: #b9a78f;
  background: var(--surface);
}

.quick-search svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.quick-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.quick-search input::placeholder {
  color: var(--faint);
}

.quick-search kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 9px;
  white-space: nowrap;
}

.language-toggle {
  display: inline-flex;
  height: 34px;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.62);
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.language-toggle .language-active {
  color: var(--cinnabar-deep);
}

.language-toggle:hover {
  border-color: #c8b69e;
  background: var(--surface);
}

.quota-pill {
  display: inline-flex;
  height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #d8c7ae;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #745225;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.quota-pill:hover {
  border-color: #c6a873;
  background: #f4e5c8;
}

.quota-pill svg {
  width: 14px;
  height: 14px;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  overflow: hidden;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgba(56, 44, 28, 0.14);
}

.search-result-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.search-result-item:hover {
  background: var(--surface-warm);
}

.search-result-item strong {
  font-size: 13px;
  font-weight: 600;
}

.search-result-item span {
  color: var(--muted);
  font-size: 11px;
}

.search-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

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

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

.button-primary {
  background: var(--cinnabar);
  box-shadow: 0 6px 16px rgba(143, 46, 35, 0.15);
  color: #fffaf2;
}

.button-primary:hover {
  background: var(--cinnabar-deep);
  box-shadow: 0 8px 22px rgba(143, 46, 35, 0.2);
}

.button-soft {
  border-color: transparent;
  background: var(--cinnabar-soft);
  color: var(--cinnabar-deep);
}

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

.button-ghost:hover {
  background: var(--surface-warm);
}

.button-small {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 10px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  background: transparent;
  color: var(--cinnabar-deep);
  font-size: 12px;
  font-weight: 600;
}

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

.main-content {
  width: min(100%, 1460px);
  margin: 0 auto;
  padding: 38px clamp(20px, 3vw, 48px) 32px;
}

.view-panel {
  animation: fade-up 300ms ease both;
}

.view-panel[hidden] {
  display: none;
}

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

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}

.promo-hero {
  position: relative;
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
  overflow: hidden;
  padding: 30px 34px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 92% 12%, rgba(177, 59, 45, 0.34), transparent 18rem),
    radial-gradient(circle at 65% 100%, rgba(168, 125, 61, 0.16), transparent 17rem),
    #29251f;
  box-shadow: 0 20px 50px rgba(35, 27, 18, 0.14);
  color: #fffdf8;
}

.promo-copy {
  position: relative;
  z-index: 1;
  max-width: 810px;
}

.promo-kicker {
  display: block;
  margin-bottom: 11px;
  color: #dfb676;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.promo-copy h2 {
  margin-bottom: 10px;
  color: #fffdf8;
  font-size: clamp(27px, 3vw, 39px);
  line-height: 1.35;
  letter-spacing: 0.025em;
}

.promo-copy > .promo-proof {
  margin-bottom: 7px;
  color: #fff4df;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.promo-copy > .promo-subcopy {
  max-width: 680px;
  margin-bottom: 14px;
  color: rgba(255, 253, 248, 0.65);
  font-size: 11px;
}

.promo-points {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.promo-points span {
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #f0dfc7;
  font-size: 8px;
}

.promo-actions {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 170px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.promo-primary {
  background: var(--cinnabar);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  color: #fff;
}

.promo-primary:hover {
  background: #c94a39;
}

.promo-secondary {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #fff5e5;
}

.promo-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.promo-seal {
  position: absolute;
  right: 26px;
  bottom: -25px;
  color: rgba(255, 255, 255, 0.035);
  font-family: var(--serif);
  font-size: 180px;
  line-height: 1;
  pointer-events: none;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--cinnabar-deep);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.eyebrow-line {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--cinnabar);
}

.demo-badge,
.status-pill {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #7d5a24;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 14px;
}

.title-line h1,
.compact-heading h1 {
  margin-bottom: 6px;
  font-size: clamp(30px, 3vw, 43px);
  line-height: 1.2;
}

.title-line h1 span {
  color: var(--cinnabar-deep);
  font-feature-settings: "tnum";
}

.case-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid #c8dcd3;
  border-radius: 999px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 10px;
  font-weight: 600;
}

.case-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--jade);
}

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

.heading-meta {
  display: flex;
  align-items: center;
  gap: 15px;
  padding-top: 12px;
}

.case-stamp {
  position: relative;
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border: 1px solid rgba(177, 59, 45, 0.22);
  background: rgba(255, 253, 248, 0.48);
  color: var(--cinnabar-deep);
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.03em;
}

.case-stamp::after {
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(177, 59, 45, 0.28);
  content: "";
}

.heading-meta > div:last-child {
  display: flex;
  flex-direction: column;
}

.heading-meta span {
  color: var(--faint);
  font-size: 9px;
}

.heading-meta strong {
  font-size: 11px;
  font-weight: 600;
}

.workspace-grid {
  display: grid;
  align-items: stretch;
  gap: 18px;
  grid-template-columns: minmax(0, 1.1fr) minmax(390px, 0.9fr);
}

.workspace-grid > * {
  min-width: 0;
}

.card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 12px;
}

.card-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.card-head h2,
.analysis-intro h2,
.section-head h2,
.path-card h2,
.review-card h2 {
  margin-bottom: 0;
  font-size: 21px;
}

.card-head h2 small {
  margin-left: 8px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-warm);
}

.segmented button {
  padding: 5px 11px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.segmented button.is-active {
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(52, 41, 26, 0.07);
  color: var(--ink);
  font-weight: 600;
}

.chart-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 0 24px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
}

.chart-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.dot.cinnabar {
  background: var(--cinnabar);
}

.dot.jade {
  background: var(--jade);
}

.dot.gold {
  background: var(--gold);
}

.chart-sample {
  margin-left: auto;
  color: var(--faint);
}

.chart-view {
  padding: 13px 24px 14px;
}

.chart-legend,
.hex-line {
  display: grid;
  align-items: center;
  grid-template-columns: 45px 80px minmax(82px, 1fr) 77px 40px;
}

.chart-legend {
  padding: 0 8px 8px;
  color: var(--faint);
  font-size: 9px;
}

.chart-legend span:nth-child(3) {
  text-align: center;
}

.hexagram-lines {
  border-top: 1px solid var(--line-soft);
}

.hex-line {
  position: relative;
  width: 100%;
  min-height: 50px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  transition:
    background 140ms ease,
    box-shadow 140ms ease;
}

.hex-line:last-child {
  border-bottom: 0;
}

.hex-line:hover,
.hex-line.is-selected {
  background: var(--surface-warm);
}

.hex-line.is-selected {
  box-shadow: inset 3px 0 0 var(--cinnabar);
}

.line-spirit {
  color: var(--muted);
  font-size: 10px;
}

.line-relative {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.line-relative strong {
  font-weight: 600;
}

.line-relative em {
  color: var(--faint);
  font-style: normal;
  font-size: 9px;
}

.line-glyph {
  display: flex;
  width: 100%;
  max-width: 115px;
  height: 13px;
  align-items: center;
  justify-self: center;
  gap: 11px;
}

.line-glyph span {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--ink-soft);
}

.line-glyph.is-yang span {
  width: 100%;
}

.line-glyph.is-yin span {
  width: calc(50% - 5.5px);
}

.line-glyph.is-changing span {
  background: var(--cinnabar);
}

.line-ganzhi {
  color: var(--ink-soft);
  font-size: 10px;
}

.line-role {
  display: flex;
  justify-content: flex-end;
}

.line-role b {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 10px;
  font-weight: 600;
}

.line-role b.shi {
  background: var(--jade-soft);
  color: var(--jade);
}

.line-role b.ying {
  background: var(--gold-soft);
  color: #7b5925;
}

.line-role b.moving {
  background: var(--cinnabar-soft);
  color: var(--cinnabar-deep);
}

.chart-view[hidden],
.table-view[hidden] {
  display: none;
}

.table-view {
  padding: 14px 24px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
}

table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 10px;
  text-align: left;
}

th,
td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}

th {
  background: var(--surface-warm);
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-note {
  margin: 9px 0 0;
  color: var(--faint);
  font-size: 9px;
}

.line-detail {
  display: flex;
  width: calc(100% - 48px);
  align-items: center;
  gap: 11px;
  margin: 0 24px 16px;
  padding: 10px 12px;
  border: 1px solid #e2d4c1;
  border-radius: 9px;
  background: #faf3e7;
  text-align: left;
}

.line-detail:hover {
  border-color: #d4bda1;
  background: #f8efe1;
}

.line-detail-mark {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: var(--cinnabar);
  color: #fff;
  font-family: var(--serif);
  font-size: 13px;
}

.line-detail > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.line-detail strong {
  font-size: 11px;
  font-weight: 600;
}

.line-detail small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-detail > svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px 17px;
  border-top: 1px solid var(--line-soft);
}

.reading-note {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 9px;
}

.seal-mini {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(177, 59, 45, 0.35);
  color: var(--cinnabar-deep);
  font-family: var(--serif);
  font-size: 11px;
}

.reading-note p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.reading-note strong {
  color: var(--ink-soft);
}

.analysis-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.analysis-tabs {
  display: flex;
  gap: 25px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line-soft);
}

.analysis-tab {
  position: relative;
  padding: 18px 1px 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.analysis-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  content: "";
}

.analysis-tab.is-active {
  color: var(--ink);
  font-weight: 600;
}

.analysis-tab.is-active::after {
  background: var(--cinnabar);
}

.analysis-body {
  flex: 1;
  padding: 20px 24px 14px;
}

.analysis-pane[hidden] {
  display: none;
}

.analysis-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.step-counter {
  padding-top: 8px;
  color: var(--faint);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.step-list {
  position: relative;
}

.step-list::before {
  position: absolute;
  top: 26px;
  bottom: 24px;
  left: 14px;
  width: 1px;
  background: var(--line);
  content: "";
}

.reason-step {
  position: relative;
  border-bottom: 1px solid var(--line-soft);
}

.reason-step:last-child {
  border-bottom: 0;
}

.step-head {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  background: transparent;
  text-align: left;
}

.step-index {
  position: relative;
  z-index: 1;
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}

.reason-step.is-open .step-index {
  border-color: var(--cinnabar);
  background: var(--cinnabar);
  color: #fff;
}

.reason-step.is-learned:not(.is-open) .step-index {
  border-color: var(--jade);
  background: var(--jade-soft);
  color: var(--jade);
}

.step-head > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.step-head strong {
  font-size: 12px;
  font-weight: 600;
}

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

.step-icon {
  position: relative;
  width: 13px;
  height: 13px;
  margin-top: 5px;
  flex: 0 0 auto;
}

.step-icon::before,
.step-icon::after {
  position: absolute;
  top: 6px;
  left: 2px;
  width: 9px;
  height: 1px;
  background: var(--muted);
  content: "";
  transition: transform 180ms ease;
}

.step-icon::after {
  transform: rotate(90deg);
}

.reason-step.is-open .step-icon::after {
  transform: rotate(0);
}

.step-content {
  display: none;
  padding: 0 25px 15px 41px;
}

.reason-step.is-open .step-content {
  display: block;
  animation: reveal-step 200ms ease both;
}

@keyframes reveal-step {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-content > p {
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.75;
}

.free-limit-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 0 9px 41px;
  padding: 10px 11px;
  border: 1px solid #dcc8af;
  border-radius: 9px;
  background:
    linear-gradient(110deg, rgba(255, 253, 248, 0.88), rgba(242, 231, 211, 0.62)),
    var(--surface-warm);
}

.free-limit-icon {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: #2d2922;
  color: #fff7e9;
  font-family: var(--serif);
  font-size: 12px;
}

.free-limit-banner > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.free-limit-banner strong {
  font-size: 10px;
  font-weight: 600;
}

.free-limit-banner small {
  color: var(--muted);
  font-size: 8px;
}

.free-limit-banner button {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--cinnabar);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
}

.step-lock-label {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--gold-soft);
  color: #805c27;
  font-family: var(--sans);
  font-size: 7px;
  font-weight: 600;
  vertical-align: 2px;
}

.reason-step.is-access-locked .step-head {
  opacity: 0.76;
}

.reason-step.is-access-locked .step-icon {
  width: 15px;
  height: 15px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.reason-step.is-access-locked .step-icon::before,
.reason-step.is-access-locked .step-icon::after {
  display: none;
}

.reason-step.is-access-locked .step-icon {
  background:
    linear-gradient(var(--muted), var(--muted)) center 5px / 7px 1px no-repeat,
    linear-gradient(var(--muted), var(--muted)) center 9px / 7px 1px no-repeat;
}

body.has-full-access .free-limit-banner {
  display: none;
}

body.has-full-access .step-lock-label {
  display: none;
}

body.has-full-access .reason-step.is-access-locked .step-head {
  opacity: 1;
}

body.has-full-access .reason-step.is-access-locked .step-icon {
  width: 13px;
  height: 13px;
  border: 0;
  background: none;
}

body.has-full-access .reason-step.is-access-locked .step-icon::before,
body.has-full-access .reason-step.is-access-locked .step-icon::after {
  display: block;
}

.term-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.term-row > span {
  margin-right: 2px;
  color: var(--faint);
  font-size: 9px;
}

.term-row button,
.term-chips button,
.review-words button {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--cinnabar-deep);
  font-size: 9px;
}

.term-row button:hover,
.term-chips button:hover,
.review-words button:hover {
  border-color: #cfad9d;
  background: var(--cinnabar-soft);
}

.info-callout,
.quiet-alert {
  padding: 9px 11px;
  border-left: 2px solid var(--gold);
  background: #fbf4e7;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.65;
}

.info-callout span {
  display: block;
  color: #765428;
  font-weight: 600;
}

.note-sheet {
  padding: 17px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background:
    linear-gradient(90deg, transparent 27px, rgba(177, 59, 45, 0.09) 28px, transparent 29px),
    repeating-linear-gradient(
      var(--surface),
      var(--surface) 30px,
      var(--line-soft) 31px
    );
}

.note-sheet > p {
  font-size: 11px;
  line-height: 1.8;
}

.note-label {
  color: var(--cinnabar-deep);
  font-size: 9px !important;
  font-weight: 600;
}

.note-grid {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  grid-template-columns: repeat(3, 1fr);
}

.note-grid div {
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 248, 0.82);
}

.note-grid span {
  color: var(--faint);
  font-size: 8px;
}

.note-grid strong {
  font-size: 9px;
  font-weight: 500;
}

.quiet-alert {
  margin-top: 13px;
}

.quiet-alert strong {
  display: block;
  color: var(--ink-soft);
}

.quiet-alert p {
  margin: 2px 0 0;
}

.saved-state {
  padding-top: 8px;
  color: var(--jade);
  font-size: 9px;
}

.note-editor {
  width: 100%;
  min-height: 205px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background:
    repeating-linear-gradient(
      var(--surface),
      var(--surface) 30px,
      var(--line-soft) 31px
    );
  font-size: 12px;
  line-height: 31px;
}

.note-editor:focus {
  border-color: #c5ad94;
}

.note-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.note-prompts button {
  padding: 4px 9px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
}

.term-dock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-warm);
}

.term-dock > div:first-child {
  display: flex;
  flex-direction: column;
}

.term-dock-title {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.term-dock > div:first-child span:last-child {
  color: var(--faint);
  font-size: 8px;
}

.term-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.recent-section {
  margin-top: 30px;
}

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

.section-head h2 {
  font-size: 20px;
}

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

.case-card {
  position: relative;
  display: flex;
  min-height: 104px;
  align-items: stretch;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 253, 248, 0.68);
  text-align: left;
  transition:
    border 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.case-card:hover {
  transform: translateY(-2px);
  border-color: #cbb79e;
  background: var(--surface);
}

.case-card.is-selected {
  border-color: rgba(177, 59, 45, 0.38);
  background: var(--surface);
}

.case-card-id {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--cinnabar-deep);
  font-family: var(--serif);
  font-size: 12px;
}

.case-card.is-selected .case-card-id {
  border-color: var(--cinnabar);
  background: var(--cinnabar);
  color: #fff;
}

.case-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.case-card-body strong {
  overflow: hidden;
  margin-top: 2px;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-card-body p {
  display: -webkit-box;
  margin: 4px 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.case-card-tags {
  display: flex;
  gap: 5px;
  margin-top: auto;
}

.case-card-tags span {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-warm);
  color: var(--faint);
  font-size: 8px;
}

.case-card-arrow {
  position: absolute;
  top: 13px;
  right: 12px;
  width: 13px;
  height: 13px;
  color: var(--faint);
}

.compact-heading {
  align-items: center;
}

.compact-heading > div:first-child {
  max-width: 720px;
}

.progress-orbit {
  display: flex;
  width: 78px;
  height: 78px;
  align-items: baseline;
  justify-content: center;
  padding-top: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--paper) 61%, transparent 63%),
    conic-gradient(var(--cinnabar) 0 68%, var(--line) 68%);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 24px;
}

.progress-orbit small {
  font-family: var(--sans);
  font-size: 9px;
}

.study-grid {
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
}

.challenge-card {
  min-height: 470px;
  padding: 28px;
  background:
    radial-gradient(circle at 100% 0, rgba(177, 59, 45, 0.08), transparent 18rem),
    var(--surface);
}

.challenge-top {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 9px;
}

.challenge-tag {
  color: var(--cinnabar-deep);
  font-weight: 600;
}

.challenge-card h2 {
  max-width: 680px;
  margin: 37px 0 12px;
  font-size: clamp(26px, 3vw, 35px);
  line-height: 1.45;
}

.challenge-card > p {
  max-width: 650px;
  color: var(--muted);
  font-size: 13px;
}

.prompt-list {
  display: grid;
  gap: 8px;
  max-width: 630px;
  margin: 25px 0;
  padding: 0;
  list-style: none;
}

.prompt-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(250, 246, 237, 0.62);
  color: var(--ink-soft);
  font-size: 11px;
}

.prompt-list span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--cinnabar-soft);
  color: var(--cinnabar-deep);
  font-size: 8px;
}

.challenge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.answer-box {
  max-width: 700px;
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 3px solid var(--jade);
  background: var(--jade-soft);
  animation: reveal-step 240ms ease both;
}

.answer-box span {
  color: var(--jade);
  font-size: 9px;
  font-weight: 700;
}

.answer-box p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.8;
}

.study-side {
  display: grid;
  gap: 18px;
}

.path-card,
.review-card {
  padding: 22px;
}

.path-list {
  display: grid;
  gap: 8px;
  margin-top: 17px;
}

.path-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.path-item.is-current {
  border-color: #d8c1aa;
  background: var(--surface-warm);
}

.path-check {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 9px;
}

.path-item.is-done .path-check {
  border-color: var(--jade);
  background: var(--jade);
  color: #fff;
}

.path-item.is-current .path-check {
  border-color: var(--cinnabar);
  color: var(--cinnabar-deep);
}

.path-item > span:last-child {
  display: flex;
  flex-direction: column;
}

.path-item strong {
  font-size: 11px;
  font-weight: 600;
}

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

.review-card {
  background: #29251f;
  color: #fffdf8;
}

.review-card .card-kicker {
  color: rgba(255, 255, 255, 0.44);
}

.review-card h2 {
  font-size: 18px;
}

.review-words {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 17px 0;
}

.review-words button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #f6ddc1;
}

.review-card .text-button {
  color: #f2c991;
}

.membership-hero {
  display: grid;
  align-items: stretch;
  gap: 22px;
  padding: 26px;
  background:
    radial-gradient(circle at 3% 0, rgba(177, 59, 45, 0.08), transparent 18rem),
    linear-gradient(115deg, var(--surface), #fbf4e8);
  grid-template-columns: minmax(0, 1fr) minmax(255px, 0.36fr);
}

.membership-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.membership-copy h2 {
  margin: 4px 0 8px;
  font-size: clamp(25px, 3vw, 34px);
}

.membership-copy > p {
  max-width: 670px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12px;
}

.membership-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.membership-points span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 10px;
}

.membership-points i {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 8px;
  font-style: normal;
}

.usage-card {
  position: relative;
  display: flex;
  min-height: 210px;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 22px;
  border-radius: 12px;
  background: #29251f;
  color: #fffdf8;
}

.usage-card::after {
  position: absolute;
  right: -25px;
  bottom: -42px;
  width: 130px;
  height: 130px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 18px rgba(255, 255, 255, 0.025),
    0 0 0 38px rgba(255, 255, 255, 0.018);
  content: "";
}

.usage-label {
  color: rgba(255, 255, 255, 0.46);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.usage-card > strong {
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}

.usage-number {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 9px 0 15px;
}

.usage-number b {
  color: #f1c995;
  font-family: var(--serif);
  font-size: 43px;
  font-weight: 500;
  line-height: 1;
}

.usage-number span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 9px;
}

.usage-card .button {
  position: relative;
  z-index: 1;
  align-self: flex-start;
}

.usage-unlock-link {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: #f2c991;
}

.usage-card small {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 8px;
}

.pricing-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 30px 0 13px;
}

.pricing-heading h2 {
  margin: 0;
  font-size: 22px;
}

.pricing-heading > span {
  color: var(--faint);
  font-size: 9px;
}

.price-grid {
  display: grid;
  align-items: stretch;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.plan-card {
  position: relative;
  display: flex;
  min-height: 365px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.8);
}

.plan-card.is-featured {
  border-color: rgba(177, 59, 45, 0.52);
  background:
    linear-gradient(180deg, rgba(177, 59, 45, 0.065), transparent 42%),
    var(--surface);
  box-shadow: 0 16px 38px rgba(117, 72, 42, 0.09);
}

.recommended-ribbon {
  position: absolute;
  top: -1px;
  right: 17px;
  padding: 3px 9px 4px;
  border-radius: 0 0 6px 6px;
  background: var(--cinnabar);
  color: #fff;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.plan-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.plan-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.plan-badge {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-warm);
  color: var(--faint);
  font-size: 7px;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin: 17px 0 5px;
}

.plan-price > span {
  color: var(--cinnabar-deep);
  font-size: 12px;
}

.plan-price strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}

.plan-price small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 8px;
}

.plan-card > p {
  min-height: 44px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 9px;
}

.plan-features {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  padding: 13px 0 0;
  border-top: 1px solid var(--line-soft);
  list-style: none;
}

.plan-features li {
  position: relative;
  padding-left: 14px;
  color: var(--ink-soft);
  font-size: 9px;
}

.plan-features li::before {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--jade);
  content: "✓";
  font-weight: 700;
}

.plan-card .button {
  width: 100%;
  margin-top: auto;
}

.teacher-plan {
  background:
    linear-gradient(145deg, rgba(46, 105, 90, 0.055), transparent 45%),
    rgba(255, 253, 248, 0.82);
}

.membership-detail-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  grid-template-columns: 1fr 1fr;
}

.unlock-detail-card,
.invite-card {
  padding: 22px;
}

.unlock-detail-card h2,
.invite-card h2 {
  margin-bottom: 15px;
  font-size: 21px;
}

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

.unlock-list > div {
  display: grid;
  align-items: center;
  gap: 2px 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  grid-template-columns: 27px 1fr;
}

.unlock-list > div:last-child {
  border-bottom: 0;
}

.unlock-list span {
  grid-row: 1 / 3;
  color: var(--cinnabar-deep);
  font-family: var(--serif);
  font-size: 14px;
}

.unlock-list strong {
  font-size: 10px;
}

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

.invite-card {
  background:
    radial-gradient(circle at 100% 100%, rgba(168, 125, 61, 0.12), transparent 15rem),
    var(--surface);
}

.invite-card > p {
  color: var(--muted);
  font-size: 9px;
}

.invite-code-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 17px 0;
  padding: 10px 12px;
  border: 1px dashed #d3b990;
  border-radius: 8px;
  background: var(--surface-warm);
}

.invite-code-row > span {
  color: var(--faint);
  font-size: 8px;
}

.invite-code-row strong {
  flex: 1;
  color: var(--cinnabar-deep);
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.08em;
}

.invite-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
}

.invite-stats > div {
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: 7px;
  background: var(--surface-warm);
}

.invite-stats strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
}

.invite-stats span {
  color: var(--faint);
  font-size: 7px;
}

.commerce-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 2px solid var(--gold);
  background: rgba(250, 246, 237, 0.72);
  color: var(--muted);
  font-size: 9px;
}

.commerce-note strong {
  flex: 0 0 auto;
  color: var(--ink-soft);
}

.glossary-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 150px minmax(0, 1fr);
}

.glossary-filters {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.glossary-filters button {
  padding: 9px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}

.glossary-filters button:hover {
  background: rgba(255, 253, 248, 0.6);
}

.glossary-filters button.is-active {
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(60, 47, 31, 0.06);
  color: var(--cinnabar-deep);
  font-weight: 600;
}

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

.glossary-card {
  display: flex;
  min-height: 170px;
  flex-direction: column;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 253, 248, 0.74);
  text-align: left;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.glossary-card:hover {
  transform: translateY(-2px);
  background: var(--surface);
}

.glossary-card > span {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-warm);
  color: var(--faint);
  font-size: 8px;
}

.glossary-card h3 {
  margin: 16px 0 7px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}

.glossary-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.glossary-card .glossary-more {
  margin-top: auto;
  padding-top: 13px;
  color: var(--cinnabar-deep);
  font-size: 9px;
  font-weight: 600;
}

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.library-toolbar label {
  display: flex;
  width: min(100%, 360px);
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.72);
}

.library-toolbar svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.library-toolbar input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.library-toolbar > span {
  color: var(--muted);
  font-size: 10px;
}

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

.library-item {
  position: relative;
  min-height: 180px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.8);
  text-align: left;
  transition:
    transform 160ms ease,
    border 160ms ease;
}

.library-item:hover {
  transform: translateY(-2px);
  border-color: #c9b499;
}

.library-item-id {
  color: var(--cinnabar-deep);
  font-family: var(--serif);
  font-size: 19px;
}

.library-item h3 {
  margin: 13px 0 5px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.library-item p {
  color: var(--muted);
  font-size: 10px;
}

.library-item-foot {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 8px;
}

.library-item-foot span:last-child {
  color: var(--cinnabar-deep);
}

.library-load-more {
  grid-column: 1 / -1;
  min-height: 74px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.42);
  color: var(--cinnabar-deep);
  font-size: 11px;
  font-weight: 600;
}

.library-load-more:hover {
  border-color: #c6a98e;
  background: var(--surface);
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 3vw, 48px) 24px;
  border-top: 1px solid rgba(222, 212, 195, 0.65);
  color: var(--faint);
  font-size: 9px;
}

.app-footer p {
  margin: 0;
}

.modal {
  width: min(92vw, 680px);
  max-height: 88vh;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(38, 30, 20, 0.25);
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(31, 27, 22, 0.52);
  backdrop-filter: blur(3px);
}

.modal form,
.term-dialog-body {
  padding: 26px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal-head h2 {
  margin-bottom: 3px;
  font-size: 27px;
}

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

.icon-button {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  background: var(--surface-warm);
}

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

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  grid-template-columns: 1fr 1fr;
}

.casting-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 20px 0 9px;
}

.casting-lines-head > div {
  display: flex;
  flex-direction: column;
}

.casting-lines-head strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

.line-input-grid {
  display: grid;
  gap: 7px;
}

.line-input-row {
  display: grid;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-warm);
  grid-template-columns: 45px minmax(150px, 1fr) auto;
}

.line-input-label {
  color: var(--muted);
  font-size: 10px;
}

.line-type-switch {
  display: flex;
  gap: 5px;
}

.line-type-switch label,
.moving-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 9px;
  cursor: pointer;
}

.line-type-switch input,
.moving-check input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--cinnabar);
}

.moving-check {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.analysis-source-text {
  margin: 7px 0 12px;
  white-space: pre-wrap;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.8;
}

.analysis-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0;
}

.analysis-source-meta span {
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 8px;
}

.analysis-source-empty {
  padding: 17px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-full {
  grid-column: 1 / -1;
}

.field > span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: var(--surface);
  font-size: 12px;
}

.field textarea {
  min-height: 82px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #bca78f;
}

.modal-note {
  margin-top: 14px;
  padding: 9px 11px;
  border-left: 2px solid var(--gold);
  background: var(--surface-warm);
  color: var(--muted);
  font-size: 9px;
}

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

.term-modal {
  width: min(92vw, 500px);
}

.paywall-modal {
  width: min(94vw, 640px);
}

.paywall-modal-body {
  padding: 25px;
}

.paywall-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 19px 0;
}

.paywall-benefits span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 8px;
  font-weight: 600;
}

.wechat-contact-box {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid #c8dcd3;
  border-radius: 10px;
  background:
    radial-gradient(circle at 100% 0, rgba(46, 105, 90, 0.12), transparent 12rem),
    var(--jade-soft);
  grid-template-columns: 36px minmax(0, 1fr) auto;
}

.wechat-contact-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: #168b4f;
  color: #fff;
  font-family: var(--serif);
  font-size: 16px;
}

.wechat-contact-box > div {
  display: flex;
  flex-direction: column;
}

.wechat-contact-box small {
  color: var(--jade);
  font-size: 8px;
}

.wechat-contact-box strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.05em;
}

.wechat-steps {
  display: grid;
  gap: 7px;
  margin: 17px 0;
}

.wechat-steps > div {
  display: grid;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface-warm);
  grid-template-columns: 22px minmax(0, 1fr);
}

.wechat-steps span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--jade);
  color: #fff;
  font-size: 8px;
}

.wechat-steps p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.55;
}

.paywall-plans {
  display: grid;
  gap: 7px;
}

.paywall-plan {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  grid-template-columns: 16px minmax(0, 1fr) auto;
}

.paywall-plan:has(input:checked) {
  border-color: rgba(177, 59, 45, 0.48);
  background: rgba(244, 228, 223, 0.32);
}

.paywall-plan input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--cinnabar);
}

.paywall-plan > span {
  display: flex;
  flex-direction: column;
}

.paywall-plan strong {
  font-size: 10px;
  font-weight: 600;
}

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

.paywall-plan b {
  color: var(--cinnabar-deep);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.payment-methods {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.payment-methods > span {
  color: var(--faint);
  font-size: 8px;
}

.payment-methods > div {
  display: flex;
  gap: 6px;
}

.payment-method {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
}

.payment-method.is-active {
  border-color: #d3bda4;
  background: var(--surface-warm);
  color: var(--ink-soft);
}

.payment-dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.payment-dot.wechat {
  background: #1aad19;
}

.payment-dot.alipay {
  background: #1677ff;
}

.paywall-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
  padding: 12px 13px;
  border-radius: 8px;
  background: #29251f;
  color: #fffdf8;
}

.paywall-summary span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 8px;
}

.paywall-summary strong {
  color: #f1c995;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
}

.demo-payment-note {
  margin-top: 9px;
  color: var(--faint);
  font-size: 8px;
  text-align: center;
}

.paywall-actions {
  flex-wrap: wrap;
  margin-top: 15px;
}

.unlock-modal {
  width: min(92vw, 520px);
}

.unlock-modal form {
  padding: 25px;
}

.unlock-field {
  margin-top: 20px;
}

.unlock-field input {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.unlock-error {
  min-height: 20px;
  margin: 7px 0 0;
  color: var(--cinnabar-deep);
  font-size: 9px;
}

.term-modal .modal-head,
.term-modal .modal-actions {
  margin: 0;
  padding: 23px 25px 0;
}

.term-dialog-body {
  padding-top: 16px;
}

.term-dialog-body > p {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.85;
}

.term-example {
  padding: 13px;
  border-left: 2px solid var(--cinnabar);
  background: var(--surface-warm);
}

.term-example span {
  color: var(--cinnabar-deep);
  font-size: 9px;
  font-weight: 600;
}

.term-example p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.term-modal .modal-actions {
  padding-bottom: 23px;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 26px;
  left: 50%;
  padding: 9px 16px;
  border-radius: 8px;
  background: #29251f;
  box-shadow: 0 12px 30px rgba(31, 25, 18, 0.22);
  color: #fffdf8;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) minmax(350px, 0.9fr);
  }

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

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

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: 100%;
    height: auto;
    padding: 7px max(10px, env(safe-area-inset-right))
      max(7px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar > .brand,
  .sidebar-foot {
    display: none;
  }

  .primary-nav {
    flex-direction: row;
    justify-content: space-around;
    gap: 3px;
  }

  .nav-item {
    max-width: none;
    flex: 1;
    padding: 5px;
    border-radius: 9px;
    font-size: 9px;
  }

  .nav-item.is-active::before {
    top: -7px;
    right: 18px;
    left: 18px;
    width: auto;
    height: 2px;
    border-radius: 0 0 2px 2px;
  }

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

  .main-shell {
    padding-bottom: 64px;
  }

  .topbar {
    min-height: 64px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    font-family: var(--serif);
    font-size: 15px;
  }

  .mobile-brand .brand-seal {
    width: 30px;
    height: 30px;
    border-radius: 6px 6px 6px 2px;
    font-size: 18px;
  }

  .breadcrumb {
    display: none;
  }

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

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

  .study-side {
    grid-template-columns: 1fr 1fr;
  }

  .membership-hero {
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 270px;
  }

  .case-strip {
    grid-template-columns: 1fr 1fr;
  }

  .case-strip .case-card:last-child {
    display: none;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .topbar {
    gap: 10px;
  }

  .quick-search {
    width: 40px;
    padding: 0 10px;
    border: 0;
    background: transparent;
  }

  .quick-search input,
  .quick-search kbd {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .button {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 11px;
  }

  .main-content {
    padding: 24px 14px;
  }

  .page-heading {
    margin-bottom: 21px;
  }

  .promo-hero {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 22px;
    padding: 24px 21px;
  }

  .promo-copy h2 {
    font-size: 27px;
  }

  .promo-actions {
    width: 100%;
    min-width: 0;
  }

  .promo-actions .button {
    width: 100%;
  }

  .promo-seal {
    right: -18px;
    bottom: -28px;
    font-size: 130px;
  }

  .title-line {
    flex-wrap: wrap;
    gap: 8px;
  }

  .title-line h1,
  .compact-heading h1 {
    font-size: 31px;
  }

  .heading-meta {
    display: none;
  }

  .page-heading p {
    font-size: 12px;
  }

  .card-head {
    padding: 17px 16px 10px;
  }

  .chart-meta {
    gap: 9px;
    padding: 0 16px 12px;
  }

  .chart-meta span:nth-child(3) {
    display: none;
  }

  .chart-view {
    padding: 11px 12px 12px;
  }

  .chart-legend,
  .hex-line {
    grid-template-columns: 37px 66px minmax(72px, 1fr) 65px 32px;
  }

  .chart-legend {
    padding-right: 6px;
    padding-left: 6px;
  }

  .hex-line {
    padding-right: 6px;
    padding-left: 6px;
  }

  .line-glyph {
    gap: 8px;
  }

  .line-glyph.is-yin span {
    width: calc(50% - 4px);
  }

  .line-detail {
    width: calc(100% - 32px);
    margin: 0 16px 13px;
  }

  .chart-foot {
    padding: 12px 16px;
  }

  .chart-foot .text-button {
    display: none;
  }

  .analysis-tabs {
    gap: 20px;
    padding: 0 16px;
  }

  .analysis-body {
    padding: 17px 16px 12px;
  }

  .step-content {
    padding-right: 10px;
    padding-left: 41px;
  }

  .term-dock {
    align-items: flex-start;
    padding: 11px 16px;
  }

  .term-dock > div:first-child span:last-child {
    display: none;
  }

  .section-head h2 {
    font-size: 18px;
  }

  .case-strip {
    display: flex;
    margin-right: -14px;
    padding-right: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .case-strip::-webkit-scrollbar {
    display: none;
  }

  .case-card,
  .case-strip .case-card:last-child {
    display: flex;
    width: min(84vw, 340px);
    flex: 0 0 min(84vw, 340px);
    scroll-snap-align: start;
  }

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

  .challenge-card h2 {
    margin-top: 26px;
    font-size: 25px;
  }

  .study-side {
    grid-template-columns: 1fr;
  }

  .membership-hero {
    padding: 20px;
    grid-template-columns: 1fr;
  }

  .usage-card {
    min-height: 190px;
  }

  .pricing-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

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

  .plan-card {
    min-height: 0;
  }

  .plan-card > p {
    min-height: 0;
  }

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

  .commerce-note {
    flex-direction: column;
    gap: 3px;
  }

  .free-limit-banner {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-left: 0;
  }

  .free-limit-banner button {
    margin-left: 37px;
  }

  .payment-methods {
    align-items: flex-start;
    flex-direction: column;
  }

  .wechat-contact-box {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .wechat-contact-box .button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .glossary-layout {
    grid-template-columns: 1fr;
  }

  .glossary-filters {
    flex-direction: row;
    overflow-x: auto;
  }

  .glossary-filters button {
    flex: 0 0 auto;
  }

  .glossary-grid,
  .library-grid {
    grid-template-columns: 1fr;
  }

  .library-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .library-toolbar label {
    width: 100%;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 14px 24px;
  }

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

  .field-full {
    grid-column: auto;
  }

  .line-input-row {
    gap: 7px;
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .moving-check {
    grid-column: 2;
    justify-self: start;
  }

  .modal form,
  .term-dialog-body,
  .paywall-modal-body {
    padding: 20px;
  }
}

@media (max-width: 420px) {
  .topbar-actions .button-primary {
    width: 36px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
    white-space: nowrap;
  }

  .topbar-actions .button-primary svg {
    width: 17px;
    height: 17px;
  }

  .language-toggle {
    height: 34px;
    padding: 0 6px;
  }

  .quota-pill {
    width: 35px;
    height: 35px;
    justify-content: center;
    padding: 0;
  }

  .quota-pill span {
    display: none;
  }

  .chart-legend,
  .hex-line {
    grid-template-columns: 34px 61px minmax(66px, 1fr) 58px 28px;
  }

  .paywall-plan {
    gap: 7px;
    padding: 9px;
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .paywall-plan b {
    grid-column: 2;
  }
}

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