:root {
  --paper: #eee9dc;
  --paper-light: #f7f3e9;
  --ink: #2d372f;
  --muted: #72766b;
  --sage: #4b6252;
  --sage-dark: #354b3d;
  --cinnabar: #974c3c;
  --line: rgba(66, 77, 61, 0.2);
  --soft-line: rgba(66, 77, 61, 0.11);
  --serif: "STSong", "SimSun", "Noto Serif CJK SC", serif;
  --brush: "STXingkai", "华文行楷", "STLiti", "华文隶书", "KaiTi", "STKaiti", serif;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

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

body[data-view="landing"] {
  overflow: hidden;
}

body[data-view="learning"] {
  overflow-x: hidden;
  overflow-y: auto;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 5px;
}

#learning-title:focus-visible,
#group-title:focus-visible,
.lesson-title:focus-visible {
  outline: none;
  text-decoration: underline;
  text-decoration-color: rgba(151, 76, 60, 0.3);
  text-decoration-thickness: 1px;
  text-underline-offset: 8px;
}

.answer-feedback:focus-visible {
  outline: 1px solid rgba(151, 76, 60, 0.25);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(151, 76, 60, 0.16);
}

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

.scene-backdrop {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 46% 28%, rgba(255, 253, 244, 0.8), transparent 42rem),
    var(--paper);
  pointer-events: none;
}

.paper-light {
  position: absolute;
  z-index: 5;
  inset: 0;
  background: url("/static/assets/paper-grain.svg") repeat;
  opacity: 0.19;
}

.scene-layer {
  position: absolute;
  max-width: none;
  user-select: none;
  will-change: transform;
}

.scene-far {
  inset: -3%;
  width: 106%;
  height: 106%;
  object-fit: cover;
  opacity: 0.85;
}

.scene-mid {
  bottom: -2%;
  left: -3%;
  width: 106%;
  height: 104%;
  object-fit: cover;
  opacity: 0.86;
}

.scene-near {
  bottom: -2%;
  left: -3%;
  width: 106%;
  height: 104%;
  object-fit: cover;
  opacity: 0.95;
}

.scene-mist {
  bottom: -4%;
  left: -55%;
  width: 210%;
  height: 48%;
  object-fit: cover;
  opacity: 0.8;
}

.ink-vignette {
  position: absolute;
  z-index: 4;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 43%, rgba(55, 69, 52, 0.065) 100%);
}

body[data-view="learning"] .scene-far {
  opacity: 0.6;
}

body[data-view="learning"] .scene-mid {
  opacity: 0.42;
}

body[data-view="learning"] .scene-near {
  opacity: 0.42;
}

body[data-view="learning"] .scene-mist {
  opacity: 0.55;
}

#app,
.view {
  position: relative;
  z-index: 1;
}

.landing-view {
  height: 100svh;
  min-height: 640px;
}

.landing-header {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 4vw;
}

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

.seal {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  height: 44px;
  border: 1px solid var(--cinnabar);
  border-radius: 3px;
  background: var(--cinnabar);
  box-shadow: inset 0 0 0 3px var(--cinnabar), inset 0 0 0 4px rgba(247, 243, 233, 0.66);
  color: var(--paper-light);
  font: 28px var(--brush);
  transform: rotate(-3deg);
}

.brand-name {
  margin: 0;
  font: 600 22px var(--brush);
  letter-spacing: 0.14em;
}

.brand-tagline {
  margin: 5px 0 0;
  color: var(--muted);
  font: 9px var(--serif);
  letter-spacing: 0.23em;
}

.edition {
  margin: 0;
  color: var(--muted);
  font: 11px var(--serif);
  letter-spacing: 0.16em;
}

.landing-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100svh;
  min-height: inherit;
  padding: 88px 6vw 72px;
}

.hero-orbit {
  position: relative;
  width: min(64vw, 58svh, 580px);
  min-width: 300px;
  aspect-ratio: 1;
}

.hero-orbit::before {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(113, 123, 94, 0.17), rgba(151, 133, 95, 0.07) 48%, transparent 72%);
  content: "";
}

