/* Luyện GPLX — Đức Quang Solutions
 * Bảng màu, font và hình khối lấy từ giao diện C1 của ducquang.com.vn (app/globals.css, lớp .c1-site):
 * nền kem #f7f3ec, bề mặt #fffdf9, chữ graphite #26262a, viền ấm #e7ded2, đỏ thương hiệu #b91f2a,
 * nút bo tròn dạng viên thuốc, thẻ bo 1rem, một dải graphite duy nhất làm điểm nhấn.
 * Chế độ tối là phần bổ sung (nguồn C1 không có), giữ cùng vai trò màu.
 */

:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --surface-2: #f1ebe1;
  --surface-3: #efe7da;
  --ink: #26262a;
  --ink-2: #6e675e;
  --line: #e7ded2;
  --line-strong: #d6c9b8;
  --red: #b91f2a;
  --red-hover: #a91924;
  --red-text: #b91f2a;
  --red-tint: #f7e6e4;
  --logo-red: #ee2b30;
  --on-red: #ffffff;
  --graphite: #2c2b31;
  --on-graphite: #ffffff;
  --on-graphite-2: rgba(255, 255, 255, 0.68);
  --ok: #1c7a4a;
  --ok-tint: #e3f2e8;
  --ok-line: #95cfae;
  --on-ok: #ffffff;
  --bad: #b91f2a;
  --bad-tint: #fbe8e6;
  --bad-line: #e8aca5;
  --on-bad: #ffffff;
  --pick: #26262a;
  --pick-tint: #ece5da;
  --shadow-sm: 0 1px 2px rgba(38, 38, 42, 0.06);
  --shadow: 0 1px 2px rgba(38, 38, 42, 0.05), 0 12px 32px -18px rgba(38, 38, 42, 0.28);
  --scrim: rgba(24, 22, 26, 0.55);
  --logo-light: block;
  --logo-dark: none;
  --fig-bg: transparent;
  --fig-ink: #26262a;
  --font: "Be Vietnam Pro", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r-card: 1rem;
  --r-big: 1.5rem;
  --r-ctl: 12px;
  --header-h: 52px;
  --gutter: 8px; /* lề trái phải của cả ứng dụng; thẻ câu hỏi cũng cách mép trong bằng chừng ấy */
  color-scheme: light;
}
@media (min-width: 640px) {
  :root {
    --header-h: 60px;
    --gutter: 24px;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #19181c;
    --surface: #222126;
    --surface-2: #2a292f;
    --surface-3: #312f36;
    --ink: #f2ede5;
    --ink-2: #b3aa9e;
    --line: #36343b;
    --line-strong: #4a4750;
    --red: #d63a40; /* chữ trắng trên nền đỏ đạt 4.6:1 */
    --red-hover: #e0454b;
    --red-text: #ff8080;
    --red-tint: #3a1f22;
    --logo-red: #ff5a5f;
    --on-red: #ffffff;
    --graphite: #0f0e12;
    --on-graphite: #f2ede5;
    --on-graphite-2: rgba(242, 237, 229, 0.66);
    --ok: #4cc38a;
    --ok-tint: #173022;
    --ok-line: #2f6b49;
    --on-ok: #0c2016;
    --bad: #ff7a7a;
    --bad-tint: #3a1d20;
    --bad-line: #7a3136;
    --on-bad: #2a0f11;
    --pick: #f2ede5;
    --pick-tint: #34313a;
    --shadow-sm: none;
    --shadow: 0 12px 32px -18px rgba(0, 0, 0, 0.7);
    --scrim: rgba(0, 0, 0, 0.66);
    --logo-light: none;
    --logo-dark: block;
    --fig-bg: #ffffff;
    --fig-ink: #26262a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #19181c;
  --surface: #222126;
  --surface-2: #2a292f;
  --surface-3: #312f36;
  --ink: #f2ede5;
  --ink-2: #b3aa9e;
  --line: #36343b;
  --line-strong: #4a4750;
  --red: #d63a40;
  --red-hover: #e0454b;
  --red-text: #ff8080;
  --red-tint: #3a1f22;
  --logo-red: #ff5a5f;
  --on-red: #ffffff;
  --graphite: #0f0e12;
  --on-graphite: #f2ede5;
  --on-graphite-2: rgba(242, 237, 229, 0.66);
  --ok: #4cc38a;
  --ok-tint: #173022;
  --ok-line: #2f6b49;
  --on-ok: #0c2016;
  --bad: #ff7a7a;
  --bad-tint: #3a1d20;
  --bad-line: #7a3136;
  --on-bad: #2a0f11;
  --pick: #f2ede5;
  --pick-tint: #34313a;
  --shadow-sm: none;
  --shadow: 0 12px 32px -18px rgba(0, 0, 0, 0.7);
  --scrim: rgba(0, 0, 0, 0.66);
  --logo-light: none;
  --logo-dark: block;
  --fig-bg: #ffffff;
  --fig-ink: #26262a;
  color-scheme: dark;
}

/* ---------- Nền tảng ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-padding-top: calc(var(--header-h) + 72px);
  scroll-padding-bottom: 96px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  /* chạm hai lần nhanh (bấm Câu sau liên tiếp) không phóng to trang — phóng to làm hàng nút neo đáy trôi lên giữa */
  touch-action: manipulation;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img {
  max-width: 100%;
  height: auto;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
:focus-visible {
  outline: 2.5px solid var(--red);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
/* tiêu đề ngắn: cân dòng. Câu hỏi (h2.q-text) không cân — viết liền lấp đủ bề ngang */
h1,
h2:not(.q-text),
h3 {
  text-wrap: balance;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px; /* ô đọc màn hình cuối trang không làm trang dài thêm 1 px (trang Kỷ lục vừa khít màn hình) */
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.num {
  font-variant-numeric: tabular-nums;
}

.wrap {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap.narrow {
  max-width: 760px;
}
/* Máy tính (chuột, màn rộng): cột rộng hơn và chữ to hơn cho thoáng. Cỡ chữ các phần đều theo rem nên cả giao diện
   to theo; điện thoại và iPad (cảm ứng) giữ nguyên. */
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
  html {
    font-size: 17px;
  }
  .wrap {
    max-width: 1120px;
  }
  .wrap.narrow {
    max-width: 920px;
  }
}
@media (min-width: 1440px) and (hover: hover) and (pointer: fine) {
  html {
    font-size: 18px;
  }
  .wrap {
    max-width: 1240px;
  }
  .wrap.narrow {
    max-width: 1000px;
  }
}
@media (min-width: 1680px) and (hover: hover) and (pointer: fine) {
  html {
    font-size: 19px;
  }
  .wrap {
    max-width: 1320px;
  }
  .wrap.narrow {
    max-width: 1080px;
  }
}

/* ---------- Đầu trang ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
}
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: none;
  padding: 4px 0;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
}
.brand img {
  height: 26px;
  width: auto;
  flex: none;
}
.brand .logo-l {
  display: var(--logo-light);
}
.brand .logo-d {
  display: var(--logo-dark);
}
.hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hdr-btn {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.875rem;
}
/* điện thoại: logo nhỏ lại — vừa một dòng với hai nút "Kỷ lục", "Học lại" (đo tới máy 360px) */
@media (max-width: 460px) {
  .brand img {
    height: 20px;
  }
  .hdr-right {
    gap: 6px;
  }
  .hdr-btn {
    min-height: 34px;
    padding: 0 11px;
    font-size: 0.8125rem;
  }
}
@media (max-width: 380px) {
  .brand img {
    height: 18px;
  }
  .hdr-btn {
    padding: 0 9px;
  }
}
.hdr-btn svg {
  width: 17px;
  height: 17px;
}
/* nút Kỷ lục: xanh lá đậm cả sáng lẫn tối (chữ trắng đọc rõ) */
.btn-xanh {
  background: #1c7a4a;
  color: #fff;
}
.btn-xanh:hover:not(:disabled) {
  background: #166a3f;
}

/* Vào qua đường dẫn của thầy: Trang chủ · Gọi, Zalo · "Thầy …" + số điện thoại · (bên phải như cũ) */
.site-header.co-thay .hdr {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
}
.hdr-nha {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 0.9375rem var(--font);
  cursor: pointer;
}
.hdr-nha:hover {
  border-color: var(--ink-2);
}
.hdr-nha svg {
  width: 20px;
  height: 20px;
  flex: none;
}
.hdr-lh {
  display: inline-flex;
  gap: 6px;
}
.hdr-ico {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  flex: none;
}
.hdr-ico svg {
  width: 18px;
  height: 18px;
}
.hdr-ico.goi {
  background: #1c7a4a;
}
.hdr-ico.zalo {
  background: #0068ff;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.hdr-ten {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  line-height: 1.3;
}
.hdr-ten b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9375rem;
  font-weight: 700;
}
.hdr-sdt {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.hdr-sdt:hover {
  color: var(--ink);
}
/* điện thoại: hàng 1 — nhà sát góc màn hình, Gọi, Zalo … bên phải; hàng 2 — tên thầy + số, thẳng mép nút nhà */
@media (max-width: 639px) {
  :root.co-thay {
    --header-h: 84px;
  }
  .site-header.co-thay .hdr {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas: "nha lh phai" "ten ten ten";
    align-content: center;
  }
  .hdr-nha {
    grid-area: nha;
    margin-left: calc(-1 * var(--gutter));
    padding: 0 10px 0 var(--gutter);
    border-left: 0;
    border-radius: 0 999px 999px 0;
  }
  .hdr-nha span {
    display: none;
  }
  .hdr-lh {
    grid-area: lh;
  }
  .site-header.co-thay .hdr-right {
    grid-area: phai;
    justify-self: end;
  }
  .hdr-ten {
    grid-area: ten;
    padding-left: 2px;
  }
}

/* ---------- Nút ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}
.btn-red {
  background: var(--red);
  color: var(--on-red);
}
.btn-red:hover:not(:disabled) {
  background: var(--red-hover);
}
.btn-line {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-line:hover:not(:disabled) {
  border-color: var(--ink-2);
}
.btn-light {
  background: var(--on-graphite);
  color: var(--graphite);
}
.btn-light:hover:not(:disabled) {
  background: var(--bg);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}
.btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.9375rem;
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.45;
}
.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--red-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.icon-btn:hover {
  border-color: var(--line-strong);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ---------- Trang chủ: chọn hạng → học lý thuyết → câu điểm liệt → [mô phỏng] → thi thử ----------
   Khung trang là cột dọc cao bằng màn hình: phần lưu ý và chân trang dồn xuống đáy. */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
#app > main {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-block: 10px 4px;
}
@media (min-width: 768px) {
  .home {
    gap: 14px;
    padding-top: 24px;
  }
}
.home-q {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
@media (min-width: 768px) {
  .home-q {
    font-size: 1.5rem;
  }
}

/* Chọn hạng: mã hạng nền đỏ chữ trắng; dòng phụ là loại xe được lái (tối đa 2 dòng, ô cao cố định) */
.classes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 640px) {
  .classes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.cls {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 8px 10px 8px 8px;
  text-align: left;
  border-radius: var(--r-card);
  border: 1.5px solid var(--line);
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.cls:hover {
  border-color: var(--line-strong);
}
.cls-code {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 40px;
  height: 40px;
  padding-inline: 5px;
  border-radius: 11px;
  background: var(--red);
  color: var(--on-red);
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.cls-code svg {
  width: 20px;
  height: 20px;
}
.cls-txt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.cls-title {
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.25;
}
.cls-sub {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--ink-2);
}
.cls[aria-checked="true"] {
  border-color: var(--red);
  background: var(--red-tint);
  box-shadow: 0 0 0 1px var(--red) inset;
}

/* Thẻ lớn: cả khối là một nút, động từ nằm bên phải. Ô Mô phỏng luôn giữ chỗ (trống với hạng xe máy) để thẻ
   Thi thử không nhảy khi đổi hạng. */
.go-main {
  display: grid;
  gap: 10px;
}
.go {
  min-height: 76px;
}
.go-slot {
  display: grid;
}
.go-ghost {
  visibility: hidden;
}
.go {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.go:hover {
  border-color: var(--line-strong);
}
.go:active,
.go-exam:active {
  transform: translateY(1px);
}
.go-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--red-tint);
  color: var(--red-text);
}
.go-ico svg {
  width: 24px;
  height: 24px;
}
.go-txt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.go-txt b {
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.go-cta {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-red);
  font-weight: 600;
  white-space: nowrap;
}
/* điện thoại: siết khoảng cách để "Mô phỏng tình huống" nằm một dòng (đo từ bề rộng 360px) */
@media (max-width: 440px) {
  .go {
    gap: 10px;
    padding: 12px;
  }
  .go-ico {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .go-ico svg {
    width: 20px;
    height: 20px;
  }
  .go-txt b {
    font-size: 1.125rem;
    letter-spacing: -0.02em;
  }
  .go-cta {
    padding: 0 12px;
    font-size: 0.875rem;
  }
}
@media (max-width: 370px) {
  .go {
    gap: 8px;
  }
  .go-txt b {
    font-size: 1.0625rem;
  }
}

/* Thi thử: khối đỏ chữ trắng, dưới cùng. Trái: bốn ô "số + chữ", mỗi ô canh mép trái, chia đều cột
   (điện thoại hai hàng: câu · phút / cần đúng · câu liệt; màn rộng một hàng bốn ô); phải: "Thi thử" lớn, giữa dọc */
.go-exam {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--r-card);
  background: var(--red);
  color: var(--on-red);
  text-align: left;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.go-exam:hover {
  background: var(--red-hover);
}
.ge-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.625rem;
  line-height: 1.1;
  white-space: nowrap;
}
.ge-head svg {
  width: 28px;
  height: 28px;
}
.ge-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(max-content, 1fr)); /* cột không hẹp hơn chữ: không đè nhau */
  gap: 2px 12px;
  min-height: 56px;
  align-content: center;
  font-size: 0.875rem;
  line-height: 1.25;
}
.ge-s {
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
.ge-s b {
  font-size: 1.25rem;
  font-weight: 800;
}
/* máy hẹp: chữ nhỏ lại, bỏ đồng hồ — số và "Thi thử" vẫn đủ chỗ */
@media (max-width: 380px) {
  .go-exam {
    padding-inline: 12px;
  }
  .ge-head {
    font-size: 1.375rem;
  }
  .ge-head svg {
    display: none;
  }
  .ge-stats {
    column-gap: 10px;
    font-size: 0.8125rem;
  }
  .ge-s {
    gap: 4px;
  }
  .ge-s b {
    font-size: 1.125rem;
  }
}
@media (min-width: 640px) {
  .go-exam {
    gap: 24px;
    padding: 14px 24px;
  }
  .ge-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 48px;
    font-size: 0.9375rem;
  }
  .ge-s b {
    font-size: 1.5rem;
  }
  .go-exam .ge-run {
    min-height: 48px;
  }
}
.ge-run {
  display: flex;
  align-items: center;
  gap: 0.3em;
  min-height: 56px;
  font-weight: 600;
}

/* Lưu ý: chữ nhỏ, mỗi ý một dòng, dồn xuống sát chân trang */
.home-notes {
  display: grid;
  gap: 4px;
  margin: auto 0 0;
  padding: 14px 0 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.home-notes li {
  position: relative;
  padding-left: 14px;
}
.home-notes li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}

.sec-hint {
  font-size: 0.875rem;
  color: var(--ink-2);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink);
}
.hdr .pill {
  flex: none;
  white-space: nowrap;
  padding: 3px 9px;
  border: 1px solid var(--bad-line);
  background: var(--red-tint);
  color: var(--red-text);
}
.card {
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--surface);
}

