/* ==========================================================================
   Bank Question — Medium Teal & Coral Identity (Premium Lab Layer)
   Faculty of AI · Clean, Colorful, Focused Academic Workspace

   Scoped to:
       html[data-ui-theme="premium-lab"]

   Palette:
     - Bright Medium Teal (--bg-main: #16464C, --bg-sidebar: #12383E, --bg-topbar: #173F45)
     - Calm Blue-Green Surfaces (--surface-card: #24636A, --surface-panel: #1F565D)
     - Clean Teal Borders (--border: #4B9695, --border-soft: #33747A)
     - Coral Actions & Accents (--coral: #F47B5C, --coral-hover: #FF9070)
     - Mint Green Accents (--mint: #6FD6B7)
     - Warm Off-White Text (--text-primary: #F3F3E8, --text-secondary: #C1D6D0)
     - Zero brown, beige, cream, dark muddy gray or neon colors
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] {
  color-scheme: dark;

  /* Rich Darker Blue-Teal Background with Lighter Cards */
  --bg-main: #0B1720;
  --bg-main-light: #101F2A;
  --bg-sidebar: #08121A;
  --bg-topbar: #0C1A24;

  --surface-card: #172B36;
  --surface-card-light: #1D3541;
  --surface-panel: #142631;
  --surface-hover: #23414D;

  --border: #315563;
  --border-soft: #25434F;

  --text-primary: #E8EEF0;
  --text-secondary: #B2C3C9;
  --text-muted: #78929B;

  --coral: #F47B5C;
  --coral-hover: #FF9070;
  --mint: #6FD6B7;
  --green: #91D36B;
  --yellow: #F0C34D;
  --red: #E77772;

  --surface-1: #2C626B;
  --surface-2: #34737A;
  --surface-3: #22535B;

  --border-subtle: #3B777A;
  --border-strong: #74B5B3;

  --accent-coral: #F47B5C;
  --accent-coral-hover: #FF9070;
  --accent-mint: #6FD6B7;
  --accent-green: #91D36B;
  --accent-yellow: #F0C34D;
  --accent-red: #E77772;

  /* Core palette tokens */
  --pl-bg: #0E1D27;
  --pl-bg-deep: #060D13;
  --pl-surface: #1B323D;
  --pl-surface-2: #22404B;
  --pl-surface-3: #142A35;
  --pl-border: #315563;
  --pl-border-soft: #25434F;
  --pl-text: #E8EEF0;
  --pl-text-2: #B2C3C9;
  --pl-text-muted: #78929B;
  --pl-accent: #F07858;
  --pl-accent: #F47B5C;
  --pl-accent-soft: #FFAB94;
  --pl-accent-strong: #FF9070;
  --pl-highlight: #F0C34D;
  --pl-success: #6FD6B7;
  --pl-warning: #F0C34D;
  --pl-error: #E77772;
  --pl-progress: #F47B5C;
  --pl-teal: #6FD6B7;

  /* Phase 11 / 17 exact match compatibility tokens */
  --compat-bg: #18363C;
  --compat-surface: #2C5056;
  --compat-surface-2: #345D62;
  --compat-coral: #F07858;
  --compat-coral-hover: #FF8966;
  --compat-yellow: #F2C04F;
  --compat-mint: #63D2B5;
  --compat-text: #F4F1E9;
  --compat-text-2: #D0DAD5;
  --compat-border: #5A8585;

  /* Tints */
  --pl-accent-tint: rgba(244, 123, 92, 0.20);
  --pl-accent-border: rgba(244, 123, 92, 0.45);
  --pl-accent-glow: rgba(244, 123, 92, 0.22);
  --pl-soft-tint: rgba(244, 123, 92, 0.14);
  --pl-soft-border: rgba(244, 123, 92, 0.35);
  --pl-highlight-tint: rgba(240, 195, 77, 0.18);
  --pl-highlight-border: rgba(240, 195, 77, 0.45);
  --pl-success-tint: rgba(111, 214, 183, 0.18);
  --pl-success-border: rgba(111, 214, 183, 0.45);
  --pl-warning-tint: rgba(240, 195, 77, 0.18);
  --pl-warning-border: rgba(240, 195, 77, 0.45);
  --pl-error-tint: rgba(231, 119, 114, 0.18);
  --pl-error-border: rgba(231, 119, 114, 0.45);

  /* Typography */
  --font-sans: "Plus Jakarta Sans", "Inter", "Segoe UI", "Helvetica Neue", Arial,
    "Noto Sans Arabic", "Noto Kufi Arabic", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", "Segoe UI", "Inter", "Helvetica Neue", Arial,
    "Noto Sans Arabic", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono",
    "Noto Sans Mono", monospace;
  --text-display: clamp(1.85rem, 3vw, 2.6rem);
  --text-h1: clamp(1.45rem, 2.2vw, 1.95rem);
  --text-h2: 1.22rem;
  --text-body: 0.94rem;
  --text-small: 0.82rem;
  --text-label: 0.68rem;
  --tracking-label: 0.1em;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --space-8: 2.5rem;

  /* Radii — Friendly rounded clay cards & controls */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 12px;
  --radius-controls: 10px;
  --radius-card: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Borders and gentle clay shadows */
  --border: var(--pl-border);
  --border-subtle: var(--pl-border-soft);
  --border-strong: #62AEAD;
  --shadow-sm: 0 2px 6px rgba(10, 35, 40, 0.22), 0 1px 2px rgba(10, 35, 40, 0.18);
  --shadow-md: 0 12px 28px -6px rgba(10, 35, 40, 0.38), 0 4px 10px -2px rgba(10, 35, 40, 0.22);
  --shadow-accent: 0 8px 20px -4px rgba(244, 123, 92, 0.32);
  --clay-icon-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.2), inset 0 -2px 4px rgba(10, 35, 40, 0.35), 0 5px 12px -3px rgba(10, 35, 40, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 150ms;
  --t-base: 220ms;
  --motion-duration-slow: 90s;
  --motion-duration-mid: 52s;
  --motion-intensity: 1;

  /* Application tokens remapped to the Rich Darker Teal Palette */
  --bg: var(--pl-bg);
  --bg-deep-contrast: var(--pl-bg-deep);
  --bg-secondary: #0D2830;
  --bg-sidebar: #0D2830;
  --bg-topbar: #0E303A;
  --bg-card: var(--pl-surface);
  --bg-card-hover: var(--surface-hover);
  --bg-elevated: var(--pl-surface-2);
  --bg-elevated-hover: #3F8588;
  --card: var(--pl-surface);

  --text: var(--pl-text);
  --text-secondary: var(--pl-text-2);
  --text-muted: var(--pl-text-muted);
  --muted: var(--pl-text-muted);

  --accent: var(--pl-accent);
  --accent-hover: var(--pl-accent-strong);
  --accent-text: var(--pl-accent-soft);
  --accent-tint: var(--pl-accent-tint);
  --accent-border: var(--pl-accent-border);
  --on-accent: #FFFFFF;

  --primary: var(--pl-accent);
  --primary-hover: var(--pl-accent-strong);
  --primary-soft: var(--pl-accent-tint);
  --primary-border: var(--pl-accent-border);
  --primary-glow: transparent;
  --on-primary: #FFFFFF;
  --brand-accent: var(--pl-accent);
  --brand-glow: transparent;

  --success: var(--pl-success);
  --success-bg: var(--pl-success-tint);
  --success-border: var(--pl-success-border);
  --danger: var(--pl-error);
  --danger-bg: var(--pl-error-tint);
  --danger-border: var(--pl-error-border);
  --warning: var(--pl-warning);
  --warning-bg: var(--pl-warning-tint);
  --warning-border: var(--pl-warning-border);
  --progress: var(--pl-progress);

  --lab-grid: rgba(111, 214, 183, 0.04);
  --lab-line: rgba(75, 150, 149, 0.45);
  --amber-primary: var(--pl-highlight);
}

/* Hide the optional ambient layer when disabled */
.lab-ambient {
  display: none;
}

html[data-ui-theme="premium-lab"] .lab-ambient {
  display: block;
}

/* --------------------------------------------------------------------------
   2. Global base
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] body {
  font-family: var(--font-sans);
  background-color: var(--pl-bg);
  background-image: linear-gradient(180deg, #0E1D27 0%, #10232D 100%);
  background-attachment: fixed;
  color: var(--pl-text);
  letter-spacing: 0.003em;
}

html[data-ui-theme="premium-lab"] ::selection {
  background: rgba(244, 123, 92, 0.35);
  color: #FFFFFF;
}

html[data-ui-theme="premium-lab"] :focus-visible {
  outline: 2px solid var(--pl-accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

html[data-ui-theme="premium-lab"] * {
  scrollbar-width: thin;
  scrollbar-color: #4B9695 transparent;
}

html[data-ui-theme="premium-lab"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html[data-ui-theme="premium-lab"] ::-webkit-scrollbar-thumb {
  background: #5A8585;
  border-radius: 999px;
  border: 2px solid var(--pl-bg);
}

html[data-ui-theme="premium-lab"] ::-webkit-scrollbar-track {
  background: transparent;
}

/* --------------------------------------------------------------------------
   3. Ambient background — animated cyber-grid & glowing square cells
   -------------------------------------------------------------------------- */
.lab-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--motion-intensity);
}

/* Crisp cyber-grid pattern matching target reference */
.lab-ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(99, 210, 181, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99, 210, 181, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  opacity: 0.85;
}

#cyberGridCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.72;
}

/* Animated glowing cyber tiles & pixel clusters */
.ambient-square-cluster {
  position: absolute;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  pointer-events: none;
  z-index: 1;
}

.ambient-square-cluster--left {
  left: 18px;
  top: 260px;
  width: 48px;
}

.ambient-square-cluster--right {
  right: 28px;
  top: 140px;
  width: 52px;
}

.ambient-square-cluster--bottom {
  right: 140px;
  bottom: 80px;
  width: 64px;
}

.sq-tile {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: rgba(111, 214, 183, 0.25);
  border: 1px solid rgba(111, 214, 183, 0.55);
  box-shadow: 0 0 8px rgba(111, 214, 183, 0.4);
  animation: cyberTilePulse 4s ease-in-out infinite alternate;
}

.sq-tile--1 { animation-delay: 0.1s; }
.sq-tile--2 { animation-delay: 0.7s; background: rgba(244, 123, 92, 0.28); border-color: rgba(244, 123, 92, 0.6); box-shadow: 0 0 8px rgba(244, 123, 92, 0.45); }
.sq-tile--3 { animation-delay: 1.2s; }
.sq-tile--4 { animation-delay: 1.8s; }
.sq-tile--5 { animation-delay: 2.3s; }
.sq-tile--6 { animation-delay: 0.3s; }
.sq-tile--7 { animation-delay: 1.1s; }
.sq-tile--8 { animation-delay: 1.9s; background: rgba(240, 195, 77, 0.28); border-color: rgba(240, 195, 77, 0.6); box-shadow: 0 0 8px rgba(240, 195, 77, 0.4); }
.sq-tile--9 { animation-delay: 2.5s; }
.sq-tile--10 { animation-delay: 0.5s; }
.sq-tile--11 { animation-delay: 1.4s; }
.sq-tile--12 { animation-delay: 2.2s; }

@keyframes cyberTilePulse {
  0% { transform: scale(0.9); opacity: 0.35; }
  50% { transform: scale(1.15); opacity: 0.95; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

/* Quiet floating bubbles */
html[data-ui-theme="premium-lab"] .lab-ambient::before,
html[data-ui-theme="premium-lab"] .lab-ambient::after {
  content: "";
  position: absolute;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.035), 0 0 28px rgba(255, 255, 255, 0.025);
  animation: labBubbleDrift 28s ease-in-out infinite alternate;
}

html[data-ui-theme="premium-lab"] .lab-ambient::before {
  left: 11%;
  bottom: 8%;
}

html[data-ui-theme="premium-lab"] .lab-ambient::after {
  width: 7rem;
  height: 7rem;
  right: 13%;
  top: 14%;
  animation-duration: 34s;
  animation-delay: -8s;
}

@keyframes labBubbleDrift {
  from { transform: translate3d(0, 14px, 0) scale(0.96); opacity: 0.42; }
  to { transform: translate3d(22px, -20px, 0) scale(1.04); opacity: 0.78; }
}

.lab-ambient-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(rgba(99, 210, 181, 0.05) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
  opacity: 0.45;
}

.lab-ambient-glow {
  position: absolute;
  width: 45vw;
  height: 45vw;
  min-width: 320px;
  min-height: 320px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
}

.lab-ambient-glow--violet {
  top: -14%;
  right: -6%;
  background: radial-gradient(circle, rgba(240, 120, 88, 0.15), transparent 70%);
  animation: ambientBlobFloat1 24s ease-in-out infinite alternate;
}

.lab-ambient-glow--plum {
  bottom: -18%;
  left: -8%;
  background: radial-gradient(circle, rgba(99, 210, 181, 0.14), transparent 70%);
  animation: ambientBlobFloat2 28s ease-in-out infinite alternate;
}

.lab-ambient-glow--center {
  top: 35%;
  left: 30%;
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, rgba(99, 210, 181, 0.08), transparent 70%);
  animation: ambientBlobFloat1 32s ease-in-out infinite alternate;
}

@keyframes ambientBlobFloat1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-25px, 35px, 0) scale(1.06); }
  100% { transform: translate3d(15px, 50px, 0) scale(0.96); }
}

@keyframes ambientBlobFloat2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(30px, -25px, 0) scale(1.05); }
  100% { transform: translate3d(-15px, -40px, 0) scale(0.96); }
}

.lab-ambient-sweep {
  display: none;
}

.lab-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.lab-particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(160, 240, 245, 0.45));
  opacity: 0.14;
  box-shadow: 0 0 6px rgba(180, 245, 250, 0.25);
  animation: lab-particle-float var(--dur) ease-in-out infinite alternate;
  animation-delay: var(--delay);
  pointer-events: none;
}

@keyframes lab-particle-float {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.09; }
  50% { transform: translate3d(6px, -14px, 0) scale(1.08); opacity: 0.18; }
  100% { transform: translate3d(-6px, -28px, 0) scale(0.96); opacity: 0.11; }
}

/* Keep app surfaces above the atmosphere. */
html[data-ui-theme="premium-lab"] .app-shell,
html[data-ui-theme="premium-lab"] .mobile-bottom-bar {
  position: relative;
  z-index: 1;
}

html[data-ui-theme="premium-lab"] body.lab-focus-mode .lab-particle {
  animation-play-state: paused;
}

