:root {
  --bg: #F4F5FA; --card: #FFFFFF; --text: #1C2030; --sub: #687086; --line: #E4E6EF;
  --pri: #5B5BF0; --pri-2: #8B5CF6; --pri-soft: #ECEBFF; --pri-ink: #FFFFFF;
  --ok: #16A34A; --ok-soft: #DCFCE7; --ok-ink: #14532D;
  --bad: #E5484D; --bad-soft: #FDE4E4; --bad-ink: #7F1D1D;
  --amber: #F59E0B; --amber-soft: #FEF3C7;
  --shadow: 0 1px 2px rgba(20, 24, 40, .04), 0 6px 20px rgba(20, 24, 40, .06);
  --r: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1016; --card: #181B24; --text: #ECEEF6; --sub: #9AA1B5; --line: #282C39;
    --pri: #7C7CFF; --pri-2: #A78BFA; --pri-soft: #25264A;
    --ok: #22C55E; --ok-soft: #0F2E1C; --ok-ink: #BBF7D0;
    --bad: #F87171; --bad-soft: #3A1719; --bad-ink: #FECACA;
    --amber-soft: #3A2A0A; --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang HK", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
h1 { font-size: 28px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 0; }
.muted { color: var(--sub); }
.small { font-size: 13px; }

.page { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 100px); }

