/* ============================================================
   TapLaiOto — Design System
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box
}

/* Hidden attribute MUST override any explicit display: in component classes.
   Custom .modal{display:grid}, .drawer{display:flex}, .install-prompt{display:flex}
   have specificity (0,1,0) — same as [hidden] — and being declared later, would win.
   This rule guarantees `hidden` attribute always hides. */
[hidden] {
  display: none !important
}

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

body {
  margin: 0;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden
}

img,
svg {
  display: block;
  max-width: 100%
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none
}

input,
textarea,
select {
  font: inherit;
  color: inherit
}

a {
  color: inherit;
  text-decoration: none
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px
}

kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .75em;
  padding: .15em .5em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border-strong)
}

/* ===== TOKENS ===== */
:root {
  --primary: #0066ff;
  --primary-2: #3b82f6;
  --primary-fg: #fff;
  --accent: #ff6b35;
  --accent-2: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #06b6d4;

  --bg: #fbfcff;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --surface-3: #e9ecf5;
  --border: #e3e8f1;
  --border-strong: #cdd5e3;
  --text: #0b1220;
  --text-muted: #5b6478;

  --grad-brand: linear-gradient(135deg, #0066ff 0%, #7c3aed 50%, #ff6b35 100%);
  --grad-soft: linear-gradient(135deg, rgba(0, 102, 255, .10), rgba(255, 107, 53, .10));
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, .06), 0 1px 3px rgba(11, 18, 32, .05);
  --shadow: 0 8px 24px -8px rgba(11, 18, 32, .10), 0 4px 8px -4px rgba(11, 18, 32, .06);
  --shadow-lg: 0 30px 60px -20px rgba(11, 18, 32, .18), 0 12px 24px -10px rgba(11, 18, 32, .10);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --t-fast: 120ms cubic-bezier(.2, .8, .2, 1);
  --t: 220ms cubic-bezier(.2, .8, .2, 1);
  --t-slow: 400ms cubic-bezier(.2, .8, .2, 1);

  --container: 1200px;
  --hdr-h: 68px;
  --bnav-h: 64px;
}

[data-theme="dark"] {
  --bg: #070a14;
  --surface: #0d1322;
  --surface-2: #131a2c;
  --surface-3: #1b2440;
  --border: #1f2a44;
  --border-strong: #2c3a5c;
  --text: #eef2fb;
  --text-muted: #9aa6c0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .30);
  --shadow: 0 12px 32px -10px rgba(0, 0, 0, .55), 0 6px 12px -6px rgba(0, 0, 0, .40);
  --shadow-lg: 0 40px 80px -20px rgba(0, 0, 0, .7), 0 20px 40px -20px rgba(0, 0, 0, .5);
  --grad-soft: linear-gradient(135deg, rgba(0, 102, 255, .18), rgba(255, 107, 53, .16));
}

/* ===== LAYOUT ===== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
}

.container.narrow {
  max-width: 780px
}

.sect {
  padding: 96px 0
}

.sect.alt {
  background: var(--surface-2)
}

.sect-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 48px
}

.sect-head h2 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.15;
  margin: .4em 0 .3em;
  letter-spacing: -.02em
}

.sect-head p {
  color: var(--text-muted);
  margin: 0
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--grad-soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent)
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  transition: transform var(--t-fast), background var(--t), border-color var(--t), box-shadow var(--t);
  white-space: nowrap
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm)
}

.btn:active {
  transform: translateY(0)
}

.btn.lg {
  padding: 14px 24px;
  font-size: 16px;
  border-radius: 12px
}

.btn.sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px -8px var(--primary)
}

.btn.primary:hover {
  background: #0a5fe6;
  box-shadow: 0 12px 28px -10px var(--primary)
}

.btn.ghost {
  background: transparent
}

.btn.ghost:hover {
  background: var(--surface-2)
}

.btn.white {
  background: #fff;
  color: var(--primary);
  border-color: transparent
}

.btn.white:hover {
  background: #f7fbff
}

.btn.ghost-light {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-color: rgba(255, 255, 255, .25)
}

.btn.ghost-light:hover {
  background: rgba(255, 255, 255, .20)
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent
}

.btn.danger:disabled {
  opacity: .45;
  cursor: not-allowed
}

.btn.block {
  width: 100%;
  justify-content: center
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  transition: background var(--t)
}

.icon-btn:hover {
  background: var(--surface-2)
}

/* ===== HEADER ===== */
.hdr {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t), background var(--t)
}

.hdr.scrolled {
  border-bottom-color: var(--border)
}

.hdr-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--hdr-h)
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.01em
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--grad-brand);
  position: relative;
  box-shadow: 0 6px 20px -6px var(--primary)
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 5px;
  background: linear-gradient(135deg, #fff 30%, transparent 30%),
    linear-gradient(45deg, #fff 30%, transparent 30%);
  background-position: 0 0, 0 0;
  background-size: 8px 8px, 8px 8px;
  mix-blend-mode: screen;
  opacity: .85
}

.brand-text span {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

.nav {
  display: flex;
  gap: 6px;
  margin-left: 8px
}

.nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14.5px;
  transition: color var(--t), background var(--t)
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2)
}

.hdr-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px
}

.menu-btn {
  display: none
}

.theme-toggle .theme-i-moon {
  display: none
}

[data-theme="dark"] .theme-toggle .theme-i-sun {
  display: none
}

[data-theme="dark"] .theme-toggle .theme-i-moon {
  display: inline-flex
}

/* ===== HERO ===== */
.hero {
  position: relative;
  padding: 48px 0 80px;
  overflow: hidden
}

.hero-bg {
  position: absolute;
  inset: -80px 0 -40px;
  z-index: 0;
  pointer-events: none
}

.mesh {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  mix-blend-mode: multiply;
  animation: float 18s ease-in-out infinite
}

[data-theme="dark"] .mesh {
  mix-blend-mode: screen;
  opacity: .45
}

.mesh-a {
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, #0066ff, transparent 70%);
  top: -160px;
  left: -120px
}

.mesh-b {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #ff6b35, transparent 70%);
  top: 80px;
  right: -160px;
  animation-delay: -6s
}

.mesh-c {
  width: 440px;
  height: 440px;
  background: radial-gradient(circle, #a855f7, transparent 70%);
  bottom: -180px;
  left: 35%;
  animation-delay: -12s
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1)
  }

  33% {
    transform: translate(30px, -20px) scale(1.06)
  }

  66% {
    transform: translate(-20px, 20px) scale(.96)
  }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .18;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%)
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 64px;
  align-items: center;
  min-height: 560px
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm)
}

.pill-glow {
  position: relative;
  color: var(--primary);
  font-weight: 600;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border))
}

.h-display {
  font-size: clamp(40px, 6.4vw, 76px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.025em;
  margin: 18px 0 16px
}

.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

.lede {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 560px
}

.lede b {
  color: var(--text);
  font-weight: 600
}

.class-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px
}

.cls {
  padding: 8px 16px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--t)
}

.cls:hover {
  border-color: var(--primary)
}

.cls.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 6px 18px -8px var(--primary)
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px
}

.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 14px
}

.trust strong {
  color: var(--text);
  font-weight: 700
}

/* ===== HERO MOCK ===== */
.hero-mock {
  position: relative;
  perspective: 1200px;
  height: 520px
}

.mock-stack {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d
}

.mock {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  animation: floatY 6s ease-in-out infinite
}

.mock.card {
  padding: 18px
}

.mock-a {
  top: 30px;
  left: 0;
  right: 30px;
  transform: rotate(-3deg);
  min-height: 280px
}

.mock-b {
  top: 230px;
  right: 0;
  width: 260px;
  transform: rotate(4deg);
  display: flex;
  align-items: center;
  gap: 14px;
  animation-delay: -2s
}

.mock-c {
  bottom: 0;
  left: 30px;
  width: 280px;
  transform: rotate(-2deg);
  display: flex;
  gap: 12px;
  align-items: center;
  animation-delay: -4s
}

@keyframes floatY {

  0%,
  100% {
    translate: 0 0
  }

  50% {
    translate: 0 -10px
  }
}

.mock-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%
}

.dot-r {
  background: #ff5f57
}

.dot-y {
  background: #febc2e
}

.dot-g {
  background: #28c840
}

.mock-title {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500
}

.mock-q {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  line-height: 1.5
}

.mock-opts {
  display: grid;
  gap: 6px
}

.mock-opt {
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px
}

.mock-opt.ok {
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  border-color: var(--success);
  color: var(--success);
  font-weight: 600
}

.mock-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px
}

.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2)
}

.badge.crit {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger)
}

.xp-pop {
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--grad-brand);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  animation: pop 1.6s ease-in-out infinite
}

@keyframes pop {

  0%,
  100% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.08)
  }
}

.streak {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1
}

.flame {
  display: inline-flex;
  color: #ea580c;
  animation: flicker 2s ease-in-out infinite
}

[data-theme="dark"] .flame {
  color: #fb923c
}

@keyframes flicker {

  0%,
  100% {
    filter: hue-rotate(0deg) brightness(1)
  }

  50% {
    filter: hue-rotate(-10deg) brightness(1.15)
  }
}

.streak-n {
  font-weight: 800;
  font-size: 20px
}

.streak-l {
  font-size: 12px;
  color: var(--text-muted)
}

.ring {
  position: relative;
  width: 86px;
  height: 86px
}

.ring-c {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center
}

.ring-n {
  font-weight: 800;
  font-size: 20px
}

.ring-l {
  font-size: 11px;
  color: var(--text-muted)
}

.trophy {
  display: inline-flex;
  color: #f59e0b;
  filter: drop-shadow(0 4px 8px rgba(245, 158, 11, .4))
}

.trophy-t {
  font-weight: 700
}

.trophy-s {
  font-size: 12px;
  color: var(--text-muted)
}

.scroll-down {
  position: absolute;
  bottom: 14px;
  left: 50%;
  translate: -50% 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  animation: bounce 2.4s infinite
}

@keyframes bounce {

  0%,
  100% {
    translate: -50% 0
  }

  50% {
    translate: -50% 6px
  }
}

/* ===== QUIZ ===== */
.card-elev {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 32px
}

.quiz {
  max-width: 100%;
  margin: 0 auto
}

.quiz-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px
}

