:root {
  --ink: #17352f;
  --muted: #68756f;
  --green: #1f6958;
  --green-dark: #173f35;
  --mint: #d9ebe1;
  --cream: #f4f1e9;
  --paper: #fffdf8;
  --line: #dfe3dc;
  --orange: #d7783d;
  --orange-soft: #f6dfce;
  --red: #a63f39;
  --shadow: 0 18px 55px rgba(30, 49, 42, .10);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--cream);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--cream); }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(215,120,61,.35); outline-offset: 2px; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 16px; letter-spacing: .16em; font-size: 12px; font-weight: 800; color: var(--orange); }
.brand-mark { width: 54px; height: 54px; border-radius: 18px 18px 18px 5px; display: grid; place-items: center; background: var(--orange); color: white; font: 800 28px Georgia, serif; box-shadow: 0 10px 24px rgba(150,79,37,.22); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px 12px 12px 4px; font-size: 21px; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); }
.auth-brand { position: relative; overflow: hidden; padding: clamp(48px,7vw,112px); color: #f9f4e9; background: var(--green-dark); display: flex; flex-direction: column; justify-content: center; }
.auth-brand::after { content: "A"; position: absolute; right: -2vw; bottom: -18vw; color: rgba(255,255,255,.035); font: 800 min(60vw,760px)/1 Georgia,serif; }
.auth-brand .brand-mark { margin-bottom: 48px; }
.auth-brand h1 { position: relative; z-index: 1; max-width: 700px; margin: 0; font: 700 clamp(44px,6.3vw,92px)/1.08 Georgia,"Songti SC",serif; letter-spacing: -.04em; }
.auth-lead { position: relative; z-index: 1; max-width: 560px; margin: 34px 0; font-size: 18px; line-height: 1.9; color: #d8e3dc; }
.auth-points { display: flex; flex-wrap: wrap; gap: 9px; position: relative; z-index: 1; }
.auth-points span { padding: 8px 13px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; font-size: 13px; }
.public-actions { display:flex; align-items:center; flex-wrap:wrap; gap:13px; margin-top:28px; position:relative; z-index:1; }
.public-actions span { color:#aac1b8; font-size:12px; }
.public-primary { display:inline-block; padding:12px 18px; border-radius:12px; color:white; background:var(--orange); text-decoration:none; font-weight:800; box-shadow:0 8px 18px rgba(215,120,61,.2); }
.auth-card { align-self: center; width: min(420px, calc(100% - 48px)); margin: 40px auto; padding: 36px; background: var(--paper); border-radius: 28px; box-shadow: var(--shadow); }
.pending-assessment { display:grid; gap:5px; margin-bottom:16px; padding:13px 15px; border-radius:13px; background:var(--mint); }
.pending-assessment span { color:var(--muted); font-size:12px; line-height:1.5; }
.auth-levels { grid-column:1/-1; padding:70px clamp(28px,7vw,110px) 84px; background:var(--paper); }
.level-intro { max-width:720px; }
.level-intro h2 { margin:0; font:700 clamp(30px,4vw,51px)/1.2 Georgia,"Songti SC",serif; }
.level-intro > p:last-child { color:var(--muted); line-height:1.8; }
.level-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-top:32px; }
.level-grid article { min-height:210px; padding:23px; border:1px solid var(--line); border-radius:19px; background:#faf8f2; }
.level-grid article b { display:block; color:var(--orange); font:700 31px Georgia,serif; }
.level-grid article h3 { margin:18px 0 10px; font-size:17px; }
.level-grid article p { margin:0; color:var(--muted); font-size:13px; line-height:1.75; }
.level-note { margin:18px 0 0; color:var(--muted); font-size:12px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-bottom: 28px; background: #ecece6; border-radius: 13px; }
.auth-tab { border: 0; border-radius: 10px; padding: 11px; background: transparent; cursor: pointer; color: var(--muted); }
.auth-tab.active { background: white; color: var(--ink); font-weight: 700; box-shadow: 0 3px 12px rgba(30,49,42,.08); }
label { display: block; margin: 17px 0; font-size: 13px; font-weight: 700; }
input, select { display: block; width: 100%; margin-top: 8px; padding: 13px 14px; border: 1px solid var(--line); background: white; border-radius: 12px; color: var(--ink); }
.primary, .secondary, .soft-btn, .text-btn { border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer; font-weight: 750; }
.primary { background: var(--green); color: white; box-shadow: 0 8px 18px rgba(31,105,88,.2); }
.primary:hover { background: #185747; }
.primary:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.secondary { background: var(--orange-soft); color: #82441f; }
.soft-btn { background: #e7eee9; color: var(--green-dark); }
.text-btn { background: transparent; color: var(--green); padding: 8px; }
.wide { width: 100%; margin-top: 8px; }
.form-hint { margin: 17px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.form-error { min-height: 20px; margin: 10px 0 0; color: var(--red); font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0,1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 236px; padding: 26px 18px; background: var(--green-dark); color: white; display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 7px; }
.side-brand b { display: block; font-size: 15px; }
.side-brand small { display: block; margin-top: 4px; color: #a9c1b7; font-size: 11px; }
#mainNav { display: grid; gap: 7px; margin-top: 50px; }
.nav-item { position: relative; border: 0; border-radius: 15px; padding: 13px 15px; background: transparent; color: #c4d3cd; text-align: left; cursor: pointer; }
.nav-item span { display: block; font-weight: 750; }
.nav-item small { display: block; margin-top: 4px; color: #829e93; }
.nav-item.active { background: rgba(255,255,255,.1); color: white; }
.nav-item.active small { color: #bad0c7; }
.badge { position: absolute; top: 12px; right: 12px; padding: 2px 7px; border-radius: 999px; background: var(--orange); color: white; font-style: normal; font-size: 11px; }
.side-foot { margin-top: auto; padding: 12px; color: #abc0b8; font-size: 12px; display: flex; align-items: center; justify-content:space-between; gap: 8px; }
.side-foot > div { display:flex; align-items:center; gap:8px; }
.side-logout { border:0; padding:5px; background:transparent; color:#abc0b8; cursor:pointer; font-size:11px; }
.side-logout:hover,.logout-text { color:#d99872; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #79cba5; }
.sync-dot.busy { animation: pulse 1s infinite; background: #edbd62; }
.sync-dot.error { background: #e17870; }
@keyframes pulse { 50% { opacity: .35; } }
.main { grid-column: 2; min-width: 0; }
.mobile-head, .bottom-nav { display: none; }
.page { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 52px 0 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 30px; }
.page-head h1 { margin: 0; font: 700 clamp(30px,4vw,48px)/1.15 Georgia,"Songti SC",serif; letter-spacing: -.025em; }
.page-head p { margin: 9px 0 0; color: var(--muted); line-height: 1.7; }
.date-chip { flex: 0 0 auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0,1.45fr) minmax(300px,.75fr); }
.grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.card { background: var(--paper); border: 1px solid rgba(29,61,51,.07); border-radius: 22px; padding: 24px; box-shadow: 0 7px 24px rgba(35,55,47,.045); }
.card h2, .card h3 { margin: 0; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.card-title h2 { font-size: 19px; }
.card-title small { color: var(--muted); }
.hero-card { position: relative; overflow: hidden; min-height: 330px; padding: 36px; color: white; background: linear-gradient(135deg,#1d5f50,#173f35); }
.hero-card::after { content: "hello"; position: absolute; right: -22px; bottom: -25px; color: rgba(255,255,255,.055); font: italic 700 130px Georgia,serif; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card .kicker { color: #b8d0c6; font-size: 13px; }
.hero-card h2 { max-width: 610px; margin: 15px 0 12px; font: 700 clamp(28px,4vw,46px)/1.2 Georgia,"Songti SC",serif; }
.hero-card p { max-width: 580px; color: #c9d9d3; line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 28px; }
.hero-actions .primary { background: var(--orange); }
.hero-actions .soft-btn { background: rgba(255,255,255,.12); color: white; }
.time-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.time-picker button { border: 1px solid rgba(255,255,255,.19); border-radius: 999px; padding: 7px 11px; background: transparent; color: #d7e4de; cursor: pointer; font-size: 12px; }
.time-picker button.active { background: white; color: var(--green-dark); }
.stat-stack { display: grid; gap: 18px; }
.stat-number { margin: 8px 0 4px; font: 700 38px Georgia,serif; }
.stat-number small { font: 500 13px -apple-system,sans-serif; color: var(--muted); }
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #e6e8e2; }
.progress-track > i { display: block; height: 100%; border-radius: inherit; background: var(--green); transition: width .4s ease; }
.progress-track.orange > i { background: var(--orange); }
.stat-label, .muted { color: var(--muted); }
.stat-label { font-size: 13px; }
.notice { padding: 15px 17px; border-radius: 14px; background: #e6eee9; color: #355b50; font-size: 13px; line-height: 1.65; }
.notice.warm { background: var(--orange-soft); color: #75421f; }
.assessment-callout { display:flex; align-items:center; justify-content:space-between; gap:18px; }
.assessment-callout p { margin:4px 0 0; }
.plan-phases { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-top:18px; }
.plan-phase { padding:15px; border-radius:14px; background:#eef1ed; }
.plan-phase b { display:block; margin-bottom:6px; font-size:13px; }
.plan-phase span { color:var(--muted); font-size:12px; line-height:1.55; }
.priority-tags { display:flex; flex-wrap:wrap; gap:7px; margin-top:13px; }
.priority-tags span { padding:6px 10px; border-radius:999px; background:var(--orange-soft); color:#7a451f; font-size:11px; }
.task-list { display: grid; gap: 10px; }
.task-row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.task-index { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--mint); color: var(--green); font-weight: 800; }
.task-row b { display: block; font-size: 14px; }
.task-row small { display: block; margin-top: 4px; color: var(--muted); }
.task-row button { border: 0; background: transparent; color: var(--green); cursor: pointer; font-weight: 700; }
.section-gap { margin-top: 18px; }

.module-list { display: grid; gap: 16px; }
.module { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.module-head { display: grid; grid-template-columns: 58px minmax(0,1fr) auto; align-items: center; gap: 16px; padding: 22px; cursor: pointer; }
.module-no { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; color: var(--green); background: var(--mint); font: 700 22px Georgia,serif; }
.module-head h2 { margin: 0; font-size: 18px; }
.module-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.module-meta { text-align: right; color: var(--muted); font-size: 12px; }
.lesson-list { display: grid; gap: 1px; padding: 0 12px 12px; background: var(--line); }
.lesson-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 15px 12px; background: var(--paper); }
.lesson-row:first-child { border-radius: 12px 12px 0 0; }
.lesson-row:last-child { border-radius: 0 0 12px 12px; }
.lesson-status { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #eceee9; color: #7a867f; font-size: 12px; font-weight: 800; }
.lesson-status.done { background: var(--green); color: white; }
.lesson-row b { display: block; font-size: 14px; }
.lesson-row small { display: block; margin-top: 4px; color: var(--muted); }

.skill-bars { display: grid; gap: 18px; }
.skill-row { display: grid; grid-template-columns: 68px minmax(0,1fr) 42px; align-items: center; gap: 12px; font-size: 13px; }
.skill-row strong { text-align: right; }
.history-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.history-row { display: grid; grid-template-columns: 110px minmax(0,1fr) auto; gap: 15px; padding: 13px 15px; background: white; font-size: 13px; }
.history-row span:first-child, .history-row span:last-child { color: var(--muted); }
.baseline { display: grid; grid-template-columns: repeat(6,1fr); gap: 8px; margin-top: 16px; }
.baseline div { padding: 12px 8px; text-align: center; border-radius: 12px; background: #f0efe9; }
.baseline b { display: block; font: 700 20px Georgia,serif; }
.baseline small { color: var(--muted); font-size: 10px; }
.settings-list { display: grid; gap: 14px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 22px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row b { display: block; font-size: 14px; }
.setting-row small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.5; }
.setting-row input, .setting-row select { width: 190px; margin: 0; }

.lesson-dialog { width: min(860px,calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 25px; color: var(--ink); background: var(--paper); box-shadow: 0 30px 100px rgba(14,35,29,.28); }
.lesson-dialog::backdrop { background: rgba(15,36,30,.68); backdrop-filter: blur(5px); }
.lesson-top { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px; padding: 18px 24px; background: rgba(255,253,248,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.lesson-top h2 { margin: 0; text-align: center; font-size: 16px; }
.close-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eceee9; cursor: pointer; font-size: 18px; }
.lesson-step-count { color: var(--muted); font-size: 12px; }
.lesson-progress { height: 4px; background: #e7e9e3; }
.lesson-progress i { display: block; height: 100%; background: var(--orange); }
.lesson-body { min-height: 520px; padding: clamp(24px,5vw,48px); }
.lesson-body .eyebrow { margin-bottom: 10px; }
.lesson-body h1 { margin: 0 0 16px; font: 700 clamp(28px,4vw,42px)/1.2 Georgia,"Songti SC",serif; }
.lesson-body .lead { color: var(--muted); line-height: 1.8; }
.lesson-footer { position: sticky; bottom: 0; display: flex; justify-content: space-between; gap: 12px; padding: 17px 24px; background: rgba(255,253,248,.96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.word-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 24px; }
.word-card { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.word-card .word-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.word-card strong { font: 700 22px Georgia,serif; }
.word-card em { color: var(--green); font-style: normal; font-size: 13px; }
.word-card p { margin: 8px 0 0; color: var(--muted); }
.listen-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--mint); color: var(--green); cursor: pointer; }
.pattern-box { margin: 22px 0; padding: 25px; border-left: 5px solid var(--orange); border-radius: 4px 17px 17px 4px; background: #f7eee5; }
.pattern-box code { font: 700 21px Georgia,serif; color: #72401f; }
.pattern-box p { margin: 10px 0 0; color: #725b4a; line-height: 1.7; }
.example-list { display: grid; gap: 10px; margin-top: 18px; }
.example { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 10px; align-items: center; padding: 12px; border-radius: 13px; background: white; border: 1px solid var(--line); }
.exercise { margin-top: 22px; padding: 22px; border-radius: 17px; background: #edf1ed; }
.exercise h3 { margin: 0 0 14px; }
.choice-list { display: grid; gap: 9px; }
.choice { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: white; text-align: left; cursor: pointer; }
.choice.correct { border-color: #56a883; background: #e3f4eb; }
.choice.wrong { border-color: #d97f78; background: #f9e5e2; }
.feedback { min-height: 24px; margin: 12px 0 0; font-weight: 700; font-size: 13px; }
.feedback.ok { color: var(--green); }
.feedback.bad { color: var(--red); }
.speech-panel { margin-top: 22px; padding: 24px; border-radius: 18px; background: var(--green-dark); color: white; text-align: center; }
.speech-target { margin: 18px 0; font: 700 26px/1.4 Georgia,serif; }
.speech-result { min-height: 48px; margin: 14px 0; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.09); color: #d9e6e0; line-height: 1.5; }
.speech-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.speech-actions button { border: 0; border-radius: 999px; padding: 10px 14px; background: rgba(255,255,255,.14); color: white; cursor: pointer; }
.speech-actions .recording { background: #bd4d45; animation: pulse 1s infinite; }
.transcript-input { margin-top: 12px; color: var(--ink); }
.dialogue { display: grid; gap: 13px; margin-top: 20px; }
.bubble { max-width: 78%; padding: 13px 16px; border-radius: 18px 18px 18px 5px; background: #e6ede9; line-height: 1.65; }
.bubble.me { justify-self: end; border-radius: 18px 18px 5px 18px; background: var(--orange-soft); }
.review-card { text-align: center; padding: 26px; }
.review-word { margin: 35px 0 10px; font: 700 clamp(42px,8vw,74px)/1 Georgia,serif; }
.review-answer { min-height: 85px; margin: 20px 0; padding: 18px; border-radius: 16px; background: #f0efe9; }
.grade-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.grade-row button { border: 0; border-radius: 12px; padding: 12px 6px; cursor: pointer; font-weight: 700; }
.grade-row button:nth-child(1) { background: #f7dedb; color: var(--red); }
.grade-row button:nth-child(2) { background: #f7e9d2; color: #855916; }
.grade-row button:nth-child(3) { background: #dff0e6; color: var(--green); }
.toast { position: fixed; z-index: 1000; left: 50%; bottom: 30px; transform: translate(-50%,25px); max-width: calc(100% - 40px); padding: 11px 17px; border-radius: 999px; color: white; background: #193e35; opacity: 0; pointer-events: none; transition: .22s; box-shadow: var(--shadow); font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 920px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 44vh; padding: 44px 28px; }
  .auth-brand .brand-mark { margin-bottom: 25px; }
  .auth-brand h1 { font-size: clamp(38px,11vw,64px); }
  .auth-lead { margin: 22px 0; font-size: 15px; }
  .auth-card { margin: -25px auto 35px; position: relative; z-index: 2; }
  .auth-levels { padding:55px 28px 70px; }
  .level-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main { padding-bottom: 68px; }
  .mobile-head { display: flex; position: sticky; top: 0; z-index: 10; justify-content: space-between; align-items: center; padding: 12px 18px; background: rgba(244,241,233,.92); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(30,50,43,.07); }
  .bottom-nav { position: fixed; display: grid; z-index: 25; bottom: 0; left: 0; right: 0; grid-template-columns: repeat(5,1fr); padding: 6px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); background: rgba(255,253,248,.96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
  .bottom-nav button { border: 0; padding: 8px 2px; background: transparent; color: var(--muted); font-size: 11px; }
  .bottom-nav button.active { color: var(--green); font-weight: 800; }
  .page { width: min(100% - 28px,720px); padding: 28px 0 38px; }
  .page-head { align-items: flex-start; }
  .date-chip { display: none; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .hero-card { min-height: 315px; padding: 26px; }
  .baseline { grid-template-columns: repeat(3,1fr); }
  .plan-phases { grid-template-columns:1fr; }
}

@media (max-width: 580px) {
  .auth-card { width: calc(100% - 28px); padding: 26px 21px; }
  .level-grid { grid-template-columns:1fr; }
  .level-grid article { min-height:0; }
  .page-head h1 { font-size: 31px; }
  .card { padding: 19px; border-radius: 18px; }
  .hero-card h2 { font-size: 30px; }
  .module-head { grid-template-columns: 48px minmax(0,1fr); padding: 16px; }
  .module-no { width: 44px; height: 44px; }
  .module-meta { display: none; }
  .lesson-row { grid-template-columns: 35px minmax(0,1fr); }
  .lesson-row > button { grid-column: 2; justify-self: start; }
  .history-row { grid-template-columns: 82px minmax(0,1fr); }
  .history-row span:last-child { display: none; }
  .setting-row { display: block; }
  .setting-row input, .setting-row select { width: 100%; margin-top: 12px; }
  .lesson-dialog { width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .lesson-body { padding: 28px 20px; }
  .lesson-top { padding: 13px 15px; }
  .lesson-footer { padding: 13px 15px calc(13px + env(safe-area-inset-bottom)); }
  .word-grid { grid-template-columns: 1fr; }
  .speech-target { font-size: 22px; }
  .bubble { max-width: 90%; }
  .assessment-callout { display:block; }
  .assessment-callout .primary { margin-top:14px; width:100%; }
}
