/* ═══════════════════════════════════════════════════════
   CardioSurv — Global Stylesheet
   Aesthetic: Apple-Inspired / Aurora Flow (Adaptive Dark/Light). 
   Soft, asymmetric, breathable, and typographically driven.
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;1,9..144,400&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&display=swap');

:root {
  /* Default Dark Mode */
  --bg:          #0a1047; /* Deep forest green — replaces near-black */
  --surface:     rgba(30, 32, 42, 0.6);
  --surface2:    rgba(45, 48, 62, 0.6);
  --surface3:    #3f4354;
  
  --border:      rgba(255, 255, 255, 0.08);
  --border2:     rgba(255, 255, 255, 0.12);
  
  --text:        #f8fafc;
  --muted:       #94a3b8;
  --muted2:      #64748b;
  
  --accent:      #f472b6;
  --accent2:     #db2777;
  --accent-dim:  rgba(244, 114, 182, 0.15);

  --aurora-1:    #2dd4bf;
  --aurora-2:    #818cf8;
  --aurora-3:    #e879f9;
  
  /* Risk Colors */
  --risk-low:    #2dd4bf; 
  --risk-med:    #fbbf24; 
  --risk-high:   #f472b6;

  /* ── Risk color fill backgrounds ── */
  --risk-low-bg:  rgba(45, 212, 191, 0.10);
  --risk-med-bg:  rgba(251, 191, 36, 0.10);
  --risk-high-bg: rgba(244, 114, 182, 0.12);
  --green:        #2dd4bf;
  --green-bg:     rgba(45, 212, 191, 0.10);
  --danger:       #f87171;

  /* ── Font stacks ── */
  --font:        "Inter", system-ui, sans-serif;
  --serif:       "Fraunces", "Newsreader", serif;

  --r-sm:        12px;
  --r-md:        24px;
  --r-lg:        40px;
  --r-pill:      999px;
  --r:           12px;
  --topbar-h:    80px;
  
  --shadow-soft: 0 24px 48px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.1);

  --model-color: 0.8, 0.8, 0.85;
}

/* Light Theme */
body.light {
  --bg:          #7fbef5; 
  --surface:     rgba(255, 255, 255, 0.7);
  --surface2:    rgba(241, 245, 249, 0.7);
  --surface3:    #e2e8f0;
  
  --border:      rgba(15, 23, 42, 0.06);
  --border2:     rgba(15, 23, 42, 0.12);
  
  --text:        #090e18;
  --muted:       #1e4c7a;
  --muted2:      #1e4482;
  
  --accent:      #db2777;
  --accent2:     #be185d;
  --accent-dim:  rgba(219, 39, 119, 0.12);

  --aurora-1:    #99f6e4;
  --aurora-2:    #c7d2fe;
  --aurora-3:    #fbcfe8;
  
  --risk-low-bg:  rgba(45, 212, 191, 0.12);
  --risk-med-bg:  rgba(251, 191, 36, 0.12);
  --risk-high-bg: rgba(219, 39, 119, 0.10);
  --risk-low:  #09978b;
  --risk-med:  #d97706;
  --risk-high: #db2777;
  --green:        #0d9488;
  --green-bg:     rgba(45, 212, 191, 0.12);
  --danger:       #e11d48;
  
  --shadow-soft: 0 24px 48px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.03);

  --model-color: 0.65, 0.7, 0.8;


}

/* ── RESET & BASE ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-size: 16px; }

body {
  font-family: var(--font);
  font-feature-settings: "tnum" on, "lnum" on, "cv02" on;
  letter-spacing: -0.01em;  
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.6s ease, color 0.6s ease;
}

/* ── SCROLLBAR ──────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── AURORA DYNAMIC BACKGROUND ──────────────────────── */
.aurora-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
  pointer-events: none;
  transition: background-color 0.6s ease;
}

.aurora-blob {
  position: absolute;
  filter: blur(100px);
  opacity: 0.65;
  border-radius: 50%;
  animation: auroraFlow 12s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  transition: background-color 0.8s ease;
}
body.light .aurora-blob { opacity: 0.7; filter: blur(120px); }