.chip {
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text)
}

.chip.muted {
  color: var(--text-muted)
}

.chip.danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger)
}

.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden
}

.progress-bar {
  height: 100%;
  background: var(--grad-brand);
  border-radius: 99px;
  width: 10%;
  transition: width var(--t-slow)
}

.quiz-q {
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 700;
  line-height: 1.5;
  margin: 8px 0 14px
}

/* Image embedded in quiz card (biển báo, cấu tạo questions) */
.q-image-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 18px;
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--primary) 6%, var(--surface-2)),
      color-mix(in srgb, var(--accent) 4%, var(--surface-2)));
  border: 1px solid var(--border);
}

.q-image {
  display: block;
  max-width: 280px;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(11, 18, 32, .12));
}

[data-theme="dark"] .q-image {
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .5));
}

.quiz-opts {
  display: grid;
  gap: 10px;
  margin-bottom: 18px
}

.q-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  transition: transform var(--t-fast), background var(--t), border-color var(--t)
}

.q-opt:hover:not(:disabled) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
  transform: translateX(2px)
}

.q-opt:disabled {
  cursor: default
}

.q-opt .lbl {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0
}

.q-opt.correct {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  color: var(--success);
  font-weight: 600
}

.q-opt.correct .lbl {
  background: var(--success);
  color: #fff
}

.q-opt.wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
  font-weight: 600;
  animation: shake .4s
}

.q-opt.wrong .lbl {
  background: var(--danger);
  color: #fff
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0)
  }

  25% {
    transform: translateX(-6px)
  }

  75% {
    transform: translateX(6px)
  }
}

.quiz-explain {
  margin-top: 14px;
  padding: 18px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--info) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--info) 30%, var(--border));
  animation: fadeUp .4s
}

@keyframes fadeUp {
  from {
    opacity: 0;
    translate: 0 6px
  }

  to {
    opacity: 1;
    translate: 0 0
  }
}

.ex-h {
  display: flex;
  gap: 14px
}

.ex-icon {
  display: inline-flex;
  color: var(--info);
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px
}

.ex-t {
  font-weight: 700;
  margin-bottom: 6px
}

.ex-h p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.6
}

.ex-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px
}

.quiz-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border)
}

.quiz-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13.5px;
  color: var(--text-muted)
}

.quiz-stats b {
  color: var(--text)
}

.quiz-nav {
  display: flex;
  gap: 8px
}

.quiz-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 18px
}

/* ===== FEATURES ===== */
.feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px
}

.feat {
  position: relative;
  padding: 28px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t)
}

.feat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--c1), var(--c2))
}

.feat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c1)
}

.feat-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  filter: drop-shadow(0 8px 20px color-mix(in srgb, var(--c1) 30%, transparent));
  transition: transform var(--t);
}

.feat:hover .feat-ico {
  transform: translateY(-3px) scale(1.05);
}

.feat-ico svg.rich {
  width: 100%;
  height: 100%;
}

.feat h3 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700
}

.feat p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 14.5px
}

.feat-stat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--c1);
  font-weight: 600
}

/* ===== DASHBOARD ===== */
.dash {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 28px
}

.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 24px
}

.dash-greet h3 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 800
}

.dash-greet p {
  margin: 0;
  color: var(--text-muted)
}

.dash-streak {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1px solid #fde68a;
  color: #92400e
}

[data-theme="dark"] .dash-streak {
  background: linear-gradient(135deg, #451a03, #3f1f0a);
  border-color: #78350f;
  color: #fcd34d
}

.flame-big {
  display: inline-flex;
  animation: flicker 2s infinite;
  color: #ea580c
}

[data-theme="dark"] .flame-big {
  color: #fb923c
}

.num-big {
  font-weight: 800;
  font-size: 24px;
  line-height: 1
}

.num-lbl {
  font-size: 11.5px;
  opacity: .85
}

.freeze {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .6);
  font-size: 12.5px;
  font-weight: 600
}

[data-theme="dark"] .freeze {
  background: rgba(0, 0, 0, .3);
  color: #fcd34d
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px
}

.d-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px
}

.d-card.span-2 {
  grid-column: span 2
}

.d-card.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center
}

.d-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px
}

.d-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700
}

.lvl-pill {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--surface)
}

.quest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 6px;
  transition: background var(--t)
}

.quest:hover {
  background: var(--surface)
}

.quest-ck {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0
}

.quest[data-done="true"] .quest-ck {
  background: var(--success);
  border-color: var(--success);
  color: #fff
}

.quest[data-done="true"] .quest-t {
  text-decoration: line-through;
  opacity: .65
}

.quest-t {
  font-weight: 600;
  font-size: 14px
}

.quest-s {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px
}

.quest-xp {
  margin-left: auto;
  font-weight: 700;
  color: var(--primary);
  font-size: 13px
}

.quest-xp.earned {
  color: var(--success)
}

.big-ring {
  position: relative;
  margin: 8px 0
}

.big-ring-c {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center
}

.big-num {
  font-size: 34px;
  font-weight: 800;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

.big-lbl {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  margin-top: 2px
}

.d-foot {
  margin: 8px 0 0
}

.d-foot.muted {
  color: var(--text-muted);
  font-size: 12.5px
}

.bars {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px
}

.bars li {
  display: grid;
  grid-template-columns: 160px 1fr 50px;
  gap: 12px;
  align-items: center;
  font-size: 13.5px
}

.bars li span:first-child {
  color: var(--text-muted)
}

.bars li b {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 700
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface);
  overflow: hidden
}

.bar i {
  display: block;
  height: 100%;
  background: var(--grad-brand);
  border-radius: 99px;
  animation: fill 1.2s ease-out
}

.bars li.warn .bar i {
  background: linear-gradient(90deg, var(--warn), var(--accent))
}

.bars li.warn b {
  color: #b9530a
}

.bars li.danger .bar i {
  background: linear-gradient(90deg, var(--danger), #ef4444)
}

.bars li.danger b {
  color: #b91c1c
}

.bars li em {
  color: #b91c1c;
  font-style: normal;
  font-weight: 700
}

@keyframes fill {
  from {
    width: 0 !important
  }
}

.heat {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px
}

.heat span {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--surface);
  transition: transform var(--t-fast)
}

.heat span:hover {
  transform: scale(1.4);
  z-index: 2;
  position: relative
}

.hl {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px
}

.hl-0 {
  background: var(--surface)
}

.hl-1 {
  background: color-mix(in srgb, var(--primary) 20%, var(--surface))
}

.hl-2 {
  background: color-mix(in srgb, var(--primary) 40%, var(--surface))
}

.hl-3 {
  background: color-mix(in srgb, var(--primary) 65%, var(--surface))
}

.hl-4 {
  background: var(--primary)
}

.heat-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-muted)
}

.lb {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px
}

.lb li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px
}

.lb li.me {
  outline: 2px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface))
}

.rk {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  width: 20px;
  color: var(--text-muted)
}

.av {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-weight: 700;
  font-size: 13px
}

.nm {
  font-weight: 600;
  flex: 1
}

.xp {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600
}

.bdg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px
}

.bdg {
  padding: 14px 8px;
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  border: 1px solid var(--border);
  transition: transform var(--t), box-shadow var(--t)
}

.bdg:hover:not(.locked) {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent)
}

.bdg-i {
  font-size: 24px;
  margin-bottom: 4px
}

.bdg-t {
  font-size: 11.5px;
  font-weight: 600
}

.bdg.locked {
  opacity: .45;
  filter: grayscale(1)
}

/* ===== EXAM ===== */
.exam {
  max-width: 840px;
  margin: 0 auto
}

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

.exam-name {
  font-weight: 700
}

.exam-rule {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px
}

.exam-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border))
}

.t-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 18px;
  color: var(--accent)
}

.exam-empty {
  text-align: center;
  padding: 48px 12px
}

.play-circle {
  display: grid;
  place-items: center;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 24px 60px -20px var(--primary);
  animation: pulse 2.4s infinite
}

.play-circle svg {
  margin-left: 6px
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 40%, transparent)
  }

  80%,
  100% {
    box-shadow: 0 0 0 20px transparent
  }
}

.exam-empty h3 {
  margin: 0 0 6px;
  font-size: 24px
}

.exam-empty p {
  margin: 0 0 22px;
  color: var(--text-muted)
}

.exam-q {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  margin: 8px 0 18px
}

.exam-q.crit::before {
  content: "⚠ Câu liệt — sai 1 là rớt thi";
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 8px
}

.exam-pal {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px
}

.pal {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  transition: all var(--t-fast)
}

.pal.cur {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary)
}

.pal.done {
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
  border-color: var(--success);
  color: var(--success)
}

.exam-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px
}

.exam-result {
  text-align: center;
  padding: 18px
}

.score-big {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

.score-pass {
  font-size: 22px;
  font-weight: 800;
  color: var(--success);
  margin: 8px 0
}

.score-fail {
  font-size: 22px;
  font-weight: 800;
  color: var(--danger);
  margin: 8px 0
}

.score-list {
  display: grid;
  gap: 8px;
  text-align: left;
  margin: 18px 0
}

.score-row {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px
}

.score-row.ok {
  border-left: 3px solid var(--success)
}

.score-row.no {
  border-left: 3px solid var(--danger)
}

/* ===== SIM ===== */
.sim {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  max-width: 100%;
  margin: 0 auto
}

.sim-stage {
  display: flex;
  flex-direction: column;
  gap: 14px
}

.sim-scene {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #0b1220;
  user-select: none
}

.sim-video-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: default;
  --zoom: 1;
  --pan-x: 0px;
  --pan-y: 0px
}

.sim-video-wrap.zoomed {
  cursor: grab
}

.sim-video-wrap.dragging {
  cursor: grabbing
}

.sim-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0b1220;
  transform: translate(var(--pan-x), var(--pan-y)) scale(var(--zoom));
  transform-origin: center center;
  transition: transform 240ms cubic-bezier(.2, .8, .2, 1)
}

.sim-video-wrap.dragging .sim-video {
  transition: none
}

/* ===== HINT TOGGLE (top-left) ===== */
.sim-hint-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .15);
  transition: all var(--t-fast)
}

.sim-hint-toggle:hover {
  background: rgba(0, 0, 0, .85);
  transform: translateY(-1px)
}

