/* =============================================================
   LỚP HỌC ONLINE — giao diện
   Muốn đổi màu chủ đạo: sửa --brand ở dưới (hoặc đổi trong
   trang Quản trị → Cài đặt, web sẽ tự áp dụng).
   ============================================================= */

:root {
  /* Đỏ chủ đạo + xám trung tính, bo góc nhỏ, bóng rất nhẹ — gọn và sang */
  /* Chỉ cần đổi --brand (Quản trị → Cài đặt → Bộ màu): các sắc đậm / nhạt tự tính theo */
  --brand: #cf001c;
  --brand-600: color-mix(in srgb, var(--brand) 84%, #000);
  --brand-700: color-mix(in srgb, var(--brand) 68%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 8%, transparent);
  --brand-ring: color-mix(in srgb, var(--brand) 22%, transparent);
  --brand-tint: color-mix(in srgb, var(--brand) 5%, #fff);

  --bg: #f3f4f6;
  --bg-elev: #ffffff;
  --bg-sunk: #f3f4f6;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --text: #111827;
  --text-soft: #4b5563;
  --text-mute: #6b7280;

  --ok: #0a8a3f;
  --ok-soft: rgba(10, 138, 63, 0.10);
  --warn: #b45309;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --bad: #dc2626;
  --bad-soft: rgba(220, 38, 38, 0.10);
  --hsa: #2e7d5b;

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --shadow-1: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-2: 0 2px 10px rgba(17, 24, 39, 0.08);
  --shadow-3: 0 16px 40px rgba(17, 24, 39, 0.16);
  --header-h: 60px;
  --font: 'Google Sans Flex', 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

[data-theme='dark'] {
  --bg: #0f1115;
  --bg-elev: #171a20;
  --bg-sunk: #1e2229;
  --line: #2a2f38;
  --line-strong: #383e49;
  --text: #f1f2f4;
  --text-soft: #b3b8c2;
  --text-mute: #8a909c;
  --brand-soft: color-mix(in srgb, var(--brand) 18%, transparent);
  --brand-tint: color-mix(in srgb, var(--brand) 10%, transparent);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 22px 48px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 .7em; }
::selection { background: var(--brand-ring); }

/* ---------- Màn hình chờ ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }
.boot-logo { font-size: 44px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line-strong); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================
   NÚT BẤM
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r); border: 1px solid transparent;
  background: var(--bg-sunk); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: .16s ease; white-space: nowrap; text-align: center;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 10px var(--brand-ring); }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-sunk); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { padding: 13px 24px; font-size: 15.5px; border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 10px; }

/* =============================================================
   Ô NHẬP LIỆU
   ============================================================= */
.field { display: block; margin-bottom: 14px; }
.field > .label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--text-mute); margin-top: 5px; }
/* Ô nhập nằm thẳng trong .field thì tự có kiểu, khỏi phải nhớ gắn class —
   quên gắn thì ô bị teo lại thành một cột hẹp, viết bài luận không nổi. */
.input, .select, .textarea,
.field > input:not([type=checkbox]):not([type=radio]), .field > select, .field > textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--r);
  border: 1.5px solid var(--line); background: var(--bg-elev); color: var(--text);
  transition: border-color .15s, box-shadow .15s; font-size: 14.5px;
}
.input:focus, .select:focus, .textarea:focus,
.field > input:focus, .field > select:focus, .field > textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring);
}
.textarea, .field > textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.select, .field > select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a6' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 16px; padding-right: 34px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 9px 11px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--bg-elev); margin-bottom: 9px; }
.check:hover { border-color: var(--line-strong); }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.check .t { font-size: 14px; font-weight: 600; display: block; }
.check .d { font-size: 12.5px; color: var(--text-mute); font-weight: 400; display: block; margin-top: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

/* =============================================================
   THẺ / KHỐI
   ============================================================= */
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 14px; }
.section-title h2 { font-size: 19px; }
.muted { color: var(--text-mute); }
.soft { color: var(--text-soft); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hstack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg-sunk); color: var(--text-soft); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }

.progress { height: 7px; border-radius: 999px; background: var(--bg-sunk); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #22c55e); transition: width .4s ease; }

.empty { text-align: center; padding: 46px 20px; color: var(--text-mute); }
.empty .ico { font-size: 40px; margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 17px; }

/* =============================================================
   THANH TRÊN CÙNG
   ============================================================= */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16.5px; letter-spacing: -.02em; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-content: center; background: var(--brand); color: #fff; font-size: 17px; }
.nav { display: flex; gap: 3px; margin-left: 10px; }
.nav a { padding: 8px 13px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--text-soft); }
.nav a:hover { background: var(--bg-sunk); color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-content: center; font-weight: 700; font-size: 14px; flex: none; }
.usermenu { position: relative; }
.usermenu .panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 232px; padding: 7px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); z-index: 60;
}
.usermenu .panel button, .usermenu .panel a {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 11px; border: 0; border-radius: 9px;
  background: transparent; cursor: pointer; font-size: 14px; font-weight: 500; text-align: left;
}
.usermenu .panel button:hover, .usermenu .panel a:hover { background: var(--bg-sunk); }
.usermenu .head { padding: 10px 11px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }

.page { max-width: 1180px; margin: 0 auto; padding: 22px 18px 70px; }
.page-wide { max-width: 1500px; }

/* =============================================================
   TRANG ĐĂNG NHẬP
   ============================================================= */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-side {
  background: linear-gradient(150deg, var(--brand), #7c3aed 55%, #0ea5e9);
  color: #fff; padding: 54px; display: flex; flex-direction: column; justify-content: center; gap: 20px; position: relative; overflow: hidden;
}
.auth-side::after { content: ''; position: absolute; inset: 0; background: radial-gradient(700px 380px at 78% 12%, rgba(255,255,255,.22), transparent 62%); }
.auth-side > * { position: relative; z-index: 1; }
.auth-side h1 { font-size: 38px; line-height: 1.15; letter-spacing: -.03em; }
.auth-side p { font-size: 16px; opacity: .93; max-width: 460px; }
.auth-points { display: grid; gap: 12px; margin-top: 8px; }
.auth-points div { display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; opacity: .96; }
.auth-points span { flex: none; width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.2); display: grid; place-content: center; }
.auth-main { display: grid; place-content: center; padding: 40px 26px; }
.auth-box { width: min(410px, 92vw); }
.auth-box h2 { font-size: 25px; margin-bottom: 5px; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg-sunk); padding: 4px; border-radius: var(--r); margin: 20px 0 18px; }
.auth-tabs button { flex: 1; padding: 8px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-soft); }
.auth-tabs button.on { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-1); }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { padding: 34px 24px; } .auth-side h1 { font-size: 27px; } .auth-points { display: none; } }

/* =============================================================
   DANH SÁCH KHOÁ HỌC
   ============================================================= */