/* Chân trang */
/* Chân trang: neo đáy (khung trang là cột dọc cao bằng màn hình), hai dòng canh giữa, đường kẻ sát chữ */
.site-footer {
  margin-top: 12px;
  padding-block: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-2);
  text-align: center;
}
.foot {
  display: grid;
  gap: 2px;
}
.foot-links .link {
  white-space: nowrap;
}
.foot .link {
  color: inherit;
  font-weight: 600;
  text-decoration-color: var(--line-strong);
}

/* ---------- Màn học / thi ---------- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.switch .knob {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color 0.15s ease;
}
.switch .knob::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}
.switch[aria-checked="true"] .knob {
  background: var(--ok);
}
.switch[aria-checked="true"] .knob::after {
  transform: translateX(14px);
}

/* Nhóm câu / chương: xuống hàng cho vừa màn hình, không cuộn ngang */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-block: 8px 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip small {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-2);
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.chip[aria-pressed="true"] small {
  color: inherit;
  opacity: 0.75;
}
.chip.liet:not([aria-pressed="true"]) {
  border-color: var(--bad-line);
  color: var(--red-text);
}
/* điện thoại: các phần của trang Học lý thuyết gom vào một ô chọn xổ xuống — một hàng (chỉ hàng phần học; hàng nút
   khác như Đậu / Rớt khi báo kết quả thi, chương mô phỏng vẫn hiện) */
