/* AIEdu — hệ thiết kế v2 (Duolingo/Azota), dùng chung token với app di động (xem DESIGN.md).
   Sáng/tối theo hệ thống; ép được bằng <html data-theme="light|dark">. Không font/ảnh ngoài. */

@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  --bg: #F4F6FC; --surface: #FFFFFF; --surface2: #EAEFFB; --ink: #19213A; --muted: #5B6788; --line: #D9E0F0;
  --brand: #3355E0; --brand-deep: #2742B8; --brand-ink: #FFFFFF; --brand-soft: #E4EAFF; --accent: #FFB020; --accent-deep: #D9900A;
  --ok: #2BB673; --ok-deep: #1F8F58; --ok-soft: #DDF6EA; --ok-ink: #14693F;
  --warn: #FF9F1C; --warn-deep: #D67E00; --warn-soft: #FFF0D6; --warn-ink: #8A5200;
  --bad: #EF5350; --bad-deep: #C73B38; --bad-soft: #FDE7E7; --bad-ink: #A82B28;
  /* nút đặc theo ngữ nghĩa (chữ đạt ≥4.5:1) */
  --ok-fill: #1A8754; --ok-fill-ink: #FFFFFF; --ok-edge: #115E3A;
  --warn-fill: #FF9F1C; --warn-fill-ink: #19213A; --warn-edge: #D67E00;
  --bad-fill: #C73B38; --bad-fill-ink: #FFFFFF; --bad-edge: #902826;
  --card: var(--surface);
  --shadow: 0 10px 30px rgba(25, 33, 58, .16);
  --r-card: 20px; --r-btn: 16px; --r-in: 14px; --radius: var(--r-card);
  --hh: 64px; --side: 252px;
  --font: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1424; --surface: #172036; --surface2: #1E2A45; --ink: #E9EEFA; --muted: #9CA9C7; --line: #2B3858;
    --brand: #8AA4FF; --brand-deep: #5B78E6; --brand-ink: #0B1226; --brand-soft: #1F2E5C; --accent: #FFC24A; --accent-deep: #C99522;
    --ok: #5ED39A; --ok-deep: #3FAE79; --ok-soft: #123226; --ok-ink: #5ED39A;
    --warn: #F2C76B; --warn-deep: #C79A3A; --warn-soft: #3A2F10; --warn-ink: #F2C76B;
    --bad: #FF8F86; --bad-deep: #D6645C; --bad-soft: #3B1A18; --bad-ink: #FF8F86;
    --ok-fill: #5ED39A; --ok-fill-ink: #07281A; --ok-edge: #3FAE79;
    --warn-fill: #F2C76B; --warn-fill-ink: #2A1E04; --warn-edge: #C79A3A;
    --bad-fill: #FF8F86; --bad-fill-ink: #2B0A08; --bad-edge: #D6645C;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #0E1424; --surface: #172036; --surface2: #1E2A45; --ink: #E9EEFA; --muted: #9CA9C7; --line: #2B3858;
  --brand: #8AA4FF; --brand-deep: #5B78E6; --brand-ink: #0B1226; --brand-soft: #1F2E5C; --accent: #FFC24A; --accent-deep: #C99522;
  --ok: #5ED39A; --ok-deep: #3FAE79; --ok-soft: #123226; --ok-ink: #5ED39A;
  --warn: #F2C76B; --warn-deep: #C79A3A; --warn-soft: #3A2F10; --warn-ink: #F2C76B;
  --bad: #FF8F86; --bad-deep: #D6645C; --bad-soft: #3B1A18; --bad-ink: #FF8F86;
  --ok-fill: #5ED39A; --ok-fill-ink: #07281A; --ok-edge: #3FAE79;
  --warn-fill: #F2C76B; --warn-fill-ink: #2A1E04; --warn-edge: #C79A3A;
  --bad-fill: #FF8F86; --bad-fill-ink: #2B0A08; --bad-edge: #D6645C;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

/* ---------- Nền tảng ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-wrap: anywhere; }
a { color: var(--brand); text-underline-offset: 3px; font-weight: 700; }
a:hover { text-decoration-thickness: 2px; }
b, strong { font-weight: 800; }
code, pre { font-family: ui-monospace, Consolas, "SFMono-Regular", monospace; font-size: .92em; }
code { background: var(--surface2); padding: 1px 6px; border-radius: 6px; }
pre { background: var(--surface2); padding: 12px; border-radius: 12px; overflow: auto; }
ul, ol { padding-left: 22px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 10px 16px; border-radius: 12px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1 { font-size: 28px; line-height: 1.2; margin: 28px 0 6px; letter-spacing: -.015em; font-weight: 800; }
h2 { font-size: 20px; line-height: 1.3; margin: 32px 0 12px; font-weight: 800; letter-spacing: -.01em; }
h3 { font-size: 17px; line-height: 1.35; margin: 0 0 8px; font-weight: 800; }
p { margin: 0 0 12px; }
p.lead { color: var(--muted); margin: 0 0 20px; max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: 14.5px; }
.tiny { font-size: 13px; line-height: 1.45; }
.nowrap { white-space: nowrap; }
@media (min-width: 768px) { h1 { font-size: 32px; } }

/* ---------- Icon ---------- */
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -5px; }
svg.i.sm { width: 16px; height: 16px; vertical-align: -3px; stroke-width: 2.75; }
svg.i.lg { width: 30px; height: 30px; }
svg.i.fill { fill: currentColor; }
.owl { display: block; flex: none; height: auto; user-select: none; }

/* ---------- Khung & điều hướng ---------- */
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 56px; }
.wrap.wide { max-width: 1180px; }
header.top { background: var(--surface); border-bottom: 2px solid var(--line); position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top); }
header.top .in { max-width: 1280px; margin: 0 auto; min-height: var(--hh); padding: 8px 16px; display: flex; gap: 12px; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-height: 48px; }
.brand .logo { width: 38px; height: 38px; flex: none; }
.wordmark { font-weight: 800; font-size: 22px; letter-spacing: -.03em; white-space: nowrap; }
.wordmark b { color: var(--brand); font-weight: 800; }
nav.main { display: flex; gap: 6px; flex: 1; align-items: center; }
nav.main a { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 16px; border-radius: 14px; border: 2px solid transparent; text-decoration: none; color: var(--muted); font-weight: 800; font-size: 15px; letter-spacing: .02em; transition: background .15s, color .15s; }
nav.main a:hover { background: var(--surface2); color: var(--ink); }
nav.main a.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
nav.main .sep { display: none; }
.who { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 14px; color: var(--muted); }
.who form { margin: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #19213A; display: grid; place-items: center; font-weight: 800; font-size: 16px; flex: none; box-shadow: 0 3px 0 var(--accent-deep); }
.who-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.themebtn { width: 44px; min-width: 44px; padding: 0; }
.themebtn .moon { display: none; }
:root[data-theme="dark"] .themebtn .sun { display: none; }
:root[data-theme="dark"] .themebtn .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .themebtn .sun { display: none; }
  :root:not([data-theme="light"]) .themebtn .moon { display: inline; }
}
.r-anon header.top .in { justify-content: center; }
.netbar { display: flex; align-items: center; gap: 10px; background: var(--warn-soft); color: var(--warn-ink); padding: 10px 16px; font-size: 14.5px; font-weight: 700; position: sticky; top: var(--hh); z-index: 25; border-bottom: 2px solid var(--warn); }
.netbar[hidden] { display: none; }

