/* 布局：单列、拇指友好；主要按钮放在屏幕下半部分 */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #eaefed;
  --ink: #12201c;
  --muted: #5c6b66;
  --line: #d9e1de;
  --accent: #0f6b5e;
  --accent-ink: #ffffff;
  --accent-soft: #dcefeb;
  --amber: #b45309;
  --amber-soft: #fdf0dc;
  --good: #15803d;
  --good-soft: #dcf3e3;
  --bad: #b42318;
  --bad-soft: #fde4e1;
  --who-a: #0f6b5e;
  --who-b: #7c3aed;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-en: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1418; --surface: #151f24; --surface-2: #1c282e; --ink: #e5eeeb; --muted: #93a4a0;
    --line: #26343a; --accent: #34c3ab; --accent-ink: #062b25; --accent-soft: #143a34;
    --amber: #f0a742; --amber-soft: #3a2a12; --good: #4ade80; --good-soft: #12321f;
    --bad: #f87171; --bad-soft: #3b1715; --who-a: #34c3ab; --who-b: #b79cff;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
[hidden] { display: none !important; }

#app {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 24px) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px; min-height: 100vh; min-height: 100dvh;
}
.boot { margin: 40vh auto 0; color: var(--muted); }

.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.topbar h1 { font-size: 1.25rem; margin: 0; flex: 1; letter-spacing: 0.02em; }
.topbar .streak { font-size: 0.85rem; color: var(--amber); background: var(--amber-soft); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; font-size: 1.1rem; flex: none; }
.iconbtn:focus-visible, .btn:focus-visible, .opt:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.card.hero { padding: 20px 18px; }
.eyebrow { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.04em; }
.title { font-size: 1.35rem; font-weight: 650; margin: 0; line-height: 1.35; text-wrap: balance; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.78rem; color: var(--muted); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 18px; border-radius: 14px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 1.05rem; cursor: pointer; width: 100%; text-align: center; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--accent); border-color: transparent; min-height: 44px; }
.btn.small { min-height: 40px; font-size: 0.92rem; padding: 8px 12px; width: auto; border-radius: 10px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grades .btn { font-size: 1rem; padding: 10px 6px; }
.btn.bad { background: var(--bad-soft); color: var(--bad); }
.btn.mid { background: var(--amber-soft); color: var(--amber); }
.btn.good { background: var(--good-soft); color: var(--good); }

.nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.nav button { min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 0.98rem; }

.notice { border-radius: 12px; padding: 12px 14px; font-size: 0.92rem; background: var(--amber-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); }
.notice.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.notice code { font-family: inherit; font-weight: 600; user-select: all; -webkit-user-select: all; }

/* 上课 */
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps span { font-size: 0.78rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.steps span.on { background: var(--accent); color: var(--accent-ink); }
.steps span.done { background: var(--accent-soft); color: var(--accent); }
.count { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.big-en { font-family: var(--font-en); font-size: 2.1rem; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.big-en.sent { font-size: 1.45rem; font-weight: 600; }
.ipa { font-family: var(--font-en); color: var(--muted); }
.zh { font-size: 1.08rem; }
.pos { font-size: 0.8rem; color: var(--muted); margin-right: 6px; }
.badge { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; font-weight: 600; letter-spacing: 0.02em; }
.badge.ui { background: var(--surface-2); color: var(--ink); }
.badge.error { background: var(--bad-soft); color: var(--bad); }
.badge.daily { background: var(--amber-soft); color: var(--amber); }
.note { font-size: 0.92rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }

.play { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 0.9rem; color: var(--accent); flex: none; }
.play.big { min-width: 88px; min-height: 88px; border-radius: 50%; font-size: 2rem; margin: 6px auto; display: flex; }
.play.playing { background: var(--accent-soft); border-color: var(--accent); }
.play .tri { width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent currentColor; }
.play.big .tri { border-width: 16px 0 16px 26px; margin-left: 6px; }

.ex { background: var(--surface-2); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: flex-start; }
.ex .grow p { margin: 0; }
.ex .en { font-family: var(--font-en); font-weight: 550; }

.prose p { margin: 0 0 0.7em; }
.prose p:last-child { margin-bottom: 0; }

.line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .who { font-weight: 700; width: 22px; flex: none; text-align: center; padding-top: 2px; }
.line .who.A { color: var(--who-a); }
.line .who.B { color: var(--who-b); }
.line .en { font-family: var(--font-en); font-weight: 550; font-size: 1.05rem; }
.line.active { background: var(--accent-soft); border-radius: 10px; }
.hide-zh .zhline { visibility: hidden; }

.opts { display: grid; gap: 8px; }
.opt { min-height: 52px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; font-size: 1.02rem; }
.opt.en { font-family: var(--font-en); font-weight: 550; }
.opt.right { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.opt.audio { display: flex; align-items: center; gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; }
.chip { font-family: var(--font-en); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1rem; }
.chip.used { opacity: 0.3; }
.answer-line { min-height: 52px; border: 1px dashed var(--line); border-radius: 12px; padding: 8px; }

.feedback { font-weight: 600; }
.feedback.ok { color: var(--good); }
.feedback.no { color: var(--bad); }

.bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); padding-top: 8px; }

input[type=password], input[type=search], input[type=text] { width: 100%; min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 10px 14px; font-size: 1.05rem; }
input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
label { font-size: 0.9rem; color: var(--muted); }
.err { color: var(--bad); font-size: 0.92rem; min-height: 1.4em; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.wordrow { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wordrow .en { font-family: var(--font-en); font-weight: 600; }
.lessonhead { font-size: 0.8rem; color: var(--muted); padding-top: 12px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tr.here td { background: var(--accent-soft); }
h2 { font-size: 1.1rem; margin: 6px 0 0; }
h3 { font-size: 1rem; margin: 4px 0 0; }

.celebrate { text-align: center; font-size: 3rem; line-height: 1; }
@media (prefers-reduced-motion: no-preference) {
  .pop { animation: pop .35s ease-out; }
  @keyframes pop { from { transform: scale(.96); opacity: .4; } to { transform: none; opacity: 1; } }
}