.chon-phan {
  display: none;
}
@media (max-width: 639px) {
  .chips-phan {
    display: none;
  }
  .chon-phan {
    display: block;
    padding-block: 8px;
  }
  .chon-phan select {
    width: 100%;
    min-height: 40px;
    padding: 0 34px 0 12px;
    border-radius: var(--r-ctl);
    border: 1px solid var(--line-strong);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
    text-overflow: ellipsis;
    appearance: none;
    -webkit-appearance: none;
  }
}

/* Hàng công cụ trên màn học: Học lại (trái) · Câu sai (giữa) · Hiện đáp án (phải) */
.tools {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
}
.tools > :first-child {
  justify-self: start;
}
.tools > :last-child {
  justify-self: end;
}
/* máy hẹp (≤ 380 px): ba nút vẫn vừa một hàng */
@media (max-width: 380px) {
  .tools {
    gap: 6px;
  }
  .tools .btn-sm {
    min-height: 38px;
    padding-inline: 10px;
    font-size: 0.8125rem;
  }
  .tools .switch {
    min-height: 38px;
    gap: 6px;
    padding: 0 9px 0 7px;
    font-size: 0.8125rem;
  }
}
.tools.tools-end {
  display: flex;
  justify-content: flex-end;
}

/* Giải thích đáp án (hiện khi đã thấy đáp án) */
.explain {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  background: var(--surface);
  font-size: 0.9375rem;
  line-height: 1.55;
}
.explain h3 {
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ok);
}
.explain p + p,
.explain ul,
.explain p + ul,
.explain ul + p {
  margin-top: 6px;
}
.explain ul {
  margin-bottom: 0;
  padding-left: 1.2em;
}
.explain .explain-src {
  font-size: 0.8125rem;
  color: var(--ink-2);
}

/* Tiêu đề trang đơn giản (giới thiệu thi) — không mũi tên quay lại, về bằng logo hoặc thao tác lùi */
.page {
  padding-top: 16px;
}
.page-title {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.mp-page {
  padding-top: 12px;
}


/* Thẻ câu hỏi */
/* không có hiệu ứng trồi lên: sang câu khác khung thẻ đứng yên, chỉ chữ / hình / đáp án đổi (không nháy) */
.qcard {
  padding: var(--gutter);
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 640px) {
  .qcard {
    padding: 24px 24px 20px;
  }
}
.q-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}
.q-num {
  color: var(--ink);
  font-weight: 700;
}
.badge-liet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-red);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-liet svg {
  width: 14px;
  height: 14px;
}
.q-text {
  font-size: 1.125rem;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-wrap: wrap;
  text-wrap-style: auto;
}
/* điện thoại: chữ câu hỏi 16 px (bằng cỡ đáp án, đậm hơn) — 18 px thì mỗi dòng thiếu một chữ, trống lớn bên phải */
@media (max-width: 639px) {
  .q-text {
    font-size: 1rem;
    line-height: 1.45;
  }
}
@media (min-width: 640px) {
  .q-text {
    font-size: 1.1875rem;
  }
}
.q-figs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 24px;
  margin: 16px 0 4px;
}
.q-fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.q-fig button {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 10px;
  cursor: zoom-in;
  max-width: 100%;
}
.q-fig img {
  display: block;
  width: var(--fw, 100%);
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
}
.q-fig figcaption {
  font-size: 0.875rem;
  font-weight: 700;
}
/* Hình biển báo vector: các biển xếp một hàng, co giãn theo tỉ lệ cỡ gốc, nhãn thẳng hàng phía dưới */
.sfig-btn {
  display: block;
  width: 100%;
  margin: 16px 0 4px;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  border-radius: 10px;
}
.sfig {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px 20px;
  padding: 10px;
  border-radius: 10px;
  background: var(--fig-bg);
}
.sfig.joined {
  gap: 0;
}
.sf-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
}
.sf-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}
.sf-art img {
  display: block;
  width: 100%;
  height: auto;
}
/* viền mảnh như hình gốc (biển ZONE, biển chữ V) */
.sf-art img.framed {
  outline: 1.5px solid #8c8c8c;
  outline-offset: -1.5px;
}
.sf-art.sf-stack:has(.post) {
  gap: 0;
}
.sf-art .post {
  display: block;
  width: 7%;
  min-width: 4px;
  height: 10px;
  background: #5b5b5b;
}
.sf-item figcaption {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--fig-ink);
  white-space: nowrap;
}
.lb-panel {
  width: min(100%, 1100px);
  max-height: 100%;
  overflow: auto;
  padding: 28px 20px;
  border-radius: 14px;
  background: #fff;
  cursor: default;
}
.lb-panel .sf-item figcaption {
  color: #26262a;
  font-size: 1.125rem;
}
.credits {
  display: grid;
  gap: 12px;
  font-size: 0.9375rem;
}
.credits ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.2em;
}
.credits b {
  color: var(--ink);
}

