/* =====================================================
   BrainPig – EdTech Design System (nghiêm túc, dễ đọc)
   Navy slate · Indigo · Teal accent (bớt neon AI)
   ===================================================== */

:root {
  --bp-purple: #3730A3;
  --bp-purple-deep: #1E3A5F;
  --bp-purple-dark: #0F172A;
  --bp-purple-black: #0B1220;
  --bp-accent: #1D4ED8;
  --bp-cyan: #0E7490;
  --bp-cyan-glow: rgba(14, 116, 144, 0.2);
  --bp-pink: #9F1239;
  --bp-pink-soft: #BE123C;
  --bp-pink-glow: rgba(159, 18, 57, 0.15);
  --bp-neon: #4338CA;
  --bp-success: #047857;
  --bp-warning: #B45309;
  --bp-danger: #B91C1C;
  --bp-radius: 1rem;
  --bp-radius-sm: 0.65rem;
  --bp-blur: 18px;
  --bp-transition: 0.25s ease;
  --font: 'Be Vietnam Pro', 'Inter', system-ui, sans-serif;
}

/* Dark */
html, html.dark {
  --bg-base: #0B1220;
  --bg-elevated: #111827;
  --bg-gradient: linear-gradient(180deg, #0F172A 0%, #0B1220 40%, #0B1220 100%);
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --glass-bg: rgba(30, 41, 59, 0.55);
  --glass-bg-strong: rgba(30, 41, 59, 0.85);
  --glass-border: rgba(148, 163, 184, 0.14);
  --glass-border-hover: rgba(99, 102, 241, 0.4);
  --glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --glass-glow: none;
  --nav-bg: rgba(15, 23, 42, 0.9);
  --input-bg: rgba(15, 23, 42, 0.6);
  --menu-bg: #1E293B;
  --menu-text: #F8FAFC;
  --menu-muted: #94A3B8;
  --menu-hover: rgba(99, 102, 241, 0.18);
  --skeleton: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  color-scheme: dark;
}

/* Light – nền kem/xám lạnh, chữ đậm rõ */
html.light {
  --bg-base: #F8FAFC;
  --bg-elevated: #FFFFFF;
  --bg-gradient: linear-gradient(180deg, #F1F5F9 0%, #F8FAFC 50%, #FFFFFF 100%);
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --glass-bg: rgba(255, 255, 255, 0.82);
  --glass-bg-strong: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-hover: rgba(29, 78, 216, 0.35);
  --glass-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  --glass-glow: none;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --input-bg: #FFFFFF;
  --menu-bg: #FFFFFF;
  --menu-text: #0F172A;
  --menu-muted: #475569;
  --menu-hover: #F1F5F9;
  --skeleton: linear-gradient(90deg, rgba(15,23,42,0.04) 25%, rgba(15,23,42,0.08) 50%, rgba(15,23,42,0.04) 75%);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.6;
  transition: background 0.4s ease, color 0.3s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Mobile: lighter blur (GPU cost) */
@media (max-width: 767px) {
  :root { --bp-blur: 16px; }
  body { background-attachment: scroll; }
  .orb { display: none; }
  .glass, .glass-card, .glass-strong, .navbar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .floating, .floating-delay, .floating-delay2, .orb { animation: none !important; }
}

/* Page transition */
.page-enter {
  animation: pageIn 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes pageIn {
  from { opacity: 0; filter: blur(8px); transform: scale(0.98) translateY(8px); }
  to   { opacity: 1; filter: blur(0); transform: scale(1) translateY(0); }
}

/* ========== Glass components ========== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--bp-blur));
  -webkit-backdrop-filter: blur(var(--bp-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--bp-radius);
  box-shadow: var(--glass-shadow);
  transition: transform var(--bp-transition), box-shadow var(--bp-transition), border-color var(--bp-transition), background var(--bp-transition);
}

.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--glass-border);
  border-radius: var(--bp-radius);
  box-shadow: var(--glass-shadow), var(--glass-glow);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--bp-blur));
  -webkit-backdrop-filter: blur(var(--bp-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--bp-radius);
  box-shadow: var(--glass-shadow);
  transition: transform var(--bp-transition), box-shadow var(--bp-transition), border-color var(--bp-transition);
}

.glass-card:hover,
.glass-hover:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow);
}

.floating {
  animation: float 6s ease-in-out infinite;
}
.floating-delay { animation-delay: -2s; }
.floating-delay2 { animation-delay: -4s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ========== Brand text & buttons ========== */
.gradient-text, .brand-accent {
  color: var(--bp-accent);
  background: none;
  -webkit-text-fill-color: unset;
}
html.dark .gradient-text,
html.dark .brand-accent {
  color: #93C5FD;
}

.neon-text { text-shadow: none; }

.btn-neon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border-radius: 0.65rem;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--bp-transition);
}

.btn-primary {
  background: #1D4ED8;
  color: #fff;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}
.btn-primary:hover {
  background: #1E40AF;
  transform: translateY(-1px);
}

.btn-cyan {
  background: #0E7490;
  color: #fff;
}
.btn-cyan:hover { background: #155E75; }

.btn-ghost {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}
.btn-ghost:hover {
  border-color: var(--bp-accent);
  background: var(--menu-hover);
}

.btn-pink {
  background: #9F1239;
  color: #fff;
}

/* Hero serious panel */
.hero-panel { border-radius: 1rem; }
.hero-stat {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
}
.step-num {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  background: #1D4ED8;
  color: #fff;
}

/* ========== Navbar v2 ========== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.3s ease;
}

.navbar-v2 .nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 64px;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo { width: 40px; height: 40px; font-size: 1.25rem; border-radius: 12px; }
.nav-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.nav-brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; }
.nav-brand-sub { font-size: 10px; color: var(--text-muted); font-weight: 500; }

.nav-center { display: none; flex: 1; justify-content: center; }
@media (min-width: 1024px) {
  .nav-center { display: flex; }
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.28rem;
  border-radius: 9999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-secondary);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.22s ease;
}
.nav-pill:hover {
  color: var(--text-primary);
  background: rgba(109, 40, 217, 0.12);
}
.nav-pill.is-active {
  color: #fff;
  background: #1D4ED8;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3);
}
.nav-logo-img {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--glass-border);
}
.nav-pill-btn { padding-right: 0.75rem; }
.nav-caret { opacity: 0.7; }

.nav-more { position: relative; }
.nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 90vw);
  padding: 0.75rem;
  z-index: 60;
  border-radius: 1rem;
}
.nav-dropdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}
.nav-dropdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.2s ease;
}
.nav-dropdown-item:hover {
  background: rgba(109, 40, 217, 0.14);
}
.nav-dd-title { font-size: 0.875rem; font-weight: 600; }
.nav-dd-desc { font-size: 0.7rem; color: var(--text-muted); }
.nav-dd-admin { grid-column: 1 / -1; border: 1px dashed rgba(244, 114, 182, 0.35); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.theme-toggle-sm { width: 40px; height: 40px; }
.nav-btn-login { display: none; padding: 0.5rem 1rem; font-size: 0.85rem; min-height: auto; }
.nav-btn-reg { padding: 0.5rem 1rem; font-size: 0.85rem; min-height: auto; }
@media (min-width: 640px) {
  .nav-btn-login { display: inline-flex; }
}

.nav-user { position: relative; }
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.55rem 0.28rem 0.28rem;
  border-radius: 9999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.22s ease;
}
.nav-user-btn:hover {
  border-color: var(--glass-border-hover);
  box-shadow: 0 0 16px rgba(109, 40, 217, 0.2);
}
.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  ring: 2px;
  box-shadow: 0 0 0 2px rgba(109, 40, 217, 0.35);
}
.nav-user-name {
  display: none;
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 640px) {
  .nav-user-name { display: block; }
}
.nav-user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 260px;
  padding: 0.4rem;
  z-index: 60;
  border-radius: 0.85rem;
  background: var(--menu-bg) !important;
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.nav-user-head {
  padding: 0.85rem 0.9rem 0.85rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 0.25rem;
  background: var(--menu-hover);
  border-radius: 0.6rem 0.6rem 0 0;
}
.nav-user-fullname {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--menu-text);
  letter-spacing: -0.01em;
}
.nav-user-email {
  font-size: 0.78rem;
  color: var(--menu-muted);
  font-weight: 500;
  margin-top: 0.15rem;
}
.nav-user-link {
  display: block;
  padding: 0.65rem 0.9rem;
  border-radius: 0.55rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--menu-text);
  text-decoration: none;
  transition: all 0.15s ease;
}
.nav-user-link:hover {
  background: var(--menu-hover);
  color: var(--bp-accent);
}
.nav-user-link.is-danger {
  color: #B91C1C !important;
  font-weight: 800;
}
html.dark .nav-user-link.is-danger { color: #FCA5A5 !important; }
.nav-user-divider { height: 1px; background: var(--glass-border); margin: 0.35rem 0.4rem; }

/* Admin shell */
.admin-shell { display: grid; gap: 1.25rem; }
@media (min-width: 1024px) {
  .admin-shell { grid-template-columns: 220px 1fr; align-items: start; }
}
.admin-side {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: 0.85rem;
  padding: 0.75rem;
  position: sticky;
  top: 5rem;
}
.admin-side a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 0.15rem;
}
.admin-side a:hover, .admin-side a.is-active {
  background: var(--menu-hover);
  color: var(--text-primary);
}
.admin-side .admin-side-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0.35rem;
}
.admin-stat {
  border-left: 3px solid #1D4ED8;
  padding-left: 0.85rem;
}
.logo-pig {
  background: #1D4ED8 !important;
  box-shadow: none !important;
  color: #fff;
  font-weight: 800;
  font-size: 0.75rem !important;
  letter-spacing: 0.02em;
}

/* Burger */
.nav-burger, .lg-hidden {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer;
}
@media (min-width: 1024px) {
  .nav-burger, .lg-hidden { display: none !important; }
}
.burger-line {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.28s ease;
}
.burger-line.open:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger-line.open:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger-line.open:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu panel */
.nav-mobile {
  border-top: 1px solid var(--glass-border);
  background: var(--nav-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  max-height: min(78dvh, 640px);
  overflow-y: auto;
}
.nav-mobile-inner { padding: 1rem 0 1.25rem; }
.nav-mobile-section { margin-bottom: 1rem; }
.nav-mobile-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.15rem;
}
.nav-mobile-link {
  display: block;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 560;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  transition: all 0.18s ease;
}
.nav-mobile-link:hover, .nav-mobile-link.is-active {
  background: rgba(109, 40, 217, 0.16);
  color: var(--text-primary);
}
.nav-mobile-link.is-active {
  box-shadow: inset 3px 0 0 var(--bp-cyan);
}
.nav-mobile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.nav-mobile-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem;
  border-radius: 0.85rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
}
.nav-mobile-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-1px);
}
.nav-mobile-cta {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Legacy nav-link keep */
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.25s ease;
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--glass-bg);
  box-shadow: 0 0 16px rgba(109, 40, 217, 0.2);
}

