/* BIO-SYNC — Dark Psychedelic UI */
:root {
  --bg: #030008;
  --glass: rgba(10, 0, 30, 0.55);
  --glass-border: rgba(180, 80, 255, 0.25);
  --neon-purple: #bf5fff;
  --neon-cyan: #00ffee;
  --neon-pink: #ff00aa;
  --neon-gold: #ffd700;
  --neon-green: #39ff14;
  --text: #e8d5ff;
  --text-muted: rgba(200, 180, 255, 0.55);
  --danger: #ff3366;
  --radius: 14px;
  --blur: blur(22px);
}

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ── CANVAS ─────────────────────────────────────────────── */
#psychCanvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
}

/* ── APP SHELL ──────────────────────────────────────────── */
#app {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  pointer-events: none;
}
#app > * { pointer-events: auto; }

/* ── HEADER ─────────────────────────────────────────────── */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: rgba(3,0,12,0.7);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
}
.logo {
  display: flex; align-items: center; gap: 8px;
}
.logo span {
  font-size: 22px; font-weight: 900; letter-spacing: 6px;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logoShift 6s linear infinite;
}
.header-logo-img {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.donate-link {
  color: #ff6080 !important; border-color: rgba(255,96,128,0.35) !important;
  text-decoration: none; display: flex; align-items: center; justify-content: center;
}
.donate-link:hover { color: #ff3366 !important; border-color: rgba(255,51,102,0.6) !important; background: rgba(255,0,80,0.12) !important; }
@keyframes logoShift {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
.header-center {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.phase-label {
  font-size: 11px; letter-spacing: 3px; color: var(--text-muted);
  text-transform: uppercase;
}
#phaseNameDisplay {
  font-size: 16px; font-weight: 700; letter-spacing: 2px;
  color: var(--neon-cyan);
  text-shadow: 0 0 16px var(--neon-cyan);
  transition: color 1s, text-shadow 1s;
}
#eegDisplay {
  font-size: 11px; letter-spacing: 2px; color: var(--neon-purple);
  text-shadow: 0 0 10px var(--neon-purple);
}
.header-right { display: flex; align-items: center; gap: 16px; }
#timerDisplay {
  font-size: 28px; font-weight: 900; letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px var(--neon-cyan), 0 0 40px rgba(0,255,238,0.4);
}
#totalTimerDisplay {
  font-size: 11px; color: var(--text-muted); letter-spacing: 2px;
}

/* ── MAIN LAYOUT ────────────────────────────────────────── */
main {
  flex: 1; display: flex; overflow: hidden; position: relative;
}

/* ── SIDEBAR ────────────────────────────────────────────── */
#sidebar {
  width: 320px; min-width: 320px;
  display: flex; flex-direction: column;
  background: var(--glass);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  transition: margin-left 0.35s ease, opacity 0.35s;
  overflow: hidden;
}
#sidebar.collapsed { margin-left: -320px; opacity: 0; pointer-events: none; }

.tab-bar {
  display: flex; border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.tab-btn {
  flex: 1; padding: 10px 4px; background: none; border: none;
  color: var(--text-muted); font-size: 11px; letter-spacing: 1px;
  cursor: pointer; transition: color 0.2s, border-bottom 0.2s;
  border-bottom: 2px solid transparent;
  text-transform: uppercase;
}
.tab-btn.active { color: var(--neon-cyan); border-bottom-color: var(--neon-cyan); }
.tab-btn:hover:not(.active) { color: var(--text); }

.tab-content { display: none; flex-direction: column; flex: 1; overflow-y: auto; padding: 16px; gap: 14px; }
.tab-content.active { display: flex; }

/* scrollbar */
.tab-content::-webkit-scrollbar { width: 4px; }
.tab-content::-webkit-scrollbar-track { background: transparent; }
.tab-content::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 2px; }

.section-title {
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--neon-purple); margin-bottom: 4px;
  text-shadow: 0 0 10px var(--neon-purple);
}
.section-hint {
  font-size: 11px; color: var(--text-muted); line-height: 1.5;
}

/* Affirmations list */
.affirmation-item {
  display: flex; align-items: flex-start; gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border); border-radius: 8px;
  padding: 8px 10px;
}
.affirmation-item span { flex: 1; font-size: 13px; line-height: 1.4; }
.affirmation-item select {
  background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border);
  color: var(--text-muted); border-radius: 4px; font-size: 10px; padding: 2px 4px;
}
.btn-remove {
  background: none; border: none; color: var(--danger); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px;
  opacity: 0.6; transition: opacity 0.2s;
}
.btn-remove:hover { opacity: 1; }

.add-row { display: flex; gap: 8px; align-items: flex-end; }
.add-row textarea, .add-row input[type="text"] {
  flex: 1; background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 8px; padding: 8px 10px;
  resize: none; font-size: 13px; font-family: inherit;
  min-height: 60px;
}
.add-row input[type="text"] { min-height: unset; height: 36px; }
.add-row textarea:focus, .add-row input:focus {
  outline: none; border-color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(191,95,255,0.3);
}