.aurora-blob-1 {
  top: -10%; left: -10%; 
  width: 55vw; height: 55vh;
  background: var(--aurora-1);
  animation-duration: 9s;
}
.aurora-blob-2 {
  bottom: -20%; right: -10%; 
  width: 65vw; height: 65vh;
  background: var(--aurora-2);
  animation-duration: 10s;
  animation-direction: alternate-reverse;
}
.aurora-blob-3 {
  top: 30%; left: 20%; 
  width: 45vw; height: 45vh;
  background: var(--aurora-3);
  animation-duration: 11s;
  animation-delay: -3s;
}

@keyframes auroraFlow {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  33%  { transform: translate(10%, 15%) scale(1.15) rotate(8deg); }
  66%  { transform: translate(-8%, 10%) scale(0.9) rotate(-6deg); }
  100% { transform: translate(15%, -15%) scale(1.1) rotate(4deg); }
}

/* ── SPLASH SCREEN ──────────────────────────────────── */
#splash {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg); pointer-events: all;
  transition: background-color 0.6s ease;
}
#splash.hide {
  animation: splashFadeOut 0.9s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes splashFadeOut {
  0%   { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 0; transform: scale(1.02); filter: blur(4px); pointer-events: none; }
}

.splash-rings, .splash-icon-bg { display: none; }

.splash-logo-wrap { display:flex; flex-direction:column; align-items:center; gap:24px; }
.splash-text-group { text-align:center; opacity:0; transform:translateY(8px); animation:fadeInUp 0.8s 0.2s ease forwards; }
.splash-title { font-family: var(--serif); font-size: 3.5rem; font-weight: 500; color: var(--text); margin-bottom: 8px; letter-spacing: -0.02em; }
.splash-subtitle { font-size: 0.85rem; letter-spacing: 0.05em; color: var(--muted); font-weight: 400; }

.splash-loader { margin-top: 40px; display:flex; flex-direction:column; align-items:center; gap:16px; opacity:0; animation:fadeInUp 0.8s 0.4s ease forwards; }
.splash-progress-track { width: 180px; height: 3px; background: var(--surface2); border-radius: var(--r-pill); overflow: hidden; }
.splash-progress-bar { height: 100%; width: 0%; background: var(--aurora-1); border-radius: var(--r-pill); animation: progressOrganic 1.6s 0.6s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
.splash-loading-text { font-size: 0.75rem; color: var(--muted); font-weight: 500; }

@keyframes fadeInUp { to { opacity:1; transform:translateY(0); } }
@keyframes progressOrganic { 0%{width:0%;} 40%{width:50%;} 80%{width:85%;} 100%{width:100%;} }

/* ── PAGE WRAPPER ───────────────────────────────────── */
.page-wrap {
  position: relative; z-index: 1; width: 100%; display: flex; flex-direction: column;
  opacity: 0; transition: opacity 1s ease;
}
.page-wrap.visible { opacity: 1; }

/* ── NAV BAR ────────────────────────────────────────── */
.topbar {
  position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 100;
  height: 60px; width: calc(100% - 3rem); max-width: 1036px;
  background: var(--surface); 
  backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem 0 1.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transition: background 0.6s ease, border-color 0.6s ease;
}
body.light .topbar { box-shadow: 0 8px 32px rgba(15, 23, 42, 0.05); }

/* ── Sub-page topbar logo (predict / history / results) ── */
.logo-wrap { display: flex; align-items: center; gap: 12px; }
.logo-mark { display: none; } /* Hidden — logo mark not used */
.logo-text-group { display: flex; flex-direction: row; align-items: baseline; gap: 12px; }
.page-title { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; color: var(--text); }
.page-sub { font-size: 0.75rem; color: var(--muted); font-weight: 500; letter-spacing: 0.02em; }

/* Sub-page topbar logo (predict / history / results) */
.topbar-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.topbar-logo-icon { display: flex; align-items: center; flex-shrink: 0; }
.topbar-logo-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; color: var(--text); }