/* 頂部 */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 18px; }
.head.sub { margin: 0 0 8px; }
.back { color: var(--pri); font-weight: 600; font-size: 17px; padding: 6px 0; }
.streak { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 18px; filter: grayscale(1); opacity: .75; }
.streak.lit { filter: none; opacity: 1; background: var(--amber-soft); }
.streak b { font-size: 18px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.goal { display: flex; align-items: center; gap: 16px; }
.ring-wrap { position: relative; width: 76px; height: 76px; flex: none; }
.ring-txt { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--pri); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-fg.full { stroke: var(--ok); }
.goal-xp { font-size: 15px; }
.goal-xp b { font-size: 26px; }

.hero { background: linear-gradient(135deg, var(--pri), var(--pri-2)); color: #fff; }
.hero .muted { color: rgba(255, 255, 255, .8); }
.hero-unit { display: flex; align-items: center; gap: 12px; }
.hero-title { font-size: 20px; font-weight: 700; }
.hero .u-ic { background: rgba(255, 255, 255, .2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 16px; }
.chip { background: rgba(255, 255, 255, .2); padding: 4px 12px; border-radius: 999px; font-size: 14px; }
.hero .btn.pri { background: #fff; color: var(--pri); }
@media (prefers-color-scheme: dark) { .hero .btn.pri { background: #fff; color: #4B4BD8; } }

.dp-en { font-size: 20px; font-weight: 600; line-height: 1.35; margin-bottom: 2px; }
.small-ex { margin-top: 8px; font-size: 14px; color: var(--sub); }

/* 一週柱形圖 */
.bars { display: flex; gap: 8px; align-items: flex-end; height: 120px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-val { font-size: 11px; color: var(--sub); height: 16px; }
.bar-track { flex: 1; width: 100%; max-width: 30px; display: flex; align-items: flex-end; background: var(--bg); border-radius: 8px; overflow: hidden; }
.bar-track i { display: block; width: 100%; background: var(--pri); border-radius: 8px; min-height: 0; }
.bar-track i.met { background: var(--ok); }
.bar-lbl { font-size: 12px; color: var(--sub); margin-top: 4px; }
.bar-lbl.now { color: var(--pri); font-weight: 700; }

/* 提示加入主畫面 */
.hint { border: 2px dashed var(--pri); box-shadow: none; }
.hint-h { font-weight: 700; margin-bottom: 4px; }
.hint ol { margin: 6px 0 8px; padding-left: 22px; }
.hint li { margin: 2px 0; }
.inline-ic { width: 18px; height: 18px; vertical-align: -3px; stroke: var(--pri); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hint .btn { margin-top: 10px; }

/* 按鈕 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 14px; font-weight: 700; padding: 10px 16px; transition: transform .08s, opacity .2s; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.big { width: 100%; min-height: 54px; font-size: 17px; }
.btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.pri { background: var(--pri); color: var(--pri-ink); box-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.btn.sec { background: var(--pri-soft); color: var(--pri); }
.btn.okb { background: var(--ok); color: #fff; }
.btn.badb { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .4; box-shadow: none; }
.btn-col { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.link { display: block; margin: 14px auto 0; color: var(--sub); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; padding: 8px; }
.say-btn { display: inline-grid; place-items: center; min-width: 36px; height: 36px; border-radius: 10px; background: var(--pri-soft); font-size: 17px; flex: none; }
.say-btn.sm { min-width: 32px; height: 32px; font-size: 15px; vertical-align: middle; }
.say-btn.round { width: 48px; height: 48px; border-radius: 50%; font-size: 22px; }
.say-btn.pill { padding: 0 14px; font-size: 15px; font-weight: 600; color: var(--pri); }
.icon-btn { width: 40px; height: 40px; font-size: 22px; color: var(--sub); flex: none; }

/* 底部分頁 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tab { position: relative; flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: var(--sub); font-size: 11px; font-weight: 600; }
.tab svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--pri); }
.badge { position: absolute; top: 4px; left: 50%; margin-left: 8px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; min-width: 18px; padding: 0 5px; border-radius: 9px; }

/* 課程 */
.sec { font-size: 17px; margin: 22px 0 10px; }
.units { display: flex; flex-direction: column; gap: 10px; }
.unit { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); border: 2px solid transparent; }
.unit.cur { border-color: var(--pri); }
.u-ic { width: 44px; height: 44px; flex: none; display: grid; place-items: center; font-size: 24px; background: var(--pri-soft); border-radius: 12px; }
.u-ic.big { width: 72px; height: 72px; font-size: 40px; border-radius: 20px; margin: 0 auto 10px; }
.u-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.u-title { font-weight: 700; }
.u-en { font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.lv { font-size: 11px; font-weight: 700; color: var(--pri); background: var(--pri-soft); padding: 1px 7px; border-radius: 6px; }
.pbar { display: block; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.pbar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .4s ease; }
.pbar.lg { height: 10px; border-radius: 5px; margin: 14px 0 6px; }
.unit-hero { text-align: center; margin: 4px 0 6px; }
.unit-hero h1 { font-size: 24px; }

/* 句子清單 */
.list { display: flex; flex-direction: column; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.list.compact { box-shadow: none; background: none; margin: 0 -4px; }
.row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list.compact .row { padding: 10px 4px; }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-en { font-weight: 600; }
.row-zh { font-size: 14px; color: var(--sub); }
.row-more { margin-top: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 7px; display: inline-block; }
.dot.new { background: var(--line); }
.dot.learn { background: var(--amber); }
.dot.master { background: var(--ok); }
.legend { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: var(--sub); margin: 12px 0; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .dot { margin: 0; }
.empty { text-align: center; color: var(--sub); padding: 20px 0; }
.search { width: 100%; font: inherit; font-size: 16px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); margin-bottom: 6px; -webkit-appearance: none; appearance: none; }

.note { background: var(--amber-soft); border-radius: 12px; padding: 8px 12px; font-size: 14px; margin: 8px 0; }
mark { background: color-mix(in srgb, var(--pri) 18%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; font-weight: 600; }
.ex-en { font-size: 15px; }
.ex-zh { font-size: 14px; color: var(--sub); }

/* 複習 */
.review-hero { text-align: center; padding: 24px 16px; }
.review-hero .btn { margin-top: 14px; }
.big-num { font-size: 56px; font-weight: 800; line-height: 1; color: var(--pri); }

/* 我的 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: 16px; padding: 12px 6px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 18px; white-space: nowrap; }
.stat span { font-size: 12px; color: var(--sub); }
.hm-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.hm-grid > span { text-align: center; font-size: 12px; color: var(--sub); }
.hm { display: block; aspect-ratio: 1; border-radius: 6px; background: var(--line); }
.hm.l1 { background: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.hm.l2 { background: color-mix(in srgb, var(--ok) 60%, var(--line)); }
.hm.l3 { background: var(--ok); }
.hm.future { background: transparent; border: 1px dashed var(--line); }
.hm.now { outline: 2px solid var(--pri); outline-offset: 1px; }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--sub); }
.hm-legend .hm { width: 14px; height: 14px; border-radius: 4px; }
.settings h3 { margin-bottom: 6px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-l { font-weight: 600; flex: none; }
.set-sub { display: block; font-size: 12px; color: var(--sub); }
.set-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
.set-row select { font: inherit; font-size: 15px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; max-width: 190px; min-width: 0; }
.set-row input[type=range] { width: 46%; accent-color: var(--pri); }
.switch { -webkit-appearance: none; appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line); position: relative; flex: none; transition: background .2s; cursor: pointer; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }
.row-btn { display: flex; justify-content: space-between; width: 100%; padding: 13px 0; border-bottom: 1px solid var(--line); font-weight: 600; text-align: left; }
.row-btn:last-child { border-bottom: 0; }
.row-btn span { color: var(--sub); }
.row-btn.danger { color: var(--bad); }
.foot { text-align: center; margin-top: 20px; }

/* 練習畫面 */
.ses { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 16px); }
.ses-top { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.ses-bar { flex: 1; height: 14px; border-radius: 7px; margin: 0; }
.ses-bar i { border-radius: 7px; background: linear-gradient(90deg, var(--ok), #4ADE80); }
.combo { font-weight: 800; color: var(--amber); min-width: 44px; text-align: right; opacity: 0; transition: opacity .2s; }
.combo.show { opacity: 1; }
.ses-body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-top: 10px; }
.ses.answered .ses-body { padding-bottom: 270px; }
.ses-actions { margin-top: auto; position: sticky; bottom: 0; padding: 14px 0 0; background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.q-label { font-size: 15px; font-weight: 700; color: var(--sub); }
.q-card { background: var(--card); border-radius: var(--r); padding: 20px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.q-card.center { align-items: center; padding: 26px 16px; }
.q-en { font-size: 23px; font-weight: 700; line-height: 1.35; }
.q-en.big { font-size: 27px; }
.q-zh { font-size: 22px; font-weight: 700; line-height: 1.4; }
.q-sent { font-size: 20px; font-weight: 600; line-height: 1.6; }
.blank { display: inline-block; min-width: 80px; border-bottom: 3px solid var(--pri); text-align: center; }
.blank.filled { color: var(--ok); border-color: var(--ok); padding: 0 4px; }
.play-big { width: 96px; height: 96px; border-radius: 50%; background: var(--pri); font-size: 40px; box-shadow: 0 6px 0 rgba(0, 0, 0, .15); }
.play-big:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }

.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { width: 100%; min-height: 56px; text-align: left; padding: 12px 16px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; font-size: 17px; font-weight: 600; line-height: 1.35; transition: border-color .15s, background .15s; }
.opt:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-ink); }
.opt.dim { opacity: .45; }

.tag { align-self: flex-start; font-size: 13px; font-weight: 700; color: var(--pri); background: var(--pri-soft); padding: 3px 10px; border-radius: 999px; }
.intro { background: var(--card); border-radius: var(--r); padding: 20px 16px; box-shadow: var(--shadow); }
.say-row { display: flex; gap: 8px; margin: 12px 0; }
.intro-zh { font-size: 20px; font-weight: 600; }
.example { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ex-label { font-size: 12px; font-weight: 700; color: var(--sub); margin-bottom: 2px; }

.ans-line { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; padding: 10px 0; border-bottom: 2px solid var(--line); }
.ans-line.ok { border-color: var(--ok); }
.ans-line.bad { border-color: var(--bad); }
.ans-ph { color: var(--sub); font-size: 15px; padding-top: 8px; }
.bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 6px 0; }
.tile { padding: 8px 13px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; font-size: 17px; font-weight: 600; }
.tile.used { background: var(--line); color: transparent; border-color: var(--line); }
.tile:active:not(:disabled) { transform: translateY(2px); }

.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.mic { width: 92px; height: 92px; border-radius: 50%; background: var(--pri); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 0 rgba(0, 0, 0, .15); }
.mic svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mic.on { background: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 50%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
.mic-hint { color: var(--sub); text-align: center; }
.heard { font-size: 15px; text-align: center; min-height: 22px; }
.w-ok { color: var(--ok); }
.w-miss { color: var(--bad); text-decoration: underline wavy; text-underline-offset: 4px; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 18px 16px calc(env(safe-area-inset-bottom) + 16px); border-radius: 22px 22px 0 0; animation: up .22s ease-out; box-shadow: 0 -8px 30px rgba(0, 0, 0, .12); }
.sheet > * { max-width: 528px; margin-left: auto; margin-right: auto; }
.sheet.ok { background: var(--ok-soft); color: var(--ok-ink); }
.sheet.bad { background: var(--bad-soft); color: var(--bad-ink); }
.sheet-h { display: flex; justify-content: space-between; align-items: center; font-size: 20px; font-weight: 800; }
.gain { font-size: 15px; background: var(--ok); color: #fff; padding: 2px 10px; border-radius: 999px; }
.combo-msg { font-weight: 700; color: var(--amber); margin-top: 2px; }
.sheet-en { font-size: 18px; font-weight: 700; margin-top: 8px; }
.sheet-en .say-btn { background: rgba(255, 255, 255, .5); }
.sheet-zh { font-size: 15px; opacity: .85; margin-bottom: 14px; }
.sheet-tip { font-size: 13px; opacity: .8; margin: -8px 0 12px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }

/* 完成畫面 */
.result { text-align: center; padding-top: calc(env(safe-area-inset-top) + 48px); }
.res-emoji { font-size: 72px; line-height: 1; margin-bottom: 12px; animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0 16px; }
.res-grid div { background: var(--card); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.res-grid b { display: block; font-size: 26px; color: var(--pri); }
.res-grid span { font-size: 13px; color: var(--sub); }
.result .btn { margin-top: 20px; }

/* 第一次使用 */
.ob { display: flex; flex-direction: column; gap: 14px; min-height: 100vh; min-height: 100dvh; padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
.ob.center { text-align: center; align-items: stretch; justify-content: center; }
.ob h1 { font-size: 26px; }
.ob .btn.big { margin-top: auto; }
.ob .btn.big + .btn.big { margin-top: 0; }
.ob.center .btn.big { margin-top: 8px; }
.ob-step { font-size: 13px; font-weight: 700; color: var(--pri); }
.logo { width: 96px; height: 96px; border-radius: 22px; margin: 0 auto 6px; box-shadow: 0 8px 24px rgba(91, 91, 240, .35); }
.feat { list-style: none; padding: 0; margin: 8px auto 12px; text-align: left; display: inline-flex; flex-direction: column; gap: 8px; align-self: center; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; }
.choice b { display: block; font-size: 17px; }
.choice.on { border-color: var(--pri); background: var(--pri-soft); }
.c-ic { font-size: 28px; }

/* 彈出視窗、提示 */
#modal { display: none; position: fixed; inset: 0; z-index: 50; }
#modal.show { display: block; }
.modal-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.modal-box { position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); max-width: 480px; margin: 0 auto; background: var(--card); border-radius: 20px; padding: 20px; }
.code { width: 100%; height: 120px; font: 12px/1.4 ui-monospace, Menlo, monospace; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); word-break: break-all; resize: none; }
#toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 16px); transform: translate(-50%, -20px); background: rgba(20, 22, 32, .92); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- v2：生字、音標 ---------- */
.ipa-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.ipa { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 10px; background: var(--pri-soft); font-size: 15px; font-family: "Lucida Sans Unicode", "Arial Unicode MS", -apple-system, sans-serif; }
.ipa b { font-size: 12px; color: var(--pri); font-family: inherit; }
.row-ipa { font-size: 13px; font-weight: 400; color: var(--sub); }
.row-zh.full { white-space: normal; margin: 4px 0; }
.review-card { display: flex; flex-direction: column; gap: 10px; }
.card-title { font-weight: 700; font-size: 17px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.new-words-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.seg { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; flex: none; }
.seg button { padding: 5px 11px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--sub); }
.seg button.on { background: var(--pri); color: #fff; }
.sec-h { display: flex; justify-content: space-between; align-items: center; width: 100%; font-size: 17px; font-weight: 700; margin: 18px 0 10px; padding: 4px 0; text-align: left; }

/* 串字題 */
.spell-form { display: flex; flex-direction: column; flex: 1; }
.spell-in { width: 100%; font: inherit; font-size: 24px; font-weight: 700; text-align: center; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--text); -webkit-appearance: none; appearance: none; }
.spell-in:focus { outline: none; border-color: var(--pri); }
.spell-in.ok { border-color: var(--ok); background: var(--ok-soft); }
.spell-in.bad { border-color: var(--bad); background: var(--bad-soft); }
.spell-hint { font-size: 20px; letter-spacing: .12em; font-weight: 700; }
.small-zh { font-size: 17px; text-align: center; }

/* AI 老師 */
.chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; }
.chat-top { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 16px 8px; border-bottom: 1px solid var(--line); background: var(--card); }
.chat-title { flex: 1; text-align: center; font-weight: 700; }
.chat-sp { width: 60px; }
.chat-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; }
.bubble.ai { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.bubble.me { align-self: flex-end; background: var(--pri); color: #fff; border-bottom-right-radius: 6px; }
.typing { display: flex; gap: 5px; padding: 14px 16px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--sub); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.fix { align-self: flex-end; max-width: 85%; background: var(--amber-soft); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.chat-err { background: var(--bad-soft); color: var(--bad-ink); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px); border-top: 1px solid var(--line); background: var(--card); }
.composer textarea { flex: 1; font: inherit; font-size: 16px; resize: none; max-height: 120px; padding: 9px 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.send { width: 40px; height: 40px; border-radius: 50%; background: var(--pri); color: #fff; display: grid; place-items: center; flex: none; }
.send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.send:disabled { opacity: .4; }
.mic.sm { width: 40px; height: 40px; box-shadow: none; flex: none; }
.mic.sm svg { width: 20px; height: 20px; }

/* 作文批改 */
.essay-form { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.lbl { font-weight: 700; font-size: 14px; margin-top: 8px; }
.ta { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); resize: vertical; }
.full-sel { width: 100%; font: inherit; font-size: 16px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.essay-form .btn { margin-top: 12px; }
.band { text-align: center; margin-bottom: 12px; }
.band-n { font-size: 52px; font-weight: 800; color: var(--pri); line-height: 1.1; }
.crit { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.crit div { background: var(--bg); border-radius: 12px; padding: 8px 4px; text-align: center; }
.crit b { display: block; font-size: 20px; }
.crit span { font-size: 11px; color: var(--sub); }
.corr { padding: 10px 0; border-bottom: 1px solid var(--line); }
.corr:last-child { border-bottom: 0; }
.corr-o { color: var(--bad); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.corr-b { color: var(--ok); font-weight: 600; }
.improved { white-space: pre-wrap; line-height: 1.6; font-size: 15px; }
.ul { margin: 6px 0 0; padding-left: 20px; }
.ul li { margin: 4px 0; }
.tab { max-width: 110px; }
.hf { font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--bg); color: var(--sub); flex: none; }
.hf.on { background: var(--pri-soft); color: var(--pri); }

/* ---------- v2.3：改錯、聽寫、情景對話 ---------- */
.fx-wrong { color: var(--bad); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 55%, transparent); font-size: 18px; margin-bottom: 6px; }
.fx-right { color: var(--ok); font-size: 23px; font-weight: 700; line-height: 1.35; }
.row-wrong { color: var(--bad); text-decoration: line-through; font-size: 14px; margin: 4px 0; }
.dict-in { font-size: 18px; min-height: 90px; }
.sec-p { margin: -4px 0 10px; }
.ok-txt { color: var(--ok); font-weight: 700; }
.center-txt { text-align: center; }
.res-emoji.sm { font-size: 48px; margin-bottom: 6px; }
.say-row.center, .btn-row.center { justify-content: center; }
.btn-row.center { margin: 16px 0; }
.seg.wide { display: flex; width: 100%; margin: 12px 0 14px; }
.seg.wide button { flex: 1; padding: 8px 0; }
.dl-ctrl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.dl-tog { display: flex; align-items: center; gap: 4px; font-weight: 600; font-size: 15px; }
.dl-tog input { width: 18px; height: 18px; accent-color: var(--pri); }
.dl-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.dl-line { display: flex; flex-direction: column; align-items: flex-start; }
.dl-line.b { align-items: flex-end; }
.dl-who { font-size: 12px; color: var(--sub); margin: 0 6px 2px; }
.dl-line .bubble { max-width: 90%; }
.bubble.me2 { background: var(--pri-soft); border-bottom-right-radius: 6px; }
.dl-line.playing .bubble { outline: 2px solid var(--pri); }
.dl-zh { font-size: 14px; color: var(--sub); margin-top: 4px; }
