/* =============================================================
   HocMai Miễn Phí — Design System v4.0 Glass Edition
   Premium Vietnamese Education Quiz Platform
   Glass Morphism + Flat Premium + Micro-Animations
   ============================================================= */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Core palette */
  --clr-indigo-950: #0f0a2e;
  --clr-indigo-900: #1a1046;
  --clr-indigo-800: #2d1b69;
  --clr-indigo-700: #3730a3;
  --clr-violet-600: #7c3aed;
  --clr-violet-500: #8b5cf6;
  --clr-violet-400: #a78bfa;
  --clr-violet-200: #ddd6fe;
  --clr-violet-100: #ede9fe;
  --clr-violet-50:  #f5f3ff;

  --clr-pink-500:   #ec4899;
  --clr-pink-400:   #f472b6;
  --clr-cyan-400:   #22d3ee;
  --clr-amber-400:  #fbbf24;
  --clr-emerald-400:#34d399;

  /* Semantic */
  --bg:             #f8f7ff;
  --bg-card:        rgba(255,255,255,0.72);
  --bg-glass:       rgba(255,255,255,0.55);
  --bg-glass-dark:  rgba(15,10,46,0.65);
  --bg-muted:       #f0eeff;
  --bg-hover:       rgba(139,92,246,0.06);

  --primary:        var(--clr-violet-600);
  --primary-h:      #6d28d9;
  --primary-soft:   var(--clr-violet-100);
  --primary-glow:   rgba(124,58,237,0.25);

  --gold:           #d97706;
  --gold-soft:      #fef3c7;
  --green:          #059669;
  --green-soft:     #d1fae5;
  --red:            #dc2626;
  --red-soft:       #fee2e2;

  --text:           #1a0f3a;
  --text-secondary: #4a3f6b;
  --text-muted:     #9188b0;
  --text-inv:       #ffffff;

  --border:         rgba(139,92,246,0.12);
  --border-glass:   rgba(255,255,255,0.35);
  --border-strong:  rgba(139,92,246,0.25);

  /* Shadows */
  --shadow-glow:    0 0 0 1px rgba(124,58,237,0.08), 0 4px 24px rgba(124,58,237,0.12);
  --shadow-card:    0 1px 3px rgba(0,0,0,0.04), 0 8px 32px rgba(107,70,193,0.08);
  --shadow-card-hover: 0 4px 6px rgba(0,0,0,0.04), 0 20px 48px rgba(107,70,193,0.18);
  --shadow-float:   0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-btn:     0 4px 14px rgba(124,58,237,0.35);
  --shadow-xs:      0 1px 2px rgba(0,0,0,0.05);

  /* Typography */
  --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --text-xs:        .8125rem;  /* 13px */
  --text-sm:        .875rem;   /* 14px */
  --text-base:      1.0625rem; /* 17px - Reading optimal */
  --text-md:        1.125rem;  /* 18px */
  --text-lg:        1.25rem;   /* 20px */
  --text-xl:        1.5rem;    /* 24px */
  --text-2xl:       1.75rem;   /* 28px */
  --text-3xl:       2.25rem;   /* 36px */
  --text-4xl:       2.75rem;   /* 44px */
  --text-5xl:       3.5rem;    /* 56px */

  /* Spacing */
  --sp-1: .25rem;  --sp-2: .5rem;   --sp-3: .75rem;
  --sp-4: 1rem;    --sp-5: 1.25rem; --sp-6: 1.5rem;
  --sp-8: 2rem;    --sp-10: 2.5rem; --sp-12: 3rem;
  --sp-16: 4rem;   --sp-20: 5rem;

  /* Layout */
  --container: 1320px;
  --nav-h: 68px;

  /* Radius */
  --r-sm:   6px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-xl:   24px;
  --r-2xl:  32px;
  --r-full: 9999px;

  /* Transitions */
  --ease:      cubic-bezier(0.16, 1, 0.32, 1);
  --ease-out:  cubic-bezier(0, 0, 0.2, 1);
  --ease-in:   cubic-bezier(0.4, 0, 1, 1);
  --dur-fast:  140ms;
  --dur:       240ms;
  --dur-slow:  380ms;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