.orbit-ring {
  position: absolute;
  border-radius: 49% 51% 47% 53%;
  pointer-events: none;
}

.ring-one {
  inset: 0;
  border: 1px solid rgba(75, 98, 82, 0.18);
  transform: rotate(-5deg);
}

.ring-two {
  inset: 3% -2% -1% 3%;
  border: 1px solid rgba(151, 76, 60, 0.09);
  border-radius: 52% 48% 53% 47%;
  transform: rotate(7deg);
}

.orbit-glyph {
  position: absolute;
  top: 50%;
  left: 50%;
  color: rgba(75, 98, 82, 0.075);
  font: min(39svh, 400px)/1 var(--brush);
  transform: translate(-50%, -50%) rotate(-8deg);
}

.hero-copy {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-kicker {
  margin: 0 0 24px;
  color: var(--cinnabar);
  font: 10px var(--serif);
  letter-spacing: 0.28em;
}

.hero-copy h1 {
  display: flex;
  gap: 0.12em;
  margin: 0;
  font: 500 clamp(50px, 7vw, 96px)/1.12 var(--brush);
  letter-spacing: 0.12em;
  transform: translateX(0.08em);
}

.hero-description {
  margin: 22px 0 0;
  color: var(--sage);
  font: 13px var(--serif);
  letter-spacing: 0.16em;
}

.vertical-note {
  position: absolute;
  top: 37%;
  color: var(--muted);
  font: 12px var(--serif);
  letter-spacing: 0.4em;
  writing-mode: vertical-rl;
}

.vertical-note::before {
  display: block;
  width: 5px;
  height: 5px;
  margin: 0 auto 15px;
  background: var(--cinnabar);
  content: "";
}

.note-left {
  left: 8%;
}

.note-right {
  right: 8%;
}

.entry-actions {
  position: relative;
  z-index: 2;
  margin-top: -12px;
  text-align: center;
}

.enter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 49px;
  padding: 13px 23px;
  border: 1px solid var(--cinnabar);
  border-radius: 1px;
  background: rgba(247, 243, 233, 0.32);
  color: var(--cinnabar);
  font: 14px var(--serif);
  letter-spacing: 0.18em;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.enter-arrow {
  font-size: 20px;
  line-height: 1;
  transition: transform 180ms ease;
}

.entry-actions p {
  margin: 13px 0 0;
  color: var(--muted);
  font: 9px var(--serif);
  letter-spacing: 0.17em;
}

.landing-footer {
  position: absolute;
  right: 4vw;
  bottom: 23px;
  left: 4vw;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font: 9px var(--serif);
  letter-spacing: 0.14em;
}

.scene-transition {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.scene-transition span {
  display: block;
  width: 20vmin;
  height: 20vmin;
  border: 1px solid rgba(75, 98, 82, 0.28);
  border-radius: 50%;
  opacity: 0;
}

.learning-view {
  min-height: 100svh;
}

.learning-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 16px 3.5vw;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 233, 220, 0.95);
}

.compact-brand {
  gap: 10px;
}

.compact-brand .seal {
  flex-basis: 34px;
  height: 34px;
  font-size: 23px;
}

.compact-brand .brand-name {
  font-size: 18px;
}

.compact-brand .brand-tagline {
  font-size: 8px;
}

.steps {
  display: flex;
  gap: 25px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.step > span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font: 12px var(--brush);
}

.step.active {
  color: var(--cinnabar);
}

.step.active > span {
  border-color: var(--cinnabar);
}

.step.complete {
  color: var(--sage);
}

.step.complete > span {
  border-color: var(--sage);
}

.learning-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8c9186;
}

.status-pill[data-mode="kimi"] {
  border-color: rgba(75, 98, 82, 0.35);
  color: var(--sage);
}

.status-pill[data-mode="kimi"] .status-dot {
  background: var(--sage);
}

.status-pill[data-mode="fallback"] {
  border-color: rgba(151, 112, 58, 0.35);
  color: #876738;
}