.hero {
  background: linear-gradient(130deg, var(--brand), #7c3aed 60%, #0ea5e9);
  color: #fff; border-radius: var(--r-xl); padding: 30px 32px; margin-bottom: 8px;
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow-2);
}
.hero h1 { font-size: 26px; letter-spacing: -.02em; }
.hero p { opacity: .92; margin: 6px 0 0; max-width: 620px; }
.hero .stats { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.hero .stat { background: rgba(255,255,255,.16); border-radius: var(--r); padding: 11px 17px; min-width: 96px; }
.hero .stat b { display: block; font-size: 22px; line-height: 1.2; }
.hero .stat span { font-size: 12.5px; opacity: .9; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: thin; }
.chip { padding: 8px 15px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg-elev); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: .15s; }
.chip:hover { border-color: var(--line-strong); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.grid-courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(276px, 1fr)); gap: 18px; }
.course-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; cursor: pointer; transition: .2s; display: flex; flex-direction: column; box-shadow: var(--shadow-1); }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.course-thumb { aspect-ratio: 16/9; background: var(--bg-sunk); position: relative; display: grid; place-content: center; font-size: 56px; opacity: 1; }
.course-thumb > span { filter: saturate(.9); opacity: .55; }
.course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-thumb .lock { position: absolute; inset: 0; background: rgba(4,7,15,.5); color: #fff; display: grid; place-content: center; font-size: 26px; backdrop-filter: blur(2px); }
.course-body { padding: 15px 16px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-body h3 { font-size: 16px; }
.course-meta { display: flex; gap: 12px; font-size: 12.5px; color: var(--text-mute); margin-top: auto; padding-top: 4px; }

/* =============================================================
   TRANG KHOÁ HỌC + DANH SÁCH BÀI
   ============================================================= */
.course-head { display: grid; grid-template-columns: 1.6fr 1fr; gap: 26px; align-items: start; margin-bottom: 8px; }
@media (max-width: 860px) { .course-head { grid-template-columns: 1fr; } }
.curriculum { display: flex; flex-direction: column; gap: 12px; }
.sec { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--bg-elev); }
.sec > header { padding: 13px 16px; background: var(--bg-sunk); font-weight: 700; display: flex; justify-content: space-between; gap: 10px; align-items: center; cursor: pointer; font-size: 14.5px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); cursor: pointer; transition: background .13s; }
.lesson-row:hover { background: var(--bg-sunk); }
.lesson-row .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-content: center; background: var(--bg-sunk); font-size: 13px; flex: none; }
.lesson-row.done .ico { background: var(--ok-soft); color: var(--ok); }
.lesson-row.locked { opacity: .62; }
.lesson-row .t { flex: 1; min-width: 0; }
.lesson-row .t b { display: block; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-row .t span { font-size: 12.5px; color: var(--text-mute); }

/* =============================================================
   TRÌNH PHÁT VIDEO
   ============================================================= */
.player-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
@media (max-width: 1050px) { .player-layout { grid-template-columns: 1fr; } }
.video-shell { position: relative; background: #000; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 16/9; box-shadow: var(--shadow-2); }
.video-shell video, .video-shell iframe { width: 100%; height: 100%; display: block; border: 0; background: #000; }
.video-shell .novideo { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: #cbd5e1; text-align: center; padding: 20px; }
.watermark { position: absolute; color: rgba(255,255,255,.32); font-size: 12.5px; font-weight: 600; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.6); transition: left 1.4s linear, top 1.4s linear; z-index: 5; }
/* ---- Tự học: so chính tả từng từ ---- */
.ct-cau { font-size: 17px; line-height: 2.1; word-spacing: 2px; }
.ct-tu { padding: 2px 4px; border-radius: 5px; }
.ct-dung { color: var(--text); }
.ct-thieu { background: var(--bad-soft); color: var(--bad); font-weight: 700; text-decoration: underline wavy var(--bad); }
.ct-nham { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.ct-nham i { font-style: normal; opacity: .75; font-size: .82em; }
.ct-nham i::before { content: ' → '; }
.ct-thua { background: var(--bg-sunk); color: var(--text-mute); text-decoration: line-through; }
.ct-chu { display: inline-flex; align-items: center; gap: 5px; color: var(--text-mute); }
/* Ô màu trong chú thích: phải đặc, không thì nhìn không ra màu gì */
.ct-o { width: 11px; height: 11px; border-radius: 3px; display: inline-block; padding: 0; text-decoration: none; }
.ct-o.ct-dung { background: var(--line-strong); }
.ct-o.ct-thieu { background: var(--bad); }
.ct-o.ct-nham { background: var(--warn); }
.ct-o.ct-thua { background: var(--text-mute); }
.ct-benh { margin-top: 14px; padding: 13px 15px; background: var(--bg-sunk); border-radius: var(--r); }
.ct-benh ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.9; font-size: 13.5px; color: var(--text-soft); }

/* ---- Tự học: việc hôm nay ---- */
.viec { display: flex; align-items: center; gap: 14px; padding: 15px 16px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.viec:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--brand); }
.viec.xong { opacity: .62; }
.viec.xong .viec-cham { background: var(--ok-soft); color: var(--ok); }
.viec h3 { font-size: 16px; }
.viec-cham { flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft);
  display: grid; place-content: center; font-size: 19px; }
.viec-phut { white-space: nowrap; }
@media (max-width: 560px) { .viec-phut { display: none; } }

/* ---- IELTS: con đường 4 chặng ---- */
/* Chữ trong .hero là màu trắng -> nền phải đủ đậm, đừng làm nền nhạt kẻo không đọc nổi */
.hero-ielts { background: linear-gradient(130deg, #0f766e, #0d9488 45%, #4f46e5); }
.cat-card.ielts-vao { border-color: rgba(13,148,136,.35); }
.duong-band { position: relative; display: flex; flex-direction: column; gap: 12px; padding-left: 30px; }
/* Sợi dây nối các mốc lại thành một con đường */
.duong-band::before { content: ''; position: absolute; left: 13px; top: 26px; bottom: 26px; width: 3px;
  background: linear-gradient(var(--line-strong), var(--line)); border-radius: 3px; }
.band-moc { position: relative; display: flex; align-items: center; gap: 14px; padding: 15px 16px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.band-moc:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--c); }
.band-moc.dang-o { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.band-moc.xong { opacity: .82; }
.band-moc h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.band-moc .progress i { background: var(--c); }
/* Chấm tròn nằm trên sợi dây */
.band-moc .band-cham { position: absolute; left: -30px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-content: center; font-size: 14px; background: var(--bg-elev);
  border: 3px solid var(--c); z-index: 1; }
.band-moc.xong .band-cham { background: var(--c); }
@media (max-width: 620px) { .duong-band { padding-left: 26px; } .band-moc .band-cham { left: -26px; width: 24px; height: 24px; font-size: 12px; } }
/* Danh sách tên các phần bên trong một chặng — mỗi phần một viên chữ nhỏ */
.chang-phan { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chang-phan span { font-size: 12px; line-height: 1.5; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--brand)) 12%, transparent);
  color: color-mix(in srgb, var(--c, var(--brand)) 72%, var(--text));
  border: 1px solid color-mix(in srgb, var(--c, var(--brand)) 24%, transparent); white-space: nowrap; }
@media (max-width: 560px) { .chang-phan span { font-size: 11.5px; padding: 2px 8px; } }

/* ---- Bài đọc kiểu sách (mục IELTS) ---- */
/* Ba mốc: Đã đọc → Đã luyện → Đã đạt. Mốc bài này không có thì làm mờ hẳn,
   đừng để học viên nhìn một ô xám mà không hiểu vì sao mình không tô được. */
.ba-buoc { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.buoc { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg-elev); font-size: 13.5px; font-weight: 600;
  color: var(--text-mute); }
.buoc.xong { border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.buoc.chua-co { opacity: .45; border-style: dashed; font-weight: 500; }
.buoc-ico { font-size: 15px; line-height: 1; }
@media (max-width: 480px) { .buoc { padding: 7px 11px; font-size: 12.5px; } }

/* Tiêu đề ### trong nội dung soạn bằng markdown */
.mini-h { margin: 22px 0 8px; font-size: 16.5px; }
.mini-h:first-child { margin-top: 0; }

/* Thân bài đọc — rộng vừa mắt, dòng thưa cho dễ đọc lâu */
.bai-doc { max-width: 68ch; }
.bai-doc > * { margin-bottom: 18px; }
.bai-doc > *:last-child { margin-bottom: 0; }
.bai-doc .prose { font-size: 15.5px; line-height: 1.85; }

/* Mục tiêu bài học */
.kh-muctieu { background: var(--brand-soft); border-radius: var(--r-lg); padding: 15px 18px; }
.kh-muctieu ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.9; font-size: 14.5px; }

/* Hộp lưu ý */
.kh-luuy { border-left: 4px solid var(--warn); background: var(--bg-sunk);
  border-radius: 0 var(--r-lg) var(--r-lg) 0; padding: 14px 17px; font-size: 14.5px; line-height: 1.8; }
.kh-luuy > div { margin-top: 6px; }

/* Ví dụ đúng / sai đặt cạnh nhau */
.kh-vidu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kh-vidu > p { grid-column: 1 / -1; }
@media (max-width: 640px) { .kh-vidu { grid-template-columns: 1fr; } }
.vd { padding: 13px 15px; border-radius: var(--r-lg); font-size: 14.5px; line-height: 1.75; }
.vd-nhan { display: block; font-weight: 700; font-size: 12.5px; margin-bottom: 6px; letter-spacing: .02em; }
.vd-dung { background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.vd-dung .vd-nhan { color: var(--ok); }
.vd-sai { background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.vd-sai .vd-nhan { color: var(--warn); }

/* Khối nghe trong bài */
.kh-audio { background: var(--bg-sunk); border-radius: var(--r-lg); padding: 14px 16px; }

/* Câu tự kiểm — đáp án giấu tới khi bấm */
.kh-cauhoi { border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 15px 17px; }
.kh-dapan-noi { margin-top: 12px; padding: 13px 15px; border-radius: var(--r);
  background: color-mix(in srgb, var(--ok) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 26%, transparent); font-size: 14.5px; line-height: 1.8; }

/* Nút "tôi đã đọc xong" ở cuối bài */
.doc-xong { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---- Phòng luyện viết & phòng luyện nói ---- */
.vstack { display: flex; flex-direction: column; }
/* Câu tiếng Anh bị bắt lỗi — để nguyên khoảng trắng cho khớp bài gốc */
.loi-cau { border-left: 3px solid var(--warn); background: var(--bg-sunk); padding: 9px 13px;
  border-radius: 0 8px 8px 0; font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
/* Bài đã nộp, xem lại nguyên văn */
.bai-cu { background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 15px; font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow-y: auto; }
/* Khu ghi âm */
.ghi-am { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 16px;
  background: var(--bg-sunk); border-radius: var(--r-lg); text-align: center; }
.btn-ghi { min-width: 190px; font-size: 15px; padding: 13px 22px; }
.btn-ghi.dang-ghi { background: #dc2626; border-color: #dc2626; animation: dapNhip 1.4s ease-in-out infinite; }
@keyframes dapNhip { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); } 50% { box-shadow: 0 0 0 11px rgba(220, 38, 38, 0); } }
.ghi-gio { font-size: 27px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .btn-ghi.dang-ghi { animation: none; } }

/* Bảng chữ nhỏ hiện giữa video khi tua / đổi tốc độ, tự mờ đi sau 1 giây */
.video-osd { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  background: rgba(15,17,26,.8); color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .2px;
  padding: 11px 18px; border-radius: 14px; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.video-osd.hien { opacity: 1; }

/* Thanh dưới video: tua nhanh, chọn tốc độ, nhắc phím tắt */
.vctl { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 12px; }
.vctl .nhan { font-size: 12.5px; font-weight: 700; color: var(--text-mute); }
.vctl .cum { display: flex; gap: 3px; background: var(--bg-sunk); border-radius: 999px; padding: 4px; }
.vctl .cum button { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--text-soft); padding: 6px 11px; border-radius: 999px; cursor: pointer; line-height: 1; white-space: nowrap; }
.vctl .cum button:hover { background: var(--bg-elev); color: var(--text); }
.vctl .cum button.on { background: var(--brand); color: #fff; }
.vctl .phim { font-size: 12px; color: var(--text-mute); margin-left: auto; }
.vctl .phim kbd { font: inherit; font-weight: 700; background: var(--bg-sunk); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; margin: 0 1px; color: var(--text-soft); }
@media (max-width: 700px) { .vctl .phim { display: none; } }
/* Màn hình hẹp: cho chữ "Tốc độ" xuống dòng đứng ngay trên hàng nút, đỡ lửng lơ */
@media (max-width: 620px) {
  .vctl { gap: 7px; }
  .vctl .nhan { flex-basis: 100%; margin-bottom: -3px; }
  .vctl .cum button { padding: 6px 9px; }
}

.playlist { max-height: 74vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elev); }
.playlist .p-head { padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 700; position: sticky; top: 0; background: var(--bg-elev); z-index: 2; }
.playlist .lesson-row.on { background: var(--brand-soft); }
.playlist .lesson-row.on .t b { color: var(--brand); }

.tabs { display: flex; gap: 3px; border-bottom: 1.5px solid var(--line); margin: 22px 0 16px; overflow-x: auto; }
.tabs button { padding: 10px 15px; border: 0; background: transparent; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-soft); border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-color: var(--brand); }

.att { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 9px; background: var(--bg-elev); }
.att .fi { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: grid; place-content: center; font-size: 15px; flex: none; }

/* Quiz */
.quiz-q { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 13px; background: var(--bg-elev); }
.quiz-q > b { display: block; margin-bottom: 11px; font-size: 15px; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px; border: 1.5px solid var(--line); border-radius: var(--r); margin-bottom: 8px; cursor: pointer; transition: .13s; }
.opt:hover { border-color: var(--brand); }
.opt input[type="radio"], .opt input[type="checkbox"] {
  margin-top: 3px; accent-color: var(--brand); width: 17px; height: 17px; flex: none;
}
/* Ô nhập nội dung phương án phải chiếm hết chỗ còn lại, không bị co về 17px */
.opt input[type="text"], .opt input:not([type]) { flex: 1; min-width: 0; width: auto; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.explain { font-size: 13.5px; color: var(--text-soft); background: var(--bg-sunk); border-radius: var(--r-sm); padding: 10px 12px; margin-top: 8px; }

/* =============================================================
   TRANG QUẢN TRỊ
   ============================================================= */
.admin-layout { display: grid; grid-template-columns: 226px minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-nav { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 3px; }
.admin-nav button { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border: 0; background: transparent; border-radius: var(--r); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-soft); text-align: left; }
.admin-nav button:hover { background: var(--bg-sunk); color: var(--text); }
.admin-nav button.on { background: var(--brand); color: #fff; }
@media (max-width: 900px) { .admin-nav { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 6px; } }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 13px; }
.stat-box { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.stat-box b { display: block; font-size: 26px; letter-spacing: -.02em; }
.stat-box span { font-size: 13px; color: var(--text-mute); }
.stat-box .ico { font-size: 18px; margin-bottom: 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elev); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.tbl th { text-align: left; padding: 12px 14px; background: var(--bg-sunk); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mute); font-weight: 700; white-space: nowrap; }
table.tbl td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:hover td { background: var(--bg-sunk); }

.drop {
  border: 2.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: 30px 20px; text-align: center;
  cursor: pointer; transition: .16s; background: var(--bg-sunk);
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .ico { font-size: 32px; margin-bottom: 8px; }
.upbar { margin-top: 12px; }
.upbar .progress { height: 10px; }
.upbar .txt { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-soft); margin-top: 7px; }

.sortable-item { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-elev); margin-bottom: 8px; }
.sortable-item .grab { cursor: grab; color: var(--text-mute); user-select: none; }
.sortable-item.dragging { opacity: .45; }

/* =============================================================
   HỘP THOẠI & THÔNG BÁO
   ============================================================= */
.modal-back { position: fixed; inset: 0; background: rgba(8, 11, 20, .55); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 18px; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0 } }
.modal { width: min(620px, 100%); max-height: 88vh; overflow: auto; background: var(--bg-elev); border-radius: var(--r-xl); box-shadow: var(--shadow-3); animation: pop .18s ease; }
.modal.wide { width: min(880px, 100%); }
@keyframes pop { from { transform: translateY(14px) scale(.985); opacity: 0 } }
.modal > header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; background: var(--bg-elev); z-index: 2; }
.modal > header h3 { font-size: 17.5px; }
.modal > .body { padding: 20px 22px; }
.modal > footer { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--bg-elev); }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; max-width: min(380px, 92vw); }
.toast { background: var(--bg-elev); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--r); padding: 12px 15px; box-shadow: var(--shadow-3); font-size: 14px; animation: slide .2s ease; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--bad); }
@keyframes slide { from { transform: translateX(20px); opacity: 0 } }