/* --------------------------------------------------------------------------
   4. Shell, sidebar (full-height track + mobile drawer) and top bar
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

@media (min-width: 769px) {
  html[data-ui-theme="premium-lab"] .app-shell {
    display: flex;
  }
  /* Fixed sidebar bug: Removed .app-shell::before dark column overlay that covered dashboard on collapse */
  html[data-ui-theme="premium-lab"] .app-shell::before {
    display: none !important;
  }
  html[data-ui-theme="premium-lab"][dir="rtl"] .app-shell::before {
    display: none !important;
  }
  html[data-ui-theme="premium-lab"] .app-sidebar {
    background: #0D2830;
    border-right: 1px solid var(--pl-border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 264px;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 50;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  html[data-ui-theme="premium-lab"][dir="rtl"] .app-sidebar {
    left: auto;
    right: 0;
    border-right: 0;
    border-left: 1px solid var(--pl-border);
  }
  html[data-ui-theme="premium-lab"] .app-content-area {
    margin-left: 264px;
    width: calc(100% - 264px);
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    transition: margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1), margin-right 0.28s cubic-bezier(0.16, 1, 0.3, 1), width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  html[data-ui-theme="premium-lab"][dir="rtl"] .app-content-area {
    margin-left: 0;
    margin-right: 264px;
  }
  html[data-ui-theme="premium-lab"] .sidebar-mobile-close-btn,
  html[data-ui-theme="premium-lab"] .mobile-sidebar-backdrop {
    display: none !important;
  }
}

/* Sidebar 3-bars toggle button - active on Desktop & Mobile */
.mobile-menu-toggle-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  cursor: pointer;
  margin-inline-end: 0.75rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}
.mobile-menu-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--coral);
  transform: scale(1.05);
}
.mobile-menu-toggle-btn:active {
  transform: scale(0.95);
}

/* Desktop sidebar collapsing - completely expands content area across full viewport */
@media (min-width: 769px) {
  body.sidebar-collapsed .app-sidebar {
    transform: translateX(-100%) !important;
  }
  body.sidebar-collapsed .app-content-area {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }
  html[dir="rtl"] body.sidebar-collapsed .app-sidebar {
    transform: translateX(100%) !important;
  }
  html[dir="rtl"] body.sidebar-collapsed .app-content-area {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }
}

html[data-ui-theme="premium-lab"] .app-sidebar {
  background: #0D2830;
  border-right: 1px solid var(--pl-border);
}

html[data-ui-theme="premium-lab"] .sidebar-brand-bar {
  border-bottom: 1px solid var(--pl-border);
  padding: 1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

html[data-ui-theme="premium-lab"] .brand-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .brand-mark-svg {
  border-radius: 9px;
  box-shadow: var(--clay-icon-shadow);
}

html[data-ui-theme="premium-lab"] .brand-mark-svg rect {
  fill: #173F45;
  stroke: var(--pl-accent);
}

html[data-ui-theme="premium-lab"] .brand-mark-svg circle,
html[data-ui-theme="premium-lab"] .brand-mark-svg line {
  stroke: var(--pl-accent);
}

html[data-ui-theme="premium-lab"] .brand-mark-svg circle[fill] {
  fill: var(--pl-accent);
}

html[data-ui-theme="premium-lab"] .sidebar-group-label {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--pl-text-muted);
  text-transform: uppercase;
}

html[data-ui-theme="premium-lab"] .btn-nav {
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--pl-text-2);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.55rem 0.7rem;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

html[data-ui-theme="premium-lab"] .btn-nav:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--pl-border);
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .btn-nav.active {
  background: rgba(244, 123, 92, 0.16) !important;
  border-color: rgba(244, 123, 92, 0.45) !important;
  color: var(--pl-text) !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(10, 35, 40, 0.25), inset 3px 0 0 var(--pl-accent);
}

html[data-ui-theme="premium-lab"] .btn-nav.active .nav-icon {
  color: var(--pl-accent);
  stroke: var(--pl-accent) !important;
}

html[data-ui-theme="premium-lab"] .sidebar-subject-item {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.48rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .sidebar-subject-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--pl-border);
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .sidebar-subject-item.active {
  background: var(--pl-surface);
  border-color: var(--pl-accent-border);
  color: var(--pl-text);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

html[data-ui-theme="premium-lab"] .app-topbar {
  background: rgba(14, 48, 58, 0.94);
  border-bottom: 1px solid var(--pl-border);
  backdrop-filter: blur(12px);
  padding: 0.6rem 1.35rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

html[data-ui-theme="premium-lab"] .topbar-context {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .faculty-term-btn,
html[data-ui-theme="premium-lab"] .student-profile-btn {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-pill);
  color: var(--pl-text-2);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 0.36rem 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

html[data-ui-theme="premium-lab"] .faculty-term-btn:hover,
html[data-ui-theme="premium-lab"] .student-profile-btn:hover {
  border-color: var(--pl-accent-border);
  background: var(--pl-surface-2);
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .topbar-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  color: #F2F7F8;
  background: linear-gradient(135deg, rgba(244, 123, 92, 0.2) 0%, rgba(23, 43, 54, 0.92) 100%);
  border: 1.5px solid rgba(244, 123, 92, 0.55);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), 0 0 12px rgba(244, 123, 92, 0.15);
  transition: all 0.2s ease;
}

html[data-ui-theme="premium-lab"] .topbar-login-btn:hover {
  background: linear-gradient(135deg, rgba(244, 123, 92, 0.35) 0%, rgba(29, 55, 68, 0.98) 100%);
  border-color: #F47B5C;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 123, 92, 0.3);
}

.guest-sub-badge {
  font-size: 0.64rem;
  font-weight: 600;
  color: #B2C3C9;
  padding-left: 0.35rem;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-mode-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem 0;
}

.auth-mode-tab {
  flex: 1;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
}

.auth-mode-tab.active {
  color: var(--text-primary);
  border-color: var(--coral);
  background: rgba(244, 123, 92, 0.16);
}

@media (min-width: 769px) {
  .subject-bento-hub,
  #subjectBentoHub,
  #mobileSubjectBento {
    display: none !important;
  }

  #subjectQuizzesView .subject-tabs-bar {
    display: flex !important;
  }
}

html[data-ui-theme="premium-lab"] .admin-access-btn {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-pill);
  color: var(--pl-text-2);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.36rem 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

html[data-ui-theme="premium-lab"] .admin-access-btn:hover {
  border-color: var(--pl-accent-border);
  color: var(--pl-accent-soft);
  background: var(--pl-surface-2);
}

html[data-ui-theme="premium-lab"] .topbar-creator-capsule {
  opacity: 0.88;
}

html[data-ui-theme="premium-lab"] .container {
  max-width: 1460px;
  padding: 1.25rem 1.5rem 3.25rem;
}

/* --------------------------------------------------------------------------
   5. Typography helpers
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .dashboard-hero-title,
html[data-ui-theme="premium-lab"] .section-title,
html[data-ui-theme="premium-lab"] .subject-hero-title,
html[data-ui-theme="premium-lab"] .lecture-page-title,
html[data-ui-theme="premium-lab"] #playerQuizTitle,
html[data-ui-theme="premium-lab"] #resultsQuizTitle {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .dashboard-hero-title {
  font-size: 1.5rem;
  font-weight: 700;
}

html[data-ui-theme="premium-lab"] .section-title {
  font-size: 1.24rem;
  font-weight: 700;
}

html[data-ui-theme="premium-lab"] .section-subtitle,
html[data-ui-theme="premium-lab"] .text-muted {
  color: var(--pl-text-muted);
}

/* --------------------------------------------------------------------------
   6. Buttons, badges, inputs, cards
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .btn {
  border-radius: var(--radius-controls);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  border: 1px solid var(--pl-border);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}

html[data-ui-theme="premium-lab"] .btn-primary {
  background: linear-gradient(180deg, #F47B5C 0%, #E26848 100%);
  border-color: #D65A3A;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 3px 10px -2px rgba(244, 123, 92, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

html[data-ui-theme="premium-lab"] .btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #FF9070 0%, #F47B5C 100%);
  border-color: #E26848;
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -2px rgba(244, 123, 92, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

html[data-ui-theme="premium-lab"] .btn-secondary {
  background: var(--pl-surface);
  border-color: var(--pl-border);
  color: var(--pl-text-2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

html[data-ui-theme="premium-lab"] .btn-secondary:hover:not(:disabled) {
  background: var(--pl-surface-2);
  border-color: var(--pl-accent-border);
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .btn-ghost:hover:not(:disabled) {
  color: var(--pl-accent-soft);
  background: rgba(244, 123, 92, 0.12);
}

html[data-ui-theme="premium-lab"] .btn-danger-outline {
  border-color: var(--pl-error-border);
  color: var(--pl-error);
  background: var(--pl-surface);
}

html[data-ui-theme="premium-lab"] .btn-danger {
  background: var(--pl-error);
  border-color: #9E3B30;
  color: #FFFFFF;
}

html[data-ui-theme="premium-lab"] .badge {
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--pl-border);
  background: var(--pl-surface-3);
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .badge-subject {
  border-color: var(--pl-accent-border);
  background: var(--pl-accent-tint);
  color: var(--pl-accent-soft);
}

html[data-ui-theme="premium-lab"] .badge-mode {
  border-color: var(--pl-border);
  background: var(--pl-surface-3);
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .badge-success {
  border-color: var(--pl-success-border);
  background: var(--pl-success-tint);
  color: var(--pl-success);
}

html[data-ui-theme="premium-lab"] .badge-warning {
  border-color: var(--pl-warning-border);
  background: var(--pl-warning-tint);
  color: var(--pl-warning);
}

html[data-ui-theme="premium-lab"] .card,
html[data-ui-theme="premium-lab"] .lab-panel,
html[data-ui-theme="premium-lab"] .content-panel {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .input-text,
html[data-ui-theme="premium-lab"] .input-select,
html[data-ui-theme="premium-lab"] .input-textarea {
  background: var(--pl-surface-2);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-controls);
  color: var(--pl-text);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  min-height: 40px;
}

html[data-ui-theme="premium-lab"] .input-text::placeholder,
html[data-ui-theme="premium-lab"] .input-textarea::placeholder {
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .input-text:focus,
html[data-ui-theme="premium-lab"] .input-select:focus,
html[data-ui-theme="premium-lab"] .input-textarea:focus {
  border-color: var(--pl-accent);
  box-shadow: 0 0 0 3px rgba(244, 123, 92, 0.25);
  outline: none;
}

html[data-ui-theme="premium-lab"] .pill {
  border-radius: var(--radius-pill);
  border: 1px solid var(--pl-border);
  background: var(--pl-surface);
  color: var(--pl-text-2);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
}

html[data-ui-theme="premium-lab"] .pill:hover {
  border-color: var(--pl-accent-border);
  background: var(--pl-surface-2);
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .pill.active {
  border-color: var(--pl-accent);
  background: var(--pl-accent);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(244, 123, 92, 0.35);
}

/* --------------------------------------------------------------------------
   7. Dashboard (Compact, calm, friendly overview)
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .dashboard-header {
  margin-bottom: 0.7rem;
}

html[data-ui-theme="premium-lab"] .dashboard-header::after {
  content: "Faculty of AI · Term 1 Study Workspace";
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .lab-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  background: linear-gradient(168deg, #122B32 0%, #0E2228 100%);
  border: 1.5px solid rgba(111, 214, 183, 0.55);
  border-radius: 18px;
  padding: clamp(0.75rem, 1.4vw, 1.15rem) clamp(0.95rem, 1.8vw, 1.35rem);
  margin-bottom: 0.25rem;
  overflow: visible;
  box-shadow: 0 0 25px rgba(111, 214, 183, 0.12), 0 8px 30px rgba(0, 0, 0, 0.45);
}

html[data-ui-theme="premium-lab"] .lab-hero::before,
html[data-ui-theme="premium-lab"] .lab-hero::after {
  content: none !important;
}

/* Glowing Top-Right Beacon LED */
.lab-hero-corner-led {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6FD6B7;
  box-shadow: 0 0 10px #6FD6B7, 0 0 18px rgba(111, 214, 183, 0.8);
  animation: beaconPulse 2.4s ease-in-out infinite;
}

@keyframes beaconPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Hero Top Content Row (Left Copy | Center Cyber Rig | Right Activity & Progress) */
.lab-hero-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1.15fr);
  gap: 1.25rem;
  align-items: center;
}

html[data-ui-theme="premium-lab"] .lab-hero-copy {
  position: relative;
  z-index: 1;
}

html[data-ui-theme="premium-lab"] .lab-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--pl-text-muted);
  margin-bottom: 0.2rem;
}

