/* ==========================================================================
   E-BOOK ZONE INDIA — MASTER CYBERPUNK & GLASSMORPHISM DESIGN SYSTEM
   File: /assets/css/theme-global.css (Phase 1 — File 5/30)
   Covers: Design Tokens, Custom I-Beam & Canvas Cursor Fix, Sentiment Aura,
           Neural Progress Tracker, Glass Header, Library Grid, Metaverse,
           Audio Studio, Leaderboards, Admin Console, J.A.R.V.I.S & Modals
   ========================================================================== */

:root {
  /* Core Cyberpunk Dark Palette */
  --bg-void: #05070f;
  --bg-obsidian: #090d1a;
  --bg-elevated: #0e1528;
  --glass-surface: rgba(12, 18, 36, 0.74);
  --glass-surface-heavy: rgba(8, 12, 26, 0.92);
  --glass-border: rgba(0, 243, 255, 0.22);
  --glass-border-strong: rgba(0, 243, 255, 0.5);
  --glass-highlight: rgba(255, 255, 255, 0.08);

  /* Neon Accents */
  --neon-cyan: #00f3ff;
  --neon-cyan-dim: rgba(0, 243, 255, 0.14);
  --neon-purple: #b026ff;
  --neon-purple-dim: rgba(176, 38, 255, 0.16);
  --neon-emerald: #00ff9d;
  --neon-emerald-dim: rgba(0, 255, 157, 0.14);
  --neon-amber: #ffb800;
  --neon-danger: #ff2a6d;

  /* Typography Hierarchy */
  --text-primary: #f2f7ff;
  --text-secondary: #b4c6e0;
  --text-muted: #7589a6;
  --font-display: 'Orbitron', 'Space Grotesk', sans-serif;
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Adaptive Typography Engine Variables (Controlled by AI Strategy #8) */
  --reader-font-family: 'Merriweather', Georgia, serif;
  --reader-font-size: 18px;
  --reader-line-height: 1.75;
  --reader-letter-spacing: 0.01em;

  /* Layout & Safe Areas */
  --header-height: 70px;
  --dock-height: 74px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-cyber: 0 20px 50px rgba(0, 0, 0, 0.72), 0 0 30px rgba(0, 243, 255, 0.08);
  --transition-fast: 160ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-smooth: 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   1. RESET, SCROLLBARS & BASE VIEWPORT
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-void);
  color: var(--text-primary);
  -webkit-text-size-adjust: 100%;
}