.skeleton { background: linear-gradient(90deg, var(--bg-sunk) 25%, var(--line) 37%, var(--bg-sunk) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--r); }
@keyframes sk { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }

.notice { padding: 13px 16px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 500; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.notice.info { background: var(--brand-soft); color: var(--brand); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
/* .notice.warn = màu mặc định */

.prose { line-height: 1.75; color: var(--text-soft); }
.prose h3 { color: var(--text); margin: 18px 0 8px; font-size: 16px; }
.prose ul { padding-left: 20px; }
.prose code, code { background: var(--bg-sunk); padding: 2px 6px; border-radius: 6px; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }

@media print { .topbar, .btn, .tabs { display: none !important; } }

/* ---------- Tiện ích nhỏ ---------- */
@media (max-width: 620px) {
  .hide-sm { display: none; }
  .nav a { padding: 8px 10px; font-size: 13.5px; }
  .page { padding: 16px 13px 60px; }
  .hero { padding: 22px 20px; border-radius: 18px; }
  .hero h1 { font-size: 21px; }
  .hero .stats { margin-left: 0; }
  .modal > .body { padding: 16px; }
  .modal > header, .modal > footer { padding: 14px 16px; }
}
.grab { user-select: none; }
input[type='color'] { cursor: pointer; }

/* =============================================================
   THI THỬ & BÀI TẬP — màn hình làm bài
   ============================================================= */
body.exam-mode { overflow: hidden; }
.exam-wrap { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 50; }
.no-select { user-select: none; -webkit-user-select: none; }
.no-select input, .no-select textarea { user-select: text; -webkit-user-select: text; }

.exam-top {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px;
  background: var(--bg-elev); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-1); flex: none;
}
.exam-top > div:first-child { flex: 1; min-width: 0; }
.exam-clock {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 26px; letter-spacing: -.02em;
  padding: 4px 16px; border-radius: 12px; background: var(--bg-sunk); color: var(--text);
}
.exam-clock.warn { background: var(--warn-soft); color: var(--warn); }
.exam-clock.danger { background: var(--bad-soft); color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.exam-warn { font-size: 13px; font-weight: 600; color: var(--bad); background: var(--bad-soft); padding: 5px 11px; border-radius: 999px; }

.exam-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 262px; gap: 18px; overflow: hidden; padding: 18px; }
.exam-main { overflow-y: auto; padding-right: 6px; }
.exam-side { overflow-y: auto; }
@media (max-width: 900px) {
  .exam-body { grid-template-columns: 1fr; padding: 12px; }
  .exam-side { display: none; }
  .exam-clock { font-size: 21px; padding: 3px 11px; }
}

.exam-part { font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 8px 14px; border-radius: 10px; margin-bottom: 14px; }
.exam-q { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow-1); }
.exam-qno { font-weight: 800; font-size: 16px; background: var(--brand); color: #fff; padding: 3px 12px; border-radius: 999px; }
.exam-qno.ok { background: var(--ok); }
.exam-qno.bad { background: var(--bad); }
.exam-content { font-size: 16.5px; line-height: 1.75; }
.exam-content img.tikz-fig { max-width: 100%; margin: 12px auto; display: block; }
[data-theme='dark'] .exam-content img.tikz-fig { filter: invert(1) hue-rotate(180deg); }
.tikz-fail { color: var(--bad); font-size: 13px; font-style: italic; }

.exam-opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 15px; margin-bottom: 9px;
  border: 1.5px solid var(--line); border-radius: var(--r); cursor: pointer; transition: .13s; background: var(--bg-elev);
}
.exam-opt:hover { border-color: var(--brand); background: var(--brand-soft); }
.exam-opt.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.exam-opt.right { border-color: var(--ok); background: var(--ok-soft); }
.exam-opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.exam-opt .ltr { flex: none; width: 27px; height: 27px; border-radius: 50%; background: var(--bg-sunk); display: grid; place-content: center; font-weight: 700; font-size: 13px; }
.exam-opt.on .ltr { background: var(--brand); color: #fff; }
.exam-opt.right .ltr { background: var(--ok); color: #fff; }
.exam-opt.wrong .ltr { background: var(--bad); color: #fff; }
.exam-opt-t { flex: 1; min-width: 0; }

.tf-table { width: 100%; border-collapse: collapse; }
.tf-table th { text-align: left; padding: 8px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mute); background: var(--bg-sunk); }
.tf-table td { padding: 11px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.tf-ltr { font-weight: 700; color: var(--text-soft); width: 34px; }
.tf-pick { text-align: center; }
.tf-btn {
  display: inline-grid; place-content: center; width: 44px; height: 36px; border-radius: 10px;
  border: 1.5px solid var(--line); font-weight: 700; cursor: pointer; transition: .13s; user-select: none;
}
.tf-btn:hover { border-color: var(--brand); }
.tf-btn.on-t { background: var(--ok); border-color: var(--ok); color: #fff; }
.tf-btn.on-f { background: var(--bad); border-color: var(--bad); color: #fff; }

.short-box { max-width: 340px; }
.short-input { font-size: 21px; font-weight: 700; text-align: center; letter-spacing: .02em; }

.exam-nav { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-bottom: 20px; }

.qmap { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qmap-h { grid-column: 1/-1; font-size: 11.5px; font-weight: 700; color: var(--text-mute); text-transform: uppercase; letter-spacing: .05em; margin: 6px 0 2px; }
.qmap-b {
  aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 9px; background: var(--bg-elev);
  cursor: pointer; font-weight: 700; font-size: 13px; transition: .12s;
}
.qmap-b:hover { border-color: var(--brand); }
.qmap-b.done { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.qmap-b.cur { box-shadow: 0 0 0 3px var(--brand-ring); border-color: var(--brand); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; border: 1.5px solid var(--line); vertical-align: -1px; }
.dot.done { background: var(--ok-soft); border-color: var(--ok); }

.exam-wm { position: fixed; color: rgba(120,130,150,.28); font-size: 13px; font-weight: 700; pointer-events: none; z-index: 60; transition: left 1.5s linear, top 1.5s linear; }

.vio-overlay { position: fixed; inset: 0; background: rgba(8,11,20,.72); backdrop-filter: blur(5px); z-index: 300; display: grid; place-items: center; padding: 20px; }
.vio-box { background: var(--bg-elev); border-radius: var(--r-xl); padding: 32px 30px; text-align: center; max-width: 460px; box-shadow: var(--shadow-3); }
.vio-box h2 { font-size: 20px; margin: 10px 0 8px; }
.vio-box p { color: var(--text-soft); font-size: 14.5px; }
.vio-box .btn { margin-top: 14px; }

/* Bảng soạn đề của giáo viên */
.qedit { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px 16px; margin-bottom: 12px; background: var(--bg-elev); }
.qedit textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; }
.qedit .qtype { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px; }
.latex-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; min-height: 260px; }
.katex { font-size: 1.03em; }
.katex-display { margin: .6em 0; }

/* ---------- Thẻ mục kiến thức & kho tài liệu ---------- */
.grid-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cat-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--brand));
  border-radius: var(--r-lg); box-shadow: var(--shadow-1); transition: .18s;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--c, var(--brand)); border-left-color: var(--c, var(--brand)); }
.cat-card h3 { font-size: 16px; }
.cat-ico { flex: none; width: 48px; height: 48px; border-radius: 13px; display: grid; place-content: center; font-size: 24px; }
.cat-go { font-size: 26px; color: var(--text-mute); font-weight: 300; }

.doc-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r); transition: .13s;
}
.doc-row:hover { border-color: var(--line-strong); }
.doc-ico { flex: none; width: 42px; height: 42px; border-radius: 11px; background: var(--brand-soft); display: grid; place-content: center; font-size: 20px; }

/* Logo riêng của lớp thay cho biểu tượng 📚 */
.mark-anh {
  width: 30px; height: 30px; object-fit: cover;
  border-radius: 9px; display: block; background: var(--bg-sunk);
}

/* Bảng chọn bộ màu trong Cài đặt */
.mau-hang { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 6px; }
.mau-o {
  width: 40px; height: 40px; border-radius: 11px; cursor: pointer;
  border: 2px solid transparent; box-shadow: var(--shadow-1);
  position: relative; padding: 0; flex: none;
}
.mau-o.on { border-color: var(--text); }
.mau-o.on::after {
  content: '✓'; position: absolute; inset: 0;
  display: grid; place-content: center; color: #fff;
  font-size: 17px; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.45);
}