.topbar-nav { display:flex; align-items:center; gap: 8px; position: absolute; left: 50%; transform: translateX(-50%); }
.topbar-nav a {
  padding: 8px 16px; border-radius: var(--r-pill); text-decoration: none;
  font-size: 0.85rem; font-weight: 500; color: var(--muted); transition: all 0.3s ease;
  display: flex; align-items: center; gap: 6px;
}
.topbar-nav a:hover { color: var(--text); background: var(--surface2); }
.topbar-nav a.active { color: var(--text); background: var(--surface2); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.topbar-nav a svg { width: 14px; height: 14px; opacity: 0.7; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ── THEME TOGGLE ───────────────────────────────────── */
.theme-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.3s ease;
}
.theme-btn:hover { background: var(--surface3); transform: scale(1.05); }
.theme-btn svg { width: 16px; height: 16px; pointer-events: none; stroke-width: 1.5; }

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
  padding: 14px 28px; border: none; font-family: var(--font); font-size: 0.95rem; font-weight: 500;
  cursor: pointer; transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none;
}
.btn-primary {
  background: var(--text); color: var(--bg);
  border-radius: var(--r-pill);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); opacity: 0.9; }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-sm) var(--r-md) var(--r-sm) var(--r-md);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.btn-secondary:hover { background: var(--surface2); transform: translateY(-2px); }
.btn-primary svg, .btn-secondary svg { width: 16px; height: 16px; }
.btn-full { width: 100%; }

/* ── INNER PAGE LAYOUT ──────────────────────────────── */
.inner-page {
  padding-top: 100px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 4rem;
}

/* ── Combined .container definition (single source of truth) ── */
.container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 2rem;
}

.container-lg { max-width: 1100px; margin: 0 auto; padding: 0 2rem 4rem; width: 100%; }

/* ── CARD ───────────────────────────────────────────── */
.card, .hero-context-card, .workflow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.15), 
    var(--shadow-soft);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  padding: 2.5rem;
  position: relative; overflow: hidden;
  transition: background-color 0.6s ease, border-color 0.6s ease;
}

.card { 
  border-radius: var(--r-lg) var(--r-sm) var(--r-lg) var(--r-lg);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.2), 
    0 32px 64px rgba(0, 0, 0, 0.2);
}
.hero-context-card {
  border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg);
}

/* ── 3D MODEL ───────────────────────────────────────── */
.gltf-model-container {
  width: 100%;
  max-width: 420px;
  height: 360px;
  margin: 0 auto 3.5rem;
  display: block;
  position: relative;
  z-index: 2;
}
model-viewer:focus-visible { outline: none; }

/* ── SECTION HEADER ─────────────────────────────────── */
/* Section title and subtitle shared across pages */
.section-header { margin-bottom: 1.5rem; }
.section-title { font-family: var(--serif); font-size: 2rem; font-weight: 400; color: var(--text); letter-spacing: -0.02em; line-height: 1.2; }
.section-sub { font-size: 0.9rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.5; }

/* ── TABLE ──────────────────────────────────────────── */
/* History page table styles */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted2); border-bottom: 1px solid var(--border2); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

/* ── PAGINATION ─────────────────────────────────────── */
/* History page pagination controls */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 1.25rem; justify-content: center; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px; background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--r-sm); color: var(--text); font-size: 13px;
  cursor: pointer; transition: all 0.2s; font-family: var(--font);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover:not(:disabled) { background: var(--surface2); border-color: var(--border2); }
.page-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--muted2); padding: 0 4px; }

/* ── MODAL ──────────────────────────────────────────── */
/* Patient detail modal overlay and dialog */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--r-lg); width: 100%; max-width: 560px;
  max-height: 85vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 32px 64px rgba(0,0,0,0.3);
  animation: modalIn 0.25s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { font-size: 1.1rem; font-weight: 600; color: var(--text); font-family: var(--serif); }