@media (max-width: 640px) { html { font-size: 105%; } }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: clip;
  /* Subtle dot grid background */
  background-image: radial-gradient(circle, rgba(124,58,237,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── Container ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}
@media (max-width: 640px) { .container { padding: 0 var(--sp-4); } }

/* ── Animated background blobs ─────────────────────────────── */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: blobFloat 20s ease-in-out infinite alternate;
}
body::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,0.08), transparent 70%);
  top: -200px; right: -100px;
}
body::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(236,72,153,0.06), transparent 70%);
  bottom: -150px; left: -100px;
  animation-delay: -10s;
}
@keyframes blobFloat {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px,30px) scale(1.08); }
}
.hmt-body { position: relative; z-index: 1; }

/* ══════════════════════════════════════════════════════════════
   NAVIGATION — Glass morphism sticky bar
═══════════════════════════════════════════════════════════════ */
.hmt-nav {
  position: sticky;
  top: 0;
  z-index: 201;
  height: var(--nav-h);
  background: rgba(248,247,255,0.80);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 1px solid var(--border-glass);
  transition: box-shadow var(--dur) var(--ease);
}
.hmt-nav.scrolled {
  box-shadow: var(--shadow-float);
  background: rgba(248,247,255,0.92);
}
.hmt-nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* Logo */
.hmt-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.hmt-logo:hover { text-decoration: none; }
.hmt-logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--clr-indigo-800) 0%, var(--clr-violet-500) 100%);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-btn);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur);
}
.hmt-logo:hover .hmt-logo-mark {
  transform: rotate(-6deg) scale(1.08);
  box-shadow: 0 6px 20px rgba(124,58,237,0.45);
}
.hmt-logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.hmt-logo-name {
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
}
.hmt-logo-tag {
  font-size: .6rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* Desktop Nav Menu */
.hmt-nav-desktop {
  flex: 1;
  display: flex; align-items: center;
}
.hmt-nav-menu {
  display: flex; align-items: center; gap: var(--sp-4);
  list-style: none; margin: 0; padding: 0;
}
.hmt-nav-menu > li > a {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 12px;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--r-md); transition: all var(--dur-fast);
}
.hmt-nav-menu > li > a:hover {
  background: rgba(124,58,237,0.08); color: var(--primary); text-decoration: none;
}
.hmt-nav-chevron { transition: transform var(--dur-fast); }
.hmt-has-dropdown:hover .hmt-nav-chevron { transform: rotate(180deg); }

/* Dropdown */
.hmt-has-dropdown { position: relative; }
.hmt-dropdown {
  position: absolute; top: 100%; left: 0;
  width: 280px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xl);
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  list-style: none; padding: var(--sp-3); margin: var(--sp-2) 0 0;
  opacity: 0; visibility: hidden;
  transform: translateY(10px);
  transition: all var(--dur) var(--ease);
  z-index: 200;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
}
.hmt-has-dropdown:hover .hmt-dropdown {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.hmt-dropdown li { display: block; }
.hmt-dropdown a {
  display: flex; align-items: center; padding: 8px 12px;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--r-md); transition: all var(--dur-fast);
}
.hmt-dropdown a:hover {
  background: rgba(124,58,237,0.06); color: var(--primary); font-weight: 700; text-decoration: none;
}

/* Nav search */
.hmt-nav-search {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
  overflow: visible;
}
.hmt-nav-search input {
  width: 220px;
  height: 38px;
  padding: 0 var(--sp-3) 0 2.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  font-size: var(--text-sm);
  color: var(--text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), width var(--dur) var(--ease), background var(--dur-fast);
  outline: none;
}
.hmt-nav-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  width: 280px;
  background: #fff;
}
.hmt-nav-search input::placeholder { color: var(--text-muted); }
.hmt-nav-search-icon {
  position: absolute;
  left: .65rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--dur-fast);
}
.hmt-nav-search input:focus ~ .hmt-nav-search-icon { color: var(--primary); }