.status-pill[data-mode="fallback"] .status-dot {
  background: #a98549;
}

.text-button {
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
}

.learning-content {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
}

.component-scene {
  position: relative;
  min-height: calc(100svh - 100px);
  padding: 43px 0 28px;
}

.scene-heading {
  position: relative;
  z-index: 2;
  text-align: center;
}

.section-kicker {
  margin: 0 0 12px;
  color: var(--cinnabar);
  font: 9px var(--serif);
  letter-spacing: 0.27em;
}

.scene-heading h1 {
  margin: 0;
  font: 500 clamp(32px, 4vw, 52px) var(--brush);
  letter-spacing: 0.12em;
}

.scene-heading > p:last-child {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.component-orbit {
  position: relative;
  width: min(100%, 900px);
  height: min(56svh, 510px);
  min-height: 420px;
  margin: 15px auto 0;
}

.component-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 480px;
  max-width: 65%;
  aspect-ratio: 1;
  border: 1px solid rgba(75, 98, 82, 0.1);
  border-radius: 49% 51% 48% 52%;
  transform: translate(-50%, -50%) rotate(-6deg);
}

.component-guide::after {
  position: absolute;
  inset: 10px -6px -5px 7px;
  border: 1px solid rgba(75, 98, 82, 0.06);
  border-radius: 52% 48% 51% 49%;
  content: "";
}

.component-focus {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(75, 98, 82, 0.24);
  border-radius: 49% 51% 47% 53%;
  background: radial-gradient(circle, rgba(247, 243, 233, 0.78), rgba(75, 98, 82, 0.045));
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.component-focus > span {
  color: var(--sage);
  font: 72px/1 var(--brush);
}

.component-focus > small {
  margin-top: 11px;
  color: var(--muted);
  font: 10px var(--serif);
  letter-spacing: 0.14em;
}

.component-grid {
  position: absolute;
  inset: 0;
}

.component-button {
  position: absolute;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 118px;
  height: 118px;
  padding: 12px;
  border: 0;
  background: transparent;
}

.component-button:nth-child(1) { left: 3%; top: 35%; }
.component-button:nth-child(2) { left: 23%; top: 2%; }
.component-button:nth-child(3) { right: 23%; top: 2%; }
.component-button:nth-child(4) { right: 3%; top: 35%; }
.component-button:nth-child(5) { right: 23%; bottom: 1%; }
.component-button:nth-child(6) { left: 23%; bottom: 1%; }

.component-button::before {
  position: absolute;
  z-index: -1;
  inset: 4px;
  border: 1px solid rgba(75, 98, 82, 0.24);
  border-radius: 48% 52% 47% 53%;
  background: rgba(247, 243, 233, 0.36);
  content: "";
  transform: rotate(-4deg);
  transition: border-color 180ms ease, background 180ms ease, transform 200ms ease;
}

.component-button::after {
  position: absolute;
  z-index: -1;
  inset: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(75, 98, 82, 0.13), transparent 70%);
  content: "";
  opacity: 0;
  transition: opacity 180ms ease;
}

.component-character {
  color: var(--sage);
  font: 43px/1 var(--brush);
}

.component-meta {
  margin-top: 9px;
  color: var(--muted);
  font-size: 9px;
}

.component-button.selected::before {
  border-color: rgba(151, 76, 60, 0.62);
  background: rgba(151, 76, 60, 0.055);
}

.component-button.selected .component-character {
  color: var(--cinnabar);
}

.scene-status {
  min-height: 24px;
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
  text-align: center;
}

.scene-status.error {
  color: var(--cinnabar);
}

.scene-status .secondary-button {
  margin-left: 10px;
}

.character-scene {
  position: relative;
  max-width: 1060px;
  margin: 0 auto 45px;
  padding: 25px 0 10px;
  border-top: 1px solid var(--line);
}

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

.character-heading .section-kicker {
  margin-bottom: 8px;
}

.character-heading h2 {
  margin: 0;
  font: 500 32px var(--brush);
  letter-spacing: 0.1em;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  perspective: 1000px;
}

