:root {
  --bg: #f7f6fb;
  --surface: #ffffff;
  --surface-2: #f2f0fa;
  --text: #1c1b29;
  --muted: #6e6b85;
  --line: #e7e4f1;
  --accent: #5b4cf0;
  --accent-2: #8b5cf6;
  --accent-soft: #eeecff;
  --on-accent: #ffffff;
  --mark: #fff0c2;
  --mark-text: #7a5300;
  --good: #14a067;
  --good-soft: #e1f6ec;
  --bad: #e5484d;
  --bad-soft: #fdeced;
  --warn: #f2a516;
  --shadow: 0 1px 2px rgba(25, 20, 70, .05), 0 10px 30px rgba(25, 20, 70, .07);
  --shadow-lg: 0 14px 40px rgba(91, 76, 240, .28);
  --radius: 20px;
  --radius-sm: 12px;
  --l-tbg: 97%;
  --l-tile: 92%;
  --l-fill: 52%;
  --s-tbg: 90%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f17;
    --surface: #181826;
    --surface-2: #21203a;
    --text: #ecebf5;
    --muted: #9b99b4;
    --line: #2a2941;
    --accent: #8b80ff;
    --accent-2: #b28cff;
    --accent-soft: #26244b;
    --on-accent: #ffffff;
    --mark: #4a3a10;
    --mark-text: #ffd978;
    --good: #3ecf8e;
    --good-soft: #12301f;
    --bad: #ff6b6b;
    --bad-soft: #3a1719;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .45);
    --l-tbg: 14%;
    --l-tile: 22%;
    --l-fill: 62%;
    --s-tbg: 30%;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: 28px; font-weight: 800; margin: 0; }
h2 { font-size: 20px; font-weight: 700; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.grow { flex: 1; min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---------- Thanh trên ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 820px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -0.02em; }
.logo {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 17px;
  box-shadow: 0 4px 12px rgba(91, 76, 240, .35);
}
.top nav { display: flex; gap: 6px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; white-space: nowrap;
}
.pill:hover { border-color: var(--accent); }
.streak { color: #e8590c; }
.streak.cold { color: var(--muted); filter: grayscale(1); }
.badge { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; line-height: 18px; }

main { max-width: 820px; margin: 0 auto; padding: 24px 16px 90px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; font-size: 14px; font-weight: 600; color: var(--muted); }
.back:hover { color: var(--accent); }

/* ---------- Thành phần chung ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.center { text-align: center; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; background: var(--accent); color: var(--on-accent);
  border-radius: 14px; padding: 11px 18px; cursor: pointer; font-weight: 700; font-size: 15px;
  box-shadow: 0 4px 14px rgba(91, 76, 240, .28);
  transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn.good { background: var(--good); box-shadow: 0 4px 14px rgba(20, 160, 103, .28); }
.btn.bad { background: transparent; color: var(--bad); box-shadow: none; border: 1px solid var(--bad); }
.btn.big { padding: 14px 24px; font-size: 16px; border-radius: 16px; }
.link-btn { background: none; border: none; padding: 6px 0; cursor: pointer; font-weight: 700; color: inherit; opacity: .9; }
.link-btn:hover { opacity: 1; text-decoration: underline; }

.icon-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 50%;
  width: 40px; height: 40px; flex-shrink: 0; cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s;
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.round-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 18px; cursor: pointer; display: grid; place-items: center;
}
.round-btn.main {
  width: 68px; height: 68px; font-size: 24px; border: none; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow-lg);
}

mark { background: var(--mark); color: var(--mark-text); border-radius: 6px; padding: 0 4px; }

.chips { display: flex; gap: 4px; flex-shrink: 0; }
.chips span {
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted);
}
.chips span.ok { background: var(--good-soft); color: var(--good); }
.chips span.ok::before { content: "✓ "; }

.bar { height: 6px; background: color-mix(in srgb, var(--text) 8%, transparent); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--good); transition: width .3s; }

/* ---------- Trang chủ ---------- */
.hero { margin-bottom: 18px; }
.hero h1 { margin-top: 4px; }

.today {
  position: relative; overflow: hidden;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff; border-radius: 24px; padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow-lg);
}
.today::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255, 255, 255, .09); pointer-events: none;
}
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.today .eyebrow { color: rgba(255, 255, 255, .8); }
.today h2 { font-size: 24px; color: #fff; margin: 2px 0; }
.today-sub { color: rgba(255, 255, 255, .8); font-size: 14px; }
.today-list { display: grid; gap: 8px; position: relative; z-index: 1; }
.today-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  background: rgba(255, 255, 255, .14); color: #fff; transition: background .15s;
}
.today-item:hover { background: rgba(255, 255, 255, .22); }
.today-item b { display: block; font-size: 15px; }
.today-item small { display: block; color: rgba(255, 255, 255, .78); font-size: 13px; }
.ti-icon { width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.today .chips span { background: rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .85); }
.today .chips span.ok { background: #fff; color: var(--good); }
.today .go { font-weight: 700; font-size: 14px; white-space: nowrap; }
.today .done-mark { width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--good); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.today .link-btn { color: #fff; margin-top: 10px; position: relative; z-index: 1; }

.ring-wrap { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-wrap .ring-bg { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 3.2; }
.ring-wrap .ring-fg { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; transition: stroke-dasharray .4s; }
.ring-wrap span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 16px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.stat span { font-size: 13px; color: var(--muted); }

.section-title { margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.topic {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 20px; color: var(--text);
  background: hsl(var(--h) var(--s-tbg) var(--l-tbg)); border: 1px solid hsl(var(--h) 40% 50% / .14);
  transition: transform .12s, box-shadow .15s;
}
.topic:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.t-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: hsl(var(--h) 80% var(--l-tile)); }
.t-name { font-weight: 700; line-height: 1.3; margin-top: 4px; }
.t-meta { font-size: 13px; color: var(--muted); }
.topic .bar > i { background: hsl(var(--h) 70% var(--l-fill)); }

/* ---------- Trang chủ đề ---------- */
.topic-hero {
  display: flex; align-items: center; gap: 16px; padding: 22px; border-radius: 24px; margin-bottom: 16px;
  background: hsl(var(--h) var(--s-tbg) var(--l-tbg)); border: 1px solid hsl(var(--h) 40% 50% / .14);
}
.topic-hero .t-icon { width: 60px; height: 60px; font-size: 30px; border-radius: 18px; }
.pat-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--text);
  transition: border-color .15s, transform .12s;
}
.pat-row:hover { border-color: var(--accent); transform: translateX(2px); }
.pat-row .num {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--muted);
}
.pat-row .num.done { background: var(--good-soft); color: var(--good); }
.pat-row .f { font-weight: 700; }
.pat-row .vi { font-size: 14px; color: var(--muted); }

