:root {
  --bg-glass: rgba(6, 13, 30, 0.78);
  --bg-glass-strong: rgba(4, 10, 24, 0.90);
  --border-glass: rgba(255, 255, 255, 0.14);
  --lfc-red: #c8102e;
  --lfc-crimson: #9e0b1c;
  --barca-volt: #d8f528;
  --ucl-navy: #0a1840;
  --ucl-blue: #1e40af;
  --ucl-cyan: #38bdf8;
  --gold: #fbbf24;
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030712;
  color: var(--text-main);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

#sim-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#sim-canvas:active {
  cursor: grabbing;
}

/* Splash / title card */
#splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(200, 16, 46, 0.24), transparent 70%),
    linear-gradient(165deg, #16060d 0%, #09112b 48%, #030712 100%);
  transition: opacity 0.9s ease, visibility 0.9s ease;
  cursor: pointer;
}

#splash.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-card {
  text-align: center;
  padding: 0 24px;
  animation: splash-rise 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes splash-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.splash-crest {
  font-size: 3.4rem;
  line-height: 1;
  margin-bottom: 1.1rem;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.65));
  animation: splash-fade 0.9s ease-out 0.05s both;
}

.splash-title {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2rem, 6.4vw, 3.6rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
  background: linear-gradient(180deg, #fff8e6 0%, #fbbf24 55%, #b45309 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 30px rgba(251, 191, 36, 0.22);
  animation: splash-fade 0.9s ease-out 0.15s both;
}

.splash-rule {
  width: min(240px, 60vw);
  height: 1px;
  margin: 1.15rem auto 1rem;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.78), transparent);
  animation: splash-widen 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

@keyframes splash-widen {
  from { opacity: 0; transform: scaleX(0.2); }
  to   { opacity: 1; transform: none; }
}

.splash-tagline {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.56);
  animation: splash-fade 0.9s ease-out 0.45s both;
}

.splash-credit {
  margin-top: 2.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  animation: splash-fade 1s ease-out 0.7s both;
}

.splash-by {
  font-size: 0.62rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
}

.splash-author {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.12rem;
  letter-spacing: 0.16em;
  color: rgba(255, 246, 227, 0.92);
}

.splash-version {
  margin-top: 1.5rem;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ffd166;
  background: rgba(0, 0, 0, 0.55);
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 209, 102, 0.45);
  display: inline-block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  animation: splash-fade 1s ease-out 0.9s both;
}

@keyframes splash-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .splash-card,
  .splash-crest,
  .splash-title,
  .splash-rule,
  .splash-tagline,
  .splash-credit,
  .splash-version {
    animation: none;
  }
}

/* Loading Screen */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1a0915 0%, #060d22 65%, #02050d 100%);
  transition: opacity 0.6s ease;
}

#loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.load-crest {
  font-size: 13px;
  letter-spacing: 0.28em;
  color: var(--gold);
  font-weight: 800;
  margin-bottom: 10px;
}

.load-title {
  font-size: clamp(24px, 3.6vw, 42px);
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  text-align: center;
}

.load-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.load-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: var(--lfc-red);
  animation: spin 0.85s linear infinite;
  margin-bottom: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-status {
  font-size: 13px;
  color: #cbd5e1;
}

/* HUD Shell */
#hud-shell {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 18px;
}

#hud-shell.hud-minimal .hideable-hud {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.hideable-hud {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

/* Broadcast Scorebug (2018-19 UEFA Champions League aesthetic) */
.scorebug-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: auto;
}

.scorebug {
  display: inline-flex;
  align-items: stretch;
  width: fit-content;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 197, 255, 0.22);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.ucl-star-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: linear-gradient(145deg, #091844 0%, #1d4ed8 100%);
  font-size: 15px;
  color: #f8fafc;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.team-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.06em;
}

.team-liv {
  background: linear-gradient(90deg, rgba(158, 11, 28, 0.95), rgba(158, 11, 28, 0.68));
  border-right: 1px solid rgba(255,255,255,0.14);
}

.team-swatch-liv {
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: #fef08a;
}

.team-bar {
  background: linear-gradient(90deg, rgba(15, 23, 52, 0.92), rgba(21, 30, 62, 0.78));
  border-left: 1px solid rgba(255,255,255,0.14);
}