/* ========== Subject icons (school-friendly) ========== */
.subj-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1.5px solid;
  flex-shrink: 0;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  font-variant-numeric: tabular-nums;
}
.subj-icon-sm { border-radius: 11px; }
.subj-icon-lg { border-radius: 18px; }
.subj-sym {
  font-family: 'Be Vietnam Pro', ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}
.subj-toan {
  font-family: 'Cambria Math', 'Times New Roman', Georgia, serif;
  font-weight: 700;
}
.subj-sub {
  opacity: 0.85;
  font-weight: 600;
  margin-top: 1px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

.subj-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  border-radius: 9999px;
  background: var(--subj-bg, var(--glass-bg));
  border: 1px solid color-mix(in srgb, var(--subj-color, #6D28D9) 35%, transparent);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.22s ease;
  cursor: pointer;
}
.subj-chip:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 18px color-mix(in srgb, var(--subj-color, #6D28D9) 30%, transparent);
}
.subj-chip.is-active {
  background: linear-gradient(135deg, rgba(109,40,217,0.35), rgba(34,211,238,0.15));
  border-color: var(--bp-cyan);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.25);
}
.subj-chip-label { padding-right: 0.15rem; }

.subj-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.65rem;
  padding: 1.1rem 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}
.subj-card:hover .subj-icon {
  transform: scale(1.08);
  box-shadow: 0 0 24px color-mix(in srgb, var(--subj-color, #6D28D9) 40%, transparent);
}
.subj-card-name { font-weight: 700; font-size: 0.9rem; }
.subj-card-code {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Bottom nav v2 */
.bottom-nav-v2 a {
  min-width: 58px;
  gap: 0.2rem;
  padding: 0.4rem 0.4rem;
}
.bottom-nav-v2 .bn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  transition: all 0.2s ease;
}
.bottom-nav-v2 a.active .bn-icon {
  background: rgba(34, 211, 238, 0.15);
  color: var(--bp-cyan);
}
.bottom-nav-v2 .bn-label { font-size: 0.62rem; font-weight: 600; }

/* ========== Theme toggle (SVG sun/moon) ========== */
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: all 0.35s ease;
  color: var(--text-primary);
}
.theme-toggle:hover {
  box-shadow: 0 0 20px var(--bp-cyan-glow);
  border-color: var(--bp-cyan);
  transform: scale(1.06);
  color: var(--bp-cyan);
}
.theme-toggle .icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.45s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  line-height: 0;
}
.theme-toggle .sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.3);
  color: #F59E0B;
}
.theme-toggle .moon {
  opacity: 1;
  transform: rotate(0) scale(1);
  color: #A5B4FC;
}
html.light .theme-toggle .sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}
html.light .theme-toggle .moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.3);
}
.theme-toggle-sm { width: 40px; height: 40px; border-radius: 11px; }

