/* ==========================================================================
   Bài Học - giao diện phong cách F8 (cam #f05123, bo góc lớn, sidebar icon)
   ========================================================================== */

:root {
  --primary: #d97706;
  --primary-600: #b45309;
  --primary-soft: #fef3c7;
  --on-primary: #fff;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f8;
  --surface-3: #eeeef2;
  --text: #292929;
  --text-soft: #4b5563;
  --muted: #757575;
  --border: #e8e8ec;

  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --info: #2563eb;
  --info-soft: #eaf1ff;
  --warn: #d97706;
  --warn-soft: #fff6e5;
  --danger: #dc2626;
  --danger-soft: #feecec;

  --code-bg: #f7f7fa;
  --code-text: #24292f;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-number: #0550ae;
  --hl-comment: #6e7781;
  --hl-title: #8250df;
  --hl-built: #953800;

  --header-h: 64px;
  --sidebar-w: 0px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.1);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --primary: #f59e0b;
  --primary-600: #d97706;
  --primary-soft: #451a03;
  --bg: #121214;
  --surface: #1a1a1e;
  --surface-2: #232328;
  --surface-3: #2c2c33;
  --text: #ececf1;
  --text-soft: #c4c4cc;
  --muted: #9a9aa5;
  --border: #2d2d34;

  --ok-soft: #12301e;
  --info-soft: #172544;
  --warn-soft: #3a2a0c;
  --danger-soft: #3d1717;

  --code-bg: #16161a;
  --code-text: #e6e6ea;
  --hl-keyword: #ff7b72;
  --hl-string: #a5d6ff;
  --hl-number: #79c0ff;
  --hl-comment: #8b949e;
  --hl-title: #d2a8ff;
  --hl-built: #ffa657;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
img {
  max-width: 100%;
  height: auto;
}
code {
  font-family: var(--mono);
}
h1, h2, h3, h4 {
  line-height: 1.3;
  margin: 0;
}
[hidden] {
  display: none !important;
}

.i {
  width: 20px;
  height: 20px;
  flex: none;
}
.muted {
  color: var(--muted);
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.logo-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0;
  background: linear-gradient(135deg, #fbbf24, var(--primary));
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
  overflow: hidden;
  padding: 0;
}
.logo-mark img,
.logo-mark .logo-mark-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.logo-text strong {
  font-size: 15px;
  font-weight: 700;
}
.logo-text small {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  transition: background 0.15s;
}
.icon-btn:hover {
  background: var(--surface-3);
}
.menu-toggle {
  display: none;
}

#theme-toggle .show-dark {
  display: none;
}
:root[data-theme="dark"] #theme-toggle .show-dark {
  display: inline-flex;
}
:root[data-theme="dark"] #theme-toggle .show-light {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.header-actions form {
  margin: 0;
}

/* ---------- Top Navigation Bar (Khoá học, Luyện đề, Từ vựng, Của tôi, Cộng đồng) ---------- */
.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.top-nav-group {
  position: relative;
}
.top-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.top-nav-link:hover,
.top-nav-group.open > .top-nav-link {
  background: var(--surface-2);
  color: var(--text);
}
.top-nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}
.top-nav-chev {
  width: 15px;
  height: 15px;
  opacity: 0.72;
  transition: transform 0.18s ease;
}
.top-nav-group.open > .top-nav-link .top-nav-chev {
  transform: rotate(180deg);
  opacity: 1;
}
.top-nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  max-height: 75vh;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  z-index: 80;
}
.top-nav-menu-vocab {
  min-width: 300px;
}
.top-nav-group.open > .top-nav-menu {
  display: block;
}
.top-nav-sec {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.top-nav-sec-label {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.top-nav-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--border);
}
.top-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.14s ease, color 0.14s ease;
}
#side-exam-subitems .top-nav-item,
.top-nav-menu-vocab .top-nav-item {
  justify-content: flex-start;
}
.top-nav-menu-vocab .top-nav-item.top-nav-item-all,
.mb-vocab-sheet .top-nav-item.top-nav-item-all {
  justify-content: space-between;
}
.top-nav-item-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.top-nav-item:hover {
  background: var(--surface-2);
  color: var(--primary);
}
.top-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}
.top-nav-item-all {
  font-weight: 700;
  color: var(--primary);
}
.top-nav-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.top-nav-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--primary);
  flex: none;
}
.top-nav-icon .i {
  width: 18px;
  height: 18px;
}
.top-nav-item-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.top-nav-item-body strong {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}
.top-nav-item-body small {
  font-size: 12px;
  color: var(--muted);
  white-space: normal;
  line-height: 1.3;
}
.cat-empty {
  display: block;
  padding: 10px 12px;
  color: var(--muted);
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1080px) {
  .header {
    gap: 8px;
    padding: 0 14px;
  }
  .top-nav {
    gap: 2px;
    margin-left: 4px;
  }
  .top-nav-link {
    padding: 0 9px;
    font-size: 13.5px;
  }
  .logo-text small {
    display: none;
  }
}

@media (max-width: 860px) {
  .top-nav,
  .menu-toggle {
    display: none !important;
  }
  .main {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: stretch;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 85;
  }
  body:has(#view-workspace:not([hidden])) .mobile-bottom-nav,
  body:has(#view-omr:not([hidden])) .mobile-bottom-nav {
    display: none !important;
  }
  .mb-nav-group {
    position: relative;
    display: flex;
  }
  .mb-nav-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 3px 1px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .mb-nav-item:hover,
  .mb-nav-group.open > .mb-nav-item {
    color: var(--text);
  }
  .mb-nav-item.active {
    color: var(--primary);
    font-weight: 700;
  }
  .mb-nav-icon {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
  }
  .mb-nav-icon .i {
    width: 20px;
    height: 20px;
  }
  .mb-vocab-sheet {
    display: none;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 86px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    z-index: 90;
  }
  .mb-nav-group.open > .mb-vocab-sheet {
    display: block;
  }
  .mb-vocab-sheet .top-nav-item {
    justify-content: flex-start;
  }
}

/* Tìm kiếm */
.search {
  position: relative;
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s;
}
.search:focus-within {
  border-color: var(--primary);
  background: var(--surface);
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.search input::-webkit-search-cancel-button {
  display: none;
}
.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.sr-item {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
}
.sr-item:hover,
.sr-item.active {
  background: var(--surface-2);
}
.sr-title {
  font-weight: 600;
  font-size: 15px;
}
.sr-path {
  font-size: 12.5px;
  color: var(--primary);
  font-weight: 500;
}
.sr-snippet {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sr-empty {
  padding: 16px 12px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Layout + sidebar ---------- */
.layout {
  padding-top: var(--header-h);
}
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 40;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar {
  display: none;
}
.side-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.25;
  gap: 4px;
  padding: 12px 4px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}
.side-item:hover {
  background: var(--surface-2);
}
.side-item.active {
  background: var(--surface-3);
  color: var(--text);
}
.side-icon .i {
  width: 24px;
  height: 24px;
}
.side-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-group > .side-item {
  position: relative;
  cursor: pointer;
}
.side-group > .side-item.active {
  background: linear-gradient(135deg, #f05123, #d97706);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.28);
}
.side-item-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.side-chev {
  width: 11px;
  height: 11px;
  opacity: 0.8;
  transition: transform 0.2s ease;
}
.side-group > .side-item.active .side-chev {
  opacity: 1;
}
.side-group.is-open .side-chev {
  transform: rotate(180deg);
}
.side-subitems {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}
.side-subitems[hidden] {
  display: none !important;
}
.side-subitem {
  padding: 9px 4px;
  font-size: 11px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
}
.side-subitem .side-icon .i {
  width: 19px;
  height: 19px;
}
.side-subitem.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.scrim {
  display: none;
}
.main {
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
}
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 32px 48px;
  flex: 1;
}

.footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.footer.uni-site-footer {
  position: relative;
  overflow: hidden;
  background: #121a2d;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: #94a3b8;
  text-align: left;
  padding: 58px 32px 0;
  margin-top: auto;
}
.uni-ft-inner {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.uni-ft-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 44px;
  align-items: start;
}
.uni-ft-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #ffffff;
}
.uni-ft-logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, var(--primary));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 6px 16px -4px rgba(217, 119, 6, 0.35);
  flex-shrink: 0;
}
.uni-ft-logo-badge svg {
  width: 20px;
  height: 20px;
}
.uni-ft-logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ffffff;
}
.uni-ft-desc {
  margin: 16px 0 20px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #94a3b8;
  max-width: 310px;
}
.uni-ft-contacts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.uni-ft-contacts li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: #cbd5e1;
}
.uni-ft-contact-ico {
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  flex-shrink: 0;
}
.uni-ft-contact-ico svg {
  width: 15px;
  height: 15px;
}
.uni-ft-contacts a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.16s ease;
}
.uni-ft-contacts a:hover {
  color: #ffffff;
}
.uni-ft-col-title {
  margin: 4px 0 18px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
}
.uni-ft-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.uni-ft-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.45;
  transition: color 0.16s ease, transform 0.16s ease;
  display: inline-block;
}
.uni-ft-links a:hover {
  color: #f8fafc;
}
.uni-ft-cta-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 16px 18px;
}
.uni-ft-cta-text {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #94a3b8;
}
.uni-ft-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #93c5fd;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.uni-ft-cta-btn:hover {
  background: var(--primary-600);
  border-color: var(--primary);
  color: #ffffff;
}
.uni-ft-bottom {
  margin-top: 44px;
  padding: 22px 0 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #94a3b8;
}
.uni-ft-bottom-links {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.uni-ft-bottom-links a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.16s ease;
}
.uni-ft-bottom-links a:hover {
  color: #ffffff;
}
.uni-ft-watermark-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 8px;
  min-height: 104px;
  user-select: none;
  pointer-events: none;
}
.uni-ft-watermark {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: rgba(255, 255, 255, 0.045);
  transform: translateY(10px);
}
.uni-ft-wm-cap {
  width: clamp(58px, 7.5vw, 102px);
  height: auto;
  flex-shrink: 0;
}
.uni-ft-wm-text {
  font-size: clamp(50px, 7.8vw, 102px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 0.88;
  text-transform: uppercase;
}
.uni-ft-mascot {
  position: absolute;
  right: 0;
  bottom: -4px;
  width: 170px;
  height: 106px;
}
.uni-ft-turtle-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.uni-ft-zzz {
  position: absolute;
  font-weight: 800;
  color: #fbbf24;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.85;
}
.uni-ft-zzz.z1 {
  left: 30px;
  top: 22px;
  font-size: 12px;
  transform: rotate(-12deg);
}
.uni-ft-zzz.z2 {
  left: 38px;
  top: 6px;
  font-size: 14px;
  transform: rotate(-6deg);
}
.uni-ft-zzz.z3 {
  left: 48px;
  top: -8px;
  font-size: 11px;
  opacity: 0.6;
}
@media (max-width: 1080px) {
  .uni-ft-grid {
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 28px;
  }
}
@media (max-width: 720px) {
  .footer.uni-site-footer {
    padding: 40px 18px 0;
  }
  .uni-ft-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px 18px;
  }
  .uni-ft-brand,
  .uni-ft-col-cta {
    grid-column: 1 / -1;
  }
  .uni-ft-desc {
    max-width: none;
  }
  .uni-ft-mascot {
    width: 132px;
    height: 84px;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 22px;
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn:active {
  transform: scale(0.98);
}
.btn-sm {
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn-primary {
  background: linear-gradient(180deg, #f59e0b, var(--primary));
  color: var(--on-primary);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.32);
}
.btn-primary:hover {
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.42);
  transform: translateY(-1px);
}
.btn-light {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-600);
}
.btn-light:hover {
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-outline.is-done {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}
.btn-disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}
.link-btn {
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  padding: 4px 0;
}
.link-btn:hover {
  text-decoration: underline;
}

/* ---------- Trang chủ ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 36px 40px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(120deg, #b45309 0%, #d97706 48%, #fbbf24 100%);
  box-shadow: 0 14px 34px rgba(217, 119, 6, 0.26);
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}
.hero::before {
  width: 280px;
  height: 280px;
  right: -60px;
  top: -120px;
}
.hero::after {
  width: 180px;
  height: 180px;
  right: 180px;
  bottom: -110px;
}
.hero > * {
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.hero p {
  margin: 8px 0 0;
  max-width: 560px;
  opacity: 0.95;
}

/* ---------- Banner Hệ thống Khóa học (/mon-hoc/) ---------- */
.hero.hero-courses-banner {
  padding: 24px 32px;
  border-radius: 18px;
  background: linear-gradient(90deg, #b84c00 0%, #c85300 24%, #d96200 52%, #e77500 78%, #f08c00 100%);
  box-shadow: 0 8px 24px rgba(184, 76, 0, 0.22);
  gap: 28px;
  user-select: none;
}
:root[data-theme="dark"] .hero.hero-courses-banner {
  background: linear-gradient(90deg, #9a3e00 0%, #b84c00 30%, #c85300 65%, #d96200 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.hero-courses-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 64ch;
  position: relative;
  z-index: 2;
}
.hero-courses-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  width: fit-content;
}
.hero-courses-tag .i {
  width: 13px;
  height: 13px;
}
.hero-courses-title {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.26;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}
.hero-courses-title span {
  display: inline-block;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.96);
}
.hero-courses-sub {
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 13.5px;
  line-height: 1.56;
  margin: 0 !important;
  max-width: 62ch !important;
}
.hero-courses-visual {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 8px 10px 4px 6px;
  z-index: 2;
  pointer-events: none;
}
.hc-grad-badge {
  position: absolute;
  top: -6px;
  right: -2px;
  z-index: 6;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);
  color: #b45309;
  border: 2px solid #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hc-grad-badge svg {
  width: 19px;
  height: 19px;
}
.hc-subject-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 2;
  margin-right: -14px;
}
.hc-subject-pill {
  background: #fffafb;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  border-radius: 9px;
  padding: 6px 12px 6px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 118px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
  color: #1e293b;
}
.hc-subject-pill.is-math {
  transform: translateX(-8px) rotate(-3.5deg);
  z-index: 3;
}
.hc-subject-pill.is-phys {
  transform: translateX(-2px) rotate(-1deg);
  z-index: 2;
}
.hc-subject-pill.is-chem {
  transform: translateX(4px) rotate(2deg);
  z-index: 1;
}
.hc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.hc-subj-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.hc-subj-text strong {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
}
.hc-subj-text small {
  font-size: 8.5px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.hc-video-card {
  position: relative;
  z-index: 4;
  width: 168px;
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  border-radius: 11px;
  padding: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  color: #0f172a;
}
.hc-video-screen {
  position: relative;
  height: 70px;
  border-radius: 7px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 58%, #334155 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hc-video-screen::before {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.32) 0%, transparent 70%);
}
.hc-screen-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}
.hc-screen-time {
  position: absolute;
  bottom: 5px;
  right: 6px;
  font-size: 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0;
}
.hc-play-btn {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #ea580c 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.55);
}
.hc-play-btn svg {
  width: 13px;
  height: 13px;
  margin-left: 1.5px;
}
.hc-video-info {
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hc-video-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  line-height: 1.2;
  color: #1e293b;
}
.hc-video-meta-row strong {
  font-weight: 800;
  letter-spacing: -0.01em;
}
.hc-video-progress {
  height: 5px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}