/* Mobile hamburger */
.hmt-nav-hamburger {
  display: none;
  padding: var(--sp-2);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text);
  border-radius: var(--r-md);
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.hmt-nav-hamburger:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.hmt-nav-hamburger svg line { transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease); transform-origin: center; }
.hmt-nav-hamburger[aria-expanded="true"] svg line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hmt-nav-hamburger[aria-expanded="true"] svg line:nth-child(2) { opacity: 0; }
.hmt-nav-hamburger[aria-expanded="true"] svg line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile drawer & overlay */
.hmt-mobile-menu-overlay {
  display: block; position: fixed; inset: 0;
  background: rgba(15,10,46,0.4);
  backdrop-filter: blur(4px);
  z-index: 199;
  opacity: 0; visibility: hidden;
  transition: all var(--dur) var(--ease);
}
.hmt-mobile-menu-overlay.open { opacity: 1; visibility: visible; }

.hmt-mobile-menu {
  display: flex !important; flex-direction: column;
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 300px; max-width: 85vw;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(32px) saturate(200%);
  z-index: 200;
  padding: calc(var(--nav-h) + var(--sp-4)) var(--sp-4) var(--sp-6);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease);
  box-shadow: -20px 0 60px rgba(0,0,0,0.1);
}
.hmt-mobile-menu.open { transform: translateX(0); }

.hmt-mobile-menu-header {
  margin-bottom: var(--sp-4); padding: 0 16px var(--sp-4);
  border-bottom: 1px solid var(--border-glass);
}
.hmt-mobile-menu-title {
  font-size: var(--text-xs); font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em;
}

.hmt-mobile-menu ul { list-style: none; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; }
.hmt-mobile-menu a {
  display: block; padding: 12px 16px;
  font-size: var(--text-md); font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--r-md);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.hmt-mobile-menu a.hmt-mobile-link-main {
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(139,92,246,0.05));
  color: var(--primary); font-weight: 800;
  border: 1px solid rgba(124,58,237,0.15); margin-bottom: var(--sp-3);
}
.hmt-mobile-menu a:hover { color: var(--primary); background: var(--primary-soft); text-decoration: none; }

/* Thu nhỏ search thành icon khi hamburger xuất hiện */
@media (max-width: 1024px) {
  .hmt-nav-hamburger { display: flex; }
  .hmt-nav-desktop { display: none; }
  .hmt-nav-search input {
    width: 40px; height: 40px; padding: 0;
    border-radius: var(--r-md);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    cursor: pointer; color: transparent;
    transition: width var(--dur) var(--ease), border-color var(--dur-fast), background var(--dur-fast);
  }
  .hmt-nav-search input::placeholder { color: transparent; }
  .hmt-nav-search.expanded input,
  .hmt-nav-search input:focus {
    width: 240px;
    padding: 0 var(--sp-3) 0 2.25rem;
    color: var(--text);
    background: #fff;
    cursor: text;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
  }
  .hmt-nav-search.expanded input::placeholder,
  .hmt-nav-search input:focus::placeholder { color: var(--text-muted); }
  .hmt-nav-search-icon { color: var(--text); left: 12px; }
  .hmt-nav-search.expanded .hmt-nav-search-icon,
  .hmt-nav-search:focus-within .hmt-nav-search-icon { color: var(--primary); }
}
@media (max-width: 640px) {
  /* Ẩn style expand riêng cho 640px vì 1024px đã xử lý, chỉ giữ resize nhỏ hơn */
  .hmt-nav-search.expanded input,
  .hmt-nav-search input:focus {
    width: 200px;
  }
}