/* ========== Forms ========== */
.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--bp-radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}
.form-input:focus {
  border-color: var(--bp-purple);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.25), 0 0 20px var(--bp-cyan-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

/* ========== Sidebar ========== */
.sidebar {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--bp-blur));
  -webkit-backdrop-filter: blur(var(--bp-blur));
  border-right: 1px solid var(--glass-border);
  transition: width 0.3s ease, transform 0.3s ease;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--bp-radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.25s ease;
}
.sidebar-link:hover, .sidebar-link.active {
  background: linear-gradient(90deg, rgba(109, 40, 217, 0.25), transparent);
  color: var(--text-primary);
  box-shadow: inset 3px 0 0 var(--bp-cyan);
}

/* ========== Bottom nav (mobile) ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--glass-border);
  padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-radius: 0.75rem;
  min-width: 56px;
  transition: all 0.25s ease;
}
.bottom-nav a.active, .bottom-nav a:hover {
  color: var(--bp-cyan);
  background: rgba(109, 40, 217, 0.15);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.2);
}
.bottom-nav .icon { font-size: 1.25rem; }

/* ========== Badges & pills ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(109, 40, 217, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: var(--bp-neon);
}
.badge-cyan { background: rgba(34, 211, 238, 0.15); border-color: rgba(34, 211, 238, 0.3); color: var(--bp-cyan); }
.badge-pink { background: rgba(244, 114, 182, 0.15); border-color: rgba(244, 114, 182, 0.3); color: var(--bp-pink); }
.badge-success { background: rgba(52, 211, 153, 0.15); border-color: rgba(52, 211, 153, 0.3); color: var(--bp-success); }
.badge-danger { background: rgba(248, 113, 113, 0.15); border-color: rgba(248, 113, 113, 0.3); color: var(--bp-danger); }
.badge-warn { background: rgba(251, 191, 36, 0.15); border-color: rgba(251, 191, 36, 0.3); color: var(--bp-warning); }

/* ========== Skeleton shimmer ========== */
.skeleton {
  background: var(--skeleton);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--bp-radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== Progress ========== */
.progress-bar {
  height: 8px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: #1D4ED8;
  transition: width 0.6s ease;
}
@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ========== Exam UI ========== */
.exam-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
  color: var(--bp-cyan);
  text-shadow: 0 0 20px var(--bp-cyan-glow);
}
.exam-timer.warning { color: var(--bp-warning); text-shadow: 0 0 20px rgba(251, 191, 36, 0.5); }
.exam-timer.danger { color: var(--bp-danger); text-shadow: 0 0 20px rgba(248, 113, 113, 0.5); animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 1rem 1.15rem;
  border-radius: var(--bp-radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  font-size: 0.95rem;
}
.option-btn:hover {
  border-color: var(--bp-neon);
  box-shadow: 0 0 20px rgba(109, 40, 217, 0.25);
  transform: translateX(4px);
}
.option-btn.selected {
  border-color: var(--bp-cyan);
  background: rgba(34, 211, 238, 0.12);
  box-shadow: 0 0 24px var(--bp-cyan-glow);
}
.option-btn.correct {
  border-color: var(--bp-success);
  background: rgba(52, 211, 153, 0.15);
}
.option-btn.wrong {
  border-color: var(--bp-danger);
  background: rgba(248, 113, 113, 0.12);
}
.option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(109, 40, 217, 0.3);
  border: 1px solid rgba(167, 139, 250, 0.4);
}

