:root {
  --paper: #fffdf8;
  --canvas: #f4efe4;
  --ink: #173f36;
  --ink-deep: #0f2e28;
  --ink-soft: #526e65;
  --muted: #73847c;
  --line: #ded7c7;
  --coral: #ee6a4b;
  --coral-deep: #d55335;
  --yellow: #ffd257;
  --mint: #dcefdc;
  --green: #4e8e73;
  --font-ui: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-hanzi: "KaiTi", "楷体", "STKaiti", "华文楷体", "Kaiti SC", "LXGW WenKai", serif;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 14px;
  --shadow: 4px 5px 0 rgba(23, 63, 54, .12);
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 210, 87, .18), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(238, 106, 75, .12), transparent 38%),
    var(--canvas);
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
input { font: inherit; }
h1, h2, h3, p { margin: 0; }
.sprite { display: none; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .16em; color: var(--muted); }
.hanzi { font-family: var(--font-hanzi); font-weight: 400; }

/* ---------- buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border: 1.5px solid var(--ink-deep);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--ink-deep);
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 4px 0 rgba(23, 63, 54, .2);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s;
}
.button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(23, 63, 54, .2); }
.button .icon { width: 20px; height: 20px; }
.button-primary { background: var(--coral); color: #fff; }
.button-soft { background: #eef4ea; border-color: #b9cfbd; box-shadow: 0 4px 0 rgba(78, 142, 115, .22); }
.button-lg { min-height: 58px; font-size: 17px; border-radius: 19px; }
.button-block { width: 100%; }
.button:disabled { opacity: .45; box-shadow: none; }
.button:disabled:active { transform: none; }

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(23, 63, 54, .16);
  border-radius: 13px;
  background: #fff;
  color: var(--ink-deep);
}
.icon-button .icon { width: 20px; height: 20px; }
.icon-button.is-muted { color: #b2bdb4; }
.icon-button.is-favorite { color: var(--coral); background: #fff1ec; border-color: #f0b6a2; }
.icon-button.is-favorite .icon { fill: #ffd9cf; }

/* ---------- top bar ---------- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: rgba(244, 239, 228, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1.5px solid rgba(23, 63, 54, .12);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: var(--yellow);
  font-family: var(--font-hanzi);
  font-size: 22px;
  line-height: 1;
  box-shadow: 3px 3px 0 rgba(23, 63, 54, .18);
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 14px; font-weight: 800; color: var(--ink-deep); letter-spacing: .02em; white-space: nowrap; }
.brand-text small { display: block; margin-top: 1px; font-size: 9px; color: var(--muted); letter-spacing: .18em; }
.top-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.top-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 99px;
  background: #fff;
  border: 1.5px solid rgba(23, 63, 54, .14);
  font-size: 13px;
  font-weight: 800;
  color: #8a6a17;
}
.chip-icon { color: #e0ac35; font-size: 12px; }

/* ---------- main ---------- */
.app-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px calc(92px + env(safe-area-inset-bottom, 0px));
}
.tab-page:not([hidden]) { animation: page-in .22s ease; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head h1 { margin-top: 5px; font-size: 26px; font-weight: 800; color: var(--ink-deep); letter-spacing: -.01em; }
.page-head p { margin-top: 6px; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 20px 0 12px; }
.section-head h2 { font-size: 15.5px; font-weight: 800; color: var(--ink-deep); }
.section-note { font-size: 11.5px; color: var(--muted); }
.section-note b { color: var(--coral-deep); }

/* ---------- today ---------- */
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #1d4a40, #12332c 72%);
  color: #f6f0df;
  box-shadow: 5px 6px 0 rgba(23, 63, 54, .16);
}
.hero-card::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -54px;
  top: -54px;
  border-radius: 50%;
  background: rgba(255, 210, 87, .13);
  box-shadow: 0 0 0 18px rgba(255, 210, 87, .06);
}
.hero-kicker { font-size: 9px; font-weight: 800; letter-spacing: .2em; color: rgba(246, 240, 223, .62); }
.hero-card h1 { position: relative; z-index: 1; margin-top: 7px; font-size: 26px; line-height: 1.3; font-weight: 800; letter-spacing: .01em; }
.hero-card h1 em { font-style: normal; color: var(--yellow); font-size: 36px; }
.hero-card p { position: relative; z-index: 1; margin-top: 5px; font-size: 12px; color: rgba(246, 240, 223, .78); }
.hero-progress { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.progress-track { flex: 1; height: 8px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, .18); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--coral), var(--yellow)); transition: width .35s ease; }
#daily-progress-label { font-size: 12px; font-weight: 800; color: var(--yellow); }