.sim-hint-toggle.off {
  opacity: .7;
  background: rgba(239, 68, 68, .45)
}

.sim-hint-toggle.off:hover {
  background: rgba(239, 68, 68, .65)
}

.sim-hint-icon {
  display: inline-flex;
  flex-shrink: 0
}

/* ===== ZOOM CONTROLS (bottom-left) ===== */
.sim-zoom-controls {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .15)
}

.sim-zoom-controls button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: transparent;
  transition: background var(--t-fast)
}

.sim-zoom-controls button:hover:not(:disabled) {
  background: rgba(255, 255, 255, .18)
}

.sim-zoom-controls button:disabled {
  opacity: .35;
  cursor: not-allowed
}

.sim-zoom-level {
  padding: 0 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  display: grid;
  place-items: center;
  min-width: 50px;
  border-left: 1px solid rgba(255, 255, 255, .15);
  border-right: 1px solid rgba(255, 255, 255, .15)
}

/* ===== HINT HIDDEN STATE — fade out scoring zones + chapter ===== */
#sim.hint-off .sim-bar-zone-5,
#sim.hint-off .sim-bar-zone-fade {
  opacity: 0;
  transition: opacity var(--t)
}

#sim.hint-off .sim-time-badge {
  opacity: .35;
  transition: opacity var(--t)
}

#sim.hint-off .sim-meta .chip {
  opacity: .35;
  transition: opacity var(--t)
}

#sim:not(.hint-off) .sim-bar-zone-5,
#sim:not(.hint-off) .sim-bar-zone-fade {
  transition: opacity var(--t), width var(--t-slow)
}

/* When overlay shown, hide zoom + hint controls */
.sim-scene:has(.sim-overlay:not(.hidden)) .sim-zoom-controls,
.sim-scene:has(.sim-overlay:not(.hidden)) .sim-hint-toggle {
  display: none
}

.sim-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(11, 18, 32, .85), rgba(11, 18, 32, .65));
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  padding: 20px;
  backdrop-filter: blur(2px);
  transition: opacity var(--t);
  cursor: pointer;
}

.sim-overlay.hidden {
  opacity: 0;
  pointer-events: none
}

.sim-overlay-icon {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--grad-brand);
  box-shadow: 0 16px 40px -8px var(--primary);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.sim-overlay:hover .sim-overlay-icon {
  transform: scale(1.06);
  box-shadow: 0 22px 50px -8px var(--primary);
}

.sim-overlay:active .sim-overlay-icon {
  transform: scale(0.97);
}

/* Loading state: don't pretend the overlay is clickable while we fetch */
.sim-overlay.loading { cursor: wait; }
.sim-overlay.loading .sim-overlay-icon { display: none; }

.sim-flag-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 99px;
  background: rgba(239, 68, 68, .95);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .4);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 16px 40px -8px rgba(239, 68, 68, .6)
}

.sim-flag-flash.show {
  animation: flagPop .8s cubic-bezier(.2, .8, .2, 1)
}

@keyframes flagPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.6)
  }

  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15)
  }

  60% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1)
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.4)
  }
}

.sim-time-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(8px)
}

.sim-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px
}

.sim-bar-track {
  position: relative;
  height: 14px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: visible
}

.sim-bar-zone-5 {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #10b981;
  border-radius: 99px 0 0 99px;
  width: 0;
  transition: width var(--t-slow)
}

.sim-bar-zone-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #10b981 0%, #22d3ee 20%, #a855f7 50%, #f59e0b 80%, #ef4444 100%);
  border-radius: 0 99px 99px 0;
  width: 0;
  transition: width var(--t-slow)
}

.sim-bar-cursor {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  background: #fff;
  border-radius: 99px;
  box-shadow: 0 0 12px rgba(255, 255, 255, .8);
  transition: left 100ms linear
}

.sim-bar-flag {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 5px;
  background: var(--accent);
  border-radius: 99px;
  box-shadow: 0 0 12px var(--accent);
  opacity: 0;
  transition: opacity var(--t-fast)
}

.sim-bar-flag.show {
  opacity: 1
}

.sim-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600
}

.sim-bar-labels .muted {
  color: var(--text-muted);
  font-weight: 500
}

.sim-side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg)
}

.sim-meta-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px
}

.sim-meta h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 700
}

.sim-picker {
  display: flex;
  align-items: center;
  gap: 6px
}

.sim-picker input {
  width: 64px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-align: center;
  font-size: 14px;
  color: var(--text)
}

.sim-picker input::-webkit-inner-spin-button,
.sim-picker input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0
}

.sim-picker .btn {
  padding: 8px 10px
}

.sim-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px
}

.sim-score-ring {
  position: relative;
  width: 120px;
  height: 120px
}

.sim-score-c {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center
}

.sim-pts {
  font-size: 34px;
  font-weight: 800
}

.sim-l {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600
}

.sim-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted)
}

.kb {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border)
}

.sim-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto
}

/* ===== SIGN EXPLORER ===== */
.signs {
  max-width: 100%;
  margin: 0 auto
}

.signs-tools {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center
}

.search {
  position: relative;
  flex: 1;
  min-width: 240px
}

.search svg {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none
}

.search input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 14.5px;
  color: var(--text);
  transition: border-color var(--t)
}

.search input:focus {
  outline: 0;
  border-color: var(--primary)
}

.kbdhint {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  pointer-events: none
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center
}

.ftr {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  transition: all var(--t-fast);
  cursor: pointer
}

.ftr:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-2))
}

.ftr.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 6px 16px -8px var(--primary)
}

.ftr svg.i {
  color: currentColor
}

.sign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px
}

.sg-card {
  padding: 18px 14px 14px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: center;
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px
}

.sg-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary)
}

.sg-img {
  display: block;
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(11, 18, 32, .10))
}

[data-theme="dark"] .sg-img {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .45))
}

.sg-svg {
  display: block;
  filter: drop-shadow(0 4px 10px rgba(11, 18, 32, .10))
}

[data-theme="dark"] .sg-svg {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .45))
}

.sg-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 4px
}

.sg-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35
}

.center {
  text-align: center
}

/* ============================================================
   SIGN GAME — pick the correct sign name from 4 options
   ============================================================ */
.sgame {
  max-width: 100%;
  margin: 0 auto;
  padding: 28px
}

.sgame-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border)
}

.sgame-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2)
}

.sgame-stat-i {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  flex-shrink: 0
}

.sgame-stat-i.sgame-flame {
  color: #ea580c
}

[data-theme="dark"] .sgame-stat-i.sgame-flame {
  color: #fb923c
}

.sgame-stat>div:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1
}

.sgame-stat b {
  font-size: 18px;
  font-weight: 800;
  color: var(--text)
}

.sgame-stat span {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500
}

.sgame-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 24px
}

.sgame-filters .small {
  margin-right: 4px
}

.sgame-filter {
  height: 32px;
  padding: 0 14px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--t-fast)
}

.sgame-filter:hover {
  border-color: var(--primary)
}

.sgame-filter.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px -4px var(--primary)
}

.sgame-q {
  display: flex;
  flex-direction: column
}

.sgame-q-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px
}

.sgame-prompt {
  margin: 0 0 18px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted)
}

.sgame-image-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--primary) 6%, var(--surface)),
      color-mix(in srgb, var(--accent) 4%, var(--surface)));
  border: 1px solid var(--border);
  min-height: 240px
}

.sgame-image {
  display: block;
  max-width: 200px;
  max-height: 200px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 16px 40px rgba(11, 18, 32, .18))
}

[data-theme="dark"] .sgame-image {
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, .6))
}

.sgame-feedback {
  position: absolute;
  top: 12px;
  right: 14px;
  padding: 6px 14px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .04em;
  opacity: 0;
  transition: opacity var(--t)
}

.sgame-feedback.ok {
  opacity: 1;
  background: var(--success);
  color: #fff;
  animation: popOk .4s cubic-bezier(.2, .8, .2, 1)
}

.sgame-feedback.bad {
  opacity: 1;
  background: var(--danger);
  color: #fff;
  animation: shake .35s
}

@keyframes popOk {
  0% {
    transform: scale(.4);
    opacity: 0
  }

  50% {
    transform: scale(1.15)
  }

  100% {
    transform: scale(1);
    opacity: 1
  }
}

.sgame-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px
}

.sgame-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast)
}

.sgame-option:hover:not(:disabled) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
  transform: translateY(-2px)
}

.sgame-option:disabled {
  cursor: default
}

.sgame-option-key {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface-2);
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  color: var(--text-muted)
}

.sgame-option-text {
  flex: 1;
  line-height: 1.4
}

.sgame-option.correct {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  color: var(--success);
  font-weight: 700
}

.sgame-option.correct .sgame-option-key {
  background: var(--success);
  color: #fff
}

.sgame-option.wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  font-weight: 700;
  animation: shake .35s
}

.sgame-option.wrong .sgame-option-key {
  background: var(--danger);
  color: #fff
}

.sgame-explain {
  padding: 16px 18px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--info) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--info) 30%, var(--border));
  margin-bottom: 18px;
  animation: fadeUp .3s
}

.sgame-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px
}

.sgame-nav .btn {
  flex: 1;
  justify-content: center
}

.sgame-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 18px 0 0
}

@media (max-width:640px) {
  .sgame {
    padding: 18px
  }

  .sgame-stats {
    grid-template-columns: repeat(3, 1fr)
  }

  .sgame-options {
    grid-template-columns: 1fr
  }

  .sgame-image {
    max-width: 160px;
    max-height: 160px
  }
}

/* ===== AI CHAT ===== */
.chat {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  overflow: hidden
}

.chat-msgs {
  padding: 24px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px
}

.bubble {
  display: flex;
  gap: 12px;
  max-width: 88%
}

.bubble.user {
  margin-left: auto;
  flex-direction: row-reverse
}

.bubble.bot .bot-avt {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  flex-shrink: 0
}

.bubble.bot>div {
  background: var(--surface-2);
  padding: 14px 18px;
  border-radius: 18px 18px 18px 4px
}

.bubble.user>div {
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px
}

.bot-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--primary)
}

.bubble p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6
}

.bubble.bot .typing {
  display: flex;
  gap: 4px;
  padding: 6px 0
}