/* ========== Modal ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 6, 20, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.25s ease;
}
.modal-panel {
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: modalIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); filter: blur(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

/* ========== Alert ========== */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--bp-radius-sm);
  border: 1px solid;
  font-size: 0.9rem;
  backdrop-filter: blur(12px);
}
.alert-success { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.35); color: var(--bp-success); }
.alert-error { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.35); color: var(--bp-danger); }
.alert-info { background: rgba(34, 211, 238, 0.1); border-color: rgba(34, 211, 238, 0.3); color: var(--bp-cyan); }

/* ========== Hero orbs ========== */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.5;
  animation: orbFloat 12s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: #6D28D9; top: -100px; left: -50px; }
.orb-2 { width: 300px; height: 300px; background: #22D3EE; top: 20%; right: -80px; animation-delay: -4s; opacity: 0.3; }
.orb-3 { width: 250px; height: 250px; background: #F472B6; bottom: 10%; left: 30%; animation-delay: -7s; opacity: 0.25; }
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ========== Logo ========== */
.logo-pig {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6D28D9, #22D3EE, #F472B6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 24px rgba(109, 40, 217, 0.5), 0 0 12px var(--bp-cyan-glow);
  flex-shrink: 0;
}

/* ========== Tables ========== */
.table-glass {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-glass th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-glass td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.9rem;
}
.table-glass tr:hover td {
  background: rgba(109, 40, 217, 0.08);
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(109, 40, 217, 0.4);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(109, 40, 217, 0.7); }

/* ========== Utilities ========== */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.container-bp {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
@media (min-width: 768px) {
  .container-bp { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* Radio chips for subject picker */
.subj-chip:has(input:checked),
.subj-chip.is-active {
  background: linear-gradient(135deg, rgba(109,40,217,0.35), rgba(34,211,238,0.15));
  border-color: var(--bp-cyan);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.25);
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Mobile padding for bottom nav */
.has-bottom-nav { padding-bottom: 5.5rem; }
@media (min-width: 1024px) {
  .has-bottom-nav { padding-bottom: 0; }
  .bottom-nav { display: none !important; }
}

/* Safe touch targets */
@media (max-width: 767px) {
  .btn-neon { min-height: 44px; padding: 0.7rem 1.25rem; }
  .option-btn { min-height: 48px; }
}

/* Print */
@media print {
  .navbar, .sidebar, .bottom-nav, .theme-toggle, .no-print { display: none !important; }
  body { background: white; color: black; }
}

/* ========== Site banners & popup ========== */
.site-top-banners {
  position: sticky;
  top: 0;
  z-index: 60;
}
.site-banner {
  text-align: center;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: linear-gradient(90deg, rgba(29,78,216,0.92), rgba(67,56,202,0.92));
  color: #F8FAFC;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.site-banner-announce { background: linear-gradient(90deg, #1E3A5F, #3730A3); }
.site-banner-link { color: inherit; text-decoration: none; }
.site-banner-link:hover { text-decoration: underline; }

.bp-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: modalIn 0.25s ease;
}
.bp-popup-card {
  position: relative;
  max-width: 420px;
  width: 100%;
  padding: 1.5rem 1.5rem 1.25rem;
  border-radius: 1rem;
}
.bp-popup-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}
.bp-popup-close:hover { color: var(--text-primary); }

/* ========== Blog prose ========== */
.blog-article {
  max-width: 48rem;
  margin: 0 auto;
}
.prose-bp {
  color: var(--text-primary);
  line-height: 1.8;
  font-size: 1.02rem;
}
.prose-bp h1, .prose-bp h2, .prose-bp h3 {
  font-weight: 800;
  line-height: 1.3;
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
  color: var(--text-primary);
}
.prose-bp h1 { font-size: 1.6rem; }
.prose-bp h2 { font-size: 1.3rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.4rem; }
.prose-bp h3 { font-size: 1.1rem; }
.prose-bp p { margin: 0.85rem 0; color: var(--text-secondary); }
.prose-bp ul, .prose-bp ol { margin: 0.75rem 0 0.75rem 1.25rem; color: var(--text-secondary); }
.prose-bp li { margin: 0.35rem 0; }
.prose-bp blockquote {
  border-left: 4px solid var(--bp-accent);
  padding: 0.6rem 1rem;
  margin: 1.25rem 0;
  background: var(--glass-bg);
  border-radius: 0 0.5rem 0.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}
.prose-bp code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88em;
  background: var(--glass-bg);
  padding: 0.15em 0.4em;
  border-radius: 0.3rem;
}
.prose-bp pre {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}
.prose-bp pre code { background: none; padding: 0; }
.prose-bp a { color: var(--bp-accent); text-decoration: underline; }
.prose-bp img { max-width: 100%; border-radius: 0.75rem; margin: 1rem 0; }
.prose-bp table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.prose-bp th, .prose-bp td { border: 1px solid var(--glass-border); padding: 0.5rem 0.75rem; text-align: left; }
.prose-bp th { background: var(--glass-bg); font-weight: 700; }
.blog-meta { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; font-size: 0.8rem; color: var(--text-muted); }
.blog-cover { width: 100%; max-height: 360px; object-fit: cover; border-radius: 1rem; margin-bottom: 1.25rem; }
.blog-toc {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}
.blog-toc-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 0.5rem; }
.blog-toc a { display: block; font-size: 0.85rem; color: var(--text-secondary); padding: 0.25rem 0; text-decoration: none; }
.blog-toc a:hover { color: var(--bp-accent); }

/* ========== Study tools ========== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}
.tool-card {
  padding: 1.1rem;
  border-radius: 1rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 110px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-hover);
}
.tool-card-title { font-weight: 700; font-size: 0.95rem; }
.tool-card-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }
.tool-panel { padding: 1.25rem; border-radius: 1rem; }
.pomodoro-display {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--bp-accent);
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.calc-btn {
  padding: 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}
.calc-btn:hover { border-color: var(--bp-accent); }
.calc-btn.is-op { color: var(--bp-accent); }
.calc-btn.is-eq { background: var(--bp-accent); color: #fff; border-color: transparent; }
.formula-block {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}
.formula-block h4 { font-size: 0.9rem; font-weight: 700; margin: 0 0 0.4rem; }
.formula-block code {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0.2rem 0;
  white-space: pre-wrap;
}

/* ========== Shared modern module UI ========== */
.mod-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.35rem 1.5rem;
  border-radius: 1.1rem;
}
.mod-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bp-accent);
  margin: 0 0 0.35rem;
}
.mod-hero-stats { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.mod-stat {
  min-width: 72px;
  padding: 0.65rem 0.9rem;
  border-radius: 0.75rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  text-align: center;
}
.mod-stat-n { font-size: 1.25rem; font-weight: 800; color: var(--bp-accent); line-height: 1.2; }
.mod-stat-l { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.15rem; }

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rb, #0E7490) 15%, transparent);
  color: var(--rb, #0E7490);
  border: 1px solid color-mix(in srgb, var(--rb, #0E7490) 35%, transparent);
}
.role-badge-admin { --rb: #7C3AED; background: rgba(124,58,237,0.12); color: #A78BFA; border-color: rgba(124,58,237,0.3); }
.role-badge-student { --rb: #64748B; background: rgba(100,116,139,0.12); color: var(--text-muted); border-color: rgba(100,116,139,0.25); }

/* ========== Library premium ========== */
.lib-hero {
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
  padding: 0;
}
.lib-hero-glow {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 50% 80% at 0% 0%, rgba(29,78,216,0.18), transparent 55%),
    radial-gradient(ellipse 40% 60% at 100% 100%, rgba(14,116,144,0.12), transparent 50%);
}
.lib-hero-inner {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1.25rem; padding: 1.5rem 1.6rem;
}
.lib-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 960px) {
  .lib-shell { grid-template-columns: 1fr; }
  .lib-aside {
    display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 0.35rem;
    padding: 0.65rem !important; max-height: none !important;
  }
  .lib-aside-title { display: none; }
  .lib-subj { flex-shrink: 0; min-width: max-content; }
}
.lib-aside {
  border-radius: 1rem;
  padding: 0.75rem;
  max-height: calc(100dvh - 8rem);
  overflow-y: auto;
  position: sticky;
  top: 5rem;
}
.lib-aside-title {
  font-size: 0.7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); padding: 0.35rem 0.55rem 0.65rem;
}
.lib-subj {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.7rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: 0.2s ease;
}
.lib-subj-label { display: flex; align-items: center; gap: 0.45rem; min-width: 0; font-size: 0.85rem; font-weight: 600; }
.lib-subj-count { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }
.lib-subj:hover { background: var(--glass-bg); }
.lib-subj.is-active {
  background: var(--glass-bg);
  border-color: color-mix(in srgb, var(--subj, var(--bp-accent)) 40%, transparent);
  box-shadow: inset 3px 0 0 var(--subj, var(--bp-accent));
}
.lib-main { min-width: 0; }
.lib-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.75rem; border-radius: 1rem; margin-bottom: 1rem;
}
.lib-search-wrap { position: relative; flex: 1; min-width: 160px; }
.lib-search-icon {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.lib-search { padding-left: 2.4rem !important; }
.lib-sort { width: auto; min-width: 130px; }
.lib-upload { padding: 1.15rem; border-radius: 1rem; margin-bottom: 1rem; }
.lib-drop-hint {
  text-align: center; font-size: 0.8rem; color: var(--text-muted);
  padding: 0.75rem; border-radius: 0.75rem; border: 1.5px dashed var(--glass-border);
}
.lib-drop-hint.is-drag { border-color: var(--bp-accent); color: var(--bp-accent); background: rgba(29,78,216,0.06); }
.lib-empty {
  text-align: center; padding: 3.5rem 1.5rem; border-radius: 1.1rem;
}
.lib-empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3.5rem; height: 3.5rem; border-radius: 1rem; margin-bottom: 0.75rem;
  font-weight: 800; font-size: 0.85rem; letter-spacing: 0.06em;
  background: rgba(29,78,216,0.12); color: var(--bp-accent);
}
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.lib-card-v2 {
  padding: 0; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.lib-card-v2:hover {
  transform: translateY(-3px);
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow);
}
.lib-thumb {
  position: relative;
  height: 140px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--subj, #1D4ED8) 18%, transparent), transparent 60%),
    var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.lib-thumb-pdf, .lib-thumb-file {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  color: var(--subj, var(--bp-accent));
}
.lib-thumb-badge {
  position: absolute; top: 0.6rem; left: 0.6rem;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem; border-radius: 0.35rem;
  background: rgba(185,28,28,0.9); color: #fff;
}
.lib-thumb-preview-hint {
  font-size: 0.68rem; font-weight: 700; color: var(--text-muted);
  opacity: 0; transform: translateY(4px); transition: 0.2s ease;
}
.lib-card-v2:hover .lib-thumb-preview-hint { opacity: 1; transform: none; }
.lib-thumb-img-wrap { position: absolute; inset: 0; }
.lib-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.lib-card-body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.lib-card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.lib-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 1.75rem;
  padding: 0 0.4rem;
  border-radius: 0.4rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(29,78,216,0.12);
  color: var(--bp-accent);
  border: 1px solid rgba(29,78,216,0.2);
}
.lib-ext-lg { min-width: 3.2rem; height: 2.4rem; font-size: 0.85rem; border-radius: 0.55rem; }
.lib-ext-xl { min-width: 4rem; height: 3rem; font-size: 1rem; border-radius: 0.75rem; }
.lib-card-title {
  font-weight: 700; font-size: 0.95rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-card-meta { font-size: 0.7rem; color: var(--text-muted); }
.lib-card-desc {
  font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-card-actions { display: flex; gap: 0.4rem; margin-top: auto; padding-top: 0.65rem; }

/* Preview modal */
.lib-modal {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.lib-modal-panel {
  width: min(1100px, 100%);
  height: min(90dvh, 900px);
  display: flex; flex-direction: column;
  border-radius: 1.15rem;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  overflow: hidden;
}
.lib-modal-head {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: flex-start; justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--glass-border);
  background: var(--nav-bg);
}
.lib-modal-title { font-size: 1.05rem; font-weight: 800; margin: 0; }
.lib-modal-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.lib-modal-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.lib-modal-close {
  width: 2.25rem; height: 2.25rem; border-radius: 0.65rem;
  border: 1px solid var(--glass-border); background: var(--glass-bg);
  color: var(--text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.lib-modal-close:hover { color: var(--text-primary); border-color: var(--text-muted); }
.lib-modal-body {
  flex: 1; min-height: 0; position: relative;
  background: var(--bg-base);
}
.lib-preview-frame { position: absolute; inset: 0; }
.lib-pdf-iframe {
  width: 100%; height: 100%; border: 0;
  background: #111827;
}
.lib-preview-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.75rem; background: var(--bg-base); color: var(--text-muted); font-size: 0.9rem;
}
.lib-spinner {
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 3px solid var(--glass-border);
  border-top-color: var(--bp-accent);
  animation: libSpin 0.7s linear infinite;
}
@keyframes libSpin { to { transform: rotate(360deg); } }
.lib-preview-media {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; overflow: auto;
}
.lib-preview-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 0.5rem; box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.lib-preview-video {
  max-width: 100%; max-height: 100%; border-radius: 0.75rem;
  background: #000;
}
.lib-preview-audio { background: var(--bg-elevated); }
.lib-audio-card {
  width: min(420px, 100%); text-align: center; padding: 2rem 1.5rem;
  border-radius: 1rem; background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.lib-preview-fallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem; color: var(--text-secondary);
}
.lib-modal-foot {
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--glass-border);
  background: var(--nav-bg);
}
@media (max-width: 640px) {
  .lib-modal { padding: 0; }
  .lib-modal-panel { height: 100dvh; width: 100%; border-radius: 0; }
  .lib-thumb { height: 120px; }
}

/* Planner */
.planner-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
}
@media (max-width: 1023px) {
  .planner-week { grid-template-columns: 1fr; }
}
.planner-day {
  border-radius: 1rem;
  padding: 0.75rem;
  min-height: 160px;
  display: flex;
  flex-direction: column;
}
.planner-day.is-today {
  border-color: rgba(14,116,144,0.45);
  box-shadow: 0 0 0 1px rgba(14,116,144,0.25);
}
.planner-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.planner-day-name { font-size: 0.75rem; font-weight: 800; }
.planner-day-date { font-size: 0.7rem; color: var(--text-muted); }
.planner-day-body { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.planner-empty { font-size: 0.7rem; color: var(--text-muted); opacity: 0.7; }
.planner-item {
  border-radius: 0.65rem;
  background: var(--glass-bg);
  border-left: 3px solid var(--accent, var(--bp-accent));
  overflow: hidden;
}
.planner-item.is-done { opacity: 0.55; }
.planner-item.is-done .planner-item-title { text-decoration: line-through; }
.planner-item-form { display: flex; align-items: flex-start; gap: 0.35rem; padding: 0.45rem 0.4rem; }
.planner-check {
  width: 1.15rem; height: 1.15rem; border-radius: 0.3rem;
  border: 1.5px solid var(--glass-border); background: transparent;
  cursor: pointer; flex-shrink: 0; font-size: 0.7rem; line-height: 1;
  color: var(--bp-success); display: flex; align-items: center; justify-content: center;
}
.planner-item.is-done .planner-check { background: rgba(4,120,87,0.15); border-color: var(--bp-success); }
.planner-item-title { font-size: 0.72rem; font-weight: 700; line-height: 1.3; }
.planner-item-meta { font-size: 0.62rem; color: var(--text-muted); margin-top: 0.1rem; }
.planner-del {
  border: none; background: none; color: var(--text-muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0 0.15rem;
}
.planner-del:hover { color: var(--bp-danger); }

/* Roadmap */
.roadmap-card { padding: 1.35rem 1.5rem; border-radius: 1.1rem; }
.roadmap-card-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem;
}
.roadmap-ring {
  --p: 0;
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--bp-accent) calc(var(--p) * 1%), var(--glass-border) 0);
  position: relative; flex-shrink: 0;
}
.roadmap-ring::before {
  content: '';
  position: absolute; inset: 4px; border-radius: 50%;
  background: var(--glass-bg-strong);
}
.roadmap-ring span { position: relative; font-size: 0.75rem; font-weight: 800; }
.roadmap-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.roadmap-step-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 0.9rem; border-radius: 0.85rem;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  text-decoration: none; color: inherit; transition: 0.2s ease;
}
.roadmap-step-link:hover { border-color: var(--glass-border-hover); transform: translateX(2px); }
.roadmap-step-dot {
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 800;
  background: rgba(29,78,216,0.12); color: var(--bp-accent); flex-shrink: 0;
}
.roadmap-step.is-done .roadmap-step-dot { background: rgba(4,120,87,0.18); color: var(--bp-success); }
.roadmap-step.is-done .roadmap-step-title { text-decoration: line-through; color: var(--text-muted); }
.roadmap-step-title { font-size: 0.9rem; font-weight: 600; }