/* ══════════════════════════════════════════════════════════════
   SMART AUTOCOMPLETE DROPDOWN v2
═══════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════
   SMART AUTOCOMPLETE DROPDOWN v2
═══════════════════════════════════════════════════════ */
.hmt-live-search-results {
  position: absolute; top: calc(100% + 8px);
  right: 0; left: auto;
  width: 400px; max-width: calc(100vw - 24px);
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(32px) saturate(200%);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15,10,46,0.18), 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(139,92,246,0.12);
  z-index: 500;
  overflow: hidden;
  opacity: 0; visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
  max-height: 520px; overflow-y: auto;
}
.hmt-live-search-results.active {
  opacity: 1; visibility: visible;
  transform: translateY(0);
}
/* Mobile: dropdown tràn ngang màn hình */
@media (max-width: 1024px) {
  .hmt-live-search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: -8px; /* Bù trừ padding của container */
    left: auto;
    width: calc(100vw - 32px); /* Cách mép trái 16px, mép phải 16px */
    max-width: none;
    border-radius: 12px;
    max-height: 70vh;
    transform: translateY(-10px);
  }
  .hmt-live-search-results.active { transform: translateY(0); }
}

/* Section label */
.hmt-search-section-label {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px 6px;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted);
}

/* Search items */
.hmt-search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  text-decoration: none; color: var(--text);
  transition: background var(--dur-fast);
  cursor: pointer;
  position: relative;
}
.hmt-search-item:hover,
.hmt-search-item--active { background: var(--bg-hover); }
.hmt-search-item:hover .hmt-search-arrow,
.hmt-search-item--active .hmt-search-arrow { opacity: 1; transform: translateX(0); }

/* Category item */
.hmt-search-item--cat { gap: 10px; }
.hmt-search-cat-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--primary-soft);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.hmt-search-cat-info { flex: 1; min-width: 0; }
.hmt-search-cat-info strong { display: block; font-size: var(--text-sm); font-weight: 700; color: var(--text); }
.hmt-search-cat-info span  { font-size: var(--text-xs); color: var(--text-muted); }