.character-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 160px;
  padding: 22px 8px 16px;
  border: 1px solid rgba(75, 98, 82, 0.18);
  border-radius: 1px;
  background: rgba(247, 243, 233, 0.72);
  box-shadow: 0 8px 22px rgba(61, 66, 46, 0.045);
  transition: border-color 160ms ease, background 160ms ease;
}

.character-button::before {
  position: absolute;
  top: 10px;
  right: 12px;
  left: 12px;
  height: 1px;
  background: var(--soft-line);
  content: "";
}

.character-button strong {
  font: 500 44px/1.25 var(--brush);
}

.character-button > span {
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
}

.demo-tag {
  margin-top: 9px;
  color: var(--cinnabar);
  font-size: 8px;
  font-style: normal;
}

.character-button.selected {
  border-color: rgba(75, 98, 82, 0.55);
  background: rgba(75, 98, 82, 0.08);
}

.scroll-invitation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 740px;
  margin: 35px auto 80px;
  padding: 29px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 12px var(--serif);
  text-align: center;
}

.scroll-invitation p {
  margin: 0;
}

.mini-seal {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  height: 28px;
  border: 1px solid rgba(151, 76, 60, 0.58);
  color: var(--cinnabar);
  font: 17px var(--brush);
  transform: rotate(2deg);
}

.lesson-region {
  position: relative;
}

.character-scene,
.lesson-scroll,
.error-card,
.answer-feedback {
  scroll-margin-top: 110px;
}

.answer-request-error {
  margin: 10px 0 0;
  color: var(--cinnabar);
  font-size: 11px;
  line-height: 1.8;
}

.lesson-scroll {
  position: relative;
  max-width: 960px;
  margin: 55px auto 85px;
  padding: 44px clamp(24px, 5vw, 66px) 38px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: rgba(247, 243, 233, 0.95) url("/static/assets/paper-grain.svg");
  box-shadow: 0 28px 80px rgba(54, 61, 43, 0.12);
  transform-origin: 50% 0;
}

.lesson-scroll::before,
.lesson-scroll::after {
  position: absolute;
  right: -14px;
  left: -14px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(0deg, #746f5b, #b0a88f 48%, #696852);
  box-shadow: 0 3px 5px rgba(54, 61, 43, 0.1);
  content: "";
}

.lesson-scroll::before {
  top: -6px;
}

.lesson-scroll::after {
  bottom: -6px;
}

.scroll-header {
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
}

.lesson-kicker {
  margin: 0 0 18px;
  color: var(--cinnabar);
  font: 9px var(--serif);
  letter-spacing: 0.2em;
}

.lesson-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.lesson-identity {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lesson-character {
  font: 500 76px/1 var(--brush);
}

.lesson-title {
  margin: 0 0 9px;
  font: 500 26px var(--brush);
  letter-spacing: 0.08em;
}

.lesson-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
}

.lesson-source {
  color: var(--muted);
  font: 9px Georgia, serif;
  white-space: nowrap;
}

.observation {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 52px);
  padding: 36px 0;
}

.glyph-column {
  min-width: 0;
  text-align: center;
}

.glyph-frame {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  height: 280px;
  padding: 20px 20px 35px;
  border: 0;
  background: radial-gradient(ellipse, rgba(255, 253, 244, 0.65), transparent 72%);
}

.glyph-frame::before {
  position: absolute;
  z-index: -1;
  inset: 8px;
  border: 1px solid rgba(75, 98, 82, 0.22);
  border-radius: 49% 51% 47% 53%;
  background: rgba(75, 98, 82, 0.035);
  content: "";
  transform: rotate(-3deg);
}

.glyph-image {
  width: auto;
  height: auto;
  max-width: 180px;
  max-height: 215px;
  object-fit: contain;
}

.zoom-hint {
  position: absolute;
  right: 0;
  bottom: 14px;
  left: 0;
  color: var(--muted);
  font-size: 9px;
}