/* Notes */
.notes-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  min-height: 520px;
}
@media (max-width: 900px) {
  .notes-layout { grid-template-columns: 1fr; }
}
.notes-sidebar { border-radius: 1rem; overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.notes-list { overflow-y: auto; flex: 1; }
.notes-item {
  display: block; padding: 0.85rem 1rem; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--glass-border); transition: 0.15s ease;
}
.notes-item:hover { background: var(--menu-hover); }
.notes-item.is-active { background: rgba(29,78,216,0.1); border-left: 3px solid var(--bp-accent); }
.notes-item-title { font-size: 0.88rem; font-weight: 700; line-height: 1.35; }
.notes-pin {
  font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
  color: var(--bp-warning); margin-right: 0.25rem;
}
.notes-item-meta { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.2rem; }
.notes-editor { border-radius: 1rem; min-height: 520px; display: flex; flex-direction: column; }
.notes-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 2rem; }
.notes-form { display: flex; flex-direction: column; flex: 1; padding: 1rem 1.15rem 1.15rem; }
.notes-title-input {
  border: none; background: transparent; font-size: 1.35rem; font-weight: 800;
  color: var(--text-primary); outline: none; padding: 0.35rem 0 0.75rem; width: 100%;
  font-family: inherit;
}
.notes-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding-bottom: 0.75rem; border-bottom: 1px solid var(--glass-border); margin-bottom: 0.75rem;
}
.notes-check { font-size: 0.8rem; display: flex; align-items: center; gap: 0.35rem; color: var(--text-muted); cursor: pointer; }
.notes-textarea {
  flex: 1; min-height: 320px; width: 100%; border: none; background: transparent;
  color: var(--text-primary); font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 0.95rem; line-height: 1.7; resize: vertical; outline: none;
}