.hc-video-progress-fill {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b 0%, #ea580c 100%);
}
.hc-vocab-card {
  position: relative;
  z-index: 4;
  width: 170px;
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  border-radius: 11px;
  padding: 9px 10px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  color: #0f172a;
}
.hc-vocab-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.hc-vocab-tag {
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 2px 5px;
  border-radius: 4px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}
.hc-vocab-audio {
  font-size: 8px;
  font-weight: 700;
  color: #64748b;
}
.hc-vocab-word {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
}
.hc-vocab-ipa {
  font-size: 8.5px;
  color: #64748b;
  font-family: var(--mono);
  margin-bottom: 5px;
}
.hc-vocab-mean {
  font-size: 9px;
  font-weight: 700;
  color: #9a3412;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 5px;
  padding: 3px 6px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hc-vocab-rates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.hc-rate {
  font-size: 7.5px;
  font-weight: 800;
  text-align: center;
  padding: 2.5px 2px;
  border-radius: 4px;
  white-space: nowrap;
}
.hc-rate.is-again {
  background: #fef2f2;
  color: #dc2626;
}
.hc-rate.is-good {
  background: #eff6ff;
  color: #2563eb;
}
.hc-rate.is-easy {
  background: #f0fdf4;
  color: #16a34a;
}
@media (max-width: 768px) {
  .hero.hero-courses-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 18px;
  }
  .hero-courses-title {
    font-size: 22px;
  }
  .hero-courses-visual {
    align-self: center;
    padding: 6px 4px 2px 10px;
  }
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 16px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.page-head {
  margin-bottom: 8px;
}
.page-head h1 {
  font-size: 28px;
  font-weight: 800;
}
.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
}
.page-head + .grid {
  margin-top: 24px;
}

.continue-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.continue-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.continue-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}
.continue-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.continue-text small {
  color: var(--muted);
  font-weight: 500;
}
.continue-text strong {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Thẻ môn học ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 28px 24px;
}
.course-card {
  display: block;
  transition: transform 0.18s;
}
.course-card:hover {
  transform: translateY(-5px);
}
.card-cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s;
}
.course-card:hover .card-cover {
  box-shadow: var(--shadow-md);
}
.card-cover::before,
.card-cover::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.card-cover::before {
  width: 170px;
  height: 170px;
  right: -40px;
  top: -60px;
}
.card-cover::after {
  width: 90px;
  height: 90px;
  right: 70px;
  top: 50px;
  background: rgba(255, 255, 255, 0.1);
}
.card-cover.has-img::before,
.card-cover.has-img::after {
  display: none;
}
.card-cover-title {
  position: relative;
  z-index: 1;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-cover-sub {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.92;
}
.card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ok);
  background: rgba(255, 255, 255, 0.95);
}
.card-title {
  margin: 14px 4px 6px;
  font-size: 17px;
  font-weight: 700;
}
.course-card:hover .card-title {
  color: var(--primary);
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 4px;
  color: var(--muted);
  font-size: 13.5px;
}
.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.card-meta .i {
  width: 15px;
  height: 15px;
}
.card-progress {
  margin: 12px 4px 0;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.card-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--ok);
  transition: width 0.4s;
}

.empty {
  padding: 48px 24px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty.big {
  border: 0;
}
.empty h1 {
  font-size: 72px;
  color: var(--primary);
}
.empty code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-3);
}

/* ---------- Trang môn học ---------- */
.course-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px;
  align-items: start;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.breadcrumb a:hover {
  color: var(--primary);
}
.course-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.course-desc {
  margin: 12px 0 0;
  font-size: 16.5px;
  color: var(--text-soft);
}
.block {
  margin-top: 36px;
}
.block h2 {
  font-size: 22px;
  font-weight: 700;
}
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.block-sub {
  margin: 6px 0 16px;
  color: var(--text-soft);
  font-size: 14.5px;
}
.learn-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 28px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.learn-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-soft);
}
.learn-list .i {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  color: var(--primary);
}

.chapter {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.chapter > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  background: var(--surface-2);
  font-weight: 700;
}
.chapter > summary::-webkit-details-marker {
  display: none;
}
.chapter-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chapter-count {
  flex: none;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--muted);
}
.chev {
  transition: transform 0.2s;
  color: var(--muted);
}
.chapter[open] > summary .chev {
  transform: rotate(180deg);
}
.lesson-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  transition: background 0.12s;
}
.lesson-row:hover {
  background: var(--surface-2);
}
.lesson-row-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-soft);
  flex: none;
}
.lesson-row-icon .i {
  width: 17px;
  height: 17px;
}
.lesson-row-title {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}
.lesson-row:hover .lesson-row-title {
  color: var(--primary);
}
.lesson-row-time {
  flex: none;
  font-size: 13px;
  color: var(--muted);
}
.lesson-row-type,
.badge {
  flex: none;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-soft);
}
.type-bai-tap {
  background: var(--warn-soft);
  color: var(--warn);
}
.type-loi-giai {
  background: var(--ok-soft);
  color: var(--ok);
}
.type-ly-thuyet {
  background: var(--info-soft);
  color: var(--info);
}
.lesson-row-done {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  color: transparent;
  flex: none;
}
.lesson-row-done .i {
  width: 13px;
  height: 13px;
  stroke-width: 3;
}
.lesson-row.done .lesson-row-done {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.course-aside {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}
.aside-card {
  padding: 16px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.aside-cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  line-height: 1.25;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  background-size: cover;
  background-position: center;
}
.aside-cover::before {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -30px;
  top: -50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.aside-cover.has-img::before {
  display: none;
}
.aside-cover span {
  position: relative;
}
.aside-progress {
  margin-top: 14px;
}
.bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ok);
  transition: width 0.4s;
}
.aside-progress small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  text-align: center;
}
.aside-list {
  list-style: none;
  margin: 18px 0 4px;
  padding: 0;
  display: grid;
  gap: 12px;
  color: var(--text-soft);
  font-size: 14.5px;
}
.aside-list li {
  display: flex;
  align-items: center;
  gap: 12px;
}
.aside-list .i {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

/* ---------- Trang học bài ---------- */
body.learn-body {
  --top-h: 56px;
  --bottom-h: 64px;
  --side-w: 380px;
  background: var(--bg);
}
.learn-top {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--top-h);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: #232830;
  color: #fff;
}
.learn-top .icon-btn {
  color: #fff;
}
.learn-top .icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.logo-sm .logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 14px;
}
.learn-course {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.learn-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  margin-right: 6px;
}
.ring {
  width: 30px;
  height: 30px;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 3.5;
}
.ring-bg {
  stroke: rgba(255, 255, 255, 0.2);
}
.ring-fg {
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-dasharray: 94.25;
  stroke-dashoffset: 94.25;
  transition: stroke-dashoffset 0.5s;
}
.outline-toggle {
  display: none;
}

