:root {
  --bg: #f2f5fa;
  --card: #ffffff;
  --ink: #1b1f2a;
  --muted: #6b7080;
  --line: #dbe3ee;
  --navy: #0b2e6b;
  --accent: #1670cc;
  --accent-soft: #e2eefb;
  --ok: #2f9e5b;
  --ok-soft: #e3f4ea;
  --bad: #d0453a;
  --bad-soft: #fbe6e3;
  --shadow: 0 1px 2px rgba(11, 46, 107, .06), 0 4px 16px rgba(11, 46, 107, .07);
  --on-accent: #ffffff;
  --r: 16px;
  /* Màu dãy số liệu biểu đồ (thứ tự cố định, đã kiểm mù màu — palette tham chiếu dataviz) */
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d121b;
    --card: #1a1f2b;
    --ink: #eceef3;
    --muted: #9aa0ae;
    --line: #2a3140;
    --navy: #071a3d;
    --accent: #5aa9f0;
    --accent-soft: #14283f;
    --ok: #4cc27c;
    --ok-soft: #173325;
    --bad: #f06a5e;
    --bad-soft: #3a1d1b;
    --on-accent: #061428;
    --shadow: none;
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; }

/* ---------- Thanh trên ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 6px) 12px 6px;
  background: var(--navy); color: #fff;
}
.top-title { flex: 1; font-weight: 700; font-size: 18px; padding-left: 4px; }
.top .bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; }
.top .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: transparent; display: grid; place-items: center; color: #fff;
}
.icon-btn:active { background: rgba(255,255,255,.12); }
[hidden] { display: none !important; }

main { max-width: 560px; margin: 0 auto; padding: 16px 16px 120px; }

/* ---------- Trang chủ ---------- */
.hello { margin: 4px 0 14px; }
.hello h1 { font-size: 22px; margin: 0; }
.hello p { margin: 2px 0 0; color: var(--muted); }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.today { background: var(--navy); color: #fff; border: 0; }
.today .row { display: flex; gap: 10px; margin: 6px 0 14px; }
.today .stat { flex: 1; background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px; }
.today .stat b { display: block; font-size: 24px; line-height: 1.2; color: #9fd0ff; }
.today .stat span { font-size: 13px; opacity: .8; }
.today h2 { margin: 0; font-size: 17px; }
.today .sub { font-size: 13px; opacity: .75; margin-top: 2px; }
.btn {
  display: block; width: 100%; border: 0; border-radius: 14px;
  padding: 15px 16px; font-weight: 700; font-size: 17px;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn.ghost { background: transparent; color: inherit; border: 1.5px solid var(--line); box-shadow: none; font-weight: 600; }
.btn.navy { background: var(--navy); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .45; }
.btn + .btn { margin-top: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { margin: 0; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile {
  text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
}
.tile .ic { font-size: 22px; }
.tile b { display: block; margin-top: 4px; }
.tile span { font-size: 13px; color: var(--muted); }
.tile:active { transform: scale(.98); }

.goal .meter { height: 10px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; margin: 8px 0 6px; }
.goal .meter i { display: block; height: 100%; background: var(--accent); }
.goal .line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.goal h3 { margin: 0; font-size: 15px; }

/* ---------- Thẻ học ---------- */
.q-label { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 4px 0 10px; }
.word-card { text-align: center; padding: 26px 16px 20px; }
.word { font-size: 34px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; word-break: break-word; }
.ipa { color: var(--muted); margin-top: 4px; font-size: 17px; }
.pos { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
.meaning { font-size: 19px; font-weight: 600; margin-top: 12px; }
.ex { text-align: left; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.ex .en { font-weight: 500; }
.ex .vi { color: var(--muted); font-size: 14px; margin-top: 2px; }
mark { background: var(--accent-soft); color: inherit; border-radius: 4px; padding: 0 2px; }
.ex mark { background: var(--accent-soft); color: inherit; border-radius: 4px; padding: 0 2px; }
.speak-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--accent-soft); color: var(--accent); vertical-align: middle;
}
.speak-btn.sm { width: 34px; height: 34px; float: right; margin: -2px -4px 0 8px; }
.big-listen { width: 96px; height: 96px; margin: 18px auto 6px; display: grid; }
.big-listen svg { width: 42px; height: 42px; }
.slow { font-size: 13px; border: 0; background: none; color: var(--muted); text-decoration: underline; }

.opts { display: grid; gap: 10px; }
.opt {
  text-align: left; padding: 14px 16px; border-radius: 14px;
  background: var(--card); border: 2px solid var(--line); font-size: 17px; font-weight: 500;
  box-shadow: 0 2px 0 var(--line);
}
.opt:active { transform: translateY(1px); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opts.done .opt { pointer-events: none; }

.prompt-vi { font-size: 22px; font-weight: 700; text-align: center; margin: 6px 0 4px; }
.blank-ex { text-align: center; color: var(--muted); margin-bottom: 14px; }
.text-in {
  width: 100%; padding: 14px 16px; font-size: 19px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink); outline: none;
}
.text-in:focus { border-color: var(--accent); }

.mic {
  width: 104px; height: 104px; border-radius: 50%; border: 0; margin: 18px auto 10px;
  display: grid; place-items: center; background: var(--navy); color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
}
.mic svg { width: 44px; height: 44px; }
.mic.on { background: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(208,69,58,.5)} 70%{box-shadow:0 0 0 18px rgba(208,69,58,0)} 100%{box-shadow:0 0 0 0 rgba(208,69,58,0)} }
.heard { text-align: center; min-height: 26px; color: var(--muted); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 8px; }

/* ---------- Thanh phản hồi dưới ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(0,0,0,.08);
  animation: up .18s ease-out;
}
.sheet-in { max-width: 560px; margin: 0 auto; }
.sheet.ok { background: var(--ok-soft); }
.sheet.bad { background: var(--bad-soft); }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet.ok h3 { color: var(--ok); }
.sheet.bad h3 { color: var(--bad); }
.sheet .ans { margin-bottom: 12px; }
@keyframes up { from { transform: translateY(40px); opacity: 0 } to { transform: none; opacity: 1 } }
.fixed-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.fixed-bottom > div { max-width: 560px; margin: 0 auto; }

/* ---------- Chấm câu nói/nghe ---------- */
.diff { font-size: 18px; line-height: 1.7; }
.diff .g { color: var(--ok); font-weight: 600; }
.diff .r { color: var(--bad); text-decoration: underline wavy; text-underline-offset: 4px; }
.score { font-size: 40px; font-weight: 800; text-align: center; }

/* ---------- Tiến độ ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.kpi b { display: block; font-size: 24px; }
.kpi span { font-size: 12px; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; margin-top: 10px; }
.chart i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; }
.chart i.zero { background: var(--line); }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- Danh sách từ ---------- */
.search { margin-bottom: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; font-size: 14px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.wl { list-style: none; margin: 0; padding: 0; }
.wl li { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.wl .t { flex: 1; min-width: 0; }
.wl .t b { display: block; }
.wl .t span { font-size: 14px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.dot.L { background: var(--bad); } .dot.R { background: var(--accent); } .dot.M { background: var(--ok); }

/* ---------- Cài đặt ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-size: 22px; }
.stepper b { font-size: 22px; min-width: 40px; text-align: center; }
select.text-in { appearance: none; font-size: 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; font-size: 15px;
  max-width: calc(100% - 32px);
}
.done-hero { text-align: center; padding: 20px 0 10px; }
.done-hero .big { font-size: 56px; }
.done-hero h2 { margin: 4px 0; }

/* ---------- Helena ---------- */
.helena-hi { display: flex; align-items: flex-end; gap: 10px; margin: 2px 0 6px; }
.helena-hi img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--accent); background: var(--accent-soft); }
.bubble { position: relative; flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 13px; font-size: 15px; box-shadow: var(--shadow); }
.bubble b { font-size: 17px; }
.streak { margin: 0 0 14px 74px; font-size: 13px; color: var(--muted); }
.helena-big { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--accent); display: block; margin: 0 auto 8px; }

/* ---------- Hội thoại AI ---------- */
.kb {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.kb:active { transform: scale(.99); }
.kb .co { font-size: 26px; flex: none; }
.kb .t { flex: 1; min-width: 0; }
.kb .t b { display: block; }
.kb .t span { font-size: 13px; color: var(--muted); }
.ht-goal { padding: 12px 14px; }
.chat { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 8px; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: 16px; line-height: 1.45; box-shadow: var(--shadow); }
.msg .who { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.msg.khach { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.sep { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.msg.typing { color: var(--muted); letter-spacing: .2em; }
.msg .speak-btn.sm { width: 30px; height: 30px; }
.msg .speak-btn.sm svg { width: 18px; height: 18px; }
.goiy { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--ink); }
.ht-type { display: flex; gap: 8px; margin-top: 6px; }
.ht-type .text-in { flex: 1; min-width: 0; font-size: 16px; padding: 12px 14px; }
.ht-type .btn { width: auto; flex: none; padding: 12px 18px; }
.sua { padding: 10px 0; border-bottom: 1px solid var(--line); }
.sua:last-child { border-bottom: 0; }
.sua .goc { color: var(--bad); }
.sua .tot { color: var(--ok); font-weight: 600; margin: 2px 0; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }

/* ---------- Câu hôm nay + chấm từng từ ---------- */
.cau .diff { font-size: 18px; font-weight: 500; }
.cau-act { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.cau-act .chip.on { background: var(--bad); color: #fff; border-color: var(--bad); }
.tu-do { font: inherit; background: none; border: 0; padding: 0; color: var(--bad); text-decoration: underline wavy; text-underline-offset: 4px; cursor: pointer; }
.diff .tu-do { font-weight: 600; }

/* ---------- Câu hỏi trắc nghiệm, bài đọc, bài nghe (dùng chung các kỹ năng) ---------- */
.tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 8px; }
.tq { margin-bottom: 14px; }
.tq .qt { font-weight: 600; margin: 0 0 8px; }
.tq .opts { gap: 8px; }
.tq .opt { font-size: 16px; padding: 11px 14px; display: flex; gap: 10px; align-items: flex-start; }
.tq .opt .k { flex: none; font-weight: 800; color: var(--muted); }
.opt.picked { border-color: var(--navy); background: var(--accent-soft); }
.giai { margin-top: 8px; padding: 10px 12px; border-radius: 12px; font-size: 14px; background: var(--bg); border-left: 4px solid var(--ok); }
.giai.bad { border-left-color: var(--bad); }
.giai b.ok { color: var(--ok); } .giai b.bad { color: var(--bad); }
.passage { white-space: pre-wrap; font-size: 15.5px; line-height: 1.6; }
.passage + .passage { margin-top: 12px; }
.passage-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.blank { display: inline-block; min-width: 46px; padding: 0 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 700; text-align: center; }
.blank.filled { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.tx { font-size: 14.5px; line-height: 1.55; }
.tx p { margin: 0 0 6px; }
.tx .vai { font-weight: 700; color: var(--muted); margin-right: 4px; }
.bieu-do { white-space: pre-wrap; font-size: 14px; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 8px 0 0; }
.listen-box { text-align: center; }
.listen-box .big-listen { margin-top: 6px; }
.listen-st { font-size: 13px; color: var(--muted); min-height: 20px; }
.abc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.abc .opt { text-align: center; font-size: 22px; font-weight: 800; padding: 16px 0; }
.timer { position: sticky; top: 62px; z-index: 5; display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: #fff; border-radius: 12px; padding: 8px 14px; margin-bottom: 12px; font-size: 14px; }
.timer b { font-variant-numeric: tabular-nums; font-size: 17px; }
.timer.low { background: var(--bad); }
.bars { list-style: none; margin: 8px 0 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 76px minmax(0, 1fr) 64px; gap: 8px; align-items: center; padding: 5px 0; font-size: 14px; }
.bars .track { height: 10px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.bars .track i { display: block; height: 100%; background: var(--accent); }
.bars .track i.lo { background: var(--bad); } .bars .track i.hi { background: var(--ok); }
.bars .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.score-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 6px 0 12px; }
.score-grid .kpi b { font-size: 28px; color: var(--accent); }
.note { font-size: 12.5px; color: var(--muted); font-style: italic; }
.wrong-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.wrong-item:last-child { border-bottom: 0; }
.wrong-item .q { font-size: 15px; margin: 4px 0; }
.wrong-item .a { font-size: 13.5px; }

/* ---------- Trang chủ: bài hôm nay ---------- */
.plan { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 8px; }
.plan button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; border-radius: 12px; padding: 10px 12px; background: rgba(255,255,255,.08); color: #fff; }
.plan .ck { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.plan li.xong .ck { background: var(--ok); border-color: var(--ok); }
.plan li.xong b { text-decoration: line-through; opacity: .7; }
.plan .t { flex: 1; min-width: 0; }
.plan .t b { display: block; font-size: 15px; }
.plan .t span { font-size: 12.5px; opacity: .75; }
.plan .ph { flex: none; font-size: 13px; opacity: .8; font-variant-numeric: tabular-nums; }
.today .btn { background: #fff; color: var(--navy); }
.sec-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sec-h .chip { flex: none; }
.tile .ic { font-weight: 800; color: var(--accent); }

/* ---------- Tab + danh sách đề ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; }
.tabs.sticky { position: sticky; top: 56px; z-index: 6; background: var(--bg); padding: 6px 0; }
.tab { flex: none; padding: 7px 13px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.de-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.de-list a { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.de-list .so { flex: none; min-width: 28px; height: 28px; padding: 0 4px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.de-list .t { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.45; }
.de-list .st { flex: none; color: var(--ok); font-size: 14px; }
.huong-dan { font-size: 13.5px; font-weight: 700; margin: 14px 0 8px; color: var(--ink); }

/* ---------- Nói ---------- */
.cau-hoi { font-size: 20px; font-weight: 700; line-height: 1.4; }
.cue b { font-size: 18px; line-height: 1.4; display: block; }
.cue ul { margin: 2px 0 0; padding-left: 20px; }
.prep-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.prep-row b { font-size: 26px; font-variant-numeric: tabular-nums; min-width: 78px; color: var(--accent); }
.prep-row .btn { flex: 1; padding: 11px; font-size: 15px; }
.note-in { font-size: 15px; padding: 10px 12px; }
.rec-box { text-align: center; }
.rec-t { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); min-height: 22px; }
.mic:disabled { opacity: .35; }
.mic.nhac { animation: pulse 1.2s infinite; }
.go-tay { margin: 8px 0 14px; }
.go-tay summary { cursor: pointer; color: var(--muted); font-size: 14px; text-align: center; padding: 6px; }
.go-tay .text-in { font-size: 16px; }
.transcript { margin: 6px 0 4px; font-size: 16px; line-height: 1.55; }
.mau-tl { margin: 8px 0 4px; line-height: 1.6; }
.band-tong { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.band-tong span { font-weight: 700; }
.band-tong b { font-size: 40px; font-weight: 800; color: var(--accent); line-height: 1; }
.score-grid .kpi span { line-height: 1.3; display: block; }
.err { color: var(--bad); }
.lien-quan { display: block; width: 100%; text-align: left; margin-top: 8px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); font-size: 15px; }
.muc-tieu { display: inline-block; margin: 6px 0 0; padding: 4px 12px; border-radius: 99px; font-weight: 700; font-size: 14px; }
.muc-tieu.ok { background: var(--ok-soft); color: var(--ok); }
.muc-tieu.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- Viết ---------- */
.de-text { margin: 0; font-weight: 600; line-height: 1.5; }
.de ul { margin: 2px 0 6px; padding-left: 20px; }
.viet-in { font-size: 16px; line-height: 1.6; min-height: 300px; resize: vertical; }
.dem-tu { display: flex; justify-content: space-between; margin: 6px 2px 14px; font-size: 14px; font-weight: 600; color: var(--bad); }
.dem-tu .du, .dem-tu span.du { color: var(--ok); }
#dem.du { color: var(--ok); }
.timer .link { color: #fff; padding: 0 0 0 8px; }
.mau-bai summary { cursor: pointer; }
.bai-mau { margin-top: 10px; line-height: 1.65; font-size: 15px; }

/* ---------- Biểu đồ (Writing Task 1) ---------- */
.bd { margin: 12px 0 6px; }
.bd-unit { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.bd-svg { display: block; width: 100%; height: auto; overflow: visible; }
.bd-svg text { font-family: inherit; stroke: none; }
.bd-grid { stroke: var(--line); stroke-width: 1; }
.bd-zero { stroke: var(--muted); }
.bd-tick { font-size: 10.5px; fill: var(--muted); }
.bd-lbl { font-size: 11px; fill: var(--ink); }
.bd-val { font-size: 10px; fill: var(--muted); }
.bd-num { font-size: 12.5px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.bd-th { font-size: 11px; font-weight: 700; fill: var(--ink); }
.bd-th-bg { fill: var(--accent-soft); }
.bd-zebra { fill: var(--bg); }
.bd-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.bd-dot { stroke: var(--card); stroke-width: 2; }
.bd-bar { stroke: var(--card); stroke-width: 1; }
.bd-slice { stroke: var(--card); stroke-width: 2; }
.bd-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; padding: 0; font-size: 13px; color: var(--ink); }
.bd-legend i, .bd-pie-list i, .bd-sub i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bd-sub { font-weight: 700; font-size: 14px; margin: 10px 0 4px; }
.bd-pies { display: grid; gap: 6px; }
.bd-pie-row { display: flex; align-items: center; gap: 12px; }
.bd-pie { width: 44%; max-width: 170px; flex: none; }
.bd-pie-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; font-size: 13px; display: grid; gap: 4px; }
.bd-pie-list li { display: flex; align-items: flex-start; gap: 2px; }
.bd-pie-list span { flex: 1; min-width: 0; }
.bd-pie-list b { flex: none; font-variant-numeric: tabular-nums; }
.bd-note { font-size: 13px; color: var(--muted); margin: 8px 0 0; font-style: italic; }
.bd-data { margin-top: 8px; font-size: 13px; }
.bd-data summary { cursor: pointer; color: var(--muted); }
.bd-scroll { overflow-x: auto; }
.bd-data table, table.xh { border-collapse: collapse; width: 100%; margin-top: 6px; font-size: 13px; }
.bd-data th, .bd-data td, table.xh th, table.xh td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: right; font-variant-numeric: tabular-nums; }
.bd-data th:first-child, table.xh th:first-child { text-align: left; font-weight: 600; }
table.xh td:last-child { width: 20px; }

/* ---------- Nghe & đọc ---------- */
.text-in.dien { font-size: 17px; padding: 10px 12px; }
.text-in.ok, select.ok { border-color: var(--ok); background: var(--ok-soft); }
.text-in.bad, select.bad { border-color: var(--bad); background: var(--bad-soft); }
.opts.tfng { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opts.tfng .opt { justify-content: center; text-align: center; font-size: 13px; font-weight: 700; padding: 11px 4px; }
.doc-h { font-size: 19px; margin: 0 0 10px; }
.doan { margin: 0 0 12px; line-height: 1.65; font-size: 15.5px; }
.doan-k { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--navy); color: #fff; font-size: 12px; margin-right: 8px; vertical-align: 1px; }
.tq select.text-in { font-size: 15px; padding: 10px 12px; }

/* ---------- Tiến bộ ---------- */
.kpis4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi.kn b { font-size: 30px; color: var(--accent); }
.kpi .kn-t { font-size: 13px; font-weight: 700; color: var(--ink); }
.chart.stack { gap: 4px; }
.chart.stack .col { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; border-bottom: 1px solid var(--line); }
.chart.stack .col i { display: block; border-radius: 3px; min-height: 3px; }
.so-loi { list-style: none; margin: 0; padding: 0; }
.so-loi li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.so-loi li:last-child { border-bottom: 0; }
.so-loi .n { flex: none; font-weight: 800; color: var(--bad); min-width: 30px; }
.so-loi s { color: var(--bad); }
.so-loi b { color: var(--ok); }
.len { color: var(--ok); } .xuong { color: var(--bad); }
label.sw { display: flex; gap: 10px; align-items: center; font-weight: 600; }
label.sw input { width: 22px; height: 22px; flex: none; }
@media (prefers-color-scheme: dark) {
  .chip.on, .tab.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .doan-k { background: var(--accent); color: var(--on-accent); }
  .mic { background: var(--accent); color: var(--on-accent); }
  .mic.on { background: var(--bad); color: #fff; }
}
