:root {
  --home-color: #e11d48;
  --away-color: #2563eb;
  --flash-color: #f59e0b;
  --alert-accent: #38bdf8;
  --alert-glow: rgba(56, 189, 248, 0.35);
}

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

html, body {
  width: 100%;
  height: 100%;
  background: transparent !important;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Lienzo vertical 9:16 con container-queries para escalado idéntico en OBS (1080x1920) y preview */
.stage {
  position: relative;
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  background: transparent;
  container-type: inline-size;
  pointer-events: none;
}

/* Posicionado en zona segura superior de TikTok LIVE (debajo del perfil/espectadores) */
.hud {
  position: absolute;
  top: 12.5%;
  left: 0;
  right: 0;
  padding: 0 4.5cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Cápsula deportiva de alto contraste --- */
.capsule {
  position: relative;
  width: 100%;
  border-radius: 4cqw;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(13, 18, 30, 0.96) 0%, rgba(7, 10, 18, 0.98) 100%);
  border: 0.38cqw solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 2.2cqw 6cqw rgba(0, 0, 0, 0.62),
    inset 0 0.25cqw 0 rgba(255, 255, 255, 0.14);
}

.capsule-main {
  display: grid;
  grid-template-columns: 2.6cqw 1fr auto 1fr 2.6cqw;
  align-items: stretch;
  min-height: 15.5cqw;
}

.team-stripe {
  width: 100%;
  transition: background-color 0.3s ease;
}

.stripe-home {
  background: var(--home-color);
  box-shadow: 0.8cqw 0 2.6cqw color-mix(in srgb, var(--home-color) 55%, transparent);
}

.stripe-away {
  background: var(--away-color);
  box-shadow: -0.8cqw 0 2.6cqw color-mix(in srgb, var(--away-color) 55%, transparent);
}

.team-abbr {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6.8cqw;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f8fafc;
  text-shadow: 0 0.4cqw 1.2cqw rgba(0, 0, 0, 0.7);
  padding: 0 2cqw;
}

.score-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.2cqw;
  padding: 0 4.2cqw;
  background: rgba(255, 255, 255, 0.07);
  border-left: 0.28cqw solid rgba(255, 255, 255, 0.1);
  border-right: 0.28cqw solid rgba(255, 255, 255, 0.1);
}

.score-digit {
  font-size: 8.6cqw;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  min-width: 5.2cqw;
  text-align: center;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), color 0.25s ease;
}

.score-digit.pop {
  transform: scale(1.3);
  color: #fde047;
}

.score-dash {
  font-size: 5.5cqw;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.4);
  transform: translateY(-0.4cqw);
}

/* Fila de periodo + cronómetro MM:SS (+ añadido) */
.capsule-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.2cqw;
  padding: 1.8cqw 3.4cqw;
  background: rgba(255, 255, 255, 0.05);
  border-top: 0.28cqw solid rgba(255, 255, 255, 0.1);
}

.live-dot {
  width: 2cqw;
  height: 2cqw;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 1.8cqw #22c55e;
  animation: pulseDot 1.3s ease-in-out infinite;
}

.live-dot.paused {
  background: #94a3b8;
  box-shadow: none;
  animation: none;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.period-pill {
  background: rgba(255, 255, 255, 0.14);
  border: 0.22cqw solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  font-size: 3.2cqw;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 0.45cqw 2cqw;
  border-radius: 1.4cqw;
}

.clock-main {
  font-size: 4.5cqw;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.clock-added {
  font-size: 3.8cqw;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #0b101d;
  background: #facc15;
  padding: 0.35cqw 1.8cqw;
  border-radius: 1.4cqw;
  letter-spacing: 0.03em;
  box-shadow: 0 0 2cqw rgba(250, 204, 21, 0.45);
}

/* --- Destello animado de GOL sobre la cápsula --- */
.goal-flash {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    110deg,
    color-mix(in srgb, var(--flash-color) 92%, #000) 0%,
    #f59e0b 48%,
    #22c55e 100%
  );
  opacity: 0;
  pointer-events: none;
  transform: scale(1.06);
}

.goal-flash.active {
  animation: goalFlashAnim 2.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.goal-flash-text {
  font-size: 9cqw;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0.6cqw 2.4cqw rgba(0, 0, 0, 0.65);
}

@keyframes goalFlashAnim {
  0%   { opacity: 0; transform: scale(1.08); }
  12%  { opacity: 1; transform: scale(1); }
  78%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.98); }
}

/* --- Alerta temporal desplegable integrada debajo del marcador --- */
.alert-slot {
  width: 96%;
  overflow: hidden;
  padding-top: 1.6cqw;
}

.alert-card {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: 3cqw;
  overflow: hidden;
  background: rgba(10, 15, 26, 0.95);
  border: 0.38cqw solid var(--alert-accent);
  box-shadow:
    0 1.8cqw 4.5cqw rgba(0, 0, 0, 0.6),
    0 0 3.4cqw var(--alert-glow);
  opacity: 0;
  transform: translateY(-120%);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.alert-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.alert-accent {
  width: 2.2cqw;
  background: var(--alert-accent);
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
  padding: 2.4cqw 3.2cqw;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.alert-text {
  font-size: 3.7cqw;
  font-weight: 800;
  line-height: 1.25;
  color: #f8fafc;
  letter-spacing: 0.01em;
  text-shadow: 0 0.25cqw 0.9cqw rgba(0, 0, 0, 0.65);
}

.alert-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.7cqw;
  background: var(--alert-accent);
  transform-origin: left center;
  transform: scaleX(0);
}

/* Paletas por tipo de evento */
.alert-card.style-goal {
  --alert-accent: #22c55e;
  --alert-glow: rgba(34, 197, 94, 0.45);
  border-color: #f59e0b;
}

.alert-card.style-goal .alert-accent,
.alert-card.style-goal .alert-progress {
  background: linear-gradient(90deg, #f59e0b, #22c55e);
}

.alert-card.style-yellow {
  --alert-accent: #facc15;
  --alert-glow: rgba(250, 204, 21, 0.42);
}

.alert-card.style-red {
  --alert-accent: #ef4444;
  --alert-glow: rgba(239, 68, 68, 0.48);
}

.alert-card.style-sub {
  --alert-accent: #10b981;
  --alert-glow: rgba(16, 185, 129, 0.35);
}

.alert-card.style-manual-orange {
  --alert-accent: #f97316;
  --alert-glow: rgba(249, 115, 22, 0.42);
}

.alert-card.style-manual-blue {
  --alert-accent: #38bdf8;
  --alert-glow: rgba(56, 189, 248, 0.42);
}

.hidden {
  display: none !important;
}