.team-bar .team-swatch {
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--barca-volt);
}

.score-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.38);
  border-radius: 4px;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.clock-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: linear-gradient(180deg, #0d1a3d, #071026);
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: #e2e8f0;
  min-width: 64px;
}

.sub-score-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: nowrap;
}

#agg-pill {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #cbd5e1;
  backdrop-filter: blur(8px);
}

#agg-pill.agg-lead {
  background: linear-gradient(90deg, rgba(200, 16, 46, 0.92), rgba(180, 83, 9, 0.88));
  border-color: rgba(251, 191, 36, 0.72);
  color: #fffbeb;
  box-shadow: 0 0 14px rgba(200, 16, 46, 0.4);
}

#live-cam-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 15, 36, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: #bae6fd;
  backdrop-filter: blur(8px);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.9);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

#anfield-meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
  margin-left: 4px;
  padding-left: 6px;
  border-left: 1px solid rgba(148, 197, 255, 0.28);
}

#anfield-meter span {
  display: block;
  width: 2.5px;
  height: 11px;
  border-radius: 1px;
  background: #38bdf8;
  transform-origin: bottom;
  transform: scaleY(0.5);
  transition: transform 0.14s ease, background-color 0.2s ease;
}

#live-cam-pill.roar-hot #anfield-meter span {
  background: #fbbf24;
}

#bullettime-badge {
  display: none;
  background: rgba(8, 22, 48, 0.90);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.72);
  color: #7dd3fc;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

#bullettime-badge.visible {
  display: inline-block;
}

/* Top-Right Chapter Card, Moment Callout & Tactical Panel */
.top-right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}

.chapter-card {
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: 460px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 197, 255, 0.18);
  border-radius: 9px;
  padding: 8px 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.ch-badge {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 5px;
  background: #334155;
  color: #ffffff;
}

.ch-badge.kind-goal {
  background: linear-gradient(135deg, #c8102e, #b45309);
}

.ch-badge.kind-save {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
}

.ch-badge.kind-fulltime {
  background: linear-gradient(135deg, #ca8a04, #991b1b);
}

.ch-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#chapter-title {
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.2;
}

#chapter-sub {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.25;
}

/* Compact UCL Player / Moment Callout Pill */
#callout-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(345px, 27vw);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(7, 17, 42, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.36);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

#callout-pill.visible {
  opacity: 1;
  transform: translateY(0);
}

#callout-pill.kind-ynwa {
  background: linear-gradient(90deg, rgba(158, 11, 28, 0.88), rgba(146, 64, 14, 0.84));
  border-color: rgba(251, 191, 36, 0.65);
}

#callout-pill.kind-save {
  border-color: rgba(56, 189, 248, 0.68);
}

#callout-pill.kind-corner {
  background: linear-gradient(90deg, rgba(14, 29, 70, 0.92), rgba(158, 11, 28, 0.88));
  border-color: rgba(251, 191, 36, 0.6);
}

#callout-tag {
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fde047;
  white-space: nowrap;
  flex-shrink: 0;
}

#callout-text {
  font-size: 11px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tactical-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

#tactical-panel.visible {
  display: flex;
}

#minimap-canvas {
  display: block;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.16);
}

.tactical-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  text-align: center;
}

.stat-box {
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 4px 6px;
}

.stat-lbl {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-val {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
}

/* Authentic 2018-19 UCL Broadcast Goal Banner Plate */
#goal-banner {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: stretch;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(8, 19, 52, 0.95), rgba(15, 29, 72, 0.94));
  border: 1px solid rgba(254, 240, 138, 0.68);
  box-shadow: 0 14px 44px rgba(200, 16, 46, 0.48), 0 0 0 1px rgba(200, 16, 46, 0.35);
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 16;
}

#goal-banner.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.goal-crest-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #b90c22 0%, #c8102e 65%, #b45309 100%);
  border-right: 2px solid rgba(254, 240, 138, 0.8);
}

.goal-kicker {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fef08a;
  white-space: nowrap;
}

.goal-num {
  font-size: 17px;
  font-weight: 900;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.28);
  padding: 2px 7px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.goal-banner-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7px 18px 7px 14px;
  gap: 1px;
}

#goal-banner-text {
  font-size: 15.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #ffffff;
  white-space: nowrap;
}