.learn-wrap {
  padding-top: var(--top-h);
  padding-bottom: var(--bottom-h);
  padding-right: var(--side-w);
  min-height: 100vh;
}
.learn-main {
  padding: 36px 40px 56px;
}
.lesson {
  max-width: 860px;
  margin: 0 auto;
}
.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  color: var(--muted);
  font-size: 14px;
}
.lesson-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.lesson-meta .i {
  width: 15px;
  height: 15px;
}
.lesson-meta .dot {
  opacity: 0.6;
}
.lesson-title {
  margin: 10px 0 24px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.lesson-actions {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.learn-side {
  position: fixed;
  top: var(--top-h);
  right: 0;
  bottom: var(--bottom-h);
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 30;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.side-head h2 {
  font-size: 17px;
  font-weight: 700;
}
.side-close {
  display: none;
  font-size: 26px;
  line-height: 1;
}
.side-body {
  flex: 1;
  overflow: auto;
}
.o-chapter > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 18px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 14.5px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.o-chapter > summary::-webkit-details-marker {
  display: none;
}
.o-chapter .chev {
  width: 16px;
  height: 16px;
}
.o-chapter[open] > summary .chev {
  transform: rotate(180deg);
}
.o-lesson {
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  grid-template-areas: "icon title done" ". time .";
  column-gap: 10px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}
.o-lesson:hover {
  background: var(--surface-2);
}
.o-lesson.current {
  background: var(--primary-soft);
}
.o-lesson.current .o-title {
  color: var(--primary);
  font-weight: 700;
}
.o-icon {
  grid-area: icon;
  color: var(--muted);
  display: grid;
}
.o-icon .i {
  width: 16px;
  height: 16px;
}
.o-title {
  grid-area: title;
  font-weight: 500;
  line-height: 1.4;
}
.o-time {
  grid-area: time;
  font-size: 12.5px;
  color: var(--muted);
}
.o-done {
  grid-area: done;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  color: transparent;
}
.o-done .i {
  width: 12px;
  height: 12px;
  stroke-width: 3;
}
.o-lesson.done .o-done {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.learn-bottom {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--bottom-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  padding-right: calc(var(--side-w) + 24px);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.learn-bottom-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  border-radius: 21px;
  border: 1.5px solid var(--border);
  font-weight: 600;
  font-size: 14.5px;
  background: var(--surface);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.nav-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.nav-next {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.nav-next:hover {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #fff;
}
.nav-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.nav-disabled:hover {
  border-color: var(--border);
  color: inherit;
}

/* ---------- Nội dung bài (markdown) ---------- */
.markdown {
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--text);
  overflow-wrap: anywhere;
}
.markdown > :first-child {
  margin-top: 0;
}
.markdown h2 {
  margin: 2.1em 0 0.6em;
  padding-bottom: 0.3em;
  font-size: 1.55em;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.markdown h3 {
  margin: 1.7em 0 0.5em;
  font-size: 1.25em;
  font-weight: 700;
}
.markdown h4 {
  margin: 1.4em 0 0.4em;
  font-size: 1.05em;
  font-weight: 700;
}
.markdown .header-anchor {
  color: inherit;
}
.markdown h2:hover .header-anchor::after,
.markdown h3:hover .header-anchor::after {
  content: " #";
  color: var(--primary);
  opacity: 0.7;
}
.markdown p {
  margin: 0.9em 0;
}
.markdown ul,
.markdown ol {
  margin: 0.9em 0;
  padding-left: 1.6em;
}
.markdown li {
  margin: 0.3em 0;
}
.markdown li > p {
  margin: 0.3em 0;
}
.markdown a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.markdown strong {
  font-weight: 700;
}
.markdown hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.markdown blockquote {
  margin: 1em 0;
  padding: 0.2em 1.1em;
  border-left: 4px solid var(--border);
  color: var(--text-soft);
  background: var(--surface-2);
  border-radius: 0 10px 10px 0;
}
.markdown img {
  display: block;
  margin: 1.2em auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}
.markdown :not(pre) > code {
  padding: 0.15em 0.4em;
  border-radius: 6px;
  background: var(--surface-3);
  font-size: 0.88em;
}

.table-wrap {
  margin: 1.2em 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.markdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}
.markdown th,
.markdown td {
  padding: 9px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.markdown th {
  background: var(--surface-2);
  font-weight: 700;
}
.markdown tr:last-child td {
  border-bottom: 0;
}
.markdown tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}
.markdown td[align="left"],
.markdown th[align="left"],
.markdown td:first-child.text-left {
  text-align: left;
}

/* Code */
.code-block {
  margin: 1.2em 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 6px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.code-lang {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.copy-btn {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text-soft);
}
.copy-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.markdown pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  color: var(--code-text);
  tab-size: 4;
}
.markdown pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-type {
  color: var(--hl-keyword);
}
.hljs-string,
.hljs-regexp,
.hljs-meta .hljs-string {
  color: var(--hl-string);
}
.hljs-number,
.hljs-attr,
.hljs-variable,
.hljs-symbol {
  color: var(--hl-number);
}
.hljs-comment,
.hljs-quote {
  color: var(--hl-comment);
  font-style: italic;
}
.hljs-title,
.hljs-section,
.hljs-title.function_ {
  color: var(--hl-title);
}
.hljs-built_in,
.hljs-name,
.hljs-tag {
  color: var(--hl-built);
}

/* Callout + lời giải */
.callout {
  margin: 1.2em 0;
  padding: 14px 18px;
  border-left: 4px solid var(--info);
  border-radius: 0 12px 12px 0;
  background: var(--info-soft);
}
.callout > :last-child {
  margin-bottom: 0;
}
.callout-title {
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 0.95em;
  color: var(--info);
}
.callout p {
  margin: 0.4em 0;
}
.callout-tip {
  border-color: var(--ok);
  background: var(--ok-soft);
}
.callout-tip .callout-title {
  color: var(--ok);
}
.callout-warning {
  border-color: var(--warn);
  background: var(--warn-soft);
}
.callout-warning .callout-title {
  color: var(--warn);
}
.callout-danger {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.callout-danger .callout-title {
  color: var(--danger);
}

.solution {
  margin: 1.2em 0;
  border: 1.5px solid var(--ok);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.solution > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--ok);
  background: var(--ok-soft);
}
.solution > summary::-webkit-details-marker {
  display: none;
}
.solution > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
.solution[open] > summary::before {
  transform: rotate(45deg);
}
.solution-body {
  padding: 4px 20px 14px;
}
.solution-body > :first-child {
  margin-top: 0.8em;
}
.solutions-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 16px;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}
.markdown .katex {
  font-size: 1.08em;
}

/* ---------- Đăng nhập & Đăng ký ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--primary-soft), transparent), var(--bg);
}
.login-card {
  width: 100%;
  max-width: 440px;
  padding: 28px 30px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.login-card h1 {
  margin: 18px 0 4px;
  font-size: 22px;
}
.login-card .muted {
  margin: 0 0 20px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface-2);
  margin-bottom: 18px;
}
.auth-tab {
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.auth-tab.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.auth-field {
  margin-bottom: 14px;
}
.login-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-soft);
}
.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 15px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  outline: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-form input[type="text"]:focus,
.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 14.5px;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.btn-google:hover {
  background: var(--surface-2);
  border-color: var(--muted);
}
.auth-foot-note {
  margin: 16px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}
.alert {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
}
.user-header-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 5px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.user-header-chip:hover {
  border-color: var(--primary);
  background: var(--surface-3);
}
.uhc-avatar,
.uhc-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
}
.uhc-avatar {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, #fbbf24, var(--primary));
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
}
.uhc-avatar-img {
  object-fit: cover;
}
.uhc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.user-role-dot {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}
.admin-jump-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #21645a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  transition: filter 0.15s;
}
.admin-jump-btn:hover {
  filter: brightness(1.08);
}
.site-announce {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-announce a,
.site-announce-link {
  color: var(--primary-600);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
  transition: opacity 0.15s ease, color 0.15s ease;
}
:root[data-theme="dark"] .site-announce a,
:root[data-theme="dark"] .site-announce-link {
  color: var(--primary);
}
.site-announce a:hover,
.site-announce-link:hover {
  opacity: 0.82;
}
.card-role-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}
.card-role-badge.is-open {
  background: rgba(22, 163, 74, 0.9);
  color: #fff;
}
.card-role-badge.is-locked {
  background: rgba(17, 24, 39, 0.72);
  color: #f3f4f6;
}
@media (max-width: 640px) {
  .user-header-chip {
    padding: 4px;
  }
  .uhc-name,
  .user-role-dot {
    display: none;
  }
  .admin-jump-btn span {
    display: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .course-page {
    grid-template-columns: minmax(0, 1fr);
  }
  .course-aside {
    position: static;
    order: -1;
  }
  .aside-cover {
    display: none;
  }
}

@media (max-width: 1024px) {
  body.learn-body {
    --side-w: 0px;
  }
  .learn-bottom {
    padding-right: 24px;
  }
  .outline-toggle {
    display: inline-grid;
  }
  .learn-side {
    width: min(92vw, 400px);
    top: 0;
    bottom: 0;
    z-index: 80;
    transform: translateX(100%);
    transition: transform 0.25s;
    box-shadow: var(--shadow-md);
  }
  body.outline-open .learn-side {
    transform: none;
  }
  .side-close {
    display: inline-grid;
  }
  #outline-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  body.outline-open #outline-scrim {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar-w: 0px;
    --header-h: 56px;
  }
  .menu-toggle {
    display: inline-grid;
  }
  .sidebar {
    width: 240px;
    padding: 16px 12px;
    transform: translateX(-100%);
    transition: transform 0.25s;
    box-shadow: var(--shadow-md);
    border-right: 1px solid var(--border);
    z-index: 70;
  }
  .side-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    font-size: 14.5px;
    border-radius: 12px;
  }
  body.sidebar-open .sidebar {
    transform: none;
  }
  .scrim {
    display: block;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    z-index: 65;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  body.sidebar-open #scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .header {
    gap: 8px;
    padding: 0 12px;
  }
  .logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 15px;
  }
  .logo-text small,
  .cat-btn span {
    display: none;
  }
  .cat-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }
  .cat-menu {
    left: -44px;
    min-width: 250px;
    max-width: calc(100vw - 24px);
  }
  .container {
    padding: 16px 14px 36px;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px 20px;
    border-radius: 18px;
    gap: 16px;
  }
  .hero h1 {
    font-size: 22px;
  }
  .hero p {
    font-size: 14.5px;
    margin-top: 6px;
  }
  .course-title {
    font-size: 24px;
  }
  .learn-list {
    grid-template-columns: 1fr;
  }
  .lesson-row-time,
  .lesson-row-type {
    display: none;
  }
  .learn-main {
    padding: 20px 14px 36px;
  }
  .lesson-title {
    font-size: 22px;
  }
  .markdown {
    font-size: 15.5px;
  }
  .learn-bottom {
    padding: 0 12px;
  }
  .learn-bottom-title {
    display: none;
  }
  .nav-btn {
    flex: 1;
    justify-content: center;
  }
  .learn-course {
    font-size: 14px;
  }
  .learn-progress span {
    display: none;
  }
}

@media (max-width: 560px) {
  .logo-text strong {
    font-size: 14px;
  }
  .logo-text small {
    display: none;
  }
  .search {
    height: 38px;
    padding: 0 12px;
  }
  .hero {
    padding: 18px 16px;
    gap: 14px;
  }
  .hero h1 {
    font-size: 20px;
  }
  .hero .btn {
    width: 100%;
    height: 40px;
    font-size: 14px;
  }
  .section-title {
    font-size: 19px;
    margin: 24px 0 12px;
  }
  .grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .card-cover {
    padding: 14px 16px;
    border-radius: 14px;
  }
  .card-cover-title {
    font-size: 18px;
  }
  .card-title {
    font-size: 16px;
    margin-top: 8px;
  }
  .footer:not(.uni-site-footer) {
    padding: 18px 14px;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Thư viện khoá học (môn -> giáo viên -> khoá)
   ========================================================================== */
.lib-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.lib-search {
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lib-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.lib-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.lib-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.lib-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.lib-chip span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.lib-chip:hover {
  border-color: var(--c1, var(--primary));
}
.lib-chip.is-active {
  background: var(--c1, var(--primary));
  border-color: var(--c1, var(--primary));
  color: #fff;
}
.lib-chip.is-active span {
  color: rgba(255, 255, 255, 0.85);
}
.lib-status {
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}

.lib-subject {
  margin-top: 28px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.lib-subject-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.lib-swatch {
  flex: none;
  width: 8px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--c1), var(--c2));
}
.lib-subject-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}
.lib-subject-meta {
  color: var(--muted);
  font-size: 14px;
}
.lib-exam-group {
  margin-top: 22px;
}
.lib-exam-group:first-of-type {
  margin-top: 12px;
}
.lib-exam-group-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 12px;
}
.lib-exam-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c1);
  flex: none;
}
.lib-exam-group-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.lib-exam-group-meta {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.lib-teachers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-items: start;
}
.lib-teacher {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: box-shadow 0.18s, border-color 0.18s;
}
.lib-teacher:hover {
  border-color: var(--c1);
  box-shadow: var(--shadow-sm);
}
.lib-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  font-size: 19px;
  font-weight: 800;
}
.lib-avatar.is-badge {
  font-size: 12.5px;
  letter-spacing: -0.02em;
}
.lib-avatar.is-badge-long {
  font-size: 10.5px;
  letter-spacing: -0.04em;
}
.tp-avatar.is-badge {
  font-size: 19px;
}
.tp-avatar.is-badge-long {
  font-size: 16px;
}
.lib-teacher-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.lib-teacher-info strong {
  font-size: 15.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.lib-teacher-info small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.lib-center {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.lib-none {
  margin-top: 32px;
}

@media (max-width: 640px) {
  .page-head h1 {
    font-size: 22px;
  }
  .page-head p {
    font-size: 13.5px;
  }
  .lib-toolbar {
    margin-top: 14px;
  }
  .lib-search {
    height: 42px;
    padding: 0 14px;
  }
  .lib-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 12px -14px 0;
    padding: 2px 14px 6px;
  }
  .lib-chips::-webkit-scrollbar {
    display: none;
  }
  .lib-chip {
    flex: none;
    white-space: nowrap;
    padding: 6px 13px;
    font-size: 13.5px;
  }
  .lib-subject {
    margin-top: 22px;
  }
  .lib-subject-head {
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 10px;
  }
  .lib-subject-head h2 {
    font-size: 18.5px;
  }
  .lib-subject-meta {
    font-size: 13px;
  }
  .lib-teachers {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.search-spacer {
  flex: 1;
}

/* --- liên kết khoá có bài học trong thư viện --- */

/* ==========================================================================
   Trang học: video lớn + tài liệu của chính bài đó
   ========================================================================== */
.study {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 16px 24px 28px;
}
.study-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 14px;
}
.study-crumb {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.study-crumb a {
  color: var(--muted);
  font-weight: 600;
}
.study-crumb a:hover {
  color: var(--primary);
}
.study-title {
  flex: 1 1 280px;
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.study-bar-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.study-progress {
  margin-right: 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
#study-toggle-doc[aria-pressed="true"] {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.study-bar .btn,
.study-foot .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.study-bar .btn .i,
.study-foot .btn .i {
  width: 18px;
  height: 18px;
}

.study-tabs {
  display: none;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}
.study-tabs button {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.study-tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.study-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: stretch;
}
.study[data-doc="off"] .study-stage {
  grid-template-columns: minmax(0, 1fr);
}
.study[data-doc="off"] .study-doc {
  display: none;
}
.study-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-3);
  border: 1px solid var(--border);
}
.study-video .study-frame {
  aspect-ratio: 16 / 9;
  background: #0b0b0e;
  border: 0;
}
.study-doc {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 360px;
}
.study-doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 14px;
}
.study-ext {
  flex: none;
  color: var(--primary);
  font-weight: 600;
}
.study-doc-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.study-doc-tabs button {
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.study-doc-tabs button[aria-selected="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.study-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
/* bài chỉ có tài liệu: tài liệu chiếm cả khung */
.study[data-mode="doc"] .study-stage {
  grid-template-columns: minmax(0, 1fr);
}
.study[data-mode="doc"] .study-video,
.study[data-mode="doc"] .study-tabs,
.study[data-mode="doc"] #study-toggle-doc {
  display: none;
}
.study[data-mode="doc"] .study-doc {
  display: flex;
}
.study[data-mode="doc"] .study-doc .study-frame {
  height: 78vh;
  min-height: 520px;
}
.kp-tag-video {
  background: var(--primary-soft);
  color: var(--primary);
}
.study-doc .study-frame {
  flex: 1;
  height: clamp(500px, 75vh, 840px);
  min-height: 480px;
  background: var(--surface);
}
.study-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.pdfv {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  color: var(--text);
  user-select: none;
}
.pdfv-toolbar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 6px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  z-index: 3;
}
.pdfv-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pdfv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pdfv-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.pdfv-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pdfv-page-inp {
  width: 44px;
  height: 28px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.pdfv-page-inp::-webkit-outer-spin-button,
.pdfv-page-inp::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pdfv-page-total {
  color: var(--muted);
  font-weight: 600;
  margin: 0 2px;
  white-space: nowrap;
}
.pdfv-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.pdfv-viewport {
  position: relative;
  flex: 1;
  overflow: auto;
  padding: 12px 10px 24px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.pdfv-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: min-content;
}
.pdfv-page {
  position: relative;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  flex: none;
  display: grid;
  place-items: center;
}
.pdfv-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.pdfv-page-placeholder {
  color: #9ca3af;
  font-size: 12.5px;
  font-weight: 600;
}
.pdfv-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  backdrop-filter: blur(4px);
  text-align: center;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
}
.pdfv-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: pdfv-spin 0.75s linear infinite;
}
@keyframes pdfv-spin {
  to {
    transform: rotate(360deg);
  }
}
.study-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
}
.study-video .study-empty {
  color: #a8a8b3;
}
.study-empty strong {
  color: var(--text);
  font-size: 16px;
}
.study-video .study-empty strong {
  color: #fff;
}
.study-empty a {
  color: var(--primary);
  font-weight: 600;
}

.study-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.study-now {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.study-now small {
  color: var(--muted);
  font-size: 12.5px;
}
.study-now strong {
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.study-foot .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
#study-done.is-done {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

.study-drawer {
  position: fixed;
  z-index: 95;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
.study.list-open .study-drawer {
  transform: none;
  visibility: visible;
  transition: transform 0.22s ease;
}
.study-scrim {
  position: fixed;
  z-index: 92;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.study.list-open .study-scrim {
  display: block;
}
.study-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}
.study-drawer-head strong {
  display: block;
  font-size: 15.5px;
  line-height: 1.35;
}
.study-drawer-head small {
  color: var(--muted);
  font-size: 13px;
}
.study-drawer-bar {
  height: 4px;
  margin: 0 18px 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}
.study-drawer-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.25s;
}
.study-list {
  flex: 1;
  margin: 0;
  padding: 0 10px 18px;
  list-style: none;
  overflow-y: auto;
}
.study-group {
  padding: 14px 10px 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.study-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.study-item:hover {
  background: var(--surface-2);
}
.study-item.is-current {
  background: var(--primary-soft);
}
.study-item-no {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 700;
}
.study-item.is-done .study-item-no {
  background: var(--ok);
  color: #fff;
}
.study-item.is-current .study-item-no {
  background: var(--primary);
  color: #fff;
}
.study-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.4;
  font-size: 14.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.study-item-tags {
  display: flex;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.study-item-tags .is-missing {
  opacity: 0.55;
  text-decoration: line-through;
}

@media (max-width: 900px) {
  .study {
    padding: 10px 14px 24px;
  }
  .study-tabs {
    display: flex;
  }
  .study[data-has-doc="false"] .study-tabs {
    display: none;
  }
  .study-stage {
    grid-template-columns: minmax(0, 1fr);
  }
  .study[data-tab="video"] .study-doc,
  .study[data-tab="doc"] .study-video {
    display: none;
  }
  .study[data-doc="off"] .study-doc {
    display: flex;
  }
  .study[data-doc="off"][data-tab="video"] .study-doc {
    display: none;
  }
  .study[data-mode="doc"] .study-doc {
    display: flex !important;
  }
  .study[data-tab="doc"] .study-doc,
  .study[data-mode="doc"] .study-doc {
    min-height: 74vh;
  }
  .study-doc .study-frame {
    height: 74vh;
    min-height: 460px;
  }
  #study-toggle-doc {
    display: none;
  }
}

@media (max-width: 600px) {
  .study {
    padding: 8px 12px 24px;
  }
  .study-bar {
    gap: 6px 10px;
    margin-bottom: 8px;
  }
  .study-crumb {
    font-size: 12px;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .study-title {
    flex: 1 1 100%;
    font-size: 16px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .study-bar-side {
    width: 100%;
    justify-content: space-between;
  }
  .study-progress {
    font-size: 12.5px;
  }
  .study-tabs {
    margin-bottom: 8px;
  }
  .study-tabs button {
    padding: 7px 10px;
    font-size: 13.5px;
  }
  .study-video .study-frame {
    margin: 0 -12px;
    border-radius: 0;
  }
  .study-doc-head {
    gap: 8px;
  }
  .study-doc-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .study-doc-tabs::-webkit-scrollbar {
    display: none;
  }
  .study-ext {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    font-size: 12.5px;
  }
  .study-foot {
    margin-top: 12px;
    padding: 12px;
    gap: 8px;
  }
  .study-now {
    order: -1;
    flex: 1 1 100%;
    padding-bottom: 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border);
  }
  .study-now strong {
    font-size: 15px;
  }
  .study-foot .btn {
    flex: 1 1 0;
    min-width: 0;
    height: 38px;
    padding: 0 8px;
    font-size: 13px;
    gap: 4px;
  }
  .study-foot .btn .i {
    width: 16px;
    height: 16px;
  }
}

/* ==========================================================================
   Trang giới thiệu khoá nhỏ (bố cục kiểu trang khoá học F8)
   ========================================================================== */
.kp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 40px;
  align-items: start;
}
.kp-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13.5px;
  color: var(--muted);
}
.kp-crumb a {
  color: var(--primary);
  font-weight: 600;
}
.kp-crumb a:hover {
  text-decoration: underline;
}
.kp-title {
  margin: 0 0 12px;
  font-size: 32px;
  line-height: 1.25;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.kp-desc {
  margin: 0 0 14px;
  color: var(--text-soft);
  line-height: 1.7;
}
.kp-by {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-soft);
  font-size: 14.5px;
  font-weight: 600;
}
.kp-by .i {
  width: 18px;
  height: 18px;
  color: var(--primary);
}
.kp-section {
  margin-top: 32px;
}
.kp-section h2 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 800;
}

.kp-learn,
.kp-req {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}
.kp-req {
  grid-template-columns: minmax(0, 1fr);
}
.kp-learn li,
.kp-req li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
  font-size: 15px;
}
.kp-learn .i,
.kp-req .i {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--primary);
}