.bubble.bot .typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dots 1.4s infinite
}

.bubble.bot .typing span:nth-child(2) {
  animation-delay: .2s
}

.bubble.bot .typing span:nth-child(3) {
  animation-delay: .4s
}

@keyframes dots {

  0%,
  60%,
  100% {
    opacity: .3;
    transform: translateY(0)
  }

  30% {
    opacity: 1;
    transform: translateY(-4px)
  }
}

.chat-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 16px
}

.chat-suggest button {
  padding: 8px 14px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  transition: all var(--t)
}

.chat-suggest button:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary)
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2)
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14.5px
}

.chat-input input:focus {
  outline: 0;
  border-color: var(--primary)
}

/* ===== COMMUNITY ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px
}

.qa {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 10px
}

.qa li {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--t)
}

.qa li:hover {
  border-color: var(--primary)
}

.qa-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 32px
}

.qa-vote b {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  margin: 2px 0
}

.qa-vote span {
  cursor: pointer;
  line-height: 1;
  font-size: 14px
}

.qa-vote span:hover {
  color: var(--primary)
}

.qa-t {
  font-weight: 600;
  margin-bottom: 4px
}

.qa-m {
  font-size: 12.5px;
  color: var(--text-muted)
}

.schools {
  display: grid;
  gap: 10px;
  margin-top: 14px
}

.school {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--t)
}

.school:hover {
  border-color: var(--primary)
}

.map-pin {
  font-size: 24px;
  flex-shrink: 0
}

.school-info {
  flex: 1;
  min-width: 0
}

.school h4 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700
}

.school p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted)
}

/* ===== PRICING ===== */
.prices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 1080px;
  margin: 0 auto
}

.price {
  position: relative;
  padding: 28px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border)
}

.price.hot {
  border-color: var(--primary);
  box-shadow: 0 30px 60px -20px color-mix(in srgb, var(--primary) 40%, transparent);
  transform: scale(1.03)
}

.hot-tag {
  position: absolute;
  top: -12px;
  right: 24px;
  padding: 4px 14px;
  border-radius: 99px;
  background: var(--grad-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700
}

.price-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline
}

.price-h h3 {
  margin: 0;
  font-size: 22px
}

.price-n {
  font-size: 40px;
  font-weight: 800;
  margin: 14px 0;
  line-height: 1
}

.price-n span {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted)
}

.price ul {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: grid;
  gap: 8px;
  font-size: 14px
}

.price li {
  padding: 6px 0;
  color: var(--text-muted)
}

.price li.dim {
  color: color-mix(in srgb, var(--text-muted) 70%, transparent);
  font-style: italic
}

/* ===== TESTIMONIALS ===== */
.tests {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px
}

.test {
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm)
}

.test p {
  margin: 0 0 18px;
  font-size: 15.5px;
  line-height: 1.65;
  font-style: italic
}

.test footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px
}

.test footer b {
  font-size: 14px;
  display: block
}

.test footer span {
  color: var(--text-muted);
  font-size: 12.5px
}

.test .rt {
  margin-left: auto;
  color: #f59e0b;
  font-size: 13px;
  letter-spacing: 1px
}

/* ===== FAQ ===== */
.faq {
  display: grid;
  gap: 8px
}

.faq details {
  padding: 18px 22px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--t)
}

.faq details[open] {
  border-color: var(--primary)
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none
}

.faq summary::-webkit-details-marker {
  display: none
}

.faq summary::after {
  content: "+";
  font-size: 22px;
  font-weight: 300;
  color: var(--text-muted);
  transition: transform var(--t)
}

.faq details[open] summary::after {
  transform: rotate(45deg)
}

.faq summary>div,
.faq details>div {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.7
}

/* ===== CTA STRIP ===== */
.cta-strip {
  background: var(--grad-brand);
  color: #fff;
  padding: 64px 0;
  position: relative;
  overflow: hidden
}

.cta-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .18), transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, .12), transparent 40%)
}

.cta-wrap {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px
}

.cta-wrap h2 {
  margin: 0 0 6px;
  font-size: 32px;
  font-weight: 800;
  color: #fff
}

.cta-wrap p {
  margin: 0;
  color: rgba(255, 255, 255, .85)
}

/* ===== FOOTER (works whether <footer> has class .ftr or not) ===== */
body>footer,
footer.ftr {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding: 64px 0 24px;
  margin-top: 0;
}

body>footer .container,
footer.ftr .container {
  width: 100%;
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
}

body>footer .ftr-grid,
footer.ftr .ftr-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr) 1.4fr;
  gap: 32px;
  align-items: start;
}

body>footer h5,
footer.ftr h5 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

body>footer a,
footer.ftr a {
  display: block;
  padding: 5px 0;
  color: var(--text-muted);
  font-size: 14px;
  transition: color var(--t);
  text-decoration: none;
}

body>footer a:hover,
footer.ftr a:hover {
  color: var(--primary);
}

body>footer .muted,
footer.ftr .muted {
  color: var(--text-muted);
  margin: 10px 0;
  font-size: 14px;
}

body>footer .brand,
footer.ftr .brand {
  margin-bottom: 6px;
}

.socials {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.socials a {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0;
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.socials a:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.socials a svg.i {
  display: block;
}

.news {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.news input {
  flex: 1 1 140px;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--text);
}

.news input:focus {
  outline: 0;
  border-color: var(--primary);
}

body>footer .ftr-bot,
footer.ftr .ftr-bot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width:768px) {

  body>footer .ftr-bot,
  footer.ftr .ftr-bot {
    padding-right: 0;
  }
}

.small {
  font-size: 13px
}

.tiny {
  font-size: 11.5px
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 99px;
  background: var(--grad-brand);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 16px 32px -10px var(--primary);
  transition: transform var(--t)
}

.fab:hover {
  transform: translateY(-3px) scale(1.04)
}

.fab>span:first-child {
  font-size: 22px
}

.fab-t {
  text-align: left;
  line-height: 1.2
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: none;
  justify-content: space-around;
  align-items: center;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--surface) 90%, transparent)
}

.bn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 500
}

.bn span:first-child {
  font-size: 20px
}

.bn.active {
  color: var(--primary)
}

/* ===== MOBILE DRAWER ===== */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--surface);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideR var(--t)
}

@keyframes slideR {
  from {
    translate: 100% 0
  }

  to {
    translate: 0 0
  }
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px
}

.drawer a {
  padding: 14px 12px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  border-bottom: 1px solid var(--border)
}

.drawer a:active {
  background: var(--surface-2)
}

#drawerCta {
  margin-top: 18px
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(11, 18, 32, .6);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn var(--t);
  backdrop-filter: blur(6px)
}

.modal[hidden] {
  display: none !important
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.modal-bd {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: popIn var(--t)
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(.9)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

.modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px
}

.modal-emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 8px
}

.modal-bd h3 {
  margin: 0 0 6px;
  font-size: 22px
}

.modal-bd input[type=email],
.modal-bd input[type=text],
.modal-bd input[type=password],
.modal-bd input[type=tel],
.modal-bd input[type=number] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin: 14px 0;
  font-size: 15px
}

.modal-bd input[type=email]:focus,
.modal-bd input[type=text]:focus,
.modal-bd input[type=password]:focus,
.modal-bd input[type=tel]:focus,
.modal-bd input[type=number]:focus {
  outline: 0;
  border-color: var(--primary)
}

.modal-sign {
  max-width: 520px;
  text-align: left;
  padding: 28px
}

.modal-sign h3 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25
}

.modal-sign #signSub {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace
}

.modal-sign #signSub b {
  color: var(--text);
  font-weight: 700
}

.modal-sign #signMeaning {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 4px solid var(--primary)
}

.sign-hero {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 24px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 50%),
    radial-gradient(circle at 70% 80%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 50%),
    linear-gradient(135deg, var(--surface-2), var(--surface-3));
  margin-bottom: 18px;
  border: 1px solid var(--border)
}

.sign-hero .sg-svg {
  filter: drop-shadow(0 16px 40px rgba(11, 18, 32, .18))
}

[data-theme="dark"] .sign-hero .sg-svg {
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, .6))
}

.sign-hero-img {
  display: block;
  max-width: 200px;
  max-height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 16px 40px rgba(11, 18, 32, .18))
}

[data-theme="dark"] .sign-hero-img {
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, .6))
}

.sign-flash {
  display: flex;
  gap: 10px;
  margin-top: 18px
}

.sign-flash .btn {
  flex: 1;
  justify-content: center;
  padding: 12px 16px
}

/* ===== TOAST ===== */
.toasts {
  position: fixed;
  top: calc(var(--hdr-h) + 12px);
  right: 14px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none
}

.toast {
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  font-size: 14px;
  animation: slideIn .3s, slideOut .3s 3.7s forwards;
  min-width: 240px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px
}

.toast.success {
  border-left: 4px solid var(--success)
}

.toast.error {
  border-left: 4px solid var(--danger)
}

.toast.info {
  border-left: 4px solid var(--primary)
}

.toast.xp {
  background: var(--grad-brand);
  color: #fff;
  border: 0
}

@keyframes slideIn {
  from {
    opacity: 0;
    translate: 30px 0
  }

  to {
    opacity: 1;
    translate: 0 0
  }
}

@keyframes slideOut {
  to {
    opacity: 0;
    translate: 30px 0
  }
}

/* ============================================================
   LESSON PAGE — 600-question study experience (ly-thuyet.html)
   ============================================================ */
.lt-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  margin-bottom: 24px;
  align-items: start;
}

@media (max-width:960px) {
  .lt-shell {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.lt-side {
  position: sticky;
  top: calc(var(--hdr-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--hdr-h) - 32px);
  overflow: auto;
}

/* Mobile: drop sticky so the sidebar scrolls with the page instead of
   eating viewport room above the question card. */
@media (max-width: 960px) {
  .lt-side {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
  }
}

.lt-side-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lt-side-h h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.lt-progress {
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.lt-chapters {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lt-chapter-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}

.lt-chapter-btn:hover {
  background: var(--surface-2);
}

.lt-chapter-btn.active {
  background: color-mix(in srgb, var(--c, var(--primary)) 14%, var(--surface));
  color: var(--c, var(--primary));
  font-weight: 700;
}

.lt-ch-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--c, var(--primary)) 14%, transparent);
  color: var(--c, var(--primary));
  font-weight: 800;
  font-size: 11.5px;
  flex-shrink: 0;
}