.modal-body { padding: 1.25rem 1.5rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-close {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px; border-radius: 6px; display: flex; transition: all 0.2s; flex-shrink: 0;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-close svg { width: 18px; height: 18px; }

/* ── PROGRESS BAR ───────────────────────────────────── */
/* Confidence bar on results page */
.progress-track { height: 6px; background: var(--surface2); border-radius: var(--r-pill); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--r-pill); transition: width 0.8s cubic-bezier(0.25, 1, 0.5, 1); }

/* ── MSG / ALERT ────────────────────────────────────── */
.msg { padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; line-height: 1.4; }
.msg.err {
  background: var(--risk-high-bg);
  color: var(--accent);
  border: 1px solid rgba(244, 114, 182, 0.3);
}

/* ── EMPTY STATE ────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; margin-bottom: 1rem; opacity: 0.4; display: block; margin-left: auto; margin-right: auto; }
.empty-state h3 { font-size: 1.1rem; font-weight: 500; color: var(--text); margin-bottom: 0.5rem; font-family: var(--serif); }
.empty-state p { font-size: 0.9rem; line-height: 1.5; }

/* ── PREDICT PAGE SPECIFIC ──────────────────────────── */
.predict-page-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent2);
  margin: 1.75rem 0 1rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border2);
}
.form-section-title svg { width: 14px; height: 14px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* FIX: field wrapper includes error message slot */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Error state — red border + glow on invalid fields */
.field.has-error input,
.field.has-error select {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field-error-msg {
  font-size: 11px;
  color: var(--accent);
  margin-top: 2px;
  display: none;
}

.form-card {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--r-lg); padding: 1.75rem;
  position: relative; overflow: hidden;
  box-shadow: 0 0 0 1px var(--border), 0 24px 48px rgba(0,0,0,0.3);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.form-card::before {
  content:''; position:absolute; top:0;left:0;right:0; height:1px;
  background:linear-gradient(90deg,transparent,rgba(224,92,122,0.4),transparent);
}

.predict-page-container input, 
.predict-page-container select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: all 0.2s;
  appearance: auto;
}
.predict-page-container input:focus, 
.predict-page-container select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.step-indicator {
  display: flex; align-items: center; gap: 0; margin-bottom: 1.75rem;
}
.step { display:flex;align-items:center;gap:8px;font-size:12px;font-weight:500; }
.step-num {
  width:24px;height:24px;border-radius:50%;border:1.5px solid var(--border2);
  background:var(--surface2);color:var(--muted2);
  display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;
}
.step.active .step-num { border-color:var(--accent);background:var(--accent-dim);color:var(--accent2); }
.step.active .step-label { color:var(--text); }
.step-label { color:var(--muted2); }
.step-line { flex:1;height:1px;background:var(--border2);margin:0 8px; }

.arrhythmia-row {
  background:var(--surface2);border:1px solid var(--border2);border-radius:var(--r);
  padding:14px 16px;display:flex;align-items:center;gap:12px;cursor:pointer;transition:all 0.2s;
  margin-bottom:14px;
}
.arrhythmia-row:hover { border-color:var(--accent);background:var(--accent-dim); }
.arrhythmia-row input[type=checkbox] { width:18px;height:18px;accent-color:var(--accent);flex-shrink:0;cursor:pointer; }
.arrhythmia-row .ar-text { flex:1; }
.arrhythmia-row .ar-title { font-size:13px;font-weight:600;color:var(--text); }
.arrhythmia-row .ar-sub { font-size:11px;color:var(--muted2);margin-top:2px; }

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.radio-option input[type="radio"] {
  width: 16px !important;
  height: 16px !important;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.radio-option label {
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.submit-area { margin-top:1.5rem;border-top:1px solid var(--border2);padding-top:1.5rem; }
#form-error { display:none;margin-bottom:1rem; }

#submit-btn {
  width: 100%;
  height: 48px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  transition: all 0.2s;
}
#submit-btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
#submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
#submit-btn.loading { opacity: 0.7; }

/* Loading spinner inside button */
.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BACKGROUND CANVAS (sub-pages) ─────────────────── */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 0;
  pointer-events: none;
}
.bg-glow { display: none; }

#bg-canvas, .aurora-bg {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important; height: 100vh !important;
  pointer-events: none !important;
}
#bg-canvas { z-index: 0 !important; }
.aurora-bg { z-index: 0 !important; }

/* All sub-page content must sit above the canvas */
.inner-page, nav.topbar, header.topbar {
  position: relative;
  z-index: 1;
}

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { width: calc(100% - 1.5rem); padding: 0 1rem; top: 0.75rem; }
  .topbar-nav { display: none; }
  .inner-page { padding-top: calc(var(--topbar-h) + 2rem); }
  .gltf-model-container { height: 280px; margin-bottom: 2rem; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .container { padding: 1rem; }
  .container-lg { padding: 0 1rem 3rem; }
}

@media (max-width: 480px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; }
}