/* Post item with thumbnail */
.hmt-search-thumb {
  width: 48px; height: 36px; flex-shrink: 0;
  border-radius: 8px; object-fit: cover;
  background: var(--bg-muted);
}
.hmt-search-thumb--placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.hmt-search-info { flex: 1; min-width: 0; }
.hmt-search-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: var(--text-sm); font-weight: 600; color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  margin-bottom: 5px;
}
.hmt-search-meta { display: flex; gap: 4px; flex-wrap: wrap; }
.hmt-sbadge {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: var(--r-full);
  font-size: 10px; font-weight: 700;
}
.hmt-sbadge--grade   { background: var(--gold-soft); color: #92400e; }
.hmt-sbadge--subject { background: var(--primary-soft); color: var(--primary-h); }
.hmt-sbadge--count   { background: var(--green-soft); color: #065f46; }

/* Arrow icon */
.hmt-search-arrow {
  flex-shrink: 0; opacity: 0;
  transform: translateX(-4px);
  transition: opacity .15s, transform .15s;
  color: var(--text-muted);
}

/* Footer */
.hmt-search-footer {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
}
.hmt-search-view-all {
  display: block; text-align: center;
  font-size: var(--text-xs); font-weight: 700;
  color: var(--primary); text-decoration: none;
  padding: 6px 0;
  border-radius: var(--r-md);
  transition: background var(--dur-fast);
}
.hmt-search-view-all:hover { background: var(--primary-soft); text-decoration: none; }

/* Loading spinner */
.hmt-search-spinner {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px;
  color: var(--text-muted); font-size: var(--text-sm);
}
.hmt-spinner {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: hmt-spin .7s linear infinite;
}
@keyframes hmt-spin { to { transform: rotate(360deg); } }

/* Empty state */
.hmt-search-empty {
  padding: 24px 16px;
  text-align: center; color: var(--text-muted);
}
.hmt-search-empty svg { margin: 0 auto 10px; display: block; }
.hmt-search-empty p { font-size: var(--text-sm); line-height: 1.5; }
.hmt-search-empty strong { color: var(--text); }


/* ══════════════════════════════════════════════════════════════
   HERO — Deep glass / gradient
═══════════════════════════════════════════════════════════════ */
.hmt-archive-hero {
  background: linear-gradient(135deg, var(--clr-indigo-950) 0%, var(--clr-indigo-800) 45%, #4338ca 100%);
  color: #fff;
  padding: var(--sp-16) 0 var(--sp-12);
  position: relative;
  overflow: hidden;
}
.hmt-archive-hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 15% 60%, rgba(167,139,250,0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 10%, rgba(236,72,153,0.14) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 120%, rgba(34,211,238,0.08) 0%, transparent 50%);
  pointer-events: none;
}
/* Mesh grid overlay */
.hmt-archive-hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
.hmt-archive-hero .container { position: relative; z-index: 2; }
.hmt-archive-hero h1 {
  font-size: clamp(1.75rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.12;
  margin-bottom: var(--sp-4);
}
.hmt-archive-hero h1 .grad {
  background: linear-gradient(135deg, var(--clr-violet-400), var(--clr-pink-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hmt-archive-hero p {
  font-size: var(--text-lg);
  color: rgba(255,255,255,.72);
  max-width: 520px;
  line-height: 1.65;
}
.hmt-archive-stats {
  display: flex;
  gap: var(--sp-8);
  margin-top: var(--sp-8);
  flex-wrap: wrap;
}
.hmt-archive-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hmt-archive-stat strong {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: #fff;
  letter-spacing: -.03em;
}
.hmt-archive-stat span { font-size: var(--text-sm); color: rgba(255,255,255,.55); font-weight: 500; }

/* Grade pills in hero breadcrumb area */
.hmt-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: var(--text-sm);
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-bottom: var(--sp-5);
  backdrop-filter: blur(8px);
}

/* ══════════════════════════════════════════════════════════════
   FILTER BAR — Glass sticky
═══════════════════════════════════════════════════════════════ */
.hmt-filters {
  background: rgba(248,247,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-3) 0;
  position: sticky;
  top: var(--nav-h);
  z-index: 90;
  transition: box-shadow var(--dur);
}
.hmt-filters.has-shadow { box-shadow: 0 4px 16px rgba(107,70,193,0.08); }
.hmt-filters-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.hmt-filters-inner::-webkit-scrollbar { display: none; }
.hmt-filter-chips { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: nowrap; }
.hmt-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-glass);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.hmt-filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
  text-decoration: none;
}
.hmt-filter-chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

/* ══════════════════════════════════════════════════════════════
   QUIZ CARD GRID
═══════════════════════════════════════════════════════════════ */
.hmt-archive-content { padding: var(--sp-10) 0 var(--sp-20); }
.hmt-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.hmt-results-count { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }
.hmt-results-count strong { color: var(--text); }

.hmt-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
}
@media (max-width: 1200px) { .hmt-card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .hmt-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .hmt-card-grid { grid-template-columns: 1fr; } }

/* Card — glass morphism */
.hmt-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur-fast);
  text-decoration: none;
  color: inherit;
  position: relative;
  box-shadow: var(--shadow-card);
}
.hmt-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
  z-index: 1;
}
.hmt-card:hover {
  transform: translateY(-6px) scale(1.005);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(124,58,237,0.3);
  text-decoration: none;
}
/* Top accent line on hover */
.hmt-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--clr-violet-500), var(--clr-pink-400));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  opacity: 0;
  transition: opacity var(--dur-fast);
  z-index: 2;
}
.hmt-card:hover::after { opacity: 1; }

/* Card thumbnail */
.hmt-card-thumb {
  height: 140px;
  background: linear-gradient(135deg, var(--clr-violet-100) 0%, #f0e6ff 100%);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.hmt-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease);
}
.hmt-card:hover .hmt-card-thumb img { transform: scale(1.04); }
.hmt-card-thumb-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.hmt-card-thumb-icon-bg {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(139,92,246,0.08));
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  border: 1.5px solid rgba(124,58,237,0.18);
  backdrop-filter: blur(4px);
  transition: transform var(--dur-fast);
}
.hmt-card:hover .hmt-card-thumb-icon-bg {
  transform: scale(1.08) rotate(-3deg);
}