.glyph-caption {
  margin: 12px 0 0;
  color: var(--muted);
  font: 11px var(--serif);
  letter-spacing: 0.08em;
}

.image-error {
  color: var(--muted);
  font-size: 12px;
}

.fact-list {
  margin: 0 0 20px;
}

.fact-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--soft-line);
  font-size: 12px;
  line-height: 1.85;
}

.fact-row dt {
  color: var(--muted);
}

.fact-row dd {
  margin: 0;
}

.explanation {
  padding: 18px 0;
  border-top: 1px solid rgba(75, 98, 82, 0.26);
  border-bottom: 1px solid rgba(75, 98, 82, 0.15);
}

.explanation.fallback {
  border-top-color: rgba(151, 112, 58, 0.35);
  border-bottom-color: rgba(151, 112, 58, 0.2);
}

.explanation.pending {
  border-top-style: dashed;
  border-bottom-style: dashed;
}

.explanation.pending .explanation-mode {
  color: var(--muted);
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 0;
}

.explanation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.explanation-heading h3 {
  margin: 0;
  color: var(--sage);
  font: 14px var(--serif);
  letter-spacing: 0.09em;
}

.explanation-mode {
  color: var(--sage);
  font: 9px Georgia, serif;
  letter-spacing: 0.08em;
}

.explanation-text {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 2;
  white-space: pre-line;
}

.ai-message {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.quiz-panel {
  padding: 30px 0 5px;
  border-top: 1px solid var(--line);
}

.quiz-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quiz-heading h3 {
  margin: 0;
  color: var(--cinnabar);
  font: 500 28px var(--brush);
  letter-spacing: 0.1em;
}

.quiz-type {
  color: var(--muted);
  font-size: 10px;
}

.quiz-question {
  margin: 14px 0 20px;
  font-size: 15px;
  line-height: 1.85;
}

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

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: rgba(255, 253, 245, 0.25);
  font-size: 13px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.option-letter {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  height: 28px;
  border: 1px solid rgba(115, 116, 105, 0.35);
  color: var(--muted);
  font: 11px Georgia, serif;
}

.quiz-option.correct-option {
  border-color: rgba(75, 98, 82, 0.65);
  background: rgba(75, 98, 82, 0.1);
  color: var(--sage-dark);
}

.quiz-option.correct-option .option-letter {
  border-color: var(--sage);
  background: var(--sage);
  color: var(--paper-light);
}

.quiz-option.wrong-option {
  border-color: rgba(151, 76, 60, 0.55);
  background: rgba(151, 76, 60, 0.06);
}

.answer-form {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.answer-input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: rgba(255, 253, 245, 0.34);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}

.answer-input::placeholder {
  color: var(--muted);
  opacity: 0.72;
}

.primary-button,
.secondary-button {
  padding: 11px 18px;
  border: 1px solid var(--sage);
  border-radius: 1px;
  font-size: 12px;
  letter-spacing: 0.05em;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-button {
  background: var(--sage);
  color: var(--paper-light);
}

.secondary-button {
  background: transparent;
  color: var(--sage);
}

.answer-feedback {
  margin-top: 18px;
  padding: 16px 18px;
  border-left: 2px solid;
  font-size: 13px;
  line-height: 1.85;
}

.answer-feedback p {
  margin: 6px 0 0;
}

.feedback-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.feedback-title {
  font: 14px var(--serif);
  letter-spacing: 0.05em;
}

.feedback-source {
  color: var(--muted);
  font-size: 10px;
}

.feedback-note {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.is-correct {
  border-color: var(--sage);
  background: rgba(75, 98, 82, 0.08);
  color: var(--sage-dark);
}

.is-wrong {
  border-color: var(--cinnabar);
  background: rgba(151, 76, 60, 0.055);
  color: #784536;
}

.is-review {
  border-color: #a18857;
  background: rgba(161, 136, 87, 0.07);
  color: #695d43;
}

.reference-answer {
  margin-top: 10px !important;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.feedback-retry {
  display: block;
  margin-top: 8px;
  font-size: 11px;
}

.lesson-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 28px;
}

.loading-scroll {
  padding: 45px 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 10px;
  vertical-align: middle;
}

.loading-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cinnabar);
  animation: pulse 1s infinite ease-in-out;
}

.loading-dots i:nth-child(2) { animation-delay: 140ms; }
.loading-dots i:nth-child(3) { animation-delay: 280ms; }

.error-card {
  padding: 23px;
  border-left: 2px solid var(--cinnabar);
  background: rgba(151, 76, 60, 0.05);
  font-size: 13px;
  line-height: 1.8;
}

.error-card p {
  margin: 0 0 13px;
}

.learning-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  width: min(1240px, calc(100% - 64px));
  margin: 30px auto 0;
  padding: 18px 0 25px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
}

