/* ============ HSK Mỗi Ngày — Design System ============ */
:root {
  --red: #D8232A;
  --red-dark: #B01B22;
  --red-soft: #FDECEC;
  --blue: #3B82C4;
  --blue-dark: #2C6699;
  --blue-soft: #EAF3FB;
  --gray-bg: #F5F6F8;
  --surface: #FFFFFF;
  --line: #E7E9EE;
  --text: #1F2430;
  --muted: #6B7280;
  --good: #2E9E6B;
  --good-soft: #E7F6EE;
  --warn: #E7A008;
  --warn-soft: #FCF3DD;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20,30,50,.05), 0 6px 20px rgba(20,30,50,.06);
  --shadow-lg: 0 12px 40px rgba(20,30,50,.14);
  --sidebar-w: 248px;
  --han: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--gray-bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 15px; }
.han { font-family: var(--han); }
/* Default size for inline icons (SVGs have viewBox but no width/height).
   More specific rules below (.nav a svg, .btn svg, .stat .ic svg, …) override. */
svg { width: 20px; height: 20px; flex: none; vertical-align: -0.18em; }

/* ---------- Layout ---------- */
#app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
/* min-width:0 lets the grid column shrink below its content's intrinsic width,
   so wide children (e.g. the scrollable lesson tab bar) don't force page overflow. */
.view { padding: 28px 34px 64px; max-width: 1180px; min-width: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 14px; gap: 6px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-size: 18px; }
.brand-text b { color: var(--red); }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff;
  font-family: var(--han); font-weight: 700; font-size: 22px; box-shadow: 0 4px 12px rgba(216,35,42,.35);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 14.5px; transition: .12s;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--gray-bg); color: var(--text); }