.kp-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 14px;
  font-size: 14.5px;
  color: var(--text-soft);
}
.kp-summary i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}
.kp-expand {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.kp-expand:hover {
  text-decoration: underline;
}

.kp-chapter {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.kp-chapter > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}
.kp-chapter > summary::-webkit-details-marker {
  display: none;
}
.kp-plus {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
}
.kp-plus::before,
.kp-plus::after {
  content: "";
  position: absolute;
  background: var(--primary);
  border-radius: 2px;
}
.kp-plus::before {
  left: 0;
  right: 0;
  top: 6px;
  height: 2px;
}
.kp-plus::after {
  top: 0;
  bottom: 0;
  left: 6px;
  width: 2px;
  transition: transform 0.18s, opacity 0.18s;
}
.kp-chapter[open] .kp-plus::after {
  transform: scaleY(0);
  opacity: 0;
}
.kp-chapter-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.kp-chapter-count {
  flex: none;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--muted);
}
.kp-lessons {
  list-style: none;
  margin: 0;
  padding: 0;
}
.kp-lesson {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
  transition: background 0.12s;
}
.kp-lesson:hover {
  background: var(--surface-2);
}
.kp-lesson-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--primary);
}
.kp-lesson-icon .i {
  width: 16px;
  height: 16px;
}
.kp-lesson.is-done .kp-lesson-icon {
  color: var(--ok);
}
.kp-lesson-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kp-lesson-title {
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.kp-lesson-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kp-lesson-tags:empty {
  display: none;
}
.kp-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}
.kp-tag .i {
  width: 13px;
  height: 13px;
}
.kp-lesson-time {
  flex: none;
  min-width: 44px;
  text-align: right;
  font-size: 13.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.kp-side {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}
.kp-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.kp-cover {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 16 / 9;
  padding: 14px 16px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  text-align: left;
}
.kp-cover-title {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}
.kp-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--c1);
  transition: transform 0.18s;
}
.kp-cover:hover .kp-play {
  transform: scale(1.1);
}
.kp-status {
  margin: 16px 0 10px;
  color: var(--primary);
  font-weight: 700;
}
.kp-cta {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.kp-bar {
  height: 6px;
  margin-top: 12px;
  border-radius: 6px;
  background: var(--surface-3);
  overflow: hidden;
}
.kp-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.25s;
}
.kp-facts {
  list-style: none;
  margin: 18px 0 4px;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  color: var(--text-soft);
  font-size: 14.5px;
}
.kp-facts li {
  display: flex;
  align-items: center;
  gap: 12px;
}
.kp-facts .i {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

@media (max-width: 960px) {
  .kp-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .kp-side {
    position: static;
    order: -1;
  }
  .kp-learn {
    grid-template-columns: minmax(0, 1fr);
  }
  .kp-title {
    font-size: 26px;
  }
}

/* thẻ giáo viên là liên kết sang trang riêng */
a.lib-teacher {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: inherit;
}
a.lib-teacher .i {
  flex: none;
  color: var(--muted);
  transition: transform 0.15s, color 0.15s;
}
a.lib-teacher:hover .i {
  color: var(--primary);
  transform: translateX(3px);
}

/* trang một giáo viên */
.tp-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}
.tp-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 800;
}
.tp-head p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  color: var(--muted);
}
.tp-avatar {
  width: 72px;
  height: 72px;
  font-size: 30px;
}
.course-card.is-soon {
  opacity: 0.6;
  cursor: default;
}
.course-card.is-soon:hover {
  transform: none;
}

@media (max-width: 600px) {
  a.lib-teacher {
    padding: 12px 14px;
    gap: 12px;
  }
  .tp-head {
    gap: 12px;
    margin-bottom: 20px;
  }
  .tp-avatar {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
  .tp-head h1 {
    font-size: 21px;
  }
  .tp-head p {
    font-size: 13.5px;
    gap: 6px;
  }
  .kp-crumb {
    font-size: 12.5px;
    margin-bottom: 10px;
  }
  .kp-title {
    font-size: 21px;
    margin-bottom: 8px;
  }
  .kp-section {
    margin-top: 22px;
  }
  .kp-section h2 {
    font-size: 18.5px;
    margin-bottom: 10px;
  }
  .kp-summary {
    font-size: 13.5px;
    gap: 6px 10px;
  }
  .kp-chapter > summary {
    padding: 12px 14px;
    font-size: 14.5px;
    gap: 10px;
  }
  .kp-lesson {
    padding: 10px 12px;
    gap: 10px;
    font-size: 13.5px;
  }
  .kp-card {
    padding: 14px;
    border-radius: 16px;
  }
  .kp-facts {
    margin: 14px 0 2px;
    gap: 10px;
    font-size: 13.5px;
  }
}

/* ==========================================================================
   KHÓA HỌC CỦA TÔI — KỆ TRƯỢT NGANG (HORIZONTAL CAROUSEL SHELF)
   ========================================================================== */
#my-courses-shelf {
  margin-bottom: 36px;
}

.mc-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.mc-sec-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mc-sec-title {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mc-sec-title svg {
  width: 20px;
  height: 20px;
  color: var(--primary, #f05123);
  flex-shrink: 0;
}

.mc-count-pill {
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(240, 81, 35, 0.12);
  color: var(--primary, #f05123);
}

.mc-head-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mc-sub-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mc-sub-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.mc-sub-pill:hover {
  border-color: var(--primary, #f05123);
  color: var(--text);
}

.mc-sub-pill:focus-visible {
  outline: 2px solid var(--primary, #f05123);
  outline-offset: 2px;
}

.mc-sub-pill.is-active {
  background: var(--primary, #f05123);
  border-color: var(--primary, #f05123);
  color: #fff;
}

.mc-vc-wrap {
  position: relative;
}

.mc-vc-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mc-vc-arrow {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.mc-vc-arrow svg {
  width: 16px;
  height: 16px;
}

.mc-vc-arrow:hover:not(:disabled) {
  background: var(--primary, #f05123);
  border-color: var(--primary, #f05123);
  color: #fff;
}

.mc-vc-arrow:focus-visible {
  outline: 2px solid var(--primary, #f05123);
  outline-offset: 2px;
}

.mc-vc-arrow:disabled {
  opacity: 0.38;
  cursor: default;
}

.mc-vc-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(276px, 304px);
  gap: 16px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.mc-vc-track::-webkit-scrollbar {
  height: 6px;
}

.mc-vc-track::-webkit-scrollbar-track {
  background: transparent;
}

.mc-vc-track::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.mc-vc-card {
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.18s ease;
  color: inherit;
}

.mc-vc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(240, 81, 35, 0.38);
}

.mc-vc-banner {
  padding: 15px 16px 14px;
  color: #fff;
  position: relative;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  background-color: var(--c1, var(--primary));
  background-size: cover;
  background-position: center;
}

.mc-vc-banner-top,
.mc-vc-banner-title {
  position: relative;
  z-index: 1;
}

.mc-vc-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mc-vc-banner-subj {
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.mc-vc-banner-exp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
}

.mc-vc-banner-exp.is-trial {
  background: rgba(245, 158, 11, 0.92);
  color: #111827;
}

.mc-vc-banner-exp svg {
  width: 12px;
  height: 12px;
}

.mc-vc-banner-title {
  margin: 10px 0 0;
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.32;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mc-vc-body {
  padding: 13px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  justify-content: space-between;
}

.mc-vc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mc-vc-teacher {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mc-vc-teacher svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-soft);
}

.mc-vc-meta strong {
  color: var(--text);
  font-weight: 700;
  flex-shrink: 0;
}

.mc-vc-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3, rgba(148, 163, 184, 0.2));
  overflow: hidden;
}

.mc-vc-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary, #f05123);
  transition: width 0.25s ease;
}

.mc-vc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.mc-vc-study-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: var(--primary, #f05123);
  text-decoration: none;
}

.mc-vc-study-link:hover {
  text-decoration: underline;
}

.mc-vc-study-link svg {
  width: 14px;
  height: 14px;
}

.mc-vc-syllabus-link {
  color: var(--text-soft);
  font-weight: 600;
  text-decoration: none;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.mc-vc-syllabus-link:hover {
  color: var(--text);
  border-color: var(--text-soft);
}

@media (max-width: 640px) {
  .mc-vc-track {
    grid-auto-columns: minmax(252px, 82vw);
    gap: 12px;
  }
}

/* =====================================================================
   CHẾ ĐỘ XEM TRƯỚC MỤC LỤC KHÓA HỌC (CHƯA KÍCH HOẠT) — /khoa/:courseId/
   ===================================================================== */
.kp-lesson.is-locked {
  cursor: pointer;
}
.kp-lesson.is-locked .kp-lesson-icon {
  color: var(--muted, #94a3b8);
}
.kp-lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  color: var(--text-soft, #64748b);
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
}
.kp-lesson.is-locked:hover .kp-lock-pill {
  border-color: var(--primary, #f05123);
  color: var(--primary, #f05123);
  background: var(--primary-soft, #fff1ed);
}
.kp-lock-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.kp-lock-modal-backdrop[hidden] {
  display: none !important;
}
.kp-lock-modal {
  width: 100%;
  max-width: 480px;
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  padding: 24px 24px 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
  text-align: center;
}
.kp-lock-modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-soft, #fff1ed);
  color: var(--primary, #f05123);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
}
.kp-lock-modal h3 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 800;
}
.kp-lock-modal p {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--text-soft, #64748b);
  line-height: 1.5;
}
.kp-lock-modal-box {
  text-align: left;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 14px;
}
.kp-lock-modal-note {
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--primary-soft, #fff1ed);
  color: var(--text, #0f172a);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* =====================================================================
   TRANG HỒ SƠ CÁ NHÂN BÊN PHẢI (RIGHT-SIDE PROFILE DRAWER)
   ===================================================================== */
.uprof-scrim {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}
.uprof-scrim[hidden] {
  display: none !important;
}
.uprof-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  width: min(430px, 94vw);
  background: var(--surface);
  color: var(--text);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.24s;
}
.uprof-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.uprof-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.uprof-user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.uprof-avatar-lg {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fbbf24, var(--primary));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  object-fit: cover;
}
.uprof-user-info {
  min-width: 0;
}
.uprof-disp-name {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uprof-handle {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uprof-role-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}
.uprof-close {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}
.uprof-quick-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.uprof-copy-btn,
.uprof-admin-link {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.uprof-copy-btn:hover,
.uprof-admin-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.uprof-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 10px 20px 0;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.uprof-tab {
  padding: 9px 10px;
  border: 0;
  border-bottom: 2.5px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.uprof-tab:hover {
  color: var(--text);
}
.uprof-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.uprof-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 28px;
}
.uprof-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.uprof-stat-card {
  padding: 12px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: center;
}
.uprof-stat-card strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.uprof-stat-card span {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.uprof-sec {
  margin-bottom: 20px;
}
.uprof-sec-title {
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 10px;
}
.uprof-scopes-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.uprof-scope-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--ok-soft);
  color: var(--ok);
}
.uprof-empty-note,
.uprof-empty-box {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  line-height: 1.5;
}
.uprof-course-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.uprof-course-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.uprof-course-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
}
.uprof-course-subj {
  color: var(--primary);
}
.uprof-course-exp {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-soft);
}
.uprof-course-exp.is-trial {
  background: var(--warn-soft);
  color: var(--warn);
}
.uprof-course-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 6px;
  color: var(--text);
}
.uprof-course-title:hover {
  color: var(--primary);
}
.uprof-course-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.uprof-course-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: 10px;
}
.uprof-course-bar > span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}
.uprof-course-actions {
  display: flex;
  gap: 8px;
}
.uprof-course-btn {
  flex: 1;
  text-align: center;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.uprof-course-btn.is-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.uprof-field {
  margin-bottom: 12px;
}
.uprof-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 5px;
}
.uprof-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.uprof-field input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}
.uprof-field input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.uprof-hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.uprof-msg {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.uprof-msg.is-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.uprof-msg.is-err {
  background: var(--danger-soft);
  color: var(--danger);
}
.uprof-meta-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.uprof-logout-btn {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}
.uprof-logout-btn:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

/* ==========================================================================
   Học thử 1 Video đầu tiên & Trang Khóa học của tôi (/khoa-hoc-cua-toi/)
   ========================================================================== */
.kp-free-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--ok-soft, rgba(22, 163, 74, 0.14));
  color: var(--ok, #16a34a);
  border: 1px solid color-mix(in srgb, var(--ok, #16a34a) 32%, transparent);
}
.kp-lesson.is-free-preview {
  background: color-mix(in srgb, var(--ok, #16a34a) 6%, var(--surface));
}
.study-item.is-locked {
  opacity: 0.72;
}
.study-item.is-locked .study-num {
  background: var(--surface-3);
  color: var(--muted);
}
.my-courses-page {
  margin-top: 12px;
}
.mc-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.mc-page-grid .mc-vc-card {
  width: 100%;
  min-width: 0;
  max-width: none;
  flex: initial;
}
.mc-page-search {
  height: 36px;
  min-width: 240px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mc-page-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
@media (max-width: 640px) {
  .mc-page-search {
    width: 100%;
    min-width: 0;
  }
}

/* ---------- Lịch sử học theo môn gần nhất & Ghim khóa học (/khoa-hoc-cua-toi/) ---------- */
.mc-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.mc-section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.mc-section-sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}

.mc-sh-section {
  margin-bottom: 36px;
}
.mc-sh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.mc-sh-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.18s ease;
}
.mc-sh-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.mc-sh-banner {
  position: relative;
  min-height: 126px;
  padding: 16px 18px 15px;
  color: #fff;
  background-color: var(--c1, var(--primary));
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.mc-sh-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.12) 0%, rgba(15, 23, 42, 0.42) 100%);
  pointer-events: none;
}
.mc-sh-banner > * {
  position: relative;
  z-index: 1;
}
.mc-sh-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mc-sh-subj-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.mc-sh-banner-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mc-sh-time-tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, 0.95);
  font-size: 11.5px;
  font-weight: 600;
}
.mc-sh-course-link {
  text-decoration: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mc-sh-course-name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.32;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mc-sh-teacher-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.mc-sh-teacher-name svg {
  width: 13px;
  height: 13px;
}
.mc-sh-body {
  padding: 14px 16px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  justify-content: space-between;
}
.mc-sh-video-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.mc-sh-video-box:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}
.mc-sh-play-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}
.mc-sh-video-box:hover .mc-sh-play-icon {
  transform: scale(1.06);
}
.mc-sh-play-icon svg {
  width: 14px;
  height: 14px;
  margin-left: 1px;
}
.mc-sh-video-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mc-sh-video-group {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-sh-video-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.38;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mc-sh-video-cta {
  flex: none;
  padding: 6px 11px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.mc-sh-video-box:hover .mc-sh-video-cta {
  background: var(--primary);
  color: #fff;
}
.mc-sh-more {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.mc-sh-more-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
.mc-sh-more-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mc-sh-more-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 12.5px;
  text-decoration: none;
  color: var(--text-soft);
  background: var(--surface-2);
  transition: color 0.14s ease, background-color 0.14s ease;
}
.mc-sh-more-item:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
.mc-more-hide-btn {
  flex: none;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}
.mc-more-hide-btn:hover {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.06);
}
.mc-sh-more-course {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.mc-sh-more-lesson {
  flex: none;
  max-width: 48%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
}
.mc-sh-empty,
.mc-pin-empty {
  padding: 22px 20px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px dashed var(--border);
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
}
.mc-sh-empty p,
.mc-pin-empty p {
  margin: 0;
}
.mc-sh-empty a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}

/* ---------- Nút Ẩn lịch sử & Nút Ghim giáo viên ---------- */
.mc-vc-banner-link {
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  z-index: 1;
}
.mc-hide-hist-btn,
.mc-pin-toggle-btn,
.card-pin-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
  color: #fff;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.mc-hide-hist-btn:hover,
.mc-pin-toggle-btn:hover,
.card-pin-btn:hover {
  background: rgba(15, 23, 42, 0.72);
  transform: translateY(-1px);
}
.mc-hide-hist-btn:hover {
  border-color: rgba(252, 165, 165, 0.7);
}
.mc-pin-toggle-btn.is-pinned,
.card-pin-btn.is-pinned {
  background: #f59e0b;
  border-color: #fbbf24;
  color: #111827;
}
.card-pin-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}
.kp-pin-course-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.kp-pin-course-btn.is-pinned,
.study-pin-btn.is-pinned,
.tp-pin-teacher-btn.is-pinned {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.study-pin-btn,
.tp-pin-teacher-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tp-pin-teacher-btn {
  margin-top: 10px;
}
.mc-tc-courses {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.mc-tc-course-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 12.5px;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.mc-tc-course-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.mc-tc-course-name {
  min-width: 0;
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-tc-course-cnt {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}

.mc-pinned-section {
  margin-bottom: 32px;
}
.mc-pin-picker {
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.mc-pin-picker-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.mc-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.mc-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.14s ease;
}
.mc-picker-item.is-pinned {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}
.mc-picker-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mc-picker-subj {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}
.mc-picker-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-picker-name:hover {
  color: var(--primary);
}
.mc-picker-meta {
  font-size: 12px;
  color: var(--muted);
}
.mc-picker-pin-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}
.mc-picker-pin-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.mc-picker-pin-btn.is-pinned {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.mc-picker-none {
  grid-column: 1 / -1;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.mc-vc-last-video {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-vc-last-video:hover {
  color: var(--primary);
}
.mc-vc-last-video strong {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 640px) {
  .mc-sh-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .mc-sh-video-box {
    flex-wrap: wrap;
    padding: 11px 12px;
  }
  .mc-sh-video-cta {
    width: 100%;
    text-align: center;
  }
  .mc-picker-list {
    grid-template-columns: 1fr;
  }
}

/* ---------- Phân tách Giai đoạn / Combo trong trang Giáo viên & Khóa học ---------- */
.tp-stage-section {
  margin-bottom: 24px;
  padding: 20px 22px 24px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.tp-stage-section.is-upcoming-only {
  padding: 15px 22px;
  background: var(--surface-2);
  opacity: 0.92;
}
.tp-stage-section.is-upcoming-only .tp-stage-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.tp-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}
.tp-stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.tp-stage-dot {
  width: 10px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--c1, var(--primary)), var(--c2, #60a5fa));
  flex: none;
}
.tp-stage-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
}
.tp-stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.tp-stage-badge.is-active {
  background: color-mix(in srgb, var(--c1, var(--primary)) 12%, var(--surface-2));
  color: var(--c1, var(--primary));
  border: 1px solid color-mix(in srgb, var(--c1, var(--primary)) 26%, transparent);
}
.tp-stage-badge.is-soon {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.kp-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
}
.kp-subtopic-head {
  padding: 9px 18px 6px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}
.study-subgroup {
  padding: 7px 14px 5px 22px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  background: var(--surface-2);
  border-top: 1px dashed var(--border);
}
.tp-grid {
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
}
@media (max-width: 640px) {
  .tp-stage-section {
    padding: 16px 14px 18px;
    margin-bottom: 22px;
  }
  .tp-stage-title {
    font-size: 16px;
  }
  .tp-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Trang chủ mới (Dashboard: Học tiếp, Đếm ngược, Chuỗi học tập, Thông báo, Top 10)
   ========================================================================== */
body:has(#hv2-dashboard) {
  background: var(--bg);
}
.hv2-wrap {
  max-width: 1080px;
  padding-top: 32px;
  padding-bottom: 48px;
}
.hv2-header {
  margin-bottom: 24px;
}
.hv2-title {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hv2-sub {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* Hàng 1: Hero Học tiếp + Đếm ngược kỳ thi */
.hv2-row-top {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(300px, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.hv2-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 32px;
  border-radius: 18px;
  background: #b54c05;
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(181, 76, 5, 0.22);
}
.hv2-hero-meta {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 6px;
}
.hv2-hero-course {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
}
.hv2-hero-lesson {
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 18px;
}
.hv2-hero-bar {
  width: 100%;
  max-width: 440px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  overflow: hidden;
  margin-bottom: 8px;
}
.hv2-hero-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #ffffff;
  transition: width 0.3s ease;
}
.hv2-hero-progress {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.84);
  margin-bottom: 20px;
}
.hv2-hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hv2-hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 26px;
  border-radius: 10px;
  background: #ffffff;
  color: #7c2d12;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.hv2-hero-btn.hv2-hero-btn-pill {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13px;
}
.hv2-hero-btn .i {
  width: 16px;
  height: 16px;
  color: #b54c05;
}
.hv2-hero-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}
.hv2-hero-ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.hv2-hero-ghost-btn .i {
  width: 16px;
  height: 16px;
}
.hv2-hero-ghost-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
}
.hv2-hero-eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.88);
}
.hv2-hero-desc {
  margin: 6px 0 18px;
  max-width: 580px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
}
.hv2-hero-desc strong {
  color: #ffffff;
  font-weight: 700;
}
.hv2-hero-foot-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.86);
}
.hv2-hero-foot-stats strong {
  color: #ffffff;
  font-weight: 800;
}

/* Thẻ trắng dùng chung */
.hv2-card {
  display: flex;
  flex-direction: column;
  padding: 22px 24px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.03);
}
.hv2-card-title {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
}

/* Đếm ngược kỳ thi */
.hv2-cd-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: auto 0;
}
.hv2-cd-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.hv2-cd-num {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 102px;
}
.hv2-cd-num strong {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: #b54c05;
  letter-spacing: -0.02em;
}
:root[data-theme="dark"] .hv2-cd-num strong {
  color: var(--primary);
}
.hv2-cd-num span {
  font-size: 12.5px;
  color: var(--muted);
}
.hv2-cd-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hv2-cd-info strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.hv2-cd-info span {
  font-size: 12.5px;
  color: var(--muted);
}

/* Hàng 2: 3 cột (Chuỗi học tập, Thông báo, Top 10) */
.hv2-row-mid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* Chuỗi học tập */
.hv2-streak-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.hv2-streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #c2410c;
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.28);
}
:root[data-theme="dark"] .hv2-streak-pill {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(251, 146, 60, 0.32);
}
.hv2-streak-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}
.hv2-streak-stat strong {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.hv2-streak-stat span {
  font-size: 13.5px;
  color: var(--text-soft);
}
.hv2-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
}
.hv2-week-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.hv2-week-bar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: transparent;
  transition: all 0.2s ease;
}
.hv2-week-col.is-active .hv2-week-bar {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 1.5px solid #fb923c;
  color: #ea580c;
  box-shadow: 0 3px 10px rgba(249, 115, 22, 0.22);
}
:root[data-theme="dark"] .hv2-week-col.is-active .hv2-week-bar {
  background: rgba(249, 115, 22, 0.2);
  border-color: #fb923c;
}
.hv2-week-day {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
.hv2-week-col.is-active .hv2-week-day {
  color: #ea580c;
}
:root[data-theme="dark"] .hv2-week-col.is-active .hv2-week-day {
  color: #fdba74;
}
.hv2-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #b54c05;
}
:root[data-theme="dark"] .hv2-link {
  color: var(--primary);
}
.hv2-link:hover {
  text-decoration: underline;
}
.hv2-discord-cta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.1), rgba(88, 101, 242, 0.04));
  border: 1px solid rgba(88, 101, 242, 0.25);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.hv2-discord-cta:hover {
  transform: translateY(-1px);
  border-color: #5865f2;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.16), rgba(88, 101, 242, 0.08));
  box-shadow: 0 6px 16px rgba(88, 101, 242, 0.18);
  text-decoration: none;
}
.hv2-discord-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: #5865f2;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(88, 101, 242, 0.35);
}
.hv2-discord-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.hv2-discord-body strong {
  font-size: 13.5px;
  font-weight: 800;
  color: #4752c4;
  line-height: 1.2;
}
:root[data-theme="dark"] .hv2-discord-body strong {
  color: #8ea1e1;
}
.hv2-discord-body small {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hv2-discord-arr {
  font-size: 15px;
  font-weight: 800;
  color: #5865f2;
  flex-shrink: 0;
}

/* Thông báo */
.hv2-ann-list {
  display: flex;
  flex-direction: column;
}
.hv2-ann-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.45;
}
.hv2-ann-item:first-child {
  padding-top: 0;
}
.hv2-ann-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.hv2-ann-date {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.hv2-ann-text {
  color: var(--text);
  font-weight: 500;
}

/* Top 10 tuần này */
.hv2-rank-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}
.hv2-rank-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  border-radius: 9px;
}
.hv2-rank-row:last-child {
  border-bottom: 0;
}
.hv2-rank-no {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
}
.hv2-rank-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hv2-rank-val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

