/* ==========================================================================
   SQL 3D ODYSSEY // ULTRA-RESPONSIVE CYBERPUNK DESIGN SYSTEM
   ========================================================================== */

:root {
  --bg-dark: #040814;
  --bg-card: rgba(8, 16, 32, 0.78);
  --bg-card-hover: rgba(14, 28, 54, 0.92);
  --border-cyan: rgba(0, 240, 255, 0.25);
  --border-cyan-glow: rgba(0, 240, 255, 0.65);
  --border-purple: rgba(189, 0, 255, 0.35);
  --cyan: #00f0ff;
  --cyan-glow: 0 0 20px rgba(0, 240, 255, 0.6), 0 0 40px rgba(0, 240, 255, 0.2);
  --magenta: #ff007f;
  --purple: #9d4edd;
  --gold: #ffd166;
  --emerald: #06d6a0;
  --text-main: #f0f6fc;
  --text-muted: #8b9bb4;
  --text-dim: #4a5d78;
  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --hud-height: 64px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan) var(--bg-dark);
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cyan), var(--purple));
  border-radius: 3px;
}

/* ==========================================================================
   BABYLON 3D CANVAS & BACKGROUND OVERLAYS
   ========================================================================== */

#renderCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  outline: none;
  touch-action: none;
}

.cyber-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 25%, rgba(4, 8, 20, 0.75) 85%),
              linear-gradient(180deg, rgba(4, 8, 20, 0.4) 0%, transparent 20%, transparent 80%, rgba(4, 8, 20, 0.8) 100%);
}

.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  opacity: 0.2;
}

/* ==========================================================================
   TOP HUD HEADER & NAVIGATION
   ========================================================================== */

.hud-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--hud-height);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(0.75rem, 3vw, 2rem);
  background: rgba(4, 8, 20, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-cyan);
  box-shadow: 0 4px 30px rgba(0, 240, 255, 0.08);
  gap: 0.75rem;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(157, 78, 221, 0.2));
  border: 1px solid var(--cyan);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  box-shadow: var(--cyan-glow);
}

.brand-logo-icon svg {
  width: 18px;
  height: 18px;
}

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

.brand-title {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-main);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
  white-space: nowrap;
}

.brand-subtitle {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--cyan);
  letter-spacing: 1px;
  white-space: nowrap;
}

.hud-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(8, 16, 32, 0.85);
  padding: 0.25rem 0.4rem;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  scrollbar-width: none;
}

.hud-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-btn .step-num {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  opacity: 0.6;
}

.nav-btn:hover {
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
}

.nav-btn.active {
  color: #040814;
  background: var(--cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.7);
  font-weight: 700;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.hud-btn {
  background: rgba(14, 28, 54, 0.85);
  border: 1px solid var(--border-cyan);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.hud-btn svg {
  width: 14px;
  height: 14px;
}

.hud-btn:hover {
  border-color: var(--cyan);
  box-shadow: var(--cyan-glow);
}

.hud-btn.glow-accent {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(157, 78, 221, 0.35));
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Mobile Hamburger Button */
.mobile-menu-btn {
  display: none;
}

/* Mobile Slide-out Navigation Drawer */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100vh;
  background: rgba(6, 12, 26, 0.98);
  backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-cyan);
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.9);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer.hidden {
  transform: translateX(105%);
  pointer-events: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0, 240, 255, 0.15);
  background: rgba(0, 240, 255, 0.05);
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--cyan);
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.drawer-close-btn:hover {
  color: var(--cyan);
}

.drawer-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.drawer-nav-item {
  background: rgba(14, 28, 54, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.drawer-nav-item .d-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan);
  margin-right: 0.75rem;
}

.drawer-nav-item .d-label {
  flex: 1;
}

.drawer-nav-item svg {
  width: 14px;
  height: 14px;
  opacity: 0.4;
  transition: transform 0.2s;
}

.drawer-nav-item:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--cyan);
  color: var(--cyan);
}

.drawer-nav-item:hover svg {
  opacity: 1;
  transform: translateX(3px);
}