.lt-ch-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lt-ch-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 12px;
}

.lt-grid-wrap {
  max-height: 480px;
  overflow-y: auto;
  padding: 2px;
}

.lt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 4px;
}

.lt-cell {
  display: grid;
  place-items: center;
  height: 30px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--t-fast);
  font-variant-numeric: tabular-nums;
}

.lt-cell:hover {
  transform: scale(1.1);
  border-color: var(--primary);
  z-index: 2;
  position: relative;
}

.lt-cell.ok {
  background: color-mix(in srgb, var(--success) 28%, var(--surface-2));
  color: var(--success);
}

.lt-cell.bad {
  background: color-mix(in srgb, var(--danger) 28%, var(--surface-2));
  color: var(--danger);
}

.lt-cell.crit {
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

.lt-cell.mark {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.lt-cell.crit.mark {
  box-shadow: inset 0 0 0 1.5px var(--danger), inset 0 0 0 3px var(--accent);
}

.lt-cell.current {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  transform: scale(1.05);
  z-index: 3;
  position: relative;
}

.lt-side-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.lt-side-legend>div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lt-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.lt-legend-dot.ok {
  background: color-mix(in srgb, var(--success) 28%, var(--surface-2));
}

.lt-legend-dot.bad {
  background: color-mix(in srgb, var(--danger) 28%, var(--surface-2));
}

.lt-legend-dot.crit {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

.lt-legend-dot.mark {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.lt-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.lt-side-actions .btn {
  font-size: 12px;
  padding: 6px 10px;
}

/* Main column — stacks the question card and the question-grid card */
.lt-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* Main study card */
.lt-main-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  /* Leave room for the sticky header when scrollIntoView lands here */
  scroll-margin-top: calc(var(--hdr-h) + 16px);
}

.lt-grid-card {
  scroll-margin-top: calc(var(--hdr-h) + 16px);
}

/* Mobile floating quick-jump to the question grid */
.lt-fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  z-index: 40;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 16px 32px -10px var(--primary);
  transition: transform var(--t-fast);
}

.lt-fab:hover,
.lt-fab:focus-visible {
  transform: translateY(-3px) scale(1.05);
  outline: none;
}

.lt-fab:active {
  transform: scale(0.95);
}

@media (max-width: 960px) {
  .lt-fab {
    display: inline-flex;
  }
}

/* Full-width section that holds the question grid below the shell */
.lt-grid-section {
  margin-bottom: 64px;
}

/* Question-grid card */
.lt-grid-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lt-grid-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.lt-grid-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.lt-grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.lt-grid-legend > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 600px) {
  .lt-grid-card {
    padding: 14px 14px 16px;
    gap: 10px;
  }
  .lt-grid-legend {
    gap: 10px;
    font-size: 11.5px;
  }
}

.lt-q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.lt-q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lt-q-actions {
  display: flex;
  gap: 4px;
}

.lt-q-actions .icon-btn {
  width: 36px;
  height: 36px;
}

.lt-q-actions .icon-btn.active,
.lt-q-actions .icon-btn:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.lt-q-text {
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 700;
  line-height: 1.5;
  margin: 14px 0 16px;
}

.lt-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.lt-stats {
  font-size: 13.5px;
  color: var(--text-muted);
}

.lt-stats b {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width:560px) {
  .lt-stats {
    width: 100%;
    text-align: center;
    order: 3;
  }

  .lt-nav .btn {
    flex: 1;
  }
}

/* ============================================================
   AUTH WIDGETS — header user chip + login modal
   ============================================================ */
.auth-out,
.auth-in {
  display: contents;
}

.auth-out[hidden],
.auth-in[hidden] {
  display: none !important;
}

.auth-out {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-in {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  transition: all var(--t-fast);
  cursor: pointer;
}

.user-chip:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.user-avt {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

.user-avt.lg {
  width: 44px;
  height: 44px;
  font-size: 17px;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  animation: fadeUp .2s;
}

.user-menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.user-menu-name {
  font-weight: 700;
  font-size: 14px;
}

.user-menu-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
}

.user-menu-item:hover {
  background: var(--surface-2);
}

/* === AUTH MODAL === */
.auth-modal {
  max-width: 440px;
  padding: 28px 28px 24px;
  text-align: left;
}

.auth-tabs {
  display: flex;
  gap: 0;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  transition: all var(--t-fast);
  cursor: pointer;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-body h3 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
}

.auth-body p.muted {
  margin: 0 0 18px;
  font-size: 14px;
}

.auth-field {
  display: block;
  margin-bottom: 14px;
}

.auth-field span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  box-sizing: border-box;
  transition: border-color var(--t);
}

.auth-field input:focus {
  outline: 0;
  border-color: var(--primary);
}

.auth-error {
  padding: 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 14px;
  animation: fadeUp .2s;
}

.auth-divider {
  text-align: center;
  position: relative;
  margin: 18px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  z-index: 0;
}

.auth-divider span {
  position: relative;
  z-index: 1;
  padding: 0 12px;
  background: var(--surface);
}

.auth-skip {
  text-align: center;
  margin: 0;
}

.auth-link {
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

@media (max-width:768px) {
  .user-name {
    display: none;
  }

  .auth-out .btn:not(.primary) {
    display: none;
  }
}

/* ============================================================
   ICON SYSTEM
   ============================================================ */
svg.i {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0
}

[data-i] {
  display: inline-flex;
  align-items: center;
  justify-content: center
}

[data-i]:not([data-i-loaded]) {
  min-width: 20px;
  min-height: 20px
}

.i-stack {
  display: inline-flex;
  align-items: center;
  gap: 8px
}

.i-circle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text)
}

.i-circle.lg {
  width: 54px;
  height: 54px;
  border-radius: 14px
}

.i-circle.xl {
  width: 80px;
  height: 80px;
  border-radius: 20px
}

.i-grad {
  background: var(--grad-brand);
  color: #fff
}

.i-soft {
  background: linear-gradient(135deg, color-mix(in srgb, var(--c1) 14%, transparent), color-mix(in srgb, var(--c2) 14%, transparent));
  color: var(--c1)
}

/* ============================================================
   LESSON HUB — chapter cards
   ============================================================ */
.hub {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px
}

.hub-card {
  position: relative;
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  overflow: hidden
}

.hub-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--c)
}

.hub-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c)
}

.hub-card-h {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px
}

.hub-num {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, transparent), color-mix(in srgb, var(--c) 6%, transparent));
  color: var(--c)
}

.hub-meta {
  flex: 1;
  min-width: 0
}

.hub-meta h3 {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3
}

.hub-meta p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted)
}

.hub-pct {
  font-weight: 800;
  color: var(--c);
  font-size: 20px;
  font-variant-numeric: tabular-nums
}

.hub-bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 12px
}

.hub-bar i {
  display: block;
  height: 100%;
  background: var(--c);
  border-radius: 99px;
  transition: width var(--t-slow)
}

.hub-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted)
}

.hub-stats b {
  color: var(--text);
  font-weight: 700
}

.hub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px
}

.hub-tag {
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2)
}

.hub-tag.crit {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger)
}

.hub-tag.fav {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent)
}

.hub-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center
}

/* ============================================================
   ONBOARDING WIZARD
   ============================================================ */
.wizard-bd {
  max-width: 680px !important;
  width: 100%;
  padding: 32px;
  text-align: left
}

.wiz-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  justify-content: center;
  flex-wrap: wrap
}

.wiz-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--t)
}

.wiz-step span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  font-weight: 800;
  font-size: 12px
}

.wiz-step.active {
  background: var(--primary);
  color: #fff
}

.wiz-step.active span {
  background: #fff;
  color: var(--primary)
}

.wiz-step.done {
  background: var(--success);
  color: #fff
}

.wiz-step.done span {
  background: #fff;
  color: var(--success)
}

.wiz-step.done span::before {
  content: "✓"
}

.wiz-step.done span:not(:empty) {
  font-size: 0
}

.wiz-step.done span::after {
  font-size: 13px
}

.wiz-line {
  flex: 0 0 18px;
  height: 2px;
  background: var(--border)
}

.wiz-pane {
  display: none;
  animation: fadeUp .3s
}

.wiz-pane.active {
  display: block
}

.wizard-bd h3 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 800
}

.wizard-bd p.muted {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--text-muted)
}

.wiz-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px
}

@media(min-width:560px) {
  .wiz-grid {
    grid-template-columns: repeat(4, 1fr)
  }
}

.wiz-card {
  position: relative;
  padding: 14px 10px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  text-align: center;
  transition: all var(--t)
}

.wiz-card:hover {
  border-color: var(--primary)
}

.wiz-card.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  box-shadow: 0 8px 24px -8px var(--primary)
}

.wiz-card b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
  margin-bottom: 4px
}

.wiz-card span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px
}

.wiz-card small {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted)
}

.wiz-card.popular em {
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  font-style: normal
}

.wiz-date {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 12px;
  cursor: pointer;
  color: var(--text)
}

.wiz-date:focus {
  outline: 0;
  border-color: var(--primary)
}

.wiz-date::placeholder {
  color: var(--text-muted)
}

/* ============================================================
   FLATPICKR — only color/typography overrides.
   Do NOT override layout (width/flex/grid) — Flatpickr calculates these
   from the inner container and overriding breaks the day grid.
   ============================================================ */
.flatpickr-calendar {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
  border-radius: 14px !important;
  font-family: inherit !important;
  padding: 6px !important
}

.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before,
.flatpickr-calendar.arrowBottom::after {
  display: none !important
}

/* Header */
.flatpickr-months {
  padding-bottom: 6px
}

.flatpickr-month {
  color: var(--text) !important;
  background: transparent !important;
  border-radius: 0 !important;
  height: 36px !important;
  overflow: visible !important
}

.flatpickr-current-month {
  font-size: 15px !important;
  font-weight: 700 !important;
  padding: 6px 10px 0 !important
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
  color: var(--text) !important;
  background: transparent !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
  background: var(--surface-2) !important
}

.flatpickr-current-month .flatpickr-monthDropdown-months option {
  background: var(--surface) !important;
  color: var(--text) !important
}