/* Top 1 - Vàng Pastel nhẹ nhàng */
.hv2-rank-row.is-top-1 {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.065) 0%, rgba(245, 158, 11, 0.01) 100%);
}
.hv2-rank-row.is-top-1 .hv2-rank-no {
  background: transparent;
  color: #b45309;
  border: none;
  box-shadow: none;
}
.hv2-rank-row.is-top-1 .hv2-rank-name {
  font-weight: 600;
  color: #92400e;
}
.hv2-rank-row.is-top-1 .hv2-rank-val {
  font-weight: 600;
  color: #b45309;
}

/* Top 2 - Xanh Pastel dịu mắt */
.hv2-rank-row.is-top-2 {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.06) 0%, rgba(14, 165, 233, 0.01) 100%);
}
.hv2-rank-row.is-top-2 .hv2-rank-no {
  background: transparent;
  color: #0369a1;
  border: none;
  box-shadow: none;
}
.hv2-rank-row.is-top-2 .hv2-rank-name {
  font-weight: 600;
  color: #075985;
}
.hv2-rank-row.is-top-2 .hv2-rank-val {
  font-weight: 600;
  color: #0369a1;
}

/* Top 3 - Xanh Ngọc Mint nhẹ nhàng */
.hv2-rank-row.is-top-3 {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.01) 100%);
}
.hv2-rank-row.is-top-3 .hv2-rank-no {
  background: transparent;
  color: #047857;
  border: none;
  box-shadow: none;
}
.hv2-rank-row.is-top-3 .hv2-rank-name {
  font-weight: 600;
  color: #065f46;
}
.hv2-rank-row.is-top-3 .hv2-rank-val {
  font-weight: 600;
  color: #047857;
}

:root[data-theme="dark"] .hv2-rank-row.is-top-1 .hv2-rank-no {
  background: transparent;
  color: #fcd34d;
}
:root[data-theme="dark"] .hv2-rank-row.is-top-2 .hv2-rank-no {
  background: transparent;
  color: #7dd3fc;
}
:root[data-theme="dark"] .hv2-rank-row.is-top-3 .hv2-rank-no {
  background: transparent;
  color: #6ee7b7;
}
:root[data-theme="dark"] .hv2-rank-row.is-top-1 .hv2-rank-name,
:root[data-theme="dark"] .hv2-rank-row.is-top-1 .hv2-rank-val {
  color: #fcd34d;
}
:root[data-theme="dark"] .hv2-rank-row.is-top-2 .hv2-rank-name,
:root[data-theme="dark"] .hv2-rank-row.is-top-2 .hv2-rank-val {
  color: #7dd3fc;
}
:root[data-theme="dark"] .hv2-rank-row.is-top-3 .hv2-rank-name,
:root[data-theme="dark"] .hv2-rank-row.is-top-3 .hv2-rank-val {
  color: #6ee7b7;
}

.hv2-rank-row.is-me .hv2-rank-name,
.hv2-rank-row.is-me .hv2-rank-val {
  font-weight: 700;
  color: #b54c05;
}
:root[data-theme="dark"] .hv2-rank-row.is-me .hv2-rank-name,
:root[data-theme="dark"] .hv2-rank-row.is-me .hv2-rank-val {
  color: var(--primary);
}

/* Hàng 3: 4 thẻ lối tắt ngang */
.hv2-row-bot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.hv2-pill-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.03);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.hv2-pill-link:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.hv2-pill-arr {
  font-size: 14px;
  color: #b54c05;
}
:root[data-theme="dark"] .hv2-pill-arr {
  color: var(--primary);
}

@media (max-width: 920px) {
  .hv2-row-top {
    grid-template-columns: 1fr;
  }
  .hv2-row-mid {
    grid-template-columns: 1fr;
  }
  .hv2-row-bot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .hv2-wrap {
    padding: 4px 0 24px;
    gap: 14px;
  }
  .hv2-hero {
    padding: 18px 16px;
  }
  .hv2-hero-course {
    font-size: 20px;
  }
  .hv2-card {
    padding: 18px 16px;
  }
  .hv2-countdown-num {
    font-size: 38px;
  }
  .hv2-row-bot {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.hv2-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 24, 40, 0.45);
  backdrop-filter: blur(4px);
}
.hv2-modal-backdrop[hidden] {
  display: none !important;
}
.hv2-modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hv2-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.hv2-modal-head h3 {
  margin: 0 0 3px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}
.hv2-modal-head p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}
.hv2-modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.hv2-modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}
.hv2-modal-list {
  padding: 12px 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hv2-modal-list .hv2-rank-row {
  padding: 9px 10px;
  font-size: 14px;
}

/* ==========================================================================
   GLOBAL SHOP COSMETICS (PARTICLES & SHOP AVATARS ACROSS ALL PAGES)
   ========================================================================== */
.uni-global-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}
.uni-global-particle {
  position: absolute;
  top: -36px;
  user-select: none;
  pointer-events: none;
  opacity: 0.82;
  animation-name: uniParticleFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes uniParticleFall {
  0% {
    transform: translateY(-20px) translateX(0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 0.85;
  }
  50% {
    transform: translateY(50vh) translateX(24px) rotate(180deg);
  }
  88% {
    opacity: 0.85;
  }
  100% {
    transform: translateY(105vh) translateX(-18px) rotate(360deg);
    opacity: 0;
  }
}
.uhc-avatar.is-shop-avatar,
.uprof-avatar-lg.is-shop-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}


/* ==========================================================================
   Trang học (màn rộng): thẻ tiêu đề, cột "Nội dung khoá học" cố định bên trái,
   khung video bo góc bên phải — bố cục theo mẫu khoá học dạng thẻ
   ========================================================================== */
.study-lesson-head,
.study-drawer-label {
  display: none;
}
@media (min-width: 1101px) {
  .study {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto 1fr;
    column-gap: 28px;
    margin-top: 16px;
    margin-bottom: 28px;
    padding: 0 28px 28px;
    width: calc(100% - 48px);
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: clip;
  }
  .study-bar {
    grid-column: 1 / -1;
    margin: 0 -28px 24px;
    padding: 22px 32px 18px;
    border-bottom: 1px solid var(--border);
  }
  .study-title {
    font-size: 26px;
    text-transform: uppercase;
    letter-spacing: 0.01em;
  }
  #study-open-list,
  .study-scrim,
  #study-close-list {
    display: none !important;
  }
  .study-tabs {
    display: none;
  }
  .study-stage {
    grid-column: 2;
    grid-row: 2;
  }
  .study-foot {
    grid-column: 2;
    grid-row: 3;
  }

  /* drawer -> cột cố định */
  .study-drawer {
    grid-column: 1;
    grid-row: 2 / span 4;
    position: sticky;
    top: calc(var(--header-h) + 12px);
    right: auto;
    bottom: auto;
    z-index: 1;
    width: auto;
    max-height: calc(100vh - var(--header-h) - 28px);
    align-self: start;
    transform: none;
    visibility: visible;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding-bottom: 0;
  }
  .study-drawer-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-soft);
  }
  .study-drawer-label .i {
    width: 20px;
    height: 20px;
    color: var(--primary);
  }
  .study-drawer-head {
    padding: 12px 6px 8px;
  }
  .study-drawer-head strong {
    font-size: 13.5px;
    color: var(--text-soft);
  }
  .study-drawer-bar {
    margin: 0 6px 6px;
  }
  .study-list {
    padding: 0 0 12px;
  }
  .study-group {
    margin: 10px 0 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--text);
    font-size: 13px;
    letter-spacing: 0.02em;
  }
  .study-subgroup {
    margin: 6px 0 2px 8px;
    padding: 9px 12px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-2);
  }
  .study-item {
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
  }
  .study-item.is-current {
    border-color: var(--primary);
  }

  /* khung video: viền đen bo góc + tiêu đề bài phía trên */
  .study-lesson-head {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 0 0 14px;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 700;
    overflow-wrap: anywhere;
  }
  .study-video .study-frame {
    border: 10px solid #0b0b0e;
    border-radius: 30px;
    /* video luôn lọt trong màn hình, căn giữa cột phải */
    width: min(100%, calc((100vh - var(--header-h) - 190px) * 16 / 9));
    min-width: 480px;
    max-width: 100%;
    margin-inline: auto;
  }
  .study-lesson-head {
    width: min(100%, calc((100vh - var(--header-h) - 190px) * 16 / 9));
    min-width: 480px;
    max-width: 100%;
    margin-inline: auto;
    margin-bottom: 14px;
  }
  /* tên bài đã nằm phía trên video nên thanh dưới chỉ giữ dòng chương + số bài */
  .study-now strong {
    display: none;
  }

  /* danh sách trái: chừa chỗ cho thanh cuộn, các mục thẳng hàng với dải chương */
  .study-list {
    padding: 0 8px 12px 0;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
  }
  .study-list > li {
    min-width: 0;
  }
  .study-item {
    box-sizing: border-box;
    max-width: 100%;
  }
  .study-item-text {
    min-width: 0;
    font-size: 14px;
  }
  .study-group,
  .study-subgroup {
    box-sizing: border-box;
  }
}