/* Card body */
.hmt-card-body {
  padding: var(--sp-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  position: relative;
  z-index: 2;
}
.hmt-card-tags { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.hmt-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.hmt-tag--grade   { background: var(--gold-soft); color: #92400e; border: 1px solid #fde68a; }
.hmt-tag--subject { background: var(--primary-soft); color: #5b21b6; border: 1px solid var(--clr-violet-200); }

.hmt-card-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  transition: color var(--dur-fast);
}
.hmt-card:hover .hmt-card-title { color: var(--primary); }

.hmt-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.hmt-card-meta-item { display: flex; align-items: center; gap: 4px; }
.hmt-card-meta svg { opacity: .55; flex-shrink: 0; }


/* ══════════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════════ */
.hmt-badge {
  display: inline-flex; align-items: center;
  padding: 3px 12px;
  border-radius: var(--r-full);
  font-size: var(--text-xs); font-weight: 700;
  white-space: nowrap;
  letter-spacing: .02em;
}
.hmt-badge--grade   { background: var(--gold-soft); color: #78350f; border: 1px solid #fde68a; }
.hmt-badge--subject { background: var(--primary-soft); color: var(--primary-h); border: 1px solid var(--clr-violet-200); }
.hmt-badge--scope   { background: var(--green-soft); color: #065f46; border: 1px solid #6ee7b7; }

/* ══════════════════════════════════════════════════════════════
   BREADCRUMB
═══════════════════════════════════════════════════════════════ */
.hmt-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  flex: 1; min-width: 0;
  overflow: hidden;
}
.hmt-breadcrumb a {
  color: var(--text-muted); text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-fast);
}
.hmt-breadcrumb a:hover { color: var(--primary); }
.hmt-breadcrumb .sep { opacity: .35; flex-shrink: 0; }
.hmt-breadcrumb span:last-child {
  color: var(--text); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════════ */
.hmt-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-10) 0;
}
.hmt-page-btn {
  min-width: 40px; height: 40px;
  padding: 0 var(--sp-3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  font-size: var(--text-sm); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  transition: all var(--dur-fast) var(--ease-out);
}
.hmt-page-btn:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-soft); transform: translateY(-1px);
  text-decoration: none;
}
.hmt-page-btn.current {
  background: var(--primary); border-color: var(--primary);
  color: #fff; box-shadow: var(--shadow-btn);
}
.hmt-page-btn:disabled { opacity: .35; cursor: default; transform: none; }

/* ══════════════════════════════════════════════════════════════
   FOOTER — Dark Glass
═══════════════════════════════════════════════════════════════ */
.hmt-footer {
  background: #0f0a1d;
  color: #fff;
  padding: var(--sp-16) 0 var(--sp-6);
  position: relative; overflow: hidden;
}
.hmt-footer::before {
  content: ''; position: absolute;
  top: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167,139,250,0.5), transparent);
}
.hmt-footer-bg { position: absolute; inset: 0; pointer-events: none; }
.hmt-footer-blob { position: absolute; border-radius: 50%; filter: blur(80px); }
.hmt-footer-blob--1 { width: 400px; height: 400px; background: rgba(139,92,246,0.1); top: -200px; left: -100px; }
.hmt-footer-blob--2 { width: 300px; height: 300px; background: rgba(59,130,246,0.08); bottom: -150px; right: 10%; }