.flatpickr-current-month input.cur-year {
  color: var(--text) !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  background: transparent !important
}

.flatpickr-prev-month,
.flatpickr-next-month {
  fill: var(--text) !important;
  color: var(--text) !important;
  padding: 8px !important;
  border-radius: 8px !important
}

.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
  background: var(--surface-2) !important
}

.flatpickr-prev-month svg,
.flatpickr-next-month svg {
  fill: currentColor !important
}

/* Weekday header — keep default flex layout */
.flatpickr-weekdays {
  background: transparent !important
}

.flatpickr-weekdaycontainer {
  padding: 0 4px
}

span.flatpickr-weekday {
  color: var(--text-muted) !important;
  background: transparent !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important
}

/* Days — keep default flex/width, only override colors */
.flatpickr-days {
  padding: 0 4px 6px
}

.flatpickr-day {
  color: var(--text) !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  border-color: transparent !important;
  transition: background var(--t-fast), color var(--t-fast) !important
}

.flatpickr-day:hover {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: transparent !important
}

.flatpickr-day.today {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  font-weight: 700 !important;
  background: transparent !important
}

.flatpickr-day.today:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  color: var(--accent) !important
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
  font-weight: 700 !important;
  box-shadow: 0 6px 14px -6px var(--primary)
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
  color: var(--text-muted) !important;
  opacity: .35 !important;
  cursor: not-allowed !important;
  background: transparent !important
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: var(--text-muted) !important;
  opacity: .45 !important
}

/* Year input arrows */
.numInputWrapper span.arrowUp,
.numInputWrapper span.arrowDown {
  border-color: transparent !important;
  opacity: .6
}

.numInputWrapper span.arrowUp::after {
  border-bottom-color: var(--text) !important
}

.numInputWrapper span.arrowDown::after {
  border-top-color: var(--text) !important
}

.numInputWrapper:hover {
  background: var(--surface-2) !important;
  border-radius: 6px !important
}

.wiz-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px
}

.wiz-quick button {
  padding: 8px 16px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--t)
}

.wiz-quick button:hover {
  border-color: var(--primary)
}

.wiz-quick button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary)
}

.wiz-info {
  padding: 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--info) 8%, var(--surface));
  border-left: 4px solid var(--info);
  font-size: 14px;
  color: var(--text);
  margin-bottom: 18px
}

.wiz-radios {
  display: grid;
  gap: 8px;
  margin-bottom: 22px
}

.wiz-radio {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all var(--t);
  user-select: none
}

.wiz-radio:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border))
}

.wiz-radio:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  box-shadow: 0 8px 24px -10px var(--primary)
}

.wiz-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0
}

.wiz-rdot {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  position: relative;
  transition: border-color var(--t), background var(--t)
}

.wiz-radio:has(input:checked) .wiz-rdot {
  border-color: var(--primary);
  background: var(--primary)
}

.wiz-radio:has(input:checked) .wiz-rdot::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #fff
}

.wiz-rtxt {
  flex: 1;
  min-width: 0
}

.wiz-rtxt b {
  display: block;
  font-weight: 700;
  margin-bottom: 2px;
  font-size: 15px
}

.wiz-rtxt small {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4
}

.wiz-mini {
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 700
}

.wiz-slider input[type=range] {
  width: 100%;
  accent-color: var(--primary);
  height: 6px
}

.wiz-min-out {
  text-align: center;
  font-size: 14px;
  margin-top: 8px
}

.wiz-min-out span {
  font-weight: 800;
  font-size: 22px;
  color: var(--primary)
}

.wiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border)
}

.wiz-result {
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--primary) 8%, var(--surface)),
      color-mix(in srgb, var(--accent) 6%, var(--surface)));
  border: 1px solid var(--border)
}

.wiz-result h3 {
  font-size: 22px;
  margin: 0 0 8px
}

.wiz-result h3 b {
  color: var(--primary)
}

.wiz-result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0
}

.wiz-result-stat {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  text-align: center
}

.wiz-result-stat b {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1
}

.wiz-result-stat span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px
}

.wiz-result-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none
}

.wiz-result-list li {
  padding: 8px 0;
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start
}

.wiz-result-list li::before {
  content: "✓";
  color: var(--success);
  font-weight: 800
}

/* ============================================================
   COMMAND PALETTE (Cmd+K)
   ============================================================ */
#cmdk {
  align-items: flex-start;
  padding-top: max(80px, 12vh)
}

.cmdk-bd {
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popIn var(--t)
}

.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border)
}

.cmdk-input-wrap svg {
  color: var(--text-muted);
  flex-shrink: 0
}

.cmdk-input-wrap input {
  flex: 1;
  border: 0;
  background: none;
  outline: 0;
  font-size: 16px;
  color: var(--text)
}

.cmdk-input-wrap input::placeholder {
  color: var(--text-muted)
}

.cmdk-input-wrap kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted)
}

.cmdk-list {
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px
}

.cmdk-group {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14.5px;
  transition: background var(--t-fast)
}

.cmdk-item:hover,
.cmdk-item.active {
  background: var(--surface-2)
}

.cmdk-item.active {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-2))
}

.cmdk-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
  flex-shrink: 0
}

.cmdk-text {
  flex: 1;
  min-width: 0
}

.cmdk-text b {
  display: block;
  font-weight: 600
}

.cmdk-text span {
  display: block;
  font-size: 12px;
  color: var(--text-muted)
}

.cmdk-shortcut {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted)
}

.cmdk-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px
}

.cmdk-foot {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface-2)
}

.cmdk-foot kbd {
  font-family: 'JetBrains Mono', monospace;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-right: 4px
}

/* ===== OFFLINE BAR ===== */
.offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 8px 14px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  animation: slideDown var(--t)
}

@keyframes slideDown {
  from {
    translate: 0 -100%
  }

  to {
    translate: 0 0
  }
}

/* ===== INSTALL PROMPT ===== */
.install-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bnav-h) + 80px);
  translate: -50% 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: calc(100% - 28px);
  animation: popUp .4s cubic-bezier(.2, .8, .2, 1)
}

@keyframes popUp {
  from {
    opacity: 0;
    translate: -50% 30px
  }

  to {
    opacity: 1;
    translate: -50% 0
  }
}

.install-icon {
  font-size: 30px;
  flex-shrink: 0
}

.install-body {
  flex: 1;
  min-width: 0
}

.install-t {
  font-weight: 700;
  font-size: 14.5px
}

.install-s {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px
}

/* ===== RESPONSIVE ===== */
@media (max-width:1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px
  }

  .hero-mock {
    height: 420px;
    max-width: 520px;
    margin: 0 auto
  }

  .feat-grid,
  .prices,
  .tests {
    grid-template-columns: repeat(2, 1fr)
  }

  .dash-grid {
    grid-template-columns: repeat(2, 1fr)
  }

  .d-card.span-2 {
    grid-column: span 2
  }

  body>footer .ftr-grid,
  footer.ftr .ftr-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 28px
  }

  .sim {
    grid-template-columns: 1fr
  }

  .two-col {
    grid-template-columns: 1fr;
    gap: 40px
  }
}

@media (max-width:768px) {

  .nav,
  .hdr-actions .btn {
    display: none
  }

  .menu-btn {
    display: inline-flex
  }

  .sect {
    padding: 64px 0
  }

  .feat-grid,
  .prices,
  .tests {
    grid-template-columns: 1fr
  }

  .dash-grid {
    grid-template-columns: 1fr
  }

  .d-card.span-2 {
    grid-column: span 1
  }

  body>footer .ftr-grid,
  footer.ftr .ftr-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px
  }

  body>footer .ftr-bot,
  footer.ftr .ftr-bot {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px
  }

  .bottom-nav {
    display: flex
  }

  body {
    padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px) + 16px)
  }

  /* Quiz stats compact on narrow screens — avoid cramming into bottom-nav */
  .quiz-bot {
    gap: 10px;
    padding-top: 14px;
  }

  .quiz-stats {
    gap: 10px;
    font-size: 12.5px;
    flex-wrap: wrap;
  }

  .quiz-stats span {
    white-space: nowrap;
  }

  .h-display {
    font-size: 44px
  }

  .lede {
    font-size: 16px
  }

  .hero {
    padding-bottom: 48px
  }

  .hero-mock {
    height: 380px
  }

  .quiz-bot {
    flex-direction: column;
    align-items: stretch
  }

  .quiz-stats {
    justify-content: space-between
  }

  .price.hot {
    transform: none
  }

  .fab-t {
    display: none
  }

  .fab {
    padding: 14px;
    width: 56px;
    height: 56px;
    justify-content: center
  }

  .scroll-down {
    display: none
  }
}

@media (max-width:480px) {

  body>footer .ftr-grid,
  footer.ftr .ftr-grid {
    grid-template-columns: 1fr;
    gap: 22px
  }

  .sect-head {
    margin-bottom: 36px
  }

  .card-elev {
    padding: 20px
  }

  .hero-mock {
    display: none
  }

  .hero {
    padding-top: 24px
  }

  /* ===== Hero CTAs full-width on tiny screens ===== */
  .cta-row .btn {
    flex: 1 1 100%
  }

  .trust {
    gap: 14px;
    font-size: 13px
  }

  .class-row {
    gap: 6px
  }

  .cls {
    padding: 7px 12px;
    font-size: 13px
  }

  /* ===== SignGame: 5 stats → 2 cols (was 3 at ≤640) ===== */
  .sgame-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding-bottom: 16px;
    margin-bottom: 16px
  }

  .sgame-stat {
    padding: 8px 10px;
    gap: 8px
  }

  .sgame-stat-i {
    width: 30px;
    height: 30px
  }

  .sgame-stat b {
    font-size: 16px
  }

  .sgame-stat span {
    font-size: 10.5px
  }

  .sgame {
    padding: 14px
  }

  .sgame-image-wrap {
    padding: 16px;
    margin-bottom: 16px
  }

  .sgame-image {
    max-width: 140px;
    max-height: 140px
  }

  .sgame-prompt {
    font-size: 16px;
    margin-bottom: 14px
  }

  .sgame-feedback {
    font-size: 12px;
    padding: 4px 10px
  }

  .sgame-filters {
    gap: 5px
  }

  .sgame-filter {
    height: 30px;
    padding: 0 11px;
    font-size: 12.5px
  }

  /* ===== Exam header stacks vertically ===== */
  .exam-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px
  }

  .exam-meta {
    flex-direction: column;
    gap: 2px
  }

  /* ===== Dash demo on home — stack streak below greeting ===== */
  .dash-top {
    flex-direction: column;
    align-items: stretch;
    gap: 14px
  }

  .dash-streak {
    align-self: flex-start
  }

  /* ===== Section-header h2 size — avoid 2-line giant titles ===== */
  .sect-head h2 {
    font-size: 26px;
    line-height: 1.2
  }

  .sect-head p {
    font-size: 14px
  }

  /* ===== Container side padding tighter ===== */
  .container {
    padding-left: 16px;
    padding-right: 16px
  }
}

