:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.75);
  --border-color: rgba(56, 189, 248, 0.2);
  --border-glow: rgba(56, 189, 248, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-gold: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-family);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.08) 0px, transparent 50%);
}

/* Header & Top Bar */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-badges {
  display: flex;
  gap: 0.75rem;
}

.badge {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.badge-live {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.3);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f43f5e;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.badge-engine {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

/* Main Layout */
.main-container {
  max-width: 1720px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* 3D Simulation & Spectator Section */
.stage-section {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  min-height: 640px;
}

@media (max-width: 1200px) {
  .stage-section {
    grid-template-columns: 1fr;
  }
}

.viewport-card {
  background: #020617;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

.canvas-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 500px;
}

#worldCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#worldCanvas:active {
  cursor: grabbing;
}

/* Overlay HUD elements on 3D canvas */
.canvas-hud-top {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.hud-panel {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  pointer-events: auto;
}

.canvas-controls-bottom {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  pointer-events: auto;
}

.ctrl-btn {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.ctrl-btn.active {
  background: var(--accent-rose);
  color: #fff;
  border-color: var(--accent-rose);
}

/* Side Streamer & Chat Rail */
.side-rail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Streamer Commentary Box */
.streamer-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.host-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.host-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.avatar-alex {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border: 2px solid #38bdf8;
}

.avatar-roland {
  background: linear-gradient(135deg, #059669, #10b981);
  border: 2px solid #10b981;
}

.host-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.host-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.speech-bubble {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.88rem;
  min-height: 80px;
  position: relative;
  line-height: 1.45;
}

.speech-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 14px;
  margin-top: 0.5rem;
}

.wave-bar {
  width: 3px;
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 2px;
  animation: soundwave 1s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.2s; height: 60%; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; height: 90%; }
.wave-bar:nth-child(4) { animation-delay: 0.1s; height: 40%; }
.wave-bar:nth-child(5) { animation-delay: 0.3s; height: 75%; }

@keyframes soundwave {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* Chat & Terminal */
.chat-terminal {
  display: flex;
  flex-direction: column;
  height: 280px;
}

.terminal-logs {
  flex: 1;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0.5rem;
  margin-bottom: 0.75rem;
}

.log-line {
  word-break: break-word;
}

.log-user {
  color: var(--accent-cyan);
  font-weight: 600;
}

.log-bot {
  color: var(--accent-gold);
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
}

.chat-input-row input {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.85rem;
}

.chat-input-row input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.send-btn {
  background: var(--accent-cyan);
  color: #000;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}

/* Action Operations Drawer */
.operations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.action-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
}

.action-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.op-btn {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  border: none;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.op-btn:hover {
  opacity: 0.9;
}

/* Download & OBS Guide Cards */
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

.download-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.15);
}

.download-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #000;
  text-decoration: none;
  font-weight: 700;
  padding: 0.85rem 1.75rem;
  border-radius: 10px;
  margin-top: 1rem;
  transition: transform 0.2s;
}

.download-cta:hover {
  transform: translateY(-2px);
}

.code-block {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: #38bdf8;
  margin-top: 0.5rem;
  overflow-x: auto;
}

footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 2rem;
}

/* ==========================================================================
   24/7 BROADCAST OPERATIONS CONSOLE STYLES (Production Directive 03)
   ========================================================================== */

.console-section {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.console-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(9, 13, 22, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.console-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.console-icon {
  width: 32px;
  height: 32px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent-cyan);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.console-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #fff;
  letter-spacing: -0.01em;
}

.console-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 8 Core Broadcast States Grid */
.status-states-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.state-pill {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.25s ease;
}

.state-pill.state-active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
}

.state-pill.state-standby {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.state-pill.state-offline {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.25);
}

.state-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cbd5e1;
}

.state-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: monospace;
}

.led-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}

.state-active .led-dot {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-green 2s infinite;
}

.state-standby .led-dot {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.state-offline .led-dot {
  background: #f43f5e;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px #10b981; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Telemetry Stats Grid */
.telemetry-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.telemetry-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.85rem;
}

.telemetry-card-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.telemetry-card-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-display);
}

.telemetry-card-sub {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.2rem;
}

/* Commentary Stream History in Console */
.console-logs-box {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.85rem;
  max-height: 180px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.78rem;
  line-height: 1.6;
}

.log-entry {
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-time {
  color: #64748b;
  margin-right: 0.5rem;
}

.log-speaker {
  font-weight: 700;
  margin-right: 0.4rem;
}

.log-speaker.alex { color: #38bdf8; }
.log-speaker.roland { color: #f59e0b; }
.log-speaker.sys { color: #10b981; }

/* Control Buttons Row */
.console-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
  align-items: center;
}

.console-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #e2e8f0;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.console-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
}

.console-btn.btn-danger {
  border-color: rgba(244, 63, 94, 0.4);
}

.console-btn.btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--accent-rose);
}