/* Nhiều hình rời (vd câu 362): cùng chiều cao để nhãn "1", "2" thẳng hàng */
.q-figs.many {
  align-items: flex-end;
}
.q-figs.many img {
  width: auto;
  height: 128px;
}

.opts {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
/* không có dấu ✓ / ✗ bên phải: chữ dàn hết bề ngang; đúng = viền xanh, sai = viền đỏ */
.opt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  text-align: left;
  border-radius: var(--r-ctl);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 500;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
@media (max-width: 639px) {
  .opt {
    min-height: 48px;
    padding: 10px;
  }
  .explain {
    padding: 10px 10px 10px 12px;
  }
}
.opt:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--bg);
}
.opt:disabled {
  opacity: 1;
}
.opt-k {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 0.875rem;
  font-weight: 700;
}
.opt.is-picked {
  border-color: var(--pick);
  background: var(--pick-tint);
}
/* vệt sáng: ý đang trỏ tới bằng mũi tên Lên/Xuống (Enter hoặc Space mới chọn) — viền như con trỏ bàn phím */
.opt.is-hl {
  outline: 2.5px solid var(--red);
  outline-offset: 2px;
}
.opt.is-picked .opt-k {
  background: var(--pick);
  color: var(--bg);
}
.opt.is-right {
  border-color: var(--ok);
  background: var(--ok-tint);
}
.opt.is-right .opt-k {
  background: var(--ok);
  color: var(--on-ok);
}
.opt.is-wrong {
  border-color: var(--bad);
  background: var(--bad-tint);
}
.opt.is-wrong .opt-k {
  background: var(--bad);
  color: var(--on-bad);
}
.opt.is-dim {
  opacity: 0.62;
}

.feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 0;
  margin-top: 12px;
}
.fb {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-ctl);
  font-size: 0.9375rem;
  font-weight: 500;
}
.fb svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
}
.fb.ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.fb.bad {
  background: var(--bad-tint);
  color: var(--bad);
}
.fb b {
  font-weight: 700;
}