/* ============================================================
   DASHBOARD PAGE — extras for /dashboard.html
   ============================================================ */
.dash-welcome {
  margin: 0 0 22px;
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, transparent), color-mix(in srgb, var(--accent) 12%, transparent));
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
  color: var(--text);
  font-size: 14.5px;
  animation: dashWelcomeIn .5s ease both;
}

@keyframes dashWelcomeIn {
  from {
    opacity: 0;
    transform: translateY(-8px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.dash-gate {
  display: grid;
  place-items: center;
  min-height: 60vh;
}

.dash-gate-card {
  max-width: 480px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-md, 0 16px 40px -12px rgba(0, 0, 0, .18));
}

.dash-gate-i {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 18px;
  background: var(--grad-brand);
  color: #fff;
}

.dash-gate-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 800;
}

.dash-gate-cta {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

.dash-loading {
  display: grid;
  place-items: center;
  min-height: 50vh;
  gap: 14px;
}

.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 22px 0 26px;
}

.dstat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.dstat:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -12px rgba(0, 102, 255, .2);
}

.dstat-i {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  flex-shrink: 0;
}

.dstat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.dstat span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .dash-stats-row {
    grid-template-columns: repeat(2, 1fr)
  }
}

.dash-spark-wrap {
  width: 100%;
  height: 120px;
  margin: 6px 0 4px;
}

#dashSpark {
  width: 100%;
  height: 100%;
  display: block;
}

.dash-activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-activity li {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
}

.dash-activity .act-redo {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--t-fast);
}

.dash-activity .act-redo:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Generic pager (used by recent activity) */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pager-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pager-gap {
  color: var(--text-muted);
  padding: 0 4px;
  font-size: 13px;
}

.dash-activity .act-kind {
  font-weight: 700;
  font-size: 12.5px;
}

.dash-activity .act-quiz {
  color: #0066ff
}

.dash-activity .act-exam {
  color: #f59e0b
}

.dash-activity .act-sim {
  color: #ef4444
}

.dash-activity .act-sgame {
  color: #10b981
}

.dash-activity .act-score {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
}

.dash-activity .act-pass {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: color-mix(in srgb, #10b981 18%, transparent);
  color: #10b981;
}

.dash-activity .act-fail {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: color-mix(in srgb, #ef4444 18%, transparent);
  color: #ef4444;
}

.dash-activity .act-when {
  font-size: 12px
}

@media (max-width: 560px) {
  .dash-activity li {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: 'kind score pass' 'when when redo';
    gap: 6px 10px;
  }

  .dash-activity .act-kind {
    grid-area: kind
  }

  .dash-activity .act-score {
    grid-area: score;
    justify-self: end
  }

  .dash-activity .act-pass,
  .dash-activity .act-fail {
    grid-area: pass
  }

  .dash-activity .act-when {
    grid-area: when;
    font-size: 11.5px
  }

  .dash-activity .act-redo {
    grid-area: redo;
    justify-self: end;
    font-size: 11.5px;
    padding: 4px 8px
  }
}

.dash-best {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-best li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
}

.dash-best b {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  color: var(--primary);
}

.chip.chip-up {
  background: color-mix(in srgb, #10b981 18%, transparent);
  color: #10b981;
}

.chip.chip-down {
  background: color-mix(in srgb, #ef4444 18%, transparent);
  color: #ef4444;
}

/* ============================================================
   MOBILE PLAYER MÔ PHỎNG — UX overrides
   ============================================================ */
.sim-mb-bar {
  display: none
}

@media (pointer: coarse),
(max-width: 768px) {

  /* tap targets */
  .sim-zoom-controls button {
    width: 44px;
    height: 44px;
    border-radius: 10px
  }

  .sim-hint-toggle {
    padding: 10px 14px;
    min-height: 44px;
    font-size: 13px
  }

  /* drop noisy zoom buttons — pinch + double-tap replace them */
  .sim-zoom-controls #simZoomOut,
  .sim-zoom-controls #simZoomIn,
  .sim-zoom-controls #simZoomReset,
  .sim-zoom-controls .sim-zoom-level {
    display: none
  }

  /* safe-area aware bottom anchor (avoid bottom-nav overlap) */
  .sim-zoom-controls {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 4px
  }

  .sim-hint-toggle {
    top: calc(12px + env(safe-area-inset-top, 0px))
  }

  .sim-time-badge {
    top: calc(12px + env(safe-area-inset-top, 0px))
  }

  /* Floating mobile bar inside video stage (sticky-feel even when scrolling) */
  .sim-mb-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    /* Don't cover the zoom controls — start after them */
  }

  .sim-mb-bar>* {
    pointer-events: auto
  }

  /* Score chip on left */
  .sim-mb-score {
    margin-left: auto;
    background: rgba(0, 0, 0, .68);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 14px;
    padding: 6px 12px;
    text-align: center;
    color: #fff;
    min-width: 64px
  }

  .sim-mb-pts {
    font-size: 22px;
    font-weight: 800;
    line-height: 1
  }

  .sim-mb-pts-l {
    font-size: 10px;
    opacity: .8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em
  }

  /* Big GẮN CỜ button — primary thumb action */
  .sim-mb-flag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 22px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .04em;
    border: none;
    box-shadow: 0 12px 28px -8px rgba(239, 68, 68, .55), inset 0 1px 0 rgba(255, 255, 255, .18);
    transition: transform var(--t-fast), opacity var(--t-fast);
    cursor: pointer
  }

  .sim-mb-flag:active {
    transform: scale(.95)
  }

  .sim-mb-flag:disabled {
    opacity: .4;
    box-shadow: none;
    cursor: not-allowed
  }

  /* Exit FS button — only shows in pseudo-fs */
  .sim-mb-fs {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    background: rgba(0, 0, 0, .68);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .15);
    color: #fff;
    line-height: 0;
  }

  .sim-mb-fs > * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Side panel: shrink keys/picker on mobile, hide redundant kb hints */
  .sim-keys {
    display: none
  }

  .sim-side-panel {
    padding: 16px
  }

  /* Simplify keyboard kb chip presence — already hidden */
}

/* Pseudo-fullscreen (mobile-first; preserves overlays unlike native iOS FS) */
.sim-scene.pseudo-fs {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  z-index: 9999;
  background: #000
}

.sim-scene.pseudo-fs .sim-video {
  object-fit: contain
}

body.sim-fs-active {
  overflow: hidden
}

body.sim-fs-active .bottom-nav,
body.sim-fs-active .hdr,
body.sim-fs-active .fab {
  display: none !important
}

.sim-scene.pseudo-fs .sim-mb-fs {
  display: inline-flex
}

/* ============================================================
   FULLSCREEN OVERLAYS — progress bar + scenario menu (2026-05-08)
   ============================================================ */

/* In fullscreen the .sim-bar (timing zones) lives outside .sim-scene
   so it'd disappear. Pin it as a glassy overlay above the mobile bar.
   z-index must beat .sim-scene.pseudo-fs (9999) so it sits on top. */
body.sim-fs-active .sim-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  z-index: 10000;
  margin: 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  pointer-events: none;
}

/* PC pseudo-fs has no mobile floating bar reserving 86px — drop the bar
   to a comfortable 24px from bottom so it doesn't float in dead space. */
@media (hover: hover) and (pointer: fine) {
  body.sim-fs-active .sim-bar {
    bottom: 24px;
  }
}

/* When the Danh sách side panel is open, shrink the bar so it stops at
   the panel edge instead of bleeding under it. */
body.sim-fs-active.sim-fs-list-open .sim-bar {
  right: calc(min(86vw, 380px) + 16px);
}

/* User asked: ẩn gợi ý → ẩn luôn thanh thời gian (no scoring zones means
   the bar is just dead chrome — keep the screen clean). */
#sim.hint-off .sim-bar {
  display: none;
}

/* Move the 0.00s time badge below the hint toggle in fullscreen so it
   stops fighting the menu pill at top-right. */
body.sim-fs-active .sim-time-badge {
  top: calc(56px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: auto;
}

/* Top overlay buttons should clear the iOS notch in fullscreen */
body.sim-fs-active .sim-hint-toggle {
  top: calc(12px + env(safe-area-inset-top, 0px));
}

body.sim-fs-active .sim-bar-labels,
body.sim-fs-active .sim-bar-labels .muted {
  color: rgba(255, 255, 255, .92) !important;
}

/* Floating "Danh sách" button — shown only inside pseudo-fullscreen */
.sim-fs-listbtn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 14;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  height: 36px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.sim-fs-listbtn:hover,
.sim-fs-listbtn:active {
  background: rgba(0, 0, 0, .82);
}

.sim-scene.pseudo-fs .sim-fs-listbtn,
.sim-scene:fullscreen .sim-fs-listbtn {
  display: inline-flex;
}

@media (max-width: 480px) {
  .sim-fs-listbtn-t {
    display: none;
  }

  .sim-fs-listbtn {
    padding: 8px;
    width: 36px;
    justify-content: center;
  }
}

/* Backdrop behind the slide-out panel */
.sim-list-backdrop {
  display: none;
}

body.sim-fs-list-open .sim-list-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 10000;
  animation: fsBackdropIn .18s ease-out;
}

@keyframes fsBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Slide-out scenario panel (right side, 86vw / cap 380px) */
body.sim-fs-active.sim-fs-list-open .sim-list {
  position: fixed !important;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(86vw, 380px);
  max-height: 100dvh;
  z-index: 10001;
  margin: 0;
  padding: 16px 14px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--surface, #fff);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 50px rgba(0, 0, 0, .35);
  overflow-y: auto;
  animation: fsPanelSlideIn .26s cubic-bezier(.2, .9, .25, 1.05);
}

