:root {
  --bg-deep: #07090e;
  --bg-panel: rgba(15, 20, 31, 0.72);
  --bg-panel-border: rgba(255, 255, 255, 0.08);
  
  /* State Colors */
  --state-idle: #00d2ff;
  --state-idle-glow: rgba(0, 210, 255, 0.25);
  
  --state-eval: #ffaa00;
  --state-eval-glow: rgba(255, 170, 0, 0.35);
  
  --state-auth: #00ff88;
  --state-auth-glow: rgba(0, 255, 136, 0.35);
  
  --state-alert: #ff3344;
  --state-alert-glow: rgba(255, 51, 68, 0.45);
  
  /* Active dynamic color */
  --accent-color: var(--state-idle);
  --accent-glow: var(--state-idle-glow);
  
  --text-main: #f0f4fc;
  --text-dim: #8a99b5;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-main);
}

body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background-color 0.8s ease;
}

/* Dynamic State Themes */
body.state-idle {
  --accent-color: var(--state-idle);
  --accent-glow: var(--state-idle-glow);
}
body.state-eval {
  --accent-color: var(--state-eval);
  --accent-glow: var(--state-eval-glow);
}
body.state-auth {
  --accent-color: var(--state-auth);
  --accent-glow: var(--state-auth-glow);
}
body.state-alert {
  --accent-color: var(--state-alert);
  --accent-glow: var(--state-alert-glow);
}

/* Ambient Radial Backdrop Glow */
.ambient-aura {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vw;
  height: 80vw;
  max-width: 900px;
  max-height: 900px;
  background: radial-gradient(circle, var(--accent-glow) 0%, rgba(7, 9, 14, 0) 65%);
  pointer-events: none;
  z-index: 0;
  transition: background 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1s ease;
  filter: blur(40px);
}

/* Header Bar */
.station-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bg-panel-border);
}

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

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--accent-color);
  box-shadow: 0 0 16px var(--accent-color);
  animation: pulse-ring 2.4s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.92); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 24px var(--accent-color); }
  100% { transform: scale(0.92); opacity: 0.8; }
}

.station-title {
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin: 0;
}

.station-title span {
  color: var(--accent-color);
  margin-left: 3px;
  transition: color 0.5s ease;
}

.node-badge, .version-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--text-dim);
}

.version-badge {
  border-color: rgba(0, 210, 255, 0.3);
  color: var(--accent-color);
  font-weight: 600;
}

/* State Center Pill */
.state-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 40px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--accent-color);
  box-shadow: 0 0 14px var(--accent-glow);
  transition: all 0.5s ease;
}

.state-icon {
  color: var(--accent-color);
  font-size: 0.85rem;
}

.state-label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-main);
}

/* Telemetry Header Items */
.telemetry-bar {
  display: flex;
  align-items: center;
  gap: 20px;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.telem-label {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

.telem-val {
  font-size: 0.88rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-color);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--bg-panel-border);
  color: var(--text-dim);
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--accent-color);
}

/* Main Viewport Container */
.viewport-deck {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  overflow: hidden;
}

.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(0.98);
}

.view.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* 1. Chameleon Clock Aesthetics */
.chameleon-clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.clock-face-wrapper {
  position: relative;
  width: 440px;
  height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#clock-canvas {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 28px var(--accent-glow));
  transition: filter 0.8s ease;
}

.digital-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.digital-time {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-main);
}

.digital-date {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
}

.threat-status {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--accent-color);
  font-weight: 600;
}

/* 2. Photo Slideshow Aesthetics */
.slideshow-container {
  position: relative;
  width: 90vw;
  height: 75vh;
  max-width: 1100px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--bg-panel-border);
}

.slide-frame {
  width: 100%;
  height: 100%;
  position: relative;
}

.slide-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: ken-burns 16s infinite alternate ease-in-out;
}

@keyframes ken-burns {
  0% { transform: scale(1); }
  100% { transform: scale(1.08) translate(-1%, -1%); }
}

.slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 28px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
  font-size: 1.05rem;
  font-weight: 500;
}

.slide-watermark {
  position: absolute;
  top: 24px;
  right: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: 8px;
}

.watermark-clock {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
}

.watermark-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--accent-color);
}

/* 3. Dev HUD Aesthetics */
.hud-container {
  display: flex;
  gap: 24px;
  width: 92vw;
  height: 76vh;
  max-width: 1200px;
}

.viewfinder-pane {
  flex: 3;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--bg-panel-border);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.feed-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.crosshair-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  pointer-events: none;
  opacity: 0.4;
}

.reticle-circle {
  width: 100%;
  height: 100%;
  border: 1px dashed var(--accent-color);
  border-radius: 50%;
}

.reticle-line {
  position: absolute;
  background: var(--accent-color);
}

.reticle-line.h-line {
  top: 50%;
  left: -20px;
  right: -20px;
  height: 1px;
}

.reticle-line.v-line {
  left: 50%;
  top: -20px;
  bottom: -20px;
  width: 1px;
}

.feed-watermark {
  position: absolute;
  bottom: 16px;
  left: 18px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 10px;
  border-radius: 4px;
  color: var(--accent-color);
}

.camera-controls {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 15;
}

.cam-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent-color);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: all 0.25s ease;
}

.cam-btn:hover {
  background: var(--accent-color);
  color: #000;
}

.cam-btn.active {
  background: rgba(0, 255, 136, 0.2);
  border-color: #00ff88;
  color: #00ff88;
}

.hud-telemetry-sidebar {
  flex: 1.2;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border-radius: 12px;
  border: 1px solid var(--bg-panel-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-title {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.sidebar-stat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.stat-row span {
  color: var(--text-dim);
}

.stat-row strong {
  font-family: var(--font-mono);
  color: var(--accent-color);
}

.hw-btn {
  margin-top: 6px;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid var(--accent-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.hw-btn:hover {
  background: var(--accent-color);
  color: #000;
}

.hw-btn.connected {
  background: rgba(0, 255, 136, 0.15);
  border-color: #00ff88;
  color: #00ff88;
}

.sidebar-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.log-title {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-bottom: 8px;
}

.log-list {
  list-style: none;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-list li {
  padding: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  border-left: 2px solid var(--accent-color);
}

.log-time {
  color: var(--text-dim);
  margin-right: 6px;
}

/* Footer & Controls */
.station-footer {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--bg-panel-border);
}

.nav-controls, .simulation-controls {
  display: flex;
  gap: 12px;
}

.nav-btn, .sim-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bg-panel-border);
  color: var(--text-dim);
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.nav-btn:hover, .sim-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--accent-color);
  box-shadow: 0 0 14px var(--accent-glow);
}

.key-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--accent-color);
}

.footer-meta {
  display: flex;
  align-items: center;
}

.footer-version {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--bg-panel-border);
}

@media (max-width: 900px) {
  .clock-face-wrapper {
    width: 320px;
    height: 320px;
  }
  .hud-container {
    flex-direction: column;
  }
  .hud-telemetry-sidebar {
    display: none;
  }
  .station-footer {
    flex-direction: column;
    gap: 12px;
  }
}