.drawer-nav-item.active {
  background: var(--cyan);
  color: var(--bg-dark);
  border-color: var(--cyan);
  font-weight: 700;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.drawer-nav-item.active .d-num {
  color: var(--bg-dark);
  font-weight: 800;
}

.drawer-nav-item.active svg {
  opacity: 0.8;
  stroke: var(--bg-dark);
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 250;
  opacity: 1;
  transition: opacity 0.3s;
}

.drawer-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   LEFT TELEMETRY HUD
   ========================================================================== */

.hud-telemetry {
  position: fixed;
  left: clamp(1rem, 2.5vw, 2rem);
  top: calc(var(--hud-height) + 1.5rem);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
  width: 210px;
}

.telemetry-box {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-left: 3px solid var(--cyan);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.telemetry-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 0.2rem;
}

.telemetry-value {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.telemetry-pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  margin-top: 0.25rem;
}

.pipe-step {
  padding: 0.12rem 0.3rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  color: var(--text-dim);
  transition: all 0.3s;
}

.pipe-step.active {
  background: var(--cyan);
  color: var(--bg-dark);
  font-weight: 700;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.pipe-arrow {
  color: var(--cyan);
  opacity: 0.5;
}

/* ==========================================================================
   RIGHT CONTEXTUAL 3D INTERACTION PANEL
   ========================================================================== */

.hud-interaction-panel {
  position: fixed;
  right: clamp(1rem, 2.5vw, 2rem);
  top: calc(var(--hud-height) + 1.5rem);
  z-index: 10;
  width: 260px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 240, 255, 0.08);
  border-bottom: 1px solid var(--border-cyan);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--cyan);
}

.panel-icon {
  width: 14px;
  height: 14px;
}

.panel-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ctrl-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.ctrl-btn-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.ctrl-btn {
  background: rgba(14, 28, 54, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.ctrl-btn:hover {
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.15);
  color: var(--cyan);
}

.ctrl-btn.active {
  background: var(--cyan);
  color: var(--bg-dark);
  border-color: var(--cyan);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* ==========================================================================
   SCROLL CONTAINER & STORY SECTIONS (RESPONSIVE FLUID LAYOUT)
   ========================================================================== */

.scroll-container {
  position: relative;
  z-index: 5;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.story-section {
  min-height: 100vh;
  width: 100%;
  max-width: 1300px;
  padding: calc(var(--hud-height) + 2rem) clamp(1rem, 4vw, 2.5rem) 4rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none;
}

.story-section.full-sandbox-section {
  justify-content: center;
  align-items: flex-start;
  min-height: 120vh;
}

/* Glass Cards */
.glass-card {
  pointer-events: auto;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3.5vw, 2.25rem);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  width: 100%;
  max-width: 540px;
  position: relative;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: var(--border-cyan-glow);
  box-shadow: 0 25px 80px rgba(0, 240, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 1.5vw, 0.7rem);
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.35rem 0.75rem;
  border-radius: 30px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  margin-bottom: 1rem;
}

.card-badge svg {
  width: 14px;
  height: 14px;
}

.hero-card {
  max-width: 640px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--cyan) 0%, #a855f7 50%, var(--magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.hero-desc {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.cta-primary {
  background: linear-gradient(135deg, var(--cyan) 0%, #00b4d8 100%);
  color: var(--bg-dark);
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 1px;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.5);
  transition: all 0.25s ease;
  white-space: nowrap;
}

.cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.8);
}

.cta-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  font-weight: 700;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.cta-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--cyan);
  color: var(--cyan);
}

.scroll-indicator {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.scroll-mouse {
  width: 16px;
  height: 24px;
  border: 2px solid var(--text-dim);
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
}

.scroll-mouse .wheel {
  width: 3px;
  height: 5px;
  background: var(--cyan);
  border-radius: 2px;
  position: absolute;
  top: 3px;
  left: 4.5px;
  animation: mouseScroll 1.5s infinite;
}

@keyframes mouseScroll {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(8px); opacity: 0; }
}

/* Narrative Cards */
.card-title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 800;
  margin-bottom: 0.85rem;
  color: var(--text-main);
}