.glyph-dialog {
  width: min(680px, calc(100% - 36px));
  max-height: 88svh;
  padding: 29px;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: var(--paper-light) url("/static/assets/paper-grain.svg");
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(35, 42, 33, 0.25);
  text-align: center;
}

.glyph-dialog::backdrop {
  background: rgba(37, 43, 35, 0.64);
}

.dialog-kicker {
  margin: 0 0 10px;
  color: var(--cinnabar);
  font: 9px var(--serif);
  letter-spacing: 0.3em;
}

.glyph-dialog #dialog-caption {
  margin: 0 25px 18px;
  color: var(--muted);
  font-size: 12px;
}

.glyph-dialog img {
  max-width: 100%;
  max-height: 66svh;
  object-fit: contain;
}

.dialog-close {
  position: absolute;
  top: 9px;
  right: 11px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
}

noscript {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 20px;
  padding: 15px;
  border: 1px solid var(--cinnabar);
  background: var(--paper-light);
}

@media (hover: hover) and (pointer: fine) {
  .enter-button:hover {
    background: var(--cinnabar);
    color: var(--paper-light);
    transform: translateY(-2px);
  }

  .enter-button:hover .enter-arrow {
    transform: translateX(4px);
  }

  .text-button:hover {
    border-bottom-color: var(--cinnabar);
    color: var(--cinnabar);
  }

  .component-button:hover::before {
    border-color: rgba(151, 76, 60, 0.52);
    transform: rotate(2deg);
  }

  .component-button:hover::after {
    opacity: 1;
  }

  .component-button:hover .component-character,
  .character-button:hover strong {
    color: var(--cinnabar);
    animation: glyph-bounce 480ms cubic-bezier(0.28, 0.72, 0.35, 1);
  }

  .character-button:hover {
    border-color: rgba(151, 76, 60, 0.48);
    background: rgba(247, 243, 233, 0.9);
  }

  .glyph-frame:hover::before {
    border-color: rgba(75, 98, 82, 0.5);
  }

  .quiz-option:not(:disabled):hover {
    border-color: rgba(151, 76, 60, 0.5);
    background: rgba(151, 76, 60, 0.045);
  }

  .primary-button:not(:disabled):hover,
  .secondary-button:not(:disabled):hover {
    transform: translateY(-1px);
  }

  .primary-button:not(:disabled):hover {
    background: var(--sage-dark);
  }

  .secondary-button:not(:disabled):hover {
    background: rgba(75, 98, 82, 0.08);
  }

  .dialog-close:hover {
    color: var(--cinnabar);
  }
}

@keyframes glyph-bounce {
  0%, 100% { transform: translateY(0) rotate(0); }
  38% { transform: translateY(-8px) rotate(-3deg); }
  68% { transform: translateY(2px) rotate(1deg); }
}