/* Học sinh — điện thoại: thanh dưới */
@media (max-width: 767.98px) {
  .r-s { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .r-s nav.main { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 2px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; gap: 4px; flex: none; }
  .r-s nav.main a { flex: 1; flex-direction: column; gap: 2px; min-height: 60px; padding: 6px 4px; font-size: 12.5px; border-radius: 16px; justify-content: center; letter-spacing: 0; }
  .r-s nav.main a svg.i { width: 26px; height: 26px; }
  .r-s .who-name { display: none; }
  .r-s .logout span, .r-t .logout span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .r-s .logout, .r-t .logout { min-width: 44px; padding: 0; }
}
@media (min-width: 768px) and (max-width: 1023.98px) { .r-s nav.main { margin-left: 16px; } }

/* Máy tính: thanh bên cho cả hai vai trò */
@media (min-width: 1024px) {
  .r-s, .r-t { padding-left: var(--side); }
  .r-s header.top, .r-t header.top { margin-left: calc(-1 * var(--side)); }
  .r-s header.top .in, .r-t header.top .in { max-width: none; }
  .r-s nav.main, .r-t nav.main { position: fixed; left: 0; top: calc(var(--hh) + env(safe-area-inset-top) + 2px); bottom: 0; width: var(--side); flex-direction: column; align-items: stretch; gap: 4px;
    padding: 18px 14px; overflow-y: auto; background: var(--surface); border-right: 2px solid var(--line); z-index: 20; flex: none; }
  .r-s nav.main a { padding: 12px 16px; min-height: 52px; text-transform: uppercase; font-size: 14px; letter-spacing: .06em; }
  .r-t nav.main a { padding: 10px 14px; min-height: 46px; font-size: 15px; }
  .r-s nav.main a svg.i { width: 26px; height: 26px; }
  .r-t nav.main .sep { display: block; height: 2px; background: var(--line); margin: 8px 6px; border-radius: 2px; }
  .r-s .netbar, .r-t .netbar { top: var(--hh); }
}
@media (max-width: 1023.98px) {
  .r-t header.top { position: static; }
  .r-t header.top .in { flex-wrap: wrap; row-gap: 4px; }
  .r-t nav.main { order: 3; flex: 0 0 100%; overflow-x: auto; scrollbar-width: thin; padding-bottom: 6px; margin: 0 -4px; -webkit-overflow-scrolling: touch; }
  .r-t nav.main a { white-space: nowrap; flex: none; }
  .r-t .who-name { display: none; }
  .r-t .netbar { top: 0; }
}

/* ---------- Bố cục chung ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.sb { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 26px 0 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 15px; margin-top: 4px; max-width: 72ch; font-weight: 500; }
.backrow { margin: 18px 0 0; }

.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-card); padding: 18px; margin-bottom: 16px; animation: rise .28s ease-out both; }
.card.lift { border-color: var(--line); }
.card.flat { background: var(--surface2); border-color: transparent; }
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-bottom: 10px; }
.grid > .card { margin-bottom: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes slideup { from { transform: translateY(110%); } to { transform: none; } }
@keyframes fall { 0% { transform: translateY(-20px) rotate(0); opacity: 0; } 12% { opacity: 1; } 100% { transform: translateY(70vh) rotate(540deg); opacity: 0; } }

/* ---------- Nút "khối" ---------- */
.btn { --b-bg: var(--surface); --b-ink: var(--ink); --b-edge: var(--line); --b-line: var(--line); --edge: 4px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: var(--r-btn); border: 2px solid var(--b-line);
  background: var(--b-bg); color: var(--b-ink); font: inherit; font-weight: 800; font-size: 15px; letter-spacing: .02em; line-height: 1.2; cursor: pointer; text-decoration: none;
  box-shadow: 0 var(--edge) 0 var(--b-edge); transform: translateY(0); transition: transform .08s, box-shadow .08s, background .12s, border-color .12s, filter .12s; -webkit-tap-highlight-color: transparent; }
.btn:hover { text-decoration: none; filter: brightness(.98); border-color: var(--brand); }
.btn:active { transform: translateY(var(--edge)); box-shadow: 0 0 0 var(--b-edge); }
.btn.primary { --b-bg: var(--brand); --b-ink: var(--brand-ink); --b-edge: var(--brand-deep); --b-line: var(--brand-deep); min-height: 52px; text-transform: uppercase; letter-spacing: .05em; font-size: 15px; }
.btn.primary:hover { filter: brightness(1.07); border-color: var(--brand-deep); }
.btn.okb { --b-bg: var(--ok-fill); --b-ink: var(--ok-fill-ink); --b-edge: var(--ok-edge); --b-line: var(--ok-edge); min-height: 52px; text-transform: uppercase; letter-spacing: .05em; }
.btn.warnb { --b-bg: var(--warn-fill); --b-ink: var(--warn-fill-ink); --b-edge: var(--warn-edge); --b-line: var(--warn-edge); min-height: 52px; text-transform: uppercase; letter-spacing: .05em; }
.btn.okb:hover, .btn.warnb:hover { border-color: inherit; filter: brightness(1.06); }
.btn.soft { --b-bg: var(--brand-soft); --b-ink: var(--brand); --b-line: transparent; --b-edge: color-mix(in srgb, var(--brand) 35%, var(--brand-soft)); }
.btn.ghost { --b-bg: transparent; --b-line: transparent; --b-edge: transparent; --b-ink: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: var(--surface2); color: var(--ink); border-color: transparent; }
.btn.ghost:active { transform: none; }
.btn.sm { --edge: 3px; min-height: 44px; padding: 6px 14px; font-size: 14px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.danger { --b-ink: var(--bad-ink); --b-line: var(--bad); --b-edge: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; box-shadow: 0 var(--edge) 0 var(--line); }
.btn svg.i { width: 20px; height: 20px; }
.btn.sm svg.i { width: 18px; height: 18px; }
@media (min-width: 1024px) { .r-t .btn.sm { min-height: 40px; } .r-t .btn { min-height: 44px; } .r-t .btn.primary { min-height: 46px; } }

/* ---------- Huy hiệu, chip, tiến độ ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 12px; border-radius: 999px; font-size: 13px; line-height: 1.4; font-weight: 800; border: 2px solid var(--line); background: var(--surface); color: var(--muted); vertical-align: middle; }
.badge svg.i { width: 15px; height: 15px; }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad-ink); border-color: transparent; }
.badge.info { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip { display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 999px; text-align: center; font-weight: 800; line-height: 1.45; border: 2px solid var(--line); white-space: nowrap; color: var(--muted); background: var(--surface); }
.chip.support { background: var(--bad-soft); color: var(--bad-ink); border-color: transparent; }
.chip.forming { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.chip.mastered { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; }
.chip.insufficient { background: var(--surface2); color: var(--muted); border-color: transparent; }
.chip.noitems, .chip.inactive { background: transparent; color: var(--muted); border: 2px dashed var(--line); }
.rule { font: 700 12px ui-monospace, Consolas, monospace; background: var(--brand-soft); color: var(--brand); padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.progressbar { height: 16px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.progressbar > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .6s cubic-bezier(.3, .9, .3, 1); position: relative; }
.progressbar > i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .35); }
.progressbar.brand > i { background: var(--brand); }
.bar { height: 14px; background: var(--surface2); border-radius: 999px; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: var(--bad); border-radius: 999px; transition: width .6s ease; }
.bar.ok > i { background: var(--ok); }
.bar.neutral > i { background: var(--brand); }
.lv { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted); }
.lv-ok { background: var(--ok); } .lv-support { background: var(--accent); } .lv-intervene { background: var(--bad); } .lv-nodata { background: transparent; border: 2px solid var(--muted); }
[data-sk] { --sk: var(--brand); --sk-on: #fff; }
[data-sk="V01"] { --sk: #3355E0; --sk-on: #fff; } [data-sk="V02"] { --sk: #0FB5A3; --sk-on: #0B1A2E; } [data-sk="V03"] { --sk: #8A55F0; --sk-on: #fff; }
[data-sk="V04"] { --sk: #FF7A45; --sk-on: #1A1030; } [data-sk="V05"] { --sk: #2BB673; --sk-on: #072416; } [data-sk="V06"] { --sk: #E24A9C; --sk-on: #fff; }
/* kỹ năng thứ 7 trở đi: bảng 12 màu xoay vòng (cùng thứ tự với app: theme.ts) */
[data-sk="V07"] { --sk: #0EA5E9; --sk-on: #04202E; } [data-sk="V08"] { --sk: #F59E0B; --sk-on: #2A1B00; } [data-sk="V09"] { --sk: #6366F1; --sk-on: #fff; } [data-sk="V10"] { --sk: #84CC16; --sk-on: #1A2A00; } [data-sk="V11"] { --sk: #D946EF; --sk-on: #fff; } [data-sk="V12"] { --sk: #64748B; --sk-on: #fff; } [data-sk="V13"] { --sk: #3355E0; --sk-on: #fff; } [data-sk="V14"] { --sk: #0FB5A3; --sk-on: #0B1A2E; } [data-sk="V15"] { --sk: #8A55F0; --sk-on: #fff; } [data-sk="V16"] { --sk: #FF7A45; --sk-on: #1A1030; } [data-sk="V17"] { --sk: #2BB673; --sk-on: #072416; } [data-sk="V18"] { --sk: #E24A9C; --sk-on: #fff; } [data-sk="V19"] { --sk: #0EA5E9; --sk-on: #04202E; } [data-sk="V20"] { --sk: #F59E0B; --sk-on: #2A1B00; } [data-sk="V21"] { --sk: #6366F1; --sk-on: #fff; } [data-sk="V22"] { --sk: #84CC16; --sk-on: #1A2A00; } [data-sk="V23"] { --sk: #D946EF; --sk-on: #fff; } [data-sk="V24"] { --sk: #64748B; --sk-on: #fff; } [data-sk="V25"] { --sk: #3355E0; --sk-on: #fff; } [data-sk="V26"] { --sk: #0FB5A3; --sk-on: #0B1A2E; } [data-sk="V27"] { --sk: #8A55F0; --sk-on: #fff; } [data-sk="V28"] { --sk: #FF7A45; --sk-on: #1A1030; } [data-sk="V29"] { --sk: #2BB673; --sk-on: #072416; } [data-sk="V30"] { --sk: #E24A9C; --sk-on: #fff; }
.skdot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: var(--sk, var(--brand)); flex: none; }

/* ---------- Thông báo & trạng thái ---------- */
.note { background: var(--warn-soft); color: var(--warn-ink); border-radius: 16px; padding: 12px 16px; font-size: 15px; margin: 0 0 14px; font-weight: 600; }
.note:has(> svg.i) { display: flex; gap: 10px; align-items: flex-start; }
.note > svg.i { margin-top: 2px; }
.note.info { background: var(--brand-soft); color: var(--brand); }
.note.okn { background: var(--ok-soft); color: var(--ok-ink); }
.note b { font-weight: 800; }
.msgs { list-style: none; padding: 0; margin: 16px 0 0; }
.msgs li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 16px; margin-bottom: 8px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; animation: rise .25s ease-out both; }
.msgs li.success { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; }
.msgs li.error { background: var(--bad-soft); color: var(--bad-ink); border-color: transparent; }
.msgs li.warning { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.feedback { display: flex; gap: 10px; align-items: flex-start; border-radius: 16px; padding: 12px 16px; margin-top: 14px; font-size: 16px; font-weight: 600; animation: rise .2s ease-out both; }
.feedback > div { flex: 1; min-width: 0; }
.feedback.ok { background: var(--ok-soft); color: var(--ok-ink); }
.feedback.no { background: var(--bad-soft); color: var(--bad-ink); }
.feedback.soft { background: var(--warn-soft); color: var(--warn-ink); }
.feedback.wait { background: var(--warn-soft); color: var(--warn-ink); }
.feedback.neutral { background: var(--brand-soft); color: var(--brand); }
.feedback .tiny { opacity: .9; margin-top: 4px; font-weight: 500; }
.empty { text-align: center; padding: 28px 18px; color: var(--muted); }
.empty .ic { width: 56px; height: 56px; border-radius: 50%; background: var(--surface2); color: var(--muted); display: grid; place-items: center; margin: 0 auto 12px; }
.empty .ic svg.i { width: 26px; height: 26px; }
.empty .owl { margin: 0 auto 8px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; font-size: 19px; }
.empty p { max-width: 46ch; margin: 0 auto 14px; }
.skeleton { position: relative; overflow: hidden; background: var(--surface2); border-radius: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); } }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; margin: 10px 0; } .sk-title { height: 26px; width: 60%; margin: 6px 0 14px; } .sk-block { height: 120px; margin-top: 14px; }