/* PDF tools modern */
.pdf-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.pdf-tool-card {
  text-align: left; cursor: pointer; padding: 1rem; border: 1px solid var(--glass-border);
  background: var(--glass-bg); display: flex; flex-direction: column; gap: 0.25rem;
}
.pdf-tool-card.is-active { border-color: var(--bp-accent); box-shadow: 0 0 0 1px var(--bp-accent); }
.pdf-tool-icon { font-size: 1.1rem; font-weight: 800; color: var(--bp-accent); }
.pdf-tool-name { font-weight: 700; font-size: 0.9rem; }
.pdf-tool-desc { font-size: 0.7rem; color: var(--text-muted); }
.pdf-workspace { padding: 1.35rem; border-radius: 1.1rem; max-width: 720px; }
.pdf-workspace-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.pdf-dropzone {
  display: block; border: 2px dashed var(--glass-border); border-radius: 1rem;
  padding: 2rem 1rem; text-align: center; cursor: pointer; transition: 0.2s ease;
  background: var(--glass-bg);
}
.pdf-dropzone:hover { border-color: var(--bp-accent); }
.pdf-file-list { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.pdf-file-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.65rem; border-radius: 0.65rem; background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

/* Community modern */
.comm-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 960px) {
  .comm-layout { grid-template-columns: 1fr; }
  .comm-side { order: -1; }
}
.comm-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.comm-tab {
  padding: 0.45rem 0.9rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  text-decoration: none; color: var(--text-muted); border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}