body.cyber-body {
  min-height: 100vh;
  background-color: var(--bg-void);
  background-image:
    radial-gradient(circle at 12% 15%, rgba(0, 243, 255, 0.09) 0%, transparent 38%),
    radial-gradient(circle at 88% 82%, rgba(176, 38, 255, 0.11) 0%, transparent 42%),
    linear-gradient(rgba(0, 243, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: var(--header-height);
  padding-bottom: calc(var(--dock-height) + 28px);
  position: relative;
}

/* Custom Cyberpunk Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: rgba(5, 7, 15, 0.85);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 243, 255, 0.32);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--neon-cyan);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   2. CUSTOM VISIBLE CURSOR & CANVAS GLITCH FIX
      - Guarantees visible cursor over HTML5 Canvas & 3D WebGL
      - Automatically morphs into high-contrast Neon I-Beam over text
   ========================================================================== */
p,
span,
h1,
h2,
h3,
h4,
li,
blockquote,
code,
pre,
input[type='text'],
input[type='search'],
input[type='email'],
input[type='password'],
input[type='url'],
textarea,
.selectable-text-layer {
  cursor: text;
}

button,
a,
select,
label,
input[type='range'],
input[type='checkbox'],
[role='button'],
.book-card {
  cursor: pointer;
}

/* Fix Canvas Cursor Disappearing/Glitching */
canvas.pdf-render-canvas,
canvas#metaverse-3d-canvas,
canvas#holo-mindmap-canvas,
canvas#audio-waveform-canvas {
  cursor: default;
  touch-action: pan-y pinch-zoom;
}

canvas.annotation-overlay-canvas[data-active-tool='pen'],
canvas.annotation-overlay-canvas[data-active-tool='highlighter'],
canvas.annotation-overlay-canvas[data-active-tool='eraser'] {
  cursor: crosshair !important;
}

@media (pointer: fine) {
  #cyber-cursor-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99999;
    overflow: hidden;
  }

  .cursor-dot,
  .cursor-ring,
  .cursor-ibeam {
    position: fixed;
    top: -100px;
    left: -100px;
    pointer-events: none;
    transform: translate(-50%, -50%);
    will-change: transform, left, top;
  }

  .cursor-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
    transition: opacity 0.15s ease, transform 0.12s ease;
  }

  .cursor-ring {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 243, 255, 0.65);
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.18);
    transition: width 0.18s ease, height 0.18s ease, border-color 0.18s ease, opacity 0.15s ease;
  }

  .cursor-ibeam {
    width: 2px;
    height: 22px;
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
    opacity: 0;
    transition: opacity 0.12s ease;
  }

  .cursor-ibeam::before,
  .cursor-ibeam::after {
    content: '';
    position: absolute;
    left: -4px;
    width: 10px;
    height: 2px;
    background: var(--neon-cyan);
  }
  .cursor-ibeam::before {
    top: 0;
  }
  .cursor-ibeam::after {
    bottom: 0;
  }

  /* Morph to I-Beam when hovering text/inputs */
  body[data-cursor-mode='ibeam'] .cursor-dot,
  body[data-cursor-mode='ibeam'] .cursor-ring {
    opacity: 0;
  }
  body[data-cursor-mode='ibeam'] .cursor-ibeam {
    opacity: 1;
  }

  /* Interactive Hover Expansion */
  body[data-cursor-mode='interactive'] .cursor-ring {
    width: 44px;
    height: 44px;
    border-color: var(--neon-emerald);
    background: rgba(0, 255, 157, 0.07);
  }
}

@media (pointer: coarse) {
  #cyber-cursor-layer {
    display: none !important;
  }
}

/* ==========================================================================
   3. NEURAL PROGRESS TRACKER & SENTIMENT ANALYSIS AMBIENT AURA (AI #7 & #9)
   ========================================================================== */
#neural-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 2000;
  overflow: hidden;
}

.neural-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan) 0%, var(--neon-purple) 55%, var(--neon-emerald) 100%);
  box-shadow: 0 0 14px var(--neon-cyan);
  transition: width 0.25s ease-out;
}

#sentiment-ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  transition: background 1.2s ease;
}

body[data-sentiment-aura='analytical'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 15%, rgba(0, 243, 255, 0.14), transparent 60%);
}
body[data-sentiment-aura='intense'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 15%, rgba(255, 42, 109, 0.15), transparent 60%);
}
body[data-sentiment-aura='inspiring'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 15%, rgba(0, 255, 157, 0.14), transparent 60%);
}
body[data-sentiment-aura='philosophical'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 15%, rgba(176, 38, 255, 0.16), transparent 60%);
}

/* ==========================================================================
   4. REUSABLE GLASSMORPHISM PANELS, TAGS & CYBER BUTTONS
   ========================================================================== */
.glass-panel {
  background: var(--glass-surface);
  backdrop-filter: blur(20px) saturate(165%);
  -webkit-backdrop-filter: blur(20px) saturate(165%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-cyber), inset 0 1px 0 var(--glass-highlight);
}

.cyber-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--neon-cyan-dim);
  border: 1px solid rgba(0, 243, 255, 0.38);
  color: var(--neon-cyan);
}

.cyber-tag.tag-purple {
  background: var(--neon-purple-dim);
  border-color: rgba(176, 38, 255, 0.42);
  color: #df9eff;
}