.interval-row { display: flex; align-items: center; gap: 10px; }
.interval-row label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.interval-row select {
  background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 6px; padding: 4px 8px; font-size: 12px;
}

/* Goals */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 11px; color: var(--neon-purple); letter-spacing: 1px; text-transform: uppercase; }
.field-group textarea, .field-group input {
  background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 8px; padding: 8px 10px;
  resize: none; font-size: 13px; font-family: inherit; min-height: 60px;
}
.field-group textarea:focus, .field-group input:focus {
  outline: none; border-color: var(--neon-gold);
  box-shadow: 0 0 12px rgba(255,215,0,0.25);
}
.field-group input { min-height: unset; }

/* NLP */
.nlp-section { display: flex; flex-direction: column; gap: 8px; }
.anchor-row { display: flex; align-items: center; gap: 10px; }
.anchor-color-picker {
  width: 36px; height: 36px; border: 2px solid var(--glass-border);
  border-radius: 50%; padding: 2px; cursor: pointer;
  background: none;
}
.anchor-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.anchor-color-picker::-webkit-color-swatch { border: none; border-radius: 50%; }
.beliefs-list { display: flex; flex-direction: column; gap: 6px; }
.belief-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; line-height: 1.4;
  background: rgba(255,255,255,0.04); border-radius: 6px;
  border: 1px solid var(--glass-border); padding: 6px 8px;
}
.belief-item span { flex: 1; }
.swish-pair { display: flex; flex-direction: column; gap: 8px; }
.swish-pair textarea {
  background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 8px; padding: 8px 10px;
  resize: none; font-size: 12px; font-family: inherit; min-height: 52px;
}
.swish-pair textarea:focus {
  outline: none; border-color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(255,0,170,0.25);
}
.swish-arrow {
  text-align: center; color: var(--neon-pink); font-size: 18px;
  text-shadow: 0 0 10px var(--neon-pink);
}

/* Metrics */
.metric-row { display: flex; flex-direction: column; gap: 4px; }
.metric-row label { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; }
.metric-slider { width: 100%; accent-color: var(--neon-cyan); }
.metric-val { font-size: 18px; font-weight: 700; color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan); }
.metric-input {
  background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; font-family: inherit; width: 100%;
}
.metric-input:focus { outline: none; border-color: var(--neon-cyan); }
.radio-row { display: flex; gap: 16px; }
.radio-row label { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
.sessions-history { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.session-card {
  background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 10px;
  font-size: 12px; line-height: 1.6;
}
.session-card strong { color: var(--neon-cyan); }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  padding: 8px 18px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  transition: all 0.2s;
}
.btn-save {
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
  color: #000;
}
.btn-save:hover { filter: brightness(1.2); transform: translateY(-1px); }
.btn-add {
  background: rgba(191,95,255,0.15); border: 1px solid var(--neon-purple);
  color: var(--neon-purple); border-radius: 8px; padding: 6px 14px;
  cursor: pointer; font-size: 12px; font-weight: 700;
  transition: all 0.2s; white-space: nowrap;
}
.btn-add:hover { background: rgba(191,95,255,0.3); }
.btn-submit-metrics {
  background: linear-gradient(135deg, var(--neon-gold), #ff8c00);
  color: #000; font-weight: 900;
  padding: 10px; border: none; border-radius: 10px; cursor: pointer;
  font-size: 13px; letter-spacing: 2px;
  transition: all 0.2s; width: 100%;
}
.btn-submit-metrics:hover { filter: brightness(1.15); transform: translateY(-1px); }

/* ── CENTER STAGE ───────────────────────────────────────── */
.center-stage {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 16px 20px;
  pointer-events: none;
}
.center-stage > * { pointer-events: auto; }

/* Phase progress bar */
.phase-progress {
  display: flex; gap: 8px; align-items: center;
  width: 100%; max-width: 500px;
}
.phase-pip {
  flex: 1; height: 4px; background: rgba(255,255,255,0.1);
  border-radius: 2px; position: relative; overflow: hidden;
  cursor: pointer; transition: height 0.2s;
}
.phase-pip:hover { height: 8px; }
.phase-pip-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan));
  transition: width 0.5s linear;
  box-shadow: 0 0 8px var(--neon-cyan);
}
.phase-pip.active { height: 8px; }
.phase-pip.active .phase-pip-fill { animation: pipGlow 1s ease-in-out infinite alternate; }
@keyframes pipGlow {
  from { box-shadow: 0 0 6px var(--neon-cyan); }
  to   { box-shadow: 0 0 20px var(--neon-cyan), 0 0 40px rgba(0,255,238,0.5); }
}