.comm-tab.is-active { color: #fff; background: var(--bp-accent); border-color: transparent; }
.comm-card { padding: 1.1rem 1.2rem; }
.comm-card.is-open { border-color: rgba(29,78,216,0.35); }
.comm-card-head { display: flex; gap: 0.75rem; align-items: flex-start; margin-bottom: 0.65rem; }
.comm-avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comm-ans-count {
  text-align: center; min-width: 3rem; padding: 0.35rem;
  border-radius: 0.65rem; background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.comm-title { font-size: 1.05rem; font-weight: 800; margin: 0 0 0.4rem; line-height: 1.35; }
.comm-title a { color: inherit; }
.comm-title a:hover { color: var(--bp-accent); }
.comm-excerpt { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.55; margin: 0; }
.comm-answer {
  padding: 0.75rem 0.9rem; border-radius: 0.75rem; margin-bottom: 0.5rem;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}

/* Live class premium */
.live-hero {
  position: relative; overflow: hidden; border-radius: 1.25rem; padding: 1.75rem 1.5rem;
  min-height: 200px;
}
.live-hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 80% at 10% 20%, rgba(56,189,248,0.35), transparent 50%),
    radial-gradient(ellipse 60% 60% at 90% 80%, rgba(124,58,237,0.4), transparent 50%),
    linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #312E81 100%);
}
.live-hero-content {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: center;
}
.live-join-box {
  width: min(100%, 280px);
  padding: 1.15rem;
  border-radius: 1rem;
  background: rgba(15,23,42,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
}
.live-code-input { background: rgba(15,23,42,0.7) !important; color: #fff !important; border-color: rgba(255,255,255,0.15) !important; }
.live-pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #EF4444; box-shadow: 0 0 0 0 rgba(239,68,68,0.5);
  animation: livePulse 1.5s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.live-card { padding: 1.15rem; display: flex; flex-direction: column; }
.live-card.is-live { border-color: rgba(239,68,68,0.4); box-shadow: 0 0 24px rgba(239,68,68,0.12); }
.live-card-top { display: flex; justify-content: space-between; margin-bottom: 0.65rem; }
.live-badge-live {
  font-size: 0.65rem; font-weight: 800; letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem; border-radius: 999px; background: #EF4444; color: #fff;
}
.live-card-cta { margin-top: auto; padding-top: 0.75rem; font-size: 0.85rem; font-weight: 700; color: var(--bp-accent); }

/* Live room fullscreen UI */
.live-room {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg-base);
}
.live-room-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.65rem 1rem; border-bottom: 1px solid var(--glass-border);
  background: var(--nav-bg); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 40;
}
.live-room-bar-left { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.live-room-back {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  text-decoration: none; color: var(--text-muted); border: 1px solid var(--glass-border);
  background: var(--glass-bg); font-weight: 700;
}
.live-room-back:hover { color: var(--text-primary); }
.live-room-title { font-weight: 800; font-size: 0.95rem; }
.live-room-sub { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.live-room-bar-actions { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.live-tab-btn {
  border: 1px solid var(--glass-border); background: var(--glass-bg); color: var(--text-secondary);
  font-size: 0.75rem; font-weight: 700; padding: 0.4rem 0.75rem; border-radius: 999px; cursor: pointer;
}
.live-tab-btn.is-active { background: var(--bp-accent); color: #fff; border-color: transparent; }
.live-chat-n {
  display: inline-block; min-width: 1.1rem; padding: 0 0.25rem; border-radius: 999px;
  background: rgba(255,255,255,0.2); font-size: 0.65rem;
}
.live-room-body {
  flex: 1; display: grid; grid-template-columns: 1fr 340px; min-height: 0;
}
@media (max-width: 1023px) {
  .live-room-body { grid-template-columns: 1fr; }
  .live-board-wrap.is-hidden-mobile { display: none; }
  .live-side:not(.is-open) { display: none; }
  .live-side.is-open { display: block; min-height: calc(100dvh - 60px); }
}
.live-board-wrap { display: flex; flex-direction: column; min-height: 0; padding: 0.65rem; }
.live-board-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  margin-bottom: 0.5rem; flex-wrap: wrap;
}
.live-tools { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.live-tool {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--glass-border);
  background: var(--glass-bg); cursor: pointer; font-size: 0.75rem; font-weight: 700;
  color: var(--text-secondary);
}
.live-tool.is-active { border-color: var(--bp-accent); color: var(--bp-accent); background: rgba(29,78,216,0.1); }
.live-color { width: 36px; height: 36px; border: none; border-radius: 10px; cursor: pointer; padding: 0; background: none; }
.live-size { width: 90px; }
.live-canvas-box {
  flex: 1; min-height: 360px; border-radius: 1rem; overflow: hidden;
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
.live-canvas-box canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.live-side { padding: 0.65rem; display: flex; flex-direction: column; min-height: 0; }
.live-side-inner {
  flex: 1; display: flex; flex-direction: column; min-height: 280px; max-height: calc(100dvh - 80px);
  border-radius: 1rem; overflow: hidden;
}
.live-side-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--glass-border);
}
.live-chat-msgs {
  flex: 1; overflow-y: auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.live-msg {
  max-width: 92%; padding: 0.55rem 0.75rem; border-radius: 0.85rem 0.85rem 0.85rem 0.25rem;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.live-msg.is-self {
  align-self: flex-end; border-radius: 0.85rem 0.85rem 0.25rem 0.85rem;
  background: rgba(29,78,216,0.15); border-color: rgba(29,78,216,0.25);
}
.live-msg-meta { display: flex; gap: 0.4rem; align-items: baseline; margin-bottom: 0.15rem; }
.live-msg-user { font-size: 0.72rem; font-weight: 700; color: var(--bp-accent); }
.live-msg-time { font-size: 0.65rem; color: var(--text-muted); }
.live-msg-text { font-size: 0.88rem; line-height: 1.45; word-break: break-word; }
.live-chat-form {
  display: flex; gap: 0.4rem; padding: 0.65rem; border-top: 1px solid var(--glass-border);
}
.live-person {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem; border-radius: 0.75rem; background: var(--glass-bg);
}