html[data-ui-theme="premium-lab"] .lab-hero-heading,
.lab-hero-heading {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

html[data-ui-theme="premium-lab"] .lab-hero-sub {
  max-width: 44ch;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .lab-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

html[data-ui-theme="premium-lab"] .lab-chip {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  padding: 0.16rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--pl-text-2);
  background: rgba(0, 0, 0, 0.25);
}

html[data-ui-theme="premium-lab"] .lab-chip:first-child {
  border-color: rgba(244, 123, 92, 0.45);
  color: var(--pl-accent-soft);
  background: rgba(244, 123, 92, 0.12);
}

html[data-ui-theme="premium-lab"] .lab-chip-muted {
  color: var(--pl-text-muted);
}

/* Center Interactive AI Lab Apparatus Rig */
.lab-hero-rig {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 0 0.5rem;
}

.rig-top-cylinder {
  width: 52px;
  height: 20px;
  background: #14353E;
  border: 1.5px solid #2B6774;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cylinder-fluid-level {
  position: absolute;
  top: 4px;
  left: 6px;
  right: 6px;
  height: 6px;
  background: #6FD6B7;
  border-radius: 3px;
  box-shadow: 0 0 10px #6FD6B7;
  animation: fluidGlow 3s ease-in-out infinite alternate;
}

@keyframes fluidGlow {
  0% { opacity: 0.6; filter: brightness(0.9); }
  100% { opacity: 1; filter: brightness(1.25); }
}

.cylinder-pipe {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 10px;
  background: #235560;
  border: 1px solid #3B7C8A;
}

.rig-console-body {
  width: 96px;
  background: #102931;
  border: 1.5px solid #2F7280;
  border-radius: 10px;
  padding: 0.45rem 0.5rem;
  margin-top: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.rig-gauge-screen {
  height: 14px;
  background: #08161A;
  border: 1px solid #1D4B54;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.gauge-fill {
  position: absolute;
  top: 2px;
  left: 2px;
  bottom: 2px;
  width: 72%;
  background: linear-gradient(90deg, #379579, #6FD6B7);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(111, 214, 183, 0.7);
  animation: gaugePulse 3.5s ease-in-out infinite;
}

@keyframes gaugePulse {
  0% { width: 55%; }
  50% { width: 85%; }
  100% { width: 55%; }
}

.gauge-ticks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  pointer-events: none;
}

.gauge-ticks span {
  width: 1px;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
}

.rig-console-pins {
  display: flex;
  gap: 4px;
  padding-left: 2px;
}

.rig-console-pins span {
  width: 8px;
  height: 3px;
  background: #255864;
  border-radius: 1px;
}

.rig-dial-knob {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #19404B 0%, #0C2127 100%);
  border: 1.5px solid #368292;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5), 0 0 8px rgba(111, 214, 183, 0.2);
  align-self: flex-end;
  position: relative;
  margin-top: -16px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.rig-dial-knob:hover {
  transform: rotate(35deg);
}

.dial-indicator {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 7px;
  background: #6FD6B7;
  border-radius: 1px;
  box-shadow: 0 0 4px #6FD6B7;
}

.rig-vertical-pipe-exit {
  width: 6px;
  height: 22px;
  background: #22525D;
  border: 1px solid #368090;
  margin-top: -1px;
  z-index: 2;
}

/* Right Cluster: Activity Mini-Graph + Overall Progress Block */
.lab-hero-right-cluster {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  justify-content: flex-end;
}

.hero-activity-graph {
  background: #09171C;
  border: 1.5px solid #1A404A;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
  min-width: 175px;
}

.graph-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.54rem;
  font-weight: 600;
  color: var(--pl-text-muted);
  line-height: 1;
}

.graph-plot-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
}

.graph-spline-svg {
  width: 100%;
  height: 48px;
  overflow: visible;
}

.graph-curve-line {
  filter: drop-shadow(0 0 6px rgba(111, 214, 183, 0.45));
}

.graph-node-pulse {
  animation: nodeGlow 2s ease-in-out infinite alternate;
}

@keyframes nodeGlow {
  0% { r: 3.5; opacity: 0.8; filter: drop-shadow(0 0 4px #F47B5C); }
  100% { r: 5; opacity: 1; filter: drop-shadow(0 0 10px #F47B5C); }
}

.graph-x-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.56rem;
  font-weight: 600;
  color: var(--pl-text-muted);
  margin-top: 0.2rem;
  padding: 0 4px;
}

html[data-ui-theme="premium-lab"] .lab-hero-progress {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 120px;
}

html[data-ui-theme="premium-lab"] .lab-progress-number,
.lab-progress-number {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.4vw, 2.4rem);
  line-height: 1;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.03em;
}

html[data-ui-theme="premium-lab"] .lab-progress-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pl-text-muted);
  margin-top: 0.2rem;
}

html[data-ui-theme="premium-lab"] .lab-progress-track {
  height: 5px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  margin-top: 0.35rem;
  overflow: hidden;
}

html[data-ui-theme="premium-lab"] .lab-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6FD6B7, #F47B5C);
  border-radius: inherit;
  transition: width 420ms var(--ease);
}

html[data-ui-theme="premium-lab"] .lab-progress-meta {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--pl-text-muted);
  white-space: nowrap;
}

/* Stat strip — integrated overall statistics & Live Micro-Visualizations */
html[data-ui-theme="premium-lab"] .stats-compact-row.lab-hero-stats,
.stats-compact-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
  background: #0B1C22;
  border: 1.5px solid #1C444F;
  border-radius: 13px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0;
}

html[data-ui-theme="premium-lab"] .stat-card {
  background: #112830 !important;
  border: 1px solid #1D4B56 !important;
  border-radius: 9px !important;
  padding: 0.45rem 0.55rem !important;
  position: relative;
  overflow: hidden;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.35rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html[data-ui-theme="premium-lab"] .stat-card::before {
  content: none !important;
}

.stat-card-left {
  flex: 1;
  min-width: 0;
}

html[data-ui-theme="premium-lab"] .stat-card .stat-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pl-text-muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-ui-theme="premium-lab"] .stat-card .stat-value {
  display: block;
  margin-top: 0.12rem;
  font-family: var(--font-display);
  font-size: 1.15rem !important;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Micro-Visualizations beside stat values */
.stat-micro-viz {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 1. Questions Equalizer */
.micro-viz--eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
  padding-bottom: 2px;
}

.micro-viz--eq .eq-col {
  width: 2.5px;
  background: #6FD6B7;
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(111, 214, 183, 0.5);
  animation: eqJump 1.2s ease-in-out infinite alternate;
}

.micro-viz--eq .eq-col:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.micro-viz--eq .eq-col:nth-child(2) { height: 14px; animation-delay: 0.35s; }
.micro-viz--eq .eq-col:nth-child(3) { height: 9px; animation-delay: 0.2s; }
.micro-viz--eq .eq-col:nth-child(4) { height: 18px; animation-delay: 0.5s; }
.micro-viz--eq .eq-col:nth-child(5) { height: 12px; animation-delay: 0.25s; }
.micro-viz--eq .eq-col:nth-child(6) { height: 16px; animation-delay: 0.4s; }
.micro-viz--eq .eq-col:nth-child(7) { height: 8px; animation-delay: 0.15s; }

@keyframes eqJump {
  0% { transform: scaleY(0.4); opacity: 0.6; }
  100% { transform: scaleY(1); opacity: 1; }
}

/* 2. Matrix Dot Grid */
.micro-viz--matrix .matrix-dot-grid {
  display: grid;
  grid-template-columns: repeat(4, 3.5px);
  gap: 3px;
}

.m-dot {
  width: 3.5px;
  height: 3.5px;
  border-radius: 1px;
  background: rgba(111, 214, 183, 0.2);
}

.m-dot.on {
  background: #6FD6B7;
  box-shadow: 0 0 4px #6FD6B7;
  animation: dotMatrixBlink 2.2s ease-in-out infinite alternate;
}

@keyframes dotMatrixBlink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* 3. Quiz Attempts Pulse Bars */
.micro-viz--pulse-bars {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 18px;
}

.pulse-bar {
  width: 3px;
  background: #F47B5C;
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(244, 123, 92, 0.5);
  animation: pulseBarBounce 1.5s ease-in-out infinite alternate;
}

.pulse-bar.bar-1 { height: 7px; animation-delay: 0.1s; }
.pulse-bar.bar-2 { height: 15px; animation-delay: 0.4s; }
.pulse-bar.bar-3 { height: 10px; animation-delay: 0.25s; }
.pulse-bar.bar-4 { height: 16px; animation-delay: 0.5s; }

@keyframes pulseBarBounce {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.1); }
}

/* 4. Accuracy Audio Wave */
.micro-viz--wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 18px;
}

.wave-slice {
  width: 2.5px;
  background: #F0C34D;
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(240, 195, 77, 0.4);
  animation: waveHeight 1.4s ease-in-out infinite alternate;
}

.wave-slice.slice-1 { height: 5px; animation-delay: 0.1s; }
.wave-slice.slice-2 { height: 13px; animation-delay: 0.3s; }
.wave-slice.slice-3 { height: 17px; animation-delay: 0.5s; }
.wave-slice.slice-4 { height: 11px; animation-delay: 0.25s; }
.wave-slice.slice-5 { height: 6px; animation-delay: 0.4s; }

@keyframes waveHeight {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* 5. Saved Questions Matrix Digits */
.micro-viz--digits .digits-stream {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  line-height: 1;
  color: #6FD6B7;
  letter-spacing: 0.05em;
  opacity: 0.85;
  animation: digitsFlicker 3s ease-in-out infinite alternate;
}

@keyframes digitsFlicker {
  0% { opacity: 0.5; filter: brightness(0.8); }
  100% { opacity: 1; filter: brightness(1.2); }
}

/* 6. Mistakes Oscilloscope Sparkline */
.micro-viz--sparkline .sparkline-svg {
  width: 44px;
  height: 18px;
  color: #F47B5C;
}

.sparkline-path {
  filter: drop-shadow(0 0 4px rgba(244, 123, 92, 0.6));
  stroke-dasharray: 60;
  stroke-dashoffset: 0;
  animation: sparklinePulse 3s linear infinite;
}

@keyframes sparklinePulse {
  0% { stroke-dashoffset: 60; }
  100% { stroke-dashoffset: 0; }
}

/* DECORATIVE ANIMATED CYBER-CIRCUIT PIPES EXTENDING FROM HERO */
.hero-conduit-system {
  position: relative;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -6px 0 0.85rem;
  pointer-events: none;
  z-index: 2;
}

.conduit-feeder-pipe {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 24px;
  background: #183F49;
  border: 1.5px solid #2B6774;
  overflow: hidden;
}

.conduit-pulse-bead {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: #6FD6B7;
  box-shadow: 0 0 8px #6FD6B7;
  animation: beadTravelDown 2.2s ease-in-out infinite;
}

@keyframes beadTravelDown {
  0% { top: -6px; opacity: 0; }
  40% { opacity: 1; }
  100% { top: 24px; opacity: 0; }
}

.conduit-junction-box {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 20px;
  background: #123038;
  border: 1.5px solid #368292;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

.junction-indicator {
  width: 8px;
  height: 4px;
  background: #F47B5C;
  border-radius: 1px;
  box-shadow: 0 0 6px #F47B5C;
}

.conduit-duct-left {
  position: absolute;
  top: 26px;
  right: calc(50% + 15px);
  width: 220px;
  height: 18px;
  color: #368292;
}

.conduit-scope-monitor {
  position: absolute;
  top: 18px;
  left: calc(50% + 40px);
  width: 76px;
  height: 26px;
  background: #09171C;
  border: 1.5px solid #2B6E7D;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6), 0 0 10px rgba(111, 214, 183, 0.15);
  z-index: 3;
}

.scope-wave {
  filter: drop-shadow(0 0 4px #6FD6B7);
  animation: scopeScan 3s linear infinite;
}

@keyframes scopeScan {
  0% { stroke-dasharray: 20 5; stroke-dashoffset: 0; }
  100% { stroke-dasharray: 20 5; stroke-dashoffset: 50; }
}

.conduit-duct-right {
  position: absolute;
  top: 26px;
  left: calc(50% + 115px);
  width: 260px;
  height: 18px;
  color: #368292;
}

.conduit-wireframe-svg {
  width: 100%;
  height: 100%;
}

html[data-ui-theme="premium-lab"] .stat-card:nth-child(3) .stat-value,
html[data-ui-theme="premium-lab"] .stat-card:nth-child(4) .stat-value {
  color: var(--pl-accent-soft);
}

html[data-ui-theme="premium-lab"] .stat-card:nth-child(5) .stat-value {
  color: var(--pl-highlight);
}

html[data-ui-theme="premium-lab"] .stat-card:nth-child(6) .stat-value {
  color: var(--pl-error);
}

/* Dashboard controls */
html[data-ui-theme="premium-lab"] .dashboard-controls-bar {
  gap: 0.85rem;
  margin-bottom: 1rem;
}

html[data-ui-theme="premium-lab"] .subject-search-input {
  background: var(--pl-surface-2);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-pill);
  padding: 0.58rem 0.95rem 0.58rem 2.45rem;
  color: var(--pl-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

html[data-ui-theme="premium-lab"] .subject-search-input:focus {
  border-color: var(--pl-accent);
  box-shadow: 0 0 0 3px rgba(244, 123, 92, 0.25);
}

html[data-ui-theme="premium-lab"] .continue-banner {
  background: var(--pl-surface);
  border: 1px solid var(--pl-accent-border);
  border-left: 4px solid var(--pl-accent);
  border-radius: var(--radius-card);
  padding: 0.8rem 1.05rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .continue-banner.hidden {
  display: none !important;
}

html[data-ui-theme="premium-lab"] .continue-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pl-accent-soft);
}

html[data-ui-theme="premium-lab"] .continue-title {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--pl-text);
}

/* --------------------------------------------------------------------------
   8. Subject cards — Balanced, compact, soft semi-3D clay icon tiles
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .subjects-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

@media (max-width: 1199px) {
  html[data-ui-theme="premium-lab"] .subjects-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
  }
}

@media (max-width: 899px) {
  html[data-ui-theme="premium-lab"] .subjects-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
  }
}

@media (max-width: 599px) {
  html[data-ui-theme="premium-lab"] .subjects-card-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

html[data-ui-theme="premium-lab"] .subject-card {
  --s-accent: #F47B5C;
  --s-soft: rgba(244, 123, 92, 0.16);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.55rem;
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  padding: 0.8rem 0.9rem;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base) var(--ease), border-color var(--t-base) var(--ease),
    background var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}

html[data-ui-theme="premium-lab"] .subject-card:hover,
html[data-ui-theme="premium-lab"] .subject-card:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--s-accent) 60%, var(--pl-border)) !important;
  background: var(--pl-surface-2);
  box-shadow: var(--shadow-md);
}

html[data-ui-theme="premium-lab"] .subject-card::before,
html[data-ui-theme="premium-lab"] .subject-card::after {
  content: none !important;
}

html[data-ui-theme="premium-lab"] .subject-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--s-accent), color-mix(in srgb, var(--s-accent) 30%, transparent));
  opacity: 0.95;
  pointer-events: none;
}

html[data-ui-theme="premium-lab"] .subject-card.is-last-active {
  border-color: color-mix(in srgb, var(--s-accent) 50%, var(--pl-border));
}

html[data-ui-theme="premium-lab"] .subject-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

/* Soft semi-3D clay icon tile */
html[data-ui-theme="premium-lab"] .subject-card-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--s-accent) 26%, var(--pl-surface-3)), color-mix(in srgb, var(--s-accent) 14%, var(--pl-surface)));
  border: 1px solid color-mix(in srgb, var(--s-accent) 40%, transparent);
  color: var(--s-accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--clay-icon-shadow);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html[data-ui-theme="premium-lab"] .subject-icon-svg {
  stroke: var(--s-accent);
  width: 18px;
  height: 18px;
}

html[data-ui-theme="premium-lab"] .subject-card-title-group {
  flex: 1;
  min-width: 0;
}

html[data-ui-theme="premium-lab"] .subject-card-code-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.12rem;
}

html[data-ui-theme="premium-lab"] .subject-code {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--s-accent);
  border: 1px solid color-mix(in srgb, var(--s-accent) 35%, transparent);
  border-radius: 5px;
  padding: 0.04rem 0.3rem;
  background: var(--s-soft);
}

html[data-ui-theme="premium-lab"] .subject-code-label {
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .subject-card-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .subject-card-subline {
  font-size: 0.7rem;
  color: var(--pl-text-muted);
  margin-top: 0.1rem;
}

html[data-ui-theme="premium-lab"] .subject-status-pill {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.14rem 0.42rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--pl-border);
  margin-left: auto;
  align-self: flex-start;
  white-space: nowrap;
}