.cyber-tag.tag-emerald {
  background: var(--neon-emerald-dim);
  border-color: rgba(0, 255, 157, 0.42);
  color: var(--neon-emerald);
}

.cyber-tag.tag-danger {
  background: rgba(255, 42, 109, 0.15);
  border-color: rgba(255, 42, 109, 0.45);
  color: #ff6b9b;
}

.cyber-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.62rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(15, 24, 48, 0.8);
  border: 1px solid var(--glass-border);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.cyber-btn:hover {
  transform: translateY(-2px);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.24);
}

.cyber-btn-neon {
  background: linear-gradient(135deg, #00f3ff 0%, #0077ff 100%);
  color: #030712;
  font-weight: 700;
  border: none;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

.cyber-btn-neon:hover {
  background: linear-gradient(135deg, #33f6ff 0%, #1a88ff 100%);
  box-shadow: 0 0 28px rgba(0, 243, 255, 0.5);
}

.cyber-btn-glass {
  background: rgba(176, 38, 255, 0.16);
  border: 1px solid rgba(176, 38, 255, 0.45);
  color: #f3dcff;
}

.cyber-btn-outline {
  background: rgba(0, 243, 255, 0.06);
  border: 1px solid rgba(0, 243, 255, 0.35);
}

.cyber-btn-admin {
  background: linear-gradient(135deg, rgba(255, 42, 109, 0.2) 0%, rgba(176, 38, 255, 0.2) 100%);
  border: 1px solid rgba(255, 42, 109, 0.48);
  color: #ff9ec0;
  width: 100%;
}

.cyber-btn-lg {
  padding: 0.85rem 1.45rem;
  font-size: 0.96rem;
}

.cyber-btn-full {
  width: 100%;
}

.cyber-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 243, 255, 0.22);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.cyber-icon-btn:hover {
  background: rgba(0, 243, 255, 0.16);
  border-color: var(--neon-cyan);
}

.tiny-cyber-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.72rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 243, 255, 0.1);
  border: 1px solid rgba(0, 243, 255, 0.3);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background var(--transition-fast);
}

.tiny-cyber-btn:hover {
  background: rgba(0, 243, 255, 0.22);
}

/* ==========================================================================
   5. TOP CYBERPUNK GLASS COMMAND HEADER
   ========================================================================== */
.glass-header {
  position: fixed;
  top: 4px;
  left: 0;
  right: 0;
  height: var(--header-height);
  padding: 0 1.5rem;
  background: rgba(7, 11, 24, 0.82);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 1000;
  transition: transform var(--transition-smooth), opacity var(--transition-smooth);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.vault-hamburger-icon {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--neon-cyan);
  position: relative;
}
.vault-hamburger-icon::before,
.vault-hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--neon-cyan);
}
.vault-hamburger-icon::before {
  top: -6px;
}
.vault-hamburger-icon::after {
  top: 6px;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-emblem {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.22), rgba(176, 38, 255, 0.28));
  border: 1px solid var(--neon-cyan);
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 0 16px rgba(0, 243, 255, 0.25);
}

.emblem-core {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--neon-cyan);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.neon-accent {
  color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(0, 243, 255, 0.45);
}

.brand-subtitle {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.header-center {
  flex: 1;
  max-width: 540px;
}

.neural-search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(5, 8, 19, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.28);
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.neural-search-box:focus-within {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.22);
}

.neural-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
}

.neural-search-input::placeholder {
  color: var(--text-muted);
}

.search-action-btn {
  background: transparent;
  border: none;
  font-size: 0.95rem;
}

.search-shortcut-kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-secondary);
}

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  background: rgba(10, 16, 34, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.25);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-emerald);
  box-shadow: 0 0 10px var(--neon-emerald);
}

/* ==========================================================================
   6. MAIN SPA VIEWPORT & LIBRARY HUB (View 1)
   ========================================================================== */