.nav a.active { background: var(--red-soft); color: var(--red-dark); font-weight: 600; }
.nav a.active svg { color: var(--red); }
.nav .nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9aa1ac; padding: 14px 11px 4px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: 10px; }
.streak-mini { background: linear-gradient(135deg,#fff5f5,#fef0ea); border:1px solid var(--red-soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; display:flex; align-items:center; gap:8px; }
.streak-mini b { color: var(--red); font-size: 18px; }

/* ---------- Topbar (mobile) ---------- */
.topbar { display: none; }
.scrim { display: none; }

/* ---------- Typography ---------- */
.page-head { margin: 0 0 20px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.page-head p { margin: 5px 0 0; color: var(--muted); }
h2.section-title { font-size: 18px; font-weight: 700; margin: 26px 0 12px; display:flex; align-items:center; gap:8px; }
.muted { color: var(--muted); }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card.pad-lg { padding: 22px 24px; }
.card-hover { transition: .15s; cursor: pointer; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #dfe3ea; }

/* ---------- Stat tiles ---------- */
.stat { display: flex; align-items: center; gap: 14px; }
.stat .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .ic svg { width: 22px; height: 22px; }
.ic.red { background: var(--red-soft); color: var(--red); }
.ic.blue { background: var(--blue-soft); color: var(--blue); }
.ic.green { background: var(--good-soft); color: var(--good); }
.ic.amber { background: var(--warn-soft); color: var(--warn); }
.stat .val { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat .lbl { font-size: 12.5px; color: var(--muted); }

/* ---------- Progress ---------- */
.bar { height: 8px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--red-dark)); border-radius: 99px; transition: width .5s; }
.bar.blue > i { background: linear-gradient(90deg, var(--blue), var(--blue-dark)); }
.bar.green > i { background: linear-gradient(90deg, #34c07d, var(--good)); }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--red) calc(var(--p)*1%), var(--gray-bg) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 12px; background: var(--surface); border-radius: 50%; }
.ring .ring-in { position: relative; text-align: center; }
.ring .ring-in b { font-size: 30px; font-weight: 800; }
.ring .ring-in span { font-size: 12px; color: var(--muted); display: block; }

/* ---------- Pills / tags / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.pill.red { background: var(--red-soft); color: var(--red-dark); }
.pill.blue { background: var(--blue-soft); color: var(--blue-dark); }
.pill.green { background: var(--good-soft); color: var(--good); }
.pill.gray { background: var(--gray-bg); color: var(--muted); }
.pill.amber { background: var(--warn-soft); color: #b9820a; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13.5px; font-weight: 500; transition: .12s; }
.chip:hover { border-color: var(--red); color: var(--red); }
.chip.active { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 18px; border-radius: 11px; border: 1px solid transparent; font-weight: 600; font-size: 14.5px; transition: .13s; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--red); color: var(--red); }
.btn-soft { background: var(--red-soft); color: var(--red-dark); }
.btn-soft:hover { background: #fbdbdb; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 18px; color: var(--text); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: none; background: none; padding: 11px 15px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--red); border-bottom-color: var(--red); }

/* ---------- Forms ---------- */
.field { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); outline: none; transition: .12s; }
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
textarea.field { resize: vertical; min-height: 96px; line-height: 1.6; }
.select { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }

/* ---------- Vocab / hanzi cells ---------- */
.vocab-row { display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.vocab-row:last-child { border-bottom: none; }
.vocab-han { font-family: var(--han); font-size: 24px; font-weight: 500; min-width: 66px; }
.vocab-py { color: var(--blue-dark); font-weight: 600; font-size: 14px; }
.vocab-mean { color: var(--text); }
.speak-btn { margin-left: auto; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--blue); flex: none; }
.speak-btn:hover { background: var(--blue-soft); }

.hanzi-cell { text-align: center; }
.hanzi-glyph { font-family: var(--han); font-size: 72px; line-height: 1; font-weight: 500; }

/* ---------- Flashcard ---------- */
.flashcard { perspective: 1200px; height: 300px; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; text-align: center; padding: 22px; box-shadow: var(--shadow); }
.flash-back { transform: rotateY(180deg); background: var(--red-soft); }

/* ---------- Quiz ---------- */
.quiz-opt { display: flex; align-items: center; gap: 11px; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 12px; margin-bottom: 10px; cursor: pointer; transition: .12s; background: var(--surface); }
.quiz-opt:hover { border-color: var(--blue); background: var(--blue-soft); }
.quiz-opt .mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.quiz-opt.correct { border-color: var(--good); background: var(--good-soft); }
.quiz-opt.correct .mark { border-color: var(--good); background: var(--good); color: #fff; }
.quiz-opt.wrong { border-color: var(--red); background: var(--red-soft); }
.quiz-opt.wrong .mark { border-color: var(--red); background: var(--red); color: #fff; }
.quiz-opt.disabled { pointer-events: none; }

/* ---------- Audio / subtitle ---------- */
.subtitle-line { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.subtitle-line .zh { font-family: var(--han); font-size: 18px; }
.subtitle-line .py { color: var(--blue-dark); font-size: 13px; }
.subtitle-line .vi { color: var(--muted); font-size: 14px; }
.hide-sub .py, .hide-sub .vi { visibility: hidden; }
.hide-py .rd-py { visibility: hidden; }
.hide-vi .rd-vi { visibility: hidden; }

/* ---------- Speaking highlight ---------- */
.syl { padding: 1px 3px; border-radius: 5px; }
.syl.warn { background: var(--warn-soft); color: #a9780a; }
.syl.bad { background: var(--red-soft); color: var(--red-dark); }
.syl.ok { background: var(--good-soft); color: var(--good); }

/* ---------- Misc ---------- */
.list-clean { list-style: none; margin: 0; padding: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.mt { margin-top: 16px; } .mt-sm { margin-top: 8px; } .mb { margin-bottom: 16px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.tag-han { font-family: var(--han); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.kbd { font-size: 12px; background: var(--gray-bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.callout { border-left: 3px solid var(--blue); background: var(--blue-soft); padding: 11px 14px; border-radius: 8px; font-size: 14px; }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.callout.red { border-color: var(--red); background: var(--red-soft); }
.badge-ach { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 14px; border-radius: 12px; border: 1px solid var(--line); }
.badge-ach .em { font-size: 34px; }
.badge-ach.locked { opacity: .4; filter: grayscale(1); }

/* progress mini chart */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 10px; }
.chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar-col i { width: 60%; max-width: 30px; background: linear-gradient(180deg, var(--blue), var(--blue-dark)); border-radius: 6px 6px 0 0; display: block; transition: height .5s; }
.chart .bar-col span { font-size: 11px; color: var(--muted); }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1f2430; color: #fff; padding: 11px 20px; border-radius: 11px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* stroke order */
.stroke-box { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; position: relative; background:
  linear-gradient(var(--line),var(--line)) center/100% 1px no-repeat,
  linear-gradient(var(--line),var(--line)) center/1px 100% no-repeat; }
.stroke-box .grid-x { position:absolute; inset:0; background:
  repeating-linear-gradient(45deg, transparent 0 88px, var(--line) 88px 89px); opacity:.4; pointer-events:none;}
.stroke-glyph { font-family: var(--han); font-size: 140px; line-height: 180px; text-align: center; color: var(--text); }
.trace-canvas { border: 1px solid var(--line); border-radius: 12px; background: #fff; touch-action: none; }

/* recent history list */
.hist-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 40;
  }
  .topbar-brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
  .topbar-brand .brand-mark { width: 30px; height: 30px; font-size: 17px; border-radius: 9px; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60; width: 264px; height: 100vh;
    transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg);
  }
  #app.menu-open .sidebar { transform: translateX(0) !important; }
  #app.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20,30,50,.4); z-index: 50; }
  .view { padding: 18px 16px 60px; }
  .page-head h1 { font-size: 22px; }
  /* collapse any inline multi-column grid to a single column on tablet/phone */
  .view [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .view [style*="display:flex"], .view [style*="display: flex"] { flex-wrap: wrap; }
  .ring { width: 116px; height: 116px; }
}
@media (max-width: 560px) {
  .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .view { padding: 16px 13px 56px; }
  .stat .val { font-size: 21px; }
}

/* ============ Admin & Auth ============ */

/* --- Auth (login/register) page: hide app chrome, center card --- */
#app.no-chrome { grid-template-columns: 1fr; }
#app.no-chrome .sidebar, #app.no-chrome .topbar, #app.no-chrome .scrim { display: none !important; }
#app.no-chrome .view { max-width: none; padding: 0; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1000px 500px at 80% -10%, var(--red-soft), transparent 60%),
  radial-gradient(800px 400px at -10% 110%, var(--blue-soft), transparent 60%), var(--gray-bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; font-size: 20px; font-weight: 700; }
.auth-card .field { margin-bottom: 12px; }
.auth-err { color: var(--red-dark); background: var(--red-soft); border-radius: 9px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }
.auth-demo { background: var(--blue-soft); border-radius: 10px; padding: 11px 13px; font-size: 13px; margin-top: 14px; line-height: 1.7; }
.auth-demo code { background: #fff; border-radius: 6px; padding: 1px 7px; font-size: 12.5px; }

/* --- Sidebar user footer --- */
.user-mini { display: flex; align-items: center; gap: 10px; padding: 10px 8px 4px; }
.user-mini .avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-dark); display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.user-mini .u-name { font-size: 13.5px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini .u-role { font-size: 11.5px; color: var(--muted); }
.user-mini .logout-btn { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; flex: none; }
.user-mini .logout-btn:hover { color: var(--red); border-color: var(--red); }
.user-mini .logout-btn svg { width: 16px; height: 16px; }

/* --- Nav unread badge --- */
.nav a .nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 99px; display: grid; place-items: center; padding: 0 5px; }

/* --- Data table (admin) --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--gray-bg); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table .t-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .t-actions .icon-btn { width: 32px; height: 32px; border-radius: 8px; font-size: 14px; }
.table .t-actions .icon-btn svg { width: 15px; height: 15px; }

/* --- Role badges --- */
.badge-role { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.badge-role.admin { background: var(--red-soft); color: var(--red-dark); }
.badge-role.giaovien { background: var(--blue-soft); color: var(--blue-dark); }
.badge-role.hocvien { background: var(--good-soft); color: var(--good); }

/* --- Admin forms --- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label, .f-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.editor-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar .field { max-width: 260px; }

/* --- Notifications --- */
.notif-item { display: flex; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--surface); align-items: flex-start; }
.notif-item.unread { border-left: 3px solid var(--red); background: #fffafa; }
.notif-item .n-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.notif-item .n-title { font-weight: 600; font-size: 14.5px; }
.notif-item .n-body { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.notif-item .n-time { font-size: 12px; color: #9aa1ac; margin-top: 4px; }

/* --- Misc admin --- */
.swatch { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface); }
.admin-detail-back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }
.admin-detail-back:hover { color: var(--red); }

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .editor-row { grid-template-columns: 1fr; }
  .filter-bar .field { max-width: none; width: 100%; }
}

/* ============ Public Landing Page ============ */
.lp { background: #fff; }
.lp-container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.btn-lg { padding: 13px 26px; font-size: 15.5px; border-radius: 12px; }

/* Header */
.lp-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.lp-headrow { display: flex; align-items: center; gap: 20px; height: 68px; }
.lp-logo { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; white-space: nowrap; }
.lp-logo b { color: var(--red); }
.lp-nav { display: flex; gap: 26px; margin-left: 18px; }
.lp-nav a { color: var(--text); font-weight: 500; font-size: 15px; transition: .12s; }
.lp-nav a:hover { color: var(--red); }
.lp-head-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lp-hi { font-size: 14px; color: var(--muted); }

/* Hero */
.lp-hero { padding: 60px 0 40px; background:
  radial-gradient(900px 420px at 88% -10%, var(--red-soft), transparent 60%),
  radial-gradient(700px 380px at -5% 40%, #fff5f0, transparent 55%); }
.lp-hero-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 44px; align-items: center; }
.lp-hero-text h1 { font-size: 46px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; margin: 0 0 16px; }
.lp-red { color: var(--red); }
.lp-hero-text > p { font-size: 18px; color: var(--muted); margin: 0 0 26px; max-width: 460px; }
.lp-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.lp-hero-mini { display: flex; gap: 22px; flex-wrap: wrap; }
.lp-hero-mini > div { display: flex; align-items: center; gap: 10px; }
.lp-hero-mini svg { width: 22px; height: 22px; color: var(--red); flex: none; }
.lp-hero-mini b { display: block; font-size: 13.5px; }
.lp-hero-mini span { display: block; font-size: 12.5px; color: var(--muted); }

/* Dashboard mockup */
.lp-hero-mock { min-width: 0; }
.lp-mock { display: grid; grid-template-columns: 116px 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.lp-mock-side { background: linear-gradient(180deg, var(--red), var(--red-dark)); padding: 14px 10px; color: #fff; }
.lp-mock-brand { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; margin-bottom: 12px; }
.lp-mock-nav { font-size: 11.5px; padding: 7px 9px; border-radius: 8px; color: rgba(255,255,255,.82); margin-bottom: 2px; }
.lp-mock-nav.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
.lp-mock-main { padding: 14px; min-width: 0; }
.lp-mock-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.lp-mock-top b { font-size: 14px; display: block; }
.lp-mock-top span { font-size: 11px; color: var(--muted); }
.lp-mock-fire { background: var(--red-soft); color: var(--red-dark); font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.lp-mock-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.lp-mock-c { border: 1px solid var(--line); border-radius: 11px; padding: 10px; text-align: center; }
.lp-mock-c > span { font-size: 10.5px; color: var(--muted); display: block; margin-bottom: 6px; }
.lp-mock-c b { font-size: 11px; display: block; }
.lp-mock-center { display: flex; flex-direction: column; align-items: center; }
.lp-mock-lesson { width: 34px; height: 34px; border-radius: 9px; background: var(--red-soft); display: grid; place-items: center; font-size: 18px; margin: 0 auto 6px; }
.lp-mock-ring { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--red) 62%, var(--gray-bg) 0); margin: 2px auto; }
.lp-mock-ring::before { content: ""; position: absolute; inset: 7px; background: #fff; border-radius: 50%; }
.lp-mock-ring i { position: relative; font-size: 13px; font-weight: 800; font-style: normal; }
.lp-mock-fire-big { font-size: 26px; margin: 2px 0 4px; }
.lp-mock-goal { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; font-size: 11.5px; color: var(--muted); }

/* Sections */
.lp-section { padding: 56px 0; }
.lp-soft { background: linear-gradient(180deg, #fff, var(--gray-bg)); }
.lp-section-head { text-align: center; margin-bottom: 32px; }
.lp-section-head h2 { font-size: 30px; font-weight: 800; margin: 0 0 8px; }
.lp-section-head p { color: var(--muted); margin: 0; }
.lp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }

/* Feature cards */
.lp-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.lp-feature { transition: .15s; }
.lp-feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #dfe3ea; }
.lp-feature-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; }
.lp-feature-ic svg { width: 24px; height: 24px; }
.lp-feature h3 { margin: 0 0 6px; font-size: 17px; }
.lp-feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

/* Roadmap */
.lp-roadmap-wrap { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 22px; align-items: center; }
.lp-roadmap-main { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); min-width: 0; }
.lp-roadmap-main h2 { margin: 0 0 20px; font-size: 22px; }
.lp-road { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.lp-road-step { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.lp-road-node { width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--red); color: var(--red-dark); display: grid; place-items: center; font-size: 10px; font-weight: 600; line-height: 1; text-align: center; background: var(--surface); }
.lp-road-node b { font-size: 16px; }
.lp-road-node.lv3, .lp-road-node.lv4 { border-color: var(--warn); color: #b9820a; }
.lp-road-node.lv5, .lp-road-node.lv6 { border-color: var(--blue); color: var(--blue-dark); }
.lp-road-meta { text-align: center; }
.lp-road-meta b { display: block; font-size: 12px; }
.lp-road-meta span { display: block; font-size: 11.5px; color: var(--muted); }
.lp-road-line { color: #c7ccd6; flex: none; display: grid; place-items: center; }
.lp-road-line svg { width: 18px; height: 18px; }
.lp-roadmap-box { background: linear-gradient(180deg, var(--warn-soft), #fff); border: 1px solid var(--warn-soft); border-radius: var(--radius); padding: 24px; text-align: center; }
.lp-roadmap-box .lp-feature-ic { margin: 0 auto 12px; }
.lp-roadmap-box b { font-size: 17px; display: block; margin-bottom: 6px; }
.lp-roadmap-box p { margin: 0; color: var(--muted); font-size: 14px; }

/* Pricing */
.lp-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
.lp-plan { position: relative; display: flex; flex-direction: column; transition: .15s; }
.lp-plan:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.lp-plan.featured { border: 2px solid var(--red); box-shadow: 0 12px 40px rgba(216,35,42,.16); }
.lp-plan h3 { margin: 0 0 10px; font-size: 19px; }
.lp-plan-badge { position: absolute; top: -12px; right: 18px; background: var(--gray-bg); color: var(--muted); font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); }
.lp-plan-badge.hot { background: var(--red); color: #fff; border-color: var(--red); }
.lp-price { margin-bottom: 16px; }
.lp-price b { font-size: 32px; font-weight: 800; }
.lp-price span { color: var(--muted); font-size: 14px; }
.lp-plan-items { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.lp-plan-items li { display: flex; gap: 9px; font-size: 14px; align-items: flex-start; }
.lp-plan-items svg { width: 18px; height: 18px; color: var(--good); flex: none; margin-top: 1px; }
.lp-plan-cta { width: 100%; }

/* FAQ */
.lp-faq-wrap { max-width: 780px; }
.lp-faq-item { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; background: var(--surface); overflow: hidden; }
.lp-faq-q { width: 100%; text-align: left; background: none; border: none; padding: 16px 18px; font-size: 15.5px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--text); }
.lp-faq-plus { color: var(--red); font-size: 22px; font-weight: 400; transition: .2s; flex: none; }
.lp-faq-item.open .lp-faq-plus { transform: rotate(45deg); }
.lp-faq-a { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.lp-faq-item.open .lp-faq-a { max-height: 300px; }
.lp-faq-a p { margin: 0; padding: 0 18px 16px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }

/* Final CTA */
.lp-final { background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; padding: 60px 0; }
.lp-final-in { text-align: center; }
.lp-final-in h2 { font-size: 32px; font-weight: 800; margin: 0 0 10px; }
.lp-final-in p { font-size: 17px; opacity: .92; margin: 0 0 24px; }
.lp-final-btn { background: #fff; color: var(--red-dark); }
.lp-final-btn:hover { background: #fff5f5; }

/* Footer */
.lp-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 24px 0; }
.lp-footrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.lp-footrow .muted { font-size: 13.5px; }

/* ============ Onboarding wizard ============ */
.ob-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(900px 440px at 85% -10%, var(--red-soft), transparent 60%),
  radial-gradient(700px 380px at -5% 110%, var(--blue-soft), transparent 60%), var(--gray-bg); }
.ob-card { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 26px 28px 22px; }
.ob-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ob-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.ob-stepno { font-size: 13px; color: var(--muted); font-weight: 600; }
.ob-bar { height: 7px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; margin-bottom: 22px; }
.ob-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--red-dark)); border-radius: 99px; transition: width .35s; }
.ob-q { margin-bottom: 20px; }
.ob-q h1 { font-size: 24px; font-weight: 800; margin: 0 0 6px; letter-spacing: -.01em; }
.ob-q p { color: var(--muted); margin: 0; font-size: 14.5px; }
.ob-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ob-options.ob-dense { grid-template-columns: repeat(2, 1fr); }
.ob-opt { display: flex; align-items: center; gap: 12px; padding: 14px 15px; border: 1.5px solid var(--line); border-radius: 13px; background: var(--surface); text-align: left; transition: .13s; position: relative; }
.ob-opt:hover { border-color: var(--red); background: #fffafa; }
.ob-opt-em { font-size: 22px; flex: none; width: 26px; text-align: center; }
.ob-opt-label { font-weight: 600; font-size: 14.5px; flex: 1; }
.ob-opt-check { opacity: 0; color: var(--red); flex: none; transition: .12s; }
.ob-opt-check svg { width: 20px; height: 20px; }
.ob-opt.active { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 3px rgba(216,35,42,.10); }
.ob-opt.active .ob-opt-label { color: var(--red-dark); }
.ob-opt.active .ob-opt-check { opacity: 1; }
.ob-days { margin-top: 16px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; }
.ob-days-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ob-day { width: 46px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px; transition: .12s; }
.ob-day:hover { border-color: var(--red); }
.ob-day.active { background: var(--red); border-color: var(--red); color: #fff; }
.ob-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; }
.btn-skip { background: none; border: none; color: var(--muted); font-size: 13.5px; font-weight: 500; padding: 8px 6px; }
.btn-skip:hover { color: var(--red); }
.ob-summary { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.ob-sum-row { display: flex; gap: 13px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--gray-bg); }
.ob-sum-em { font-size: 22px; flex: none; }
.ob-sum-k { font-size: 12px; color: var(--muted); }
.ob-sum-v { font-weight: 600; font-size: 14.5px; }

@media (max-width: 560px) {
  .ob-card { padding: 20px 16px 18px; border-radius: 16px; }
  .ob-q h1 { font-size: 20px; }
  .ob-options, .ob-options.ob-dense { grid-template-columns: 1fr; }
  .ob-nav { flex-wrap: wrap; }
  .ob-nav .btn, .ob-nav .flex { width: 100%; }
  .ob-nav .flex { justify-content: space-between; }
}

/* ---- Plan gate (tường nâng cấp) ---- */
.plan-wall { max-width: 540px; margin: 24px auto; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px 28px;
  background-image: radial-gradient(600px 240px at 50% -20%, var(--red-soft), transparent 65%); }
.plan-wall-ic { font-size: 46px; margin-bottom: 10px; line-height: 1; }
.plan-wall h2 { margin: 0 0 8px; font-size: 21px; }
.plan-wall p { color: var(--muted); margin: 0 0 20px; }
.plan-wall-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Landing responsive */
@media (max-width: 900px) {
  .lp-hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .lp-hero-text h1 { font-size: 36px; }
  .lp-hero-mock { order: 2; }
  .lp-nav { display: none; }
  .lp-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .lp-roadmap-wrap { grid-template-columns: 1fr; }
  .lp-grid-3 { grid-template-columns: 1fr; max-width: 440px; margin: 0 auto; }
  .lp-plan.featured { order: -1; }
}
@media (max-width: 560px) {
  .lp-container { padding: 0 16px; }
  .lp-hero { padding: 36px 0 24px; }
  .lp-hero-text h1 { font-size: 29px; }
  .lp-hero-text > p { font-size: 16px; }
  .lp-hero-cta .btn { width: 100%; }
  .lp-grid-4 { grid-template-columns: 1fr; }
  .lp-hi { display: none; }
  .lp-head-actions .btn { padding: 8px 12px; font-size: 13px; }
  .lp-section, .lp-final { padding: 40px 0; }
  .lp-section-head h2, .lp-final-in h2 { font-size: 25px; }
  .lp-headrow { height: 60px; gap: 10px; }
  .lp-logo { font-size: 16px; }
}

/* ============ AI Tutor ============ */
.ai-spin { display:inline-block; width:16px; height:16px; border:2px solid var(--red-soft); border-top-color:var(--red); border-radius:50%; animation:aispin .7s linear infinite; vertical-align:-3px; }
@keyframes aispin { to { transform:rotate(360deg); } }
.ai-loading { display:flex; align-items:center; gap:10px; padding:26px; justify-content:center; color:var(--muted); font-size:14px; }
.ai-result h3 { font-size:17px; }
.ai-block { padding:10px 0; border-bottom:1px solid var(--line); font-size:14px; line-height:1.6; }
.ai-block:last-child { border-bottom:none; }
.ai-zh { background:var(--gray-bg); border-radius:10px; padding:10px 12px; }
.ai-ul { margin:6px 0 0; padding-left:20px; }
.ai-ul li { margin-bottom:4px; font-size:13.5px; }
.ai-score { font-size:34px; font-weight:800; color:var(--red); line-height:1; }
.ai-score span { font-size:15px; color:var(--muted); font-weight:600; }
.ai-day { border:1px solid var(--line); border-radius:12px; padding:13px 14px; background:var(--surface); }
.ai-day-row { font-size:13px; margin-top:5px; }
.ai-day-row .muted { font-weight:600; }
/* chat */
.ai-chat { max-height:52vh; overflow-y:auto; display:flex; flex-direction:column; gap:10px; padding:4px; }
.ai-msg { display:flex; }
.ai-msg.user { justify-content:flex-end; }
.ai-bubble { max-width:82%; padding:10px 13px; border-radius:14px; font-size:14px; line-height:1.5; }
.ai-msg.ai .ai-bubble { background:var(--gray-bg); border-bottom-left-radius:4px; }
.ai-msg.user .ai-bubble { background:var(--red); color:#fff; border-bottom-right-radius:4px; font-family:var(--han); }
.ai-msg.ai .vocab-py { color:var(--blue-dark); font-size:13px; }