/* ---- thu gọn chương trong danh sách bài ---- */
.study-group {
  position: relative;
  cursor: pointer;
  user-select: none;
  padding-right: 38px !important;
}
.study-group::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.18s;
  opacity: 0.7;
}
.study-group.is-folded::after {
  transform: translateY(-50%) rotate(-45deg);
}
.study-group:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.study-list > li.is-grp-folded {
  display: none;
}
.study-side-hide {
  display: none;
}

/* ---- thu cột "Nội dung khoá học" sang trái (màn rộng) ---- */
@media (min-width: 1101px) {
  .study-drawer-label {
    justify-content: flex-start;
  }
  .study-side-hide {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
  }
  .study-side-hide:hover {
    background: var(--primary-soft);
    color: var(--primary);
  }
  .study-side-hide .i {
    width: 16px;
    height: 16px;
    color: inherit;
  }
  .study:not(.side-collapsed) #study-open-list {
    display: none !important;
  }
  .study.side-collapsed #study-open-list {
    display: inline-flex !important;
  }
  .study {
    transition: grid-template-columns 0.22s ease;
  }
  .study.side-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
    column-gap: 0;
  }
  .study.side-collapsed .study-drawer {
    visibility: hidden;
    overflow: hidden;
    pointer-events: none;
  }
}

/* thanh trên cùng: chỉ hiện logo, to hơn */
.header .logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}
.header .logo-text {
  display: none;
}

/* ==========================================================================
   Tối ưu điện thoại
   ========================================================================== */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a,
button,
[role="button"],
summary,
label,
select {
  touch-action: manipulation;
}
@media (max-width: 860px) {
  /* thanh dưới: số mục không cố định (6 hoặc 7) nên chia đều theo số mục thật */
  .mobile-bottom-nav {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }
  .mb-nav-item {
    min-height: 50px;
    font-size: 11px;
  }
}
@media (max-width: 560px) {
  /* trang chủ: chừa lề hai bên, không để chữ/thẻ sát mép màn hình */
  .hv2-wrap {
    padding: 14px 14px 24px;
  }
}
@media (max-width: 600px) {
  /* vùng bấm đủ lớn (>= 36-44px) */
  .kp-crumb,
  .study-crumb {
    align-items: center;
  }
  .hv2-link,
  .kp-expand,
  .kp-crumb a,
  .study-crumb a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
  }
  .admin-jump-btn {
    min-width: 40px;
    min-height: 40px;
    justify-content: center;
  }
  .study-bar .btn {
    min-height: 40px;
  }
  .study-tabs button {
    min-height: 42px;
  }
  .study-item {
    padding: 13px 10px;
  }

  /* trang học: cụm Bài trước / Đã học / Bài tiếp luôn nằm sát thanh dưới, một tay bấm được */
  .study-foot {
    position: sticky;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    margin-top: 12px;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.1);
  }
  .study-foot .btn {
    min-height: 44px;
  }
  .study-now strong {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }
}

/* điện thoại: thẻ danh mục (Luyện đề / Luyện từ) thấp hơn để thấy nhiều mục cùng lúc */
@media (max-width: 700px) {
  .lt-cat-subject-card .card-cover,
  .exam-subjects-cards-grid .card-cover {
    aspect-ratio: auto;
    min-height: 110px;
    padding: 14px 16px;
  }
}

/* ==========================================================================
   Playful Pastel Homepage Template + 3D Mascot Tô (tophoc-to.glb)
   ========================================================================== */
.th-home {
  --th-cream: #faf7f2;
  --th-cream-card: #ffffff;
  --th-ink: #171412;
  --th-ink-soft: #4a433e;
  /* Một màu nhấn duy nhất: cam thương hiệu (--primary) */
  --th-accent: var(--primary-600);
  --th-accent-hover: #92400e;
  --th-on-accent: var(--on-primary);
  --th-accent-soft: #fef3c7;
  --th-border: rgba(23, 20, 18, 0.09);
  position: relative;
  background-color: var(--th-cream);
  color: var(--th-ink);
  overflow-x: clip;
}

[data-theme='dark'] .th-home {
  --th-cream: #13161c;
  --th-cream-card: #1c2029;
  --th-ink: #f8fafc;
  --th-ink-soft: #cbd5e1;
  --th-accent: #f59e0b;
  --th-accent-hover: #fbbf24;
  --th-on-accent: #171412;
  --th-border: rgba(248, 250, 252, 0.12);
  background-color: var(--th-cream);
}

.th-container {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Synchronized Screen Focus & Depth Transition */
.th-screen {
  position: relative;
}
.th-screen-inner {
  transform: scale(0.968) translateY(14px);
  opacity: 0.82;
  transition:
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}
.th-screen.is-screen-active .th-screen-inner {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Ẩn vệt sóng cắt khúc (.th-seam) để nền chuyển màu liền mạch 100% khi cuộn */
.th-seam {
  display: none !important;
}

.th-seam-pill {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(23, 20, 18, 0.1);
  color: #171412;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-decoration: none;
  box-shadow: 0 8px 20px -10px rgba(23, 20, 18, 0.18);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease;
}
.th-seam-pill:hover {
  transform: translateY(-2px) scale(1.03);
  background: #ffffff;
}

/* Floating Right-Side 6-Step Screen Progress Navigator (.th-dot-nav) */
.th-dot-nav {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 48;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(23, 20, 18, 0.08);
  box-shadow: 0 10px 26px -12px rgba(23, 20, 18, 0.18);
}
[data-theme='dark'] .th-dot-nav {
  background: rgba(28, 32, 41, 0.72);
  border-color: rgba(248, 250, 252, 0.12);
}
.th-dot-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 2px;
}
.th-dot-label {
  position: absolute;
  right: calc(100% + 10px);
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  background: #171412;
  color: #ffef62;
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  transform: translateX(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.th-dot-item:hover .th-dot-label,
.th-dot-item.is-active:hover .th-dot-label {
  opacity: 1;
  transform: translateX(0);
}
.th-dot-circle {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(23, 20, 18, 0.24);
  transition:
    height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.28s ease,
    transform 0.2s ease;
}
[data-theme='dark'] .th-dot-circle {
  background: rgba(248, 250, 252, 0.28);
}
.th-dot-item.is-active .th-dot-circle {
  height: 24px;
  background: #171412;
}
[data-theme='dark'] .th-dot-item.is-active .th-dot-circle {
  background: #ffef62;
}

@media (max-width: 960px) {
  .th-dot-nav {
    display: none;
  }
}

/* Scroll-reveal transition (compositor-friendly opacity + transform) */
.th-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0ms),
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0ms);
}
.th-reveal.is-inview {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   TẦNG 1 (FULL SCREEN 1): HERO — WARM CREAM + 3 STACKED YELLOW PILLS + 3D TÔ
   -------------------------------------------------------------------------- */
.th-hero {
  position: relative;
  min-height: calc(100dvh - var(--header-h, 64px));
  display: flex;
  align-items: center;
  padding: 40px 0;
  background: transparent;
}

/* 3 Chuông gió Furin Nhật Bản Pastel (Logo Shop, Discord & Zalo) đung đưa từ mép dưới thanh menu */
.th-wood-signs-rail {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1180px;
  padding: 0 23% 0 5%;
  z-index: 25;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.th-wood-sign-rig {
  pointer-events: auto;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  width: 68px;
  height: 70px;
  margin-top: 0;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transform-origin: 50% 0px;
  translate: 0px 0px;
  rotate: 0deg;
  scale: 1;
  filter: drop-shadow(0 8px 14px rgba(23, 20, 18, 0.1));
  transition:
    scale 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    translate 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.25s ease;
}
.th-wood-sign-rig.is-left {
  animation: thWoodSwingLeft 4.4s ease-in-out infinite;
}
.th-wood-sign-rig.is-mid {
  animation: thWoodSwingRight 5.1s ease-in-out infinite;
}
.th-wood-sign-rig.is-right {
  animation: thWoodSwingLeft 4.7s ease-in-out infinite reverse;
}
@keyframes thWoodSwingLeft {
  0%, 100% { rotate: -2.4deg; }
  50% { rotate: 2.4deg; }
}
@keyframes thWoodSwingRight {
  0%, 100% { rotate: 2.2deg; }
  50% { rotate: -2.6deg; }
}
.th-chime-svg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.th-chime-ring-wave {
  position: absolute;
  top: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #171412;
  opacity: 0;
  pointer-events: none;
  scale: 0.7;
  translate: 0px 0px;
  rotate: 0deg;
}
.th-wood-sign-rig:hover {
  scale: 1.1;
  translate: 0px 2px;
  filter: drop-shadow(0 12px 20px rgba(23, 20, 18, 0.18));
}
.th-wood-sign-rig:active {
  scale: 0.96;
  translate: 0px 4px;
}
.th-wood-sign-rig:hover .th-chime-ring-wave {
  animation: thChimeRingRipple 1s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
@keyframes thChimeRingRipple {
  0% { scale: 0.85; opacity: 0.55; }
  100% { scale: 1.55; opacity: 0; }
}
.th-chime-tooltip {
  position: absolute;
  top: 34px;
  left: calc(100% + 6px);
  white-space: nowrap;
  background: #171412;
  color: #ffef62;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
  opacity: 0;
  translate: -6px 0px;
  rotate: 0deg;
  scale: 0.94;
  pointer-events: none;
  transition: opacity 0.2s ease, translate 0.2s ease, scale 0.2s ease;
}
.th-wood-sign-rig:hover .th-chime-tooltip {
  opacity: 1;
  translate: 0px 0px;
  scale: 1;
}
.th-hero-grid {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 48px;
  align-items: center;
}
.th-eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--th-accent-soft);
  color: #171412;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.th-hero-title {
  margin: 0 0 20px;
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--th-ink);
  text-wrap: balance;
}
.th-hero-desc {
  margin: 0 0 32px;
  max-width: 520px;
  font-size: 16.5px;
  line-height: 1.68;
  color: var(--th-ink-soft);
  text-wrap: pretty;
}
.th-hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.th-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
  border: 2px solid transparent;
  transition:
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s ease,
    background 0.2s ease;
}
.th-btn:hover {
  transform: translateY(-2px);
}
.th-btn:active {
  transform: scale(0.97);
}
.th-btn-accent {
  background: var(--th-accent);
  color: var(--th-on-accent);
  box-shadow: 0 10px 24px -12px rgba(180, 83, 9, 0.5);
}
.th-btn-accent:hover {
  background: var(--th-accent-hover);
  color: var(--th-on-accent);
}
.th-btn-outline {
  background: transparent;
  border-color: var(--th-border);
  color: var(--th-ink);
  letter-spacing: 0.02em;
}
.th-btn-outline:hover {
  border-color: var(--th-ink);
}
.th-btn-wide {
  padding: 15px 36px;
  font-size: 14px;
  letter-spacing: 0.03em;
}

/* Right Hero Stage: 3 Stacked Yellow Pill Bars + 3D Tô */
.th-hero-stage-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
}
.th-yellow-stack {
  position: absolute;
  inset: 24px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
  z-index: 0;
}
.th-yellow-pill {
  display: block;
  width: 100%;
  height: 112px;
  border-radius: 999px;
  background: var(--th-accent-soft);
  box-shadow: 0 14px 30px -18px rgba(180, 83, 9, 0.22);
  animation: thPillFloat 5.2s ease-in-out infinite;
}
[data-theme='dark'] .th-yellow-pill {
  background: var(--th-cream-card);
}
.th-yp-1 {
  width: 92%;
  margin-left: auto;
  animation-delay: 0s;
}
.th-yp-2 {
  width: 100%;
  animation-delay: 0.7s;
}
.th-yp-3 {
  width: 95%;
  margin-right: auto;
  animation-delay: 1.4s;
}
@keyframes thPillFloat {
  0%, 100% { transform: translateX(0) scale(1); }
  50% { transform: translateX(-5px) scale(1.012); }
}

