/* ── PulseXI – Main Styles ─────────────────────────────────────────── */
:root {
  --bg-0: #0a0e14;
  --bg-1: #121823;
  --surface: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.10);
  --text: #eef3fa;
  --muted: rgba(238, 243, 250, 0.65);
  --pitch-green: #0f5c35;
  --pitch-line: rgba(255, 255, 255, 0.55);
  --accent-home: #36d6c6;
  --accent-away: #ff9a3c;
  --warn: #ff5d7a;
  --ok: #4ade80;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(ellipse 50% 40% at 8% 0%, rgba(54, 214, 198, 0.07), transparent 65%),
    radial-gradient(ellipse 50% 40% at 92% 0%, rgba(255, 154, 60, 0.06), transparent 65%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(74, 222, 128, 0.04), transparent 70%),
    var(--bg-0);
  background-attachment: fixed;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-accent { color: var(--accent-home); }
.brand-tag { color: var(--muted); font-size: 0.8rem; margin-left: 4px; }

.scoreboard { display: flex; align-items: center; gap: 14px; font-weight: 600; }
.scoreboard .team.home { color: var(--accent-home); }
.scoreboard .team.away { color: var(--accent-away); }
.scoreboard .score {
  font-family: "Consolas", monospace;
  font-size: 1.05rem;
  background: rgba(255,255,255,0.08);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
}
.scoreboard .clock {
  font-family: "Consolas", monospace;
  background: var(--surface);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.controls { display: flex; align-items: center; gap: 8px; }
.audio-toggle {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.78rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 10px; cursor: pointer;
}
.audio-toggle input { accent-color: var(--accent-home); }
.btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn.primary { background: var(--accent-home); color: #06201a; border: none; font-weight: 700; }
.btn:hover { filter: brightness(1.15); }

.scrubber {
  width: 100%;
  margin: 0;
  accent-color: var(--accent-home);
  background: var(--bg-1);
}

.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  padding: 10px 16px;
}

.pitch-panel { display: flex; flex-direction: column; gap: 8px; position: relative; }

.stadium-glow {
  position: absolute; inset: -40px -10px auto -10px; height: 260px;
  background:
    radial-gradient(ellipse 60% 100% at 15% 0%, rgba(54, 214, 198, 0.16), transparent 70%),
    radial-gradient(ellipse 60% 100% at 85% 0%, rgba(255, 154, 60, 0.14), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.broadcast-tag {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  background: rgba(10, 14, 20, 0.72);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--ok);
  backdrop-filter: blur(2px);
}

.pitch-stage {
  position: relative;
  z-index: 1;
}

.pitch-canvas {
  display: block;
  width: 100%;
  height: 460px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow:
    0 40px 60px -20px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.3);
  cursor: grab;
}
.pitch-canvas:active { cursor: grabbing; }

.drag-hint {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 0.65rem;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 1.5s ease 2s;
}
.drag-hint.faded { opacity: 0; }

.camera-controls {
  position: absolute; bottom: 10px; right: 10px; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  background: rgba(10, 14, 20, 0.72);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  backdrop-filter: blur(2px);
}
.cam-btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
  width: 22px; height: 22px; line-height: 1;
  cursor: pointer; font-size: 0.9rem;
}
.cam-btn:hover { filter: brightness(1.2); }
.zoom-label { font-size: 0.72rem; color: var(--muted); min-width: 30px; text-align: center; }
.cam-toggle {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.72rem; color: var(--muted);
  cursor: pointer; margin-left: 4px;
  border-left: 1px solid var(--border); padding-left: 8px;
}
.cam-toggle input { accent-color: var(--accent-home); }

.player-popup {
  position: absolute;
  z-index: 10;
  width: 200px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  box-shadow: 0 12px 28px rgba(0,0,0,0.55);
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.player-popup.hidden { opacity: 0; visibility: hidden; }
.player-popup .pp-name { font-weight: 700; font-size: 0.88rem; }
.player-popup .pp-sub { color: var(--muted); font-size: 0.72rem; margin-bottom: 6px; }
.player-popup .pp-row { display: flex; justify-content: space-between; color: var(--muted); padding: 1px 0; }
.player-popup .pp-row span:last-child { color: var(--text); font-weight: 600; }
.player-popup.home-team { border-left: 3px solid var(--accent-home); }
.player-popup.away-team { border-left: 3px solid var(--accent-away); }

.overlay-zone {
  position: relative;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cue {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-home);
  border-radius: 8px;
  padding: 10px 14px;
  animation: slideIn 0.35s ease-out;
}
.cue.style-goal { border-left-color: var(--ok); }
.cue.style-warning { border-left-color: var(--warn); }
.cue.style-momentum { border-left-color: var(--accent-away); }
.cue .cue-title { font-weight: 700; font-size: 0.95rem; }
.cue .cue-body { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.cue .cue-time { float: right; color: var(--muted); font-size: 0.75rem; }
.verified-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.68rem; color: var(--ok);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 10px; padding: 1px 7px; margin-left: 6px;
}
.verified-badge.corrected { color: var(--accent-away); border-color: rgba(255, 154, 60, 0.4); }
.speak-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 5px; font-size: 0.68rem; padding: 1px 6px; cursor: pointer; margin-left: 6px;
}
.speak-btn:hover { color: var(--text); border-color: var(--accent-home); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-6px); }
}
.cue.leaving { animation: fadeOut 0.4s ease-in forwards; }

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 10px;
  align-items: center;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.8rem;
  line-height: 1.5;
}
.momentum-bar-wrap { text-align: center; }
.momentum-label { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.momentum-bar {
  height: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.momentum-fill {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 2px;
  background: var(--accent-home);
  transition: left 0.4s ease, width 0.4s ease;
}

.persona-panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: fit-content;
}
.persona-panel h2 { font-size: 1rem; margin: 0 0 4px; }
.persona-panel h3 { font-size: 0.85rem; color: var(--muted); margin: 8px 0 2px; }
.persona-panel label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.78rem; color: var(--muted);
}
.persona-panel select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
}
.hidden { display: none; }

.persona-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
}
.persona-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.8rem;
}
.persona-card .pc-title { font-weight: 700; }
.persona-card .pc-time { color: var(--muted); font-size: 0.7rem; }
.persona-card .pc-body { margin-top: 2px; color: var(--muted); }

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

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s ease;
}
.modal-backdrop.hidden { opacity: 0; pointer-events: none; }

.recap-modal {
  position: relative;
  width: min(560px, 90vw);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 30px 24px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.6);
}
.recap-tag {
  display: inline-block;
  font-size: 0.68rem; letter-spacing: 0.06em;
  color: var(--ok);
  border: 1px solid rgba(74,222,128,0.35);
  border-radius: 10px; padding: 2px 9px;
  margin-bottom: 10px;
}
.recap-modal h2 { margin: 0 0 6px; font-size: 1.3rem; }
.recap-score {
  font-family: "Consolas", monospace; font-size: 1.1rem;
  color: var(--muted); margin-bottom: 14px;
}
.recap-modal p {
  line-height: 1.6; font-size: 0.92rem; color: var(--text);
  margin: 0 0 18px;
}
.recap-footer { display: flex; align-items: center; gap: 10px; }
.recap-footer .speak-btn { margin-left: 0; padding: 5px 12px; font-size: 0.78rem; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 1rem; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
