@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg-color: #0b0d19;
  --accent-cyan: #00f0ff;
  --accent-purple: #9d4edd;
  --accent-green: #00ff88;
  --accent-yellow: #ffbe0b;
  --accent-coral: #ff0055;
  --text-color: #f1f5f9;
  --panel-bg: rgba(13, 17, 34, 0.88);
  --panel-border: rgba(0, 240, 255, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: 'Space Mono', monospace;
  color: var(--text-color);
}

#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* 3D Canvas with crisp pixel art scaling */
#canvas-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Scanline and CRT Overlay for retro aesthetic */
.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 4px, 6px 100%;
}

/* Top Navigation Bar */
.top-nav {
  position: relative;
  z-index: 10;
  width: 96%;
  max-width: 1200px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 240, 255, 0.15), inset 0 0 16px rgba(0, 240, 255, 0.05);
  backdrop-filter: blur(8px);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  clip-path: polygon(50% 0%, 100% 85%, 50% 70%, 0% 85%);
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(5deg); }
}

.brand-text h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--accent-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
  letter-spacing: 1px;
}

.brand-text span {
  font-size: 11px;
  color: #94a3b8;
}

.nav-badges {
  display: flex;
  gap: 10px;
}

.pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill.active {
  border-color: var(--accent-green);
  color: var(--accent-green);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Subtitle and Caption Overlay */
.subtitle-container {
  position: relative;
  z-index: 10;
  max-width: 800px;
  width: 90%;
  text-align: center;
  margin-bottom: 8px;
}

.subtitle-box {
  background: rgba(11, 13, 25, 0.92);
  border: 2px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 12px 24px;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.subtitle-scene {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--accent-yellow);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.subtitle-text {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* Bottom Control Panel */
.bottom-panel {
  position: relative;
  z-index: 10;
  width: 96%;
  max-width: 1200px;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 240, 255, 0.05);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Timeline scrubber */
.timeline-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.time-display {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--accent-cyan);
  min-width: 120px;
}

.slider-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.timeline-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-cyan);
  border: 2px solid #ffffff;
}

.timeline-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-cyan);
  border: 2px solid #ffffff;
}

/* Button Controls Row */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.playback-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.4), rgba(157, 78, 221, 0.5));
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
}

.btn-record {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  background: linear-gradient(135deg, #ff0055, #ff5400);
  border-color: #ff0055;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(255, 0, 85, 0.4);
  animation: pulseRecord 2s infinite;
}

.btn-record:hover {
  background: linear-gradient(135deg, #ff1a6b, #ff6a1a);
  box-shadow: 0 0 28px rgba(255, 0, 85, 0.7);
  transform: scale(1.03);
}

.btn-record.recording {
  animation: recordingFlash 1s infinite;
  background: #ff0000;
  border-color: #ffffff;
}

@keyframes pulseRecord {
  0%, 100% { box-shadow: 0 0 16px rgba(255, 0, 85, 0.4); }
  50% { box-shadow: 0 0 26px rgba(255, 0, 85, 0.8); }
}

@keyframes recordingFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.extra-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-btn {
  font-size: 11px;
  padding: 6px 12px;
}

/* Recording Modal / Notification */
.record-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 13, 25, 0.85);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.record-overlay.active {
  display: flex;
}

.record-box {
  background: var(--panel-bg);
  border: 2px solid var(--accent-cyan);
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  max-width: 480px;
  box-shadow: 0 0 50px rgba(0, 240, 255, 0.4);
}

.record-box h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--accent-cyan);
  margin-bottom: 12px;
}

.record-box p {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 20px;
  line-height: 1.5;
}

.progress-bar-bg {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-coral));
  transition: width 0.1s linear;
}

.progress-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--accent-yellow);
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .top-nav {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .controls-row {
    flex-direction: column;
    align-items: stretch;
  }
  .playback-buttons, .extra-controls {
    justify-content: center;
  }
  .btn-record {
    width: 100%;
  }
}