/* ---------- Biểu mẫu ---------- */
label { font-weight: 800; display: block; margin: 14px 0 6px; font-size: 15px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--r-in); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; min-height: 48px; transition: border-color .12s, box-shadow .12s; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 24px; height: 24px; flex: none; margin: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; margin: 6px 0; padding: 8px 4px; min-height: 44px; cursor: pointer; }
.check input { margin-top: 1px; }
.check.strong { font-weight: 800; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field-row > div { flex: 1; min-width: 160px; }
.field-row label { margin-top: 0; }
form .actions-row { margin-top: 16px; }

/* ---------- Bảng ---------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-card); }
.card.tablewrap { padding: 4px 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
th { color: var(--muted); font-weight: 800; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; background: var(--surface2); }
th:first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px; } th:last-child { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--brand); }
th[data-sort]::after { content: "↕"; margin-left: 4px; opacity: .4; font-size: 12px; }
th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--brand); }
th[aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--brand); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.group, tr.group td { background: var(--surface2); font-weight: 800; }
.sticky-col td { vertical-align: middle; }
.sticky-col th:first-child, .sticky-col td:first-child { min-width: 200px; position: sticky; left: 0; z-index: 1; background: var(--surface); }
.sticky-col th:first-child { background: var(--surface2); }
@media (min-width: 1024px) { .r-t td { padding-top: 11px; padding-bottom: 11px; } }

/* ---------- Đăng nhập / đồng ý ---------- */
.auth { max-width: 440px; margin: 0 auto; padding: 8px 0 0; }
.auth-hero { text-align: center; margin: 2vh 0 18px; }
.auth-hero .owl { margin: 0 auto 4px; width: 132px; animation: bob 3.2s ease-in-out infinite; }
.auth-hero h1 { margin: 0 0 6px; font-size: 34px; letter-spacing: -.03em; }
.auth-hero h1 b { color: var(--brand); }
.auth-hero p { color: var(--muted); margin: 0 auto; max-width: 34ch; font-weight: 600; }
.auth .card { padding: 22px; }
.loginbox { max-width: 440px; margin: 6vh auto 0; }
.consent-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 12px; }
.consent-list li { display: flex; gap: 12px; align-items: flex-start; }
.consent-list .ic { width: 42px; height: 42px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; box-shadow: 0 3px 0 color-mix(in srgb, var(--brand) 30%, var(--brand-soft)); }
.consent-list .ic.warn { background: var(--warn-soft); color: var(--warn-ink); box-shadow: 0 3px 0 color-mix(in srgb, var(--warn) 40%, var(--warn-soft)); }
.consent-list .ic.ok { background: var(--ok-soft); color: var(--ok-ink); box-shadow: 0 3px 0 color-mix(in srgb, var(--ok) 40%, var(--ok-soft)); }
.agree { display: flex; gap: 12px; align-items: flex-start; background: var(--brand-soft); border: 2px solid transparent; border-radius: 16px; padding: 14px; font-weight: 800; cursor: pointer; margin-top: 8px; }
.agree:has(input:checked) { border-color: var(--brand); }
.owlsay { display: flex; align-items: flex-end; gap: 12px; margin: 18px 0 14px; }
.owlsay .owl { width: 96px; }
.bubble { position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 12px 16px; font-weight: 700; flex: 1; min-width: 0; }
.bubble::before { content: ""; position: absolute; left: -9px; bottom: 22px; width: 14px; height: 14px; background: var(--surface); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.bubble h1, .bubble h2 { margin: 0 0 2px; }

/* ---------- Hôm nay ---------- */
.today { display: grid; gap: 8px 28px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "path" "rail"; }
.t-hero { grid-area: hero; } .t-path { grid-area: path; } .t-rail { grid-area: rail; }
@media (min-width: 1024px) { .today { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "hero rail" "path rail"; align-items: start; } .t-rail { margin-top: 20px; position: sticky; top: calc(var(--hh) + 20px); } }
.hero { display: flex; align-items: center; gap: 14px; margin: 20px 0 6px; animation: rise .3s ease-out both; }
.hero .owl { width: 108px; margin-bottom: -4px; }
.hero .bubble { padding: 14px 18px; }
.hero h1 { margin: 0 0 2px; font-size: 25px; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; font-weight: 600; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.stat-pill { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 8px 14px; font-weight: 800; box-shadow: 0 4px 0 var(--line); }
.stat-pill .ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn-deep); flex: none; }
.stat-pill .ico svg.i { width: 22px; height: 22px; }
.stat-pill .ico.fire { background: #FFE9C7; color: #E86A00; }
.stat-pill .n { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-pill .l { font-size: 12.5px; color: var(--muted); line-height: 1.2; font-weight: 700; }
.stat-pill.goal { flex: 1; min-width: 170px; flex-wrap: wrap; row-gap: 6px; }
.stat-pill.goal .progressbar { flex: 1 1 100%; height: 14px; }
.stat-pill.goal.done { border-color: var(--ok); box-shadow: 0 4px 0 var(--ok-deep); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; }
.section-title .sub { color: var(--muted); font-size: 14px; font-weight: 600; }

/* Đường học */
.pathhead { display: flex; align-items: center; gap: 12px; margin: 26px 0 0; }
.pathhead h2 { margin: 0; }
.pathhead .line { flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.pathwrap { max-width: 380px; margin: 4px auto 0; padding-top: 20px; }
.prow { position: relative; height: 196px; margin: 0 48px; }
.prow:last-child { height: 160px; }
.pconn { position: absolute; left: 0; top: 88px; width: 100%; height: 196px; overflow: visible; z-index: 0; pointer-events: none; }
.pconn path { fill: none; stroke: color-mix(in srgb, var(--muted) 45%, var(--line)); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 1 17; vector-effect: non-scaling-stroke; }
.pconn.done path { stroke: var(--ok); }
.pnode { position: absolute; top: 40px; left: calc(var(--x) * 1%); width: 160px; margin-left: -80px; text-align: center; z-index: 1; --size: 92px; }
.pbtn { position: relative; display: block; width: calc(var(--size) + 16px); height: calc(var(--size) + 16px); margin: 0 auto; border-radius: 50%; text-decoration: none; color: var(--sk-on);
  background: conic-gradient(var(--ringc, var(--ok)) calc(var(--pct) * 1%), var(--line) 0); padding: 8px; -webkit-tap-highlight-color: transparent; cursor: pointer; border: 0; font: inherit; }
.pbtn:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; border-radius: 50%; }
.pcore { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--sk); color: var(--sk-on); box-shadow: 0 6px 0 color-mix(in srgb, var(--sk) 62%, #000), inset 0 -4px 0 rgba(0, 0, 0, .0);
  border: 5px solid var(--surface); transition: transform .1s, box-shadow .1s; position: relative; }
.pbtn:active .pcore { transform: translateY(5px); box-shadow: 0 1px 0 color-mix(in srgb, var(--sk) 62%, #000); }
.pcore svg.i { width: 40px; height: 40px; stroke-width: 2.4; }
.pcore::after { content: ""; position: absolute; left: 18%; top: 10%; width: 36%; height: 16%; border-radius: 50%; background: rgba(255, 255, 255, .3); transform: rotate(-24deg); }
.pcode { position: absolute; left: -2px; top: -2px; min-width: 32px; padding: 0 6px; height: 24px; border-radius: 12px; background: var(--surface); color: var(--ink); border: 2px solid var(--line); font-size: 12.5px; font-weight: 800; display: grid; place-items: center; z-index: 2; letter-spacing: .02em; }
.pbadge { position: absolute; right: -4px; bottom: -2px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; z-index: 2; border: 3px solid var(--surface); }
.pbadge svg.i { width: 18px; height: 18px; stroke-width: 3; }
.pbadge.star { background: var(--accent); color: #19213A; }
.pbadge.star svg.i { fill: currentColor; }
.pbadge.redo { background: var(--warn-fill); color: var(--warn-fill-ink); }
.pbadge.lock { background: var(--surface2); color: var(--muted); border-color: var(--surface); }
.pinfo { display: inline-block; max-width: 100%; margin-top: 10px; padding: 4px 10px 2px; background: var(--bg); border-radius: 14px; }
.plabel { font-weight: 800; font-size: 14.5px; line-height: 1.25; color: var(--ink); }
.pstate { display: inline-block; margin-top: 2px; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.pnode.mastered { --ringc: var(--accent); }
.pnode.completed { --ringc: var(--ok); }
.pnode.review { --ringc: var(--warn); }
.pnode.current, .pnode.learning { --ringc: var(--brand); }
.pnode.current { --size: 104px; }
.pnode.current .pcore { animation: pulse 1.8s ease-in-out infinite; }
.pnode.locked .pcore { background: var(--surface2); color: var(--muted); box-shadow: 0 6px 0 var(--line); border-color: var(--surface); }
.pnode.locked .pcore::after { display: none; }
.pnode.locked .plabel { color: var(--muted); }
.pnode.locked .pbtn:active .pcore { box-shadow: 0 1px 0 var(--line); }
.pstart { position: absolute; left: 50%; bottom: calc(100% - 2px); transform: translateX(-50%); animation: bob 1.6s ease-in-out infinite; z-index: 3; white-space: nowrap; }
.pstart span { display: block; background: var(--surface); color: var(--brand); border: 2px solid var(--brand); border-radius: 14px; padding: 5px 14px; font-weight: 800; font-size: 14px; letter-spacing: .08em; box-shadow: 0 4px 0 var(--brand-deep); position: relative; }
.pstart span::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; background: var(--surface); border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: translateX(-50%) rotate(45deg); }
.pend { text-align: center; padding: 8px 0 12px; position: relative; z-index: 1; }
.pend .owl { width: 84px; margin: 0 auto 6px; }
.pend p { color: var(--muted); font-weight: 700; margin: 0; font-size: 14px; }
.pathfoot { max-width: 380px; margin: 0 auto; }
@media (max-width: 380px) { .prow { margin: 0 40px; } .pnode { width: 140px; margin-left: -70px; } }

/* Bảng chi tiết kỹ năng (bấm vào nút tròn) */
.sheet-back { position: fixed; inset: 0; background: rgba(14, 20, 36, .55); z-index: 60; animation: fadein .15s ease-out; }
.sheet-back[hidden], .sheet[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }
.sheet { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 2px solid var(--line); border-radius: 24px 24px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); animation: slideup .22s cubic-bezier(.2, .9, .3, 1); max-width: 520px; margin: 0 auto; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -10px auto 14px; }
.sheet h3 { font-size: 20px; margin: 0 0 4px; }
.sheet .sk { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sheet .sk .dot { width: 46px; height: 46px; border-radius: 50%; background: var(--sk); color: var(--sk-on); display: grid; place-items: center; box-shadow: 0 4px 0 color-mix(in srgb, var(--sk) 62%, #000); flex: none; }
.sheet p { color: var(--muted); font-weight: 600; margin: 8px 0 14px; }
.sheet .acts { display: grid; gap: 10px; }
@media (min-width: 640px) { .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 440px; transform: translate(-50%, -50%); border-radius: 24px; border: 2px solid var(--line); animation: pop .2s ease-out; } .sheet .grab { display: none; } }

/* Cột phải: nhiệm vụ & bài giao */
.rail-card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-card); padding: 16px; margin-bottom: 16px; }
.rail-card h2 { font-size: 18px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.rail-card h2 svg.i { color: var(--brand); }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 2px solid var(--line); border-radius: 16px; margin-bottom: 10px; background: var(--surface); box-shadow: 0 4px 0 var(--line); }
.task:last-child { margin-bottom: 0; }
.task .num { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--sk, var(--brand)); color: var(--sk-on, #fff); display: grid; place-items: center; font-weight: 800; box-shadow: 0 3px 0 color-mix(in srgb, var(--sk, var(--brand)) 62%, #000); }
.task.done { background: var(--ok-soft); border-color: transparent; box-shadow: none; }
.task.done .num { background: var(--ok); color: #072416; box-shadow: 0 3px 0 var(--ok-deep); }
.task.locked { background: var(--surface2); border-style: dashed; box-shadow: none; }
.task.locked .num { background: var(--surface); color: var(--muted); box-shadow: none; border: 2px solid var(--line); }
.task .body { flex: 1; min-width: 0; }
.task h3 { margin: 0; font-size: 16px; }
.task .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.task .why { margin: 4px 0 0; font-size: 14.5px; color: var(--ink); font-weight: 500; }
.task .meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.task .lockwhy { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); margin-top: 8px; font-weight: 600; }
.task .go { margin-top: 10px; }
.assign { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px; border: 2px solid var(--line); border-radius: 16px; margin-bottom: 10px; box-shadow: 0 4px 0 var(--line); background: var(--surface); }
.assign:last-child { margin-bottom: 0; }
.assign .info { flex: 1; min-width: 160px; }
.assign .t { font-weight: 800; }
.assign .m { color: var(--muted); font-size: 14px; margin-top: 2px; font-weight: 600; }
.mini-progress { margin-top: 8px; max-width: 280px; }
.mini-progress.progressbar { height: 12px; }
.quiet { margin-top: 36px; padding-top: 16px; border-top: 2px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

/* ---------- Làm bài (kiểu Duolingo) ---------- */
.runner header.top { display: none; }
.runner .netbar { top: 0; }
.runner .wrap { max-width: 760px; padding-bottom: 150px; }
@media (min-width: 1024px) { .r-s.runner { padding-left: 0; } .r-s.runner nav.main { display: none; } }
@media (max-width: 767.98px) { .r-s.runner nav.main { display: none; } .r-s.runner { padding-bottom: 0; } }
.qhead { display: flex; align-items: center; gap: 14px; padding: 16px 0 6px; position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: calc(16px + env(safe-area-inset-top)); }
.qclose { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--muted); text-decoration: none; flex: none; }
.qclose:hover { background: var(--surface2); color: var(--ink); }
.qclose svg.i { width: 28px; height: 28px; stroke-width: 3; }
.qbar { flex: 1; height: 20px; background: var(--surface2); border-radius: 999px; overflow: hidden; border: 2px solid var(--line); }
.qbar > i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 999px; transition: width .7s cubic-bezier(.3, .9, .3, 1); position: relative; min-width: 0; }
.qbar > i::after { content: ""; position: absolute; left: 10px; right: 10px; top: 3px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .4); }
.qtitle { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 4px 0 10px; }
.qtitle h1 { margin: 0; font-size: 15px; color: var(--muted); font-weight: 800; letter-spacing: .02em; }
.savestate { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-height: 24px; font-weight: 700; }
.savestate::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.savestate.saving::before { background: var(--accent); }
.savestate.saved::before { background: var(--ok); }
.savestate.err::before { background: var(--bad); }
.savestate:empty { display: none; }
.testbar { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: var(--warn-ink); padding: 10px 16px; border-radius: 16px; font-weight: 700; font-size: 14.5px; margin: 0 0 14px; }
.qprog { margin: 4px 0 10px; }
.pill-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.pill { min-width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font: inherit; font-weight: 800; cursor: pointer; font-size: 15px; color: var(--muted); box-shadow: 0 3px 0 var(--line); transition: transform .08s, box-shadow .08s; display: inline-grid; place-items: center; padding: 0 8px; }
.pill:hover { border-color: var(--brand); }
.pill:active { transform: translateY(3px); box-shadow: none; }
.pill.cur { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); box-shadow: 0 3px 0 var(--brand-deep); }
.pill.done { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; box-shadow: 0 3px 0 color-mix(in srgb, var(--ok) 45%, var(--ok-soft)); }
.pill.wait { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; box-shadow: 0 3px 0 color-mix(in srgb, var(--warn) 45%, var(--warn-soft)); }
.pill.again { background: var(--surface2); color: var(--muted); border-color: transparent; box-shadow: 0 3px 0 var(--line); }
.pill.cur.done { border: 2px solid var(--ok); }
.pill.cur.again { border: 2px solid var(--warn); }
.qcard { padding: 22px; animation: rise .25s ease-out both; }
#app .card.tutor, #app .card.donecard { animation: rise .3s ease-out both; }
.qmeta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.qmeta .sk { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); background: var(--surface2); padding: 4px 12px; border-radius: 999px; }
.prompt { font-size: 20px; line-height: 1.55; font-weight: 700; white-space: pre-wrap; margin: 0 0 20px; max-width: 68ch; }
.choices { display: grid; gap: 12px; }
.choice { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; border: 2px solid var(--line); border-radius: 18px; cursor: pointer; font-size: 17px; line-height: 1.45; font-weight: 600; background: var(--surface);
  box-shadow: 0 4px 0 var(--line); transition: border-color .12s, background .12s, transform .08s, box-shadow .08s; }
.choice:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 40%, var(--surface)); }
.choice:active { transform: translateY(4px); box-shadow: none; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice .key { flex: none; width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--line); color: var(--muted); display: grid; place-items: center; font-weight: 800; transition: background .12s, color .12s; }
.choice input:focus-visible ~ .key { outline: 3px solid var(--brand); outline-offset: 2px; }
.choice.sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 4px 0 var(--brand-deep); color: var(--ink); }
.choice.sel .key { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.choice.right { border-color: var(--ok-deep); background: var(--ok-soft); box-shadow: 0 4px 0 var(--ok-deep); animation: pop .35s ease-out; }
.choice.right .key { background: var(--ok-fill); color: var(--ok-fill-ink); border-color: var(--ok-fill); }
.choice.miss { border-color: var(--warn-deep); background: var(--warn-soft); box-shadow: 0 4px 0 var(--warn-deep); animation: wiggle .4s ease-out; }
.choice.miss .key { background: var(--warn-fill); color: var(--warn-fill-ink); border-color: var(--warn-fill); }
.choice.locked { cursor: default; }
.choice.locked:active { transform: none; }
.choice.locked:not(.sel):not(.right):not(.miss) { opacity: .65; }
.choice .txt { flex: 1; min-width: 0; }
.answer-area { position: relative; }
.answer-area textarea { min-height: 180px; font-size: 17px; border-radius: 18px; padding: 14px 16px; }
.counter { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 6px; font-weight: 600; }
.counter .n.warn { color: var(--warn-ink); font-weight: 800; }
.qdone-inline { margin-top: 16px; }
.qfoot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 2px solid var(--line); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.qfoot .in { max-width: 760px; margin: 0 auto; display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.qfoot .btn.primary, .qfoot .btn.okb { flex: 1; max-width: 300px; font-size: 16px; }
.qfoot .btn.ghost { margin-right: auto; }
@media (max-width: 520px) { .qfoot .btn.primary, .qfoot .btn.okb { max-width: none; } }
.fbsheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: slideup .28s cubic-bezier(.2, .9, .3, 1); border-top: 3px solid var(--fb-line); background: var(--fb-bg); color: var(--fb-ink); }
.fbsheet.ok { --fb-bg: var(--ok-soft); --fb-line: var(--ok-deep); --fb-ink: var(--ok-ink); }
.fbsheet.no { --fb-bg: var(--warn-soft); --fb-line: var(--warn-deep); --fb-ink: var(--warn-ink); }
.fbsheet.wait { --fb-bg: var(--brand-soft); --fb-line: var(--brand); --fb-ink: var(--ink); }
.fbsheet .in { max-width: 760px; margin: 0 auto; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.fbsheet .owl { width: 84px; animation: pop .4s ease-out; }
.fbsheet .msg { flex: 1; min-width: 200px; }
.fbsheet h2 { margin: 0 0 4px; font-size: 22px; color: var(--fb-ink); }
.fbsheet .txt { font-weight: 600; font-size: 15.5px; white-space: pre-wrap; color: var(--ink); }
.fbsheet .tiny { margin-top: 4px; color: var(--muted); font-weight: 600; }
.fbsheet .acts { display: flex; gap: 10px; flex: 1 1 100%; justify-content: flex-end; flex-wrap: wrap; }
.fbsheet .acts .btn.primary, .fbsheet .acts .btn.okb, .fbsheet .acts .btn.warnb { min-width: 180px; }
@media (max-width: 520px) { .fbsheet .owl { width: 64px; } .fbsheet .acts .btn { flex: 1; } .fbsheet h2 { font-size: 20px; } }
.helpbox { margin-top: 20px; border-top: 2px dashed var(--line); padding-top: 14px; }
.helpbox .lbl { font-size: 14px; color: var(--muted); font-weight: 800; margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.help { display: block; border-left: 5px solid var(--brand); background: var(--brand-soft); border-radius: 0 14px 14px 0; padding: 10px 14px; margin-top: 10px; white-space: pre-wrap; animation: rise .2s ease-out both; font-weight: 600; }
.help .src { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 800; margin-bottom: 2px; }
.errcard { text-align: center; padding: 26px 18px; }
.errcard .owl { width: 120px; margin: 0 auto 8px; }

/* Màn ăn mừng */
.celebrate { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px 40px; text-align: center; animation: fadein .25s ease-out; }
.celebrate .owl { width: min(220px, 52vw); animation: bob 1.4s ease-in-out infinite; }
.celebrate h2 { font-size: 34px; margin: 6px 0 4px; letter-spacing: -.02em; }
.celebrate p.lead { margin: 0 auto 18px; }
.celebrate .stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(480px, 100%); margin: 0 auto 22px; }
.cstat { border: 2px solid; border-radius: 18px; overflow: hidden; background: var(--surface); text-align: center; }
.cstat .h { font-size: 12px; font-weight: 800; padding: 5px 4px; letter-spacing: .05em; text-transform: uppercase; color: #fff; }
.cstat .v { font-size: 30px; font-weight: 800; padding: 10px 4px 8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cstat .v small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.cstat.okc { border-color: var(--ok-deep); } .cstat.okc .h { background: var(--ok-fill); color: var(--ok-fill-ink); }
.cstat.selfc { border-color: var(--brand); } .cstat.selfc .h { background: var(--brand); color: var(--brand-ink); }
.cstat.redoc { border-color: var(--warn-deep); } .cstat.redoc .h { background: var(--warn-fill); color: var(--warn-fill-ink); }
.celebrate .acts { width: min(480px, 100%); display: grid; gap: 10px; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 51; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall 3.2s linear infinite; opacity: 0; }

/* Gia sư AI — Cú Văn và bậc thang 4 mức */
.card.tutor { padding: 0; overflow: hidden; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); margin-top: 18px; }
.tutor-head { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--brand-soft); flex-wrap: wrap; }
.tutor-head .av { width: 64px; height: 64px; flex: none; margin-bottom: -2px; }
.tutor-head h3 { margin: 0; font-size: 18px; }
.tutor-head .sub { font-size: 14px; color: var(--muted); font-weight: 600; }
.tutor-head .badge { margin-left: auto; white-space: nowrap; background: var(--surface); }
.tutor-head > div:nth-child(2) { flex: 1; min-width: 160px; }
.tutor-body { padding: 16px 18px 18px; }
.ladder { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.step { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 4px 0 var(--line); position: relative; }
.step:nth-child(2) { margin-left: 14px; } .step:nth-child(3) { margin-left: 28px; } .step:nth-child(4) { margin-left: 42px; }
.step .n { width: 40px; height: 40px; border-radius: 50%; background: var(--surface2); color: var(--muted); display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.step .t { font-weight: 800; font-size: 15.5px; line-height: 1.3; }
.step .d { font-size: 13.5px; color: var(--muted); line-height: 1.4; font-weight: 600; }
.step .why { display: flex; gap: 6px; align-items: flex-start; font-size: 13.5px; color: var(--warn-ink); margin-top: 4px; line-height: 1.4; font-weight: 700; }
.step .why svg.i { width: 15px; height: 15px; margin-top: 2px; }
.step.next { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 60%, var(--surface)); box-shadow: 0 4px 0 var(--brand-deep); }
.step.next .n { background: var(--brand); color: var(--brand-ink); }
.step.done { box-shadow: 0 4px 0 color-mix(in srgb, var(--ok) 40%, var(--line)); }
.step.done .n { background: var(--ok-soft); color: var(--ok-ink); }
.step.done .t { color: var(--muted); }
.step.locked { background: var(--surface2); border-style: dashed; box-shadow: none; opacity: .85; }
.step.locked .t { color: var(--muted); }
.step.locked .n { background: var(--surface); }
.step .act { justify-self: end; display: flex; align-items: center; gap: 4px; }
.step .doneflag { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: var(--ok-ink); font-weight: 800; }
@media (max-width: 520px) {
  .step { grid-template-columns: 40px 1fr; align-items: start; }
  .step:nth-child(2) { margin-left: 6px; } .step:nth-child(3) { margin-left: 12px; } .step:nth-child(4) { margin-left: 18px; }
  .step .act { grid-column: 2; justify-self: stretch; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .step.next .act .btn { width: 100%; } .step .n { margin-top: 2px; }
}
.chat { max-height: 380px; overflow: auto; display: grid; gap: 12px; margin: 14px 0; padding: 2px; scroll-behavior: smooth; }
.chat:empty { display: none; }
.msg-row { display: flex; align-items: flex-end; gap: 8px; animation: rise .2s ease-out both; }
.msg-row .owl { width: 44px; margin-bottom: -2px; }
.msg-row.me { justify-content: flex-end; }
.bub { padding: 10px 16px; border-radius: 20px; max-width: 88%; white-space: pre-wrap; line-height: 1.55; font-weight: 600; }
.bub .src { display: flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 800; margin-bottom: 4px; }
.bub .src svg.i { width: 14px; height: 14px; }
.bub .meta { font-size: 12.5px; opacity: .85; margin-top: 6px; font-weight: 600; }
.bub.me { background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; }
.bub.ai { background: var(--surface2); color: var(--ink); border-bottom-left-radius: 6px; border: 2px solid var(--line); }
.bub.ai .src { color: var(--brand); }
.bub.teacher { background: var(--warn-soft); color: var(--ink); border-bottom-left-radius: 6px; }
.bub.teacher .src { color: var(--warn-ink); }
.bub.sys { background: var(--surface2); color: var(--muted); font-size: 14px; }
.msg-row .bub.sys, .msg-row .bub.teacher { max-width: 92%; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: bob .9s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.ask-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.ask-row textarea { flex: 1; min-width: 200px; min-height: 52px; border-radius: 16px; }

/* Hộp thoại */
dialog.dlg { border: 0; border-radius: 24px; padding: 22px; width: min(92vw, 440px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.dlg::backdrop { background: rgba(14, 20, 36, .55); }
dialog.dlg h3 { font-size: 20px; margin-bottom: 8px; }
dialog.dlg .row { justify-content: flex-end; margin-top: 16px; }

/* ---------- Tiến bộ ---------- */
.progress-head { display: flex; align-items: flex-end; gap: 12px; margin: 20px 0 14px; }
.progress-head .owl { width: 104px; }
.progress-head h1 { margin: 0 0 4px; }
.progress-head p { margin: 0; color: var(--muted); font-weight: 600; font-size: 15px; }
.ind { padding: 14px 0; border-top: 2px solid var(--line); display: grid; grid-template-columns: 44px 1fr; gap: 0 14px; }
.ind:first-child { border-top: 0; padding-top: 4px; }
.ind-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); box-shadow: 0 3px 0 color-mix(in srgb, var(--brand) 30%, var(--brand-soft)); grid-row: 1 / span 3; }
.ind-ic svg.i { width: 24px; height: 24px; }
.ind-ic.i1 { background: var(--ok-soft); color: var(--ok-ink); box-shadow: 0 3px 0 color-mix(in srgb, var(--ok) 40%, var(--ok-soft)); }
.ind-ic.i2 { background: var(--warn-soft); color: var(--warn-ink); box-shadow: 0 3px 0 color-mix(in srgb, var(--warn) 40%, var(--warn-soft)); }
.ind-ic.i3 { background: #EFE6FF; color: #6A35C9; box-shadow: 0 3px 0 #D6C3F8; }
.ind-ic.i4 { background: #FFE3F1; color: #B02C77; box-shadow: 0 3px 0 #F6C0DC; }
:root[data-theme="dark"] .ind-ic.i3 { background: #2B1F52; color: #C3A8FF; box-shadow: 0 3px 0 #3C2D70; }
:root[data-theme="dark"] .ind-ic.i4 { background: #45182F; color: #FF9CCC; box-shadow: 0 3px 0 #5F2542; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ind-ic.i3 { background: #2B1F52; color: #C3A8FF; box-shadow: 0 3px 0 #3C2D70; }
  :root:not([data-theme="light"]) .ind-ic.i4 { background: #45182F; color: #FF9CCC; box-shadow: 0 3px 0 #5F2542; }
}
.ind > :not(.ind-ic) { grid-column: 2; min-width: 0; }
.ind-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ind-title { font-weight: 800; font-size: 16.5px; }
.ind-val { font-size: 15px; font-variant-numeric: tabular-nums; font-weight: 600; }
.ind-val b { font-size: 24px; letter-spacing: -.02em; }
.ind .bar { margin: 8px 0 6px; height: 16px; }
.ind-text { font-size: 14.5px; font-weight: 500; }
.ind details { margin-top: 6px; }
.story { background: var(--brand-soft); border-radius: 20px; padding: 18px; margin-top: 16px; color: var(--ink); border: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.story .ttl { font-weight: 800; color: var(--brand); margin-bottom: 12px; font-size: 15.5px; }
.story-flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.story-flow .st { flex: 1; min-width: 120px; background: var(--surface); border-radius: 16px; padding: 12px 14px; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.story-flow .st:nth-child(3) { border-color: var(--warn); } .story-flow .st:nth-child(5) { border-color: var(--ok); }
.story-flow .st .k { font-size: 13px; color: var(--muted); font-weight: 700; }
.story-flow .st .v { font-size: 28px; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; }
.story-flow .arr { display: grid; place-items: center; color: var(--brand); }
@media (max-width: 520px) { .story-flow { flex-direction: column; } .story-flow .arr svg { transform: rotate(90deg); } }
.skillcard { border-top: 8px solid var(--sk, var(--brand)); }
.skillcard h3 { display: flex; align-items: center; gap: 8px; }
.dots { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.dot svg.i { width: 16px; height: 16px; stroke-width: 3.2; }
.dot.ok { background: var(--ok-soft); color: var(--ok-ink); } .dot.no { background: var(--warn-soft); color: var(--warn-ink); }
.dot.helped { outline: 2px dashed var(--muted); outline-offset: 2px; }
.legend { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 6px 0 12px; align-items: center; font-weight: 700; }
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 16px; height: 16px; border-radius: 5px; border: 2px solid transparent; }

.map-group { padding: 16px; }
.map-group > .row { margin-bottom: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; margin: 4px 0 14px; }
.tile { min-height: 66px; border-radius: 16px; padding: 8px 10px; display: flex; flex-direction: column; justify-content: space-between; border: 2px solid transparent; background: var(--surface2); color: var(--muted); font-size: 12.5px; line-height: 1.25; font-weight: 700; }
.tile b { font-size: 17px; color: inherit; letter-spacing: -.01em; }
.tile.mastered { background: var(--ok-soft); color: var(--ok-ink); border-color: var(--ok); box-shadow: 0 4px 0 color-mix(in srgb, var(--ok) 55%, var(--ok-soft)); }
.tile.forming { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn); box-shadow: 0 4px 0 color-mix(in srgb, var(--warn) 55%, var(--warn-soft)); }
.tile.support { background: var(--bad-soft); color: var(--bad-ink); border-color: var(--bad); box-shadow: 0 4px 0 color-mix(in srgb, var(--bad) 55%, var(--bad-soft)); }
.tile.insufficient, .tile.noitems, .tile.inactive { background: transparent; color: var(--muted); border: 2px dashed var(--line); }
.sub-row { padding: 10px 0; border-top: 2px solid var(--line); }
.sub-row .row { align-items: flex-start; }
.sub-row details { margin-top: 4px; }

/* ---------- Bài học ---------- */
.skillnav { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 12px; margin: 0 -4px 8px; scrollbar-width: none; }
.skillnav::-webkit-scrollbar { display: none; }
.skillnav form { flex: none; margin: 0; }
.skillnav a, .skillnav button, .skillnav-current { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 15px; box-shadow: 0 4px 0 var(--line); }
.skillnav button { font-family: inherit; cursor: pointer; }
.skillnav a.on, .skillnav-current.on { background: var(--sk); color: var(--sk-on); border-color: color-mix(in srgb, var(--sk) 62%, #000); box-shadow: 0 4px 0 color-mix(in srgb, var(--sk) 62%, #000); }
.skillnav a.on .skdot, .skillnav-current.on .skdot { background: var(--sk-on); }
.purpose-hub { margin: 0 0 16px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.purpose-hub-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:14px; }
.purpose-hub-head h2 { margin:0 0 4px; font-size:20px; }.purpose-hub-head p { margin:0; color:var(--muted); }
.purpose-grid { display:grid; grid-template-columns:repeat(5,minmax(160px,1fr)); gap:10px; }
.purpose-card { min-height:174px; padding:14px; border:1px solid var(--line); border-radius:14px; color:var(--ink); text-decoration:none; background:var(--surface2); transition:border-color .15s,transform .15s,box-shadow .15s; }
.purpose-card:hover,.purpose-card:focus-visible,.purpose-card.active { border-color:var(--brand); box-shadow:0 6px 16px color-mix(in srgb,var(--brand) 12%,transparent); transform:translateY(-2px); outline:none; }
.purpose-card-top { display:flex; align-items:center; justify-content:space-between; gap:8px; }.purpose-mark { width:34px; height:34px; display:grid; place-items:center; border-radius:10px; background:var(--brand-soft); color:var(--brand); }.purpose-mark .i { width:18px; height:18px; }.purpose-count,.purpose-meta { color:var(--muted); font-size:12px; font-weight:700; }.purpose-card h3 { margin:14px 0 5px; font-size:16px; }.purpose-card p { min-height:40px; margin:0 0 12px; color:var(--muted); font-size:13px; line-height:1.4; }.purpose-meta { display:block; padding-top:10px; border-top:1px solid var(--line); }
.purpose-filter { display:flex; gap:8px; flex-wrap:wrap; margin-top:20px; }.purpose-filter a { padding:7px 12px; border:1px solid var(--line); border-radius:999px; color:var(--ink); text-decoration:none; font-size:13px; font-weight:700; background:var(--surface); }.purpose-filter a.active { background:var(--brand); border-color:var(--brand); color:#fff; }
.purpose-chip { display:inline-flex; padding:4px 8px; border-radius:999px; background:var(--surface2); color:var(--muted); font-size:12px; font-weight:700; }.purpose-learning { color:var(--brand); }.purpose-practice { color:var(--ok); }.purpose-assessment { color:var(--warn); }.purpose-teacher { color:#7a52cc; }
.course-lane { margin:16px 0; padding:20px; border:1px solid var(--line); border-radius:18px; background:var(--surface); }.course-lane h2 { margin:0; font-size:20px; }.course-video { border-left:5px solid #7a52cc; }.course-assessment { border-left:5px solid var(--warn); }.course-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; border-top:1px solid var(--line); color:var(--ink); }.course-link { text-decoration:none; }.course-link:hover b { color:var(--brand); }.skill-course-group { padding:12px 0; border-top:1px solid var(--line); }.skill-course-group h3 { margin:0 0 4px; font-size:16px; }
.topic-manager { margin:20px 0; padding:0; overflow:hidden; border:1px solid #dce6f7; border-radius:20px; background:var(--surface); box-shadow:0 10px 28px rgba(20,67,137,.06); }.topic-manager-head { display:flex; justify-content:space-between; gap:24px; padding:26px 28px 20px; background:linear-gradient(115deg,#f6f9ff 0%,#fff 62%); border-bottom:1px solid #e4ebf7; }.topic-manager h2 { margin:3px 0 6px; font-size:22px; letter-spacing:-.025em; }.topic-manager-head p { max-width:650px; margin:0; color:var(--muted); line-height:1.55; }.topic-kicker { color:#3169c8; font-size:12px; font-weight:800; }.topic-count { display:flex; flex-direction:column; align-items:center; justify-content:center; min-width:74px; padding:8px 12px; border:1px solid #d8e5fa; border-radius:14px; background:#fff; color:#466183; line-height:1.1; }.topic-count b { color:var(--brand); font-size:25px; font-variant-numeric:tabular-nums; }.topic-count span { font-size:12px; font-weight:700; }.topic-create { display:flex; gap:10px; align-items:center; padding:18px 28px; border-bottom:1px solid #e4ebf7; background:#fbfcff; }.topic-create input { flex:1; margin:0; }.topic-create .btn { white-space:nowrap; }.topic-list { padding:0 28px 12px; }.topic-row { display:flex; align-items:center; gap:14px; min-height:74px; border-bottom:1px solid #e9eef7; }.topic-row:last-child { border-bottom:0; }.topic-order { width:32px; color:#7d95bb; font-size:12px; font-weight:800; letter-spacing:.04em; }.topic-title-form { display:flex; flex:1; align-items:center; gap:9px; min-width:0; }.topic-title-form input { flex:1; min-width:0; margin:0; border-color:transparent; background:transparent; font-size:16px; font-weight:750; }.topic-title-form input:hover { border-color:#d9e3f4; background:#fbfcff; }.topic-title-form input:focus { border-color:var(--brand); background:#fff; }.topic-actions { display:flex; align-items:center; gap:8px; }.topic-actions form { margin:0; }.topic-visibility { display:inline-flex; align-items:center; gap:7px; min-height:34px; padding:0 10px; border:1px solid #dce5f3; border-radius:9px; background:#fff; color:#71819a; font:inherit; font-size:12px; font-weight:750; cursor:pointer; }.topic-visibility span { width:7px; height:7px; border-radius:50%; background:#aab6c8; }.topic-visibility.is-live { border-color:#bfe9d9; background:#f1fcf7; color:#187b58; }.topic-visibility.is-live span { background:#20af7d; }.topic-empty { display:flex; flex-direction:column; gap:4px; padding:34px 0; color:var(--muted); text-align:center; }.topic-empty b { color:var(--ink); }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (max-width:760px) { .topic-manager-head { padding:20px; align-items:flex-start; }.topic-create { padding:14px 20px; }.topic-list { padding:0 20px 10px; }.topic-row { align-items:flex-start; flex-wrap:wrap; padding:14px 0; }.topic-order { padding-top:10px; }.topic-title-form { flex-basis:calc(100% - 46px); }.topic-actions { width:100%; padding-left:46px; } }
@media (max-width:480px) { .topic-manager-head { flex-direction:column; gap:12px; }.topic-count { align-items:flex-start; flex-direction:row; gap:6px; min-width:0; }.topic-count b { font-size:18px; }.topic-create { align-items:stretch; flex-direction:column; }.topic-create .btn { width:100%; }.topic-title-form { flex-wrap:wrap; }.topic-title-form .btn { margin-left:auto; }.topic-actions { flex-wrap:wrap; } }
@media (max-width:1100px) { .purpose-grid { grid-template-columns:repeat(3,minmax(160px,1fr)); } }
@media (max-width:650px) { .purpose-hub { padding:14px; }.purpose-hub-head { align-items:flex-start; flex-direction:column; }.purpose-grid { grid-template-columns:1fr; }.purpose-card { min-height:auto; }.purpose-card p { min-height:0; } }
.lesson-hero { display: flex; align-items: center; gap: 14px; border-radius: 24px; padding: 18px 20px; margin: 4px 0 16px; background: var(--sk); color: var(--sk-on); border-bottom: 5px solid color-mix(in srgb, var(--sk) 62%, #000); }
.lesson-hero .ic { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, .25); display: grid; place-items: center; flex: none; }
.lesson-hero .ic svg.i { width: 30px; height: 30px; }
.lesson-hero .k { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.lesson-hero h2 { margin: 0; font-size: 22px; color: inherit; }
.lesson { padding: 22px; }
.lesson h2 { margin-top: 4px; font-size: 24px; }
.lesson p, .lesson li { max-width: 66ch; font-size: 17px; line-height: 1.75; font-weight: 500; }
.lesson li { margin: 6px 0; }
.lesson .readtime { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13.5px; font-weight: 700; }
.explain { border-left: 8px solid var(--sk, var(--brand)); }
.explain p { font-size: 16px; line-height: 1.65; }

/* ---------- Giáo viên ---------- */
.stat { display: flex; align-items: center; gap: 14px; }
.stat .ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--surface2); flex: none; }
.stat .ic .lv { width: 18px; height: 18px; }
.stat .v { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13.5px; color: var(--muted); line-height: 1.3; font-weight: 700; }
.kpi { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.todo { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); text-decoration: none; color: var(--ink); box-shadow: 0 4px 0 var(--line); transition: border-color .12s, transform .08s, box-shadow .08s; font-weight: 500; }
.todo:hover { border-color: var(--brand); text-decoration: none; }
.todo:active { transform: translateY(4px); box-shadow: none; }
.todo .ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.todo.warn .ic { background: var(--warn-soft); color: var(--warn-ink); }
.todo.bad .ic { background: var(--bad-soft); color: var(--bad-ink); }
.todo .t { font-weight: 800; font-size: 16px; }
.todo .d { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.todo .go { margin-left: auto; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; align-items: center; }
.filters .btn { border-radius: 999px; }
.lvcell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.splitgrid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1000px) { .splitgrid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } .sticky { position: sticky; top: calc(var(--hh) + 16px); } }
.splitgrid > div > .card:last-child { margin-bottom: 0; }
.decision { border: 3px solid var(--brand); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.decision h3 { color: var(--brand); }
.ans { white-space: pre-wrap; background: var(--surface2); border-radius: 16px; padding: 14px; line-height: 1.8; font-size: 16px; }
.qtext { white-space: pre-wrap; line-height: 1.65; }
mark.good, mark.issue { padding: 1px 3px; border-radius: 4px; color: inherit; }
mark.good { background: var(--ok-soft); box-shadow: inset 0 -3px 0 var(--ok); }
mark.issue { background: var(--warn-soft); box-shadow: inset 0 -3px 0 var(--warn); }
.score-big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; }
details summary { cursor: pointer; font-weight: 800; min-height: 32px; display: flex; align-items: center; gap: 6px; padding: 4px 0; }
details[open] > summary { color: var(--brand); }
details > summary::marker { color: var(--muted); }
.logline { border-top: 1px solid var(--line); padding: 8px 0; }
.logline:first-of-type { border-top: 0; }
.eval-card[data-bad] { opacity: .6; }

@media (max-width: 560px) {
  h1 { font-size: 26px; }
  .hero .owl { width: 84px; } .hero h1 { font-size: 21px; }
  .progress-head .owl { width: 76px; }
  .card { padding: 16px; }
  .qcard { padding: 16px; }
  .prompt { font-size: 18.5px; }
  .celebrate h2 { font-size: 28px; }
}

@media print { header.top, nav.main, .netbar, .btn, .skip { display: none !important; } .r-t, .r-s { padding-left: 0; } body { background: #fff; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .skeleton::after, .confetti { display: none; }
}

/* Giáo viên: thẻ số liệu có màu theo mức */
.stat .ic:has(.lv-ok) { background: var(--ok-soft); } .stat .ic:has(.lv-support) { background: var(--warn-soft); }
.stat .ic:has(.lv-intervene) { background: var(--bad-soft); } .stat .ic:has(.lv-nodata) { background: var(--surface2); }
.stat .ic .lv { width: 20px; height: 20px; }
.r-t h1 { font-size: 30px; }
.r-t .page-head { margin-top: 24px; }
.r-t .card { padding: 20px; }

/* Hồ sơ học sinh: đọc kết quả theo ma trận đề thay vì chỉ một bảng điểm tổng. */
.student-profile-heading { position:relative; overflow:hidden; padding:22px 25px; border:1px solid color-mix(in srgb, var(--brand) 20%, var(--line)); border-radius:20px; background:linear-gradient(115deg, color-mix(in srgb, var(--brand) 10%, var(--surface)), var(--surface) 58%); }
.student-profile-heading::after { content:""; position:absolute; width:190px; height:190px; right:-65px; top:-100px; border:26px solid color-mix(in srgb, var(--brand) 8%, transparent); border-radius:50%; pointer-events:none; }
.student-profile-heading h1 { margin:3px 0 5px; }.student-profile-heading p { position:relative; z-index:1; }
.student-assessments { margin: 20px 0 24px; padding: 22px; border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); border-radius: 22px; background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 55%, var(--surface)) 0%, var(--surface) 46%); }
.student-section-head { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; margin-bottom:18px; }
.student-section-head h2 { margin:2px 0 4px; font-size:24px; letter-spacing:-.025em; }
.student-section-head p:not(.student-profile-kicker) { margin:0; color:var(--muted); max-width:66ch; font-size:14px; }
.student-profile-kicker { margin:0 0 4px; color:var(--brand); font-size:12px; font-weight:800; letter-spacing:.02em; }
.student-assessment-count { flex:none; border-radius:999px; padding:7px 11px; color:var(--brand); background:var(--brand-soft); font-size:13px; font-weight:800; }
.student-assessment-list { display:grid; gap:13px; }
.student-assessment-card { overflow:hidden; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
.student-assessment-card-head { display:flex; justify-content:space-between; gap:18px; align-items:flex-start; padding:18px 19px 15px; border-bottom:1px solid var(--line); }
.student-assessment-course { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-bottom:5px; color:var(--muted); font-size:12px; font-weight:700; }
.student-assessment-course span { color:var(--brand); }
.student-assessment-card h3 { margin:0; font-size:17px; line-height:1.3; }
.student-assessment-score { min-width:92px; text-align:right; }
.student-assessment-score strong { display:block; color:var(--brand); font-size:25px; font-variant-numeric:tabular-nums; letter-spacing:-.035em; line-height:1; }
.student-assessment-score span { display:block; margin-top:4px; color:var(--muted); font-size:12px; font-weight:700; }
.student-assessment-meta { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding:12px 19px; color:var(--muted); font-size:13px; font-weight:650; }
.skill-chip { display:inline-flex; align-items:center; gap:5px; padding:5px 8px; border-radius:7px; color:var(--brand); background:var(--brand-soft); font-weight:800; }
.student-assessment-target { margin:0 19px 13px; padding:11px 13px; border-left:3px solid var(--brand); border-radius:0 10px 10px 0; background:var(--surface2); }
.student-assessment-target b { font-size:12px; }
.student-assessment-target p { margin:3px 0 0; font-size:13px; line-height:1.5; }
.student-subskill-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); border-top:1px solid var(--line); }
.student-subskill-row { display:flex; justify-content:space-between; gap:12px; min-height:84px; padding:14px 19px; border-bottom:1px solid var(--line); }
.student-subskill-row:nth-child(odd) { border-right:1px solid var(--line); }
.student-subskill-row b { display:block; margin-top:3px; font-size:13px; line-height:1.3; }
.student-subskill-row small { display:block; margin-top:4px; color:var(--muted); font-size:11px; }
.student-subskill-code { color:var(--brand); font-size:11px; font-weight:850; }
.student-subskill-score { flex:none; text-align:right; align-self:center; }
.student-subskill-score b { color:var(--ink); font-size:16px; }
.student-subskill-score span { display:block; color:var(--muted); font-size:11px; font-weight:700; white-space:nowrap; }
.student-assessment-empty { margin:0; padding:0 19px 14px; color:var(--muted); font-size:13px; }
.student-assessment-footer { display:flex; justify-content:space-between; gap:14px; align-items:center; padding:12px 19px; color:var(--muted); background:var(--surface2); font-size:12px; font-weight:650; }
.student-assessment-footer > span { max-width:75ch; }
.student-assessment-empty-state { display:flex; gap:13px; align-items:flex-start; padding:20px; border:1px dashed var(--line); border-radius:14px; background:var(--surface); }
.student-assessment-empty-state .i { width:25px; height:25px; color:var(--brand); flex:none; }
.student-assessment-empty-state h3 { margin:0 0 3px; font-size:15px; }.student-assessment-empty-state p { margin:0; color:var(--muted); font-size:13px; }
.student-ai-insight { margin-top:24px; padding:22px; border:1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); border-radius:22px; background:linear-gradient(130deg, color-mix(in srgb,var(--brand-soft) 42%,var(--surface)),var(--surface) 55%); }.student-ai-result { border:1px solid var(--line); border-radius:16px; overflow:hidden; background:var(--surface); }.student-ai-result-head { display:flex; justify-content:space-between; gap:12px; padding:14px 17px; border-bottom:1px solid var(--line); background:var(--surface2); }.student-ai-result-head span { color:var(--muted); font-size:12px; font-weight:650; }.student-ai-summary { margin:0; padding:17px; line-height:1.65; font-size:15px; }.student-ai-columns { display:grid; grid-template-columns:1fr 1fr; border-top:1px solid var(--line); }.student-ai-card { padding:16px 17px; }.student-ai-card + .student-ai-card { border-left:1px solid var(--line); }.student-ai-card h3 { margin:0 0 10px; font-size:14px; }.student-ai-card.good h3 { color:#07855f; }.student-ai-card.support h3 { color:#bf6d00; }.student-ai-card ul { list-style:none; padding:0; margin:0; display:grid; gap:10px; }.student-ai-card li b { display:block; font-size:13px; }.student-ai-card li span { display:block; margin-top:3px; color:var(--muted); font-size:13px; line-height:1.45; }.student-ai-next { margin:0 17px 17px; padding:13px 14px; border-radius:12px; background:var(--surface2); font-size:13px; }.student-ai-next ol { margin:7px 0 0; padding-left:20px; display:grid; gap:5px; line-height:1.45; }.student-ai-note { margin:0 17px 17px; color:var(--muted); font-size:12px; line-height:1.45; }.student-ai-empty { display:flex; align-items:flex-start; gap:12px; padding:18px; border:1px dashed var(--line); border-radius:14px; background:var(--surface); }.student-ai-empty .i { width:26px; height:26px; color:var(--brand); flex:none; }.student-ai-empty p { margin:4px 0 0; color:var(--muted); font-size:13px; }
.student-tutor-section .student-section-head h2 { margin:0 0 4px; }.student-ai-compact { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; margin:0 0 12px; padding:11px 13px; border-radius:11px; background:var(--brand-soft); font-size:13px; }.student-ai-compact span { color:var(--muted); flex:1 1 360px; }.student-ai-compact a { font-weight:750; }

@media (max-width:720px) {
  .student-assessments { margin-inline:-2px; padding:16px; border-radius:16px; }
  .student-section-head, .student-assessment-card-head, .student-assessment-footer { flex-direction:column; }
  .student-assessment-score { text-align:left; }.student-assessment-score strong { font-size:22px; }
  .student-subskill-grid { grid-template-columns:1fr; }.student-subskill-row:nth-child(odd) { border-right:0; }
  .student-assessment-target { margin-inline:15px; }.student-assessment-meta, .student-assessment-card-head, .student-assessment-footer, .student-subskill-row { padding-left:15px; padding-right:15px; }
  .student-ai-insight { padding:16px; border-radius:16px; }.student-ai-columns { grid-template-columns:1fr; }.student-ai-card + .student-ai-card { border-left:0; border-top:1px solid var(--line); }.student-ai-result-head { flex-direction:column; }
}
