:root {
  --bg: #F5F6F8; --card: #FFFFFF; --ink: #151821; --ink2: #4A5060; --muted: #5B6170; --line: #ECEEF2; --line2: #D5D9E2;
  --accent: #3446D8; --accent-ink: #22308F; --accent-soft: #E8EBFC; --accent-soft2: #EEF1FD;
  --warm: #FFE6CC; --warm-ink: #8A3F00; --warn-bg: #FFF4E5; --warn-ink: #7A3A00;
  --ok: #1F7A4D; --ok-bg: #E3F4EC; --rec: #E0475A; --rec-soft: #FDE4E7; --bad: #A33A00;
  --radius: 20px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1; padding: 24px 20px 100px; display: flex; flex-direction: column; gap: 16px; }
.page.immersive { padding-bottom: 0; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.btn { height: 48px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line2); font-weight: 500; }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn.dark { background: var(--ink); }
.btn.sm { height: 38px; border-radius: 11px; font-size: 14px; padding: 0 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 6px 0; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; background: var(--card); border: 1px solid #E1E4EA; color: var(--ink2); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.chip.soft { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.pill-warm { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--warm); color: var(--warm-ink); font-weight: 700; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--ink2); }
.input { height: 48px; border: 1px solid var(--line2); border-radius: 12px; padding: 0 14px; font-size: 16px; background: #fff; width: 100%; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #E7E9EE; border-radius: 14px; padding: 4px; }
.seg button { height: 38px; border: 0; border-radius: 11px; background: none; color: var(--ink2); font-size: 14px; }
.seg button.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(20,24,33,.12); }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-bg); color: var(--warn-ink); border-radius: 14px; padding: 12px 14px; font-size: 13px; }
.note.blue { background: var(--accent-soft); color: var(--accent-ink); }
.note.green { background: var(--ok-bg); color: #134A31; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid #E6E8EE; padding-bottom: env(safe-area-inset-bottom); }
.tabs nav { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: 64px; }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; position: relative; }
.tabs a.on { color: var(--accent); font-weight: 700; }
.tabs .dot { position: absolute; top: 8px; left: calc(50% + 8px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--rec); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; font-weight: 700; }

/* home */
.hero { background: var(--accent); color: #fff; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.hero .btn { background: #fff; color: var(--accent); }
.days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.days div { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.days i { height: 6px; border-radius: 3px; background: rgba(255,255,255,.22); display: block; }
.days .done i { background: #fff; }
.days .now i { background: rgba(255,255,255,.55); }
.days .now { font-weight: 700; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; }
.task:last-child { border-bottom: 0; }
.task .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.task.off .ic { background: #F0F1F4; color: #6B7180; }
.task.done .ic { background: var(--ok-bg); color: var(--ok); }
.task .xp { font-size: 13px; font-weight: 700; color: var(--accent); }
.task.done .xp { color: var(--ok); }
.avatars { display: flex; gap: 8px; flex-wrap: wrap; }
.av { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }
.av.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.av.off { background: #F0F1F4 !important; color: #6B7180 !important; border: 1.5px dashed #B5BAC6; }
.av.lg { width: 56px; height: 56px; font-size: 20px; }

/* episode */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.iconbtn { width: 44px; height: 44px; border: 0; background: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--ink); }
.ep-page { background: #fff; min-height: 100dvh; display: flex; flex-direction: column; }
.ep-head { padding: 4px 20px 14px; display: flex; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); }
.cover { width: 56px; height: 56px; border-radius: 14px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex: none; }
.transcript { flex: 1; padding: 16px 20px 200px; display: flex; flex-direction: column; gap: 6px; }
.sent { padding: 8px 12px; margin: 0 -12px; border-radius: 12px; transition: background .2s; }
.sent.cur { background: var(--accent-soft2); }
.sent .en { font-size: 17px; line-height: 1.65; }
.sent .zh { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 2px; }
.w { border-radius: 4px; cursor: pointer; }
.w.v { border-bottom: 2px dashed var(--accent); }
.w.sel { background: var(--accent); color: #fff; padding: 0 2px; }
.w.saved { border-bottom: 2px solid var(--ok); }
.blind { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 24px 220px; text-align: center; color: var(--muted); }
.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: #fff; border-top: 1px solid var(--line); padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); }
.player .inner { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.player input[type=range] { width: 100%; accent-color: var(--accent); }
.controls { display: flex; justify-content: space-between; align-items: center; }
.play { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.play .icon { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.ctl { min-width: 56px; height: 44px; border: 0; background: none; color: var(--ink2); font-size: 14px; font-weight: 600; border-radius: 10px; }
.ctl.on { color: var(--accent); background: var(--accent-soft); }
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(20,24,33,.25); }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; width: min(456px, calc(100% - 24px)); z-index: 31; background: #fff; border-radius: 20px; box-shadow: 0 12px 40px rgba(20,24,33,.2); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.term { font-size: 24px; font-weight: 700; }

/* review */
.rv-card { flex: 1; background: #fff; border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 18px; min-height: 380px; }
.clip { display: flex; align-items: center; gap: 14px; background: var(--accent-soft2); border-radius: 16px; padding: 14px; }
.clip .play { width: 52px; height: 52px; }
.reveal { flex: 1; min-height: 120px; border: 2px dashed #C9CEDA; border-radius: 16px; background: #FAFBFC; color: var(--ink2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.answer { flex: 1; border-radius: 16px; background: var(--accent-soft2); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grades button { height: 64px; border: 0; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px #E1E4EA; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.grades button.good { background: var(--accent); color: #fff; box-shadow: none; }
.grades button span { font-size: 12px; opacity: .8; }
.progress { height: 6px; border-radius: 3px; background: #E3E6EC; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.wl { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }

/* speak */
.recbox { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.recbtn { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.recbtn.on { background: var(--rec); box-shadow: 0 0 0 8px var(--rec-soft); }
.recbtn .icon { width: 30px; height: 30px; }
.timer { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: center; gap: 3px; height: 32px; }
.bars i { width: 3px; border-radius: 2px; background: var(--rec); display: block; transition: height .1s; }
.recrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recrow:last-child { border-bottom: 0; }
.mini { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #F0F1F4; color: var(--ink); display: flex; align-items: center; justify-content: center; flex: none; }
.mini.acc { background: var(--accent); color: #fff; }
.mini .icon { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.like { border: 0; background: none; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; height: 40px; }
.like.on { color: var(--rec); }
.switch { display: flex; align-items: center; justify-content: space-between; width: 100%; font-size: 14px; color: var(--ink2); }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

/* group */
.rank { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.rank.me { background: var(--accent-soft2); margin: 0 -12px; padding: 11px 12px; border-radius: 12px; border-bottom: 0; }
.rank .n { width: 20px; font-weight: 700; color: var(--ink2); }
.promo { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 12px; font-weight: 700; color: var(--ok); }
.promo::before, .promo::after { content: ""; flex: 1; border-top: 1.5px dashed var(--ok); }
.bar { height: 8px; border-radius: 4px; background: #E3E6EC; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }

/* me */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: #fff; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.stat strong { font-size: 22px; }
.stat strong span { font-size: 13px; font-weight: 500; color: var(--ink2); }
.list-btn { width: 100%; border: 0; background: none; padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; text-align: left; color: var(--ink); }
.list-btn:last-child { border-bottom: 0; }

/* auth */
.auth { padding: 48px 24px 28px; display: flex; flex-direction: column; gap: 22px; min-height: 100dvh; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; }

.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: calc(100% - 40px); text-align: center; }
.toast.xp { background: var(--ok); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