.th-mascot-3d-box {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 450px;
  height: 410px;
  display: block;
  cursor: grab;
}
.th-mascot-3d-box.th-hero-tree {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: default;
}
.th-hero-tree-svg {
  width: 100%;
  height: auto;
  max-height: 340px;
  overflow: visible;
}
.th-tree-halo { fill: #fef3c7; }
.th-tree-sun { fill: #fcd34d; }
.th-tree-ground { fill: #efe3cc; }
.th-tree-trunk { fill: #6b3f1f; }
.th-tree-leaf { fill: #65a30d; }
.th-tree-leaf-deep { fill: #4d7c0f; }
.th-tree-bloom-shade { fill: #c2410c; }
.th-tree-bloom { fill: #ea580c; }
.th-tree-bloom-light { fill: #fb923c; }
.th-tree-petal { fill: #ea580c; }
[data-theme='dark'] .th-tree-halo { fill: rgba(252, 211, 77, 0.12); }
[data-theme='dark'] .th-tree-sun { fill: #d4a017; }
[data-theme='dark'] .th-tree-ground { fill: #2a2620; }
[data-theme='dark'] .th-tree-trunk { fill: #a0673a; }

/* Tán đung đưa nhẹ và vài cánh phượng rơi khi vừa tải trang; chạy vài lượt rồi dừng */
.th-tree-canopy {
  transform-box: view-box;
  transform-origin: 222px 176px;
  animation: thTreeSway 5s ease-in-out 3;
}
.th-tree-petal {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: thPetalFall 5.5s cubic-bezier(0.16, 1, 0.3, 1) 2;
}
.th-tree-petal-2 { animation-delay: 1.6s; }
.th-tree-petal-3 { animation-delay: 3.1s; }
@keyframes thTreeSway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(1.2deg); }
}
@keyframes thPetalFall {
  0% { opacity: 0; transform: translate(0, -40px) rotate(0deg); }
  15% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-36px, 88px) rotate(220deg); }
}
@media (prefers-reduced-motion: reduce) {
  .th-tree-canopy,
  .th-tree-petal {
    animation: none;
  }
}
.th-mascot-3d-box:active {
  cursor: grabbing;
}
.th-mascot-3d-box canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  filter: drop-shadow(0 20px 26px rgba(23, 20, 18, 0.2));
}
.th-mascot-loading {
  position: absolute;
  inset: 0;
  margin: auto;
  width: fit-content;
  height: fit-content;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #171412;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.15);
}

.th-mascot-controls {
  position: relative;
  z-index: 3;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.th-mc-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.th-mc-chip,
.th-mc-subchip {
  cursor: pointer;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid rgba(23, 20, 18, 0.14);
  background: #ffffff;
  color: #171412;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}
.th-mc-subchip {
  padding: 5px 11px;
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.88);
}
.th-mc-chip:hover,
.th-mc-subchip:hover {
  transform: translateY(-1px);
  border-color: #171412;
}
.th-mc-chip.is-active {
  background: #171412;
  color: #ffffff;
  border-color: #171412;
}
.th-mc-subchip.is-active {
  background: var(--th-accent-soft);
  color: #171412;
  border-color: #171412;
}

/* --------------------------------------------------------------------------
   TẦNG 2 (FULL SCREEN 2): PASTEL LAVENDER BAND — "BẠN SẼ ĐƯỢC GÌ?" + 4 CARDS
   -------------------------------------------------------------------------- */
.th-benefits-band {
  min-height: calc(100dvh - var(--header-h, 64px));
  display: flex;
  align-items: center;
  padding: 64px 0;
  background: transparent;
}
.th-sec-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 48px;
}
.th-sec-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--th-ink-soft);
  margin-bottom: 12px;
}
.th-sec-title {
  margin: 0 0 14px;
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--th-ink);
  text-wrap: balance;
}
.th-sec-sub {
  margin: 0;
  font-size: 16px;
  line-height: 1.62;
  color: var(--th-ink-soft);
  text-wrap: pretty;
}

.th-benefits-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.th-benefit-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 310px;
  padding: 36px 24px 32px;
  border-radius: 28px;
  background: var(--th-cream-card);
  border: 1.5px solid rgba(23, 20, 18, 0.08);
  color: var(--th-ink);
  text-decoration: none;
  box-shadow: 0 16px 34px -18px rgba(23, 20, 18, 0.12);
  transition:
    transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}
[data-theme='dark'] .th-benefit-card {
  border-color: var(--th-border);
}
.th-benefit-card:hover {
  transform: translateY(-7px);
  border-color: var(--th-ink);
  box-shadow: 0 24px 40px -18px rgba(23, 20, 18, 0.24);
}
.th-bc-illus {
  width: 124px;
  height: 124px;
  margin-bottom: 20px;
  color: #171412;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme='dark'] .th-bc-illus {
  color: #e2e8f0;
}
.th-benefit-card:hover .th-bc-illus {
  transform: scale(1.07) rotate(-2deg);
}
.th-bc-illus svg {
  width: 100%;
  height: 100%;
}
.th-bc-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--th-ink);
  text-wrap: balance;
}
.th-bc-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--th-ink-soft);
}

/* Kết nối & hỗ trợ: tiêu đề bên trái, danh sách kênh bên phải (Discord, Zalo, Shop cấu hình ở admin) */
.th-connect {
  padding: 72px 0;
}
.th-connect-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 48px;
  align-items: center;
}
.th-connect-title {
  margin: 0 0 12px;
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--th-ink);
  text-wrap: balance;
}
.th-connect-sub {
  margin: 0;
  max-width: 36ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--th-ink-soft);
}
.th-connect-panel {
  padding: 8px;
  border-radius: 20px;
  background: var(--th-cream-card);
  border: 1px solid var(--th-border);
}
.th-connect-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.th-connect-list[hidden] {
  display: none;
}
.th-connect-list + .th-connect-list li:first-child,
.th-connect-list li + li {
  border-top: 1px solid var(--th-border);
}
.th-connect-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 14px;
  border-radius: 14px;
  color: var(--th-ink);
  text-decoration: none;
  transition: background-color 0.18s ease;
}
.th-connect-item:hover {
  background: var(--th-accent-soft);
}
.th-connect-item:focus-visible {
  outline: 2px solid var(--th-ink);
  outline-offset: -2px;
}
.th-connect-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--th-accent-soft);
  color: var(--th-ink);
}
.th-connect-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.th-connect-text strong {
  font-size: 15.5px;
  font-weight: 700;
}
.th-connect-text small {
  font-size: 13.5px;
  color: var(--th-ink-soft);
}
.th-connect-go {
  color: var(--th-ink-soft);
  transition: transform 0.18s ease, color 0.18s ease;
}
.th-connect-item:hover .th-connect-go {
  color: var(--th-ink);
  transform: translateX(3px);
}
[data-theme='dark'] .th-connect-item:hover {
  background: rgba(248, 250, 252, 0.06);
}
[data-theme='dark'] .th-connect-icon {
  background: rgba(252, 211, 77, 0.14);
}
@media (max-width: 860px) {
  .th-connect {
    padding: 48px 0;
  }
  .th-connect-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .th-connect-item,
  .th-connect-go {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   TẦNG 3 (FULL SCREEN 3): KIỂM TRA KIẾN THỨC — WARM CREAM + YELLOW QUIZ CARD
   -------------------------------------------------------------------------- */
.th-quiz-sec {
  min-height: calc(100dvh - var(--header-h, 64px));
  display: flex;
  align-items: center;
  padding: 64px 0;
  background: transparent;
}
.th-quiz-grid {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 52px;
  align-items: center;
}
.th-quiz-title {
  margin: 6px 0 18px;
  font-size: clamp(38px, 4.6vw, 58px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--th-ink);
}
.th-quiz-desc {
  margin: 0 0 22px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--th-ink-soft);
}
.th-quiz-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--th-accent-soft);
  color: #171412;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 24px;
  font-variant-numeric: tabular-nums;
}
[data-theme='dark'] .th-quiz-score-pill {
  color: #171412;
}
.th-quiz-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.th-text-link {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--th-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.th-text-link:hover {
  opacity: 0.75;
}

/* Thẻ quiz bên phải: nền trắng, viền mảnh */
.th-quiz-card {
  padding: 38px 42px;
  border-radius: 32px;
  background: #ffffff;
  border: 1.5px solid rgba(23, 20, 18, 0.09);
  color: #171412;
  box-shadow: 0 24px 48px -24px rgba(23, 20, 18, 0.18);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
[data-theme='dark'] .th-quiz-card {
  background: #fdf8ee;
  color: #171412;
}
.th-qf-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.th-qf-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.th-qf-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #171412;
}
.th-qf-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 800;
  color: #171412;
}
.th-qf-input {
  width: 100%;
  padding: 13px 18px;
  border-radius: 14px;
  border: 1.5px solid rgba(23, 20, 18, 0.08);
  background: #faf7f2;
  color: #171412;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.th-qf-input:focus {
  border-color: #171412;
  box-shadow: 0 0 0 3px rgba(23, 20, 18, 0.1);
}

/* 5 Interactive Stars */
.th-stars-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.th-star-btn {
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 2px 4px;
  font-size: 32px;
  line-height: 1;
  color: #171412;
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
.th-star-btn:hover {
  transform: scale(1.2) rotate(-6deg);
}
.th-stars-feedback {
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(23, 20, 18, 0.78);
}

/* 4 Stacked Full-Width Option Bars */
.th-q-prompt {
  margin: 0 0 4px;
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.45;
  color: #171412;
}
.th-q-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.th-q-opt {
  cursor: pointer;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(23, 20, 18, 0.08);
  background: #faf7f2;
  color: #171412;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.th-q-opt:hover {
  transform: translateX(4px);
  border-color: #171412;
}
.th-q-opt.is-correct {
  background: #bbf7d0;
  border-color: #15803d;
  color: #14532d;
}
.th-q-opt.is-wrong {
  background: #fecaca;
  border-color: #b91c1c;
  color: #7f1d1d;
}
.th-q-explain {
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(23, 20, 18, 0.04);
  font-size: 13.5px;
  line-height: 1.5;
  color: #171412;
}
.th-q-explain:empty {
  display: none;
}
.th-qf-actions {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   TẦNG 4 (FULL SCREEN 4): PASTEL MINT SCREEN — 5 VÒNG TRÒN NHÀ VÔ ĐỊCH TỰ HỌC
   -------------------------------------------------------------------------- */
.th-champ-sec {
  min-height: calc(100dvh - var(--header-h, 64px));
  display: flex;
  align-items: center;
  padding: 64px 0;
  background: transparent;
}
[data-theme='dark'] .th-champ-sec {
  background: transparent;
}
.th-champ-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 26px;
  align-items: start;
}
.th-champ-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  text-decoration: none;
  color: var(--th-ink);
}
.th-champ-circle {
  width: 164px;
  height: 164px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid rgba(23, 20, 18, 0.09);
  color: #171412;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  box-shadow: 0 16px 32px -18px rgba(23, 20, 18, 0.18);
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}
.th-champ-item:hover .th-champ-circle {
  transform: translateY(-7px) scale(1.05);
  background: var(--th-accent-soft);
  border-color: rgba(180, 83, 9, 0.28);
  box-shadow: 0 22px 38px -18px rgba(180, 83, 9, 0.26);
}
.th-champ-circle svg {
  width: 100%;
  height: 100%;
}
.th-champ-caption {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--th-ink);
}

/* --------------------------------------------------------------------------
   TẦNG 5 (FULL SCREEN 5): NHỊP ĐỘ & BẢNG VÀNG — 3 THẺ PASTEL PLAYFUL
   -------------------------------------------------------------------------- */
.th-pulse-sec {
  min-height: calc(100dvh - var(--header-h, 64px));
  display: flex;
  align-items: center;
  padding: 64px 0;
  background: transparent;
}
[data-theme='dark'] .th-pulse-sec {
  background: transparent;
}

.th-continue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  margin-bottom: 28px;
  border-radius: 28px;
  background: #faf7f2;
  border: 1.5px solid rgba(23, 20, 18, 0.1);
  color: #171412;
  box-shadow: 0 18px 38px -18px rgba(23, 20, 18, 0.14);
}
.th-continue-banner[hidden] {
  display: none !important;
}
.th-continue-banner .th-btn {
  background: var(--th-accent);
  color: var(--th-on-accent);
  box-shadow: 0 10px 22px -12px rgba(180, 83, 9, 0.5);
  white-space: nowrap;
}
.th-continue-banner .th-btn:hover {
  background: var(--th-accent-hover);
  color: var(--th-on-accent);
}
.th-cb-meta {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(23, 20, 18, 0.62);
  margin-bottom: 4px;
}
.th-cb-course {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: #171412;
}
.th-cb-lesson {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(23, 20, 18, 0.78);
}
.th-cb-bar {
  width: 260px;
  max-width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(23, 20, 18, 0.1);
  overflow: hidden;
  margin-bottom: 6px;
}
.th-cb-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--th-accent);
}
.th-cb-prog {
  font-size: 12px;
  font-weight: 700;
}

.th-pulse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  align-items: stretch;
}
.th-pulse-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 28px;
  border-radius: 32px;
  border: 1.5px solid rgba(23, 20, 18, 0.08);
  color: #171412;
  box-shadow: 0 20px 44px -20px rgba(23, 20, 18, 0.16);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}
.th-pulse-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 28px 50px -20px rgba(23, 20, 18, 0.24);
}
.th-pulse-card {
  background: #ffffff;
}
[data-theme='dark'] .th-pulse-card {
  background: #fdf8ee;
}

.th-pc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.th-pc-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #171412;
}
.th-pc-pill {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #171412;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Thẻ 1: Chuỗi học tập */
.th-streak-hero {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 18px;
}
.th-streak-hero strong {
  font-size: clamp(44px, 4.6vw, 60px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #b45309;
  font-variant-numeric: tabular-nums;
}
.th-streak-hero span {
  font-size: 16px;
  font-weight: 600;
  color: rgba(23, 20, 18, 0.78);
}
.th-week-bubbles.hv2-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 14px 12px;
  border-radius: 22px;
  background: rgba(23, 20, 18, 0.04);
  margin-bottom: 16px;
}
.th-week-bubbles .hv2-week-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.th-week-bubbles .hv2-week-bar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(23, 20, 18, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.th-week-bubbles .hv2-week-col.is-active .hv2-week-bar {
  background: var(--th-accent);
  color: var(--th-on-accent);
}
.th-week-bubbles .hv2-week-day {
  font-size: 11.5px;
  font-weight: 600;
  color: #171412;
}
.th-pc-note {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: rgba(23, 20, 18, 0.78);
}

/* Thẻ 2: Đếm ngược kỳ thi */
.th-cd-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  justify-content: center;
}
.th-cd-box {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(23, 20, 18, 0.04);
}
.th-cd-num {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 108px;
}
.th-cd-num strong {
  font-size: clamp(32px, 3.4vw, 42px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #b45309;
  font-variant-numeric: tabular-nums;
}
.th-cd-num span {
  font-size: 13px;
  font-weight: 600;
  color: rgba(23, 20, 18, 0.7);
}
.th-cd-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.th-cd-meta strong {
  font-size: 15.5px;
  font-weight: 700;
  color: #171412;
}
.th-cd-meta span {
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(23, 20, 18, 0.65);
}

/* Thẻ 3: Top 10 tuần này */
.th-rank-list.hv2-rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.th-rank-list .hv2-rank-row {
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  color: #171412;
  font-weight: 700;
}
/* Thẻ nhịp học vẫn nền sáng ở chế độ tối: giữ màu chữ của chế độ sáng cho bảng Top 10 */
[data-theme='dark'] .th-pulse-card {
  --text: #171412;
  --muted: #57534e;
}
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-1 .hv2-rank-no,
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-1 .hv2-rank-val {
  color: #b45309;
}
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-1 .hv2-rank-name {
  color: #92400e;
}
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-2 .hv2-rank-no,
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-2 .hv2-rank-val {
  color: #0369a1;
}
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-2 .hv2-rank-name {
  color: #075985;
}
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-3 .hv2-rank-no,
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-3 .hv2-rank-val {
  color: #047857;
}
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-top-3 .hv2-rank-name {
  color: #065f46;
}
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-me .hv2-rank-name,
:root[data-theme='dark'] .th-rank-list .hv2-rank-row.is-me .hv2-rank-val {
  color: #b54c05;
}
.th-pc-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 20px;
  border-radius: 999px;
  background: #171412;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.th-pc-link-btn:hover {
  transform: translateY(-2px);
  opacity: 0.92;
}

/* --------------------------------------------------------------------------
   TẦNG 6 (FULL SCREEN 6): CỘNG ĐỒNG + BẢN TIN + VÒM PASTEL 3D TÔ
   -------------------------------------------------------------------------- */
.th-contact-band {
  position: relative;
  min-height: calc(100dvh - var(--header-h, 64px));
  display: flex;
  align-items: stretch;
  padding: 56px 0 0;
  background: transparent;
  color: var(--th-ink);
  overflow: hidden;
}
[data-theme='dark'] .th-contact-band {
  background: transparent;
  color: var(--th-ink);
}
.th-contact-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 44px;
  align-items: center;
}
.th-contact-copy {
  padding-bottom: 56px;
}
.th-contact-title {
  margin: 0 0 10px;
  font-size: clamp(36px, 4.4vw, 54px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.025em;
  color: var(--th-ink);
}
.th-contact-sub {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--th-ink-soft);
}