html[data-ui-theme="premium-lab"] .subject-status-pill.not-started {
  color: var(--pl-text-muted);
  background: var(--pl-surface-3);
}

html[data-ui-theme="premium-lab"] .subject-status-pill.in-progress {
  color: var(--s-accent);
  border-color: color-mix(in srgb, var(--s-accent) 45%, transparent);
  background: var(--s-soft);
}

html[data-ui-theme="premium-lab"] .subject-status-pill.completed {
  color: var(--pl-success);
  border-color: var(--pl-success-border);
  background: var(--pl-success-tint);
}

html[data-ui-theme="premium-lab"] .subject-card-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.18rem;
  border: 1px solid var(--pl-border-soft);
  border-radius: 9px;
  padding: 0.35rem 0.28rem;
  background: var(--pl-surface-2);
}

html[data-ui-theme="premium-lab"] .subject-card-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
  text-align: center;
  min-width: 0;
}

html[data-ui-theme="premium-lab"] .subject-stat-icon {
  width: 12px;
  height: 12px;
  color: var(--s-accent);
  opacity: 0.9;
}

html[data-ui-theme="premium-lab"] .subject-card-stat strong {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--pl-text);
  line-height: 1.05;
}

html[data-ui-theme="premium-lab"] .subject-card-stat span {
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--pl-text-muted);
  white-space: nowrap;
}

/* Compact inline progress row — eliminates huge empty gap on unstarted cards */
html[data-ui-theme="premium-lab"] .subject-card-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.08rem;
  padding-top: 0.08rem;
}

html[data-ui-theme="premium-lab"] .subject-card-progress-copy {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

html[data-ui-theme="premium-lab"] .subject-completion-huge {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--s-accent);
  line-height: 1;
}

html[data-ui-theme="premium-lab"] .subject-progress-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .subject-progress-fraction {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--pl-text-muted);
  white-space: nowrap;
}