.cyber-main-viewport {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

.spa-view {
  animation: fadeViewIn 0.28s ease-out;
}

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

/* Hero Banner */
.cyber-hero-banner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 2.35rem;
  margin-bottom: 1.5rem;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hero-main-title {
  font-family: var(--font-heading);
  font-size: clamp(1.85rem, 3.5vw, 2.9rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.text-gradient-cyber {
  background: linear-gradient(135deg, var(--neon-cyan) 0%, #ffffff 50%, var(--neon-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  color: var(--text-secondary);
  font-size: 1.02rem;
  max-width: 840px;
  margin-bottom: 1.5rem;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.cyber-btn-danger-outline {
  background: rgba(255, 59, 107, 0.12);
  border: 1px solid rgba(255, 59, 107, 0.55);
  color: #ff8fa3;
  box-shadow: 0 0 14px rgba(255, 59, 107, 0.16);
}

.cyber-btn-danger-outline:hover {
  background: rgba(255, 59, 107, 0.24);
  border-color: #ff4d6d;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(255, 59, 107, 0.35);
}

.vault-login-id-line {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neon-cyan);
  margin: 0.15rem 0 0.25rem;
  word-break: break-word;
}

.installer-brand-banner-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 243, 255, 0.28);
  background: rgba(5, 10, 24, 0.9);
  flex-wrap: wrap;
}

.installer-preview-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: contain;
  border: 1px solid rgba(0, 243, 255, 0.4);
}

.installer-preview-banner {
  max-height: 68px;
  max-width: 100%;
  object-fit: contain;
}

/* 3D Floating Book Pedestal */
.hero-3d-showcase {
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1100px;
}

.holo-book-pedestal {
  width: 260px;
  height: 340px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(-18deg) rotateX(8deg);
  transition: transform 0.45s ease;
  cursor: pointer;
}

.holo-book-pedestal:hover {
  transform: rotateY(-6deg) rotateX(4deg) translateY(-8px);
}

.book-3d-cover {
  width: 100%;
  height: 100%;
  border-radius: 6px 16px 16px 6px;
  background: linear-gradient(155deg, #0b1b3d 0%, #1c0b3b 60%, #050d24 100%);
  border: 1.5px solid var(--neon-cyan);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow:
    -12px 18px 38px rgba(0, 0, 0, 0.85),
    0 0 30px rgba(0, 243, 255, 0.25);
}

.book-badge {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--neon-cyan);
  color: #030712;
  font-weight: 700;
}

.book-3d-cover h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.35;
  color: #ffffff;
}

.book-meta-chips {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--neon-emerald);
}

/* Sponsored Ad Slot */
.cyber-ad-slot {
  padding: 0.95rem 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--neon-purple);
}

.ad-slot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.ad-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: var(--neon-purple-dim);
  color: #e2b0ff;
  border: 1px solid rgba(176, 38, 255, 0.4);
}

.ad-cta-link {
  color: var(--neon-cyan);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.88rem;
}

/* Library Filter Bar */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.category-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-tab {
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.filter-tab.active,
.filter-tab:hover {
  background: var(--neon-cyan-dim);
  border-color: var(--neon-cyan);
  color: var(--text-primary);
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.2);
}

.library-actions-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cyber-select {
  background: rgba(6, 10, 22, 0.9);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.52rem 0.85rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  outline: none;
}

/* Books Catalog Grid */
.books-cyber-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.35rem;
}

.book-card {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.book-card:hover {
  transform: translateY(-5px);
  border-color: var(--neon-cyan);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 243, 255, 0.18);
}

.book-card-cover-banner {
  height: 165px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.18), rgba(176, 38, 255, 0.25));
  border: 1px solid rgba(0, 243, 255, 0.25);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.book-card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.book-card-author {
  font-size: 0.84rem;
  color: var(--neon-cyan);
}

