:root {
  --ink: #101417;
  --ink-soft: #182025;
  --paper: #f3f0e7;
  --paper-soft: #e8e5dc;
  --line: rgba(243, 240, 231, 0.18);
  --ink-line: rgba(16, 20, 23, 0.16);
  --muted: #aab4b2;
  --ink-muted: #586566;
  --acid: #d3f36b;
  --coral: #ef886f;
  --cyan: #7fe4d3;
  --white: #ffffff;
  --shadow: 8px 8px 0 rgba(16, 20, 23, 0.15);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--paper);
  background: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: var(--ink); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { border: 0; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; background: var(--ink); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 22px;
  align-items: center;
  min-height: 72px;
  padding: 12px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 20, 23, 0.96);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; min-width: 0; align-items: center; gap: 12px; }
.brand-mark { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; border: 1px solid var(--acid); color: var(--acid); box-shadow: 4px 4px 0 var(--coral); }
.brand-mark .lucide { width: 20px; height: 20px; }
.brand strong, .brand small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand strong { color: var(--paper); font-size: 14px; letter-spacing: 0.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-family: Consolas, monospace; font-size: 10px; letter-spacing: 0.08em; }
.nav { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: 0 0 auto; padding: 9px 11px; color: var(--muted); font-size: 12px; white-space: nowrap; transition: color 180ms ease, background 180ms ease; }
.nav a:hover, .nav a.active { color: var(--ink); background: var(--acid); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.record-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: Consolas, monospace; font-size: 10px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(127, 228, 211, 0.12); }
.icon-button { display: inline-grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); background: transparent; color: var(--paper); transition: background 180ms ease, color 180ms ease, transform 180ms ease; }
.icon-button:hover { color: var(--ink); background: var(--acid); transform: translateY(-2px); }
.icon-button .lucide { width: 16px; height: 16px; }

.hero { position: relative; overflow: hidden; padding: 74px 5vw 0; border-bottom: 1px solid var(--line); background-color: var(--ink); background-image: repeating-linear-gradient(90deg, transparent 0 119px, rgba(243, 240, 231, 0.055) 120px 121px), repeating-linear-gradient(0deg, transparent 0 119px, rgba(243, 240, 231, 0.04) 120px 121px); }
.hero::before { position: absolute; top: 82px; left: 18px; color: var(--coral); content: "INDEX / 01"; font-family: Consolas, monospace; font-size: 10px; writing-mode: vertical-rl; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 0.94fr) minmax(420px, 0.86fr); gap: 7vw; max-width: 1400px; margin: 0 auto; align-items: center; }
.hero-copy { position: relative; z-index: 1; max-width: 700px; padding-bottom: 70px; }
.eyebrow { margin: 0 0 15px; color: var(--acid); font-family: Consolas, "Courier New", monospace; font-size: 11px; letter-spacing: 0.08em; }
.hero h1 { max-width: 700px; margin: 0; color: var(--paper); font-family: "Arial Narrow", "Microsoft YaHei", sans-serif; font-size: 88px; font-weight: 900; letter-spacing: -0.04em; line-height: 0.95; }
.hero h1 em { color: var(--acid); font-style: normal; }
.hero-lede { max-width: 570px; margin: 30px 0 0; color: var(--muted); font-size: 16px; line-height: 1.9; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 28px; }
.button { display: inline-flex; min-height: 44px; align-items: center; gap: 9px; padding: 0 15px; border: 1px solid var(--line); font-size: 12px; transition: transform 180ms ease, color 180ms ease, background 180ms ease, border-color 180ms ease; }
.button:hover { transform: translateY(-3px); }
.button .lucide { width: 16px; height: 16px; }
.button.primary { background: var(--acid); border-color: var(--acid); color: var(--ink); }
.button.secondary { background: transparent; border-color: var(--coral); color: var(--paper); }
.button.secondary:hover { background: var(--coral); color: var(--ink); }
.hero-note { display: flex; max-width: 560px; gap: 8px; align-items: flex-start; margin-top: 28px; color: var(--ink-muted); font-family: Consolas, monospace; font-size: 10px; line-height: 1.7; }
.hero-note .lucide { flex: 0 0 auto; width: 14px; height: 14px; color: var(--coral); }
.hero-stage { position: relative; min-height: 520px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #141b20; box-shadow: var(--shadow); }
#waveCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-label { position: absolute; left: 24px; color: var(--muted); font-family: Consolas, monospace; font-size: 10px; letter-spacing: 0.08em; }
.stage-label-top { top: 24px; }
.stage-symbol { position: absolute; top: 50%; left: 50%; color: var(--paper); font-family: Georgia, serif; font-size: 170px; line-height: 0.8; transform: translate(-50%, -56%); text-shadow: 4px 4px 0 var(--coral); }
.stage-caption { position: absolute; right: 24px; bottom: 24px; left: 24px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 14px; }
.stage-caption span { color: var(--acid); font-family: Consolas, monospace; font-size: 10px; }
.stage-caption strong { color: var(--paper); font-size: 13px; font-weight: 500; }
.stage-play { position: absolute; top: 24px; right: 24px; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--acid); background: var(--acid); color: var(--ink); }
.stage-play .lucide { width: 17px; height: 17px; }
.hero-rail { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 1400px; margin: 0 auto; border-top: 1px solid var(--line); }
.hero-rail div { min-height: 94px; padding: 18px 0 18px 22px; border-right: 1px solid var(--line); }
.hero-rail div:first-child { padding-left: 0; }
.hero-rail div:last-child { border-right: 0; }
.hero-rail span, .hero-rail strong { display: block; }
.hero-rail span { color: var(--muted); font-family: Consolas, monospace; font-size: 10px; }
.hero-rail strong { margin-top: 8px; color: var(--paper); font-size: 28px; font-weight: 500; }

