/* Scarlett English —— 和 Scarlett Notes 同一套暖纸底色 */
:root {
  --bg: #F8F5EF;
  --bg2: #F1ECE4;
  --paper: #FFFEFB;
  --ink: #2B2623;
  --ink2: #6F665E;
  --ink3: #A69D94;
  --line: #E6DFD5;
  --hover: rgba(70, 45, 25, .06);
  --press: rgba(70, 45, 25, .11);
  --accent: #C8372D;
  --accent-2: #AE2B22;
  --accent-soft: #FBEBE8;
  --on-accent: #fff;
  --ok: #2F7D4F;
  --ok-soft: #E4F2E9;
  --warn: #A66A00;
  --warn-soft: #FBF0D9;
  --bad: #B3261E;
  --bad-soft: #FBE9E7;
  --shadow: 0 10px 34px rgba(60, 35, 20, .16), 0 1px 3px rgba(60, 35, 20, .08);
  --shadow-s: 0 1px 2px rgba(60, 35, 20, .06), 0 2px 10px rgba(60, 35, 20, .06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --en: "Charter", "Iowan Old Style", "Georgia", "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #201D1B; --bg2: #1B1816; --paper: #262220; --ink: #EDE6DF; --ink2: #ABA29A; --ink3: #7A716A;
    --line: #37312D; --hover: rgba(255, 235, 215, .06); --press: rgba(255, 235, 215, .11);
    --accent: #E8604F; --accent-2: #F07462; --accent-soft: #3A2420; --on-accent: #fff;
    --ok: #62B783; --ok-soft: #1F3328; --warn: #E0A93D; --warn-soft: #3A2F18; --bad: #F0867B; --bad-soft: #3D2320;
    --shadow: 0 12px 40px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); --shadow-s: 0 2px 10px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.6 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
.en { font-family: var(--en); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink2); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.boot { padding: 30vh 20px; text-align: center; color: var(--ink3); }

/* ───── 外壳：手机底部标签，电脑左侧栏 ───── */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: calc(18px + var(--sat)) 18px calc(96px + var(--sab)); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--paper); border-top: 1px solid var(--line); padding-bottom: var(--sab); z-index: 5; }
.tabs button { flex: 1; padding: 8px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--ink3); }
.tabs button[aria-current="page"] { color: var(--accent); }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.brand { display: none; }
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .tabs { position: sticky; top: 0; height: 100vh; width: 208px; flex: none; flex-direction: column; justify-content: flex-start; gap: 2px; border-top: 0; border-right: 1px solid var(--line); background: var(--bg2); padding: 22px 12px; }
  .tabs button { flex: none; flex-direction: row; justify-content: flex-start; gap: 11px; padding: 10px 12px; border-radius: 9px; font-size: 15px; color: var(--ink2); }
  .tabs button:hover { background: var(--hover); }
  .tabs button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .brand { display: block; font: 600 19px/1.2 var(--en); padding: 2px 12px 18px; color: var(--ink); }
  .brand small { display: block; font: 12px var(--font); color: var(--ink3); font-weight: 400; margin-top: 3px; }
  .main { padding: 38px 36px 60px; }
}

/* ───── 通用部件 ───── */
.h1 { font-size: 25px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.h2 { font-size: 17px; font-weight: 650; margin: 28px 0 10px; }
.lead { color: var(--ink2); margin-top: 4px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-s); }
.card + .card { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 0 20px; border-radius: 12px; font-weight: 600; background: var(--accent); color: var(--on-accent); transition: transform .06s; }
.btn:hover { background: var(--accent-2); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--hover); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.sm { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 14.5px; }
.btn.block { display: flex; width: 100%; }
.link { color: var(--accent); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--bg2); color: var(--ink2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.field { display: block; }
.field > span { display: block; font-size: 13.5px; color: var(--ink2); margin-bottom: 5px; }
.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.55; }
.note { padding: 11px 14px; border-radius: 11px; background: var(--bg2); color: var(--ink2); font-size: 14.5px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--sab)); transform: translateX(-50%); max-width: min(92vw, 520px); padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14.5px; box-shadow: var(--shadow); z-index: 50; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ───── 登录 ───── */
.gate { max-width: 380px; margin: 0 auto; padding: 16vh 22px 40px; }
.gate h1 { font: 600 30px/1.2 var(--en); }
.gate p { color: var(--ink2); margin: 8px 0 22px; }