/* Visualizer center */
.visualizer-center {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative; width: 100%;
  pointer-events: none;
}

/* Beat Hz readout */
.beat-display {
  position: absolute; bottom: 10px; right: 20px;
  display: flex; align-items: baseline; gap: 5px;
  background: rgba(0,0,0,0.5); border-radius: 20px;
  padding: 4px 14px; border: 1px solid var(--glass-border);
}
#beatHzDisplay {
  font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums;
  color: var(--neon-purple);
  text-shadow: 0 0 16px var(--neon-purple);
  transition: color 1s, text-shadow 1s;
}
.beat-label { font-size: 11px; color: var(--text-muted); letter-spacing: 2px; }

/* Affirmation overlay */
#affirmationDisplay {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-width: 70%; text-align: center;
  pointer-events: none; z-index: 20;
  transition: opacity 1s;
  opacity: 0;
}
#affirmationDisplay.visible { opacity: 1; }
#affirmationText {
  font-size: clamp(18px, 3vw, 32px);
  font-weight: 700; letter-spacing: 2px; line-height: 1.4;
  color: #fff;
  text-shadow:
    0 0 20px var(--neon-cyan),
    0 0 40px var(--neon-purple),
    0 0 80px rgba(191,95,255,0.5);
  animation: rainbowText 3s linear infinite;
}
@keyframes rainbowText {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* Breathing guide */
#breathingGuide {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  pointer-events: none;
}
#breathCircle {
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,255,238,0.3), transparent 70%);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 30px var(--neon-cyan), 0 0 60px rgba(0,255,238,0.3);
  transition: transform 0.1s linear, box-shadow 0.1s linear;
}
#breathText {
  font-size: 16px; letter-spacing: 6px; font-weight: 700;
  color: var(--neon-cyan); text-shadow: 0 0 16px var(--neon-cyan);
  text-transform: uppercase;
}

/* Intention display (Phase 4) */
#intentionDisplay {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  max-width: 65%; text-align: center;
  pointer-events: none; opacity: 0;
  transition: opacity 1.5s;
}
#intentionDisplay.visible { opacity: 1; }
#intentionDisplay .intention-label {
  font-size: 10px; letter-spacing: 5px; color: var(--neon-gold);
  text-transform: uppercase; margin-bottom: 10px;
  text-shadow: 0 0 10px var(--neon-gold);
}
#intentionDisplay .intention-text {
  font-size: clamp(20px, 3.5vw, 38px); font-weight: 900;
  color: var(--neon-gold);
  text-shadow: 0 0 30px var(--neon-gold), 0 0 60px rgba(255,215,0,0.4);
  line-height: 1.3; letter-spacing: 1px;
}

/* ── CONTROLS BAR ───────────────────────────────────────── */
#controlsBar {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 12px 20px;
  background: rgba(3,0,12,0.75);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  flex-shrink: 0;
}
.ctrl-btn {
  padding: 10px 28px; border: none; border-radius: 24px; cursor: pointer;
  font-size: 13px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase;
  transition: all 0.2s; position: relative; overflow: hidden;
}
#btnStart {
  background: linear-gradient(135deg, #7f00ff, #00c3ff);
  color: #fff;
  box-shadow: 0 0 20px rgba(127,0,255,0.5), 0 0 40px rgba(0,195,255,0.3);
}
#btnStart:hover { filter: brightness(1.2); transform: scale(1.04); }
#btnPause {
  background: linear-gradient(135deg, #ff8c00, #ffd700);
  color: #000;
  box-shadow: 0 0 20px rgba(255,140,0,0.5);
}
#btnPause:hover { filter: brightness(1.15); }
#btnStop {
  background: linear-gradient(135deg, #ff0050, #ff3366);
  color: #fff;
  box-shadow: 0 0 20px rgba(255,0,80,0.4);
}
#btnStop:hover { filter: brightness(1.15); }
#btnStop.ctrl-stop-idle {
  opacity: 0.25; pointer-events: none;
}
.volume-wrap {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border);
  border-radius: 20px; padding: 6px 14px;
}
.volume-wrap label { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; }
#volumeSlider { accent-color: var(--neon-purple); width: 90px; cursor: pointer; }
#volumeVal { font-size: 11px; color: var(--text-muted); min-width: 32px; }

/* Toggle sidebar button */
#toggleSidebar {
  position: absolute; left: 320px; top: 50%;
  transform: translateY(-50%);
  background: var(--glass); border: 1px solid var(--glass-border);
  color: var(--text-muted); border-radius: 0 8px 8px 0;
  padding: 10px 6px; cursor: pointer; z-index: 20;
  transition: left 0.35s ease, background 0.2s;
  backdrop-filter: var(--blur);
}
#toggleSidebar:hover { background: rgba(191,95,255,0.15); color: var(--neon-purple); }
#sidebar.collapsed ~ #toggleSidebar { left: 0; }

