:root {
  --ink: #173f5f;
  --ink-2: #2e5f7f;
  --paper: #fffdf8;
  --canvas: #eef5f4;
  --sun: #f2b84b;
  --sun-soft: #fff0c7;
  --leaf: #2f7d68;
  --leaf-soft: #dff2e9;
  --coral: #e56f58;
  --sky: #dbeef7;
  --line: #d4e0df;
  --muted: #657987;
  --shadow: 0 12px 35px rgba(23, 63, 95, .10);
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 4px solid rgba(242,184,75,.75); outline-offset: 2px; }
.app-shell { width: min(100%, 1040px); min-height: 100vh; margin: 0 auto; background: var(--paper); box-shadow: 0 0 50px rgba(23,63,95,.08); padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.topbar { height: 76px; padding: 12px clamp(18px,4vw,34px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,253,248,.96); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); border: 0; background: none; padding: 0; min-height: 48px; text-align: left; cursor: pointer; }
.brand-mark { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--ink); color: var(--sun); letter-spacing: -4px; padding-right: 4px; }
.brand b { display: block; font-size: 1.15rem; line-height: 1.05; }
.brand small { display: block; font-size: .72rem; letter-spacing: .16em; color: var(--muted); margin-top: 4px; }
.star-pill { min-width: 76px; height: 44px; border-radius: 22px; display: flex; gap: 8px; justify-content: center; align-items: center; background: var(--sun-soft); color: #7d5600; font-size: 1.08rem; }
.star-pill span { color: #e19a00; }
main { padding: 26px clamp(18px,4vw,44px) 34px; }
.eyebrow { margin: 0 0 8px; color: var(--leaf); font-size: .8rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1,h2,h3,p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem,7vw,3.3rem); line-height: 1.02; letter-spacing: -.035em; }
h2 { font-size: clamp(1.4rem,4vw,2rem); margin-bottom: 16px; }
h3 { font-size: 1.14rem; }
.lead { max-width: 650px; color: var(--muted); font-size: 1.05rem; line-height: 1.55; }
.hero { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(240px,.6fr); gap: 18px; margin-bottom: 24px; }
.hero-main, .hero-side { border-radius: 26px; padding: clamp(24px,4vw,38px); }
.hero-main { background: var(--ink); color: white; min-height: 260px; position: relative; overflow: hidden; }
.hero-main::after { content: "a  e"; position: absolute; right: 28px; bottom: -18px; font-weight: 900; font-size: clamp(4rem,12vw,8rem); color: rgba(255,255,255,.07); letter-spacing: -.15em; }
.hero-main .eyebrow { color: #9ad4c4; }
.hero-main h1 { max-width: 600px; }
.hero-main .lead { color: #d9e6eb; }
.hero-side { background: var(--sun-soft); display: flex; flex-direction: column; justify-content: space-between; }
.progress-ring { width: 114px; height: 114px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; background: conic-gradient(var(--sun) var(--p), rgba(255,255,255,.75) 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 12px; background: var(--sun-soft); border-radius: 50%; }
.progress-ring b { position: relative; font-size: 1.45rem; }
.action-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.btn { border: 0; border-radius: 16px; min-height: 54px; padding: 13px 20px; font-weight: 800; font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 9px; transition: transform .12s ease, opacity .12s ease, background .12s ease; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { color: var(--ink); background: var(--sun); }
.btn-secondary { color: white; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); }
.btn-ink { color: white; background: var(--ink); }
.btn-soft { color: var(--ink); background: var(--sky); }
.btn-zh { color: #75440b; background: var(--sun-soft); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-head h2 { margin: 0; }
.section-note { color: var(--muted); font-size: .86rem; font-weight: 700; }
.text-btn { border: 0; background: none; color: var(--leaf); min-height: 44px; padding: 8px; font-weight: 800; cursor: pointer; }
.mode-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.mode-card { min-height: 145px; padding: 19px; border: 1px solid var(--line); border-radius: 21px; background: white; text-align: left; color: var(--ink); cursor: pointer; box-shadow: 0 5px 15px rgba(23,63,95,.04); }
.mode-card:hover { border-color: var(--leaf); }
.mode-icon { width: 43px; height: 43px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 13px; background: var(--leaf-soft); color: var(--leaf); font-weight: 900; font-size: 1.15rem; }
.mode-card b { display: block; font-size: 1rem; margin-bottom: 5px; }
.mode-card small { display: block; color: var(--muted); line-height: 1.35; font-size: .8rem; }
.weak-list { display: flex; flex-wrap: wrap; gap: 9px; }
.word-chip { border-radius: 999px; padding: 10px 14px; background: #f1f5f5; color: var(--ink-2); font-weight: 800; }
.bottom-nav { position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%,1040px); height: calc(74px + env(safe-area-inset-bottom)); padding: 8px max(10px,env(safe-area-inset-left)) env(safe-area-inset-bottom) max(10px,env(safe-area-inset-right)); display: grid; grid-template-columns: repeat(5,1fr); gap: 4px; background: rgba(255,253,248,.98); border-top: 1px solid var(--line); }
.nav-item { min-width: 0; border: 0; background: none; border-radius: 13px; color: var(--muted); font-size: .73rem; font-weight: 800; cursor: pointer; }
.nav-item span { display: block; margin-bottom: 3px; font-size: 1.2rem; line-height: 1; }
.nav-item.active { background: var(--sky); color: var(--ink); }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: clamp(2rem,6vw,2.8rem); }
.tabs { display: flex; gap: 7px; overflow-x: auto; padding: 3px 2px 12px; scrollbar-width: none; }
.tab { flex: 0 0 auto; min-height: 46px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--ink); font-weight: 800; cursor: pointer; }
.tab.active { color: white; background: var(--ink); border-color: var(--ink); }
.word-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.word-card { border: 1px solid var(--line); border-radius: 24px; background: white; padding: 22px; box-shadow: var(--shadow); }
.word-picture { display: block; width: calc(100% + 44px); height: 190px; margin: -22px -22px 20px; border-radius: 23px 23px 0 0; object-fit: cover; background: var(--sky); }
.word-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.word-name { font-size: clamp(1.55rem,5vw,2.2rem); font-weight: 900; letter-spacing: .01em; }
.speaker-row { display: flex; gap: 7px; }
.icon-btn { width: 48px; height: 48px; border: 0; border-radius: 15px; background: var(--sky); color: var(--ink); font-weight: 900; cursor: pointer; }
.icon-btn.slow { font-size: .72rem; }
.definition { min-height: 48px; margin: 13px 0; color: var(--muted); line-height: 1.5; }
.zh-meaning { margin: -4px 0 13px; color: #8a5b12; font-weight: 800; line-height: 1.45; }
.chunks { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0 0; }
.chunk { padding: 8px 11px; border-radius: 10px; background: var(--sun-soft); color: #71510d; font-weight: 900; }
.chunk-plus { display: grid; place-items: center; color: var(--muted); font-weight: 900; }
.sentence-audio { width: 44px; height: 44px; margin-left: 7px; border: 0; border-radius: 12px; background: var(--sky); cursor: pointer; touch-action: manipulation; }
.stage-pill { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: 13px; background: #f2f6f6; color: var(--muted); font-size: .86rem; }
.stage-pill b { color: var(--ink); text-align: right; }
.mastery { margin-top: 14px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .84rem; font-weight: 700; }
.mini-bar { flex: 1; height: 7px; border-radius: 8px; background: #e8efef; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--leaf); }
.practice-shell { max-width: 760px; margin: 0 auto; }
.question-card { border: 1px solid var(--line); border-radius: 28px; background: white; box-shadow: var(--shadow); padding: clamp(22px,5vw,40px); }
.question-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-weight: 800; font-size: .85rem; margin-bottom: 28px; }
.step-dots { display: flex; gap: 6px; }
.step-dot { width: 22px; height: 7px; border-radius: 5px; background: #dfe8e8; }
.step-dot.done { background: var(--leaf); }
.question { font-size: clamp(1.35rem,4.5vw,2rem); line-height: 1.35; margin-bottom: 22px; }
.question-tools { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.question-tools .btn { min-height: 48px; padding: 10px 15px; }
.question .blank { display: inline-block; min-width: 90px; border-bottom: 4px solid var(--sun); text-align: center; color: var(--leaf); }
.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.choice { min-height: 60px; padding: 12px 17px; border: 2px solid var(--line); border-radius: 16px; background: white; color: var(--ink); font-size: 1.05rem; font-weight: 800; cursor: pointer; }
.choice.selected { border-color: var(--ink); background: var(--sky); }
.choice.correct { border-color: var(--leaf); background: var(--leaf-soft); }
.choice.wrong { border-color: var(--coral); background: #fde9e5; }
.answer-input { width: 100%; min-height: 58px; border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; font-size: 1.1rem; color: var(--ink); background: #fff; }
textarea.answer-input { min-height: 118px; resize: vertical; line-height: 1.5; }
.letter-bank, .built-word { display: flex; gap: 8px; flex-wrap: wrap; min-height: 62px; padding: 9px; border-radius: 16px; background: #f2f6f6; margin-bottom: 14px; }
.letter { min-width: 48px; height: 48px; border: 0; border-radius: 13px; background: white; color: var(--ink); box-shadow: 0 2px 7px rgba(23,63,95,.12); font-size: 1.18rem; font-weight: 900; cursor: pointer; }
.built-word .letter { background: var(--sun-soft); }
.feedback { border-radius: 16px; padding: 14px 16px; margin-top: 16px; font-weight: 800; line-height: 1.45; }
.feedback.good { background: var(--leaf-soft); color: #185b48; }
.feedback.try { background: #fde9e5; color: #9b3f2c; }
.feedback.retry { background: var(--sun-soft); color: #6f4b08; }
.evidence-note { display: block; margin-top: 7px; font-weight: 600; }
.writing-checks { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.writing-checks span { padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.72); font-size: .86rem; }
.writing-checks .pass { color: #185b48; }
.writing-checks .miss { color: #9b3f2c; }
.hint-box { padding: 15px; border-radius: 16px; background: var(--sun-soft); margin: 16px 0; line-height: 1.55; }
.zh-hint { border-left: 5px solid var(--sun); color: #684411; }
.practice-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.story-layout { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(270px,.75fr); gap: 18px; }
.story-paper { background: white; border: 1px solid var(--line); border-radius: 26px; padding: clamp(24px,5vw,42px); box-shadow: var(--shadow); }
.story-paper p { font-family: Georgia, serif; font-size: 1.16rem; line-height: 1.78; color: #294c64; }
.story-paper mark { background: var(--sun-soft); color: inherit; border-radius: 4px; padding: 0 3px; }
.story-side { border-radius: 26px; padding: 24px; background: var(--sky); align-self: start; }
.story-facts { display: grid; gap: 10px; }
.story-fact { padding: 13px; background: rgba(255,255,255,.68); border-radius: 14px; }
.timeline { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.timeline-card { display: grid; grid-template-columns: 44px 1fr 48px; gap: 14px; align-items: start; border: 1px solid var(--line); border-radius: 22px; background: white; padding: 0 18px 18px; overflow: hidden; box-shadow: 0 7px 20px rgba(23,63,95,.06); }
.timeline-image { display: block; grid-column: 1 / -1; width: calc(100% + 36px); margin-left: -18px; aspect-ratio: 4 / 3; object-fit: cover; background: var(--sky); }
.timeline-step { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--sun); color: var(--ink); font-weight: 900; }
.timeline-card h3 { margin: 3px 0 7px; }
.timeline-card p { color: var(--muted); line-height: 1.55; margin-bottom: 8px; }
.timeline-copy { min-width: 0; }
.timeline-audio { align-self: start; }
.timeline-card details { color: #75440b; }
.timeline-card summary { min-height: 38px; padding: 7px 0; cursor: pointer; font-weight: 800; }
.timeline-card details p { color: #75440b; margin: 4px 0 0; }
.story-skill-grid { margin-bottom: 24px; }
.journal-card { font: inherit; }
.journal-shell { max-width: 900px; margin: 0 auto; }
.journal-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(240px,.55fr); gap: 18px; align-items: start; }
.journal-card-main, .journal-check { border: 1px solid var(--line); border-radius: 24px; background: white; padding: clamp(20px,4vw,30px); box-shadow: var(--shadow); }
.journal-card-main > label { display: block; margin: 18px 0 8px; font-weight: 900; }
.journal-card-main > label:first-child { margin-top: 0; }
.journal-card-main h3 { margin: 22px 0 10px; }
.journal-date { max-width: 240px; }
.journal-writing { min-height: 190px !important; }
.starter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.starter { border: 0; cursor: pointer; text-align: left; }
.journal-check { background: var(--sky); box-shadow: none; }
.journal-check label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; line-height: 1.4; font-weight: 700; }
.journal-check input { width: 21px; height: 21px; flex: 0 0 auto; }
.mock-intro { max-width: 780px; margin: 0 auto; }
.audio-option { display: flex; align-items: center; gap: 13px; max-width: 430px; margin: 18px 0; padding: 15px 17px; border: 1px solid var(--line); border-radius: 17px; background: white; cursor: pointer; }
.audio-option input { width: 24px; height: 24px; flex: 0 0 auto; }
.audio-option b, .audio-option small { display: block; }
.audio-option small { margin-top: 3px; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.rule-list { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 24px 0; }
.rule { border: 1px solid var(--line); border-radius: 18px; padding: 17px; background: white; }
.rule b { display: block; margin-bottom: 5px; }
.rule span { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.score-hero { padding: 30px; text-align: center; border-radius: 26px; background: var(--ink); color: white; }
.score-hero .score { font-size: clamp(3rem,11vw,6rem); font-weight: 900; color: var(--sun); line-height: 1; }
.result-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-top: 18px; }
.result-card { padding: 18px; border-radius: 18px; border: 1px solid var(--line); background: white; }
.result-card b { display: block; font-size: 1.15rem; margin-bottom: 5px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 92px; transform: translate(-50%,20px); opacity: 0; pointer-events: none; border-radius: 999px; background: var(--ink); color: white; padding: 12px 18px; font-weight: 800; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.parent-note { margin-top: 26px; padding: 17px 19px; background: #f1f5f5; border-radius: 16px; color: var(--muted); line-height: 1.55; }
.parent-note b { color: var(--ink); }
.skill-summary { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.skill-summary-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: white; color: var(--muted); font-weight: 800; }
.skill-summary-card b { color: var(--ink); font-size: 1.08rem; }
.crossword-wrap { display: grid; grid-template-columns: minmax(280px,420px) minmax(210px,1fr); gap: 24px; align-items: start; }
.crossword-grid { display: grid; grid-template-columns: repeat(var(--cross-size),1fr); width: 100%; aspect-ratio: 1; background: var(--ink); border: 4px solid var(--ink); gap: 2px; }
.cross-cell { position: relative; display: block; min-width: 0; min-height: 0; background: white; }
.cross-cell.blocked { background: var(--ink); }
.cross-cell small { position: absolute; z-index: 2; top: 1px; left: 3px; color: var(--ink); font-size: .58rem; font-weight: 900; pointer-events: none; }
.cross-cell input { width: 100%; height: 100%; border: 0; padding: 4px 2px 0; text-align: center; text-transform: uppercase; color: var(--ink); background: transparent; font-size: clamp(1rem,3vw,1.45rem); font-weight: 900; }
.cross-cell input:focus { position: relative; z-index: 1; outline: 4px solid var(--sun); }
.cross-cell input.revealed { background: var(--sun-soft); }
.crossword-clues { margin: 0; padding-left: 22px; }
.crossword-clues li { margin-bottom: 13px; padding-left: 4px; color: var(--muted); line-height: 1.45; }
.crossword-clues b { color: var(--ink); text-transform: capitalize; }
@media (max-width: 760px) {
  .hero, .story-layout, .journal-grid, .timeline { grid-template-columns: 1fr; }
  .hero-side { min-height: 160px; display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 14px; }
  .progress-ring { margin: 0; }
  .mode-grid { grid-template-columns: repeat(2,1fr); }
  .word-grid { grid-template-columns: 1fr; }
  .rule-list { grid-template-columns: 1fr; }
  .skill-summary { grid-template-columns: repeat(2,1fr); }
  .crossword-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  main { padding-inline: 14px; }
  .topbar { padding-inline: 14px; }
  .mode-grid { gap: 9px; }
  .mode-card { min-height: 135px; padding: 15px; }
  .choice-grid { grid-template-columns: 1fr; }
  .practice-actions { flex-direction: column-reverse; }
  .practice-actions .btn { width: 100%; }
  .result-grid { grid-template-columns: 1fr; }
  .timeline-card { grid-template-columns: 38px 1fr 48px; padding: 0 14px 16px; gap: 10px; }
  .timeline-image { width: calc(100% + 28px); margin-left: -14px; }
  .nav-item { font-size: .67rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