@keyframes fsPanelSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* Hide the inline list when fullscreen is active but panel closed —
   it's a sibling of .sim-scene, so it'd dangle behind. */
body.sim-fs-active:not(.sim-fs-list-open) .sim-list {
  display: none;
}

/* ===== A11Y ===== */
@media (prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .001s !important;
    transition-duration: .001s !important
  }

  .mesh,
  .flame-big,
  .flame {
    animation: none
  }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px
}

::-webkit-scrollbar-track {
  background: var(--surface-2)
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 2px solid var(--surface-2)
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary)
}

/* selection */
::selection {
  background: color-mix(in srgb, var(--primary) 30%, transparent);
  color: var(--text)
}

/* ============================================================
   TEMP visibility tweaks (2026-05-07)
   ============================================================ */
#ctaStart {
  display: none !important;
}

#gia {
  display: none !important;
}

.drawer a[href="#gia"] {
  display: none !important;
}

/* Trung tâm thực hành — ẩn cả PC + mobile (chưa có data thật) */
#schools-col {
  display: none !important;
}

/* Khi cột trung tâm bị ẩn, để cột Cộng đồng chiếm toàn bộ width của two-col */
#cong-dong .two-col {
  grid-template-columns: 1fr !important;
}

@media (max-width: 768px) {
  .hdr-actions #loginBtn {
    display: none !important;
  }

  .cta-strip {
    display: none !important;
  }

  /* Toast: prevent horizontal overflow off-viewport on narrow screens */
  .toasts {
    left: 14px;
    right: 14px;
    max-width: calc(100vw - 28px);
  }

  .toast {
    min-width: 0;
    max-width: 100%;
    word-break: break-word;
  }

  /* Ẩn các section nặng tay trên mobile để giữ trang chủ gọn */
  #bai-hoc,
  #features,
  #dashboard,
  #cong-dong {
    display: none !important;
  }

  /* Đồng bộ: nav drawer cũng không cần link tới các section đã ẩn */
  .drawer a[href="#bai-hoc"],
  .drawer a[href="#cong-dong"] {
    display: none !important;
  }
}

/* Dashboard footer slim — links inline (override block from main footer rules) */
body>footer.ftr .ftr-bot a {
  display: inline;
  padding: 0;
}

body>footer.ftr .ftr-bot a+a {
  margin-left: 0;
}

/* ============================================================
   SIM — question list (grouped by chapter, under video)
   ============================================================ */
.sim-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  max-height: 320px;
  overflow-y: auto;
}

.sim-list-ch {
  margin-bottom: 12px;
}

.sim-list-ch:last-child {
  margin-bottom: 0;
}

.sim-list-ch-h {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
  cursor: pointer;
  user-select: none;
}

.sim-list-ch-h::before {
  content: "▶";
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--t-fast);
}

.sim-list-ch.open .sim-list-ch-h::before {
  transform: rotate(90deg);
}

.sim-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 6px;
}

.sim-list-ch:not(.open) .sim-list-grid {
  display: none;
}

.sim-list-grid button {
  position: relative;
  padding: 6px 0;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius: 6px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}

.sim-list-grid button[data-pts]::after {
  content: attr(data-pts) "đ";
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--text);
  color: var(--surface);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
  pointer-events: none;
}

.sim-list-grid button.done[data-pts]::after {
  background: #10b981;
  color: #fff;
}

.sim-list-grid button.fail[data-pts]::after {
  background: #ef4444;
  color: #fff;
}

.sim-list-grid button:hover {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface-2));
  transform: translateY(-1px);
}

.sim-list-grid button.done {
  background: color-mix(in srgb, #10b981 16%, var(--surface));
  border-color: #10b981;
  color: #10b981;
}

.sim-list-grid button.fail {
  background: color-mix(in srgb, #ef4444 14%, var(--surface));
  border-color: #ef4444;
  color: #ef4444;
}

.sim-list-grid button.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent);
}

/* SIM — pre-roll countdown overlay (over video) */
.sim-preroll {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(11, 18, 32, 0.78);
  backdrop-filter: blur(2px);
  color: #fff;
  pointer-events: none;
}

.sim-preroll-num {
  font-size: clamp(72px, 18vw, 160px);
  font-weight: 800;
  line-height: 1;
  color: #22d3ee;
  text-shadow: 0 4px 20px rgba(34, 211, 238, .5);
  animation: prerollPulse .9s ease-out;
}

.sim-preroll-l {
  margin-top: 12px;
  font-size: 15px;
  color: rgba(255, 255, 255, .78);
  font-weight: 500;
}

@keyframes prerollPulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  35% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* SIM — pre-roll countdown picker controls */
.sim-autonext {
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.sim-autonext-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sim-autonext-label b {
  color: var(--text);
}

.sim-autonext-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sim-autonext-row button {
  flex: 1 1 auto;
  min-width: 44px;
  padding: 7px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}

.sim-autonext-row button:hover {
  border-color: var(--primary);
}

.sim-autonext-row button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Mock-test question image — shown between question text and options */
.exam-img-wrap {
  display: flex;
  justify-content: center;
  margin: 14px 0 18px;
}

.exam-img {
  max-width: 100%;
  max-height: 320px;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  object-fit: contain;
}

@media (max-width: 560px) {
  .exam-img {
    max-height: 240px;
  }
}

/* Visually hidden — for screen readers only (a11y labels) */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* A11y contrast bumps — PSI flagged these for WCAG AA <4.5:1 */
.pill.pill-glow {
  color: #0048cc;
}

.badge.crit,
.chip.danger {
  color: #b91c1c;
  background: color-mix(in srgb, #ef4444 18%, transparent);
}

.quest-xp {
  color: #0048cc;
}

.quest-xp.earned {
  color: #166534;
}

.bot-name {
  color: #0048cc;
}

.t-num,
.exam-timer {
  color: #b9530a;
}

/* Slim footer (dashboard, auth pages) — when there's no .ftr-grid block above */
footer.ftr:not(:has(.ftr-grid)),
body>footer:not(:has(.ftr-grid)) {
  padding: 22px 0;
}

footer.ftr:not(:has(.ftr-grid)) .ftr-bot,
body>footer:not(:has(.ftr-grid)) .ftr-bot {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* Quiz: nút "Hoàn thành" sau khi hết 10 câu — đổi sang xanh lá để nổi bật */
.btn.q-finish {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border-color: #16a34a;
  box-shadow: 0 8px 22px rgba(34, 197, 94, .35);
}

.btn.q-finish:hover {
  box-shadow: 0 10px 28px rgba(34, 197, 94, .45);
}

/* ============================================================
   SIM — score bubble + fullscreen "Câu tiếp" button (2026-05-08)
   ============================================================ */
.sim-score-bubble {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 12;
}

.sim-score-bubble[hidden] {
  display: none;
}

.sim-score-bubble .sb-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 22px 36px;
  border-radius: 22px;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  animation: scoreBubble 1.6s cubic-bezier(.18, 1.16, .42, 1) forwards;
}

.sim-score-bubble .sb-emoji {
  font-size: 44px;
  line-height: 1;
}

.sim-score-bubble .sb-pts {
  font-size: 56px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.sim-score-bubble .sb-label {
  font-size: 14px;
  font-weight: 600;
  opacity: .85;
  letter-spacing: .04em;
}

.sim-score-bubble.sb-5 .sb-pts { color: #22c55e; }
.sim-score-bubble.sb-4 .sb-pts { color: #84cc16; }
.sim-score-bubble.sb-3 .sb-pts { color: #facc15; }
.sim-score-bubble.sb-2 .sb-pts { color: #fb923c; }
.sim-score-bubble.sb-1 .sb-pts,
.sim-score-bubble.sb-0 .sb-pts { color: #ef4444; }

@keyframes scoreBubble {
  0%   { transform: scale(.45) translateY(20px); opacity: 0; }
  18%  { transform: scale(1.18) translateY(0);   opacity: 1; }
  30%  { transform: scale(1)    translateY(0);   opacity: 1; }
  82%  { transform: scale(1)    translateY(0);   opacity: 1; }
  100% { transform: scale(.92)  translateY(-18px); opacity: 0; }
}

/* "Câu tiếp" pill — fullscreen-only, includes countdown badge */
.sim-fs-next {
  position: absolute;
  right: 18px;
  bottom: 22px;
  z-index: 14;
  padding: 14px 20px 14px 22px;
  border-radius: 99px;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: none;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(0, 102, 255, .45);
  animation: fsNextIn .28s ease-out;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.sim-fs-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(0, 102, 255, .55);
}

.sim-fs-next .sim-fs-next-cd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .22);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.sim-fs-next .sim-fs-next-cd[hidden] {
  display: none;
}

@keyframes fsNextIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Show button only when in fullscreen (native or pseudo) */
.sim-scene:fullscreen .sim-fs-next:not([hidden]),
.sim-scene.pseudo-fs .sim-fs-next:not([hidden]) {
  display: flex;
}

/* Hide bubble when NOT fullscreen — instant render hidden, no animation flash */
.sim-scene:not(.pseudo-fs):not(:fullscreen) .sim-score-bubble {
  display: none;
}

/* ============================================================
   VIDEO LOAD PROGRESS — shown inside .sim-overlay while a clip
   is downloading. Test only starts after 100% to avoid stutter
   on 4G/slow wifi.
   ============================================================ */
.sim-overlay.loading .sim-overlay-icon,
.sim-overlay.loading .sim-overlay-text {
  display: none;
}

.sim-overlay-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(360px, 80vw);
}

.sim-overlay-loading[hidden] {
  display: none;
}

.sim-load-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .2);
  border-top-color: #fff;
  animation: simLoadSpin .8s linear infinite;
}

@keyframes simLoadSpin {
  to { transform: rotate(360deg); }
}

.sim-load-text {
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  text-align: center;
}

.sim-load-bar {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .15);
  overflow: hidden;
}

.sim-load-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--grad-brand, linear-gradient(90deg, #6366f1, #ec4899));
  transition: width 180ms ease-out;
}