html[data-ui-theme="premium-lab"] .subject-not-started {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .subject-card-progress {
  margin-top: 0;
}

html[data-ui-theme="premium-lab"] .subject-progress-track {
  height: 4px;
  background: var(--pl-surface-3);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

html[data-ui-theme="premium-lab"] .subject-progress-fill {
  height: 100%;
  background: var(--s-accent);
  border-radius: inherit;
  transition: width 420ms var(--ease);
}

html[data-ui-theme="premium-lab"] .subject-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.2rem;
}

html[data-ui-theme="premium-lab"] .subject-card-footnote {
  font-size: 0.68rem;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .subject-card-cta {
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
  flex-shrink: 0;
}

/* Distinct Subject Accents (Medium Teal Harmonious Academic Palette: Coral, Mint, Green, Yellow, Orange, Muted Red) */
html[data-ui-theme="premium-lab"] [data-subject-id="logic-number-systems"] {
  --s-accent: #F0C34D;
  --s-soft: rgba(240, 195, 77, 0.18);
}

html[data-ui-theme="premium-lab"] [data-subject-id="data-mining"] {
  --s-accent: #91D36B;
  --s-soft: rgba(145, 211, 107, 0.18);
}

html[data-ui-theme="premium-lab"] [data-subject-id="data-communication-networks-csc214"] {
  --s-accent: #6FD6B7;
  --s-soft: rgba(111, 214, 183, 0.18);
}

html[data-ui-theme="premium-lab"] [data-subject-id="operations-research"] {
  --s-accent: #F47B5C;
  --s-soft: rgba(244, 123, 92, 0.18);
}

html[data-ui-theme="premium-lab"] [data-subject-id="machine-learning-pattern-recognition"] {
  --s-accent: #F47B5C;
  --s-soft: rgba(244, 123, 92, 0.18);
}

html[data-ui-theme="premium-lab"] [data-subject-id="numerical-analysis"] {
  --s-accent: #E77772;
  --s-soft: rgba(231, 119, 114, 0.18);
}

/* --------------------------------------------------------------------------
   9. Subject workspace & Tab panels
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .breadcrumb-bar {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

html[data-ui-theme="premium-lab"] .btn-back {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-pill);
  color: var(--pl-text-2);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.38rem 0.85rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

html[data-ui-theme="premium-lab"] .btn-back:hover {
  color: var(--pl-text);
  border-color: var(--pl-accent-border);
  background: var(--pl-surface-2);
}

html[data-ui-theme="premium-lab"] .subject-hero-banner {
  background: linear-gradient(135deg, var(--s-soft, rgba(244, 123, 92, 0.14)) 0%, #24636A 55%);
  border: 1px solid var(--pl-border);
  border-left: 4px solid var(--s-accent, var(--pl-accent));
  border-radius: var(--radius-card);
  padding: 1.15rem 1.3rem;
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .subject-hero-context {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pl-text-muted);
  margin-bottom: 0.25rem;
}

html[data-ui-theme="premium-lab"] .subject-hero-title {
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  font-weight: 700;
  color: var(--pl-text);
  line-height: 1.18;
}

html[data-ui-theme="premium-lab"] .subject-hero-meta {
  font-size: 0.78rem;
  color: var(--pl-text-2);
  margin-top: 0.25rem;
}

html[data-ui-theme="premium-lab"] .subject-quick-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

html[data-ui-theme="premium-lab"] .subject-quick-stat {
  border: 1px solid var(--pl-border);
  background: var(--pl-surface-2);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  min-width: 96px;
}

html[data-ui-theme="premium-lab"] .subject-quick-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .subject-quick-value {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--s-accent, var(--pl-accent-soft));
  margin-top: 0.1rem;
}

html[data-ui-theme="premium-lab"] .subject-quick-recent {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .subject-tabs-bar {
  border-bottom: 1px solid var(--pl-border);
  gap: 0.2rem;
  margin-top: 1rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

html[data-ui-theme="premium-lab"] .subject-tab-btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pl-text-muted);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0.65rem 0.85rem;
  white-space: nowrap;
  border-radius: 8px 8px 0 0;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

html[data-ui-theme="premium-lab"] .subject-tab-btn:hover {
  color: var(--pl-text);
  background: rgba(244, 123, 92, 0.08);
}

html[data-ui-theme="premium-lab"] .subject-tab-btn.active {
  color: var(--s-accent, var(--pl-accent-soft));
  border-bottom-color: var(--s-accent, var(--pl-accent));
  background: var(--s-soft, var(--pl-accent-tint));
}

html[data-ui-theme="premium-lab"] .tab-count {
  font-size: 0.72rem;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .subject-tab-panels {
  padding-top: 1rem;
}

/* Remove dark box wrappers around tab panels */
html[data-ui-theme="premium-lab"] #studyMaterialsSection,
html[data-ui-theme="premium-lab"] #originalQuestionBankSection,
html[data-ui-theme="premium-lab"] #sheetsSection {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* Shared media cards */
html[data-ui-theme="premium-lab"] .lecture-card,
html[data-ui-theme="premium-lab"] .quiz-card,
html[data-ui-theme="premium-lab"] .sheet-card,
html[data-ui-theme="premium-lab"] .pdf-card,
html[data-ui-theme="premium-lab"] .subject-viz-card,
html[data-ui-theme="premium-lab"] .video-card {
  background: var(--pl-surface) !important;
  border: 1px solid var(--pl-border) !important;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}

html[data-ui-theme="premium-lab"] .lecture-card:hover,
html[data-ui-theme="premium-lab"] .quiz-card:hover,
html[data-ui-theme="premium-lab"] .sheet-card:hover,
html[data-ui-theme="premium-lab"] .pdf-card:hover,
html[data-ui-theme="premium-lab"] .subject-viz-card:hover,
html[data-ui-theme="premium-lab"] .video-card:hover {
  border-color: color-mix(in srgb, var(--s-accent, var(--pl-accent)) 60%, var(--pl-border)) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

html[data-ui-theme="premium-lab"] .lecture-card {
  border-left: 3px solid var(--s-accent, var(--pl-accent)) !important;
}

html[data-ui-theme="premium-lab"] .lecture-card-title,
html[data-ui-theme="premium-lab"] .quiz-card-title,
html[data-ui-theme="premium-lab"] .sheet-card-title,
html[data-ui-theme="premium-lab"] .pdf-card-title {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .lecture-card-qcount,
html[data-ui-theme="premium-lab"] .quiz-card-qcount {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .quiz-stats-strip,
html[data-ui-theme="premium-lab"] .lecture-quiz-stats-strip {
  border: 1px solid var(--pl-border-soft);
  background: var(--pl-surface-2);
  border-radius: var(--radius-sm);
}

html[data-ui-theme="premium-lab"] .quiz-stat-cell span {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .quiz-stat-cell strong {
  color: var(--pl-text);
  font-weight: 700;
}

html[data-ui-theme="premium-lab"] .order-segmented-toggle {
  border: 1px solid var(--pl-border);
  background: var(--pl-surface-2);
  border-radius: var(--radius-pill);
}

html[data-ui-theme="premium-lab"] .order-seg-btn {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .order-seg-btn.active {
  background: var(--pl-surface);
  color: var(--pl-accent-soft);
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   9B. Compact, balanced PDF & Video cards (Phase 5 & Phase 6)
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .pdfs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

html[data-ui-theme="premium-lab"] .pdf-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1rem !important;
  min-height: 0;
}

html[data-ui-theme="premium-lab"] .pdf-card-icon,
html[data-ui-theme="premium-lab"] .pdf-card-thumb {
  width: 40px !important;
  height: 46px !important;
  min-width: 40px;
  min-height: 46px;
  background: linear-gradient(145deg, #3D2D2A, #302422);
  border: 1px solid var(--pl-error-border);
  color: var(--pl-error);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--clay-icon-shadow);
}

html[data-ui-theme="premium-lab"] .pdf-card-info {
  flex: 1 1 160px;
  min-width: 0;
}

html[data-ui-theme="premium-lab"] .pdf-card-title {
  font-size: 0.92rem;
  line-height: 1.3;
  margin-bottom: 0.15rem;
  overflow-wrap: anywhere;
}

html[data-ui-theme="premium-lab"] .pdf-card-meta,
html[data-ui-theme="premium-lab"] .video-card-meta {
  font-size: 0.72rem;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .pdf-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

html[data-ui-theme="premium-lab"] .video-card-thumb {
  border-radius: var(--radius-sm);
  border: 1px solid var(--pl-border);
  background: var(--pl-surface-2);
}

html[data-ui-theme="premium-lab"] .video-embed-fallback {
  background: var(--pl-surface-2);
  border: 1px dashed var(--pl-border);
}

html[data-ui-theme="premium-lab"] .video-fallback-title {
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .video-fallback-sub {
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .admin-url-feedback.is-valid {
  color: var(--pl-success);
}

html[data-ui-theme="premium-lab"] .admin-url-feedback.is-invalid {
  color: var(--pl-error);
}

html[data-ui-theme="premium-lab"] .videos-toolbar {
  gap: 0.6rem;
}

/* Visualizations */
html[data-ui-theme="premium-lab"] .subject-viz-list {
  gap: 0.85rem;
}

html[data-ui-theme="premium-lab"] .subject-viz-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1rem;
  border-top: 3px solid var(--s-accent, var(--pl-accent)) !important;
}

html[data-ui-theme="premium-lab"] .subject-viz-badges,
html[data-ui-theme="premium-lab"] .viz-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

html[data-ui-theme="premium-lab"] .subject-viz-info h4 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--pl-text);
  margin: 0.15rem 0 0.35rem;
}

html[data-ui-theme="premium-lab"] .subject-viz-objective {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .subject-viz-description {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .subject-viz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  margin-top: 0.6rem;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .subject-viz-type {
  color: var(--s-accent, var(--pl-accent-soft));
}

html[data-ui-theme="premium-lab"] .viz-card {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  padding: 1.05rem;
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .viz-card::before {
  width: 34px;
  height: 3px;
  background: var(--s-accent, var(--pl-accent));
  border-radius: 99px;
}

html[data-ui-theme="premium-lab"] .viz-card-title {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .viz-card-objective {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--pl-text-2);
  margin-bottom: 0.35rem;
}

html[data-ui-theme="premium-lab"] .viz-card-description {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .viz-card-activity,
html[data-ui-theme="premium-lab"] .viz-card-footer .text-muted {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--pl-accent-soft);
}

html[data-ui-theme="premium-lab"] .viz-shell {
  border-top: 3px solid var(--s-accent, var(--pl-accent));
  background: var(--pl-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .lecture-tools-section {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .lecture-tool-card {
  background: var(--pl-surface-2);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-sm);
}

html[data-ui-theme="premium-lab"] .lecture-tool-info h4 {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .lecture-tool-info p {
  color: var(--pl-text-2);
}

/* --------------------------------------------------------------------------
   10. Quiz player & Lecture Study — calm, high-contrast warm paper
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .lecture-sticky-bar,
html[data-ui-theme="premium-lab"] .quiz-top-bar {
  background: rgba(14, 48, 58, 0.95);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  padding: 0.7rem 1rem;
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .lecture-summary-card,
html[data-ui-theme="premium-lab"] .lecture-quiz-section {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] #playerQuizTitle {
  font-size: 1.04rem;
  font-weight: 700;
}

html[data-ui-theme="premium-lab"] .progress-wrapper {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .progress-info {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .progress-bar-track {
  background: var(--pl-surface-3);
}

html[data-ui-theme="premium-lab"] .progress-bar-fill {
  background: linear-gradient(90deg, var(--pl-accent), #DE7E5E);
}

html[data-ui-theme="premium-lab"] .quiz-player-layout {
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 1rem;
}

html[data-ui-theme="premium-lab"] .question-card {
  background: #132530;
  border: 1px solid var(--pl-border);
  border-top: 3px solid var(--s-accent, var(--pl-accent));
  border-radius: var(--radius-card);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .question-stem {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.65;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .question-num-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pl-accent-soft);
  border: 1px solid var(--pl-accent-border);
  background: var(--pl-accent-tint);
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.5rem;
}

html[data-ui-theme="premium-lab"] .option-btn {
  background: #0E1E28;
  border: 1px solid var(--pl-border);
  border-radius: 12px;
  padding: 0.78rem 0.9rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--pl-text);
  min-height: 48px;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

html[data-ui-theme="premium-lab"] .option-btn:hover:not(:disabled) {
  border-color: var(--pl-accent);
  background: #1A3440;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .option-btn.selected {
  border-color: var(--pl-accent);
  background: var(--pl-accent-tint);
  color: var(--pl-text);
  font-weight: 600;
}

html[data-ui-theme="premium-lab"] .option-btn.correct {
  border-color: var(--pl-success);
  background: var(--pl-success-tint);
  color: var(--pl-text);
  font-weight: 600;
}

html[data-ui-theme="premium-lab"] .option-btn.incorrect {
  border-color: var(--pl-error);
  background: var(--pl-error-tint);
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .option-letter {
  background: var(--pl-surface-2);
  border: 1px solid var(--pl-border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--pl-accent-soft);
}

html[data-ui-theme="premium-lab"] .feedback-box {
  border: 1px solid var(--pl-border);
  border-radius: 12px;
  background: var(--pl-surface-2);
  color: var(--pl-text);
  font-size: 0.88rem;
  line-height: 1.6;
}

html[data-ui-theme="premium-lab"] .feedback-box.correct {
  border-color: var(--pl-success-border);
  background: var(--pl-success-tint);
}

html[data-ui-theme="premium-lab"] .feedback-box.incorrect {
  border-color: var(--pl-error-border);
  background: var(--pl-error-tint);
}

html[data-ui-theme="premium-lab"] .question-navigator-panel {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .navigator-header h4 {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .nav-dot {
  background: var(--pl-surface-2);
  border: 1px solid var(--pl-border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--pl-text-2);
  min-width: 30px;
  min-height: 30px;
}

html[data-ui-theme="premium-lab"] .nav-dot.current {
  border-color: var(--pl-accent);
  color: var(--pl-accent-soft);
  background: var(--pl-accent-tint);
  font-weight: 700;
}

html[data-ui-theme="premium-lab"] .nav-dot.answered-correct {
  border-color: var(--pl-success-border);
  background: var(--pl-success-tint);
  color: var(--pl-success);
}

html[data-ui-theme="premium-lab"] .nav-dot.answered-incorrect {
  border-color: var(--pl-error-border);
  background: var(--pl-error-tint);
  color: var(--pl-error);
}

html[data-ui-theme="premium-lab"] .nav-dot.flagged {
  border-color: var(--pl-warning-border);
  background: var(--pl-warning-tint);
  color: #C99242;
}

html[data-ui-theme="premium-lab"] .btn-icon-action {
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-pill);
  background: var(--pl-surface-2);
  color: var(--pl-text-2);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.32rem 0.68rem;
}

html[data-ui-theme="premium-lab"] .btn-icon-action:hover {
  border-color: var(--pl-accent-border);
  color: var(--pl-accent-soft);
  background: var(--pl-accent-tint);
}

html[data-ui-theme="premium-lab"] .toggle-inline {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .mcq-trick-card {
  background: var(--pl-soft-tint);
  border: 1px solid var(--pl-soft-border);
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   11. Results, bookmarks, mistakes, leaderboard & settings views
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .results-summary-card {
  background: linear-gradient(180deg, #24636A 0%, #1F565D 100%);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .score-big {
  font-family: var(--font-display);
  color: var(--pl-accent-soft);
  letter-spacing: -0.03em;
}

html[data-ui-theme="premium-lab"] .breakdown-item {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .breakdown-opt {
  border-color: var(--pl-border);
  background: var(--pl-surface-2);
}

html[data-ui-theme="premium-lab"] .breakdown-opt.is-correct {
  border-color: var(--pl-success-border);
  background: var(--pl-success-tint);
}

html[data-ui-theme="premium-lab"] .breakdown-opt.user-wrong {
  border-color: var(--pl-error-border);
  background: var(--pl-error-tint);
}

html[data-ui-theme="premium-lab"] .empty-state-card,
html[data-ui-theme="premium-lab"] .empty-category-box {
  background: var(--pl-surface);
  border: 1px dashed var(--pl-border);
  border-radius: var(--radius-card);
  color: var(--pl-text-2);
  box-shadow: var(--shadow-sm);
}

html[data-ui-theme="premium-lab"] .empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, #2C7375, #24636A);
  border: 1px solid var(--pl-border);
  color: var(--pl-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.65rem;
  box-shadow: var(--clay-icon-shadow);
}

/* Leaderboard styling */
html[data-ui-theme="premium-lab"] .leaderboard-my-rank-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, rgba(244, 123, 92, 0.14) 0%, #24636A 60%);
  border-left: 4px solid var(--pl-accent);
}

html[data-ui-theme="premium-lab"] .leaderboard-my-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pl-text);
  margin: 0.25rem 0 0.15rem;
}

html[data-ui-theme="premium-lab"] .leaderboard-table-card {
  padding: 0;
  overflow: hidden;
  max-width: 100%;
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  background: var(--pl-surface);
}

html[data-ui-theme="premium-lab"] .leaderboard-scroll-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: rgba(0, 0, 0, 0.18);
  color: var(--pl-text-2);
  font-size: 0.72rem;
  border-bottom: 1px solid var(--pl-border-soft);
}

@media (max-width: 640px) {
  html[data-ui-theme="premium-lab"] .leaderboard-scroll-hint {
    display: none !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table-card {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table-scroll {
    overflow-x: visible !important;
    width: 100% !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: none !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table thead {
    display: none !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
    width: 100% !important;
    padding: 0 !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table tbody tr.leaderboard-row {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    grid-template-areas:
      "rank student xp"
      "subj subj subj"
      "acc acc dur" !important;
    align-items: center !important;
    gap: 0.35rem 0.6rem !important;
    padding: 0.75rem 0.85rem !important;
    border-radius: 12px !important;
    border: 1px solid var(--pl-border) !important;
    background: var(--pl-surface) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: transform 120ms ease, border-color 120ms ease !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table tbody tr.leaderboard-row.top-1 {
    border-color: rgba(240, 195, 77, 0.45) !important;
    background: linear-gradient(135deg, rgba(240, 195, 77, 0.1), rgba(13, 40, 48, 0.95)) !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table tbody tr.leaderboard-row.top-2 {
    border-color: rgba(180, 195, 210, 0.45) !important;
    background: linear-gradient(135deg, rgba(180, 195, 210, 0.1), rgba(13, 40, 48, 0.95)) !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table tbody tr.leaderboard-row.top-3 {
    border-color: rgba(205, 127, 50, 0.45) !important;
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1), rgba(13, 40, 48, 0.95)) !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table tbody tr.leaderboard-row.is-current-player {
    border-color: var(--pl-accent-soft) !important;
    box-shadow: 0 0 12px rgba(244, 123, 92, 0.25) !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-rank {
    grid-area: rank !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 28px !important;
    padding: 0 !important;
    border: none !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-student {
    grid-area: student !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    overflow: hidden !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-student .student-name-text {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-score {
    grid-area: xp !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: auto !important;
    padding: 0 !important;
    border: none !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-score .xp-pill {
    font-size: 0.78rem !important;
    padding: 0.2rem 0.5rem !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-subject {
    grid-area: subj !important;
    display: block !important;
    width: 100% !important;
    padding: 0.1rem 0 !important;
    border: none !important;
    font-size: 0.78rem !important;
    color: var(--pl-text-2) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-accuracy {
    grid-area: acc !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    width: auto !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.82rem !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-accuracy .leaderboard-pct {
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    color: var(--pl-accent-soft) !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-accuracy .score-fraction {
    font-size: 0.78rem !important;
    color: var(--pl-text-2) !important;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-table td.col-duration {
    grid-area: dur !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: auto !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.78rem !important;
    color: var(--pl-text-2) !important;
  }
}

html[data-ui-theme="premium-lab"] .leaderboard-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  display: block;
  scrollbar-width: thin;
  scrollbar-color: var(--pl-border) transparent;
}

html[data-ui-theme="premium-lab"] .leaderboard-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.88rem;
  text-align: left;
}

html[data-ui-theme="premium-lab"] .leaderboard-table th {
  background: var(--pl-surface-2);
  color: var(--pl-text-2);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--pl-border);
  white-space: nowrap;
}

html[data-ui-theme="premium-lab"] .leaderboard-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--pl-border-soft);
  color: var(--pl-text);
  vertical-align: middle;
}

/* Explicit column sizing & alignments */
html[data-ui-theme="premium-lab"] .leaderboard-table th.col-rank,
html[data-ui-theme="premium-lab"] .leaderboard-table td.col-rank,
html[data-ui-theme="premium-lab"] .leaderboard-table td:first-child {
  width: 56px;
  text-align: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

html[data-ui-theme="premium-lab"] .leaderboard-table th.col-student,
html[data-ui-theme="premium-lab"] .leaderboard-table td.col-student {
  width: 23%;
  min-width: 125px;
  text-align: left;
}

html[data-ui-theme="premium-lab"] .leaderboard-table th.col-subject,
html[data-ui-theme="premium-lab"] .leaderboard-table td.col-subject {
  width: 27%;
  min-width: 150px;
  text-align: left;
}

html[data-ui-theme="premium-lab"] .leaderboard-table th.col-score,
html[data-ui-theme="premium-lab"] .leaderboard-table td.col-score {
  width: 17%;
  min-width: 100px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

html[data-ui-theme="premium-lab"] .leaderboard-table th.col-accuracy,
html[data-ui-theme="premium-lab"] .leaderboard-table td.col-accuracy {
  width: 18%;
  min-width: 110px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

html[data-ui-theme="premium-lab"] .leaderboard-table th.col-duration,
html[data-ui-theme="premium-lab"] .leaderboard-table td.col-duration {
  width: 15%;
  min-width: 85px;
  text-align: right;
  padding-right: 1.15rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

html[data-ui-theme="premium-lab"] .xp-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  font-size: 0.84rem;
  color: #F0C34D;
  background: rgba(240, 195, 77, 0.12);
  border: 1px solid rgba(240, 195, 77, 0.32);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

html[data-ui-theme="premium-lab"] .score-fraction {
  font-size: 0.76rem;
  color: var(--pl-text-2);
  margin-left: 0.25rem;
  font-variant-numeric: tabular-nums;
}

html[data-ui-theme="premium-lab"] .student-name-text {
  display: inline-block;
  max-width: calc(100% - 46px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  font-weight: 600;
}

html[data-ui-theme="premium-lab"] .subject-title-text {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

html[data-ui-theme="premium-lab"] .meta-attempts {
  color: var(--pl-text-2);
  font-size: 0.78rem;
  white-space: nowrap;
  display: inline-block;
  opacity: 0.9;
}

html[data-ui-theme="premium-lab"] .leaderboard-you-badge {
  margin-left: 0.35rem;
  vertical-align: middle;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
}

html[data-ui-theme="premium-lab"] .leaderboard-table tbody tr:hover {
  background: var(--pl-surface-2);
}

html[data-ui-theme="premium-lab"] .leaderboard-table tbody tr.is-current-player {
  background: rgba(244, 123, 92, 0.14);
  font-weight: 600;
}

html[data-ui-theme="premium-lab"] .rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8rem;
  background: var(--pl-surface-3);
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .rank-badge.rank-1 {
  background: linear-gradient(145deg, #F0C34D, #C69A27);
  color: #173F45;
  box-shadow: var(--clay-icon-shadow);
}

html[data-ui-theme="premium-lab"] .rank-badge.rank-2 {
  background: linear-gradient(145deg, #C1D6D0, #7A9F97);
  color: #12383E;
  box-shadow: var(--clay-icon-shadow);
}

html[data-ui-theme="premium-lab"] .rank-badge.rank-3 {
  background: linear-gradient(145deg, #F47B5C, #C25638);
  color: #12383E;
  box-shadow: var(--clay-icon-shadow);
}

html[data-ui-theme="premium-lab"] .settings-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

/* --------------------------------------------------------------------------
   12. Content management / admin
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] #contentView .section-title {
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] #contentView .content-panel {
  background: var(--pl-surface);
  border-color: var(--pl-border);
  border-radius: var(--radius-card);
  padding: 1.15rem;
}

html[data-ui-theme="premium-lab"] #contentView .content-panel-head h3 {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] #contentView .content-panel-head {
  border-bottom: 1px solid var(--pl-border-soft);
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
}

html[data-ui-theme="premium-lab"] #contentView .content-subject-row,
html[data-ui-theme="premium-lab"] #contentView .admin-library-row,
html[data-ui-theme="premium-lab"] #contentView .import-package-card,
html[data-ui-theme="premium-lab"] #contentView .import-preview {
  background: var(--pl-surface-2);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-sm);
}

html[data-ui-theme="premium-lab"] #contentView .content-health,
html[data-ui-theme="premium-lab"] #contentView .content-term-note {
  font-size: 0.78rem;
  color: var(--pl-text-2);
}

html[data-ui-theme="premium-lab"] .admin-security-note {
  border-left: 3px solid var(--pl-warning);
  padding-left: 0.65rem;
}

html[data-ui-theme="premium-lab"] .pdf-viewer-card {
  border-color: var(--pl-border);
}

/* --------------------------------------------------------------------------
   13. Modals and settings
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

body:not(.admin-content-active) #bulkPdfDropzone,
body:not(.admin-content-active) #adminPdfSection,
body:not(.admin-content-active) #adminVideoSection,
body:not(.admin-content-active) #adminVizSection,
body:not(.admin-content-active) #adminImageSection,
body:not(.admin-content-active) #adminCountdownPanel,
body:not(.admin-content-active) #contentTeamPanel,
body:not(.admin-content-active) #adminUsersPanel {
  display: none !important;
}

#contentView:not(.active) {
  display: none !important;
}

html[data-ui-theme="premium-lab"] .modal-card {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
}

html[data-ui-theme="premium-lab"] .modal-header,
html[data-ui-theme="premium-lab"] .modal-footer {
  border-color: var(--pl-border-soft);
}

/* Username dialog: keep the action row compact instead of showing a wide empty strip. */
html[data-ui-theme="premium-lab"] #usernameModal .modal-footer {
  justify-content: center;
  gap: 0.65rem;
  margin: 0.55rem 0 0;
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--pl-border-soft);
  background: transparent;
}

html[data-ui-theme="premium-lab"] #usernameModal .modal-footer .btn {
  min-width: 7rem;
}

html[data-ui-theme="premium-lab"] #leaderboardQuizFilter {
  display: none;
}

html[data-ui-theme="premium-lab"] .settings-section {
  border: 1px solid var(--pl-border);
  border-radius: var(--radius-sm);
  padding: 0.95rem;
  margin-bottom: 0.9rem;
  background: var(--pl-surface-2);
}

html[data-ui-theme="premium-lab"] .settings-section h4 {
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--pl-text);
  margin-bottom: 0.3rem;
}

html[data-ui-theme="premium-lab"] .settings-help {
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}

html[data-ui-theme="premium-lab"] .settings-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.62rem 0;
  cursor: pointer;
  border-top: 1px solid var(--pl-border-soft);
}

html[data-ui-theme="premium-lab"] .settings-toggle:first-of-type {
  border-top: 0;
}

html[data-ui-theme="premium-lab"] .settings-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

html[data-ui-theme="premium-lab"] .settings-toggle-control {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--pl-border);
  background: var(--pl-surface-3);
  flex-shrink: 0;
  margin-top: 0.1rem;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

html[data-ui-theme="premium-lab"] .settings-toggle-control::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

html[data-ui-theme="premium-lab"] .settings-toggle input:checked + .settings-toggle-control {
  background: var(--pl-accent);
  border-color: var(--pl-accent-strong);
}

html[data-ui-theme="premium-lab"] .settings-toggle input:checked + .settings-toggle-control::after {
  transform: translateX(18px);
  background: #FFFFFF;
}

html[data-ui-theme="premium-lab"] .settings-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

html[data-ui-theme="premium-lab"] .settings-toggle-copy strong {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--pl-text);
}

html[data-ui-theme="premium-lab"] .settings-toggle-copy small {
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--pl-text-muted);
}

html[data-ui-theme="premium-lab"] .danger-zone {
  border-color: var(--pl-error-border);
  background: rgba(196, 90, 78, 0.08);
}

/* --------------------------------------------------------------------------
   14. Mobile & Responsive Drawer (320px - 768px)
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .mobile-bottom-bar {
  background: rgba(13, 40, 48, 0.96);
  border-top: 1px solid var(--pl-border);
  backdrop-filter: blur(12px);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
}

html[data-ui-theme="premium-lab"] .mobile-tab-btn {
  color: var(--pl-text-muted);
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 600;
}

html[data-ui-theme="premium-lab"] .mobile-tab-btn.active {
  color: var(--pl-accent-soft);
}

@media (max-width: 1180px) {
  html[data-ui-theme="premium-lab"] .stats-compact-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  html[data-ui-theme="premium-lab"] .lab-hero-main {
    grid-template-columns: 1fr;
  }

  html[data-ui-theme="premium-lab"] .lab-hero-progress {
    border-left: 0;
    border-top: 1px solid var(--pl-border);
    padding-left: 0;
    padding-top: 0.65rem;
  }
}

@media (max-width: 768px) {
  html[data-ui-theme="premium-lab"] .app-shell {
    display: block;
    grid-template-columns: 1fr;
  }

  /* Slide-out mobile drawer for full sidebar navigation */
  html[data-ui-theme="premium-lab"] .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(280px, 84vw);
    height: 100vh;
    height: 100dvh;
    z-index: 95;
    transform: translateX(-104%);
    transition: transform 220ms var(--ease);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    display: flex !important;
    flex-direction: column;
    overflow-y: auto;
  }

  html[data-ui-theme="premium-lab"] body.mobile-sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  html[data-ui-theme="premium-lab"] .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 90;
  }

  html[data-ui-theme="premium-lab"] .topbar-creator-capsule {
    display: none !important;
  }

  html[data-ui-theme="premium-lab"] .app-topbar {
    min-height: 44px;
    padding: 0.3rem 0.55rem;
    gap: 0.35rem;
  }

  html[data-ui-theme="premium-lab"] .app-topbar .btn,
  html[data-ui-theme="premium-lab"] .app-topbar .btn-secondary,
  html[data-ui-theme="premium-lab"] .app-topbar .btn-sm {
    min-height: 28px;
    height: 28px;
    padding: 0.2rem 0.45rem;
    font-size: 0.74rem;
  }

  html[data-ui-theme="premium-lab"] .app-topbar .btn svg,
  html[data-ui-theme="premium-lab"] .app-topbar .btn-secondary svg {
    width: 13px !important;
    height: 13px !important;
  }

  html[data-ui-theme="premium-lab"] .mobile-menu-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-height: 32px;
    border-radius: 8px;
    border: 1px solid var(--pl-border);
    background: var(--pl-surface);
    color: var(--pl-text);
    cursor: pointer;
    flex-shrink: 0;
  }

  html[data-ui-theme="premium-lab"] .mobile-menu-toggle-btn svg {
    width: 16px;
    height: 16px;
  }

  html[data-ui-theme="premium-lab"] .mobile-bottom-bar {
    height: 48px;
    padding: 0.1rem 0.2rem;
  }

  html[data-ui-theme="premium-lab"] .mobile-tab-btn {
    font-size: 0.58rem;
    min-height: 40px;
    gap: 0.1rem;
  }

  html[data-ui-theme="premium-lab"] .mobile-tab-btn svg {
    width: 16px !important;
    height: 16px !important;
  }

  html[data-ui-theme="premium-lab"] .option-badge {
    width: 24px;
    height: 24px;
    font-size: 0.76rem;
    flex-shrink: 0;
  }

  html[data-ui-theme="premium-lab"] .rank-badge {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }

  html[data-ui-theme="premium-lab"] .action-icon {
    width: 13px;
    height: 13px;
  }

  html[data-ui-theme="premium-lab"] .sidebar-mobile-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--pl-border);
    background: var(--pl-surface);
    color: var(--pl-text-2);
    cursor: pointer;
  }

  html[data-ui-theme="premium-lab"] .app-content-area {
    margin-left: 0 !important;
    width: 100% !important;
  }

  html[data-ui-theme="premium-lab"] .container {
    padding: 0.9rem 0.85rem 5.8rem;
  }

  html[data-ui-theme="premium-lab"] .quiz-player-layout {
    grid-template-columns: 1fr;
  }

  html[data-ui-theme="premium-lab"] .stats-compact-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-ui-theme="premium-lab"] .lab-hero {
    padding: 0.85rem 0.95rem;
  }

  html[data-ui-theme="premium-lab"] .lab-hero-heading {
    font-size: 1.35rem;
  }

  html[data-ui-theme="premium-lab"] .subjects-card-grid {
    grid-template-columns: 1fr;
  }

  html[data-ui-theme="premium-lab"] .subject-quick-stat {
    min-width: calc(50% - 0.45rem);
  }
}

@media (max-width: 560px) {
  html[data-ui-theme="premium-lab"] .topbar-creator-capsule {
    display: none;
  }

  .topbar-auth-area {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
  }

  .topbar-auth-btn {
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: rgba(7, 21, 26, 0.72);
    color: var(--text-primary);
    padding: 0.3rem 0.55rem;
    font-size: 0.74rem;
    cursor: pointer;
  }

  .topbar-auth-hint {
    color: var(--text-secondary);
    font-size: 0.62rem;
    white-space: nowrap;
  }

  .topbar-user-label {
    color: var(--text-primary);
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .mobile-subject-bento {
    display: none;
  }

  html[data-ui-theme="premium-lab"] .stats-compact-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }

  html[data-ui-theme="premium-lab"] .subject-card {
    padding: 0.95rem;
  }

  html[data-ui-theme="premium-lab"] .subject-card-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 0.42rem 0.25rem;
    gap: 0.2rem;
  }

  html[data-ui-theme="premium-lab"] .subject-card-stat span {
    font-size: 0.52rem;
  }

  html[data-ui-theme="premium-lab"] .question-card {
    padding: 1rem;
  }

  html[data-ui-theme="premium-lab"] .option-btn {
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    font-size: 0.88rem;
  }
}

.viz-graphical-simulation {
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid rgba(111, 214, 183, 0.28);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(7, 21, 26, 0.96), rgba(20, 54, 60, 0.82));
  overflow: hidden;
}

.viz-graphical-simulation-heading {
  margin-bottom: 0.45rem;
  color: #6FD6B7;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.viz-simulation-svg {
  display: block;
  width: 100%;
  min-height: 180px;
}

.viz-sim-wire {
  stroke: #536D76;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 8 10;
}

.viz-sim-wire.is-active {
  stroke: #6FD6B7;
  filter: url(#vizGlow);
  animation: vizSignalFlow 1.2s linear infinite;
}

.viz-sim-pulse {
  fill: #536D76;
}

.viz-sim-pulse.is-active {
  fill: #F0C34D;
  filter: url(#vizGlow);
}

.viz-sim-node {
  cursor: pointer;
  outline: none;
}

.viz-sim-card {
  fill: rgba(31, 74, 82, 0.76);
  stroke-width: 2;
  transition: fill 160ms ease, filter 160ms ease;
}

.viz-sim-card.is-active {
  fill: rgba(44, 98, 107, 0.98);
  filter: url(#vizGlow);
}

.viz-sim-node:focus .viz-sim-card,
.viz-sim-node:hover .viz-sim-card {
  fill: rgba(244, 125, 92, 0.22);
}

.viz-sim-led {
  opacity: 0.45;
}

.viz-sim-led.is-active {
  opacity: 1;
  filter: url(#vizGlow);
}

.viz-sim-label,
.viz-sim-caption {
  fill: #F3F3E8;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.viz-sim-caption {
  fill: #A7C2C5;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

@keyframes vizSignalFlow {
  to { stroke-dashoffset: -36; }
}

/* Compact phone layout: reduce oversized controls and keep primary actions in reach. */
@media (max-width: 560px) {
  html[data-ui-theme="premium-lab"] {
    --text-display: 1.45rem;
    --text-h1: 1.2rem;
    --text-h2: 1rem;
    --text-body: 0.86rem;
    --text-small: 0.75rem;
  }

  html[data-ui-theme="premium-lab"] .app-topbar {
    min-height: 44px;
    padding: 0.28rem 0.5rem;
    gap: 0.35rem;
  }

  html[data-ui-theme="premium-lab"] .container {
    padding: 0.65rem 0.55rem 4.8rem;
  }

  html[data-ui-theme="premium-lab"] .lab-hero {
    padding: 0.7rem;
    border-radius: 12px;
  }

  html[data-ui-theme="premium-lab"] .lab-hero-heading {
    font-size: 1.15rem;
    line-height: 1.25;
  }

  html[data-ui-theme="premium-lab"] .lab-hero-sub {
    font-size: 0.78rem;
    line-height: 1.45;
  }

  html[data-ui-theme="premium-lab"] .stats-compact-row {
    gap: 0.3rem;
  }

  html[data-ui-theme="premium-lab"] .stat-card {
    padding: 0.55rem 0.45rem;
    min-height: 62px;
  }

  html[data-ui-theme="premium-lab"] .stat-card .stat-label {
    font-size: 0.57rem;
  }

  html[data-ui-theme="premium-lab"] .stat-card .stat-value {
    font-size: 1.15rem;
  }

  html[data-ui-theme="premium-lab"] .subject-card {
    padding: 0.72rem;
    border-radius: 12px;
  }

  html[data-ui-theme="premium-lab"] .subject-card-title {
    font-size: 0.92rem;
  }

  html[data-ui-theme="premium-lab"] .subject-card-stats {
    padding: 0.35rem 0.2rem;
    gap: 0.1rem;
  }

  html[data-ui-theme="premium-lab"] .subject-card-stat strong {
    font-size: 0.82rem;
  }

  html[data-ui-theme="premium-lab"] .subject-card-stat span {
    font-size: 0.48rem;
  }

  html[data-ui-theme="premium-lab"] .btn,
  html[data-ui-theme="premium-lab"] .option-btn,
  html[data-ui-theme="premium-lab"] .pill,
  html[data-ui-theme="premium-lab"] .input-text,
  html[data-ui-theme="premium-lab"] .input-select {
    font-size: 0.8rem;
  }

  html[data-ui-theme="premium-lab"] .btn {
    min-height: 36px;
    padding: 0.48rem 0.7rem;
  }

  html[data-ui-theme="premium-lab"] .option-btn {
    min-height: 42px;
    padding: 0.6rem 0.68rem;
  }

  html[data-ui-theme="premium-lab"] .question-card {
    padding: 0.82rem;
  }

  html[data-ui-theme="premium-lab"] .question-stem {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  html[data-ui-theme="premium-lab"] .leaderboard-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    gap: 0.35rem;
  }

  html[data-ui-theme="premium-lab"] #leaderboardSubjectFilter {
    min-width: 0;
  }
}

/* --------------------------------------------------------------------------
   15. RTL support
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] [dir="rtl"] {
  font-family: "Noto Kufi Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

html[data-ui-theme="premium-lab"][dir="rtl"] .app-sidebar {
  border-right: 0;
  border-left: 1px solid var(--pl-border);
}

html[data-ui-theme="premium-lab"] [dir="rtl"] .question-stem,
html[data-ui-theme="premium-lab"] [dir="rtl"] .option-text,
html[data-ui-theme="premium-lab"] [dir="rtl"] .option-btn,
html[data-ui-theme="premium-lab"] [dir="rtl"] .explanation-box,
html[data-ui-theme="premium-lab"] .viz-explanation-ar {
  text-align: right;
}

html[data-ui-theme="premium-lab"] [dir="rtl"] .lab-recent-row,
html[data-ui-theme="premium-lab"] [dir="rtl"] .subject-card-head,
html[data-ui-theme="premium-lab"] [dir="rtl"] .subject-card-footer,
html[data-ui-theme="premium-lab"] [dir="rtl"] .content-subject-row {
  flex-direction: row-reverse;
}

html[data-ui-theme="premium-lab"][dir="rtl"] .subject-status-pill {
  margin-left: 0;
  margin-right: auto;
}

html[data-ui-theme="premium-lab"][dir="rtl"] .subject-hero-banner {
  border-left: 1px solid var(--pl-border);
  border-right: 4px solid var(--s-accent, var(--pl-accent));
}

/* --------------------------------------------------------------------------
   15. Motion & Interaction Feedback (Button Press, Card Lift, View Fade)
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] .btn:active,
html[data-ui-theme="premium-lab"] .option-btn:active,
html[data-ui-theme="premium-lab"] .pill:active,
html[data-ui-theme="premium-lab"] .order-seg-btn:active,
html[data-ui-theme="premium-lab"] .btn-nav:active,
html[data-ui-theme="premium-lab"] .mobile-tab-btn:active {
  transform: scale(0.97);
  transition: transform 0.08s ease;
}

html[data-ui-theme="premium-lab"] .subject-card:hover .subject-card-icon-box {
  transform: scale(1.08) rotate(1.5deg);
}

html[data-ui-theme="premium-lab"] .progress-fill,
html[data-ui-theme="premium-lab"] .subject-progress-fill,
html[data-ui-theme="premium-lab"] .lab-progress-fill {
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-ui-theme="premium-lab"] .view.active {
  animation: labViewFade 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes labViewFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   16. Reduced motion
   -------------------------------------------------------------------------- */
html[data-motion="reduced"] .lab-ambient-grain,
html[data-motion="reduced"] .lab-ambient-glow,
html[data-motion="reduced"] .lab-ambient-sweep,
html[data-motion="reduced"] .lab-particle {
  animation: none !important;
}

html[data-motion="reduced"] .lab-ambient-sweep {
  display: none;
}

html[data-motion="reduced"] .lab-particle {
  opacity: 0.16;
  transform: none;
}

/* ==========================================================================
   ENHANCEMENTS: Mascot, Moving Ambient, Pipeline Animation,
   Team Work, How To Use & Warm Cream Paper Theme Mode
   ========================================================================== */

/* 1. BRAND MASCOT LOGO */
.brand-mascot-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.brand:hover .brand-mascot-img {
  transform: scale(1.15) rotate(-6deg);
}

/* 2. SIDEBAR FOOTER (BOTTOM-LEFT PERSONAL BRANDING & TEAM WORK) */
.sidebar-footer-creator {
  margin-top: auto;
  padding: 0.85rem;
  border-top: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  margin: 1rem 0.65rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.sidebar-creator-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
  padding: 0.45rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  transition: all 0.2s ease;
}
.sidebar-creator-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--coral);
  transform: translateY(-1px);
}
.sidebar-creator-globe {
  font-size: 1.15rem;
}
.sidebar-creator-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  overflow: hidden;
}
.sidebar-creator-domain {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-creator-author {
  font-size: 0.72rem;
  color: var(--coral);
  font-weight: 600;
}
.sidebar-creator-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0 0.2rem;
}
.sidebar-tg-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--mint);
  text-decoration: none;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(111, 214, 183, 0.12);
  border: 1px solid rgba(111, 214, 183, 0.25);
  transition: all 0.18s ease;
}
.sidebar-tg-badge:hover {
  background: rgba(111, 214, 183, 0.22);
  border-color: var(--mint);
  transform: translateY(-1px);
}
.btn-team-work {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #f47b5c 0%, #d85b3b 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(244, 123, 92, 0.3);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-team-work:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 123, 92, 0.45);
}
.btn-team-work:active {
  transform: translateY(1px);
}

/* 3. TOPBAR QUICK THEME TOGGLE */
.theme-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.theme-quick-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--coral);
  transform: translateY(-1px);
}

/* 4. ACTIVE BACKGROUND MOVING & SPINNING ELEMENTS */
.lab-motion-elements {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.lab-orbit {
  position: absolute;
  pointer-events: none;
  color: var(--mint);
  opacity: 0.4;
}
.lab-orbit--tr {
  top: 4%;
  right: 6%;
}
.lab-orbit--bl {
  bottom: 8%;
  left: 20%;
}
.spin-slow {
  animation: labSpinSlow 36s linear infinite;
  transform-origin: center;
}
.spin-reverse-slow {
  animation: labSpinReverse 48s linear infinite;
  transform-origin: center;
}
@keyframes labSpinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes labSpinReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}
.lab-drift-node {
  position: absolute;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.lab-drift-node--1 {
  top: 18%;
  left: 35%;
  animation: labDriftX1 18s ease-in-out infinite alternate;
}
.lab-drift-node--2 {
  top: 72%;
  left: 62%;
  animation: labDriftX2 24s ease-in-out infinite alternate;
}
.lab-drift-node--3 {
  top: 48%;
  left: 82%;
  animation: labDriftX3 20s ease-in-out infinite alternate;
}
.drift-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 14px var(--coral), 0 0 28px rgba(244, 123, 92, 0.6);
  animation: pulseGlow 3.5s ease-in-out infinite alternate;
}
.drift-trail {
  width: 52px;
  height: 2px;
  background: linear-gradient(90deg, var(--coral), transparent);
  opacity: 0.55;
}
@keyframes labDriftX1 {
  0% { transform: translate3d(-40px, 0, 0); }
  100% { transform: translate3d(50px, -24px, 0); }
}
@keyframes labDriftX2 {
  0% { transform: translate3d(45px, 20px, 0); }
  100% { transform: translate3d(-55px, -18px, 0); }
}
@keyframes labDriftX3 {
  0% { transform: translate3d(-25px, -30px, 0); }
  100% { transform: translate3d(40px, 30px, 0); }
}
@keyframes pulseGlow {
  0% { transform: scale(0.85); opacity: 0.45; }
  100% { transform: scale(1.35); opacity: 1; }
}

/* 5. TOPBAR HOW TO USE TRIGGER & MODAL DIALOG */
.topbar-context-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.topbar-how-to-use-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #6FD6B7;
  background: rgba(111, 214, 183, 0.1);
  border: 1px solid rgba(111, 214, 183, 0.4);
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(111, 214, 183, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.topbar-how-to-use-btn:hover {
  background: rgba(111, 214, 183, 0.2);
  border-color: #6FD6B7;
  color: #FFFFFF;
  box-shadow: 0 0 16px rgba(111, 214, 183, 0.35);
  transform: translateY(-1px);
}

.topbar-how-to-use-btn .how-icon {
  font-size: 0.85rem;
  filter: drop-shadow(0 0 4px #6FD6B7);
}

.how-modal-glow-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 8px #6FD6B7);
}

.how-to-use-modal-card {
  border: 1.5px solid rgba(111, 214, 183, 0.4) !important;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(111, 214, 183, 0.15) !important;
}

/* 6. HOW TO USE FEATURES GRID (INSIDE MODAL) */
.how-to-use-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
}

.how-card {
  background: var(--surface-panel);
  border: 1.5px solid var(--border-soft);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.how-card:hover {
  transform: translateY(-3px);
  border-color: var(--coral);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

.how-card-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--coral);
  letter-spacing: 0.08em;
}

.how-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.how-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* 7. RETRO NIXIE LAB GAUGE (BOTTOM-LEFT SIDEBAR) */
.sidebar-nixie-gauge {
  margin: 0.75rem 0.85rem 0.5rem;
  padding: 0.55rem 0.65rem;
  background: #07151A;
  border: 1.5px solid #1C4652;
  border-radius: 10px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 140, 56, 0.08);
}

.countdown-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.countdown-event-badge {
  color: #F0C34D;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.countdown-edit-btn {
  border: 0;
  background: transparent;
  color: #7FA9AC;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1;
  padding: 0.15rem;
}

.countdown-edit-btn:hover {
  color: #FF9447;
}

.countdown-event-title {
  display: block;
  overflow: hidden;
  color: #DCEBE9;
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nixie-tube-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: #040D10;
  border: 1px solid #13333C;
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8);
}

.nixie-digit,
.nixie-colon {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 900;
  color: #FF9447;
  text-shadow: 0 0 8px #FF8C38, 0 0 18px rgba(255, 140, 56, 0.7);
  line-height: 1;
  letter-spacing: 0.05em;
}

.nixie-sub-indicators {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  padding: 0 2px;
  font-size: 0.52rem;
  font-weight: 700;
  color: #4C7D8B;
  letter-spacing: 0.05em;
}

.countdown-live-status {
  color: #6FD6B7;
  display: inline-flex;
  align-items: center;
  gap: 0.16rem;
}

.countdown-live-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6FD6B7;
  box-shadow: 0 0 7px rgba(111, 214, 183, 0.9);
  animation: countdownLivePulse 1.5s ease-in-out infinite;
}

.countdown-expired .countdown-live-status {
  color: #F47B5C;
}

.countdown-expired .countdown-live-status i {
  background: #F47B5C;
  box-shadow: 0 0 7px rgba(244, 123, 92, 0.9);
}

@keyframes countdownLivePulse {
  0%, 100% { opacity: 0.45; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* DYNAMIC CREATOR FOOTER IN SIDEBAR */
.sidebar-creator-card-item {
  margin-bottom: 0.45rem;
}

.sidebar-creator-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.btn-add-person {
  background: rgba(111, 214, 183, 0.08);
  border: 1px dashed rgba(111, 214, 183, 0.4);
  color: #6FD6B7;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-add-person:hover {
  background: rgba(111, 214, 183, 0.18);
  border-color: #6FD6B7;
  color: #FFFFFF;
}

/* 8. THEME MODE SELECTOR IN SETTINGS */
.theme-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.theme-option-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface-panel);
  border: 2px solid var(--border-soft);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.theme-option-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.theme-option-card.active {
  border-color: var(--coral);
  background: rgba(244, 123, 92, 0.12);
}

.theme-preview-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
}

.theme-preview--dark {
  background: #0B1720;
  border: 1px solid #315563;
}

.theme-preview--cream,
.theme-preview--light {
  background: #1D3D47;
  border: 1.5px solid #4F8E9B;
}

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

.dot-mint { background: #6FD6B7; }
.dot-coral { background: #F47B5C; }
.dot-terracotta { background: #D94635; }
.dot-sage { background: #2E7D5B; }

.theme-option-info strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.theme-option-info small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* 9. ADMIN COMBINE QUIZZES & TEAM PANELS */
.combine-checkboxes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.admin-team-members-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* PDF CARD CLEANUP: HIDE SUMMARY/DESCRIPTION */
.pdf-card-desc {
  display: none !important;
}

/* 10. SOFT DAYLIGHT TEAL-SLATE LIGHT THEME (REPLACED HARSH CREAM #3B1220 MODE) */
html[data-theme-mode="light"],
html[data-theme-mode="cream"] {
  color-scheme: light;

  /* Eye-friendly calm mid-light slate teal */
  --bg-main: #1D3D47;
  --bg-main-light: #244954;
  --bg-sidebar: #17333B;
  --bg-topbar: #1A3942;

  --surface-card: #27525E;
  --surface-card-light: #2E5D6A;
  --surface-panel: #204550;
  --surface-hover: #336776;

  --border: rgba(95, 166, 179, 0.45);
  --border-soft: rgba(95, 166, 179, 0.28);
  --border-subtle: rgba(95, 166, 179, 0.22);
  --border-strong: #74B5B3;

  --text-primary: #F2F7F8;
  --text-secondary: #C3DFE5;
  --text-muted: #8EB7C2;

  --coral: #F47B5C;
  --coral-hover: #FF9070;
  --mint: #6FD6B7;
  --green: #91D36B;
  --yellow: #F0C34D;
  --red: #E77772;

  --pl-bg: #1D3D47;
  --pl-bg-deep: #142E35;
  --pl-surface: #27525E;
  --pl-surface-2: #2E5D6A;
  --pl-surface-3: #204550;
  --pl-border: rgba(95, 166, 179, 0.45);
  --pl-border-soft: rgba(95, 166, 179, 0.28);
  --pl-border-glow: rgba(111, 214, 183, 0.35);
  --pl-text: #F2F7F8;
  --pl-text-2: #C3DFE5;
  --pl-text-muted: #8EB7C2;

  --compat-bg: #1D3D47;
  --compat-surface: #27525E;
  --compat-surface-2: #2E5D6A;
  --compat-text: #F2F7F8;
  --compat-text-2: #C3DFE5;
  --compat-border: rgba(95, 166, 179, 0.45);
}

html[data-theme-mode="light"] body,
html[data-theme-mode="cream"] body {
  background: var(--pl-bg) !important;
  color: var(--pl-text) !important;
}

html[data-theme-mode="light"] .app-sidebar,
html[data-theme-mode="cream"] .app-sidebar {
  background: var(--bg-sidebar) !important;
  border-right: 1px solid var(--border) !important;
}

html[data-theme-mode="light"] .app-topbar,
html[data-theme-mode="cream"] .app-topbar {
  background: var(--bg-topbar) !important;
  border-bottom: 1px solid var(--border) !important;
}

html[data-theme-mode="light"] .card,
html[data-theme-mode="cream"] .card,
html[data-theme-mode="light"] .subject-card,
html[data-theme-mode="cream"] .subject-card,
html[data-theme-mode="light"] .lab-hero,
html[data-theme-mode="cream"] .lab-hero,
html[data-theme-mode="light"] .pdf-card,
html[data-theme-mode="cream"] .pdf-card,
html[data-theme-mode="light"] .modal-card,
html[data-theme-mode="cream"] .modal-card {
  background: var(--surface-card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
}

html[data-theme-mode="light"] .btn-primary,
html[data-theme-mode="cream"] .btn-primary {
  background: var(--coral) !important;
  color: #FFFFFF !important;
  border: 1px solid transparent !important;
}

html[data-theme-mode="light"] .btn-secondary,
html[data-theme-mode="cream"] .btn-secondary {
  background: var(--surface-panel) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
}

html[data-theme-mode="light"] .sidebar-footer-creator,
html[data-theme-mode="cream"] .sidebar-footer-creator {
  background: var(--surface-panel) !important;
  border: 1px solid var(--border) !important;
}

html[data-theme-mode="light"] .sidebar-creator-card,
html[data-theme-mode="cream"] .sidebar-creator-card {
  background: var(--surface-card) !important;
  border: 1px solid var(--border-soft) !important;
}

/* 11. REDUCED MOTION & BACKGROUND ANIMATION PAUSING FOR MAX PERFORMANCE */
body.animations-paused .lab-ambient *,
body.lab-focus-mode .lab-ambient *,
body.lab-focus-mode .hero-conduit-system * {
  animation-play-state: paused !important;
}

html[data-ui-theme="premium-lab"] .view.active,
html[data-ui-theme="premium-lab"] .view.active * {
  opacity: 1;
  visibility: visible;
}

html[data-ui-theme="premium-lab"] .view.active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

html[data-motion="reduced"] .spin-slow,
html[data-motion="reduced"] .spin-reverse-slow,
html[data-motion="reduced"] .lab-drift-node--1,
html[data-motion="reduced"] .lab-drift-node--2,
html[data-motion="reduced"] .lab-drift-node--3,
html[data-motion="reduced"] .hero-mascot-img,
html[data-motion="reduced"] .drift-pulse,
html[data-motion="reduced"] .circuit-pulse-dot,
html[data-motion="reduced"] .eq-col,
html[data-motion="reduced"] .pulse-bar,
html[data-motion="reduced"] .wave-slice,
html[data-motion="reduced"] .sq-tile,
html[data-motion="reduced"] .m-dot,
html[data-motion="reduced"] .conduit-pulse-bead,
html[data-motion="reduced"] .scope-wave {
  animation: none !important;
  transform: none !important;
}

/* --------------------------------------------------------------------------
   12. Industrial cyber-lab depth pass
   -------------------------------------------------------------------------- */
html[data-ui-theme="premium-lab"] {
  --pl-bg: #09141A;
  --pl-surface: #12232B;
  --pl-surface-2: #162B35;
  --surface-card: #12232B;
  --surface-card-light: #19313B;
  --surface-panel: #0F2028;
  --bg-main: #09141A;
  --bg: #09141A;
  --bg-card: #12232B;
  --bg-elevated: #162B35;
}

html[data-ui-theme="premium-lab"] body {
  background-color: #09141A;
  background-image:
    linear-gradient(rgba(85, 157, 157, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85, 157, 157, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #09141A 0%, #0B181F 100%);
  background-size: 34px 34px, 34px 34px, 100% 100%;
}

html[data-ui-theme="premium-lab"] .lab-hero {
  background: linear-gradient(168deg, #132830 0%, #0D1D24 100%);
  border: 2.5px solid #72F3CE;
  border-radius: 20px;
  box-shadow:
    0 0 0 3px #060E12,
    0 0 28px rgba(114, 243, 206, 0.38),
    0 12px 32px rgba(0, 0, 0, 0.8),
    inset 0 0 0 2px #081318,
    inset 0 0 22px rgba(114, 243, 206, 0.12);
}

html[data-ui-theme="premium-lab"] .lab-hero-top-row {
  min-height: 132px;
}

html[data-ui-theme="premium-lab"] .lab-hero-rig {
  width: 300px;
  height: 136px;
  padding: 0;
  align-self: stretch;
  z-index: 3;
  pointer-events: none;
}

html[data-ui-theme="premium-lab"] .lab-apparatus-svg {
  position: absolute;
  top: -18px;
  left: 50%;
  width: 300px;
  height: 222px;
  transform: translateX(-50%);
  overflow: visible;
}

html[data-ui-theme="premium-lab"] .lab-hero-stats {
  position: relative;
  z-index: 4;
}

html[data-ui-theme="premium-lab"] .hero-activity-graph {
  background:
    linear-gradient(rgba(90, 141, 153, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 141, 153, 0.1) 1px, transparent 1px),
    #09151B;
  background-size: 100% 14px, 30px 100%, 100% 100%;
  border: 1.5px solid #26444E;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 3px 0 #050B0E;
}

html[data-ui-theme="premium-lab"] .stats-compact-row.lab-hero-stats {
  background: #0A161C;
  border: 1.5px solid #284752;
  box-shadow: 0 4px 0 #050B0E, inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-ui-theme="premium-lab"] .stat-card {
  min-height: 62px;
  background: #0A161C !important;
  border: 1.5px solid #284752 !important;
  border-radius: 8px !important;
  box-shadow: 0 3px 0 #050B0E, inset 0 2px 8px rgba(0, 0, 0, 0.85) !important;
}

html[data-ui-theme="premium-lab"] .stat-card::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #65F8C4;
  box-shadow: 0 0 7px #65F8C4;
}

html[data-ui-theme="premium-lab"] .stat-card:nth-child(3)::after,
html[data-ui-theme="premium-lab"] .stat-card:nth-child(6)::after {
  background: #F47B5C;
  box-shadow: 0 0 7px #F47B5C;
}

html[data-ui-theme="premium-lab"] .stat-card:nth-child(4)::after {
  background: #F4A84A;
  box-shadow: 0 0 7px #F4A84A;
}

html[data-ui-theme="premium-lab"] .stat-card-left {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

html[data-ui-theme="premium-lab"] .stat-card .stat-label {
  color: #87A7AE;
}

html[data-ui-theme="premium-lab"] .stat-card .stat-value {
  font-size: 1.35rem !important;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.16);
}

html[data-ui-theme="premium-lab"] .stat-micro-viz {
  min-width: 46%;
  min-height: 34px;
  align-self: stretch;
}

html[data-ui-theme="premium-lab"] .micro-viz--eq {
  gap: 3px;
  height: 34px;
  align-items: flex-end;
  border-bottom: 2px solid rgba(88, 242, 182, 0.38);
}

html[data-ui-theme="premium-lab"] .micro-viz--eq .eq-col {
  width: 4px;
  min-height: 8px;
  box-shadow: 0 0 7px #58F2B6;
}

html[data-ui-theme="premium-lab"] .micro-viz--matrix .matrix-dot-grid {
  grid-template-columns: repeat(6, 4px);
  gap: 4px;
  align-content: center;
}

html[data-ui-theme="premium-lab"] .micro-viz--matrix .m-dot {
  width: 4px;
  height: 4px;
  background: rgba(88, 242, 182, 0.16);
}

html[data-ui-theme="premium-lab"] .micro-viz--matrix .m-dot.on {
  background: #58F2B6;
  box-shadow: 0 0 6px #58F2B6;
}

html[data-ui-theme="premium-lab"] .micro-viz--pulse-bars {
  height: 34px;
  gap: 4px;
  align-items: flex-end;
  border-bottom: 2px solid rgba(244, 123, 92, 0.42);
}

html[data-ui-theme="premium-lab"] .micro-viz--pulse-bars .pulse-bar {
  width: 5px;
  background: linear-gradient(180deg, #FFB36C, #F47B5C);
  box-shadow: 0 0 7px #F47B5C;
}

html[data-ui-theme="premium-lab"] .micro-viz--wave {
  height: 34px;
  gap: 3px;
  border-bottom: 2px solid rgba(244, 168, 74, 0.42);
}

html[data-ui-theme="premium-lab"] .micro-viz--wave .wave-slice {
  width: 4px;
  background: #F4A84A;
  box-shadow: 0 0 7px #F4A84A;
}

html[data-ui-theme="premium-lab"] .micro-viz--digits .digits-stream {
  font-size: 0.58rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-shadow: 0 0 6px #58F2B6;
}

html[data-ui-theme="premium-lab"] .micro-viz--sparkline .sparkline-svg {
  width: 76px;
  height: 32px;
  color: #F47B5C;
  border-bottom: 2px solid rgba(244, 123, 92, 0.4);
}

html[data-ui-theme="premium-lab"] .hero-conduit-system {
  height: 92px;
  margin: -10px 0 0.7rem;
  overflow: visible;
}

.admin-collapsible-panel > .admin-collapsible-content {
  display: none;
}

.admin-collapsible-panel.is-expanded > .admin-collapsible-content {
  display: block;
}

.admin-library-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.admin-inline-accordion {
  margin: 0.6rem 0 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.admin-inline-accordion summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 700;
}

.admin-subject-accordion {
  margin: 0.45rem 0;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-panel) 86%, transparent);
}

.admin-subject-accordion summary {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  padding: 0.65rem 0.75rem;
  color: var(--text-primary);
  font-weight: 700;
}

.admin-subject-accordion summary::-webkit-details-marker {
  display: none;
}

.admin-subject-accordion[open] summary {
  border-bottom: 1px solid var(--border-soft);
}

@media (max-width: 768px) {
  .app-topbar {
    height: 48px;
    min-height: 48px;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.3rem;
    overflow-x: auto;
  }

  .lab-hero {
    padding: 0.75rem 0.85rem;
    gap: 0.6rem;
    border-radius: 14px;
  }

  .lab-hero-rig,
  .hero-conduit-system,
  .hero-activity-graph {
    display: none !important;
  }

  .lab-hero-top-row {
    align-items: center;
  }

  .lab-hero-sub {
    display: none;
  }

  .lab-hero-stats,
  .stats-compact-row.lab-hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .lab-hero-stats > *,
  .stats-compact-row.lab-hero-stats > * {
    min-height: 48px;
    padding: 0.38rem 0.45rem !important;
  }

  .lab-hero-stats strong,
  .stats-compact-row.lab-hero-stats strong {
    font-size: 0.92rem !important;
  }

  .lab-hero-stats small,
  .stats-compact-row.lab-hero-stats small {
    font-size: 0.48rem;
  }

  .subject-card {
    padding: 0.7rem 0.8rem;
  }

  .subject-card-icon-box {
    width: 32px;
    height: 32px;
  }

  .subject-card-icon-box svg {
    width: 15px;
    height: 15px;
  }

  .subject-card-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 0.28rem 0.2rem;
  }

  .subject-card-stats svg {
    width: 11px;
    height: 11px;
  }

  .subject-card-stats strong {
    font-size: 0.74rem;
  }

  .subject-card-stats small {
    font-size: 0.46rem;
  }

  .subject-card-cta {
    padding: 0.28rem 0.65rem;
    font-size: 0.7rem;
  }

  .sidebar-nixie-gauge {
    background: #07151A !important;
    padding: 0.45rem 0.55rem !important;
  }

  .sidebar-nixie-gauge .nixie-digit {
    font-size: 0.98rem;
    color: #FF9447;
  }

  .mobile-bottom-bar {
    height: 48px;
  }

  .mobile-bottom-bar svg,
  .mobile-bottom-bar .nav-icon {
    width: 15px;
    height: 15px;
  }

  .mobile-bottom-bar span {
    font-size: 0.56rem;
  }

  #leaderboardView .leaderboard-row,
  #leaderboardView .rank-row {
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    min-height: 34px;
  }

  #leaderboardView .rank-badge {
    width: 22px;
    height: 22px;
  }

  #leaderboardView .rank-banner,
  #leaderboardView .leaderboard-hero,
  #leaderboardView .leaderboard-title-banner {
    display: none !important;
  }

  .topbar-auth-hint {
    display: none;
  }

  #subjectQuizzesView .subject-tabs-bar,
  #pdfCategoriesBar {
    display: none !important;
  }

  .mobile-subject-bento,
  .subject-bento-hub,
  #subjectBentoHub,
  #mobileSubjectBento {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0.55rem 0 0.7rem;
  }

  .mobile-subject-bento-item,
  .subject-bento-hub button,
  #subjectBentoHub button {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 48px;
    padding: 0.5rem 0.55rem;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface-panel);
    color: var(--text-primary);
    font-size: 0.76rem;
    text-align: left;
  }

  .mobile-subject-bento-item.active,
  .subject-bento-hub button.active,
  #subjectBentoHub button.active {
    border-color: var(--coral);
    background: rgba(244, 123, 92, 0.16);
    box-shadow: 0 0 0 1px rgba(244, 123, 92, 0.25), 0 0 12px rgba(244, 123, 92, 0.16);
  }

  .mobile-subject-bento-item strong,
  .subject-bento-hub button strong,
  #subjectBentoHub button strong {
    margin-left: auto;
    color: var(--mint);
  }

  .subject-hero-banner {
    padding: 0.65rem 0.75rem;
  }

  .subject-hero-actions {
    gap: 0.35rem;
  }

  .subject-hero-actions .btn {
    min-height: 34px;
    padding: 0.25rem 0.5rem;
    font-size: 0.68rem;
  }
}

@media (max-width: 560px) {
  .topbar-login-btn {
    padding: 0.22rem 0.45rem;
    font-size: 0.68rem;
  }

  .topbar-login-btn .guest-sub-badge {
    display: none;
  }

  .topbar-auth-btn span {
    display: none;
  }
}

@media (max-width: 560px) {
  .app-topbar .topbar-pill span:not(.topbar-pill-icon),
  .app-topbar .topbar-label {
    display: none;
  }

  .app-topbar .topbar-pill {
    font-size: 0.7rem;
    padding: 0.22rem 0.48rem;
    height: 30px;
  }
}

html[data-ui-theme="premium-lab"] .hero-conduit-svg {
  display: block;
  width: 100%;
  height: 92px;
  overflow: visible;
}

html[data-ui-theme="premium-lab"] .subject-card {
  background: linear-gradient(180deg, #142730 0%, #0F1E26 100%);
  border: 1.5px solid color-mix(in srgb, var(--s-accent) 68%, #1E3A44);
  border-radius: 16px;
  box-shadow:
    0 0 0 2.5px #060D11,
    0 6px 0 #050A0E,
    0 12px 24px rgba(0, 0, 0, 0.75),
    0 0 18px color-mix(in srgb, var(--s-accent) 16%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px color-mix(in srgb, var(--s-accent) 38%, transparent);
}

html[data-ui-theme="premium-lab"] .subject-card:hover,
html[data-ui-theme="premium-lab"] .subject-card:focus-visible {
  box-shadow:
    0 0 0 2.5px #060D11,
    0 8px 0 #050A0E,
    0 16px 28px rgba(0, 0, 0, 0.8),
    0 0 22px color-mix(in srgb, var(--s-accent) 25%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 1px color-mix(in srgb, var(--s-accent) 55%, transparent);
}

html[data-ui-theme="premium-lab"] .subject-card-accent {
  height: 2px;
  inset: 5px 10px auto;
  width: auto;
  border-radius: 999px;
  opacity: 0.45;
  filter: blur(0.2px);
}

html[data-ui-theme="premium-lab"] .subject-card-stats {
  background: #1A313B;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 3px 8px rgba(0, 0, 0, 0.4);
}

html[data-ui-theme="premium-lab"] .subject-card-cta {
  background: linear-gradient(180deg, #F0855B 0%, #C95B35 100%) !important;
  border: 1.5px solid #081217 !important;
  box-shadow: 0 3px 0 #060D11, 0 5px 12px rgba(244, 123, 92, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
}

html[data-ui-theme="premium-lab"] .btn-nav {
  background: linear-gradient(180deg, #13252E 0%, #0E1C23 100%);
  border: 1.5px solid #26434E;
  border-radius: 10px;
  box-shadow: 0 3px 0 #060E12, 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-ui-theme="premium-lab"] .btn-nav.active {
  background: linear-gradient(90deg, rgba(244, 140, 92, 0.28) 0%, rgba(20, 39, 48, 0.95) 100%) !important;
  border: 1.5px solid #E59866 !important;
  box-shadow: 0 3px 0 #060E12, 0 0 14px rgba(229, 152, 102, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

html[data-ui-theme="premium-lab"] .subject-search-input,
html[data-ui-theme="premium-lab"] .pill {
  border: 1.5px solid #284650;
  box-shadow: 0 3px 0 #060D11, inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

html[data-ui-theme="premium-lab"] .pill {
  background: linear-gradient(180deg, #13252E 0%, #0E1C23 100%);
}

@media (max-width: 900px) {
  html[data-ui-theme="premium-lab"] .lab-hero-top-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  html[data-ui-theme="premium-lab"] .lab-hero-rig {
    position: absolute;
    top: 0;
    right: 5%;
    opacity: 0.72;
    pointer-events: none;
  }

  html[data-ui-theme="premium-lab"] .lab-hero-right-cluster {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  html[data-ui-theme="premium-lab"] .lab-hero-rig {
    display: none;
  }

  html[data-ui-theme="premium-lab"] .stats-compact-row.lab-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-ui-theme="premium-lab"] .stat-micro-viz {
    min-width: 40%;
  }

  html[data-ui-theme="premium-lab"] .hero-conduit-system {
    height: 70px;
  }

  html[data-ui-theme="premium-lab"] .hero-conduit-svg {
    height: 70px;
  }
}
