/* Farb-/Typografie-Tokens, gespiegelt aus constants/theme.ts (App). */
:root {
  --primary: #590976;
  --primary-light: #7a1f9c;
  --primary-ultra-light: #c77dff;
  --secondary: #009c03;
  --secondary-light: #00c204;
  --background: #121212;
  --card: #1e1e1e;
  --card-border: #2d2d2d;
  --text: #f8f9fa;
  --secondary-text: #adb5bd;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Montserrat', 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 140% at 50% -10%, var(--primary-light) 0%, var(--background) 60%);
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */

#top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 32px;
  background: rgba(18, 18, 18, 0.55);
  border-bottom: 1px solid rgba(199, 125, 255, 0.2);
}

#top-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

#top-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  line-height: 1.2;
}

#top-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

#top-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-ultra-light);
}

#connection-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--card-border);
  font-size: 12px;
  font-weight: 600;
}

#connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--secondary-text);
}

#connection-badge.connected #connection-dot {
  background: var(--secondary-light);
  box-shadow: 0 0 8px var(--secondary-light);
}

/* ── Field ───────────────────────────────────────────────────────────────── */

#field-wrap {
  position: relative;
  flex: 1;
  margin: 18px 32px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(199, 125, 255, 0.2);
}

#field-canvas,
#draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.25s ease;
}

#draw-canvas {
  pointer-events: none;
}

#field-canvas.fading {
  opacity: 0.4;
}

#step-banner {
  position: absolute;
  top: 20px;
  left: 20px;
  max-width: 60%;
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(89, 9, 118, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#step-banner.hidden {
  display: none;
}

#step-title {
  font-size: 20px;
  font-weight: 700;
}

#step-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: var(--primary-ultra-light);
}

#live-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(211, 47, 47, 0.85);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

#live-badge.hidden {
  display: none;
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

#step-indicator {
  position: absolute;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(89, 9, 118, 0.85);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

#step-indicator.hidden {
  display: none;
}

/* ── Legend ──────────────────────────────────────────────────────────────── */
/* Kompaktes Overlay unten links im Feld-Rahmen, nur sichtbar wenn relevant
   (Team B im Spiel und/oder Pfeile vorhanden) — hält die Ansicht sonst leer. */

#legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(18, 18, 18, 0.55);
  backdrop-filter: blur(4px);
  font-size: 12px;
  font-weight: 600;
  color: var(--secondary-text);
}

#legend.hidden {
  display: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--text);
}

.legend-team-b {
  background: var(--secondary);
}

.legend-line {
  width: 22px;
  height: 0;
  border-top: 3px solid var(--text);
}

.legend-line-run {
  border-top-style: dashed;
}

/* ── Idle overlay ────────────────────────────────────────────────────────── */

#idle-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(120% 140% at 50% 30%, var(--primary-light) 0%, var(--background) 65%);
}

#idle-overlay.hidden {
  display: none;
}

#idle-logo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

#idle-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#idle-subtitle {
  font-size: 20px;
  font-weight: 500;
  color: var(--primary-ultra-light);
}