/* ───── 今日 ───── */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.streak { text-align: right; line-height: 1.2; }
.streak b { display: block; font-size: 30px; font-weight: 700; color: var(--accent); }
.streak span { font-size: 12.5px; color: var(--ink2); }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 16px 0 4px; }
.week-strip div { text-align: center; font-size: 12px; color: var(--ink3); }
.week-strip i { display: block; height: 7px; border-radius: 4px; background: var(--line); margin-bottom: 5px; }
.week-strip .done i { background: var(--accent); }
.week-strip .part i { background: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.week-strip .today { color: var(--ink); font-weight: 700; }
.task { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 15px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-s); }
.task + .task { margin-top: 10px; }
.task:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.task .ix { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--bg2); color: var(--ink2); }
.task.done .ix { background: var(--ok-soft); color: var(--ok); }
.task.next .ix { background: var(--accent); color: var(--on-accent); }
.task .t { font-weight: 650; }
.task .d { font-size: 13.5px; color: var(--ink2); }
.task .m { flex: none; font-size: 13px; color: var(--ink3); }
.task.done .t { color: var(--ink2); }

/* ───── 练习界面 ───── */
.sess { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 680px; margin: 0 auto; padding: calc(10px + var(--sat)) 18px calc(18px + var(--sab)); }
.sess-top { display: flex; align-items: center; gap: 12px; padding: 4px 0 14px; }
.sess-top .x { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--ink2); font-size: 22px; line-height: 1; }
.sess-top .x:hover { background: var(--hover); }
.bar { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .25s; }
.sess-top .cnt { font-size: 13px; color: var(--ink3); min-width: 44px; text-align: right; }
.sess-body { flex: 1; display: flex; flex-direction: column; }
.sess-foot { padding-top: 14px; display: flex; gap: 10px; }
.sess-foot .btn { flex: 1; }
.kicker { font-size: 13px; font-weight: 650; color: var(--accent); letter-spacing: .02em; }
.q { font-size: 20px; font-weight: 650; line-height: 1.4; margin: 6px 0 16px; }
.q.en { font-size: 26px; font-weight: 600; }
.big-word { font: 600 40px/1.15 var(--en); margin: 10px 0 6px; overflow-wrap: anywhere; }
.syl { font: 600 34px/1.2 var(--en); margin: 8px 0 2px; overflow-wrap: anywhere; }
.syl span { color: var(--ink2); }
.syl span:only-child { color: var(--ink); }
.syl span.st { color: var(--accent); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.syl i { font-style: normal; color: var(--ink3); margin: 0 2px; }
/* 长词拆读 */
.lsyl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 10px 0 12px; }
.lsyl .blk { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 52px; padding: 10px 12px 8px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); }
.lsyl button.blk { border-bottom-width: 3px; cursor: pointer; }
.lsyl button.blk:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.lsyl .blk b { font: 600 26px/1.15 var(--en); }
.lsyl .blk small { font: 400 14px/1.2 var(--en); color: var(--ink3); }
.lsyl.reveal .blk b { font-size: 21px; color: var(--ink2); font-weight: 500; }
.lsyl.reveal .blk.st { border-color: var(--accent); background: var(--accent-soft); padding-top: 14px; }
.lsyl.reveal .blk.st b { font-size: 32px; font-weight: 700; color: var(--accent); }
.lsyl.reveal .blk.st small { color: var(--accent); }
.rhythm { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px 6px; height: 22px; }
.rhythm i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink3); }
.rhythm i.big { width: 22px; height: 22px; background: var(--accent); }
.stairs { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: 4px 0 8px; padding: 12px 16px; border-radius: 12px; background: var(--bg2); font: 500 24px/1.35 var(--en); max-width: 100%; overflow-wrap: anywhere; }
.stairs span { color: var(--ink2); }
.stairs span.st { color: var(--accent); font-weight: 700; }
.stairs i { font-style: normal; color: var(--ink3); margin: 0 5px; }
.stairs div:last-child { border-top: 1px solid var(--line); padding-top: 4px; }
.sylboxes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.sylbox { font: 600 24px/1.3 var(--en); padding: 10px 2px; text-align: center; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); outline: none; letter-spacing: .04em; min-width: 0; color: var(--ink); }
.sylbox::placeholder { color: var(--ink3); letter-spacing: .1em; }
.sylbox:focus { border-color: var(--accent); }
.sylbox.right { border-color: var(--ok); background: var(--ok-soft); opacity: 1; -webkit-text-fill-color: currentColor; }
.sylbox.wrong { border-color: var(--bad); background: var(--bad-soft); }
.ipa { font-family: "Lucida Sans Unicode", "Doulos SIL", "Charis SIL", var(--en); color: var(--ink2); font-size: 17px; }
.zh-big { font-size: 20px; font-weight: 600; margin-top: 8px; }
.ex { margin-top: 14px; padding: 13px 15px; border-left: 3px solid var(--line); background: var(--bg2); border-radius: 0 11px 11px 0; }
.ex .en { font-size: 19px; line-height: 1.45; }
.ex .zh { color: var(--ink2); font-size: 14.5px; margin-top: 2px; }
.opts { display: grid; gap: 10px; }
.opt { display: block; width: 100%; text-align: left; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 13px; background: var(--paper); font-size: 17px; }
.opt.en { font-size: 20px; }
.opt:hover { border-color: var(--ink3); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; }
.spell { width: 100%; font: 600 26px/1.3 var(--en); padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 13px; background: var(--paper); outline: none; letter-spacing: .01em; }
.spell:focus { border-color: var(--accent); }
.spell.right { border-color: var(--ok); background: var(--ok-soft); }
.spell.wrong { border-color: var(--bad); background: var(--bad-soft); }
.fb { margin-top: 14px; padding: 12px 15px; border-radius: 12px; font-size: 15.5px; }
.fb.ok { background: var(--ok-soft); color: var(--ok); }
.fb.bad { background: var(--bad-soft); color: var(--bad); }
.fb.mid { background: var(--warn-soft); color: var(--warn); }
.fb b.en { font-size: 20px; color: var(--ink); }
.fb .why { color: var(--ink2); margin-top: 4px; }
.diff { font: 600 24px var(--en); letter-spacing: .02em; color: var(--ink); margin: 2px 0; }
.diff u { text-decoration: none; background: var(--bad-soft); color: var(--bad); border-radius: 3px; padding: 0 1px; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.tile { padding: 9px 14px; border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 11px; background: var(--paper); font: 500 19px var(--en); }
.tile.used { visibility: hidden; }
.slot { min-height: 62px; padding: 10px; border-bottom: 2px solid var(--line); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.slot.right { border-color: var(--ok); }
.slot.wrong { border-color: var(--bad); }
.audio-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.abtn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 99px; background: var(--bg2); font-size: 14.5px; font-weight: 600; color: var(--ink); }
.abtn:hover { background: var(--press); }
.abtn.playing { background: var(--accent-soft); color: var(--accent); }
.abtn svg { width: 17px; height: 17px; fill: currentColor; }

/* 录音 */
.rec-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 22px 0 6px; }
.rec { width: 78px; height: 78px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; box-shadow: var(--shadow-s); position: relative; }
.rec svg { width: 30px; height: 30px; fill: currentColor; }
.rec.on { background: var(--bad); }
.rec.on::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 3px solid var(--bad); opacity: calc(.25 + var(--lv, 0) * .75); transform: scale(calc(1 + var(--lv, 0) * .18)); transition: transform .08s, opacity .08s; }
.rec.busy { opacity: .5; }
.rec-hint { font-size: 13.5px; color: var(--ink2); min-height: 21px; text-align: center; }
.words { font: 500 23px/1.75 var(--en); }
.words span { padding: 1px 3px; border-radius: 5px; margin-right: 2px; }
.words .g { color: var(--ok); }
.words .y { color: var(--warn); background: var(--warn-soft); }
.words .r { color: var(--bad); background: var(--bad-soft); }
.words .miss { color: var(--ink3); text-decoration: line-through; }
.score-ring { font-size: 34px; font-weight: 700; line-height: 1; }
.score-ring small { font-size: 14px; font-weight: 500; color: var(--ink2); margin-left: 3px; }
.phones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.phone { min-width: 44px; padding: 5px 7px; border-radius: 9px; text-align: center; background: var(--bg2); line-height: 1.25; }
.phone b { display: block; font: 600 18px var(--en); }
.phone small { font-size: 11.5px; color: var(--ink2); }
.phone.r { background: var(--bad-soft); } .phone.r b { color: var(--bad); }
.phone.y { background: var(--warn-soft); } .phone.y b { color: var(--warn); }
.phone.g b { color: var(--ok); }
.tip { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); font-size: 15px; }
.tip b { color: var(--warn); }