/* ===================== Ô TÌM NHANH TRONG KHOÁ ===================== */
.tim-khung {
  display: flex; align-items: center; gap: 8px;
  margin: 20px 0 0; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-elev);
  transition: border-color .13s, box-shadow .13s;
}
.tim-khung:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.tim-kinh { flex: none; font-size: 15px; opacity: .7; }
.tim-o {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  padding: 13px 0; font: inherit; font-size: 15px; color: var(--fg);
}
.tim-o::placeholder { color: var(--fg-muted); }
.tim-o::-webkit-search-cancel-button { display: none; }
.tim-xoa {
  flex: none; border: 0; background: transparent; cursor: pointer;
  color: var(--fg-muted); font-size: 15px; line-height: 1;
  padding: 6px; border-radius: 8px;
}
.tim-xoa:hover { background: var(--bg-sunk); color: var(--fg); }
.tim-baocao { margin: 9px 2px 0; }

@media (max-width: 640px) {
  .tim-o { padding: 12px 0; font-size: 16px; }  /* 16px de iPhone khong tu phong to */
}

/* ===================== LỘ TRÌNH HỌC ===================== */
.lt-phan > header { user-select: none; }
.lt-mui { display: inline-block; margin-left: 6px; font-size: 11px; }

.lt-row {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.lt-so {
  flex: none; display: grid; place-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-sunk); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 700; color: var(--fg-soft);
}
.lt-body { flex: 1; min-width: 0; }
.lt-body > b { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.45; }
.lt-mo { margin-top: 5px; font-size: 13px; line-height: 1.55; color: var(--fg-soft); }
.lt-loi { padding: 11px 16px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.55; }
.lt-loi:first-child { border-top: 0; }