/* Hàng nút neo ở đáy màn hình: [Câu trước] [danh sách] [Câu sau] — dùng chung cho học, thi, xem lại, mô phỏng */
.navbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.view.has-nav {
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}
.navbar-in {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.navbar .btn {
  min-height: 48px;
  padding-inline: 12px;
}
@media (min-width: 560px) {
  .navbar .nav-prev {
    justify-self: start;
    padding-inline: 20px;
  }
  .navbar .nav-next {
    justify-self: end;
    padding-inline: 20px;
  }
}
.nav-mid {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
}
.nav-mid svg {
  width: 18px;
  height: 18px;
}

/* Thanh thi */
.exambar {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--header-h));
  z-index: 25;
  background: var(--bg);
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
}
/* [Đã làm x/y] ········ [19:34] ········ [Nộp bài] — đồng hồ nằm ở cột giữa rộng cố định nên không xê dịch */
.exambar-in {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.exambar .btn {
  justify-self: end;
}
.timer {
  width: 5ch;
  font-size: 2.5rem;
  line-height: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.timer.is-low {
  color: var(--red-text);
}
.exambar .count {
  justify-self: start;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.exambar .count b {
  color: var(--ink);
}

/* Lưới số câu */
.grid-nums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
}
.gn {
  position: relative;
  display: grid;
  place-items: center;
  height: 46px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.gn.is-done {
  background: var(--pick-tint);
  border-color: var(--line-strong);
}
.gn.is-none {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.gn.is-ok {
  background: var(--ok-tint);
  border-color: var(--ok-line);
  color: var(--ok);
}
.gn.is-bad {
  background: var(--bad-tint);
  border-color: var(--bad-line);
  color: var(--bad);
}
.gn.is-cur {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red) inset;
}
.gn .gn-l {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

/* Giới thiệu đề thi */
.intro {
  padding: 22px 20px;
  display: grid;
  gap: 16px;
}
@media (min-width: 640px) {
  .intro {
    padding: 28px;
  }
}
.intro h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.kv {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.kv div {
  padding: 12px;
  border-radius: var(--r-ctl);
  background: var(--surface-2);
}
.kv dt {
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.kv dd {
  margin: 2px 0 0;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.kv dd small {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
/* một dòng lưu ý quan trọng trong màn giới thiệu thi (thay cho danh sách luật dài) */
.intro-rule {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.intro-rule svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  color: var(--red-text);
}
.intro-rule b {
  color: var(--ink);
}
.intro-rule .red {
  color: var(--red-text);
}
/* Kết quả: "Làm đề khác" nằm dưới bảng câu trả lời, canh phải */
.res-foot {
  display: flex;
  justify-content: flex-end;
}
.exam-body {
  padding-top: 14px;
}
.fine {
  font-size: 0.8125rem;
  color: var(--ink-2);
}

/* Kết quả */
.verdict {
  display: grid;
  gap: 8px;
  padding: 24px 20px;
  border-radius: var(--r-big);
  text-align: left;
}
.verdict.pass {
  background: var(--ok-tint);
  color: var(--ok);
}
.verdict.fail {
  background: var(--bad-tint);
  color: var(--bad);
}
.verdict .v-word {
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.verdict .v-score {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
}
.verdict .v-why {
  font-size: 0.9375rem;
  color: var(--ink);
}
.res-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.res-actions .btn {
  padding-inline: 14px;
}
.res-actions .btn:first-child {
  grid-column: 1 / -1;
}
@media (min-width: 560px) {
  .res-actions {
    display: flex;
    flex-wrap: wrap;
  }
  .res-actions .btn {
    padding-inline: 24px;
  }
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -1px;
}
.lg-ok {
  background: var(--ok);
}
.lg-bad {
  background: var(--bad);
}
.lg-none {
  background: var(--line-strong);
}
.lg-l {
  border-radius: 50% !important;
  background: var(--red);
}

/* ---------- Lớp phủ: bảng chọn, hộp thoại, xem ảnh ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--scrim);
  animation: fade 0.18s ease-out both;
}
@media (min-width: 640px) {
  .overlay {
    align-items: center;
    padding: 24px;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: min(86vh, 760px);
  max-height: min(86dvh, 760px);
  border-radius: var(--r-big) var(--r-big) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 640px) {
  .sheet {
    border-radius: var(--r-big);
    padding-bottom: 0;
  }
}
@keyframes pop {
  from {
    transform: translateY(16px);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px 20px;
}
.sheet-head h2 {
  font-size: 1.125rem;
  font-weight: 700;
}
.sheet-body {
  padding: 8px 20px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 20px;
}
.dialog .sheet-body {
  font-size: 1rem;
  color: var(--ink-2);
}
/* ô nhập trong hộp thoại (tên học viên) */
.sheet .input,
.cn-form .input {
  width: 100%;
  min-height: 48px;
  margin: 12px 0 8px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
}

/* hộp "Học viên của thầy": họ tên + số điện thoại, lỗi ngay dưới ô, mã học viên (nếu thầy đã cấp) thu gọn */
.fine.loi {
  color: var(--red-text);
  font-weight: 600;
}
.fine.loi:empty {
  display: none;
}
.hv-khai {
  margin-top: 12px;
}
.hv-khai > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}
.hv-khai .input + .input {
  margin-top: 0;
}

/* Thẻ liên hệ của thầy dạy lái (học viên vào qua link của thầy): đầu trang chủ, gọn một hàng */
.thay-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}
.thay-top,
.thay-bot {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.thay-bot .thay-hv {
  flex: 1;
  min-width: 0;
}
.thay-anh {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}
.thay-chu {
  display: grid;
  place-items: center;
  background: var(--red);
  color: var(--on-red);
  font-weight: 800;
  font-size: 1.25rem;
}
.thay-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}
.thay-txt b {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thay-txt span {
  font-size: 0.8125rem;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thay-logo {
  flex: none;
  height: 40px;
  width: auto;
  max-width: 104px;
  object-fit: contain;
  padding: 3px;
  border-radius: 8px;
  background: #fff; /* logo chữ tối vẫn đọc được khi trang ở giao diện tối */
}
.thay-bot .btn-sm {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
}
.thay-hv {
  font-size: 0.8125rem;
  color: var(--ink-2);
}
/* thành tích 30 ngày của thầy (thầy tự bật ở trang quản lý) */
.thay-tt {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink-2);
}
.thay-tt b {
  color: var(--ink);
  font-weight: 800;
}
.sheet .input-ngay {
  width: auto;
  min-height: 40px;
  margin: 0 0 0 4px;
}
.search {
  position: relative;
  margin-bottom: 14px;
}
.search input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px 0 42px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  font-size: 1rem;
}
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
}
.results {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.results button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: var(--r-ctl);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.9375rem;
  line-height: 1.4;
}
.results button:hover {
  border-color: var(--line-strong);
}
.results .rn {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.results mark {
  background: var(--red-tint);
  color: inherit;
  border-radius: 3px;
}
.empty {
  padding: 16px 0;
  color: var(--ink-2);
}
.cls-list {
  display: grid;
  gap: 8px;
}
.cls-list .cls {
  min-height: 64px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 10, 12, 0.88);
  animation: fade 0.18s ease-out both;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  background: #fff;
  image-rendering: auto;
}
.lightbox .icon-btn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: pop 0.2s ease-out both;
}

.view {
  padding-bottom: 8px;
}
.stack {
  display: grid;
  gap: 16px;
}
.muted {
  color: var(--ink-2);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Mô phỏng tình huống ---------- */
:root {
  /* màu 5 vùng điểm: cố định ở cả hai giao diện sáng/tối để nhận ra ngay */
  --z5: #1c9a55;
  --z4: #72b843;
  --z3: #e9b926;
  --z2: #ee8a2b;
  --z1: #e0513f;
}
.act-mp {
  grid-column: 1 / -1;
}
.act-mp .act-ico {
  background: var(--graphite);
  color: var(--on-graphite);
}
.mp-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.mp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) {
  .mp-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 960px) {
  .mp-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}
.mp-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 0 0 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.mp-item:hover {
  border-color: var(--line-strong);
}
.mp-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #111;
}
.mp-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mp-num {
  position: absolute;
  left: 8px;
  top: 8px;
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: center;
}
.mp-best {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 800;
  color: #fff;
  background: var(--z1);
}
.mp-thumb .mp-best {
  position: absolute;
  right: 8px;
  top: 8px;
}
.mp-best.s5 {
  background: var(--z5);
}
.mp-best.s4 {
  background: var(--z4);
}
.mp-best.s3 {
  background: var(--z3);
  color: #2a2100;
}
.mp-best.s2 {
  background: var(--z2);
}
.mp-best.s0 {
  background: #7a7470;
}
.mp-name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0 10px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
}
.mp-fine {
  margin-top: 18px;
}

/* Trình phát */
.mp-card .q-text {
  font-size: 1.0625rem;
  margin-bottom: 12px;
}
.mp-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
.mp-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.mp-over {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.38);
}
.mp-over .btn {
  min-height: 52px;
  padding-inline: 26px;
  font-size: 1.0625rem;
}
.mp-count {
  color: #fff;
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.mp-err {
  padding: 0 16px;
  color: #fff;
  text-align: center;
}
.mp-toast {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-red);
  font-size: 0.875rem;
  font-weight: 700;
  animation: pop 0.18s ease-out both;
}
.mp-toast svg {
  width: 16px;
  height: 16px;
}
.mp-bar {
  padding: 12px 0 2px;
}
.mp-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
}
.mp-prog {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: var(--line-strong);
}
.mp-zones {
  position: absolute;
  inset: 0;
  display: none;
}
.mp-bar.show-zones .mp-zones {
  display: block;
}
.mp-zones .z {
  position: absolute;
  top: 0;
  bottom: 0;
}
.z5 {
  background: var(--z5);
}
.z4 {
  background: var(--z4);
}
.z3 {
  background: var(--z3);
}
.z2 {
  background: var(--z2);
}
.z1 {
  background: var(--z1);
}
.mp-flag {
  position: absolute;
  top: -7px;
  bottom: -7px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--ink);
}
.mp-flag::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 3px;
  border-left: 9px solid var(--ink);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.mp-press {
  margin-top: 12px;
  min-height: 58px;
  font-size: 1.0625rem;
  touch-action: manipulation;
}
.mp-press svg {
  width: 22px;
  height: 22px;
}
.mp-key {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--ink-2);
  text-align: center;
}
kbd {
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  font: 600 0.75rem/1.4 var(--font);
}
@media (hover: none) {
  .mp-key {
    display: none;
  }
}
/* hàng dưới nút bấm: gợi ý phím (máy tính) + công tắc vùng điểm — để thanh tiêu đề trên điện thoại khỏi chật */
.mp-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 8px;
}
.mp-tools .mp-key {
  margin-top: 0;
  text-align: left;
}
.mp-tools .switch {
  margin-left: auto;
}
.mp-result {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.mp-verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r-ctl);
  background: var(--surface-2);
  font-size: 0.9375rem;
}
.mp-points {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--z1);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 800;
}
.mp-verdict.s5 .mp-points {
  background: var(--z5);
}
.mp-verdict.s4 .mp-points {
  background: var(--z4);
}
.mp-verdict.s3 .mp-points {
  background: var(--z3);
  color: #2a2100;
}
.mp-verdict.s2 .mp-points {
  background: var(--z2);
}
.mp-verdict.s0 .mp-points {
  background: #7a7470;
}
.mp-legend i {
  border-radius: 3px;
}
.mp-tip {
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.mp-tip b {
  color: var(--ink);
}
.mp-moment {
  margin: 0;
}
.mp-moment img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #000;
}
.mp-moment figcaption {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.mp-dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.mp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
}
.mp-dot.done {
  background: var(--ink-2);
}
.mp-dot.cur {
  background: var(--red);
}
.mp-rows {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mp-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  font-size: 0.9375rem;
}
.mp-row:hover {
  border-color: var(--line-strong);
}
.mp-row svg {
  width: 18px;
  height: 18px;
  color: var(--ink-2);
}
.mp-row-t {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* số hiệu văn bản không ngắt dòng ở dấu gạch nối */
.nw {
  white-space: nowrap;
}

/* ---------- Kỷ lục ---------- */
/* vừa khít màn hình dưới đầu trang (cao --header-h + 1 px viền): cửa sổ không cuộn, chỉ khung danh sách cuộn */
.view:has(> .kl) {
  padding-bottom: 0;
}
.kl {
  height: calc(100vh - var(--header-h) - 1px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  height: calc(100dvh - var(--header-h) - 1px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  padding-bottom: 8px;
  box-sizing: border-box;
}
.kl > * {
  flex: none;
}
.kl-hd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.kl-hang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.kl-hang select {
  min-height: 40px;
  max-width: 62vw;
  padding: 0 34px 0 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--line-strong);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  appearance: none;
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}
.seg button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: none;
  font: 600 0.9375rem var(--font);
  color: var(--ink-2);
  cursor: pointer;
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.kl-cs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
}
.kl-cs::-webkit-scrollbar {
  display: none;
}
.kl-cs .chip {
  flex: none;
}
/* cao cố định hai dòng (máy tính: một dòng) — chữ dài ngắn hay trống đều không xô khung danh sách */
.kl-ban {
  display: flex;
  align-items: center;
  height: calc(2 * 1.4em + 18px);
  padding: 0 14px;
  border-radius: var(--r-card);
  background: var(--ok-tint);
  border: 1px solid var(--ok-line);
  font-size: 0.9375rem;
  line-height: 1.4;
  overflow: hidden;
}
.kl-ban > span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.kl-ban.trong {
  visibility: hidden;
}
@media (min-width: 640px) {
  .kl-ban {
    height: calc(1.4em + 20px);
  }
  .kl-ban > span {
    -webkit-line-clamp: 1;
  }
}
.kl-ban b {
  font-weight: 800;
}
/* khung cuộn: chiếm phần còn lại tới chân màn hình */
.kl-cuon {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}
.kl-ds {
  list-style: none;
  margin: 0;
  padding: 0;
}
.kl-dong {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
}
.kl-dong:first-child {
  border-top: 0;
}
.kl-dong.ban {
  background: var(--ok-tint);
}
.kl-so {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8125rem;
  font-weight: 800;
}
.kl-so.h1 {
  background: #f2c94c;
  color: #3b2a00;
}
.kl-so.h2 {
  background: #d3d8de;
  color: #26262a;
}
.kl-so.h3 {
  background: #e3a873;
  color: #3a1f08;
}
.kl-ten {
  min-width: 0;
  display: grid;
}
.kl-ten b,
.kl-ten small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kl-ten b {
  font-weight: 600;
}
.kl-ten small {
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.kl-toi {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--ok);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: 1px;
}
.kl-gt {
  text-align: right;
  font-weight: 800;
  white-space: nowrap;
}
.kl-trong {
  padding: 16px;
}
/* cuối danh sách: mũi tên báo lăn tiếp sẽ có thêm hạng */
.kl-cuoi {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.kl-cuoi svg {
  width: 18px;
  height: 18px;
  animation: kl-mui 1.4s ease-in-out infinite;
}
@keyframes kl-mui {
  50% {
    transform: translateY(3px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .kl-cuoi svg {
    animation: none;
  }
}
.kl-giai {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
/* đang tải hạng khác: bảng cũ mờ đi, có số liệu mới thì chỉ thay chữ */
.kl-ban,
.kl-cuon {
  transition: opacity 0.15s ease;
}
.kl.dang-tai .kl-ban,
.kl.dang-tai .kl-cuon {
  opacity: 0.5;
}

/* ---------- Trang chủ: hàng tên học viên · Kết quả học ---------- */
.hv-hang {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
}
.hv-ten {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 700 0.9375rem var(--font);
  cursor: pointer;
}
.hv-ten svg {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 50%;
  background: var(--red-tint);
  color: var(--red-text);
}
.hv-ten span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hv-ten:hover {
  border-color: var(--ink-2);
}
.hv-kq {
  flex: none;
}
/* ô nhập có nhãn (hộp Học viên của thầy, trang riêng) */
.hv-o {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}
.hv-o > span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.sheet .hv-o .input,
.cn-form .hv-o .input {
  margin: 0;
}
select.input {
  appearance: none;
  padding-right: 34px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
}
/* cửa sổ nổi: lướt trong cửa sổ không kéo trang nền */
.overlay {
  overscroll-behavior: contain;
  touch-action: none;
}
.overlay .sheet {
  touch-action: auto;
}

/* ---------- Trang riêng của học viên ---------- */
.cn {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 24px;
}
.cn-dau {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.cn-dau > div {
  min-width: 0;
}
.cn-dau .page-title {
  overflow-wrap: anywhere;
}
.cn-anh {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--red);
  color: var(--on-red);
  font-size: 1.375rem;
  font-weight: 800;
}
.cn-than {
  display: grid;
  gap: 12px;
}
.cn-the {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}
.cn-the-dau {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
}
.cn-the h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 800;
}
.cn-the p {
  margin: 0;
}
.cn-thanh {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.cn-thanh i {
  display: block;
  height: 100%;
  background: var(--ok);
  border-radius: inherit;
}
.cn-luoi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.cn-so {
  display: grid;
  gap: 1px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
}
.cn-so b {
  font-size: 1.25rem;
  font-weight: 800;
}
.cn-so span {
  font-size: 0.875rem;
  color: var(--ink-2);
}
.cn-so small {
  font-size: 0.75rem;
  color: var(--ink-2);
}
.cn-nut {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cn-nut:empty {
  display: none;
}
.cn-gan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.cn-trang {
  font-weight: 600;
  color: var(--ink-2);
}
.cn-trang.ok {
  color: var(--ok);
}
.cn-ma b {
  font-size: 1.375rem;
  letter-spacing: 0.04em;
}
.cn-bao {
  padding: 10px 12px;
  margin-bottom: 10px !important;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 0.9375rem;
}
.cn-cho {
  padding: 10px 12px;
  margin-bottom: 10px !important;
  border-radius: 12px;
  background: var(--pick-tint);
  font-size: 0.9375rem;
}
.hv-o small.fine {
  margin-top: 2px;
}
/* Đã có GPLX hạng: bấm bung ra danh sách để tick, đóng lại hiện các hạng đã tick */
.gplx {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
}
.gplx > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 6px 14px;
  list-style: none;
  cursor: pointer;
}
.gplx > summary::-webkit-details-marker {
  display: none;
}
.gplx > summary svg {
  flex: none;
  width: 18px;
  height: 18px;
  transition: transform 0.15s;
}
.gplx[open] > summary svg {
  transform: rotate(180deg);
}
.gplx-da {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gplx-ds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2px 10px;
  padding: 4px 10px 10px;
  border-top: 1px solid var(--line);
}
.gplx-o {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  min-height: 48px;
  padding: 4px 0;
  cursor: pointer;
}
.gplx-o input {
  grid-row: span 2;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--red);
}
.gplx-o b {
  font-size: 0.9375rem;
  line-height: 1.2;
}
.gplx-o span {
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill.ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.pill.bad {
  background: var(--bad-tint);
  color: var(--bad);
}
.verdict .v-ngay {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.cn-phu {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  font-weight: 700;
}

/* Ngày thi sát hạch: đếm ngược */
.nt-o {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nt-o .input {
  flex: 1 1 180px;
  min-width: 0;
  margin: 0;
}
.nt-dem {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nt-dem > b {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--red-text);
}
.nt-dem.xong > b {
  font-size: 1.375rem;
  letter-spacing: 0;
}
.nt-dem span {
  display: grid;
  font-weight: 700;
}
.nt-dem small {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-2);
}
.nt-dem small::first-letter {
  text-transform: uppercase;
}

/* Chuỗi ngày học + mục tiêu mỗi ngày */
.cn-muc select {
  min-height: 36px;
  padding: 0 32px 0 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--line-strong);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  appearance: none;
}
.ch-dau {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ch-dau p {
  display: grid;
  min-width: 0;
}
.ch-dau small {
  font-size: 0.875rem;
  color: var(--ink-2);
}
.ch-lua {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--ink-2);
}
.ch-lua svg {
  width: 30px;
  height: 30px;
}
.ch-lua b {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}
.ch-lua.co {
  color: var(--red-text);
}
.ch-nay {
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.ch-nay b {
  color: var(--ink);
}
.ch-7 {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
}
.ch-7 li {
  display: grid;
  justify-items: center;
  gap: 4px;
}
.ch-7 span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-2);
}
.ch-7 i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
}
.ch-7 .co i {
  border-color: var(--ok-line);
  background: var(--ok-tint);
}
.ch-7 .dat i {
  border-color: var(--ok);
  background: var(--ok);
  color: var(--on-ok);
}
.ch-7 i svg {
  width: 16px;
  height: 16px;
}
.ch-7 small {
  min-height: 1.2em;
  font-size: 0.75rem;
  color: var(--ink-2);
}

/* Tỉ lệ đúng theo phần */
.ph-ds,
.sai-ds,
.ls-ds,
.tt-ds {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ph-dong,
.sai-dong {
  display: grid;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 8px 6px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.ph-ds li:first-child .ph-dong,
.sai-ds li:first-child .sai-dong {
  border-top: 0;
}
.ph-dong {
  grid-template-columns: minmax(0, 1fr) minmax(64px, 28%) 3.2em;
  column-gap: 12px;
}
.ph-ten {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  min-width: 0;
}
.ph-ten small {
  flex-basis: 100%;
  font-size: 0.75rem;
  color: var(--ink-2);
}
.ph-ten .pill {
  padding: 1px 8px;
  font-size: 0.75rem;
}
.ph-thanh {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.ph-thanh i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ok);
}
.ph-thanh i.yeu {
  background: var(--bad);
}
.ph-tl {
  text-align: right;
}
.ph-tl.yeu {
  color: var(--bad);
}

/* Câu hay sai nhất */
.sai-dong {
  grid-template-columns: 1.6em minmax(0, 1fr) auto;
  column-gap: 10px;
}
.sai-so {
  font-weight: 800;
  color: var(--ink-2);
}
.sai-txt {
  display: grid;
  min-width: 0;
}
.sai-txt b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.sai-txt small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--ink-2);
}
@media (hover: hover) {
  .ph-dong:hover,
  .sai-dong:hover {
    background: var(--surface-2);
  }
}

/* Lịch sử thi thử */
.ls-dong {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.ls-dong:first-child {
  border-top: 0;
}
.ls-trai {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
}
.ls-ngay {
  font-size: 0.875rem;
  color: var(--ink-2);
}
.ls-phu {
  min-width: 0;
  font-size: 0.875rem;
}

/* Thành tích (như Kỷ lục) */
.tt-dong {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.tt-dong:first-child {
  border-top: 0;
}
.tt-trai,
.tt-phai {
  display: grid;
  min-width: 0;
}
.tt-phai {
  flex: none;
  max-width: 50%;
  justify-items: end;
  text-align: right;
}
.tt-ten {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}
.tt-gt {
  font-size: 1.25rem;
  font-weight: 800;
}
.tt-trai small,
.tt-phai small {
  font-size: 0.75rem;
  color: var(--ink-2);
}
.tt-hang b {
  font-size: 1.125rem;
}

/* Đón đi học: thẻ ở trang riêng, hộp chọn điểm đón trên bản đồ (ghim đứng giữa, kéo bản đồ) */
.don-dong {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.don-dong > svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--red-text);
}
.don-dong > span {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.don-sheet .sheet-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.don-sheet .sheet-body > * {
  flex: none;
}
.don-sheet .sheet-foot .don-bo {
  margin-right: auto;
}
.don-tim {
  display: flex;
  gap: 8px;
}
.sheet .don-tim .input {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.don-kq {
  display: grid;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.don-kq button {
  display: grid;
  gap: 1px;
  padding: 10px 12px;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.don-kq[hidden] {
  display: none;
}
.don-kq button:first-child {
  border-top: 0;
}
.don-kq small {
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.don-kq p {
  margin: 0;
  padding: 10px 12px;
}
.bd {
  position: relative;
  height: min(44vh, 340px);
  height: min(44dvh, 340px);
  min-height: 220px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface-2);
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.bd:active {
  cursor: grabbing;
}
.bd:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.bd-lop {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
}
.bd-lop img {
  position: absolute;
  left: 0;
  top: 0;
  width: 256px;
  height: 256px;
  max-width: none;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.bd-lop img.co {
  opacity: 1;
}
.bd-ghim {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -37px 0 0 -20px;
  color: var(--red);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}
.bd-ghim svg {
  display: block;
  width: 100%;
  height: 100%;
}
.bd-nut {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  gap: 8px;
}
.bd-nut button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.bd-nut svg {
  width: 22px;
  height: 22px;
}
.bd-nguon {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 2px 6px;
  border-top-left-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  color: #333;
  font-size: 0.6875rem;
}
.don-trang {
  min-height: 1.3em;
}
.don-2 {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 10px;
}
@media (max-width: 380px) {
  .don-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bd-lop {
    filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9);
  }
}
:root[data-theme="dark"] .bd-lop {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9);
}

/* Đi đón học viên — trang chủ trên máy của thầy đã đăng nhập trang quản lý */
.dd {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}
.dd-dau {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dd-dau h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 800;
}
.dd-dau h2 svg {
  width: 22px;
  height: 22px;
  color: var(--red-text);
}
.dd-chinh {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.dd-chinh label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
}
.dd input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--red);
}
.dd-chinh select.input {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
}
.dd-ve:has(input:disabled) {
  color: var(--ink-2);
}
.dd-vt:empty {
  display: none;
}
.dd-ds {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.dd-dong {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  border-radius: 12px;
}
.dd-dong:first-child {
  border-top: 0;
}
.dd-dong.chon {
  background: var(--red-tint);
}
.dd-o {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 48px;
  min-height: 48px;
  cursor: pointer;
}
.dd-so {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-red);
  font-size: 0.8125rem;
}
.dd-so:empty {
  visibility: hidden;
}
.dd-than {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.dd-than p {
  margin: 0;
  overflow-wrap: anywhere;
}
.dd-ten {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-weight: 700;
}
.dd-ten a {
  color: inherit;
}
.dd-ten .pill {
  padding: 1px 8px;
  font-size: 0.75rem;
}
.pill.moi {
  background: var(--pick-tint);
}
.dd-gc {
  color: var(--ink-2);
  font-style: italic;
}
.dd-nut {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
@media (max-width: 560px) {
  .dd-dong {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .dd-nut {
    grid-column: 2;
    justify-content: flex-start;
  }
}
.dd-thanh {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(640px, calc(100% - 24px));
  padding: 10px 12px 10px 18px;
  border-radius: 18px;
  background: var(--graphite);
  color: var(--on-graphite);
  box-shadow: var(--shadow);
}
.dd-thanh > span {
  flex: 1;
  min-width: 0;
}
.dd-thanh .dd-bo {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: var(--on-graphite);
}
.view:has(.dd-thanh) {
  padding-bottom: 96px;
}

/* Ủng hộ (donate): thẻ mời dưới kết quả thi thử đạt (hiện sau chút ít — đọc xong kết quả đã), hộp chuyển khoản VietQR */
.uh-the {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  animation: uh-hien 0.4s 1.2s both;
}
@keyframes uh-hien {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .uh-the {
    animation: none;
  }
}
.uh-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--red-tint);
  color: var(--red-text);
}
.uh-ico svg {
  width: 22px;
  height: 22px;
}
.uh-the p {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.uh-nut {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.uh-sheet .sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.uh-sheet .sheet-body > * {
  flex: none;
}
.uh-than {
  display: grid;
  gap: 12px;
}
.uh-than p {
  margin: 0;
}
.uh-mung {
  font-weight: 700;
  color: var(--ok);
}
.uh-so {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.uh-qr {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 0;
}
.uh-qr img {
  width: 220px;
  height: 220px;
  max-width: 100%;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
}
.uh-tk {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  margin: 0;
  font-size: 0.9375rem;
}
.uh-tk dt {
  color: var(--ink-2);
}
.uh-tk dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.uh-sheet .sheet-foot .uh-khong {
  margin-right: auto;
}

/* Bổ túc tay lái — trang đăng ký, trạng thái yêu cầu, chọn thầy, buổi học, đánh giá */
.bt .cn-the + .cn-the,
.bt .cn-dau + .cn-the {
  margin-top: 12px;
}
.bt .cn-anh svg {
  width: 22px;
  height: 22px;
}
.bt-form {
  gap: 14px;
}
.bt-muc {
  display: grid;
  gap: 6px;
}
.bt-nhan {
  font-size: 0.875rem;
  font-weight: 700;
}
.bt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bt-lich {
  display: grid;
  grid-template-columns: 2.4rem repeat(4, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}
.bt-lich > span {
  font-size: 0.8125rem;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.2;
}
.bt-lich > span small {
  display: block;
  font-size: 0.6875rem;
}
.bt-lich > b {
  font-size: 0.8125rem;
}
.bt-lich button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
}
.bt-lich button[aria-pressed="true"] {
  border-color: var(--red);
  background: var(--red-tint);
  box-shadow: inset 0 0 0 1px var(--red);
}
.bt-don {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bt-don > svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--red);
}
.bt-don > span {
  flex: 1;
  min-width: 0;
}
.bt-gan {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ok-tint);
  color: var(--ok);
  font-size: 0.875rem;
  font-weight: 600;
}
.bt-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 0 10px;
}
.bt-2 > * {
  min-width: 0;
}
.bt .cn-form .bt-muc .input {
  margin: 0;
}
.bt-o-chon {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9375rem;
  line-height: 1.45;
  cursor: pointer;
}
.bt-o-chon input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--red);
}
.bt-thay {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.bt-thay p {
  margin: 0;
}
.bt-anh {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  font-weight: 800;
  color: var(--ink-2);
}
.bt-ds {
  display: grid;
  gap: 8px;
}
.bt-chon-thay {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.bt-chon-thay.chon {
  border-color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}
.bt-chon-thay > input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 12px 0 0;
  accent-color: var(--red);
}
.bt-buoi {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bt-buoi li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 0.875rem;
}
.bt-sao {
  display: flex;
  gap: 4px;
}
.bt-sao button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--line-strong);
  font-size: 1.375rem;
  cursor: pointer;
}
.bt-sao button[aria-pressed="true"] {
  color: #e8a317;
}
.bt-su-co {
  justify-self: start;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