.continue-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 13px;
  padding: 13px 14px;
  border: 1.5px solid var(--ink-deep);
  border-radius: var(--r-md);
  background: var(--yellow);
  box-shadow: 4px 5px 0 rgba(23, 63, 54, .16);
  text-align: left;
}
.continue-card:active { transform: translateY(2px); box-shadow: 2px 3px 0 rgba(23, 63, 54, .16); }
.continue-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--paper); color: var(--ink-deep); }
.continue-copy { flex: 1; min-width: 0; }
.continue-copy .eyebrow { color: #8a7223; font-size: 9px; }
.continue-copy strong { display: block; margin-top: 2px; font-size: 15px; color: var(--ink-deep); }
.continue-copy small { display: block; margin-top: 2px; font-size: 11px; color: #7a6a2c; }
.continue-arrow { color: var(--ink-deep); }

.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 13px; }
.stat-cell { padding: 10px 3px; border: 1.5px solid rgba(23, 63, 54, .13); border-radius: var(--r-sm); background: rgba(255, 253, 248, .86); text-align: center; }
.stat-cell strong { display: block; font-size: 19px; line-height: 1.15; color: var(--ink-deep); }
.stat-cell span { display: block; margin-top: 2px; font-size: 10px; color: var(--muted); }

.daily-list { display: flex; flex-direction: column; gap: 11px; }
.daily-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 86px;
  padding: 12px 14px;
  border: 1.5px solid rgba(23, 63, 54, .15);
  border-left: 5px solid var(--tint, #e7dfd0);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: 3px 4px 0 rgba(23, 63, 54, .07);
  text-align: left;
}
.daily-item:active { transform: translateY(2px); box-shadow: 1px 2px 0 rgba(23, 63, 54, .07); }
.daily-char {
  width: 58px;
  height: 58px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--tint, #f2ede1);
  color: var(--ink-deep);
  font-family: var(--font-hanzi);
  font-size: 39px;
  line-height: 1;
}
.daily-info { flex: 1; min-width: 0; }
.daily-info strong { display: block; font-size: 15px; font-weight: 800; color: var(--ink-deep); }
.daily-info strong span { color: var(--coral-deep); font-size: 12px; font-weight: 800; margin-left: 6px; }
.daily-info small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-status { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #f0ece1; color: #8b988f; }
.daily-status .icon { width: 16px; height: 16px; }
.daily-item.is-done { border-left-color: #9cc0a5; background: #f5faf2; }
.daily-item.is-done .daily-char { background: #e2f0e3; }
.daily-item.is-done .daily-status { background: #5f9d74; color: #fff; }

/* ---------- library ---------- */
.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  margin-top: 16px;
  padding: 0 14px;
  border: 1.5px solid rgba(23, 63, 54, .15);
  border-radius: 15px;
  background: #fff;
  color: var(--muted);
  transition: border-color .15s;
}
.search-field:focus-within { border-color: var(--green); }
.search-field .icon { width: 18px; height: 18px; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink-deep); }
.search-field input::placeholder { color: #a3afa6; }
.chip-row { display: flex; gap: 8px; margin-top: 13px; padding: 2px 0 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 38px;
  padding: 0 14px;
  border: 1.5px solid rgba(23, 63, 54, .15);
  border-radius: 99px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.chip.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }
.library-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 10px; font-size: 12px; color: var(--muted); }
.library-summary b { color: var(--ink-deep); }
.text-button { padding: 6px 2px; border-bottom: 2px solid transparent; font-size: 12px; font-weight: 800; color: var(--coral-deep); }
.text-button[aria-pressed="true"] { border-bottom-color: var(--coral); }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.char-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 96px;
  padding: 11px 6px 9px;
  border: 1.5px solid rgba(23, 63, 54, .15);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 0 rgba(23, 63, 54, .06);
}
.char-card:active { transform: translateY(2px); box-shadow: none; }
.char-card .glyph { font-family: var(--font-hanzi); font-size: 41px; line-height: 1.05; color: var(--ink-deep); }
.char-card .py { font-size: 10.5px; font-weight: 800; color: var(--coral-deep); }
.char-card .wd { max-width: 100%; font-size: 9.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-card.is-learned { border-color: #a8c9ae; background: #f4faf1; }
.char-card .learned-badge { position: absolute; top: 7px; right: 7px; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; background: #5f9d74; color: #fff; }
.char-card .learned-badge .icon { width: 10px; height: 10px; stroke-width: 3; }
.char-grid.compact { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); }
.char-grid.compact .char-card { min-height: 78px; border-radius: 14px; }
.char-grid.compact .glyph { font-size: 33px; }
.empty-state {
  margin-top: 14px;
  padding: 24px 18px;
  border: 1.5px dashed #cfc7b5;
  border-radius: var(--r-md);
  background: rgba(255, 253, 248, .55);
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- review ---------- */
.review-hero {
  margin-top: 16px;
  padding: 20px 18px;
  border: 1.5px solid var(--ink-deep);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.review-ring {
  width: 126px;
  height: 126px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid #7ca88a;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 9px rgba(124, 168, 138, .13);
}
.review-ring strong { font-size: 36px; line-height: 1; color: #3f6b55; }
.review-ring span { margin-top: 4px; font-size: 10px; color: #5f7f6b; }
.review-hero p { max-width: 300px; margin: 14px auto 0; font-size: 12px; line-height: 1.7; color: var(--muted); }
.review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 15px auto 0; }
.review-actions .button { width: 100%; margin-top: 0; padding: 0 12px; font-size: 15px; }

/* ---------- growth ---------- */
.growth-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 16px; }
.growth-stat {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  border: 1.5px solid rgba(23, 63, 54, .13);
  border-radius: var(--r-md);
  background: #fff;
  text-align: center;
}
.growth-stat span { font-size: 9.5px; color: var(--muted); }
.growth-stat strong { margin-top: 3px; font-size: 23px; line-height: 1.1; color: var(--ink-deep); }
.growth-stat i { font-style: normal; margin-top: 2px; font-size: 10px; color: var(--muted); }
.growth-title strong { font-size: 15px; line-height: 1.35; }
.growth-card { margin-top: 12px; }
.task-list { display: grid; gap: 9px; margin-top: 12px; }
.task-item {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 8px 10px;
  padding: 11px;
  border: 1.5px solid rgba(23, 63, 54, .11);
  border-radius: 14px;
  background: #faf8f1;
}
.task-copy { min-width: 0; }
.task-copy strong { display: block; font-size: 13px; color: var(--ink-deep); }
.task-copy small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.task-bar { grid-column: 1 / -1; height: 7px; overflow: hidden; border-radius: 99px; background: #e2ddd0; }
.task-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #83b69a, #4e8e73); transition: width .25s ease; }
.task-meta { grid-row: 1; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 3px; font-size: 10.5px; color: var(--muted); }
.task-meta b { color: #a67818; font-size: 11px; }
.task-item.is-done { border-color: #a8c9ae; background: #f2f8ef; }
.task-item.is-done .task-bar i { background: #4e8e73; }
.checkin-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.checkin-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1.5px solid #ddd7c8;
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1;
}
.checkin-cell i { font-style: normal; font-size: 13px; line-height: 1; color: transparent; }
.checkin-cell.is-active { border-color: #7ca88a; background: #e6f3e9; color: #4e8e73; }
.checkin-cell.is-active i { color: #4e8e73; }
.checkin-cell.is-today { box-shadow: 0 0 0 2px rgba(238, 106, 75, .18); }
.plan-note { margin-top: 10px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.plan-note + .button { margin-top: 12px; }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 9px 4px 8px;
  border: 1.5px solid #ddd7c8;
  border-radius: 14px;
  background: #f7f4ea;
  text-align: center;
  color: #9b9c93;
}
.badge-mark { font-size: 25px; line-height: 1; filter: grayscale(1); opacity: .45; }
.badge strong { margin-top: 5px; font-size: 9.5px; color: inherit; }
.badge small { margin-top: 2px; font-size: 8px; line-height: 1.35; color: inherit; }
.badge.is-earned { border-color: #dfc165; background: #fff8d8; color: #7a621b; }
.badge.is-earned .badge-mark { filter: none; opacity: 1; }
.due-dot { position: absolute; top: 7px; left: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 3px rgba(238, 106, 75, .14); }
.char-card.is-due { border-color: #f0b6a2; background: #fff5f0; }

/* ---------- me ---------- */
.me-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.me-stat { padding: 14px; border: 1.5px solid rgba(23, 63, 54, .13); border-radius: var(--r-md); background: #fff; }
.me-stat strong { display: block; font-size: 26px; line-height: 1.1; color: var(--ink-deep); }
.me-stat span { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.card { margin-top: 14px; padding: 16px; border: 1.5px solid rgba(23, 63, 54, .13); border-radius: var(--r-md); background: #fff; }
.card-title { font-size: 15px; font-weight: 800; color: var(--ink-deep); }
.card-head-row { display: flex; align-items: center; justify-content: space-between; }
.card-count { font-size: 12px; font-weight: 800; color: var(--coral-deep); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 0; font-size: 14px; color: var(--ink-deep); }
.setting-row + .setting-row { border-top: 1px dashed var(--line); }
.switch { position: relative; width: 50px; height: 44px; flex: none; }
.switch::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 30px; border-radius: 99px; background: #d8d2c4; transition: background .18s; }
.switch i { position: absolute; top: 10px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(23, 63, 54, .2); transition: transform .18s; }
.switch[aria-checked="true"]::before { background: var(--green); }
.switch[aria-checked="true"] i { transform: translateX(20px); }
.segmented { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: #f0ece1; }
.segmented button { min-width: 42px; min-height: 34px; padding: 0 10px; border-radius: 9px; font-size: 12px; font-weight: 700; color: var(--muted); }
.segmented button.is-active { background: #fff; color: var(--ink-deep); box-shadow: 0 1px 3px rgba(23, 63, 54, .12); }
.card-empty { margin-top: 10px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
.card .char-grid.compact { margin-top: 12px; }
.button-danger { width: 100%; margin-top: 16px; border-color: #e3a38f; background: #fff; color: #bc4f33; box-shadow: 0 4px 0 rgba(188, 79, 51, .14); }
.button-danger .icon { width: 18px; height: 18px; }
.sources { margin-top: 18px; font-size: 11.5px; color: var(--muted); }
.sources summary { padding: 8px 0; font-weight: 700; color: var(--ink-soft); }
.sources ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.8; }
.sources a { color: var(--green); }
.fine-print { margin-top: 16px; font-size: 10.5px; line-height: 1.7; color: #94a097; }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1.5px solid rgba(23, 63, 54, .13);
  background: rgba(255, 253, 248, .96);
  backdrop-filter: blur(14px);
}
.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 62px;
  color: #8b9a91;
  font-size: 9.5px;
  font-weight: 800;
}
.nav-item .icon { width: 22px; height: 22px; stroke-width: 1.8; }
.nav-item.is-active { color: var(--coral-deep); }
.nav-item.is-active::after { content: ""; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 99px; background: var(--coral); }
.nav-item:active { background: rgba(238, 106, 75, .06); }

/* ---------- lesson sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; background: rgba(15, 46, 40, .45); }
.sheet-panel {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  animation: sheet-in .24s ease;
}
@keyframes sheet-in { from { transform: translateY(4%); opacity: .55; } to { transform: none; opacity: 1; } }
.sheet-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
  border-bottom: 1.5px solid rgba(23, 63, 54, .12);
  background: var(--paper);
}
.sheet-heading { flex: 1; min-width: 0; }
.sheet-heading .eyebrow { color: var(--coral-deep); }
.sheet-heading h2 { margin-top: 3px; font-size: 17px; font-weight: 800; color: var(--ink-deep); }
.stage-bar { flex: none; display: flex; gap: 6px; padding: 10px 14px 8px; }
.stage-seg { flex: 1; padding: 4px 0; }
.stage-seg .seg-track { display: block; height: 6px; border-radius: 99px; background: #e6e0d3; transition: background .2s; }
.stage-seg .seg-label { display: block; margin-top: 5px; font-size: 9.5px; font-weight: 700; text-align: center; color: #9aa69d; }
.stage-seg.is-done .seg-track { background: #8fbb9c; }
.stage-seg.is-active .seg-track { background: var(--coral); }
.stage-seg.is-active .seg-label { color: var(--coral-deep); }
.stage-seg:disabled { opacity: .8; }
.sheet-body { flex: 1; overflow-y: auto; padding: 12px 16px 20px; -webkit-overflow-scrolling: touch; }
.sheet-footer {
  flex: none;
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  border-top: 1.5px solid rgba(23, 63, 54, .12);
  background: var(--paper);
}
.lesson-hint { margin-bottom: 9px; font-size: 11.5px; text-align: center; color: var(--muted); }

.lesson-card { padding: 18px; border: 1.5px solid rgba(23, 63, 54, .14); border-radius: var(--r-lg); background: #fff; }
.lesson-card + .lesson-card { margin-top: 12px; }
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.action-grid.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.action-grid .button { padding: 0 10px; font-size: 14px; }
.action-grid.three .button { font-size: 12.5px; min-height: 48px; }
.sound-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border: 1.5px solid rgba(23, 63, 54, .14);
  border-radius: 15px;
  background: #f7f4ea;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-deep);
  text-align: left;
}
.sound-row + .sound-row { margin-top: 9px; }
.sound-row .icon { width: 19px; height: 19px; color: var(--green); }
.sound-row .sound-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-row .hanzi { font-size: 17px; }
.tip { margin-top: 12px; padding: 12px; border-radius: 13px; background: #edf4e8; font-size: 11.5px; line-height: 1.75; color: #5f7566; }

/* meet */
.sound-stack { margin-top: 12px; }
.meet-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 205px;
  padding: 18px 16px 16px;
  border: 1.5px solid #dcc9a3;
  border-radius: 22px;
  background-color: #fff8e7;
  background-image:
    linear-gradient(to right, transparent calc(50% - .5px), #e8d9ba 50%, transparent calc(50% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px), #e8d9ba 50%, transparent calc(50% + .5px));
}
.meet-char {
  display: grid;
  place-items: center;
  font-family: var(--font-hanzi);
  font-size: 150px;
  line-height: 1;
  color: var(--ink-deep);
  transition: transform .18s;
}
.meet-char:active { transform: scale(1.03); }
.meet-char.is-speaking { color: var(--coral); }
.meet-pinyin { margin-top: 8px; padding: 3px 14px; border-radius: 9px; background: var(--paper); border: 1.5px solid #e4d4b2; color: var(--coral-deep); font-size: 19px; font-weight: 800; letter-spacing: .02em; }
.meet-title { margin-top: 14px; font-size: 20px; font-weight: 800; color: var(--ink-deep); text-align: center; }
.meet-title .hanzi { font-size: 24px; }
.meet-desc { margin-top: 6px; font-size: 12.5px; line-height: 1.75; color: var(--muted); text-align: center; }

/* 汉字小时候入口 */
.origin-jump {
  width: 100%;
  margin-top: 14px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid #dcc9a3;
  border-radius: 15px;
  background: #fff8e7;
  text-align: left;
  transition: transform .16s, background .16s;
}
.origin-jump:active { transform: scale(.992); background: #fff2d6; }
.origin-jump-art {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #eadcbe;
  border-radius: 11px;
  background: #fff;
  font-size: 22px;
  line-height: 1;
}
.origin-jump-copy { flex: 1; min-width: 0; }
.origin-jump-copy strong { display: block; font-size: 13.5px; font-weight: 800; line-height: 1.35; color: var(--ink-deep); }
.origin-jump-copy small { display: block; margin-top: 2px; font-size: 10.5px; color: #8d7a56; }
.origin-jump > .icon { width: 18px; height: 18px; color: var(--coral); }

/* 字形来历卡片 */
.origin-card {
  margin-top: 12px;
  padding: 15px 14px 14px;
  border: 1.5px solid rgba(23, 63, 54, .14);
  border-radius: var(--r-lg);
  background: #fffdf6;
  scroll-margin-top: 10px;
}
.origin-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.origin-head .eyebrow { color: #a4834c; }
.origin-head h3 { margin-top: 2px; font-size: 15.5px; font-weight: 800; line-height: 1.4; color: var(--ink-deep); }
.origin-listen {
  flex: none;
  min-height: 34px;
  padding: 0 10px;
  border-width: 1.5px;
  border-color: #e4d4b2;
  background: #fff;
  font-size: 11px;
  box-shadow: none;
}
.origin-listen .icon { width: 15px; height: 15px; }
.origin-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.origin-arrow { display: none; }
.origin-stage {
  min-width: 0;
  min-height: 96px;
  padding: 8px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1.5px solid #e4d4b2;
  border-radius: 13px;
  background: #fff;
  color: #7c8d81;
  transition: border-color .16s, background .16s, transform .16s, box-shadow .16s;
}
.origin-stage:active { transform: scale(.98); }
.origin-stage.is-active {
  border-color: var(--ink);
  background: #fff8e7;
  color: var(--ink);
  box-shadow: 3px 3px 0 rgba(23, 63, 54, .1);
}
.origin-stage-art { height: 46px; display: grid; place-items: center; }
.origin-emoji { font-size: 30px; line-height: 1; }
.origin-modern { color: var(--ink-deep); font-family: var(--font-hanzi); font-size: 38px; font-weight: 400; line-height: 1; }
.origin-art-svg { display: block; width: 44px; height: 44px; }
.origin-stage-label { font-size: 8px; font-weight: 800; color: #8a7040; letter-spacing: .02em; }
.origin-stage.is-active .origin-stage-label { color: var(--coral-deep); }
.origin-caption {
  min-height: 31px;
  margin-top: 10px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.65;
  text-align: center;
  color: var(--coral-deep);
}
.origin-caption.is-fresh { animation: origin-pop .26s ease; }
@keyframes origin-pop { from { opacity: .15; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.origin-story {
  margin-top: 8px;
  padding: 10px 11px;
  border: 1px solid #eee2ca;
  border-radius: 11px;
  background: #fff;
  font-size: 11.5px;
  line-height: 1.9;
  color: #5f7466;
}
.origin-note { margin-top: 7px; font-size: 9px; line-height: 1.7; color: #9da79d; }

/* 合体字 */
.build-formula { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; }
.build-part {
  min-width: 54px;
  min-height: 76px;
  padding: 7px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1.5px solid #e4d4b2;
  border-radius: 12px;
  background: #fff;
}
.build-part b { color: var(--ink-deep); font-family: var(--font-hanzi); font-size: 28px; font-weight: 400; line-height: 1; }
.build-part small { font-size: 8px; color: #8a968c; text-align: center; }
.build-part.result { border-color: #d8b75e; background: #fff3bd; }
.build-op { color: #b39a68; font-size: 15px; font-weight: 800; }

/* 字义小剧场 */
.meaning-scene {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 11px;
  border: 1.5px solid #e4d4b2;
  border-radius: 13px;
  background: #fff;
}
.meaning-emoji { flex: none; font-size: 40px; line-height: 1; }
.meaning-text { flex: 1; min-width: 0; }
.meaning-text b { display: block; color: var(--ink-deep); font-family: var(--font-hanzi); font-size: 29px; font-weight: 400; line-height: 1.1; }
.meaning-word { color: var(--coral-deep); font-size: 10px; font-weight: 800; }
.meaning-text p { margin-top: 2px; font-size: 10.5px; line-height: 1.7; color: #6f8176; }

/* 跟读录音 */
#meet-mic.is-listening { background: #ffe4dc; color: #bc6045; border-color: #f0b6a2; }
.speak-panel { margin-top: 12px; }
.speak-waiting, .speak-live {
  padding: 10px 12px;
  border: 1px solid #eed0bf;
  border-radius: 12px;
  background: #fff4ec;
  color: #9a6045;
  font-size: 11px;
  line-height: 1.7;
}
.speak-waiting { display: flex; align-items: center; gap: 8px; }
.speak-live-row { display: flex; align-items: center; gap: 8px; }
.listen-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); animation: listen-pulse 1.1s ease-in-out infinite; }
@keyframes listen-pulse { 50% { opacity: .35; transform: scale(.72); } }
.speak-target { margin-left: auto; color: var(--ink-deep); font-family: var(--font-hanzi); font-size: 25px; line-height: 1; }
.speak-progress { height: 6px; margin-top: 8px; border-radius: 99px; background: #f0dfd2; overflow: hidden; }
.speak-progress i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--coral); animation: record-run 5s linear forwards; }
@keyframes record-run { from { width: 100%; } to { width: 0%; } }
.speak-hint { margin-top: 6px; font-size: 9.5px; color: #9b7c6a; }
.speak-result {
  padding: 11px 12px;
  border: 1px solid #cfdcc7;
  border-radius: 13px;
  background: #f4f9f0;
}
.speak-result-head, .speak-success-head { display: flex; align-items: center; gap: 9px; }
.speak-result-icon, .speak-success-mark {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dfeede;
  color: #4d8465;
}
.speak-result-icon .icon, .speak-success-mark .icon { width: 17px; height: 17px; }
.speak-result strong, .speak-error strong, .speak-success strong { display: block; font-size: 12px; color: #47785b; }
.speak-result p, .speak-error p, .speak-success p { margin-top: 2px; font-size: 10px; line-height: 1.65; color: #6f8876; }
.speak-audio { width: 100%; height: 36px; margin-top: 9px; }
.speak-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.speak-actions .button { flex: 1 1 auto; min-height: 40px; padding: 0 8px; font-size: 11.5px; box-shadow: none; }
.speak-actions .icon { width: 15px; height: 15px; }
.speak-note { margin-top: 7px; font-size: 9.5px; line-height: 1.65; color: #93a094; }
.speak-error {
  padding: 11px 12px;
  border: 1px solid #efc3b1;
  border-radius: 13px;
  background: #fff1e8;
}
.speak-error strong { color: #a5563c; }
.speak-error p { color: #9d705d; }
.speak-success {
  padding: 12px;
  border: 1px solid #b9d5c0;
  border-radius: 13px;
  background: #eaf6e9;
}
.speak-success-mark { background: #cfe8cf; color: #3f7f56; }
.speak-success strong { color: #3d6f50; font-size: 12.5px; }
.speak-success p { color: #6a8a72; }

/* word */
.word-visual { text-align: center; padding: 8px 0 14px; }
.word-visual .word-emoji { font-size: 56px; line-height: 1.2; }
.word-big { margin-top: 8px; font-family: var(--font-hanzi); font-size: 58px; line-height: 1.2; color: var(--ink-deep); }
.word-note { margin-top: 6px; font-size: 12px; color: var(--muted); }
.sentence { font-family: var(--font-hanzi); font-size: 22px; line-height: 2; color: var(--ink-deep); }
.sentence mark { padding: 0 3px; border-radius: 5px; background: #fff0df; color: var(--coral-deep); }

/* write / trace */
.trace-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid #d2bea0;
  border-radius: 16px;
  background-color: #fffdf7;
  background-image:
    linear-gradient(to right, transparent calc(50% - .5px), #d8c8ad 50%, transparent calc(50% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px), #d8c8ad 50%, transparent calc(50% + .5px)),
    linear-gradient(to right, transparent calc(25% - .5px), #ecdfc9 25%, transparent calc(25% + .5px)),
    linear-gradient(to bottom, transparent calc(25% - .5px), #ecdfc9 25%, transparent calc(25% + .5px)),
    linear-gradient(to right, transparent calc(75% - .5px), #ecdfc9 75%, transparent calc(75% + .5px)),
    linear-gradient(to bottom, transparent calc(75% - .5px), #ecdfc9 75%, transparent calc(75% + .5px));
  touch-action: none;
}
.trace-guide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-hanzi);
  font-size: clamp(170px, 62vw, 320px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 3px #ddcdb4;
  user-select: none;
  transition: opacity .18s;
}
.trace-guide.is-hidden { opacity: 0; }
.trace-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.write-tip { margin-top: 12px; font-size: 12px; line-height: 1.7; color: var(--muted); text-align: center; }

/* quiz */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quiz-question { display: flex; align-items: center; gap: 8px; min-width: 0; }
.quiz-question h3 { min-width: 0; }
.quiz-speak {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(23, 63, 54, .16);
  border-radius: 11px;
  background: #f4f1e6;
  color: var(--green);
}
.quiz-speak:active { transform: translateY(1px); }
.quiz-speak .icon { width: 18px; height: 18px; }
.quiz-head h3 { font-size: 17px; font-weight: 800; color: var(--ink-deep); }
.quiz-dots { display: flex; gap: 5px; }
.quiz-dots span { width: 8px; height: 8px; border-radius: 50%; background: #e0ddd2; }
.quiz-dots span.is-done { background: #8fbb9c; }
.quiz-dots span.is-active { background: var(--coral); transform: scale(1.22); }
.review-dots { display: flex; gap: 5px; }
.review-dots span { width: 7px; height: 7px; border-radius: 50%; background: #e0ddd2; transition: .2s; }
.review-dots span.is-done { background: #8fbb9c; }
.review-dots span.is-active { width: 18px; border-radius: 99px; background: var(--coral); }
.quiz-visual { margin: 8px 0 4px; text-align: center; }
.quiz-char {
  display: inline-grid;
  place-items: center;
  font-family: var(--font-hanzi);
  font-size: 122px;
  line-height: 1;
  color: var(--ink-deep);
}
.quiz-equation { font-family: var(--font-hanzi); font-size: 74px; line-height: 1.15; color: var(--ink-deep); }
.quiz-audio {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 112px;
  height: 112px;
  margin: 4px auto 2px;
  border: 2px solid var(--ink-deep);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 7px 0 #d2a51f;
  color: var(--ink-deep);
  font-size: 11.5px;
  font-weight: 800;
}
.quiz-audio:active { transform: translateY(3px); box-shadow: 0 4px 0 #d2a51f; }
.quiz-audio .icon { width: 32px; height: 32px; }
.quiz-prompt { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.quiz-options { display: grid; gap: 10px; margin-top: 14px; }
.quiz-options.cols-3 { grid-template-columns: repeat(3, 1fr); }
.quiz-options.cols-2 { grid-template-columns: repeat(2, 1fr); }
.quiz-options.cols-1 { grid-template-columns: 1fr; }
.quiz-option {
  min-height: 62px;
  padding: 6px 8px;
  border: 1.5px solid rgba(23, 63, 54, .16);
  border-radius: 16px;
  background: #fff;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-deep);
}
.quiz-option.is-char { min-height: 86px; font-family: var(--font-hanzi); font-size: 46px; }
.quiz-option.is-word { font-family: var(--font-hanzi); font-size: 26px; min-height: 66px; }
.quiz-option:active:not(:disabled) { transform: translateY(2px); }
.quiz-option.correct { border-color: #6c9c7c; background: #e4f2e7; color: #3f7351; }
.quiz-option.wrong { border-color: #e59a80; background: #fff0e9; color: #ba6b50; animation: shake .3s; }
.quiz-option:disabled:not(.correct):not(.wrong) { opacity: .45; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.quiz-feedback { min-height: 50px; margin-top: 13px; padding: 12px; border-radius: 14px; font-size: 13px; line-height: 1.7; }
.quiz-feedback.success { background: #e8f4e9; color: #4f7c5c; }
.quiz-feedback.retry { background: #fff1e6; color: #9e704f; }
.quiz-feedback strong { display: block; margin-bottom: 2px; font-size: 13.5px; }
.quiz-feedback .hanzi { font-size: 15px; }

/* done + review summary */
.done-card { display: flex; flex-direction: column; align-items: center; padding: 12px 0 4px; text-align: center; }
.done-char {
  width: 142px;
  height: 142px;
  display: grid;
  place-items: center;
  border: 2px solid #dfc165;
  border-radius: 50%;
  background: #fff2ba;
  box-shadow: 0 0 0 10px rgba(255, 210, 87, .16);
  font-family: var(--font-hanzi);
  font-size: 94px;
  line-height: 1;
  color: var(--ink-deep);
}
.done-card h3 { margin-top: 20px; font-size: 21px; font-weight: 800; color: var(--ink-deep); }
.done-card p { margin-top: 8px; font-size: 12.5px; line-height: 1.8; color: var(--muted); }
.done-stars { display: flex; gap: 7px; margin-top: 14px; font-size: 26px; color: #e0ac35; }
.done-stars i { font-style: normal; }
.done-stars i.dim { color: #ded5c0; }
.done-next { margin-top: 16px; padding: 10px 16px; border-radius: 13px; background: #f2ede1; font-size: 13px; color: var(--ink-soft); }
.done-next strong { font-family: var(--font-hanzi); font-size: 19px; color: var(--ink-deep); }
.review-done-mark { width: 116px; height: 116px; display: grid; place-items: center; border: 2px solid #7ca88a; border-radius: 50%; background: #e4f2e7; color: #4e8e73; }
.review-done-mark .icon { width: 50px; height: 50px; }

/* random review */
.random-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  margin: 4px 0 0;
  padding: 16px 16px 18px;
  border: 1.5px solid rgba(23, 63, 54, .16);
  border-radius: 26px;
  background: linear-gradient(180deg, #fffef9, #fff);
  box-shadow: 0 4px 0 rgba(23, 63, 54, .07);
}
.random-card::before {
  content: "";
  position: absolute;
  top: -74px;
  right: -58px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--tint, #f0ece1);
  opacity: .8;
}
.random-theme {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  padding: 5px 10px;
  border: 1px solid rgba(23, 63, 54, .1);
  border-radius: 99px;
  background: rgba(255, 255, 255, .72);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-soft);
}
.random-char {
  position: relative;
  z-index: 1;
  width: min(50vw, 200px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 12px auto 2px;
  border: 2px solid #dcc9a3;
  border-radius: 28px;
  background-color: #fff8e7;
  background-image:
    linear-gradient(rgba(23, 63, 54, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 63, 54, .05) 1px, transparent 1px);
  background-size: 25% 25%;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, .55), 0 5px 0 rgba(220, 201, 163, .45);
  font-family: var(--font-hanzi);
  font-size: clamp(96px, 34vw, 148px);
  line-height: 1;
  color: var(--ink-deep);
  transition: transform .12s ease;
}
.random-char:active { transform: scale(.975); }
.random-answer {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 106px;
  margin-top: 12px;
  text-align: center;
  transition: opacity .18s ease, transform .18s ease;
}
.random-answer.is-hidden { opacity: 0; visibility: hidden; transform: translateY(4px); }
.random-pinyin { font-size: 19px; font-weight: 800; letter-spacing: .12em; color: var(--coral-deep); }
.random-word { margin-top: 5px; font-size: 12.5px; color: var(--ink-soft); }
.random-word strong { margin-left: 5px; font-family: var(--font-hanzi); font-size: 21px; color: var(--ink-deep); }
.random-sentence { max-width: 270px; margin: 8px auto 0; padding: 9px 12px; border-radius: 12px; background: #f6f2e7; font-size: 12px; line-height: 1.65; color: var(--ink-soft); }
.random-note { position: relative; z-index: 1; margin-top: 9px; font-size: 11px; color: var(--muted); text-align: center; }
.random-actions { display: grid; grid-template-columns: 1fr 1.15fr; gap: 10px; }
.random-actions .button { min-height: 54px; padding: 0 12px; font-size: 14px; }

/* toast + confetti */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  padding: 11px 18px;
  border-radius: 99px;
  background: rgba(15, 46, 40, .94);
  color: #f6f0df;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity .22s, transform .22s;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; z-index: 80; overflow: hidden; pointer-events: none; }
.confetti span { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .1; } }

/* ---------- larger screens ---------- */
@media (min-width: 700px) {
  .app-topbar { padding-left: max(16px, calc((100vw - 560px) / 2)); padding-right: max(16px, calc((100vw - 560px) / 2)); }
  .app-main { padding-bottom: 110px; }
  .bottom-nav {
    left: 50%;
    right: auto;
    bottom: 14px;
    width: min(440px, calc(100vw - 32px));
    transform: translateX(-50%);
    border: 1.5px solid rgba(23, 63, 54, .16);
    border-radius: 22px;
    box-shadow: 0 10px 26px rgba(23, 63, 54, .16);
    overflow: hidden;
  }
  .sheet { align-items: center; }
  .sheet-panel {
    width: min(560px, calc(100vw - 40px));
    height: min(92vh, 880px);
    height: min(92dvh, 880px);
    border: 2px solid var(--ink);
    border-radius: 26px;
    box-shadow: 10px 14px 0 rgba(23, 63, 54, .18);
    overflow: hidden;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- boot / login gate ---------- */
#app-shell { min-height: 100vh; }

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 210, 87, .22), transparent 42%),
    radial-gradient(circle at 86% 4%, rgba(238, 106, 75, .14), transparent 38%),
    var(--canvas);
}
.boot-card { display: grid; justify-items: center; gap: 13px; text-align: center; }
.boot-mark { width: 66px; height: 66px; font-size: 40px; border-radius: 21px; box-shadow: 6px 6px 0 rgba(23, 63, 54, .16); }
.boot-title { font-family: var(--font-hanzi); font-size: 22px; font-weight: 700; color: var(--ink-deep); letter-spacing: .04em; }
.boot-message { font-size: 12.5px; color: var(--muted); }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 30px) 20px calc(env(safe-area-inset-bottom, 0px) + 26px);
  background:
    radial-gradient(circle at 14% 4%, rgba(255, 210, 87, .22), transparent 44%),
    radial-gradient(circle at 88% 0%, rgba(238, 106, 75, .15), transparent 40%),
    var(--canvas);
}
.auth-card {
  width: min(420px, 100%);
  margin: auto 0;
  padding: 24px 20px 22px;
  border: 1.5px solid rgba(23, 63, 54, .14);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 6px 8px 0 rgba(23, 63, 54, .10);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand .brand-mark { width: 46px; height: 46px; font-size: 29px; border-radius: 15px; }
.auth-brand strong { display: block; font-size: 17px; font-weight: 800; color: var(--ink-deep); letter-spacing: .01em; }
.auth-brand small { display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 16px;
  background: #f0ece1;
}
.auth-tabs button {
  min-height: 44px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
}
.auth-tabs button.is-active { background: #fff; color: var(--ink-deep); box-shadow: 0 2px 6px rgba(23, 63, 54, .10); }
.auth-field { display: grid; gap: 7px; margin-bottom: 14px; }
.auth-field label { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.auth-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1.5px solid #d9d2c2;
  border-radius: 14px;
  background: #fff;
  font-size: 16px;
  color: var(--ink-deep);
}
.auth-field input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(78, 142, 115, .15);
}
.auth-input-wrap { position: relative; }
.auth-input-wrap input { padding-right: 66px; }
.auth-reveal {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 52px;
  min-height: 38px;
  transform: translateY(-50%);
  border-radius: 10px;
  background: #eef4ea;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}
.auth-hint { margin: 2px 0 0; font-size: 11.5px; line-height: 1.7; color: var(--muted); }
.auth-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #f0b6a2;
  border-radius: 12px;
  background: #fff1ec;
  color: #b0442c;
  font-size: 12.5px;
  line-height: 1.6;
}
#auth-form .button { margin-top: 16px; }
.auth-retry {
  display: block;
  margin: 12px auto 0;
  min-height: 40px;
  padding: 0 12px;
  color: var(--green);
  font-size: 12.5px;
  font-weight: 800;
  text-decoration: underline;
}
.auth-foot {
  max-width: 420px;
  margin: 16px 0 0;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- account card ---------- */
.account-card { margin-top: 16px; }
.account-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.account-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  background: var(--mint);
  color: var(--ink-deep);
  font-family: var(--font-hanzi);
  font-size: 26px;
}
.account-copy { display: grid; gap: 3px; min-width: 0; }
.account-copy strong { font-size: 15px; color: var(--ink-deep); overflow-wrap: anywhere; }
.account-copy small { font-size: 10.5px; color: var(--muted); }
.sync-line { font-style: normal; font-size: 10.5px; color: var(--green); }
.sync-line[data-state="syncing"] { color: #9a7b1e; }
.sync-line[data-state="error"],
.sync-line[data-state="expired"] { color: var(--coral-deep); }

