/* SE.Scoreboard — atriles de concurso + podio. Solo tokens --se-* (con fallback). Prefijo .sb- */

/* ================= MARCADOR (franja inferior ~1920x260) ================= */
.sb-board {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
  width: 100%;
  height: 100%;
  padding: 0 28px 18px;
  box-sizing: border-box;
  font-family: var(--se-font-body, system-ui, sans-serif);
  color: var(--se-white, #fff);
}

.sb-team {
  --sb-color: var(--se-purple-light, #7B2FF7);
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 420px;
  display: grid;
  grid-template-rows: 86px 1fr;
  will-change: transform;
}

/* ---------- zona sobre el atril: ficha + tarjeta ---------- */
.sb-team__top {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  padding-bottom: 6px;
  pointer-events: none;
}

/* Ficha de casino */
.sb-chip {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: repeating-conic-gradient(var(--se-white, #fff) 0 15deg, var(--sb-color) 15deg 45deg);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35), inset 0 0 0 4px rgba(0, 0, 0, .18);
  opacity: 0;
  transform: translateY(-40px);
}
.sb-chip::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: var(--sb-color);
  border: 3px dashed rgba(255, 255, 255, .85);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .35);
}
.sb-chip__amt {
  position: relative;
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 19px;
  line-height: 1;
  color: var(--se-white, #fff);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .45);
  white-space: nowrap;
}
.sb-chip--allin {
  background: repeating-conic-gradient(var(--se-yellow, #FFE84D) 0 15deg, var(--se-bad, #FF4D6D) 15deg 45deg);
}
.sb-chip--allin::before { background: var(--se-ink, #1A0B3B); }
.sb-chip--allin .sb-chip__amt { font-size: 15px; color: var(--se-yellow, #FFE84D); }
.sb-chip--in { animation: sb-chip-drop .95s cubic-bezier(.2, .7, .3, 1) both; }

@keyframes sb-chip-drop {
  0%   { opacity: 0; transform: translateY(-170px) rotate(-260deg) scale(.7); }
  50%  { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
  64%  { transform: translateY(-26px) rotate(0); }
  78%  { transform: translateY(0); }
  88%  { transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Tarjeta con la letra (flip 3D) */
.sb-card {
  width: 58px;
  height: 76px;
  perspective: 600px;
  opacity: 0;
  transform: translateY(-30px);
}
.sb-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.4, 1.6, .5, 1);
  transition-delay: var(--sb-flip-delay, 0ms);
}
.sb-card__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 44px;
  line-height: 1;
  border: 3px solid var(--se-white, #fff);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .3);
}
.sb-card__face--back {
  color: var(--se-yellow, #FFE84D);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .12) 0 6px, transparent 6px 12px),
    var(--se-purple-dark, #3D0590);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .4);
}
.sb-card__face--front {
  transform: rotateY(180deg);
  color: var(--sb-color);
  background: var(--se-white, #fff);
  -webkit-text-stroke: 1px rgba(0, 0, 0, .25);
}
.sb-card--none .sb-card__face--front { color: rgba(0, 0, 0, .35); background: #d9d4e6; }
.sb-card--in { animation: sb-card-in .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.sb-card--flipped .sb-card__inner { transform: rotateY(180deg); }

@keyframes sb-card-in {
  0%   { opacity: 0; transform: translateY(-60px) rotate(-12deg); }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}

/* ---------- el atril ---------- */
.sb-team__desk {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  padding: 20px 16px 14px;
  border-radius: 24px 24px 12px 12px;
  border: 4px solid rgba(255, 255, 255, .9);
  background: var(--sb-color);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 38%, rgba(0, 0, 0, .28)),
    var(--sb-color);
  box-shadow: var(--se-shadow, 0 10px 0 rgba(0, 0, 0, .25));
  transition: box-shadow .35s ease, border-color .35s ease;
}
/* base del atril */
.sb-team__desk::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -14px;
  height: 10px;
  border-radius: 0 0 10px 10px;
  background: rgba(0, 0, 0, .35);
}

.sb-team__lights {
  position: absolute;
  top: 6px;
  left: 18px;
  right: 18px;
  height: 8px;
  background: radial-gradient(circle, var(--se-yellow, #FFE84D) 0 3px, transparent 3.5px) 0 50% / 18px 8px repeat-x;
  opacity: .55;
}
.sb-team--leader .sb-team__lights { opacity: 1; animation: sb-blink .8s steps(2) infinite; }

@keyframes sb-blink { 50% { filter: brightness(.45); } }

.sb-team__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sb-team__pos {
  flex: none;
  padding: 2px 10px;
  border-radius: var(--se-radius-pill, 999px);
  background: var(--se-white, #fff);
  color: var(--se-ink, #1A0B3B);
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 18px;
}
.sb-team__name {
  flex: 1;
  min-width: 0;
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 26px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}

.sb-team__screen {
  display: grid;
  place-items: center;
  padding: 2px 8px;
  border-radius: 14px;
  background: var(--se-ink, #1A0B3B);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, .6), 0 0 0 3px rgba(0, 0, 0, .25);
  transition: filter .4s ease;
}
.sb-team__money {
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 52px;
  line-height: 1.08;
  color: var(--se-yellow, #FFE84D);
  text-shadow: 0 0 14px rgba(255, 232, 77, .55);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sb-team__money--bump { animation: sb-bump .5s ease; }
@keyframes sb-bump { 40% { transform: scale(1.14); } }

.sb-team__bar {
  height: 12px;
  border-radius: var(--se-radius-pill, 999px);
  background: rgba(0, 0, 0, .32);
  overflow: hidden;
}
.sb-team__bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--se-gold, #FFB020), var(--se-yellow, #FFE84D));
  transition: width .9s cubic-bezier(.3, 1.2, .5, 1);
}

/* Corona del líder */
.sb-team__crown {
  position: absolute;
  top: -28px;
  left: -12px;
  font-size: 44px;
  line-height: 1;
  transform: scale(0) rotate(-60deg);
  transition: transform .45s cubic-bezier(.3, 1.8, .5, 1);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35));
  z-index: 2;
}
.sb-team--leader .sb-team__crown { transform: scale(1) rotate(-22deg); }
.sb-team--leader .sb-team__desk { border-color: var(--se-yellow, #FFE84D); }

/* Resultados */
.sb-team--ok .sb-team__desk {
  border-color: var(--se-ok, #2EE59D);
  box-shadow: 0 0 0 4px var(--se-ok, #2EE59D), 0 0 46px 6px var(--se-ok, #2EE59D);
  animation: sb-glow .7s ease-in-out 3 alternate;
}
.sb-team--bad .sb-team__desk {
  border-color: var(--se-bad, #FF4D6D);
  box-shadow: 0 0 0 4px var(--se-bad, #FF4D6D), 0 0 46px 6px var(--se-bad, #FF4D6D);
}
.sb-team--shake .sb-team__desk { animation: sb-shake .5s ease; }

@keyframes sb-glow { to { filter: brightness(1.25); } }
@keyframes sb-shake {
  15%, 55% { transform: translateX(-9px) rotate(-1deg); }
  35%, 75% { transform: translateX(9px) rotate(1deg); }
}

/* Bancarrota */
.sb-team__bankrupt {
  position: absolute;
  left: 50%;
  top: 54%;
  z-index: 3;
  padding: 4px 14px;
  border: 4px solid var(--se-bad, #FF4D6D);
  border-radius: 10px;
  background: rgba(26, 11, 59, .85);
  color: var(--se-bad, #FF4D6D);
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 30px;
  letter-spacing: 2px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-12deg) scale(2.4);
}
.sb-team--bankrupt .sb-team__bankrupt {
  animation: sb-stamp .55s cubic-bezier(.2, 1.4, .5, 1) both, sb-flicker 1.4s 1s ease-in-out infinite;
}
.sb-team--bankrupt .sb-team__screen { filter: grayscale(1) brightness(.6); }

@keyframes sb-stamp {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(-30deg) scale(2.6); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
}
@keyframes sb-flicker { 50% { color: var(--se-yellow, #FFE84D); border-color: var(--se-yellow, #FFE84D); } }

/* Delta flotante (solo si SE.FX.floatDelta no existe) */
.sb-delta {
  position: absolute;
  left: 50%;
  top: 30%;
  z-index: 4;
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 40px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .45);
  pointer-events: none;
  animation: sb-float 1.6s ease-out forwards;
}
.sb-delta--up { color: var(--se-ok, #2EE59D); }
.sb-delta--down { color: var(--se-bad, #FF4D6D); }
@keyframes sb-float {
  0%   { opacity: 0; transform: translate(-50%, 10px) scale(.6); }
  20%  { opacity: 1; transform: translate(-50%, -10px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -110px) scale(1); }
}

/* Escala por nº de equipos */
.sb-board[data-count="5"] .sb-team__money,
.sb-board[data-count="6"] .sb-team__money { font-size: 44px; }
.sb-board[data-count="6"] .sb-team__name { font-size: 22px; }
.sb-board[data-count="6"] { gap: 14px; }

/* ================= PODIO ================= */
.sb-podium {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 36px 40px 30px;
  box-sizing: border-box;
  font-family: var(--se-font-body, system-ui, sans-serif);
  color: var(--se-white, #fff);
  opacity: 0;
  transition: opacity .6s ease;
  overflow: hidden;
}
.sb-podium.is-in { opacity: 1; }

.sb-podium__title {
  margin: 0 0 12px;
  padding: 8px 44px;
  border-radius: var(--se-radius-pill, 999px);
  background: var(--se-yellow, #FFE84D);
  color: var(--se-purple-dark, #3D0590);
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 64px;
  font-weight: normal;
  box-shadow: var(--se-shadow, 0 10px 0 rgba(0, 0, 0, .25));
  transform: translateY(-30px) scale(.8);
  transition: transform .6s cubic-bezier(.3, 1.6, .5, 1);
}
.sb-podium.is-in .sb-podium__title { transform: none; }

.sb-podium__stage {
  flex: 1;
  min-height: 0;
  width: min(1400px, 94%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 28px;
}

.sb-podium__col {
  --sb-color: var(--se-purple-light, #7B2FF7);
  position: relative;
  flex: 0 1 360px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sb-podium__step {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 22px 22px 0 0;
  border: 5px solid rgba(255, 255, 255, .9);
  border-bottom: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, .3)),
    var(--sb-color);
  box-shadow: inset 0 -20px 40px rgba(0, 0, 0, .25);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .9s cubic-bezier(.3, 1.4, .5, 1), box-shadow .4s ease;
}
.sb-podium__col--p1 .sb-podium__step { height: 44%; transition-delay: .3s; }
.sb-podium__col--p2 .sb-podium__step { height: 32%; transition-delay: .15s; }
.sb-podium__col--p3 .sb-podium__step { height: 22%; }
.sb-podium.is-steps .sb-podium__step { transform: scaleY(1); }

.sb-podium__num {
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 96px;
  line-height: 1;
  color: rgba(255, 255, 255, .85);
  text-shadow: 0 6px 0 rgba(0, 0, 0, .3);
}

.sb-podium__col.is-pending .sb-podium__step { animation: sb-pending .5s ease-in-out infinite alternate; }
@keyframes sb-pending { to { box-shadow: inset 0 -20px 40px rgba(0, 0, 0, .25), 0 0 50px 8px var(--se-yellow, #FFE84D); } }

.sb-podium__team {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 14px;
  text-align: center;
  opacity: 0;
  transform: translateY(-80px) scale(.4);
  transition: opacity .35s ease, transform .75s cubic-bezier(.3, 1.7, .5, 1);
}
.sb-podium__col.is-revealed .sb-podium__team { opacity: 1; transform: none; }

.sb-podium__badge {
  font-size: 76px;
  line-height: 1;
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, .3));
}
.sb-podium__col--p1 .sb-podium__badge { font-size: 120px; }
.sb-podium__col--p1.is-revealed .sb-podium__badge { animation: sb-trophy 1.6s ease-in-out .6s infinite; }
@keyframes sb-trophy {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50%      { transform: rotate(6deg) scale(1.08); }
}

.sb-podium__name {
  max-width: 100%;
  margin-top: 6px;
  padding: 4px 22px;
  border-radius: var(--se-radius-pill, 999px);
  background: var(--sb-color);
  border: 4px solid var(--se-white, #fff);
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 38px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.sb-podium__money {
  margin-top: 6px;
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 56px;
  line-height: 1;
  color: var(--se-yellow, #FFE84D);
  text-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 0 22px rgba(255, 232, 77, .5);
  font-variant-numeric: tabular-nums;
}
.sb-podium__col--p1 .sb-podium__name { font-size: 46px; }
.sb-podium__col--p1 .sb-podium__money { font-size: 72px; }

/* Rayos tras el ganador */
.sb-podium__rays {
  position: absolute;
  left: 50%;
  bottom: 30%;
  width: 760px;
  height: 760px;
  margin-left: -380px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 232, 77, .28) 0 10deg, transparent 10deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%);
  mask: radial-gradient(circle, #000 20%, transparent 68%);
  opacity: 0;
  transform: scale(.3);
  transition: opacity .8s ease, transform 1s cubic-bezier(.3, 1.4, .5, 1);
  pointer-events: none;
}
.sb-podium__col--p1.is-revealed .sb-podium__rays {
  opacity: 1;
  transform: scale(1);
  animation: sb-spin 14s linear infinite;
}
@keyframes sb-spin { to { rotate: 360deg; } }

/* Resto de equipos */
.sb-podium__rest {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 22px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.sb-podium__rest-item {
  --sb-color: var(--se-purple-light, #7B2FF7);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 20px 6px 8px;
  border-radius: var(--se-radius-pill, 999px);
  background: var(--sb-color);
  border: 3px solid var(--se-white, #fff);
  font-family: var(--se-font-title, system-ui, sans-serif);
  font-size: 28px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .25);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .4s ease, transform .5s cubic-bezier(.3, 1.6, .5, 1);
  transition-delay: calc(var(--sb-i, 0) * 140ms);
}
.sb-podium.is-rest .sb-podium__rest-item { opacity: 1; transform: none; }
.sb-podium__rest-pos {
  padding: 2px 12px;
  border-radius: var(--se-radius-pill, 999px);
  background: var(--se-white, #fff);
  color: var(--se-ink, #1A0B3B);
}
.sb-podium__rest-money { color: var(--se-yellow, #FFE84D); }

/* ================= Movimiento reducido ================= */
@media (prefers-reduced-motion: reduce) {
  .sb-chip--in,
  .sb-card--in,
  .sb-team__money--bump,
  .sb-team--ok .sb-team__desk,
  .sb-team--shake .sb-team__desk,
  .sb-team--leader .sb-team__lights,
  .sb-podium__col.is-pending .sb-podium__step,
  .sb-podium__col--p1.is-revealed .sb-podium__badge,
  .sb-podium__col--p1.is-revealed .sb-podium__rays {
    animation: none;
  }
  .sb-chip--in, .sb-card--in { opacity: 1; transform: none; }
  .sb-team--bankrupt .sb-team__bankrupt {
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-12deg);
  }
  .sb-delta { animation-duration: .8s; }
  .sb-card__inner,
  .sb-podium__step,
  .sb-podium__team,
  .sb-podium__rest-item,
  .sb-podium__title,
  .sb-podium__rays {
    transition-duration: .2s;
    transition-delay: 0s;
  }
}