/* Buoi day truc tiep tren Zoom */
.lt-row.co-zoom { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.lt-row.co-zoom .lt-so { background: var(--primary); color: #fff; border-color: var(--primary); }
.lt-zoom {
  display: inline-block; margin-left: 8px; vertical-align: 1px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  padding: 2px 8px; border-radius: 999px;
  background: var(--primary); color: #fff; white-space: nowrap;
}
@media (max-width: 640px) {
  .lt-zoom { display: block; margin: 6px 0 0; width: fit-content; }
}

/* Bai tap ve nha nam trong chuong */
.bt-row .ico { background: color-mix(in srgb, #8b5cf6 15%, transparent); }
.bt-row.done .ico { background: var(--ok-soft); color: var(--ok); }

@media (max-width: 640px) {
  .lt-row { padding: 11px 12px; gap: 10px; }
  .lt-so { width: 23px; height: 23px; font-size: 11.5px; }
}

/* ---------- Nhan phien ban o goc man hinh ----------
   De co giao nhin mot cai la biet may chu dang chay ban nao,
   khoi phai mo dia-chi/healthz de kiem tra. */
.nhan-ban {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 150;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  opacity: .55;
  cursor: pointer;
  user-select: none;
  transition: opacity .15s ease, transform .15s ease;
}
.nhan-ban:hover { opacity: 1; transform: translateY(-1px); }
.nhan-ban-loi {
  color: #fff;
  background: var(--bad);
  border-color: var(--bad);
  opacity: .95;
}
/* Man hinh dien thoai thi nhich len cho khoi de len thanh dieu huong duoi */
@media (max-width: 720px) {
  .nhan-ban { bottom: auto; top: 8px; left: 8px; opacity: .4; }
}

/* ---------- Thanh "dang nen video" noi o goc man hinh ----------
   Bam nen xong phai THAY no dang chay, khong thi tuong may khong lam gi. */
.hop-xu-ly {
  position: fixed;
  left: 12px;
  bottom: 44px;
  z-index: 190;
  width: min(330px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  font-size: 13px;
  animation: hopLen .22s ease;
}
@keyframes hopLen { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hop-xu-ly .xl-dau { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.hop-xu-ly .xl-dau b { font-size: 13px; }
.hop-xu-ly .spacer { flex: 1; }
.hop-xu-ly .xl-dem { font-size: 11px; color: var(--text-soft); }
.hop-xu-ly .xl-ten {
  font-weight: 600; margin-bottom: 6px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.hop-xu-ly .progress { height: 7px; margin: 0 0 5px; }
.hop-xu-ly .xl-so { font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.hop-xu-ly .xl-ly { font-size: 11px; color: var(--text-soft); margin-top: 5px; line-height: 1.4; }
.hop-xu-ly .xl-nhac { font-size: 11px; color: var(--text-soft); margin-top: 8px; opacity: .8; }
.hop-xu-ly .xl-xong { color: var(--ok); font-weight: 600; }

/* Vong tron quay cho biet may dang lam viec */
.hop-xu-ly .xl-quay {
  width: 13px; height: 13px; flex: none;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: xlQuay .8s linear infinite;
}
@keyframes xlQuay { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .hop-xu-ly { left: 8px; right: 8px; width: auto; bottom: 12px; }
}

/* ---------- Xem tai lieu PDF (web tu ve, may nao cung giong nhau) ---------- */
.doc-thanh {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 8px; margin-bottom: 8px;
  background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--r);
}
.doc-giay {
  height: 64vh; overflow: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px; scroll-behavior: smooth;
}
.doc-trang { display: flex; justify-content: center; margin-bottom: 14px; }
.doc-trang canvas {
  max-width: 100%; height: auto;
  border-radius: 6px; box-shadow: var(--shadow-2); background: #fff;
}
.doc-cho {
  width: 100%; min-height: 320px; display: flex; align-items: center; justify-content: center;
  color: var(--text-mute); font-size: 13px;
  background: #fff; border-radius: 6px; box-shadow: var(--shadow-1);
}
.doc-dangdoc { padding: 40px 0; text-align: center; color: var(--text-soft); }

/* Mo rong kin man hinh */
.doc-toanmanhinh { background: var(--bg); padding: 10px; }
.doc-toanmanhinh .doc-giay { height: calc(100vh - 70px); }

@media (max-width: 720px) {
  .doc-giay { height: 58vh; padding: 8px; }
  .doc-thanh { gap: 4px; }
  .doc-thanh .btn { padding: 4px 8px; }
}

/* =============================================================
   HÌNH CẮT TỪ ĐỀ GỐC (\hinh{...}) — đề đọc từ file PDF / ảnh chụp
   Nền trắng như tờ giấy, kể cả khi web đang ở chế độ tối.
   ============================================================= */
.exam-content img.de-hinh {
  display: block; max-width: 100%; max-height: 420px; height: auto; margin: 10px auto;
  background: #fff; border-radius: 6px; padding: 4px;
}
.opt img.de-hinh, .dd-pa img.de-hinh { max-height: 220px; margin: 4px 0; }
.qedit img.de-hinh { max-height: 160px; margin: 6px 0; }

/* =============================================================
   GỬI FILE ĐỀ -> TỰ TẠO BÀI (public/admin-docde.js)
   ============================================================= */
.dd-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.dd-o { border: 1.5px solid var(--line); border-radius: var(--r); padding: 8px; background: var(--bg-elev); cursor: pointer; transition: .13s; }
.dd-o:hover { border-color: var(--brand); }
.dd-o.bo { opacity: .42; }
.dd-thumb {
  aspect-ratio: 1 / 1.414; background: var(--bg-sunk); border-radius: 6px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.dd-thumb img, .dd-thumb canvas { max-width: 100%; max-height: 100%; background: #fff; transition: transform .2s; }

.dd-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; background: var(--bg-sunk); color: var(--text-soft); }
.dd-chip.xong { background: var(--ok-soft); color: var(--ok); }
.dd-chip.dang { background: var(--brand-soft); color: var(--brand); }
.dd-chip.loi { background: var(--bad-soft); color: var(--bad); }

.dd-loc { margin: 4px 0 12px; gap: 6px; }

.dd-cau {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); gap: 18px;
  border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 12px;
  background: var(--bg-elev); scroll-margin-top: 90px;
}
.dd-cau.khong-goc { grid-template-columns: minmax(0, 1fr); }
.dd-cau.thieu { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dd-cau.xem { border-color: var(--warn); }
.dd-cau.bo { opacity: .5; }
.dd-cau.bo .dd-de, .dd-cau.bo .dd-pas, .dd-cau.bo .dd-ys { filter: grayscale(1); }
.dd-dau { gap: 8px; margin-bottom: 8px; }
.dd-de { font-size: 15.5px; }
.dd-canh { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dd-canh li { font-size: 13px; padding: 5px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.dd-canh li.nang { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.dd-canh li.ok { background: none; padding: 0; }

.dd-pa {
  display: flex; align-items: flex-start; gap: 8px; padding: 7px 11px; margin: 6px 0;
  border: 1.5px solid var(--line); border-radius: var(--r); cursor: pointer; transition: .12s;
}
.dd-pa:hover { border-color: var(--brand); }
.dd-pa.dung { border-color: var(--ok); background: var(--ok-soft); }
.dd-pa .ltr { font-weight: 700; flex: none; }
.dd-pa .exam-content { font-size: 15px; line-height: 1.6; }

.dd-y { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.dd-y .t { flex: 1; min-width: 0; font-size: 15px; line-height: 1.6; }
.dd-ds { display: inline-flex; flex: none; border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; }
.dd-ds button { border: 0; background: var(--bg-elev); color: var(--text-soft); padding: 5px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.dd-ds button + button { border-left: 1.5px solid var(--line); }
.dd-ds button.on-d { background: var(--ok); color: #fff; }
.dd-ds button.on-s { background: var(--bad); color: #fff; }
.dd-short { margin-top: 10px; gap: 8px; }
.dd-lg { margin-top: 10px; }
.dd-lg summary { cursor: pointer; color: var(--text-soft); font-weight: 600; }

/* Cửa sổ nhìn vào một vùng ảnh trang: không cắt ảnh thật, chỉ dịch ảnh bên trong khung */
.dd-cat { display: block; position: relative; overflow: hidden; width: 100%; background: #fff; border-radius: 6px; }
.dd-cat img { position: absolute; max-width: none; height: auto; display: block; }
.dd-hinh { display: block; margin: 8px 0; }
.dd-hinh .dd-cat { border: 1px solid var(--line); }
.dd-goc .dd-cat { border: 1px solid var(--line-strong); }

.dd-chan {
  position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 16px; padding: 12px 14px; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: 0 -8px 24px rgba(16, 19, 28, .10);
}

/* Khoanh hình */
.dd-ve { position: relative; user-select: none; -webkit-user-select: none; touch-action: none; cursor: crosshair; line-height: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.dd-ve img { width: 100%; display: block; pointer-events: none; }
.dd-khung { position: absolute; border: 2px solid var(--brand); background: rgba(79, 70, 229, .10); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .28); pointer-events: none; }

@media (min-width: 1001px) { .dd-nut-goc { display: none; } }
@media (max-width: 1000px) {
  .dd-cau { grid-template-columns: minmax(0, 1fr); }
  .dd-cau .dd-goc { display: none; }
  .dd-cau.mo-goc .dd-goc { display: block; }
}

/* =============================================================
   PHẦN TOÁN / TSA — trang một mục kiểu "phòng lab" chia tab
   ============================================================= */
.nav { overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 0 1 auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; }
.nav a.nav-khu { font-weight: 700; }

.hub-hero {
  --c: var(--brand);
  position: relative; overflow: hidden; display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap;
  padding: 30px 32px; border-radius: var(--r-xl); border: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 13%, var(--bg-elev)), var(--bg-elev) 64%);
  box-shadow: var(--shadow-1);
}
.hub-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .75;
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--c) 34%, transparent) 1.2px, transparent 0) 0 0 / 18px 18px;
  -webkit-mask-image: linear-gradient(100deg, transparent 38%, #000 96%);
  mask-image: linear-gradient(100deg, transparent 38%, #000 96%);
}
.hub-hero > * { position: relative; }
.hub-hero-l { flex: 1 1 380px; min-width: 0; }
.hub-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, var(--bg-elev)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.hub-hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 12px; }
.hub-hero p { color: var(--text-soft); margin: 8px 0 0; max-width: 640px; }
.hub-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.hub-tiendo { flex: 1; min-width: 180px; max-width: 360px; }
.hub-stats { display: grid; grid-template-columns: repeat(2, minmax(112px, 1fr)); gap: 10px; }
.hub-stats > div { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 16px; text-align: center; box-shadow: var(--shadow-1); }
.hub-stats b { display: block; font-size: 24px; font-weight: 800; color: var(--c); line-height: 1.25; }
.hub-stats span { font-size: 12.5px; color: var(--text-mute); }
.hub-cung { margin-top: 14px; }
.hub-cung a.chip { display: inline-flex; align-items: center; }

.hub-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 20px; }
.hub-nav {
  position: sticky; top: calc(var(--header-h) + 14px); display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 0; box-shadow: var(--shadow-1);
}
.hub-nav button {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; border: 0; background: transparent; cursor: pointer;
  font-weight: 600; font-size: 14.5px; color: var(--text-soft); text-align: left; border-left: 3px solid transparent;
}
.hub-nav button:hover { background: var(--bg-sunk); color: var(--text); }
.hub-nav button.on { color: var(--brand); background: var(--brand-soft); border-left-color: var(--brand); }
.hub-nav-i { width: 22px; text-align: center; }
.hub-nav-t { flex: 1; }
.hub-nav-n {
  font-size: 12px; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: inline-grid; place-content: center; background: var(--bg-sunk); color: var(--text-mute); font-weight: 700;
}
.hub-nav button.on .hub-nav-n { background: var(--brand); color: #fff; }
.hub-body { min-width: 0; }
@media (max-width: 900px) {
  .hub-layout { grid-template-columns: 1fr; gap: 14px; }
  .hub-nav { position: static; flex-direction: row; overflow-x: auto; padding: 4px; gap: 2px; border-radius: var(--r); scrollbar-width: none; }
  .hub-nav::-webkit-scrollbar { display: none; }
  .hub-nav button { border-left: 0; border-bottom: 3px solid transparent; padding: 10px 12px; white-space: nowrap; border-radius: 9px; gap: 7px; }
  .hub-nav button.on { border-bottom-color: var(--brand); }
  .hub-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
}
@media (max-width: 560px) {
  .hub-hero { padding: 22px 18px; }
  .hub-hero h1 { font-size: 23px; }
  .hub-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Danh sách bài tập / đề luyện ---------- */
.de-dau { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.de-dau .chips { padding: 0; }
.chip-n { display: inline-grid; place-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bg-sunk); font-size: 11.5px; margin-left: 4px; }
.chip.on .chip-n { background: rgba(255, 255, 255, .25); }
.de-list { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.de-row { display: flex; align-items: center; gap: 16px; padding: 18px 22px; }
.de-row + .de-row { border-top: 1px solid var(--line); }
.de-row-main { flex: 1; min-width: 0; }
.de-row-ten { color: var(--brand); font-weight: 700; font-size: 17px; }
.de-row-ten:hover { text-decoration: underline; }
.de-row-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 6px; font-size: 14px; color: var(--text-soft); }
.de-row-meta b { color: var(--text); font-weight: 600; }
.de-row-act { display: flex; align-items: center; gap: 16px; flex: none; }
.de-diem { text-align: right; }
.de-diem b { display: block; font-size: 22px; line-height: 1.1; }
.de-diem span { font-size: 11.5px; color: var(--text-mute); }
.de-nut { min-width: 118px; padding: 12px 18px; font-size: 15px; }
.tt { font-weight: 700; }
.de-row-meta b.tt-chua-lam, .tt-chua-lam { color: var(--ok); }
.de-row-meta b.tt-dang-lam, .tt-dang-lam { color: var(--warn); }
.de-row-meta b.tt-da-lam, .tt-da-lam { color: #2563eb; }
.de-row-meta b.tt-het-luot, .de-row-meta b.tt-dong, .tt-het-luot, .tt-dong { color: var(--text-mute); }
[data-theme='dark'] .tt-da-lam, [data-theme='dark'] .de-row-meta b.tt-da-lam { color: #7aa7ff; }
@media (max-width: 640px) {
  .de-row { flex-direction: column; align-items: stretch; padding: 16px; gap: 12px; }
  .de-row-act { justify-content: space-between; }
  .de-diem { text-align: left; }
}

/* =============================================================
   PHÒNG CHỜ (sảnh kíp thi)
   ============================================================= */
.pt-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 40px 16px;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--brand) 16%, transparent) 1.2px, transparent 0) 0 0 / 22px 22px,
    linear-gradient(160deg, color-mix(in srgb, var(--brand) 10%, var(--bg)) 0%, var(--bg) 55%, color-mix(in srgb, var(--brand) 7%, var(--bg)) 100%);
}
.pt-brand { display: flex; align-items: center; gap: 14px; }
.pt-logo-chu, .pt-logo-anh { width: 58px; height: 58px; border-radius: 14px; flex: none; }
.pt-logo-chu { display: grid; place-content: center; background: var(--brand); color: #fff; font-size: 30px; box-shadow: 0 6px 18px var(--brand-ring); }
.pt-logo-anh { object-fit: cover; }
.pt-kicker { color: var(--brand); font-size: 16px; font-weight: 500; }
.pt-name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.pt-card {
  width: min(880px, 100%); background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 26px; padding: 34px 44px 26px; box-shadow: var(--shadow-3);
}
.pt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pt-head h1 { font-size: 27px; font-weight: 800; letter-spacing: -.01em; }
.pt-mode { padding: 7px 14px; border-radius: 999px; background: rgba(37, 99, 235, .1); color: #1d4ed8; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
[data-theme='dark'] .pt-mode { color: #93b4ff; background: rgba(96, 140, 255, .14); }
.pt-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 15.5px; color: var(--text-soft); flex-wrap: wrap; }
.pt-line b { color: var(--text); }
.pt-cap { text-transform: uppercase; letter-spacing: .06em; font-size: 13px; font-weight: 700; color: var(--text-mute); }
.pt-cap b { letter-spacing: .04em; color: var(--text-soft); }
.pt-part { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px 0; margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pt-part-ten { color: var(--brand); font-weight: 700; font-size: 19px; }
.pt-part-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 8px; font-size: 15px; color: var(--text-soft); }
.pt-go {
  border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 700; font-size: 17px;
  padding: 15px 44px; cursor: pointer; box-shadow: 0 6px 16px var(--brand-ring); transition: .15s;
}
.pt-go:hover { filter: brightness(1.06); transform: translateY(-1px); }
.pt-go[disabled] { background: var(--bg-sunk); color: var(--text-mute); box-shadow: none; cursor: default; transform: none; }
.pt-luat-ten { margin: 18px 0 -8px; font-size: 13px; font-weight: 600; color: var(--text-mute); }
.pt-luat { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; font-size: 13.8px; color: var(--text-soft); }
.pt-su { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pt-su > b { display: block; margin-bottom: 8px; }
.pt-su-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; }
.pt-su-row:hover { background: var(--bg-sunk); }
.pt-su-xem { color: var(--brand); font-weight: 600; font-size: 13.5px; }
.pt-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-weight: 700; }
.pt-foot a:first-child { text-decoration: underline; text-underline-offset: 3px; }
.pt-thoat { color: var(--brand); }
@media (max-width: 640px) {
  .pt-card { padding: 22px 18px 18px; border-radius: 20px; }
  .pt-head h1 { font-size: 21px; }
  .pt-go { width: 100%; }
  .pt-name { font-size: 19px; }
  .pt-logo-chu, .pt-logo-anh { width: 46px; height: 46px; font-size: 24px; }
}

/* =============================================================
   PHÒNG THI — đề bên trái, cột thí sinh bên phải
   ============================================================= */
:root {
  --xr-bg: #f5f6f8; --xr-grey: #e7eaef; --xr-blue: #3b82f6; --xr-blue-soft: rgba(59, 130, 246, .10);
  --xr-blue-ring: rgba(59, 130, 246, .38); --xr-navy: #1c2b4b; --xr-navy-text: #1c2b4b;
  --xr-flag: #f59e0b; --xr-flag-soft: rgba(245, 158, 11, .16);
}
[data-theme='dark'] {
  --xr-bg: #0e1117; --xr-grey: #283041; --xr-blue: #4f8ff7; --xr-blue-soft: rgba(79, 143, 247, .16);
  --xr-blue-ring: rgba(79, 143, 247, .45); --xr-navy: #3a5aa8; --xr-navy-text: #c9d7ff;
}
.xr { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 420px); background: var(--xr-bg); }
body.exam-mode .nhan-ban { display: none; }
.xr-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.xr-top { display: flex; align-items: center; gap: 14px; padding: 14px 26px; background: var(--bg-elev); border-bottom: 1px solid var(--line); flex: none; }
.xr-logo { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-content: center; font-size: 19px; flex: none; overflow: hidden; }
.xr-logo img { width: 100%; height: 100%; object-fit: cover; }
.xr-title { font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.xr-code { color: var(--brand); font-weight: 800; font-size: 18px; white-space: nowrap; }
.xr-mob { display: none; align-items: center; gap: 8px; }
.xr-scroll { flex: 1; overflow-y: auto; padding: 22px 26px 30px; }
.xr-part { font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 8px 14px; border-radius: 10px; margin-bottom: 14px; }
.xr-part span { font-weight: 500; color: var(--text-soft); }
.xr-card {
  position: relative; display: flex; gap: 18px; align-items: flex-start;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 76px 28px 22px; box-shadow: var(--shadow-1);
}
.xr-no { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--xr-grey); display: grid; place-content: center; font-weight: 800; font-size: 17px; }
.xr-body { flex: 1; min-width: 0; }
.xr-noi { font-size: 17px; line-height: 1.85; padding-top: 6px; }
.xr-flag {
  position: absolute; top: 18px; right: 18px; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: var(--xr-grey); color: var(--text-mute); cursor: pointer; display: grid; place-content: center; transition: .15s;
}
.xr-flag:hover { color: var(--xr-flag); }
.xr-flag.on { background: var(--xr-flag-soft); color: var(--xr-flag); box-shadow: inset 0 0 0 2px var(--xr-flag); }
.xr-dan { margin-top: 16px; font-size: 14px; font-weight: 700; color: var(--text-soft); }
.xr-nho { margin: 12px 0 0; font-size: 13px; color: var(--text-mute); }

.xr-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.xr-opt { display: flex; align-items: center; gap: 16px; padding: 8px 12px 8px 8px; border-radius: 12px; cursor: pointer; transition: background .12s; }
.xr-opt:hover { background: var(--bg-sunk); }
.xr-opt:focus-visible { outline: 3px solid var(--xr-blue-ring); outline-offset: 1px; }
.xr-opt-t { flex: 1; min-width: 0; font-size: 17px; }
.xr-rad, .xr-chk {
  flex: none; width: 42px; height: 42px; background: var(--xr-grey); border: 0; display: grid; place-content: center;
  font-weight: 700; color: var(--text-soft); font-size: 14.5px; transition: .12s; padding: 0;
}
.xr-rad { border-radius: 50%; }
.xr-chk { border-radius: 9px; }
.xr-opt.on .xr-rad, .xr-rad.on, .xr-opt.on .xr-chk { background: var(--xr-blue); color: #fff; }
.xr-rad:empty::after { content: ''; width: 14px; height: 14px; border-radius: 50%; background: transparent; }
.xr-opt.on .xr-rad:empty::after, .xr-rad.on:empty::after { background: #fff; }
.xr-chk:empty::after { content: '✓'; color: transparent; font-size: 20px; line-height: 1; }
.xr-opt.on .xr-chk:empty::after { color: #fff; }
.xr-opt.on .xr-chk:not(:empty)::after { content: ' ✓'; }

.xr-tf { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 16px; }
.xr-tf th { font-weight: 600; font-size: 16px; padding: 4px 0 10px; text-align: center; width: 104px; }
.xr-tf th:first-child { width: auto; }
.xr-tf td { border: 1px solid var(--line-strong); padding: 12px 14px; }
.xr-tf td + td { border-left: 0; }
.xr-tf tbody tr + tr td { border-top: 0; }
.xr-tf tbody tr:first-child td:first-child { border-top-left-radius: 10px; }
.xr-tf tbody tr:first-child td:last-child { border-top-right-radius: 10px; }
.xr-tf tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.xr-tf tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }
.xr-tf-t { font-size: 16.5px; }
.xr-tf-c { text-align: center; }
.xr-tf-c .xr-rad { margin: 0 auto; cursor: pointer; }
.xr-tf-c .xr-rad:hover { box-shadow: 0 0 0 3px var(--xr-blue-ring); }

.xr-blank-o { white-space: nowrap; }
.xr-blank {
  width: 150px; border: 0; border-bottom: 2px solid var(--xr-blue); background: transparent; color: var(--text);
  font: inherit; font-size: 18px; font-weight: 700; text-align: center; padding: 1px 6px; margin: 0 6px; outline: none; border-radius: 0;
}
.xr-blank:focus { background: var(--xr-blue-soft); }

.xr-chips { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; border: 1.5px solid var(--xr-blue-ring); border-radius: 12px; background: var(--bg-elev); }
.xr-chip {
  min-width: 54px; padding: 8px 14px; border-radius: 8px; background: var(--xr-grey); font-weight: 700; font-size: 17px;
  text-align: center; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; border: 1.5px solid transparent; transition: .12s;
}
.xr-chip:hover { border-color: var(--xr-blue); }
.xr-chip.chon { border-color: var(--xr-blue); box-shadow: 0 0 0 3px var(--xr-blue-ring); }
.xr-chip.used { opacity: .32; cursor: default; }
.xr-chip.used:hover { border-color: transparent; }
.xr-chip.dang-keo { opacity: .4; }
.xr-bong { position: fixed; z-index: 9999; pointer-events: none; transform: translate(-50%, -60%) rotate(-2deg); box-shadow: var(--shadow-3); background: var(--bg-elev); border-color: var(--xr-blue); }
.xr-keo-dan { font-weight: 700; font-style: italic; margin: 16px 0 6px; font-size: 16.5px; }
.xr-drop {
  display: inline-flex; align-items: center; justify-content: center; min-width: 130px; min-height: 38px; padding: 2px 10px;
  margin: 2px 6px; vertical-align: middle; border: 1.5px dashed var(--line-strong); border-radius: 8px;
  background: var(--bg-elev); cursor: pointer; font-weight: 700; line-height: 1.4; transition: .12s;
}
.xr-drop:hover, .xr-drop.over { border-color: var(--xr-blue); background: var(--xr-blue-soft); }
.xr-drop.full { border-style: solid; border-color: var(--xr-blue); background: var(--xr-blue-soft); }

.xr-bottom { display: flex; align-items: center; gap: 12px; padding: 14px 26px; background: var(--bg-elev); border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.xr-nav, .xr-next { height: 50px; border-radius: 9px; border: 0; background: var(--xr-navy); color: #fff; cursor: pointer; font-weight: 700; }
.xr-nav { width: 54px; font-size: 26px; line-height: 1; }
.xr-next { padding: 0 24px; font-size: 16px; }
.xr-nav:disabled, .xr-next:disabled { background: var(--bg-sunk); color: var(--text-mute); cursor: default; box-shadow: inset 0 0 0 1px var(--line); }
.xr-qtime { color: var(--text-soft); font-size: 15px; display: flex; align-items: center; gap: 14px; margin-left: 8px; }
.xr-qtime b { font-size: 28px; color: var(--xr-navy-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.xr-qtime-ngan { display: none; }

.xr-side { background: var(--bg-elev); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.xr-side-in { flex: 1; overflow-y: auto; padding: 22px 20px 12px; }
.xr-side-h { font-size: 19px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.xr-dong { display: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg-sunk); cursor: pointer; place-content: center; }
.xr-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; color: var(--text-soft); margin-bottom: 8px; }
.xr-kv b { color: var(--text); font-weight: 600; text-align: right; }
.xr-time { display: flex; gap: 10px; margin: 18px 0 20px; }
.xr-time-box { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; }
.xr-time-box span { font-size: 13.5px; color: var(--text-soft); white-space: nowrap; }
.xr-time-box b, .xr-clock-m { font-size: 28px; font-weight: 700; color: var(--xr-navy-text); font-variant-numeric: tabular-nums; }
.xr-time-box b.warn, .xr-clock-m.warn { color: var(--warn); }
.xr-time-box b.danger, .xr-clock-m.danger { color: var(--bad); animation: pulse 1s infinite; }
.xr-submit { border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 700; font-size: 16px; padding: 0 20px; cursor: pointer; min-height: 54px; box-shadow: 0 4px 12px var(--brand-ring); }
.xr-submit:hover { filter: brightness(1.06); }
.xr-legend { display: flex; align-items: center; gap: 10px; font-size: 15px; margin-bottom: 18px; flex-wrap: wrap; }
.xr-dot { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-content: center; font-style: normal; font-weight: 700; font-size: 14px; background: var(--xr-grey); color: var(--text-soft); }
.xr-dot.done { background: var(--xr-blue); color: #fff; }
.xr-dot.flag { background: transparent; box-shadow: inset 0 0 0 2.5px var(--xr-flag); }
.xr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 10px 8px; justify-items: center; }
.xr-grid-h { grid-column: 1 / -1; justify-self: stretch; font-size: 11.5px; font-weight: 700; color: var(--text-mute); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.xr-b {
  width: 100%; max-width: 44px; aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--xr-grey);
  color: var(--text-soft); font-weight: 600; font-size: 14px; cursor: pointer; transition: .12s; padding: 0;
}
.xr-b:hover { box-shadow: 0 0 0 2px var(--xr-blue-ring); }
.xr-b.done { background: var(--xr-blue); color: #fff; }
.xr-b.do { background: color-mix(in srgb, var(--xr-blue) 30%, var(--bg-elev)); color: var(--xr-navy-text); box-shadow: inset 0 0 0 2px var(--xr-blue); }
.xr-b.flag { box-shadow: inset 0 0 0 2.5px var(--xr-flag); }
.xr-b.done.flag, .xr-b.do.flag { box-shadow: 0 0 0 2.5px var(--xr-flag); }
.xr-b.cur { background: var(--xr-navy); color: #fff; }
.xr-side-foot { padding: 14px 20px 18px; border-top: 1px solid var(--line); flex: none; }
.xr-done { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; color: var(--text-soft); }
.xr-done b { font-size: 26px; color: var(--xr-navy-text); }
.xr-bar-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; font-size: 14px; color: var(--text-soft); }
.xr-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--bg-sunk); overflow: hidden; }
.xr-bar i { display: block; height: 100%; width: 0; background: var(--xr-blue); transition: width .3s ease; }
.xr-net { font-size: 14px; color: var(--ok); display: flex; align-items: center; gap: 9px; }
.xr-net i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); flex: none; }
.xr-net.mat { color: var(--bad); }
.xr-net.mat i { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.xr-man { display: none; }
.xr .exam-warn { font-size: 13px; }

@media (max-width: 900px) {
  .xr { grid-template-columns: 1fr; }
  .xr-side { position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); z-index: 70; transform: translateX(104%); transition: transform .22s ease; box-shadow: var(--shadow-3); }
  .xr-side.mo { transform: none; }
  .xr-man.mo { display: block; position: fixed; inset: 0; background: rgba(8, 11, 20, .45); z-index: 65; }
  .xr-dong { display: inline-grid; }
  .xr-mob { display: flex; }
  .xr-top { padding: 10px 12px; gap: 10px; }
  .xr-title { font-size: 15px; }
  .xr-code { display: none; }
  .xr-clock-m { font-size: 19px; }
  .xr-mob-nut { border: 1px solid var(--line); background: var(--bg-elev); border-radius: 9px; padding: 7px 10px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
  .xr-submit-m { min-height: 36px; padding: 0 12px; font-size: 13.5px; box-shadow: none; white-space: nowrap; }
  .xr-time { flex-direction: column; }
  .xr-time .xr-submit { min-height: 46px; }
  .xr-scroll { padding: 12px 10px 20px; }
  .xr-card { padding: 16px 12px 20px; gap: 12px; flex-direction: column; }
  .xr-no { width: 36px; height: 36px; font-size: 15px; }
  .xr-flag { top: 12px; right: 12px; width: 36px; height: 36px; }
  .xr-noi { font-size: 16px; padding-top: 0; }
  .xr-opt-t { font-size: 16px; }
  .xr-rad, .xr-chk { width: 38px; height: 38px; }
  .xr-tf th { width: 62px; font-size: 14px; }
  .xr-tf td { padding: 10px 8px; }
  .xr-bottom { padding: 10px 12px; gap: 8px; }
  .xr-nav, .xr-next { height: 44px; }
  .xr-qtime { font-size: 12.5px; gap: 8px; margin-left: 2px; }
  .xr-qtime-dai { display: none; }
  .xr-qtime-ngan { display: inline; }
  .xr-qtime b { font-size: 20px; }
  .xr-drop { min-width: 96px; }
}
@media (max-width: 420px) { .xr-mob-nut span { display: none; } }

/* =============================================================
   KẾT QUẢ
   ============================================================= */
.kq-wrap { max-width: 920px; margin: 0 auto; }
.kq-card { text-align: center; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 30px 26px; box-shadow: var(--shadow-2); }
.kq-kicker { font-size: 12.5px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; }
.kq-ten { font-size: 22px; margin-top: 6px; }
.kq-so { margin-top: 14px; }
.kq-lon { font-size: 64px; font-weight: 800; line-height: 1.05; letter-spacing: -.03em; }
.kq-lon small { font-size: 30px; color: var(--text-mute); font-weight: 700; }
.kq-nhan { color: var(--text-mute); }
.kq-o { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
.kq-o > div { min-width: 104px; padding: 10px 14px; border-radius: var(--r); background: var(--bg-sunk); }
.kq-o b { display: block; font-size: 22px; line-height: 1.2; }
.kq-o span { font-size: 12.5px; color: var(--text-mute); }
.kq-luoi-the { margin-top: 18px; }
.kq-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 8px; justify-items: center; }
.kq-b { width: 100%; max-width: 42px; aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; font-weight: 700; font-size: 13.5px; color: #fff; }
.kq-b.dung { background: var(--ok); }
.kq-b.sai { background: var(--bad); }
.kq-b.trong { background: var(--bg-sunk); color: var(--text-mute); }
.kq-cham { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 3px 0 8px; vertical-align: middle; }
.kq-cham.dung { background: var(--ok); }
.kq-cham.sai { background: var(--bad); }
.kq-cham.trong { background: var(--line-strong); }
.kq-bang { max-width: 640px; margin: 20px auto; }
.kq-o-keo { display: inline-flex; align-items: center; justify-content: center; min-width: 60px; padding: 1px 10px; margin: 0 4px; border-radius: 8px; border: 1.5px solid var(--line-strong); font-weight: 700; vertical-align: middle; }
.kq-o-keo.dung { border-color: var(--ok); background: var(--ok-soft); }
.kq-o-keo.sai { border-color: var(--bad); background: var(--bad-soft); }
.kq-o-keo.trong { border-style: dashed; color: var(--text-mute); }
.kq-o-dung { color: var(--ok); font-weight: 700; font-size: 14px; margin-right: 6px; }
.kq-cau { scroll-margin-top: calc(var(--header-h) + 14px); }
.kq-cau.nhay { animation: kqNhay 1.3s ease; }
@keyframes kqNhay { 0%, 100% { box-shadow: var(--shadow-1); } 30% { box-shadow: 0 0 0 4px var(--brand-ring); } }
@media (max-width: 560px) { .kq-lon { font-size: 50px; } .kq-o > div { min-width: 86px; } }

.kq-chk { flex: none; width: 27px; height: 27px; border-radius: 7px; display: grid; place-content: center; font-weight: 800; font-size: 14px;
  border: 2px solid var(--line-strong); background: var(--bg-elev); color: var(--text); }
.kq-chk.on { background: var(--xr-blue); border-color: var(--xr-blue); color: #fff; }

/* ---------- Trang chủ: mỗi phần một thẻ lớn ---------- */
.khu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.khu-card {
  --c: var(--brand);
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px;
  padding: 22px 22px 20px; border-radius: var(--r-xl); border: 1px solid var(--line); cursor: pointer;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 11%, var(--bg-elev)), var(--bg-elev) 58%);
  box-shadow: var(--shadow-1); transition: .18s;
}
.khu-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.khu-card::after {
  content: ''; position: absolute; right: -40px; top: -40px; width: 170px; height: 170px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--c) 34%, transparent) 1.2px, transparent 0) 0 0 / 14px 14px;
  -webkit-mask-image: radial-gradient(closest-side, #000, transparent); mask-image: radial-gradient(closest-side, #000, transparent);
}
.khu-dau { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.khu-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-content: center; font-size: 23px; background: color-mix(in srgb, var(--c) 16%, var(--bg-elev)); }
.khu-card .hub-pill { color: var(--c); }
.khu-card h3 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.khu-card p { margin: 0; }
.khu-so { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--text-soft); }
.khu-so b { color: var(--c); font-size: 16px; }
.khu-nut { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.khu-nut .btn-primary { background: var(--c); box-shadow: 0 2px 10px color-mix(in srgb, var(--c) 35%, transparent); }
@media (max-width: 420px) { .khu-grid { grid-template-columns: 1fr; } .khu-card { padding: 18px 16px; } }

/* =============================================================
   v1.45 — PHÒNG LUYỆN ĐỀ · THƯ VIỆN · TÌM KIẾM · TRANG GIỚI THIỆU
   Dùng lại đúng bộ màu, bo góc, bóng đổ của web — không thêm phông,
   không thêm màu mới ngoài --c (màu riêng của từng gói / khoá).
   ============================================================= */

/* ---------- Thẻ gói đề ---------- */
.goi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.goi-card {
  --c: var(--brand);
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px;
  background: var(--bg-elev); border: 1px solid var(--line); border-top: 4px solid var(--c);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1); transition: .18s;
}
.goi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.goi-dau { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.goi-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-content: center; font-size: 21px; flex: none;
  background: color-mix(in srgb, var(--c) 14%, var(--bg-elev)); }
.goi-card .hub-pill { --c: inherit; color: var(--c); }
.goi-card h3 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.goi-mo { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.goi-so { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--text-soft); }
.goi-so b { color: var(--text); }
.goi-td { display: grid; gap: 5px; }
.goi-nut { align-self: flex-start; margin-top: auto; }
.goi-card .btn-primary.goi-nut { background: var(--c); box-shadow: 0 2px 10px color-mix(in srgb, var(--c) 32%, transparent); }

.che-do-giai { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-top: 4px; }
.cd-o { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--r); background: var(--bg-sunk); }
.cd-nhac { grid-column: 1 / -1; }
@media (max-width: 640px) { .che-do-giai { grid-template-columns: 1fr; } }

.de-row-khoa { color: var(--text-soft); cursor: default; }
.de-row-khoa:hover { text-decoration: none; }
.de-khoa { display: inline-grid; place-content: center; min-width: 118px; height: 46px; border-radius: var(--r); background: var(--bg-sunk); font-size: 18px; }

/* Lịch hoạt động: mỗi ô một ngày */
.hm-khung { overflow-x: auto; padding-bottom: 4px; }
.hm-luoi { display: grid; grid-template-rows: repeat(7, 13px); grid-auto-flow: column; grid-auto-columns: 13px; gap: 3px; width: max-content; }
.hm-o { display: inline-block; width: 13px; height: 13px; border-radius: 3px; background: var(--bg-sunk); vertical-align: middle; }
.hm-1 { background: color-mix(in srgb, var(--brand) 30%, var(--bg-sunk)); }
.hm-2 { background: color-mix(in srgb, var(--brand) 60%, var(--bg-sunk)); }
.hm-3 { background: var(--brand); }
.hm-chu { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 10px; }

/* Phòng chờ: hai chế độ, nộp lượt cũ */
.pt-nut-cot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.pt-go-luyen { background: var(--bg-elev); color: var(--brand); border: 2px solid var(--brand); box-shadow: none; padding: 13px 34px; }
.pt-phu { border: 1.5px solid var(--line-strong); background: var(--bg-elev); color: var(--text); border-radius: 10px; padding: 13px 22px; font-weight: 700; font-size: 15px; cursor: pointer; }
.pt-phu:hover { background: var(--bg-sunk); }
.pt-chedo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.pt-chedo > div { display: grid; gap: 3px; padding: 11px 13px; border-radius: 10px; background: var(--bg-sunk); font-size: 13.5px; }
.pt-chedo span { color: var(--text-soft); }
@media (max-width: 640px) {
  .pt-chedo { grid-template-columns: 1fr; }
  .pt-nut-cot { width: 100%; }
  .pt-nut-cot > button { flex: 1 1 100%; }
}
.xr-chedo { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.kq-moi { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; max-width: 640px; margin: 18px auto; border-color: var(--brand-ring); }

/* ---------- Thư viện tài liệu ---------- */
.tv-loc { display: flex; gap: 10px; align-items: stretch; margin-top: 18px; flex-wrap: wrap; }
.tv-loc .tim-khung { flex: 1 1 320px; margin: 0; }
.tv-xep { width: auto; min-width: 150px; }
.tv-bao { margin: 8px 2px 10px; min-height: 1em; }
.tv-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tv-the {
  --c: var(--brand);
  display: flex; flex-direction: column; gap: 8px; padding: 15px 16px; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); transition: .16s;
}
.tv-the:hover, .tv-the:focus-visible { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow-2); outline: none; }
.tv-the.khoa { background: color-mix(in srgb, var(--bg-sunk) 45%, var(--bg-elev)); }
.tv-the.khoa .tv-ten { color: var(--text-soft); }
.tv-dau { display: flex; align-items: center; gap: 8px; }
.tv-ico { font-size: 26px; line-height: 1; }
.tv-loai { font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--bg-sunk); color: var(--text-soft); }
.tv-ten { font-size: 15px; line-height: 1.4; }
.tv-mo { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tv-chan { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; border-top: 1px dashed var(--line); }

/* ---------- Hộp tìm kiếm ---------- */
.tk-nen { align-items: flex-start; padding-top: min(12vh, 90px); }
.tk-hop { width: min(640px, 100%); max-height: min(76vh, 640px); display: flex; flex-direction: column; overflow: hidden; }
.tk-dau { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tk-kinh { font-size: 18px; opacity: .7; }
.tk-o { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 17px; padding: 8px 2px; outline: none; color: var(--text); }
.tk-o::-webkit-search-cancel-button { display: none; }
.tk-kq { overflow: auto; padding: 8px 8px 12px; }
.tk-goi { padding: 18px 14px; text-align: center; }
.tk-nhom + .tk-nhom { margin-top: 6px; }
.tk-nhom-ten { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); padding: 10px 10px 4px; }
.tk-dong { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 10px; }
.tk-dong:hover, .tk-dong.on { background: var(--brand-soft); }
.tk-dong.khoa b { color: var(--text-soft); }
.tk-ico { width: 24px; text-align: center; flex: none; }
.tk-chu { display: grid; min-width: 0; }
.tk-chu b { font-size: 14.5px; font-weight: 600; }
.tk-chu span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-them { padding: 2px 10px 6px 44px; }
@media (max-width: 560px) { .tk-nen { padding: 0; align-items: stretch; } .tk-hop { max-height: 100vh; height: 100%; border-radius: 0; width: 100%; } }

/* ---------- Thanh menu dưới đáy (chỉ điện thoại) ---------- */
.botnav { display: none; }
@media (max-width: 760px) {
  .botnav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg-elev) 94%, transparent); backdrop-filter: saturate(160%) blur(12px);
    border-top: 1px solid var(--line);
  }
  .botnav a { display: grid; justify-items: center; gap: 1px; padding: 5px 2px; border-radius: 10px; color: var(--text-mute); min-width: 0; }
  .botnav a span { font-size: 19px; line-height: 1.1; }
  .botnav a b { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .botnav a.on { color: var(--brand); background: var(--brand-soft); }
  .page { padding-bottom: 96px; }
  .toasts { bottom: 82px; }
  body.exam-mode .botnav { display: none; }
}

/* ---------- Nút liên hệ nổi ---------- */
.lh-noi { position: fixed; right: 16px; bottom: 18px; z-index: 44; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.lh-nut {
  display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer;
  padding: 11px 16px 11px 13px; border-radius: 999px; font-size: 19px; font-weight: 700;
  background: var(--brand); color: #fff; box-shadow: 0 8px 22px var(--brand-ring);
}
.lh-nhan { font-size: 14px; }
.lh-ds { display: grid; gap: 6px; padding: 8px; border-radius: var(--r-lg); background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow-3); min-width: 200px; }
.lh-kenh { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.lh-kenh:hover { background: var(--bg-sunk); }
.lh-kenh span { width: 22px; text-align: center; }
@media (max-width: 560px) { .lh-nhan { display: none; } .lh-nut { padding: 12px 13px; } }

/* ---------- Chân trang ---------- */
.chan-trang { border-top: 1px solid var(--line); background: var(--bg-elev); padding: 28px 18px 22px; }
.ct-trong { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 22px; }
.ct-cot { display: grid; gap: 6px; align-content: start; }
.ct-cot > b { margin-bottom: 2px; }
.ct-cot a { color: var(--text-soft); font-size: 14px; }
.ct-cot a:hover { color: var(--brand); }
.ct-ten p { margin: 0; }
.ct-cuoi { max-width: 1180px; margin: 18px auto 0; padding-top: 14px; border-top: 1px dashed var(--line); }
@media (max-width: 560px) {
  /* Điện thoại: tên lớp một hàng, các cột còn lại 2 cột cho ngắn chân trang */
  .ct-trong { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; }
  .ct-trong > .ct-ten { grid-column: 1 / -1; }
  .ct-cot a { overflow-wrap: anywhere; }
}

/* ---------- Trang giới thiệu cho khách ---------- */
.ck-hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; align-items: center;
  padding: 38px 36px; border-radius: var(--r-xl); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--bg-elev)), var(--bg-elev) 62%);
}
.ck-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .8;
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--brand) 30%, transparent) 1.2px, transparent 0) 0 0 / 20px 20px;
  -webkit-mask-image: linear-gradient(105deg, transparent 40%, #000 98%); mask-image: linear-gradient(105deg, transparent 40%, #000 98%);
}
.ck-hero > * { position: relative; }
.ck-hero.co-banner { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.ck-hero h1 { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1.12; margin-top: 12px; }
.ck-hero-l > p { font-size: 17px; color: var(--text-soft); margin: 12px 0 0; max-width: 620px; }
.ck-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.ck-cta-phu { padding: 12px 16px; border-radius: var(--r-lg); background: var(--bg-elev); }
.ck-so { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.ck-so > div { display: grid; min-width: 92px; padding: 10px 14px; border-radius: var(--r); background: var(--bg-elev); border: 1px solid var(--line); }
.ck-so b { font-size: 22px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.ck-so span { font-size: 12.5px; color: var(--text-mute); }
.ck-gioithieu { margin-top: 18px; }

.ck-banner { position: relative; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-2); background: var(--bg-sunk); }
.ck-banner-ray { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ck-banner-ray::-webkit-scrollbar { display: none; }
.ck-banner-o { position: relative; flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 16 / 9; display: block; }
.ck-banner-o img { width: 100%; height: 100%; object-fit: cover; }
.ck-banner-chu { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 2px; padding: 34px 18px 14px; color: #fff;
  background: linear-gradient(transparent, rgba(5, 8, 16, .72)); }
.ck-banner-chu b { font-size: 18px; }
.ck-banner-chu span { font-size: 13.5px; opacity: .92; }
.ck-banner-cham { position: absolute; right: 12px; top: 12px; display: flex; gap: 6px; }
.ck-banner-cham button { width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: rgba(255, 255, 255, .55); }
.ck-banner-cham button.on { background: #fff; width: 22px; border-radius: 6px; }

.ck-luoi-khoa { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ck-khoa {
  --c: var(--brand);
  display: flex; flex-direction: column; gap: 9px; padding: 20px; cursor: pointer;
  border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: .18s;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 9%, var(--bg-elev)), var(--bg-elev) 55%);
}
.ck-khoa:hover, .ck-khoa:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); outline: none; }
.ck-khoa-dau { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ck-khoa-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-content: center; font-size: 22px; background: color-mix(in srgb, var(--c) 15%, var(--bg-elev)); }
.ck-khoa .hub-pill { color: var(--c); }
.ck-khoa h3 { font-size: 18px; font-weight: 800; }
.ck-khoa p { margin: 0; }
.ck-khoa-so { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-soft); }
.ck-khoa-so b { color: var(--c); }
.ck-khoa .badge { align-self: flex-start; }
.ck-khoa-xem { margin-top: auto; padding-top: 6px; color: var(--c); font-weight: 700; font-size: 14px; }

.ck-gv-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.ck-gv { display: flex; gap: 16px; padding: 18px; align-items: flex-start; }
.ck-gv-anh { width: 92px; height: 92px; flex: none; border-radius: 18px; overflow: hidden; display: grid; place-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 34px; font-weight: 800; }
.ck-gv-anh img { width: 100%; height: 100%; object-fit: cover; }
.ck-gv-chu h3 { font-size: 17px; }
.ck-gv-chu p { margin: 8px 0 0; }

.ck-tt-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.ck-tt { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 18px 14px; }
.ck-tt-anh { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; margin-bottom: 6px; border: 3px solid var(--brand-soft); }
.ck-tt-chu { display: grid; place-content: center; font-size: 30px; background: var(--brand-soft); }
.ck-tt-kq { font-size: 18px; color: var(--brand); font-weight: 800; line-height: 1.25; }
.ck-tt-ten { font-weight: 600; }

.hd-ds { display: grid; gap: 10px; }
.hd-o { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.hd-o summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 18px; cursor: pointer; font-weight: 600; }
.hd-o summary::-webkit-details-marker { display: none; }
.hd-o summary i { font-style: normal; font-size: 20px; color: var(--brand); transition: transform .18s; flex: none; }
.hd-o[open] summary i { transform: rotate(45deg); }
.hd-o[open] summary { border-bottom: 1px dashed var(--line); }
.hd-dap { padding: 12px 18px 16px; }

.ck-tuvan { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 26px; padding: 28px; scroll-margin-top: calc(var(--header-h) + 16px);
  background: linear-gradient(140deg, color-mix(in srgb, var(--brand) 8%, var(--bg-elev)), var(--bg-elev) 60%); }
.ck-tuvan h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.ck-tuvan-l p { margin: 10px 0 0; }
.ck-kenh { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ck-cam-on { text-align: center; padding: 20px 8px; }
.ck-cam-on h3 { margin: 8px 0 6px; }
.o-bay { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ck-trang { max-width: 860px; margin: 0 auto; padding: 30px 32px; }
.ck-trang h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
@media (max-width: 860px) {
  .ck-hero, .ck-hero.co-banner { grid-template-columns: minmax(0, 1fr); padding: 26px 20px; }
  .ck-hero h1 { font-size: 29px; }
  .ck-tuvan { grid-template-columns: minmax(0, 1fr); padding: 22px 18px; }
  .ck-trang { padding: 22px 18px; }
}
@media (max-width: 560px) {
  /* Số liệu đầu trang: 4 ô xếp 2×2 cho cân, không lẻ một ô xuống hàng */
  .ck-so { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ck-so > div { min-width: 0; }
  /* Thành tích: 2 thẻ một hàng cho gọn, khỏi kéo mãi */
  .ck-tt-luoi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ck-tt { padding: 14px 10px; }
  .ck-tt-anh { width: 62px; height: 62px; }
  .ck-tt-chu { font-size: 25px; }
  .ck-tt-kq { font-size: 16px; }
}
@media (max-width: 420px) {
  .ck-gv-luoi { grid-template-columns: 1fr; }
  .ck-gv { flex-direction: column; align-items: center; text-align: center; }
  .ck-cta .btn { flex: 1 1 100%; }
}

/* ---------- Quản trị: gói đề, trang giới thiệu ---------- */
.goi-ql { --c: var(--brand); border-left: 4px solid var(--c); }
.goi-sua { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.goi-nhan { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin: 14px 0 6px; }
.goi-de-dong { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-elev); }
.goi-stt { width: 24px; height: 24px; border-radius: 7px; display: grid; place-content: center; font-size: 12px; font-weight: 700; background: var(--bg-sunk); flex: none; }
.goi-de-ten { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.nd-anh { width: 86px; height: 58px; border-radius: 10px; overflow: hidden; background: var(--bg-sunk); display: grid; place-content: center; flex: none; border: 1px solid var(--line); }
.nd-anh img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 1100px) { .goi-sua { grid-template-columns: minmax(0, 1fr); } }

/* Điện thoại: chừa chỗ cho thanh menu dưới đáy (đặt CUỐI file để thắng các luật gốc phía trên) */
@media (max-width: 760px) {
  /* Khách dùng điện thoại: menu đã nằm dưới đáy, bỏ dải menu trên cùng (bị cắt chữ "Trang ch…") */
  .topbar-khach .nav { display: none; }
  .lh-noi { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .chan-trang { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* Thuộc tính hidden phải LUÔN ẩn được — kể cả khi phần tử có display: flex/grid riêng.
   Trước đây ô tìm nhanh bài giảng bấm lọc mà dòng bài (display:flex) vẫn hiện nguyên. */
[hidden] { display: none !important; }