.atlas-section, .practice-section, .review-section { padding: 96px 5vw; }
.atlas-section { background: var(--paper); color: var(--ink); }
.section-heading { display: flex; max-width: 1400px; margin: 0 auto 40px; justify-content: space-between; gap: 40px; align-items: flex-end; }
.section-heading .eyebrow { color: #668b80; }
.section-heading h2 { margin: 0; font-size: 52px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.section-heading > p { max-width: 430px; margin: 0; color: var(--ink-muted); font-size: 14px; line-height: 1.7; }
.atlas-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; max-width: 1400px; margin: 0 auto; align-items: start; }
.atlas-main { min-width: 0; }
.toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 22px; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.filter { min-height: 34px; padding: 0 10px; border: 1px solid var(--ink-line); background: transparent; color: var(--ink-muted); font-size: 11px; }
.filter span { margin-left: 5px; font-family: Consolas, monospace; font-size: 10px; }
.filter.active, .filter:hover { background: var(--ink); color: var(--paper); }
.search-field { display: flex; width: 215px; min-height: 36px; gap: 7px; align-items: center; border-bottom: 1px solid var(--ink); color: var(--ink-muted); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-field input::placeholder { color: #879391; }
.search-field .lucide { width: 15px; height: 15px; }
.symbol-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.symbol-card { position: relative; display: flex; min-height: 154px; flex-direction: column; justify-content: space-between; padding: 16px; border: 1px solid var(--ink-line); background: rgba(255, 255, 255, 0.38); color: var(--ink); text-align: left; transition: color 180ms ease, background 180ms ease, transform 180ms ease, border-color 180ms ease; }
.symbol-card:hover, .symbol-card.active { border-color: var(--ink); background: var(--ink); color: var(--paper); transform: translateY(-4px); }
.symbol-card.mastered::after { position: absolute; top: 12px; right: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); content: ""; }
.symbol-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.symbol { font-family: Georgia, serif; font-size: 42px; line-height: 0.9; }
.symbol-group { color: var(--ink-muted); font-family: Consolas, monospace; font-size: 9px; }
.symbol-card:hover .symbol-group, .symbol-card.active .symbol-group { color: var(--muted); }
.symbol-word { font-size: 13px; font-weight: 700; }
.symbol-word small { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 10px; font-weight: 400; }
.symbol-card:hover .symbol-word small, .symbol-card.active .symbol-word small { color: var(--muted); }
.symbol-card-foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 12px; color: var(--ink-muted); font-family: Consolas, monospace; font-size: 10px; }
.symbol-card:hover .symbol-card-foot, .symbol-card.active .symbol-card-foot { color: var(--muted); }
.play-mini { display: inline-flex; gap: 4px; align-items: center; color: inherit; background: transparent; font-size: 10px; }
.play-mini .lucide { width: 13px; height: 13px; }
.detail-panel { position: sticky; top: 96px; min-height: 500px; padding: 26px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow); }
.detail-panel .eyebrow { color: var(--acid); }
.detail-panel h3 { margin: 5px 0 0; font-family: Georgia, serif; font-size: 76px; font-weight: 400; line-height: 0.85; }
.detail-word { margin: 19px 0 0; color: var(--acid); font-family: Consolas, monospace; font-size: 15px; }
.detail-word span { display: block; margin-top: 5px; color: var(--muted); font-family: inherit; font-size: 10px; }
.detail-block { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.detail-block h4 { margin: 0 0 7px; color: var(--coral); font-family: Consolas, monospace; font-size: 10px; letter-spacing: 0.08em; }
.detail-block p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.detail-meta div { padding: 11px; border: 1px solid var(--line); }
.detail-meta span, .detail-meta strong { display: block; }
.detail-meta span { color: var(--muted); font-family: Consolas, monospace; font-size: 9px; }
.detail-meta strong { margin-top: 5px; font-size: 12px; font-weight: 500; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 22px; }
.detail-actions button { display: inline-flex; min-height: 38px; gap: 7px; align-items: center; padding: 0 10px; border: 1px solid var(--acid); background: var(--acid); color: var(--ink); font-size: 11px; }
.detail-actions button.secondary { border-color: var(--line); background: transparent; color: var(--paper); }
.detail-actions button.secondary:hover { border-color: var(--coral); background: var(--coral); color: var(--ink); }
.detail-actions .lucide { width: 14px; height: 14px; }

.practice-section { background: #171e22; }
.compact-heading { color: var(--paper); }
.compact-heading h2 { color: var(--paper); }
.compact-heading > p { color: var(--muted); }
.practice-shell { max-width: 1000px; margin: 0 auto; border: 1px solid var(--line); background: var(--ink-soft); box-shadow: var(--shadow); }
.practice-top { display: flex; min-height: 58px; justify-content: space-between; gap: 16px; align-items: center; border-bottom: 1px solid var(--line); padding: 0 22px; }
.practice-top span { color: var(--muted); font-family: Consolas, monospace; font-size: 10px; }
.practice-progress { width: 170px; height: 5px; background: #303a3e; }
.practice-progress i { display: block; width: 0; height: 100%; background: var(--acid); transition: width 220ms ease; }
.question-stage { padding: 38px; }
.question-stage .eyebrow { color: var(--coral); }
.question-stage h3 { max-width: 760px; margin: 0; color: var(--paper); font-size: 25px; line-height: 1.45; }
.question-hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 28px; }
.answer-option { display: flex; min-height: 62px; gap: 11px; align-items: center; border: 1px solid var(--line); padding: 12px 14px; background: transparent; color: var(--paper); text-align: left; font-size: 13px; line-height: 1.45; }
.answer-option:hover, .answer-option.selected { border-color: var(--acid); background: rgba(211, 243, 107, 0.08); }
.answer-option.correct { border-color: var(--cyan); background: rgba(127, 228, 211, 0.12); }
.answer-option.wrong { border-color: var(--coral); background: rgba(239, 136, 111, 0.12); }
.answer-letter { display: grid; flex: 0 0 24px; width: 24px; height: 24px; place-items: center; border: 1px solid currentColor; color: var(--acid); font-family: Consolas, monospace; font-size: 10px; }
.question-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 25px; }
.feedback { min-height: 20px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.feedback.good { color: var(--cyan); }
.feedback.bad { color: var(--coral); }
.practice-button { display: inline-flex; min-height: 40px; gap: 7px; align-items: center; padding: 0 13px; background: var(--acid); color: var(--ink); font-size: 11px; }
.practice-button:disabled { cursor: not-allowed; opacity: 0.45; }
.practice-button .lucide { width: 15px; height: 15px; }
.result-panel { padding: 44px; text-align: center; }
.result-panel .score { color: var(--acid); font-family: Georgia, serif; font-size: 86px; line-height: 0.9; }
.result-panel h3 { margin: 15px 0 7px; font-size: 23px; }
.result-panel p { margin: 0 auto; max-width: 440px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.result-actions { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }

.review-section { background: var(--paper); color: var(--ink); }
.review-section .section-heading .eyebrow { color: #668b80; }
.review-section .section-heading h2 { color: var(--ink); }
.review-section .section-heading > p { color: var(--ink-muted); }
.review-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 1400px; margin: 0 auto; }
.review-card { display: flex; min-height: 170px; flex-direction: column; justify-content: space-between; border: 1px solid var(--ink-line); padding: 17px; background: rgba(255,255,255,0.36); }
.review-card .review-symbol { color: var(--ink); font-family: Georgia, serif; font-size: 42px; }
.review-card strong { font-size: 14px; }
.review-card p { margin: 5px 0 0; color: var(--ink-muted); font-size: 11px; }
.review-card button { display: inline-flex; width: fit-content; min-height: 33px; gap: 6px; align-items: center; border: 1px solid var(--ink); padding: 0 9px; background: transparent; color: var(--ink); font-size: 10px; }
.review-card button:hover { background: var(--ink); color: var(--paper); }
.review-card .lucide { width: 13px; height: 13px; }
.empty-review { grid-column: 1 / -1; padding: 46px; border: 1px dashed var(--ink-line); color: var(--ink-muted); text-align: center; }
.empty-review .lucide { width: 26px; height: 26px; margin-bottom: 12px; }

.footer { display: flex; min-height: 76px; justify-content: space-between; gap: 20px; align-items: center; padding: 20px 5vw; border-top: 1px solid var(--line); color: var(--muted); font-family: Consolas, monospace; font-size: 10px; }
.footer a:first-child { color: var(--acid); }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 30; display: grid; gap: 8px; }
.toast { max-width: 300px; border: 1px solid var(--acid); padding: 12px 14px; background: var(--ink); color: var(--paper); font-size: 12px; box-shadow: var(--shadow); animation: toast-in 180ms ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1080px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(340px, 0.75fr); gap: 42px; }
  .hero h1 { font-size: 72px; }
  .symbol-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .hero { padding: 58px 24px 0; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { padding-bottom: 20px; }
  .hero-stage { min-height: 390px; }
  .atlas-section, .practice-section, .review-section { padding: 72px 24px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 18px; }
  .atlas-layout { grid-template-columns: 1fr; }
  .detail-panel { position: relative; top: auto; min-height: auto; }
  .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body { min-width: 0; }
  .topbar { gap: 10px; padding: 10px 14px; }
  .brand strong { font-size: 12px; }
  .record-status { display: none; }
  .hero { padding-right: 16px; padding-left: 16px; }
  .hero::before { display: none; }
  .hero h1 { font-size: 54px; }
  .hero-lede { font-size: 14px; }
  .hero-stage { min-height: 330px; }
  .stage-symbol { font-size: 120px; }
  .hero-rail { grid-template-columns: repeat(2, 1fr); }
  .hero-rail div, .hero-rail div:first-child { padding: 15px; }
  .hero-rail div:nth-child(2) { border-right: 0; }
  .hero-rail strong { font-size: 24px; }
  .atlas-section, .practice-section, .review-section { padding: 58px 16px; }
  .section-heading h2 { font-size: 42px; }
  .toolbar { display: block; }
  .search-field { width: 100%; margin-top: 14px; }
  .symbol-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .symbol-card { min-height: 136px; padding: 12px; }
  .symbol { font-size: 36px; }
  .symbol-word { font-size: 12px; }
  .practice-top { padding: 0 14px; }
  .practice-progress { width: 110px; }
  .question-stage { padding: 26px 16px; }
  .question-stage h3 { font-size: 20px; }
  .answer-grid { grid-template-columns: 1fr; }
  .question-footer { align-items: flex-start; flex-direction: column; }
  .result-panel { padding: 34px 18px; }
  .result-panel .score { font-size: 70px; }
  .review-grid { grid-template-columns: 1fr; }
  .footer { align-items: flex-start; flex-direction: column; padding: 24px 16px; }
}

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