.book-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   7. METAVERSE ROOMS, AUDIO STUDIO, LEADERBOARDS & ADMIN (Views 3, 4, 5, 6)
   ========================================================================== */
.metaverse-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.metaverse-controls {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.metaverse-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.25rem;
}

.metaverse-canvas-wrap {
  position: relative;
  min-height: 480px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#metaverse-3d-canvas {
  width: 100%;
  height: 480px;
  display: block;
}

.metaverse-hud-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.room-code-pill,
.peers-online-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(5, 7, 15, 0.82);
  border: 1px solid var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.metaverse-sidebar {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-scroll-area {
  height: 220px;
  overflow-y: auto;
  background: rgba(5, 7, 15, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
}

.chat-input-row input {
  flex: 1;
  background: rgba(5, 8, 20, 0.9);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: var(--text-primary);
}

/* Audio & AI Story Studio */
.audio-studio-grid,
.leaderboard-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.audiobook-player-card,
.ai-story-generator-card,
.leaderboard-main-card,
.gamification-badges-card,
.admin-dashboard-card {
  padding: 1.75rem;
}

.waveform-canvas {
  width: 100%;
  height: 140px;
  background: rgba(5, 7, 15, 0.75);
  border: 1px solid rgba(0, 243, 255, 0.22);
  border-radius: var(--radius-md);
  margin: 1.25rem 0;
}

.audio-transport-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.audio-sliders-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  font-size: 0.85rem;
}

/* Forms & Admin Console */
.cyber-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}

.cyber-form label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.cyber-form input[type='text'],
.cyber-form input[type='email'],
.cyber-form input[type='password'],
.cyber-form input[type='url'],
.cyber-form textarea {
  width: 100%;
  background: rgba(5, 8, 20, 0.88);
  border: 1px solid rgba(0, 243, 255, 0.28);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  outline: none;
}

.cyber-form input:focus,
.cyber-form textarea:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.form-row-2col,
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.file-dropzone {
  border: 2px dashed rgba(0, 243, 255, 0.4);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  background: rgba(0, 243, 255, 0.04);
}

/* ==========================================================================
   8. J.A.R.V.I.S RAG AI DRAWER, MODALS & TOAST STACK
   ========================================================================== */
.jarvis-drawer {
  position: fixed;
  top: calc(var(--header-height) + 14px);
  right: 1.25rem;
  bottom: calc(var(--dock-height) + 24px);
  width: min(420px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  z-index: 1200;
  overflow: hidden;
}

.jarvis-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.jarvis-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.jarvis-orb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 16px var(--neon-cyan), 0 0 30px var(--neon-purple);
  animation: pulseOrb 2s infinite ease-in-out;
}

@keyframes pulseOrb {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.22);
    opacity: 0.75;
  }
}

.jarvis-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neon-emerald);
}

.jarvis-quick-chips {
  display: flex;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.jarvis-chip {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(0, 243, 255, 0.1);
  border: 1px solid rgba(0, 243, 255, 0.3);
  color: var(--text-primary);
  font-size: 0.75rem;
  white-space: nowrap;
}

.jarvis-messages-container {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.jarvis-msg .msg-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.jarvis-msg .msg-bubble {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(15, 25, 50, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.22);
  font-size: 0.88rem;
}

.jarvis-msg.user-msg .msg-bubble {
  background: rgba(176, 38, 255, 0.2);
  border-color: rgba(176, 38, 255, 0.45);
}

.jarvis-input-bar {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 0.5rem;
}

.jarvis-input-bar input {
  flex: 1;
  background: rgba(5, 8, 20, 0.9);
  border: 1px solid rgba(0, 243, 255, 0.32);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  color: var(--text-primary);
  outline: none;
}

/* Modals */
.cyber-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 12, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1500;
}

.cyber-modal-card {
  width: 100%;
  max-width: 580px;
  padding: 1.75rem;
  max-height: 90vh;
  overflow-y: auto;
}

.cyber-modal-card.modal-xl {
  max-width: 1060px;
}

.modal-header,
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.install-platforms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.install-card {
  padding: 1.15rem;
  border-radius: var(--radius-md);
  background: rgba(5, 8, 20, 0.72);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
}

/* Global Toast Notifications */
.toast-stack {
  position: fixed;
  top: calc(var(--header-height) + 16px);
  right: 1.25rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.cyber-toast {
  pointer-events: auto;
  padding: 0.8rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--glass-surface-heavy);
  border-left: 4px solid var(--neon-cyan);
  border-top: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-cyber);
  font-size: 0.86rem;
  color: var(--text-primary);
}