@keyframes pulse {
  0%, 70%, 100% { opacity: 0.25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 1100px) {
  .learning-header {
    grid-template-columns: auto 1fr;
  }

  .learning-header .steps {
    justify-self: center;
  }

  .learning-actions .status-pill {
    display: none;
  }

  .learning-actions {
    grid-column: 1 / -1;
    position: absolute;
    right: 3.5vw;
  }

  .component-orbit {
    max-width: 780px;
  }

  .component-button {
    width: 105px;
    height: 105px;
  }

  .component-focus {
    width: 160px;
    height: 160px;
  }

  .component-focus > span {
    font-size: 64px;
  }

  .observation {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 30px;
  }
}

@media (max-width: 900px) {
  .vertical-note {
    display: none;
  }

  .learning-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 20px;
  }

  .learning-header .steps {
    order: 3;
    justify-content: center;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid var(--soft-line);
  }

  .learning-actions {
    position: static;
    margin-left: auto;
  }

  .component-orbit {
    height: 500px;
    min-height: 0;
  }

  .component-button:nth-child(1) { left: 0; }
  .component-button:nth-child(4) { right: 0; }
  .component-button:nth-child(2) { left: 20%; }
  .component-button:nth-child(3) { right: 20%; }
  .component-button:nth-child(5) { right: 20%; }
  .component-button:nth-child(6) { left: 20%; }

  .character-grid {
    gap: 10px;
  }

  .character-button {
    min-height: 145px;
  }

  .observation {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 24px;
  }

  .glyph-frame {
    height: 245px;
  }

  .glyph-image {
    max-width: 140px;
    max-height: 180px;
  }
}

@media (max-width: 760px) {
  body[data-view="landing"] {
    overflow: auto;
  }

  .landing-header {
    padding: 22px 20px;
  }

  .edition {
    display: none;
  }

  .landing-stage {
    padding: 90px 20px 75px;
  }

  .hero-orbit {
    width: min(87vw, 52svh, 450px);
    min-width: 0;
  }

  .hero-kicker {
    margin-bottom: 18px;
    font-size: 8px;
  }

  .hero-copy h1 {
    font-size: clamp(46px, 12vw, 72px);
    letter-spacing: 0.1em;
  }

  .hero-description {
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .entry-actions {
    margin-top: -5px;
  }

  .landing-footer {
    right: 20px;
    bottom: 18px;
    left: 20px;
    font-size: 8px;
  }

  .learning-header .steps {
    gap: 18px;
    font-size: 10px;
  }

  .learning-content {
    width: calc(100% - 32px);
  }

  .component-scene {
    min-height: 0;
    padding: 30px 0 20px;
  }

  .scene-heading h1 {
    font-size: 34px;
  }

  .scene-heading > p:last-child {
    font-size: 11px;
  }

  .component-orbit {
    display: flex;
    flex-direction: column;
    height: auto;
    margin-top: 25px;
  }

  .component-guide {
    display: none;
  }

  .component-focus {
    position: relative;
    top: auto;
    left: auto;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    transform: none;
  }

  .component-focus > span {
    font-size: 52px;
  }

  .component-focus > small {
    font-size: 9px;
  }

  .component-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
  }

  .component-button,
  .component-button:nth-child(n) {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1;
  }

  .component-character {
    font-size: 36px;
  }

  .component-meta {
    margin-top: 6px;
    font-size: 8px;
  }

  .scene-status {
    margin-top: 18px;
  }

  .character-scene {
    margin-bottom: 30px;
    padding-top: 20px;
  }

  .character-heading h2 {
    font-size: 27px;
  }

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

  .character-button {
    min-height: 135px;
    padding: 18px 6px 14px;
  }

  .character-button strong {
    font-size: 36px;
  }

  .lesson-scroll {
    margin: 35px auto 60px;
    padding: 30px 22px 28px;
  }

  .lesson-scroll::before,
  .lesson-scroll::after {
    right: -7px;
    left: -7px;
    height: 8px;
  }

  .lesson-character {
    font-size: 62px;
  }

  .lesson-title {
    font-size: 22px;
  }

  .observation {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 22px;
    padding: 28px 0;
  }

  .glyph-frame {
    height: 230px;
  }

  .glyph-image {
    max-width: 130px;
    max-height: 170px;
  }

  .fact-row {
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 8px;
    font-size: 11px;
  }

  .explanation-text {
    font-size: 12px;
  }

  .learning-footer {
    flex-direction: column;
    align-items: center;
    width: calc(100% - 32px);
    text-align: center;
  }
}