#goal-banner-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #fde68a;
  white-space: nowrap;
}

/* Bottom Controls & Captions */
.bottom-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

#caption-wrap {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(4, 9, 20, 0.86);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  padding: 6px 15px;
  max-width: min(740px, calc(100vw - 240px));
}

#caption-wrap.visible {
  opacity: 1;
  transform: translateY(0);
}

#caption-wrap.speaker-only {
  padding: 5px 10px;
}

#caption-wrap.speaker-only #caption-text {
  display: none;
}

#speaker-badge {
  display: none;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

#speaker-badge.visible {
  display: inline-flex;
}

#speaker-badge.speaker-lead {
  background: linear-gradient(135deg, rgba(158, 11, 28, 0.94), rgba(180, 83, 9, 0.88));
  border: 1px solid rgba(251, 191, 36, 0.75);
  color: #fffbeb;
  box-shadow: 0 0 14px rgba(200, 16, 46, 0.38);
}

#speaker-badge.speaker-cocomm {
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.92), rgba(29, 78, 216, 0.88));
  border: 1px solid rgba(56, 189, 248, 0.78);
  color: #e0f2fe;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.34);
}

.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}

.eq-bars span {
  display: block;
  width: 2.5px;
  height: 10px;
  border-radius: 1.5px;
  background: currentColor;
  transform-origin: bottom;
  animation: eq-bounce 0.76s ease-in-out infinite;
}

.eq-bars span:nth-child(2) {
  animation-delay: 0.18s;
}

.eq-bars span:nth-child(3) {
  animation-delay: 0.36s;
}

#caption-wrap.paused .eq-bars span {
  animation-play-state: paused;
  transform: scaleY(0.45);
}

@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.32); opacity: 0.72; }
  50% { transform: scaleY(1.0); opacity: 1; }
}

#caption-text {
  font-size: 13.5px;
  font-weight: 600;
  color: #f1f5f9;
  text-align: center;
}

.control-deck {
  width: min(1180px, 96vw);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(148, 197, 255, 0.16);
  border-radius: 11px;
  padding: 7px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

#chapter-strip {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
}

.ch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 2px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(12, 20, 42, 0.74);
  color: #cbd5e1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.ch-btn:hover {
  background: rgba(25, 38, 68, 0.95);
  border-color: rgba(255,255,255,0.28);
}

.ch-btn .ch-num {
  font-size: 10.5px;
  font-weight: 900;
}

.ch-btn .ch-tag {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  opacity: 0.92;
}

.ch-btn.kind-goal { border-bottom: 2px solid var(--lfc-red); }
.ch-btn.kind-save { border-bottom: 2px solid var(--ucl-cyan); }
.ch-btn.kind-fulltime { border-bottom: 2px solid var(--gold); }

.ch-btn.active {
  background: rgba(200, 16, 46, 0.88);
  border-color: rgba(255, 255, 255, 0.7);
  color: #ffffff;
}

.ch-btn.kind-save.active {
  background: rgba(2, 132, 199, 0.88);
}

.ch-btn.kind-fulltime.active {
  background: linear-gradient(135deg, #ca8a04, #991b1b);
}

.transport-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.pill-btn {
  background: rgba(24, 36, 62, 0.86);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.pill-btn:hover {
  background: rgba(44, 62, 98, 0.96);
  border-color: rgba(255,255,255,0.35);
}

.pill-btn.active {
  background: var(--lfc-red);
  border-color: rgba(255,255,255,0.65);
  color: #ffffff;
}

.cam-btn.active {
  background: #0284c7;
}

#btn-atmosphere.mode-roar {
  background: linear-gradient(135deg, #c8102e, #b45309);
  border-color: rgba(251, 191, 36, 0.72);
}

#timeline-scrubber {
  flex: 1;
  min-width: 110px;
  accent-color: var(--lfc-red);
  cursor: pointer;
}

#time-readout {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  min-width: 78px;
  text-align: right;
}

.tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

#camera-strip, .utility-strip, .speed-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

#btn-hud-toggle {
  position: fixed;
  bottom: 142px;
  right: 18px;
  z-index: 25;
  pointer-events: auto;
  opacity: 0.78;
}

#btn-hud-toggle:hover {
  opacity: 1;
}
