/* 海星中文 — tide-pool palette: sea-glass neutrals, one coral accent (the starfish).
   Layout: iPad first. Landscape splits study card | side panel; portrait and phone stack. Floating tab bar at the bottom. */
:root {
  --bg: #edf3f2; --surface: #f8fbfa; --surface-2: #e1eae9; --fg: #10232a; --muted: #586d71; --line: #cbdad8;
  --accent: #b9503e; --accent-ink: #fff; --accent-soft: #f5dfd8;
  --ok: #2b7a4b; --bad: #b0412e;
  --ink: #10232a; --grid: #b7cbc8; --shadow: 18 52 60;
  --star: #ee8b6e; --star-dot: #ffd2c3; --star-ink: #2a1714;
  --t1: #c0392b; --t2: #b9770b; --t3: #2e7d32; --t4: #1f5fa8; --t5: #7a8784;
  --ui: "Plus Jakarta Sans", system-ui, sans-serif;
  --hanzi: "Noto Serif SC", "Songti SC", serif;
  --zh: "Noto Sans SC", "PingFang SC", sans-serif;
  --py: "Noto Sans", system-ui, sans-serif;
  --r-lg: 28px; --r-md: 16px; --r-sm: 10px;
  --tabbar: 76px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1a20; --surface: #11252c; --surface-2: #173038; --fg: #e2eded; --muted: #8fa5a8; --line: #22404a;
    --accent: #ee927b; --accent-ink: #1b0f0b; --accent-soft: #3b2520;
    --ok: #7dcd97; --bad: #ff9a84;
    --ink: #e2eded; --grid: #2c4b53; --shadow: 0 0 0;
    --t1: #ff7b6b; --t2: #f2b84b; --t3: #7cd17f; --t4: #79aef0; --t5: #8f9c99;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; color: var(--fg); font: 400 17px/1.55 var(--ui);
  background:
    radial-gradient(1100px 600px at 92% -12%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 700px at -15% 115%, var(--surface-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  padding-bottom: calc(var(--tabbar) + 32px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
body::after { /* grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.defs { position: absolute; }
.shell { width: 100%; max-width: 1240px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); position: relative; z-index: 2; }
.shell.narrow { max-width: 860px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }

h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
p { margin: 0; text-wrap: pretty; }
.lede { font-size: 1.12rem; max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.ok { color: var(--ok); font-weight: 600; } .bad { color: var(--bad); font-weight: 600; }
.zh { font-family: var(--zh); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; } .row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.tone1 { color: var(--t1); } .tone2 { color: var(--t2); } .tone3 { color: var(--t3); } .tone4 { color: var(--t4); } .tone5 { color: var(--t5); }

/* ---------- controls ---------- */
button, input, select { font: inherit; color: inherit; }
.btn {
  min-height: 52px; padding: 0 22px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .2s cubic-bezier(.2,.8,.2,1.2), background-color .2s, box-shadow .2s;
  box-shadow: 0 1px 0 rgb(var(--shadow) / .06);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgb(var(--shadow) / .35); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.wide { grid-column: 1 / -1; }
kbd { font: 500 .72rem var(--ui); opacity: .55; border: 1px solid currentColor; border-radius: 5px; padding: 0 5px; }
@media (hover: none) { kbd { display: none; } }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
a { color: var(--accent); }
input, select {
  min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; width: 100%; min-width: 0;
}
input { font-size: 1.15rem; }
select { width: auto; max-width: 100%; padding-right: 10px; }
label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 500; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg button { border: 0; background: none; min-height: 36px; padding: 0 12px; border-radius: 9px; font-weight: 600; font-size: .85rem; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgb(var(--shadow) / .15); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; transition: background-color .2s, color .2s;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.play {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-weight: 600; cursor: pointer;
}
.play svg { width: 18px; height: 18px; fill: var(--accent); }
.play .i-pause, .play.playing .i-play { display: none; } .play.playing .i-pause { display: inline; }
.play.loading svg { opacity: .35; }
@media (prefers-reduced-motion: no-preference) { .play.loading svg { animation: pulse 1s ease-in-out infinite; } @keyframes pulse { 50% { opacity: 1; } } }
.player { display: inline-flex; gap: 6px; align-items: center; }
.speed { min-height: 44px; min-width: 56px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 600 .85rem var(--ui); font-variant-numeric: tabular-nums; cursor: pointer; }
.play:active { transform: scale(.97); }

/* ---------- header ---------- */
.top { display: flex; justify-content: space-between; align-items: center; padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand b { font: 700 1.35rem var(--hanzi); letter-spacing: .04em; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: .8rem; }
.mascot { width: 42px; height: 42px; flex: none; }
.mascot.big { width: 92px; height: 92px; }
@media (prefers-reduced-motion: no-preference) {
  .mascot.big, .mascot.hero { animation: bob 3.2s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translateY(-6px) rotate(-7deg); } }
}

/* ---------- sign-in ---------- */
.login { display: grid; gap: 40px; align-items: center; min-height: calc(100dvh - 180px); padding-block: 24px 48px; }
.hero-zh { font: 700 clamp(5.5rem, 17vw, 11rem)/.9 var(--hanzi); letter-spacing: .02em; position: relative; display: inline-block; }
.mascot.hero { position: absolute; width: .62em; height: .62em; right: -.38em; top: -.18em; }
.login-hero h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 18px 0 10px; }
.login-panel { background: var(--surface); border-radius: var(--r-lg); padding: clamp(24px, 4vw, 40px); display: grid; gap: 14px; box-shadow: 0 30px 60px -36px rgb(var(--shadow) / .45); }
.login-panel h2 { font-size: 1.4rem; }
#login-msg:empty { display: none; }
@media (min-width: 900px) { .login { grid-template-columns: 1.15fr 1fr; gap: 72px; } }

/* ---------- vocabulary ---------- */
.review { display: grid; gap: 24px; align-items: start; }
@media (min-width: 960px) { .review { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 32px; } .side { position: sticky; top: 20px; } }
.stage { display: grid; gap: 14px; min-width: 0; }
.card {
  background: var(--surface); border-radius: var(--r-lg); padding: clamp(24px, 4vw, 44px);
  min-height: min(560px, 62dvh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
  box-shadow: 0 1px 0 rgb(var(--shadow) / .05), 0 40px 80px -48px rgb(var(--shadow) / .55); position: relative;
}
.card .tag { position: absolute; top: 22px; left: 26px; font-size: .78rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.card .tag em { font-style: normal; color: var(--accent); }
.hz { font: 500 clamp(4.2rem, 12vw, 8.6rem)/1.05 var(--hanzi); letter-spacing: .03em; }
.py { font: 600 clamp(1.3rem, 2.6vw, 1.9rem) var(--py); letter-spacing: .03em; }
.gloss { font-size: clamp(1.2rem, 2.4vw, 1.6rem); font-weight: 500; max-width: 26ch; }
.ask { color: var(--muted); font-size: 1.05rem; }
.card form { width: min(100%, 380px); flex-wrap: nowrap; }
.card .mono { font-family: var(--py); text-align: center; letter-spacing: .04em; }
.card.empty h2 { font: 700 2.4rem var(--hanzi); }
.writer { display: flex; gap: 16px; justify-content: center; width: 100%; }
.writer .cell {
  border-radius: 18px; background: var(--surface-2); touch-action: none;
  background-image: linear-gradient(var(--grid), var(--grid)), linear-gradient(var(--grid), var(--grid));
  background-size: 100% 1px, 1px 100%; background-position: center; background-repeat: no-repeat;
  transition: box-shadow .2s;
}
.writer .cell.active { box-shadow: 0 0 0 2.5px var(--accent); }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.actions:empty { display: none; }
.btn.grade { flex-direction: column; gap: 0; min-height: 68px; }
.btn.grade span { display: flex; gap: 6px; align-items: center; }
.btn.grade small { font-weight: 500; font-size: .78rem; opacity: .75; }

.side { display: grid; gap: 18px; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-md); overflow: hidden; }
.stats div { background: var(--surface); padding: 14px 16px; display: grid; }
.stats b { font: 600 1.7rem/1.1 var(--ui); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stats b small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stats span { color: var(--muted); font-size: .82rem; }
.filters { display: grid; gap: 10px; }
.panel { background: var(--surface); border-radius: var(--r-md); padding: 18px; display: grid; gap: 12px; }

/* ---------- Chinese input ---------- */
.zhf { display: grid; gap: 8px; min-width: 0; container-type: inline-size; }
.zhf-row { display: flex; gap: 8px; }
.zhf-row input { flex: 1; font-family: var(--zh); }
.zhf-row .chip { font: 500 1.05rem var(--zh); padding: 0; width: 52px; min-height: 52px; }
.zhf-cands { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 6px; background: var(--surface-2); border-radius: 14px; scrollbar-width: none; }
.zhf-cands .buf { font: 600 1rem var(--py); color: var(--accent); padding: 0 8px; white-space: nowrap; }
.cand { min-width: 52px; min-height: 52px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--surface); font: 500 1.35rem var(--zh); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; flex: none; }
.cand small { font: 500 .7rem var(--ui); color: var(--muted); }
.cand.nav { font-family: var(--ui); color: var(--muted); }
.cand.big { font-size: 1.7rem; min-width: 60px; min-height: 60px; justify-content: center; }
.zhf-pad { display: grid; gap: 12px; align-items: start; min-width: 0; }
.zhf-pad canvas { width: 100%; max-width: 300px; aspect-ratio: 1; justify-self: center; border-radius: 16px; background: var(--surface-2); touch-action: none; cursor: crosshair; }
.pad-side { display: grid; gap: 8px; min-width: 0; }
.pad-cands { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pad-cands .cand { min-width: 0; background: var(--surface-2); }
.pad-tools { display: flex; gap: 6px; flex-wrap: wrap; }
@container (min-width: 540px) { .zhf-pad { grid-template-columns: 280px minmax(0, 1fr); } }

/* ---------- reading, grammar ---------- */
.bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 12px; }
.split { display: grid; gap: 24px; margin-top: 20px; align-items: start; }
@media (min-width: 960px) { .split:has(.passage, .lesson) { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); } }
.passage, .lesson, .questions, .exercises { background: var(--surface); border-radius: var(--r-lg); padding: clamp(20px, 3vw, 32px); display: grid; gap: 14px; min-width: 0; }
.passage .read { font-size: 1.45rem; line-height: 2; }
.passage h2, .lesson h2 { font-size: 1.6rem; }
.formula { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 14px; font-size: 1.05rem; }
details { border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.q { display: grid; gap: 8px; }
.q p.zh { font-size: 1.15rem; }
.opt { text-align: left; min-height: 52px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font: 1.1rem var(--zh); cursor: pointer; }
.opt.right { border-color: var(--ok); color: var(--ok); } .opt.wrong { border-color: var(--bad); color: var(--bad); }
.example { display: grid; gap: 2px; padding-block: 10px; border-top: 1px solid var(--line); justify-items: start; }
.example .zh { font-size: 1.2rem; }
.ex { display: grid; gap: 8px; padding-block: 12px; border-top: 1px solid var(--line); }
.ex form { grid-template-columns: 1fr auto; align-items: start; }
.empty-state { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 48px 20px; color: var(--muted); max-width: 46ch; margin: 0 auto; }

/* ---------- tutor ---------- */
.log { display: grid; gap: 12px; margin-top: 16px; }
.msg { padding: 14px 16px; border-radius: 20px; max-width: min(88%, 640px); min-width: 0; display: grid; gap: 4px; justify-items: start; }
.msg.me { background: var(--accent); color: var(--accent-ink); justify-self: end; border-bottom-right-radius: 6px; }
.msg.ai { background: var(--surface); border-bottom-left-radius: 6px; }
.msg .zh { font-size: 1.25rem; line-height: 1.7; }
.msg .fix { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); width: 100%; }
.composer {
  margin-top: 16px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; padding: 10px; border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); box-shadow: 0 20px 40px -24px rgb(var(--shadow) / .5);
}

/* ---------- loading ---------- */
.skeleton { display: grid; gap: 8px; width: 100%; min-width: 220px; }
.skeleton span { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; }
.skeleton span:nth-child(2) { width: 82%; } .skeleton span:nth-child(3) { width: 58%; }
.skeleton p { color: var(--muted); font-size: .85rem; }
@media (prefers-reduced-motion: no-preference) { .skeleton span { animation: shimmer 1.4s linear infinite; } @keyframes shimmer { to { background-position: -200% 0; } } }

/* ---------- footer, tab bar ---------- */
.foot { margin-top: 56px; display: grid; gap: 16px; }
.foot h2 { font-size: 1.15rem; }
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; background: var(--line); border-radius: var(--r-md); overflow: hidden; }
.how li { background: var(--surface); padding: 14px 18px; display: grid; gap: 2px; }
@media (min-width: 760px) { .how { grid-template-columns: repeat(2, 1fr); } .how li:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.how li span { color: var(--muted); font-size: .92rem; max-width: 60ch; }
.credits { margin-top: 24px; }
.tabs {
  position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex; gap: 4px; padding: 6px; border-radius: 24px; height: var(--tabbar);
  background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent), 0 24px 48px -20px rgb(var(--shadow) / .45);
}
.tabs a {
  width: clamp(72px, 19vw, 104px); border-radius: 18px; display: grid; place-items: center; align-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 600; transition: background-color .2s, color .2s;
}
.tabs a svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.toast {
  position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 28px + env(safe-area-inset-bottom));
  width: min(560px, calc(100% - 32px)); padding: 14px 18px; border-radius: 16px; background: var(--fg); color: var(--bg); font-size: .92rem;
  box-shadow: 0 20px 40px -20px rgb(var(--shadow) / .6);
}

.toast { display: flex; gap: 12px; align-items: start; }
.toast span { flex: 1; }
.toast button, .x { border: 0; background: none; color: inherit; font: 600 1.3rem/1 var(--ui); min-width: 36px; min-height: 36px; cursor: pointer; opacity: .75; }
.zhf-cands .x { margin-left: auto; color: var(--muted); flex: none; }

/* levels, placement, exams */
.level p { margin: 0; }
.chip.locked { opacity: .55; display: inline-flex; align-items: center; gap: 6px; cursor: not-allowed; }
.chip.locked svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sheet { background: var(--surface); border-radius: var(--r-lg); padding: clamp(22px, 4vw, 40px); display: grid; gap: 16px; justify-items: start; }
.sheet .hz { justify-self: center; }
.sheet .ask { justify-self: center; }
.sheet .stack, .sheet .ex { width: 100%; }
.opts { display: grid; gap: 8px; width: 100%; }
@media (min-width: 640px) { .opts { grid-template-columns: 1fr 1fr; } }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt.quiet { color: var(--muted); font-family: var(--ui); }

/* speaking */
.btn.mic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.btn.mic.rec { background: var(--bad); border-color: var(--bad); color: #fff; }
@media (prefers-reduced-motion: no-preference) { .btn.mic.rec { animation: recpulse 1.2s ease-in-out infinite; } @keyframes recpulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 25%, transparent); } } }
.pron { width: 100%; display: grid; gap: 6px; text-align: left; }
.pron:empty { display: none; }
.marked { font-size: 1.35rem; line-height: 1.9; }
.marked .hit { color: var(--ok); } .marked .miss { color: var(--bad); text-decoration: underline wavy; text-underline-offset: 5px; }
.readaloud { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* daily mission */
.mbar { margin-bottom: 14px; }
.mbar-in { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border-radius: var(--r-md); padding: 8px 8px 8px 16px; }
.mbar-title { color: var(--fg); text-decoration: none; font-weight: 600; font-size: .92rem; white-space: nowrap; }
.mbar-title b { color: var(--accent); font-variant-numeric: tabular-nums; }
.mbar-track { flex: 1 1 80px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.mbar-track span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s ease; }
.btn.small-btn { min-height: 40px; padding: 0 14px; font-size: .88rem; }
.mission { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; width: 100%; }
.mission li { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r-md); background: var(--bg); }
.mission li.active { box-shadow: inset 0 0 0 2px var(--accent); }
.mission li.done { opacity: .7; }
.mission .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.mission li.active .dot { background: var(--accent); color: var(--accent-ink); }
.mission li.done .dot { background: var(--ok); color: #fff; }
.mission .dot svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mission p { margin: 2px 0 0; }
.mission .count { font-variant-numeric: tabular-nums; color: var(--muted); }
@media (max-width: 560px) { .mission li { grid-template-columns: 36px 1fr; } .mission li .btn { grid-column: 2; justify-self: start; } }

/* invite, admin, feedback */
.grow { flex: 1 1 200px; min-width: 0; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .04em; }
.code { font-size: 1.3rem; }
.stats.wide { grid-template-columns: repeat(2, 1fr); width: 100%; }
@media (min-width: 640px) { .stats.wide { grid-template-columns: repeat(4, 1fr); } }
.table { width: 100%; overflow-x: auto; }
.table table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.fb { width: 100%; padding-block: 10px; border-top: 1px solid var(--line); }
textarea { width: 100%; min-width: 0; font: inherit; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); resize: vertical; }
.link.danger { color: var(--bad); }
#fb-msg:empty, #join-msg:empty { display: none; }
.tp .opt { font: 600 1.4rem var(--py); text-align: center; letter-spacing: .1em; }

.example-line { width: 100%; max-width: 46ch; display: grid; gap: 4px; justify-items: center; padding-top: 14px; margin-top: 4px; border-top: 1px dashed var(--line); }
.example-line .zh { font-size: 1.2rem; }

/* ---------- phone ---------- */
@media (max-width: 560px) {
  body { font-size: 16px; --tabbar: 68px; }
  .shell { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .brand small { display: none; }
  .top { padding-bottom: 12px; }
  .card { min-height: min(440px, 58dvh); padding: 44px 18px 24px; border-radius: 22px; }
  .card .tag { top: 16px; left: 18px; }
  .actions { gap: 8px; }
  .btn { padding: 0 14px; }
  .btn.grade { min-height: 60px; }
  .stats b { font-size: 1.4rem; }
  .stats div { padding: 10px 12px; }
  .bar { gap: 10px; }
  .bar label { flex: 1 1 140px; }
  .bar select { width: 100%; }
  .bar .btn { flex: 1 1 100%; }
  .passage .read { font-size: 1.3rem; }
  .msg { max-width: 92%; }
  .tabs { width: calc(100% - 24px); justify-content: space-between; }
  .tabs a { width: auto; flex: 1; border-radius: 16px; }
  .login { min-height: 0; gap: 28px; padding-top: 8px; }
  .credits { padding-bottom: 8px; }
}