@media (max-width: 480px) {
  .seal {
    flex-basis: 38px;
    height: 38px;
    font-size: 24px;
  }

  .brand-name {
    font-size: 19px;
  }

  .brand-tagline {
    font-size: 8px;
  }

  .hero-orbit {
    width: min(87vw, 48svh, 360px);
  }

  .hero-kicker {
    font-size: 7px;
    letter-spacing: 0.21em;
  }

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

  .hero-description {
    font-size: 10px;
  }

  .enter-button {
    min-height: 45px;
    padding: 11px 18px;
    font-size: 12px;
  }

  .entry-actions p,
  .landing-footer {
    font-size: 8px;
  }

  .learning-header {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 12px;
  }

  .compact-brand .brand-name {
    font-size: 17px;
  }

  .learning-header .steps {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
    gap: 8px;
  }

  .compact-brand {
    grid-column: 1;
    grid-row: 1;
  }

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

  .character-scene,
  .lesson-scroll,
  .error-card,
  .answer-feedback {
    scroll-margin-top: 130px;
  }

  .learning-actions .text-button {
    font-size: 10px;
  }

  .learning-content {
    width: calc(100% - 24px);
  }

  .scene-heading h1 {
    font-size: 29px;
  }

  .section-kicker {
    font-size: 8px;
  }

  .scene-heading > p:last-child {
    font-size: 10px;
  }

  .component-focus {
    width: 110px;
    height: 110px;
  }

  .component-grid {
    gap: 8px;
  }

  .component-button::before {
    inset: 2px;
  }

  .component-character {
    font-size: 32px;
  }

  .component-meta {
    font-size: 7px;
  }

  .character-heading h2 {
    font-size: 25px;
  }

  .character-heading .text-button {
    font-size: 10px;
  }

  .character-grid {
    gap: 8px;
  }

  .character-button {
    min-height: 120px;
  }

  .character-button strong {
    font-size: 34px;
  }

  .character-button > span {
    font-size: 9px;
  }

  .demo-tag {
    font-size: 7px;
  }

  .lesson-scroll {
    padding: 26px 16px 24px;
  }

  .lesson-title-row {
    align-items: flex-start;
    gap: 10px;
  }

  .lesson-identity {
    gap: 12px;
  }

  .lesson-character {
    font-size: 54px;
  }

  .lesson-title {
    font-size: 20px;
  }

  .lesson-source,
  .lesson-tags {
    font-size: 8px;
  }

  .observation {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px 0;
  }

  .glyph-column {
    width: 100%;
    max-width: 230px;
    margin: 0 auto;
  }

  .glyph-frame {
    height: 220px;
  }

  .glyph-image {
    max-width: 145px;
    max-height: 170px;
  }

  .fact-row {
    grid-template-columns: 64px minmax(0, 1fr);
    font-size: 12px;
  }

  .quiz-question {
    font-size: 14px;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

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

  .answer-input {
    min-height: 48px;
  }

  .answer-feedback {
    font-size: 12px;
  }

  .lesson-actions {
    flex-wrap: wrap;
  }

  .primary-button,
  .secondary-button {
    padding: 10px 14px;
    font-size: 11px;
  }

  .glyph-dialog {
    padding: 22px;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  body[data-view="landing"] {
    overflow: auto;
  }

  .landing-header {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .landing-stage {
    padding-top: 70px;
    padding-bottom: 60px;
  }

  .hero-orbit {
    width: min(55vw, 52svh, 450px);
  }

  .hero-kicker {
    margin-bottom: 14px;
  }

  .hero-copy h1 {
    font-size: clamp(50px, 6.5vw, 82px);
  }

  .hero-description {
    margin-top: 14px;
  }

  .enter-button {
    min-height: 42px;
    padding: 10px 18px;
  }

  .entry-actions p {
    margin-top: 8px;
  }

  .landing-footer {
    bottom: 12px;
  }
}

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

  .scene-layer {
    will-change: auto;
  }
}