/* Hộp Bản tin Thông báo gộp gọn trong Tầng 6 */
.th-ann-card {
  padding: 18px 22px;
  border-radius: 24px;
  background: #ffffff;
  border: 1.5px solid rgba(23, 20, 18, 0.09);
  margin-bottom: 20px;
  box-shadow: 0 16px 34px -18px rgba(23, 20, 18, 0.12);
}
[data-theme='dark'] .th-ann-card {
  background: var(--th-cream-card);
  border-color: var(--th-border);
}
.th-ann-head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--th-ink);
  margin-bottom: 10px;
}
.th-ann-list .hv2-ann-item {
  padding: 7px 0;
  border-bottom: 1px dashed var(--th-border);
  font-size: 13.5px;
  color: var(--th-ink);
}
.th-ann-list .hv2-ann-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.th-ann-list .hv2-ann-date {
  font-weight: 800;
  color: var(--th-ink);
}
.th-ann-list .hv2-ann-text {
  font-weight: 600;
  color: var(--th-ink-soft);
}

.th-contact-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.th-contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: #171412;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease;
}
.th-contact-pill:hover {
  transform: translateY(-2px);
  background: #2e2925;
}

.th-contact-dome-wrap {
  align-self: end;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.th-white-dome {
  width: 460px;
  height: 410px;
  border-radius: 250px 250px 0 0;
  background: var(--th-accent-soft);
  border: 2px solid rgba(180, 83, 9, 0.16);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 18px;
  box-shadow: 0 -14px 36px -10px rgba(180, 83, 9, 0.12);
}
[data-theme='dark'] .th-white-dome {
  background: linear-gradient(180deg, #1e2430 0%, #151922 100%);
  border-color: var(--th-border);
  box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.3);
}
.th-footer-mascot-3d {
  width: 360px;
  height: 360px;
}
.th-footer-tree {
  width: 360px;
  height: 360px;
  margin: 0;
  display: flex;
  align-items: flex-end;
}
.th-footer-mascot-3d canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .th-benefits-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .th-champ-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .th-pulse-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .th-container {
    padding: 0 16px;
  }
  .th-seam {
    height: 48px;
  }
  .th-hero,
  .th-pulse-sec,
  .th-benefits-band,
  .th-quiz-sec,
  .th-champ-sec,
  .th-contact-band {
    min-height: auto;
    padding: 36px 0;
  }

  /* Tầng 1 (Hero): Gọn gàng trong 1 màn hình điện thoại */
  .th-hero {
    min-height: calc(100dvh - var(--header-h, 56px) - 56px);
    padding: 20px 0 28px;
  }
  .th-wood-signs-rail {
    padding: 0 12px;
  }
  .th-wood-sign-rig {
    width: 52px;
    height: 54px;
    margin-top: 0;
    transform-origin: 50% 0px;
  }
  .th-wood-sign-rig.is-left {
    margin-left: 0;
  }
  .th-wood-sign-rig.is-right {
    margin-right: 0;
  }
  .th-chime-tooltip {
    display: none;
  }
  .th-hero-grid {
    grid-template-columns: 1fr;
    gap: 18px;
    text-align: center;
  }
  .th-eyebrow-pill {
    margin-bottom: 10px;
    font-size: 11px;
    padding: 5px 12px;
  }
  .th-hero-title {
    font-size: clamp(32px, 8.5vw, 42px);
    margin-bottom: 14px;
  }
  /* Ẩn đoạn mô tả dài trên mobile; hai nút xếp chồng, cùng bề ngang */
  .th-hero-desc {
    display: none;
  }
  .th-hero-cta-row {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .th-hero-cta-row .th-btn-accent,
  .th-hero-cta-row .th-btn-outline {
    width: 100%;
    max-width: 280px;
    padding: 13px 24px;
    font-size: 13px;
  }
  .th-hero-stage-wrap {
    min-height: 260px;
  }
  .th-yellow-stack {
    inset: 14px 8px;
    gap: 10px;
  }
  .th-yellow-pill {
    height: 62px;
  }
  .th-mascot-3d-box {
    max-width: 280px;
    height: 250px;
  }

  /* Header chung các tầng trên mobile: ẩn mô tả phụ dài dòng */
  .th-sec-head {
    margin-bottom: 22px;
  }
  .th-sec-eyebrow {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .th-sec-title {
    font-size: clamp(26px, 7vw, 34px);
    margin-bottom: 0;
  }
  .th-sec-sub {
    display: none;
  }

  /* Tầng 2 (Nhịp độ & Bảng vàng): Gọn & dễ lướt */
  .th-continue-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 18px 18px;
    margin-bottom: 16px;
    border-radius: 22px;
  }
  .th-cb-course {
    font-size: 17px;
  }
  .th-cb-lesson {
    font-size: 13px;
    margin-bottom: 8px;
  }
  .th-cb-bar {
    width: 100%;
  }
  .th-continue-banner .th-btn {
    width: 100%;
    padding: 12px 20px;
  }
  .th-pulse-grid {
    gap: 14px;
  }
  .th-pulse-card {
    padding: 20px 18px;
    border-radius: 24px;
  }
  .th-pc-head {
    margin-bottom: 12px;
  }
  .th-pc-title {
    font-size: 18px;
  }
  .th-streak-hero {
    margin: 0 0 12px;
  }
  .th-streak-hero strong {
    font-size: 38px;
  }
  .th-week-bubbles.hv2-week {
    padding: 10px 8px;
    margin-bottom: 0;
  }
  .th-week-bubbles .hv2-week-bar {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  .th-pc-note {
    display: none;
  }
  /* 2 cột ngang cho Đếm ngược kỳ thi trên mobile */
  .th-cd-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .th-cd-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px;
    border-radius: 18px;
  }
  .th-cd-num {
    min-width: 0;
  }
  .th-cd-num strong {
    font-size: 28px;
  }
  .th-cd-meta strong {
    font-size: 13.5px;
  }
  .th-cd-meta span {
    font-size: 11.5px;
  }

  /* Tầng 3 (Bạn sẽ được gì?): Chuyển 3 thẻ dọc cao thành 3 thanh ngang gọn đẹp */
  .th-benefits-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .th-benefit-card {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    min-height: auto;
    padding: 16px 18px;
    border-radius: 22px;
    gap: 16px;
  }
  .th-bc-illus {
    width: 58px;
    height: 58px;
    flex-shrink: 0;
    margin-bottom: 0;
  }
  .th-bc-title {
    font-size: 15.5px;
    margin-bottom: 4px;
  }
  .th-bc-meta {
    font-size: 12px;
  }

  /* Tầng 4 (Kiểm tra kiến thức) */
  .th-quiz-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .th-quiz-left {
    text-align: center;
  }
  .th-quiz-title {
    font-size: clamp(26px, 7vw, 34px);
    margin: 4px 0 0;
  }
  .th-quiz-title br {
    display: none;
  }
  .th-quiz-card {
    padding: 20px 16px;
    border-radius: 24px;
    gap: 16px;
  }
  .th-q-prompt {
    font-size: 14.5px;
  }
  .th-q-opt {
    padding: 11px 14px;
    font-size: 13px;
  }
  .th-btn-wide {
    width: 100%;
    padding: 13px 20px;
  }

  /* Tầng 5 (4 vòng tròn thói quen): Lưới 2x2 vừa vặn màn hình */
  .th-champ-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }
  .th-champ-item {
    gap: 10px;
  }
  .th-champ-circle {
    width: 108px;
    height: 108px;
    padding: 22px;
  }
  .th-champ-caption {
    font-size: 13px;
  }

  /* Tầng 6 (Cộng đồng & Bản tin): Ẩn vòm 3D thứ 2 trên mobile để nhẹ máy & gọn trang */
  .th-contact-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .th-contact-copy {
    padding-bottom: 24px;
    text-align: center;
  }
  .th-contact-title {
    font-size: clamp(28px, 7.5vw, 36px);
  }
  .th-contact-title br {
    display: none;
  }
  .th-contact-sub {
    font-size: 11.5px;
    margin-bottom: 14px;
  }
  .th-ann-card {
    text-align: left;
    padding: 14px 16px;
    border-radius: 20px;
    margin-bottom: 16px;
  }
  .th-contact-pills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .th-contact-pill {
    justify-content: center;
    padding: 10px 10px;
    font-size: 12px;
  }
  .th-contact-dome-wrap {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   SCROLL-DRIVEN PARALLAX & SCROLLYTELLING (CSS ViewTimeline + ScrollTimeline)
   -------------------------------------------------------------------------- */
@keyframes thScrollProgress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes thParallaxLayer {
  from {
    transform: translate3d(0, var(--p-start, 48px), 0);
  }
  to {
    transform: translate3d(0, var(--p-end, -48px), 0);
  }
}

@keyframes thParallaxPill {
  from {
    translate: var(--p-x-start, -18px) var(--p-y-start, 34px);
  }
  to {
    translate: var(--p-x-end, 18px) var(--p-y-end, -46px);
  }
}

@keyframes thWaveParallaxBack {
  from {
    translate: -26px 10px;
  }
  to {
    translate: 26px -6px;
  }
}

@keyframes thWaveParallaxFront {
  from {
    translate: 24px 14px;
  }
  to {
    translate: -24px -4px;
  }
}

@keyframes thCardScrollyIn {
  from {
    opacity: 0.25;
    translate: 0 var(--p-card-offset, 64px);
    scale: 0.95;
  }
  to {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}

@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
  .th-home {
    timeline-scope: --th-tl-1, --th-tl-2, --th-tl-3, --th-tl-4, --th-tl-5, --th-tl-6;
  }
  .th-home::before {
    content: '';
    position: fixed;
    top: var(--header-h, 64px);
    left: 0;
    right: 0;
    height: 4px;
    z-index: 60;
    pointer-events: none;
    transform-origin: 0 50%;
    background: var(--th-accent);
    animation: thScrollProgress linear both;
    animation-timeline: scroll(root block);
    animation-range: 0% 100%;
  }
}

@supports ((animation-timeline: view()) and (animation-range: entry)) {
  /* Named ViewTimelines per section for Scrollytelling & Parallax */
  .th-screen[data-th-screen='1'] { view-timeline: --th-tl-1 block; }
  .th-screen[data-th-screen='2'] { view-timeline: --th-tl-2 block; }
  .th-screen[data-th-screen='3'] { view-timeline: --th-tl-3 block; }
  .th-screen[data-th-screen='4'] { view-timeline: --th-tl-4 block; }
  .th-screen[data-th-screen='5'] { view-timeline: --th-tl-5 block; }
  .th-screen[data-th-screen='6'] { view-timeline: --th-tl-6 block; }

  /* 1. Hero multi-layer parallax (Copy + 3 Stacked Yellow Pills + 3D Rùa Tô) */
  .th-hero-copy {
    --p-start: 28px;
    --p-end: -36px;
    animation: thParallaxLayer linear both;
    animation-timeline: --th-tl-1;
    animation-range: entry 15% exit 95%;
  }
  .th-mascot-3d-box {
    --p-start: 46px;
    --p-end: -58px;
    animation: thParallaxLayer linear both;
    animation-timeline: --th-tl-1;
    animation-range: entry 10% exit 100%;
  }
  .th-yp-1 {
    --p-x-start: 24px;
    --p-x-end: -22px;
    --p-y-start: 22px;
    --p-y-end: -34px;
    animation: thParallaxPill linear both;
    animation-timeline: --th-tl-1;
    animation-range: entry 0% exit 100%;
  }
  .th-yp-2 {
    --p-x-start: -28px;
    --p-x-end: 26px;
    --p-y-start: 44px;
    --p-y-end: -62px;
    animation: thParallaxPill linear both;
    animation-timeline: --th-tl-1;
    animation-range: entry 0% exit 100%;
  }
  .th-yp-3 {
    --p-x-start: 18px;
    --p-x-end: -18px;
    --p-y-start: 68px;
    --p-y-end: -88px;
    animation: thParallaxPill linear both;
    animation-timeline: --th-tl-1;
    animation-range: entry 0% exit 100%;
  }

  /* 2. Wave Seam Dual-Layer Scroll-Driven Parallax */
  .th-seam {
    view-timeline: --th-seam-tl block;
  }
  .th-seam-svg .th-wave-back {
    animation: thWaveParallaxBack linear both;
    animation-timeline: --th-seam-tl;
    animation-range: entry 0% exit 100%;
  }
  .th-seam-svg .th-wave-front {
    animation: thWaveParallaxFront linear both;
    animation-timeline: --th-seam-tl;
    animation-range: entry 0% exit 100%;
  }

  /* 3. Staggered Parallax Cards & Circles across Tầng 2–6 */
  .th-sec-head,
  .th-quiz-left,
  .th-contact-copy {
    --p-start: 38px;
    --p-end: -24px;
    animation: thParallaxLayer linear both;
    animation-timeline: view(block);
    animation-range: entry 10% exit 90%;
  }

  .th-pulse-card,
  .th-benefit-card,
  .th-quiz-card,
  .th-champ-item,
  .th-white-dome {
    animation: thCardScrollyIn linear both;
    animation-timeline: view(block);
    animation-range: entry 8% cover 38%;
  }
  .th-pulse-card:nth-child(1),
  .th-benefit-card:nth-child(1),
  .th-champ-item:nth-child(1) {
    --p-card-offset: 48px;
    animation-range: entry 5% cover 34%;
  }
  .th-pulse-card:nth-child(2),
  .th-benefit-card:nth-child(2),
  .th-champ-item:nth-child(2) {
    --p-card-offset: 76px;
    animation-range: entry 10% cover 40%;
  }
  .th-pulse-card:nth-child(3),
  .th-benefit-card:nth-child(3),
  .th-champ-item:nth-child(3) {
    --p-card-offset: 104px;
    animation-range: entry 15% cover 46%;
  }
  .th-champ-item:nth-child(4) {
    --p-card-offset: 128px;
    animation-range: entry 18% cover 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .th-reveal,
  .th-hero-copy,
  .th-mascot-3d-box,
  .th-yellow-pill,
  .th-seam-svg .th-wave-back,
  .th-seam-svg .th-wave-front,
  .th-sec-head,
  .th-quiz-left,
  .th-contact-copy,
  .th-pulse-card,
  .th-benefit-card,
  .th-quiz-card,
  .th-champ-item,
  .th-white-dome {
    opacity: 1 !important;
    transform: none !important;
    translate: 0 0 !important;
    scale: 1 !important;
    animation: none !important;
    transition: none !important;
  }
}