/* Tables & Horizontal Scroll Safeguards */
.leaderboard-table-container,
.admin-inventory-table-wrap,
#admin-books-table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cyber-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.cyber-table th,
.cyber-table td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid rgba(0, 243, 255, 0.14);
}

.cyber-table th {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--neon-cyan);
  white-space: nowrap;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .cyber-hero-banner,
  .metaverse-workspace-grid,
  .audio-studio-grid,
  .leaderboard-layout-grid,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
  .cache-pill {
    display: none;
  }
}

@media (max-width: 768px) {
  html,
  body.cyber-body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  body.cyber-body {
    padding-top: 136px;
    padding-bottom: calc(var(--dock-height) + 24px);
  }

  .glass-header {
    height: auto;
    min-height: 62px;
    padding: 0.5rem 0.75rem;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .header-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.5rem;
  }

  .brand-emblem {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 0.86rem;
    white-space: nowrap;
  }

  .brand-subtitle,
  #device-tier-badge,
  .search-shortcut-kbd,
  .btn-label-desktop {
    display: none !important;
  }

  .header-right {
    flex: 0 0 auto;
    gap: 0.35rem;
    flex-wrap: nowrap;
  }

  #open-contact-modal-btn {
    padding: 0.34rem 0.5rem;
    font-size: 0.74rem;
  }

  #open-install-modal-btn {
    padding: 0.34rem 0.5rem;
    font-size: 0.68rem;
  }

  #biometric-auth-btn {
    padding: 0.34rem 0.55rem;
    font-size: 0.72rem;
    max-width: 130px;
    white-space: nowrap;
  }

  #biometric-auth-btn #auth-user-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 88px;
    display: inline-block;
    vertical-align: bottom;
  }

  #header-logout-btn {
    padding: 0.34rem 0.52rem;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  #header-logout-btn .header-logout-text {
    display: none;
  }

  .header-center {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
  }

  .neural-search-box {
    padding: 0.32rem 0.7rem;
    width: 100%;
  }

  .neural-search-input {
    font-size: 0.82rem;
    min-width: 0;
  }

  .cyber-main-viewport {
    padding: 0.85rem 0.65rem;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .cyber-hero-banner {
    padding: 1.2rem 0.95rem;
    gap: 1.15rem;
  }

  .hero-main-title {
    font-size: 1.48rem;
    line-height: 1.22;
  }

  .hero-description {
    font-size: 0.88rem;
  }

  .hero-cta-row {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-cta-row .cyber-btn {
    width: 100%;
    justify-content: center;
  }

  .home-auth-account-bar {
    padding: 0.78rem 0.82rem;
  }

  .home-auth-btn-row .cyber-btn {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 0.76rem;
    padding: 0.45rem 0.68rem;
  }

  .holo-book-pedestal {
    width: 220px;
    height: 286px;
    transform: rotateY(-10deg) rotateX(5deg);
  }

  .library-toolbar {
    padding: 0.75rem;
    gap: 0.65rem;
  }

  .category-filter-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
  }

  .category-filter-group::-webkit-scrollbar {
    display: none;
  }

  .filter-tab {
    flex-shrink: 0;
    font-size: 0.78rem;
    padding: 0.4rem 0.78rem;
  }

  .library-actions-right {
    width: 100%;
    justify-content: space-between;
  }

  .library-actions-right .cyber-select {
    flex: 1;
    min-width: 0;
  }

  .books-cyber-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  #metaverse-3d-canvas {
    height: 270px;
  }

  .metaverse-hud-overlay {
    top: 0.6rem;
    left: 0.6rem;
    right: 0.6rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .metaverse-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .metaverse-controls .cyber-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
  }

  .audiobook-player-card,
  .ai-story-generator-card,
  .leaderboard-main-card,
  .gamification-badges-card,
  .admin-dashboard-card {
    padding: 1rem 0.85rem;
    min-width: 0;
    overflow: hidden;
  }

  .leaderboard-table-container,
  .admin-catalog-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .form-row-2col {
    grid-template-columns: 1fr;
  }

  .cyber-modal-card {
    padding: 1.15rem 0.95rem;
    max-height: 88vh;
    overflow-y: auto;
  }

  .jarvis-drawer {
    top: auto;
    left: 0.5rem;
    right: 0.5rem;
    bottom: calc(var(--dock-height) + 12px);
    width: auto;
    height: 72vh;
  }
}