/* ── PULSE ANIMATION (pre-session) ─────────────────────── */
.idle-pulse {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.idle-pulse span {
  display: block; width: 120px; height: 120px; border-radius: 50%;
  border: 2px solid rgba(191,95,255,0.4);
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  animation: idleExpand 3s ease-out infinite;
}
.idle-pulse span:nth-child(2) { animation-delay: 1s; }
.idle-pulse span:nth-child(3) { animation-delay: 2s; }
@keyframes idleExpand {
  0%   { transform: translate(-50%,-50%) scale(0.5); opacity: 0.6; }
  100% { transform: translate(-50%,-50%) scale(3);   opacity: 0; }
}

/* ── NOTIFICATIONS ──────────────────────────────────────── */
#notification {
  position: fixed; bottom: 80px; right: 20px; z-index: 100;
  background: var(--glass); border: 1px solid var(--neon-cyan);
  border-radius: 10px; padding: 10px 16px;
  color: var(--neon-cyan); font-size: 13px; letter-spacing: 1px;
  backdrop-filter: var(--blur);
  box-shadow: 0 0 20px rgba(0,255,238,0.3);
  opacity: 0; transition: opacity 0.4s;
  pointer-events: none; max-width: 280px;
}
#notification.show { opacity: 1; }

/* ── METRICS FORM ───────────────────────────────────────── */
#metricsFormWrap {
  background: rgba(255,215,0,0.06); border: 1px solid rgba(255,215,0,0.25);
  border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.divider {
  height: 1px; background: var(--glass-border); margin: 4px 0;
}

/* ── TTS CONTROLS ───────────────────────────────────────── */
.tts-block {
  border-top: 1px solid var(--glass-border);
  padding-top: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.tts-header {
  display: flex; align-items: center; justify-content: space-between;
}
.tts-toggle { position: relative; display: inline-block; width: 42px; height: 22px; }
.tts-toggle input { opacity: 0; width: 0; height: 0; }
.tts-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(255,255,255,0.1); border-radius: 22px;
  border: 1px solid var(--glass-border); transition: background 0.3s;
}
.tts-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; bottom: 2px;
  background: var(--text-muted); border-radius: 50%;
  transition: transform 0.3s, background 0.3s;
}
.tts-toggle input:checked + .tts-slider { background: rgba(0,255,238,0.2); border-color: var(--neon-cyan); }
.tts-toggle input:checked + .tts-slider::before { transform: translateX(20px); background: var(--neon-cyan); }
.voice-selector { display: flex; gap: 8px; }
.voice-btn {
  flex: 1; padding: 7px 4px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.04); color: var(--text-muted);
  transition: all 0.2s;
}
.voice-btn.active {
  border-color: var(--neon-purple); color: var(--neon-purple);
  background: rgba(191,95,255,0.12);
  text-shadow: 0 0 8px var(--neon-purple);
}
.voice-btn:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.07); }
.btn-preview {
  width: 100%; padding: 8px; border: 1px solid var(--neon-cyan);
  border-radius: 8px; background: rgba(0,255,238,0.08);
  color: var(--neon-cyan); font-size: 11px; font-weight: 700;
  letter-spacing: 2px; cursor: pointer; transition: all 0.2s;
}
.btn-preview:hover { background: rgba(0,255,238,0.18); }
.btn-preview:disabled { opacity: 0.4; cursor: wait; }

/* ═══════════════════════════════════════════════════════════
 *  INTRO SCREEN — Classified document aesthetic
 * ═══════════════════════════════════════════════════════════ */
#introOverlay {
  position: fixed; inset: 0; z-index: 300;
  background: #000;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s;
}
#introOverlay.active { opacity: 1; pointer-events: auto; }

/* Progress bar */
.intro-progress-rail {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: rgba(255,255,255,0.08); z-index: 10;
}
#introProgress {
  height: 100%; width: 0; background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: width 0.1s linear;
}

/* Scrollable body */
.intro-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: #333 #000;
  padding-bottom: 40px;
}

/* ── HERO ── */
.intro-hero {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 40px 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, rgba(180,0,0,0.07) 0%, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent, transparent 2px,
      rgba(255,255,255,0.012) 2px, rgba(255,255,255,0.012) 4px
    );
  position: relative; overflow: hidden;
}

/* Scanline flicker */
.intro-scanline {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px, transparent 3px,
    rgba(0,0,0,0.18) 3px, rgba(0,0,0,0.18) 4px
  );
  animation: scanMove 8s linear infinite;
}
@keyframes scanMove {
  0%   { background-position: 0 0; }
  100% { background-position: 0 400px; }
}