/* ---------- Trang khung câu ---------- */
.frame-hero {
  padding: 24px; border-radius: 24px; margin-bottom: 16px;
  background: hsl(var(--h) var(--s-tbg) var(--l-tbg)); border: 1px solid hsl(var(--h) 40% 50% / .14);
}
.frame-big { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; margin: 6px 0 4px; color: hsl(var(--h) 60% 45%); }
@media (prefers-color-scheme: dark) { .frame-big { color: hsl(var(--h) 85% 75%); } }
.frame-vi { font-size: 17px; font-weight: 500; }
.note { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 70%, transparent); font-size: 14px; color: var(--muted); }

.stepper { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 6px; margin-bottom: 16px; }
.step {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); text-align: left; font-weight: 600; font-size: 14px; color: var(--muted);
}
.step .num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: var(--surface-2); font-size: 13px; font-weight: 800;
}
.step.on { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.step.on .num { background: var(--accent); color: #fff; }
.step.done .num { background: var(--good); color: #fff; font-size: 0; }
.step.done .num::after { content: "✓"; font-size: 13px; }

.lead { margin: 0 0 12px; font-size: 14px; color: var(--muted); }

.ex { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ex:last-child { border-bottom: none; padding-bottom: 0; }
.ex:first-child { padding-top: 0; }
.ex .en { font-size: 17px; font-weight: 500; }

/* ---------- Đồng hồ ---------- */
.timer { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 14px 0; }
.timer > i {
  display: block; height: 100%; width: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.timer > i.low { background: linear-gradient(90deg, var(--bad), #ff8a65); }

/* ---------- Bước 1: nghe & nhại ---------- */
.stage { text-align: center; padding: 26px 20px; }
.rep-dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.rep-dots i { width: 22px; height: 6px; border-radius: 99px; background: var(--surface-2); }
.rep-dots i.on { background: var(--accent); }
.stage-en { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; margin: 22px 0 8px; min-height: 36px; }
.stage-vi { color: var(--muted); }
.phase {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; padding: 8px 16px; border-radius: 99px;
  font-weight: 700; background: var(--surface-2); color: var(--muted);
}
.phase.listen { background: var(--accent-soft); color: var(--accent); }
.phase.speak { background: var(--good-soft); color: var(--good); }
.phase.speak::before, .phase.listen::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: blink 1s infinite;
}
.controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 8px; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- Bước 2: thay câu ---------- */
.drill-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.frame-chip { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.counter { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.prompt { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; margin: 22px 0 4px; text-align: center; }
.prompt-hint { text-align: center; font-size: 13px; color: var(--muted); }
.answer-row { display: flex; gap: 8px; align-items: center; }
.answer-row input, textarea, .field input {
  flex: 1; min-width: 0; padding: 14px 16px; border: 2px solid var(--line); border-radius: 16px;
  background: var(--bg); font-size: 18px; transition: border-color .15s;
}
textarea { width: 100%; resize: vertical; font-size: 15px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input:disabled { opacity: .7; }
.listening { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; color: var(--accent); font-weight: 600; font-size: 14px; min-height: 22px; }
.listening .pulse { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); }
.listening .pulse::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--bad); animation: ripple 1.2s infinite;
}
@keyframes ripple { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.status { min-height: 20px; margin-top: 10px; text-align: center; font-size: 14px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

.result { margin-top: 18px; padding: 16px; border-radius: 16px; }
.result.ok { background: var(--good-soft); }
.result.no { background: var(--bad-soft); }
.result .title { font-weight: 800; margin-bottom: 8px; font-size: 16px; }
.result.ok .title { color: var(--good); }
.result.no .title { color: var(--bad); }
.answer-line { display: flex; gap: 10px; align-items: center; font-size: 18px; font-weight: 600; }
.diff { margin-top: 6px; font-size: 14px; }
.diff .extra { color: var(--bad); text-decoration: line-through; }
.diff .miss { color: var(--good); font-weight: 700; text-decoration: underline; }

.done-card { text-align: center; padding: 32px 20px; }
.done-card .emoji { font-size: 48px; line-height: 1; }
.done-card h2 { margin: 12px 0 6px; font-size: 22px; }
.done-card p { color: var(--muted); margin: 0 0 18px; }

/* ---------- Bước 3: nói tự do ---------- */
.count-ring { position: relative; width: 150px; height: 150px; margin: 6px auto 10px; }
.count-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.count-ring .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 9; }
.count-ring .ring-fg { fill: none; stroke: url(#grad); stroke-width: 9; stroke-linecap: round; }
.count-ring .ring-fg.low { stroke: var(--bad); }
.count-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; font-weight: 800; letter-spacing: -0.03em; }
.round-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.round-dots i { padding: 3px 10px; border-radius: 99px; font-style: normal; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.round-dots i.on { background: var(--accent); color: #fff; }
.round-dots i.ok { background: var(--good-soft); color: var(--good); }
.transcript {
  min-height: 96px; text-align: left; padding: 14px 16px; margin-top: 14px;
  border-radius: 16px; font-size: 16px; background: var(--bg); border: 1px dashed var(--line);
}
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.mini-stats div { background: var(--surface-2); border-radius: 14px; padding: 10px; text-align: center; }
.mini-stats b { display: block; font-size: 24px; font-weight: 800; }
.mini-stats span { font-size: 12px; color: var(--muted); }

/* ---------- Biểu mẫu ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field input { width: 100%; font-size: 15px; padding: 11px 14px; border-radius: 12px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

/* ---------- Chuỗi ngày học ---------- */
.streak-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 16px 18px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.streak-big { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0 12px; }
.streak-big span { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.day i {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-style: normal;
  font-size: 13px; font-weight: 800; background: var(--surface-2); color: #fff;
}
.day.on i { background: linear-gradient(135deg, #ff8a3d, #e8590c); }
.day.is-today i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.day span { font-size: 11px; font-weight: 600; color: var(--muted); }

.narrow { max-width: 760px; margin: 0 auto; }

.lvl {
  display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.lvl.base { background: var(--surface-2); color: var(--muted); }
.section-title + .lead { margin-top: -4px; }
.quick { width: 100%; margin-bottom: 16px; }

/* ---------- Hội thoại AI ---------- */
.key-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-color: var(--accent); background: var(--accent-soft); }
.talk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.talk-card { display: flex; gap: 14px; align-items: flex-start; margin: 0; color: var(--text); transition: border-color .15s, transform .12s; }
.talk-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.talk-icon { --h: 252; flex-shrink: 0; }
.recent { padding: 14px 16px; margin-bottom: 8px; }
.model-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-top: 8px; cursor: pointer; }
.model-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.model-opt input { margin-top: 4px; accent-color: var(--accent); }
.card h2 { margin-bottom: 6px; }

.talk-layout { display: flex; flex-direction: column; }
.talk-side { order: -1; }
.talk-side .card { padding: 10px 14px; margin-bottom: 4px; }
.talk-side .targets { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.talk-side .target { white-space: nowrap; }
.talk-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 0 14px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.talk-icon-sm { font-size: 24px; }
.chat { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 16px; min-height: 40vh; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg.ai { align-self: flex-start; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 12px 16px; border-radius: 20px; font-size: 17px; line-height: 1.45; }
.msg.ai .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg.me .bubble { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-right-radius: 6px; }
.who { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.bubble .vi { color: var(--muted); font-size: 14px; margin-top: 6px; }
.bubble .tools { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.bubble .tools .icon-btn { width: 32px; height: 32px; font-size: 14px; }
.bubble .tools .link-btn { color: var(--accent); font-size: 13px; }
.fb { margin-top: 6px; padding: 10px 12px; border-radius: 14px; font-size: 14px; max-width: 100%; text-align: left; }
.fb.ok { background: var(--good-soft); color: var(--good); }
.fb.no { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--text); }
.fb.no b { color: #b26b00; }
@media (prefers-color-scheme: dark) { .fb.no b { color: #ffc062; } }
.fb.pending { color: var(--muted); }
.fb .better { display: flex; gap: 8px; align-items: center; margin-top: 6px; color: var(--text); font-weight: 600; }
.fb .better .icon-btn, .mistake .icon-btn { width: 30px; height: 30px; font-size: 13px; }
.fb .used { margin-top: 6px; font-weight: 600; color: var(--accent); }
.typing { display: flex; gap: 5px; padding: 16px 18px !important; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.composer {
  position: sticky; bottom: 0; z-index: 5; padding: 10px 0 14px;
  background: linear-gradient(to top, var(--bg) 80%, transparent);
}
.hint { font-size: 14px; padding: 8px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--text); margin-bottom: 8px; }
.composer-row { display: flex; gap: 8px; align-items: center; }
.composer-row input {
  flex: 1; min-width: 0; padding: 14px 16px; border: 2px solid var(--line); border-radius: 18px;
  background: var(--surface); font-size: 16px;
}
.composer-row input:focus { outline: none; border-color: var(--accent); }
.mic-btn {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; border: none; cursor: pointer; font-size: 22px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow-lg);
}
.mic-btn.rec { background: var(--bad); animation: pulse-ring 1.2s infinite; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .5); } 100% { box-shadow: 0 0 0 16px rgba(229, 72, 77, 0); } }
.mic-btn:disabled, .composer .btn:disabled { opacity: .5; cursor: default; }

.targets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.target { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text); }
.target.used { background: var(--good-soft); color: var(--good); }

h3.sub { font-size: 16px; margin: 18px 0 8px; }
.list { margin: 0; padding-left: 20px; }
.list li { margin-bottom: 4px; }
.mistake { padding: 10px 0; border-bottom: 1px solid var(--line); }
.mistake:last-of-type { border-bottom: none; }
.mistake .said { color: var(--bad); text-decoration: line-through; font-size: 15px; }
.mistake .better { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 4px 0; }

/* ---------- Màn rộng: máy tính, iPad 12.9" ---------- */
@media (min-width: 1024px) {
  .top-in { max-width: 1200px; padding: 12px 32px; }
  main { max-width: 1200px; padding: 32px 32px 100px; }
  h1 { font-size: 32px; }

  .home-top { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: end; margin-bottom: 32px; }
  .home-top .today { margin-bottom: 0; }
  .home-side .stat-row { grid-template-columns: 1fr 1fr 1fr; margin-bottom: 0; }
  .home-side .stat { padding: 12px; }
  .home-side .stat b { font-size: 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
  .topic { padding: 18px; }

  .pat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .pat-list .pat-row { margin-bottom: 0; }

  .pattern-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 28px; align-items: start; }
  .pattern-side { position: sticky; top: 84px; }
  .pattern-side .stepper { grid-template-columns: 1fr; }
  .pattern-side .step { padding: 12px 14px; font-size: 15px; }
  .pattern-side .step.extra { margin-top: 6px; }
  .pattern-main { min-width: 0; }
  .pattern-main .card { padding: 28px; }
  .frame-big { font-size: 30px; }
  .stage-en, .prompt { font-size: 30px; }
  .stage { padding: 40px 28px; }
  .talk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
  .talk-side { position: sticky; top: 84px; order: 0; }
  .talk-side .card { padding: 20px; }
  .talk-side .targets { flex-wrap: wrap; overflow: visible; }
  .talk-side .target { white-space: normal; }
  .msg { max-width: 75%; }
  .count-ring { width: 180px; height: 180px; }
  .count-ring span { font-size: 52px; }
}
@media (min-width: 1280px) {
  .home-top { grid-template-columns: minmax(0, 1fr) 360px; }
}

/* ---------- Điện thoại ---------- */
@media (max-width: 560px) {
  h1 { font-size: 24px; }
  .stat-row { gap: 8px; }
  .stat { padding: 12px; }
  .stat b { font-size: 22px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .topic { padding: 14px; }
  .stepper { grid-template-columns: repeat(3, 1fr); }
  .step { flex-direction: column; gap: 4px; text-align: center; padding: 10px 6px; font-size: 12px; }
  .step.extra { grid-column: 1 / -1; flex-direction: row; justify-content: center; }
  .frame-big { font-size: 23px; }
  .stage-en, .prompt { font-size: 21px; }
  .pill .txt { display: none; }
  .today-item .chips { display: none; }
  .brand .name { display: none; }
}