/* ==========================================================================
   9. UNIVERSITY SUB-FILTER BAR (Panjab University, Delhi University & Other)
   ========================================================================== */
.university-subfilter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
  border-left: 4px solid var(--neon-cyan);
  animation: fadeViewIn 0.22s ease-out;
}

.uni-filter-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.uni-filter-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.uni-sub-tab {
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.uni-sub-tab.active,
.uni-sub-tab:hover {
  background: var(--neon-cyan-dim);
  border-color: var(--neon-cyan);
  color: var(--text-primary);
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.24);
}

/* ==========================================================================
   10. DYNAMIC BOOK-BASED THEME ENGINE (Auto-Morphs Colors Per Book/Category)
   ========================================================================== */
html[data-book-theme='story-warm-gold'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 18%, rgba(255, 200, 87, 0.18), rgba(255, 77, 109, 0.08) 45%, transparent 70%);
}

html[data-book-theme='pu-crimson-gold'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 18%, rgba(255, 71, 126, 0.18), rgba(255, 209, 102, 0.1) 45%, transparent 70%);
}

html[data-book-theme='du-royal-amethyst'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 18%, rgba(199, 125, 255, 0.2), rgba(72, 202, 228, 0.1) 45%, transparent 70%);
}

html[data-book-theme='uni-emerald-scholar'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 18%, rgba(6, 214, 160, 0.18), rgba(17, 138, 178, 0.1) 45%, transparent 70%);
}

html[data-book-theme='sovereign-saffron'] #sentiment-ambient-backdrop {
  background: radial-gradient(circle at 50% 18%, rgba(255, 159, 28, 0.18), rgba(46, 196, 182, 0.1) 45%, transparent 70%);
}

/* ==========================================================================
   11. AUTO-DETECTED DEVICE LAYOUT GUARD (Mobile vs Laptop/PC Zero-Overflow)
   ========================================================================== */
html[data-device-mode='mobile'],
html[data-device-mode='mobile'] body.cyber-body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
}

html[data-device-mode='mobile'] .cyber-main-viewport,
html[data-device-mode='mobile'] .spa-view,
html[data-device-mode='mobile'] .glass-panel {
  max-width: 100%;
  box-sizing: border-box;
}

html[data-device-mode='mobile'] .university-subfilter-row {
  padding: 0.65rem 0.8rem;
  gap: 0.45rem;
}

html[data-device-mode='mobile'] .uni-filter-pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  padding-bottom: 0.2rem;
  scrollbar-width: none;
}

html[data-device-mode='mobile'] .uni-filter-pills::-webkit-scrollbar {
  display: none;
}

html[data-device-mode='mobile'] .uni-sub-tab {
  flex-shrink: 0;
  font-size: 0.76rem;
  padding: 0.36rem 0.72rem;
}