.card-text {
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.card-text strong {
  color: var(--cyan);
}

/* Code Snippets */
.code-terminal-snippet {
  background: rgba(4, 8, 20, 0.9);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.6vw, 0.82rem);
  position: relative;
  overflow-x: auto;
  max-width: 100%;
}

.snippet-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.35rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.snippet-lang {
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--text-dim);
}

/* Syntax Highlighting */
.kw { color: #00f0ff; font-weight: 700; }
.tbl { color: #ffd166; font-weight: 600; }
.col { color: #f0f6fc; }
.type { color: #9d4edd; }
.num { color: #ff007f; }
.func { color: #06d6a0; font-weight: 700; }

.interactive-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 1.5vw, 0.75rem);
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.08);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(0, 240, 255, 0.4);
}

.interactive-hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Feature Pills */
.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill {
  background: rgba(14, 28, 54, 0.9);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: clamp(0.65rem, 1.5vw, 0.75rem);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.pill.active {
  background: var(--cyan);
  color: var(--bg-dark);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}

/* Interactive Slider Box */
.interactive-slider-box {
  background: rgba(4, 8, 20, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.slider-val {
  color: var(--cyan);
  font-weight: 700;
}

.cyber-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

.cyber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 15px var(--cyan);
  cursor: pointer;
}

/* Join Buttons */
.join-mode-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.15rem;
}

.join-btn {
  background: rgba(14, 28, 54, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.join-btn:hover {
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
}

.join-btn.active {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(157, 78, 221, 0.2));
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.join-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.join-sub {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Aggregate Toggles */
.aggregate-toggles {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.agg-btn {
  flex: 1;
  min-width: 100px;
  background: rgba(14, 28, 54, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.agg-btn svg {
  width: 14px;
  height: 14px;
}

.agg-btn:hover {
  border-color: var(--emerald);
  color: var(--emerald);
}

.agg-btn.active {
  background: var(--emerald);
  color: var(--bg-dark);
  border-color: var(--emerald);
  font-weight: 700;
  box-shadow: 0 0 15px rgba(6, 214, 160, 0.5);
}

/* B-Tree Race */
.race-controls {
  margin-bottom: 1.15rem;
}

.cta-pulse {
  width: 100%;
  background: linear-gradient(135deg, #ffd166 0%, #ff007f 100%);
  color: #040814;
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  font-weight: 800;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 0 25px rgba(255, 209, 102, 0.4);
  transition: all 0.25s ease;
}

.cta-pulse:hover {
  transform: scale(1.01);
  box-shadow: 0 0 35px rgba(255, 209, 102, 0.7);
}

.race-scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.score-card {
  background: rgba(4, 8, 20, 0.85);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-card.slow { border-left: 3px solid #ff5f56; }
.score-card.fast { border-left: 3px solid var(--emerald); }

.score-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.score-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   SANDBOX & LIVE SQL CONSOLE SECTION (RESPONSIVE GRID)
   ========================================================================== */

.sandbox-wrapper {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  width: 100%;
  max-width: 1200px;
}

.sandbox-console-card {
  max-width: 100%;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.console-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 1.8vw, 0.85rem);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--cyan);
}

.preset-dropdown {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.cyber-select {
  background: rgba(14, 28, 54, 0.9);
  border: 1px solid var(--border-cyan);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  max-width: 190px;
}

.editor-area {
  margin-bottom: 0.85rem;
}

.sql-textarea {
  width: 100%;
  height: 110px;
  background: rgba(2, 4, 10, 0.95);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  color: #00f0ff;
  font-family: var(--font-mono);
  font-size: clamp(0.78rem, 1.8vw, 0.88rem);
  line-height: 1.5;
  resize: vertical;
  outline: none;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

.sql-textarea:focus {
  border-color: var(--cyan);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 240, 255, 0.3);
}

.console-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.cta-execute {
  background: linear-gradient(135deg, var(--cyan) 0%, #00b4d8 100%);
  color: var(--bg-dark);
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 1.8vw, 0.82rem);
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cta-execute:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.8);
}

.hud-mini-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.hud-mini-btn:hover {
  color: var(--text-main);
  border-color: var(--cyan);
}

.exec-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

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

/* Query Result Box & Table */
.query-result-box {
  background: rgba(2, 4, 10, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  max-height: 220px;
  overflow: auto;
}

.cyber-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  min-width: 320px;
}

.cyber-table th {
  background: rgba(0, 240, 255, 0.1);
  color: var(--cyan);
  padding: 0.45rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
  white-space: nowrap;
}

.cyber-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  white-space: nowrap;
}

.cyber-table tr:hover td {
  background: rgba(0, 240, 255, 0.05);
}

/* Quest Card */
.quest-card {
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.quest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.quest-score {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.quest-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 800;
  margin-bottom: 0.65rem;
  color: var(--text-main);
}

.quest-desc {
  font-size: clamp(0.85rem, 1.8vw, 0.92rem);
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.quest-hint {
  background: rgba(255, 209, 102, 0.08);
  border: 1px dashed rgba(255, 209, 102, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.quest-hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.quest-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================================================
   FOOTER & TOAST & BANNER
   ========================================================================= */

.hud-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 32px;
  background: rgba(4, 8, 20, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 240, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(0.75rem, 3vw, 2rem);
  z-index: 90;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fps-counter {
  color: var(--emerald);
}

.status-tag {
  color: var(--cyan);
}

.cyber-toast {
  position: fixed;
  bottom: 45px;
  right: clamp(1rem, 3vw, 2rem);
  background: rgba(8, 16, 32, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--cyan);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 240, 255, 0.3);
  z-index: 200;
  transform: translateY(0);
  opacity: 1;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
}

.cyber-toast.hidden {
  transform: translateY(30px);
  opacity: 0;
  pointer-events: none;
}

.toast-icon {
  color: var(--cyan);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.toast-msg {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.audio-banner {
  position: fixed;
  top: var(--hud-height);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(157, 78, 221, 0.95);
  color: #fff;
  padding: 0.4rem 1.2rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  box-shadow: 0 4px 20px rgba(157, 78, 221, 0.5);
  white-space: nowrap;
}

.audio-banner.hidden {
  display: none;
}

/* Utilities */
.text-cyan { color: var(--cyan); }
.text-gold { color: var(--gold); }
.mono { font-family: var(--font-mono); }

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (MOBILE, TABLET, DESKTOP)
   ========================================================================== */

/* Large Laptops / Desktops */
@media (min-width: 1201px) {
  .story-section {
    padding-left: 270px; /* Offset clean space for the left telemetry sidebar */
  }
}

/* Medium Screens under 1200px */
@media (max-width: 1200px) {
  .hud-telemetry {
    display: none;
  }
  .hud-interaction-panel {
    top: auto;
    bottom: 45px;
    right: 1rem;
    width: 240px;
  }
  .sandbox-wrapper {
    grid-template-columns: 1fr;
  }
}

/* Tablet & Mobile Screens under 960px */
@media (max-width: 960px) {
  .hud-nav {
    display: none; /* Hide horizontal nav on tablet/mobile in favor of drawer */
  }
  .mobile-menu-btn {
    display: flex;
  }
  .hud-interaction-panel {
    display: none;
  }
  .story-section {
    justify-content: center;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .glass-card {
    max-width: 100%;
  }
}

/* Mobile Screens under 600px */
@media (max-width: 600px) {
  :root {
    --hud-height: 56px;
  }

  .hud-header {
    padding: 0 0.75rem;
  }

  .brand-subtitle {
    display: none;
  }

  .btn-label {
    display: none; /* Icons only on small mobile viewports */
  }

  .hud-btn {
    padding: 0.45rem 0.55rem;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
  }

  .cta-primary, .cta-secondary {
    width: 100%;
    justify-content: center;
  }

  .console-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .exec-stats {
    margin-left: 0;
    justify-content: center;
  }

  .join-mode-selector {
    grid-template-columns: 1fr;
  }

  .footer-left {
    display: none;
  }
  
  .hud-footer {
    justify-content: center;
  }
}