.hmt-footer-container { position: relative; z-index: 1; }
.hmt-footer-grid {
  display: grid;
  grid-template-columns: 2.5fr 1.25fr 1.25fr 1fr;
  gap: var(--sp-8);
  padding-bottom: var(--sp-12);
  border-bottom: 1px solid rgba(255,255,255,.05);
  margin-bottom: var(--sp-6);
}
@media (max-width: 1024px) { .hmt-footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { 
  .hmt-footer-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
  .hmt-footer-brand { grid-column: 1 / -1; margin-bottom: var(--sp-2); }
}

.hmt-footer-brand .hmt-logo { margin-bottom: var(--sp-5); display: inline-flex; }
.hmt-footer-brand p {
  font-size: var(--text-sm); line-height: 1.6;
  max-width: 320px; color: rgba(255,255,255,.5);
  margin-bottom: var(--sp-6);
}
.hmt-footer-social { display: flex; gap: 12px; }
.hmt-footer-social a {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: rgba(255,255,255,0.05); color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all var(--dur-fast);
}
.hmt-footer-social a:hover {
  background: var(--primary); border-color: var(--primary); transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(124,58,237,0.3); color: #fff; text-decoration: none;
}

.hmt-footer-col h4 {
  font-size: var(--text-xs); font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em;
  background: linear-gradient(135deg, #fff, #c4b5fd);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: var(--sp-5);
}
.hmt-footer-col ul  { list-style: none; display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; padding: 0; }
.hmt-footer-col a   { font-size: var(--text-sm); color: rgba(255,255,255,.45); transition: color var(--dur-fast); }
.hmt-footer-col a:hover { color: #fff; text-decoration: none; }

.hmt-footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--text-xs); color: rgba(255,255,255,.3);
  flex-wrap: wrap; gap: var(--sp-4);
}
.hmt-footer-bottom-l { font-weight: 500; }
.hmt-footer-bottom-r a { color: rgba(255,255,255,.5); text-decoration: underline; text-underline-offset: 4px; transition: color var(--dur-fast); }
.hmt-footer-bottom-r a:hover { color: #fff; }

/* ══════════════════════════════════════════════════════════════
   SKELETON LOADING
═══════════════════════════════════════════════════════════════ */
@keyframes shimmer {
  from { background-position: -600px 0; }
  to   { background-position: 600px 0; }
}
.hmt-skeleton {
  background: linear-gradient(90deg,
    rgba(139,92,246,.06) 25%,
    rgba(139,92,246,.12) 50%,
    rgba(139,92,246,.06) 75%);
  background-size: 1200px 100%;
  animation: shimmer 1.8s infinite linear;
  border-radius: var(--r-md);
}

/* ══════════════════════════════════════════════════════════════
   FADE-IN ANIMATION (intersection observer)
═══════════════════════════════════════════════════════════════ */
.hmt-card {
  animation: cardAppear 0.45s var(--ease) both;
}
@keyframes cardAppear {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* stagger via nth-child */
.hmt-card:nth-child(1)  { animation-delay: 0ms; }
.hmt-card:nth-child(2)  { animation-delay: 50ms; }
.hmt-card:nth-child(3)  { animation-delay: 100ms; }
.hmt-card:nth-child(4)  { animation-delay: 150ms; }
.hmt-card:nth-child(5)  { animation-delay: 200ms; }
.hmt-card:nth-child(6)  { animation-delay: 250ms; }
.hmt-card:nth-child(7)  { animation-delay: 300ms; }
.hmt-card:nth-child(8)  { animation-delay: 350ms; }
.hmt-card:nth-child(9)  { animation-delay: 400ms; }
.hmt-card:nth-child(10) { animation-delay: 450ms; }
.hmt-card:nth-child(n+11) { animation-delay: 480ms; }

/* ══════════════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════════════ */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: var(--sp-2); }
.no-mathjax { /* MathJax skip class */ }

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

/* ─── Broken Image Graceful Fallback ─── */
img.hmt-broken-img {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' style='background:%23f8fafc'%3E%3Crect width='100%25' height='100%25' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-dasharray='8' rx='8' ry='8'/%3E%3Ctext x='50%25' y='45%25' font-family='system-ui, sans-serif' font-size='16' font-weight='600' fill='%2364748b' text-anchor='middle'%3EHình ảnh đang tải%3C/text%3E%3Ctext x='50%25' y='60%25' font-family='system-ui, sans-serif' font-size='13' fill='%2394a3b8' text-anchor='middle'%3E(Chưa đồng bộ lên Server)%3C/text%3E%3C/svg%3E") !important;
    max-width: 100%; 
    max-height: 140px !important;
    width: auto !important;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    display: block;
    margin: 8px 0;
}

/* ─── HOCMAI 4.0: PHYSICAL CSS ANTI-THEFT SHIELD ─── */
body, .hmt-exam-page, .hmt-question-text { 
    -webkit-user-select: none !important; 
    -moz-user-select: none !important; 
    -ms-user-select: none !important; 
    user-select: none !important; 
}
input, textarea { 
    -webkit-user-select: auto !important; 
    user-select: auto !important; 
}
