/* oNeura Y-Maze  -  style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@300;400;500;600&family=Jacquard+24&display=swap');

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

:root {
  --bg: #050a0e;
  --panel-bg: #0d1825;
  --panel-border: rgba(255,255,255,0.09);
  --text: #e0e8f0;
  --text-bright: #f0f5ff;
  --text-muted: #7a8ea8;
  --teal: #5eead4;
  --teal-dim: rgba(94,234,212,0.15);
  --red: #ff6b6b;
  --green: #00ff88;
  --green-dim: rgba(0,255,136,0.15);
  --gold: #ffd24d;
  --floor: #0a0f14;
  --wall: #1a2535;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-brand: 'Jacquard 24', serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --header-h: 48px;
  --footer-h: 48px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

/* ── Header ── */
.header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--panel-border);
  height: var(--header-h);
  flex-shrink: 0;
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  justify-self: start;
}

.site-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.site-link:hover {
  opacity: 1;
}

.site-link-wordmark {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header a.back-link {
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  font-size: 11px;
  font-family: var(--font-ui);
  font-weight: 400;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.header a.back-link:hover { color: rgba(255,255,255,0.75); }

.header-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.header-brand-text {
  font-family: var(--font-brand);
  font-size: 18px;
  color: rgba(255,255,255,0.9);
}

.header-subtitle {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-brand {
  justify-self: center;
  text-align: center;
  font-family: var(--font-brand);
  font-size: 20px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.9);
}

.header-brand span {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.04em;
}

@keyframes oneura-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.header-right {
  display: flex;
  gap: 16px;
  min-width: 0;
  justify-self: end;
}

.header-nav-link {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  transition: color 0.2s;
}
.header-nav-link:hover { color: var(--teal); }

/* ── Main layout ── */
.main-container {
  display: flex;
  height: calc(100vh - var(--header-h) - var(--footer-h));
  overflow: hidden;
}

/* ── Left: Arena panel ── */
.arena-panel {
  flex: 1 1 62%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(240px, 30%, 360px);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.maze-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#mazeCanvas {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 640px;
  object-fit: contain;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}

.trial-label {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text);
  font-family: var(--font-mono);
  background: rgba(10,10,10,0.85);
  padding: 4px 14px;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
  z-index: 2;
  white-space: nowrap;
}

/* ── Right: Neural panel ── */
.neural-panel {
  flex: 0 0 320px;
  border-left: 1px solid var(--panel-border);
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 100%;
}

.np-section {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px 12px;
}

.np-section h3 {
  font-family: var(--font-ui);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
  font-weight: 600;
}

/* Bar graphs */
.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11px;
}

.bar-label {
  width: 56px;
  text-align: right;
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.15s ease;
}

.bar-fill.cs-plus { background: var(--teal); }
.bar-fill.cs-minus { background: var(--red); }

.bar-val {
  width: 36px;
  text-align: right;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  flex-shrink: 0;
}

/* Decision indicator */
.decision-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 0;
}

.decision-arrow {
  font-size: 20px;
  color: var(--teal);
  transition: transform 0.3s ease, color 0.3s ease;
}

.decision-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

/* Dopamine burst */
.dopamine-indicator {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.dopamine-indicator.active {
  color: var(--gold);
  background: rgba(255,215,0,0.08);
  box-shadow: 0 0 12px rgba(255,215,0,0.15);
}

/* Trial results */
.results-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.result-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: rgba(255,255,255,0.2);
  position: relative;
}

.result-cell.correct {
  background: rgba(78,205,196,0.15);
  border: 1px solid rgba(78,205,196,0.3);
  color: var(--teal);
}

.result-cell.incorrect {
  background: rgba(255,107,107,0.12);
  border: 1px solid rgba(255,107,107,0.25);
  color: var(--red);
}

.result-cell.current {
  border: 1px solid rgba(255,255,255,0.25);
}

.pi-display {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.pi-display .pi-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--teal);
}

/* Spike raster */
.raster-canvas {
  width: 100%;
  height: 32px;
  border-radius: 3px;
  background: rgba(255,255,255,0.02);
}

/* ── Footer ── */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  border-top: 1px solid var(--panel-border);
  height: var(--footer-h);
  flex-shrink: 0;
  gap: 16px;
  background: rgba(10, 10, 10, 0.9);
}

.footer-desc {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  line-height: 1.5;
  flex: 1;
  min-width: 0;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.footer-links a {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.footer-links a:hover { color: var(--teal); opacity: 1; }

/* ── Control Panel ── */
.control-panel {
  background: var(--panel-bg);
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
  letter-spacing: 1px;
}

.speed-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px rgba(94,234,212,0.3);
  cursor: pointer;
}

.speed-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px rgba(94,234,212,0.3);
  cursor: pointer;
}

.speed-readout {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  min-width: 28px;
  text-align: right;
}

/* Fade overlay for trial transitions */
.fade-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 100;
}

.fade-overlay.active {
  opacity: 1;
}

/* ── First-person POV ── */
.pov-container {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-height: 0;
  overflow: hidden;
}

.pov-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  margin-bottom: 6px;
  text-align: center;
}

#povCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  max-height: 220px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}

/* Responsive */
@media (max-width: 1180px) {
  .arena-panel {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

@media (max-width: 900px) {
  .main-container {
    flex-direction: column;
    height: auto;
    overflow-y: auto;
  }
  .neural-panel {
    flex: none;
    border-left: none;
    border-top: 1px solid var(--panel-border);
  }
  .footer-desc {
    display: none;
  }
  html, body {
    overflow: auto;
  }
  .header {
    display: flex;
    flex-wrap: wrap;
    height: auto;
    gap: 6px;
    padding: 8px 12px;
  }
  .header-title {
    display: none;
  }
  .header-right {
    gap: 10px;
  }
  .arena-panel {
    grid-template-columns: 1fr;
  }
  .maze-stage {
    min-height: 0;
  }
  #mazeCanvas {
    width: 100%;
    height: auto;
  }
  .pov-container {
    max-width: 600px;
    width: 100%;
    justify-self: center;
  }
}