/* Stamps */
.intro-stamp-wrap {
  display: flex; gap: 14px; align-items: center;
  flex-wrap: wrap; justify-content: center;
  margin-bottom: 28px;
}
.intro-stamp {
  display: inline-block; padding: 5px 18px;
  font-family: 'Courier New', monospace;
  font-size: 13px; font-weight: 900; letter-spacing: 6px;
  border: 2.5px solid; border-radius: 2px;
  transform: rotate(-3deg); opacity: 0.88;
}
.stamp-red   { color: #cc1100; border-color: #cc1100; box-shadow: 0 0 14px rgba(200,17,0,0.45); transform: rotate(-4deg); }
.stamp-green { color: #00cc66; border-color: #00cc66; box-shadow: 0 0 14px rgba(0,204,102,0.4); transform: rotate(2deg); }

.intro-agency {
  font-family: 'Courier New', monospace;
  font-size: 10px; letter-spacing: 5px; color: #555;
  margin-bottom: 18px; text-transform: uppercase;
}
.intro-headline {
  font-size: clamp(28px, 7vw, 64px);
  font-weight: 900; letter-spacing: 6px;
  color: #e0d0ff; margin: 0 0 14px;
  text-shadow: 0 0 40px rgba(180,80,255,0.4);
  min-height: 1.2em;
  font-family: 'Courier New', monospace;
}
.intro-cursor {
  color: var(--neon-cyan);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.intro-sub {
  font-size: 12px; color: #666; letter-spacing: 2px;
  line-height: 1.7; font-family: 'Courier New', monospace;
}
.intro-sub em { color: #444; font-style: normal; }

/* Scroll hint */
.intro-hero::after {
  content: '↓ DESPLAZA PARA CONTINUAR ↓';
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  font-size: 9px; letter-spacing: 5px; color: #333;
  font-family: 'Courier New', monospace;
  animation: pulseHint 2s ease-in-out infinite;
}
@keyframes pulseHint { 0%,100%{opacity:.3} 50%{opacity:.8} }

/* ── SECTIONS ── */
.intro-section {
  max-width: 680px; margin: 0 auto;
  padding: 56px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.intro-section-final { border-bottom: none; }

.intro-section-tag {
  font-family: 'Courier New', monospace;
  font-size: 9px; letter-spacing: 5px; color: #cc1100;
  border: 1px solid #330000; border-radius: 2px;
  display: inline-block; padding: 3px 10px;
  margin-bottom: 16px;
}
.intro-section-title {
  font-size: clamp(20px, 4vw, 28px); font-weight: 700;
  color: #c8b8e8; margin: 0 0 20px; letter-spacing: 1px;
}
.intro-text {
  font-size: 14px; line-height: 1.85; color: #8a7a9a;
  margin-bottom: 16px;
}
.intro-text strong { color: #c8b8e8; }
.intro-text em     { color: #7a6a8a; font-style: italic; }

/* CIA document block */
.intro-doc {
  border: 1px solid #440000; border-left: 3px solid #cc1100;
  background: rgba(180,0,0,0.04);
  border-radius: 4px; padding: 20px; margin: 24px 0;
  position: relative;
}
.intro-doc-header {
  font-family: 'Courier New', monospace;
  font-size: 9px; letter-spacing: 4px; color: #cc1100;
  margin-bottom: 14px;
}
.intro-quote {
  font-family: 'Courier New', monospace;
  font-size: 13px; color: #a09080; line-height: 1.9;
  border: none; margin: 0; padding: 0;
}
.intro-quote mark {
  background: rgba(200,17,0,0.25); color: #e8a090;
  padding: 0 3px; border-radius: 2px;
}
.intro-doc-footer {
  font-family: 'Courier New', monospace;
  font-size: 9px; color: #443333; margin-top: 14px; letter-spacing: 2px;
}

/* Redacted block */
.intro-redacted-block {
  display: flex; flex-direction: column; gap: 6px;
  margin: 20px 0; padding: 16px;
  background: rgba(0,0,0,0.5); border: 1px solid #1a1a1a;
  border-radius: 4px;
}
.intro-redacted {
  font-family: 'Courier New', monospace;
  font-size: 14px; letter-spacing: 3px;
  color: #1a1a1a; background: #1a1a1a; /* black on black = redacted */
  user-select: none; border-radius: 2px;
  display: inline-block; line-height: 1.6;
}

/* ── MANIFESTO (final section) ── */
.intro-manifesto {
  border: 1px solid rgba(0,255,238,0.25);
  border-left: 3px solid var(--neon-cyan);
  background: rgba(0,255,238,0.04);
  border-radius: 4px; padding: 24px 28px;
  margin: 24px 0;
}
.intro-manifesto p {
  font-size: clamp(16px, 3.5vw, 22px);
  font-weight: 700; color: var(--neon-cyan);
  letter-spacing: 2px; line-height: 1.8; margin: 0;
  text-shadow: 0 0 20px rgba(0,255,238,0.4);
}

/* ── CTA ── */
.intro-cta-section {
  max-width: 680px; margin: 0 auto;
  padding: 40px 28px 60px;
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
}
.intro-cta-btn {
  width: 100%; max-width: 360px;
  padding: 18px; border: none; border-radius: 14px; cursor: pointer;
  font-size: 15px; font-weight: 900; letter-spacing: 4px;
  background: linear-gradient(135deg, #7f00ff, #00c3ff, #00ffee);
  color: #000;
  box-shadow: 0 0 40px rgba(127,0,255,0.5), 0 0 80px rgba(0,195,255,0.3);
  transition: all 0.25s; animation: ctaPulse 3s ease-in-out infinite;
}
@keyframes ctaPulse {
  0%,100% { box-shadow: 0 0 40px rgba(127,0,255,0.5), 0 0 80px rgba(0,195,255,0.3); }
  50%      { box-shadow: 0 0 60px rgba(127,0,255,0.8), 0 0 120px rgba(0,195,255,0.5); }
}
.intro-cta-btn:hover { filter: brightness(1.15); transform: translateY(-2px) scale(1.02); }

.intro-skip-btn {
  background: none; border: none; cursor: pointer;
  font-size: 11px; color: #444; letter-spacing: 2px;
  transition: color 0.2s;
}
.intro-skip-btn:hover { color: #888; }

.intro-cta-note {
  font-size: 9px; color: #333; text-align: center;
  font-family: 'Courier New', monospace; letter-spacing: 1px;
  line-height: 1.8; max-width: 400px;
}

/* Mobile intro */
@media (max-width: 700px) {
  .intro-hero { min-height: 90vh; padding: 60px 20px 80px; }
  .intro-headline { font-size: clamp(22px, 8vw, 40px); letter-spacing: 3px; }
  .intro-section { padding: 40px 20px; }
  .intro-quote { font-size: 12px; }
  .intro-manifesto p { font-size: clamp(14px, 4vw, 18px); }
  .intro-cta-btn { font-size: 13px; letter-spacing: 3px; }
}

/* ── PROTOCOL SELECTOR ──────────────────────────────────── */
.protocol-selector {
  display: flex; gap: 5px; align-items: center;
}
.proto-btn {
  padding: 6px 14px; border-radius: 20px; cursor: pointer;
  font-size: 10px; font-weight: 900; letter-spacing: 2px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.05); color: var(--text-muted);
  transition: all 0.25s; text-align: center; line-height: 1.5;
  pointer-events: auto;
}
.proto-btn small {
  display: block; font-size: 8px; font-weight: 400;
  letter-spacing: 1px; opacity: 0.8;
}
.proto-btn.active[data-proto="deep"] {
  border-color: var(--neon-purple); color: var(--neon-purple);
  background: rgba(191,95,255,0.15);
  box-shadow: 0 0 12px rgba(191,95,255,0.35);
}
.proto-btn.active[data-proto="fast"] {
  border-color: var(--neon-gold); color: var(--neon-gold);
  background: rgba(255,215,0,0.12);
  box-shadow: 0 0 12px rgba(255,215,0,0.3);
}
.proto-btn:hover:not(.active) {
  color: var(--text); border-color: rgba(200,180,255,0.4);
  background: rgba(255,255,255,0.08);
}

/* ── HEADER WIZARD BUTTON ───────────────────────────────── */
.header-wizard-btn {
  background: none; border: 1px solid var(--glass-border); color: var(--text-muted);
  border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 15px;
  transition: all 0.2s; line-height: 1;
}
.header-wizard-btn:hover { color: var(--neon-purple); border-color: var(--neon-purple); background: rgba(191,95,255,0.12); }

/* ── WIZARD OVERLAY ─────────────────────────────────────── */
#wizardOverlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2, 0, 14, 0.88);
  backdrop-filter: blur(10px) saturate(1.4);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s;
}
#wizardOverlay.active { opacity: 1; pointer-events: auto; }

.wizard-card {
  background: rgba(10, 0, 28, 0.97);
  border: 1px solid rgba(191, 95, 255, 0.45);
  border-radius: 24px;
  padding: 32px 28px 24px;
  width: 100%; max-width: 460px;
  box-shadow: 0 0 60px rgba(191,95,255,0.2), 0 0 120px rgba(0,255,238,0.08);
  display: flex; flex-direction: column; gap: 18px;
  max-height: 92vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--glass-border) transparent;
}

.wizard-step { display: none; flex-direction: column; gap: 14px; }
.wizard-step.active { display: flex; animation: wzFadeIn 0.25s ease; }
@keyframes wzFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Welcome */
.wizard-logo {
  font-size: 30px; font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  text-align: center; animation: logoShift 6s linear infinite;
}
.wizard-tagline {
  font-size: 12px; color: var(--text-muted); text-align: center; letter-spacing: 1px;
}
.wizard-benefits { display: flex; flex-direction: column; gap: 8px; }
.benefit {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 12px 14px;
}
.b-icon { font-size: 22px; flex-shrink: 0; }
.benefit strong { display: block; font-size: 13px; color: var(--text); }
.benefit small  { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Step header */
.wz-step-hdr { display: flex; align-items: center; gap: 10px; }
.wz-step-num  { font-size: 10px; letter-spacing: 3px; color: var(--text-muted); }
.wz-step-icon { font-size: 28px; }
.wizard-title { font-size: 20px; font-weight: 700; color: var(--text); }
.wizard-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.wizard-desc strong { color: var(--neon-gold); }

/* Fields */
.wizard-field { display: flex; flex-direction: column; gap: 6px; }
.wizard-field label {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--neon-purple);
}
.wizard-field textarea {
  background: rgba(0,0,0,0.5); border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 10px; padding: 10px 12px;
  resize: none; font-size: 13px; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.wizard-field textarea:focus {
  outline: none; border-color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(191,95,255,0.25);
}
.wizard-field textarea.w-error { border-color: var(--danger); box-shadow: 0 0 10px rgba(255,51,102,0.3); }
.w-field-error {
  font-size: 10px; color: var(--danger); display: none;
}
.w-field-error.visible { display: block; }

/* Preset chips */
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-chip {
  background: rgba(0,255,238,0.06); border: 1px solid rgba(0,255,238,0.25);
  color: var(--neon-cyan); border-radius: 20px; padding: 5px 12px;
  font-size: 11px; cursor: pointer; transition: all 0.2s; text-align: left;
}
.preset-chip:hover:not(:disabled) { background: rgba(0,255,238,0.15); transform: scale(1.02); }
.preset-chip.chip-added { opacity: 0.3; cursor: default; }

/* Affirm list in wizard */
.wizard-affirm-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 130px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--glass-border) transparent;
}
.w-affirm-item {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 7px 10px; font-size: 12px;
}
.w-affirm-item span { flex: 1; line-height: 1.4; }
.w-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 10px 0; }

.wizard-add-row { display: flex; gap: 8px; }
.wizard-add-row input {
  flex: 1; background: rgba(0,0,0,0.5); border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 13px;
  font-family: inherit; transition: border-color 0.2s;
}
.wizard-add-row input:focus { outline: none; border-color: var(--neon-purple); }

/* Voice step */
.wv-voice-selector { display: flex; gap: 10px; }
.wv-btn {
  flex: 1; padding: 14px; border-radius: 12px; cursor: pointer;
  font-size: 14px; font-weight: 700; letter-spacing: 1px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.04); color: var(--text-muted);
  transition: all 0.2s;
}
.wv-btn.active {
  border-color: var(--neon-purple); color: var(--neon-purple);
  background: rgba(191,95,255,0.15); box-shadow: 0 0 16px rgba(191,95,255,0.3);
}
.wv-row { display: flex; align-items: center; gap: 12px; }
.wv-row label { font-size: 11px; color: var(--text-muted); min-width: 72px; }
.wv-row select {
  flex: 1; background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 6px; padding: 7px 8px; font-size: 12px;
}
.wv-row input[type="range"] { flex: 1; accent-color: var(--neon-purple); cursor: pointer; }
.wv-row span { font-size: 12px; color: var(--text-muted); min-width: 36px; text-align: right; }
.wv-preview {
  width: 100%; padding: 12px; border: 1px solid var(--neon-cyan);
  border-radius: 10px; background: rgba(0,255,238,0.07);
  color: var(--neon-cyan); font-size: 12px; font-weight: 700;
  letter-spacing: 2px; cursor: pointer; transition: all 0.2s;
}
.wv-preview:hover { background: rgba(0,255,238,0.16); }
.wv-preview:disabled { opacity: 0.4; cursor: wait; }

/* Progress dots */
.wizard-dots { display: flex; justify-content: center; gap: 10px; }
.w-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 1px solid var(--glass-border);
  transition: all 0.3s;
}
.w-dot.w-dot-past { background: rgba(191,95,255,0.6); border-color: var(--neon-purple); }
.w-dot.w-dot-current {
  background: var(--neon-cyan); border-color: var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan); transform: scale(1.35);
}

/* Navigation */
.wizard-nav { display: flex; gap: 10px; align-items: center; }
.w-nav-btn { border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 700; letter-spacing: 1px; transition: all 0.2s; border: none; padding: 12px 18px; }
.w-back { background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border) !important; color: var(--text-muted); flex-shrink: 0; }
.w-back:hover { color: var(--text); background: rgba(255,255,255,0.1); }
.w-skip { background: none; color: var(--text-muted); font-size: 11px; flex-shrink: 0; padding: 12px 8px; }
.w-skip:hover { color: var(--text); }
.w-next { flex: 1; background: linear-gradient(135deg, var(--neon-purple), #00c3ff); color: #000; font-weight: 900; box-shadow: 0 0 20px rgba(191,95,255,0.35); }
.w-next:hover { filter: brightness(1.12); transform: translateY(-1px); }

/* ── IMMERSIVE MODE ─────────────────────────────────────── */
#headerZone   { flex-shrink: 0; }
#controlsZone { flex-shrink: 0; }

/* Header: fixed to top viewport, slide out upward */
body.immersed #headerZone { height: 0; overflow: visible; }
body.immersed header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  opacity: 0; pointer-events: none;
  transform: translateY(-100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
body.immersed header.revealed {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Sidebar stays above the revealed header overlay */
body.immersed #sidebar       { z-index: 50; }
body.immersed #toggleSidebar { z-index: 51; }

/* Controls: fixed to bottom viewport, slide out downward */
body.immersed #controlsZone { height: 0; overflow: visible; }
body.immersed #controlsBar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  opacity: 0; pointer-events: none;
  transform: translateY(100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
body.immersed #controlsBar.revealed {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Thin accent strips — visual hint for hover zones */
body.immersed::before,
body.immersed::after {
  content: '';
  position: fixed; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan), var(--neon-pink));
  z-index: 35; pointer-events: none;
  animation: edgeGlow 4s ease-in-out infinite alternate;
}
body.immersed::before { top: 0; }
body.immersed::after  { bottom: 0; }
@keyframes edgeGlow { from { opacity: 0.2; } to { opacity: 0.6; } }

/* Mobile: no hover → keep chrome always visible */
@media (max-width: 700px) {
  body.immersed::before, body.immersed::after { display: none; }
  body.immersed #headerZone   { height: auto !important; overflow: hidden !important; }
  body.immersed #controlsZone { height: auto !important; overflow: hidden !important; }
  body.immersed header        { position: static !important; opacity: 1 !important; pointer-events: auto !important; transform: none !important; }
  body.immersed #controlsBar  { position: static !important; opacity: 1 !important; pointer-events: auto !important; transform: none !important; }
}

/* ── RESPONSIVENESS ─────────────────────────────────────── */
@media (max-width: 700px) {
  /* Header */
  .logo { font-size: 17px; letter-spacing: 4px; }
  #phaseNameDisplay { font-size: 12px; letter-spacing: 1px; }
  .phase-label { display: none; }
  #timerDisplay { font-size: 22px; }
  #totalTimerDisplay { display: none; }

  /* Sidebar: full-screen overlay, starts collapsed via JS */
  #sidebar {
    width: 100% !important;
    position: fixed !important;
    top: 0; left: 0; height: 100%;
    z-index: 50;
    margin-left: 0 !important;
    transition: transform 0.35s ease, opacity 0.35s !important;
    transform: translateX(0);
  }
  #sidebar.collapsed {
    transform: translateX(-100%) !important;
    opacity: 0 !important; pointer-events: none !important;
  }
  #toggleSidebar {
    position: fixed !important;
    left: 10px; top: 10px;
    transform: none !important; z-index: 60;
    border-radius: 8px; padding: 7px 10px; font-size: 12px;
  }
  #sidebar:not(.collapsed) ~ #toggleSidebar {
    left: auto !important; right: 10px; top: 10px;
  }

  /* Controls bar — wrap to 2 rows */
  #controlsBar {
    flex-wrap: wrap; gap: 8px; padding: 8px 12px;
    justify-content: center;
  }
  .protocol-selector { order: 0; justify-content: center; }
  #btnStart, #btnPause, #btnStop { padding: 10px 22px; font-size: 12px; letter-spacing: 2px; }
  .volume-wrap { order: 10; width: 100%; justify-content: center; }
  #volumeSlider { width: 110px; }

  /* Phase pips — taller for touch */
  .phase-pip { height: 8px; }
  .phase-pip.active { height: 10px; }

  /* Beat Hz */
  #beatHzDisplay { font-size: 22px; }

  /* Affirmation text */
  #affirmationText { font-size: clamp(14px, 4.5vw, 22px); padding: 0 20px; }

  /* Intention display */
  #intentionDisplay { max-width: 90%; }
  #intentionDisplay .intention-text { font-size: clamp(16px, 5vw, 28px); }

  /* Wizard on mobile */
  .wizard-card { padding: 24px 18px 18px; border-radius: 20px; max-height: 88vh; gap: 14px; }
  .wizard-logo { font-size: 22px; letter-spacing: 5px; }
  .wizard-title { font-size: 18px; }
  .benefit { padding: 10px 12px; }
  .b-icon { font-size: 18px; }
}

@media (max-width: 380px) {
  .logo { font-size: 14px; letter-spacing: 2px; }
  .ctrl-btn { padding: 9px 16px; font-size: 11px; }
  .proto-btn { padding: 5px 10px; font-size: 9px; }
  .wizard-card { padding: 18px 14px 14px; }
}