/* 对话 */
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 15px; margin-top: 10px; background: var(--bg2); }
.bubble.me { margin-left: auto; background: var(--accent-soft); }
.bubble .en { font-size: 18px; line-height: 1.45; }
.bubble .zh { font-size: 13.5px; color: var(--ink2); }
.bubble.dim { opacity: .45; }

/* ───── 成长 ───── */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 620px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; }
.stat b { display: block; font-size: 27px; font-weight: 700; line-height: 1.15; }
.stat span { font-size: 13px; color: var(--ink2); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--ink2); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--ink3); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink2); font-size: 13px; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.list-item { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .w { font: 600 19px var(--en); }
.list-item .grow { min-width: 0; }
.empty { padding: 26px 12px; text-align: center; color: var(--ink3); }

/* 视频 */
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 13px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 英文界面旁边的中文小字 */
.gl { font-size: .74em; font-weight: 400; font-style: normal; letter-spacing: 0; text-transform: none; opacity: .72; margin-left: .55em; white-space: normal; }
.gl.blk { display: block; margin: .25em 0 0; font-size: .82em; }
.btn .gl, .abtn .gl, .pill .gl, .tabs .gl { opacity: .8; }
.tabs .gl { display: block; margin: 1px 0 0; font-size: .82em; }
.h1 .gl { font-size: .5em; } .h2 .gl { font-size: .68em; }
.kicker .gl, .small .gl { font-size: .9em; }
.opt .gl { display: block; margin: 2px 0 0; }
.score-ring .gl { display: none; }
.gl.nw { white-space: nowrap; }
.task .t .gl, .task .d .gl, .task .m .gl, .streak .gl, .stat .gl, .hero .lead .gl, .list-item .pill .gl { display: block; margin: 1px 0 0; white-space: normal; }
.task .m { text-align: right; }
.hero .h1 .gl { display: block; margin: 2px 0 0; font-size: .42em; }
.tbl th .gl, .tbl td .gl { display: block; margin: 0; }
.sess-foot .btn .gl { display: block; margin: 0; line-height: 1.2; }
.sess-foot .btn { flex-direction: column; gap: 0; padding-top: 5px; padding-bottom: 5px; line-height: 1.25; }
/* 窄屏上列表里的按钮换到下一行，不挤压文字 */
.list-item { flex-wrap: wrap; row-gap: 6px; }
.list-item > .grow { flex: 1 1 150px; min-width: 0; }
.list-item > .w { flex: none; }
.btn.sm { flex-direction: column; gap: 0; line-height: 1.15; padding-top: 4px; padding-bottom: 4px; }
.btn.sm .gl { display: block; margin: 0; }
.pill .gl { margin-left: .4em; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(20, 16, 12, .45); }
.modal-card { width: min(100%, 440px); padding: 22px 20px 18px; border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.modal-card .btn { width: 100%; }
