/* podium.css — built to be photographed. The compatibility ring is literally
   made of the room's colours: the score is the people who produced it. */

.podium__body {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--gap-xl);
}

/* --- Compatibility ring --- */

.compat {
  display: grid;
  justify-items: center;
  gap: 1rem;
}

.compat__ring {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(14rem, 26vh, 22rem);
  aspect-ratio: 1;
  border-radius: 50%;
  /* --arc is the swept gradient built from the players in the room. */
  background: var(--arc, conic-gradient(var(--hot) 0turn, var(--line) 0turn));
  mask: radial-gradient(circle, transparent 61%, #000 62%);
  -webkit-mask: radial-gradient(circle, transparent 61%, #000 62%);
}

.compat__hole {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.2rem;
  mask: none;
  -webkit-mask: none;
}

.compat__wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.compat__value {
  font-size: clamp(3.4rem, 7vw, 6.4rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.compat__value sup {
  font-size: 0.42em;
  vertical-align: super;
  color: var(--ink-dim);
}

.compat__label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
  max-width: 12ch;
  text-align: center;
}

/* --- The three --- */

.podium__ranks {
  display: grid;
  gap: var(--gap);
}

/* The stage floor the plinths stand on. */
.top3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 1.4rem;
  border-bottom: 1px solid var(--line);
}

/* DOM order stays 1-2-3 for screen readers; the plinths sit 2-1-3 on screen. */
.rank--1 {
  order: 2;
}

.rank--2 {
  order: 1;
}

.rank--3 {
  order: 3;
}

.rank {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  text-align: center;
}

.rank .avatar {
  --size: 6.4rem;
}

.rank--1 .avatar {
  --size: 8.6rem;
}

.rank__place {
  width: 2rem;
  height: 2rem;
  font-size: 0.95rem;
  color: var(--who, var(--ink));
}

.rank__name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.rank--1 .rank__name {
  font-size: 1.9rem;
}

/* The title is the keepsake: the one line a player screenshots for themselves */
.rank__title {
  font-size: 1.05rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--who, var(--gold));
}

.rank__votes {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.rank__plinth {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--who) 55%, transparent), transparent);
  border-top: 0.22rem solid var(--who);
  height: 2.2rem;
  margin-top: 0.4rem;
}

.rank--1 .rank__plinth {
  height: 4.4rem;
}

.rank--2 .rank__plinth {
  height: 3.1rem;
}

/* --- Duo: the duel ---
   Two players are not a ranking. They are a face-off: same size stage, the
   scoreboard on the centre line and one verdict underneath both. */

.podium__ranks.is-duo {
  align-content: center;
  gap: var(--gap-sm);
}

/* The header climbs above the duel; the leftover-players list is empty here. */
.podium__ranks.is-duo .eyebrow {
  order: -1;
  justify-self: center;
  font-size: 1.05rem;
  color: var(--ink-dim);
}

.duel {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(0.8rem, 3vw, 2.6rem);
}

.duel__side {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  text-align: center;
  perspective: 900px;
}

/* Each half of the stage is lit by its own player. */
.duel__side::before {
  content: "";
  position: absolute;
  inset: -10% -6% 0;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(
    52% 44% at 50% 40%,
    color-mix(in srgb, var(--who) 26%, transparent),
    transparent 72%
  );
}

.duel__side .avatar {
  --size: clamp(8rem, 17vh, 12.4rem);
  box-shadow:
    0 0 0 0.22rem var(--bg),
    0 0 0 0.44rem var(--who),
    0 0 2.8rem color-mix(in srgb, var(--who) 45%, transparent),
    0 1.2rem 2.8rem rgb(0 0 0 / 0.6);
}

.duel__side--a .avatar {
  transform: rotateY(13deg);
}

.duel__side--b .avatar {
  transform: rotateY(-13deg);
}

/* The lead reads by size and height first, colour second. */
.duel__side.is-leader .avatar {
  --size: clamp(9.4rem, 20vh, 14.4rem);
  box-shadow:
    0 0 0 0.22rem var(--bg),
    0 0 0 0.44rem var(--who),
    0 0 0 0.62rem color-mix(in srgb, var(--gold) 70%, transparent),
    0 0 3.4rem color-mix(in srgb, var(--who) 55%, transparent),
    0 1.6rem 3.4rem rgb(0 0 0 / 0.65);
}

/* The lift rides on the avatar, not the item: the entrance animation owns the
   item's transform (fill: both) and would erase it. */
.duel__side--a.is-leader .avatar {
  transform: rotateY(13deg) translateY(-0.9rem);
}

.duel__side--b.is-leader .avatar {
  transform: rotateY(-13deg) translateY(-0.9rem);
}

.duel__name {
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.duel__title {
  font-size: 1.25rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--who, var(--gold));
}

/* The scoreboard sits on the centre line, glass over the split. */
.duel__core {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: clamp(0.6rem, 1.6vw, 1.3rem);
  padding: 0.9rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-raise) 78%, transparent);
  backdrop-filter: blur(0.5rem);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 1.4rem 3.4rem rgb(0 0 0 / 0.6);
}

.duel__core.is-tie {
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
}

.duel__score {
  font-size: clamp(2.4rem, 4.6vw, 4.2rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--who, var(--ink));
}

/* Fixed halves keep the beam on the centre line whatever the digits are. */
.duel__score--a {
  justify-self: end;
}

.duel__score--b {
  justify-self: start;
}

.duel__beam {
  width: 0.16rem;
  height: 3.2rem;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, var(--ink-faint), transparent);
}

.duel__core.is-tie .duel__beam {
  background: linear-gradient(180deg, transparent, var(--gold), transparent);
}

.duel__verdict {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

.duel__word {
  font-size: clamp(1.9rem, 3.4vw, 3.1rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  text-wrap: balance;
}

.duel__verdict.is-tie .duel__word {
  color: var(--gold);
}

.duel__matches {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* The two sides arrive from their own edge, then settle. */
.duel__side--a.anim-rise {
  animation-name: duel-in-left;
}

.duel__side--b.anim-rise {
  animation-name: duel-in-right;
}

@keyframes duel-in-left {
  from {
    opacity: 0;
    transform: translateX(-2.2rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes duel-in-right {
  from {
    opacity: 0;
    transform: translateX(2.2rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Lite pass for 1 GB sticks: no blur, no glow, same layout. */
:root[data-perf="lite"] .duel__core {
  backdrop-filter: none;
  background: var(--bg-raise);
}

:root[data-perf="lite"] .duel__side::before {
  display: none;
}

:root[data-perf="lite"] .duel__side .avatar,
:root[data-perf="lite"] .duel__side.is-leader .avatar {
  box-shadow:
    0 0 0 0.22rem var(--bg),
    0 0 0 0.44rem var(--who);
}

.rest {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
}

.rest__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.rest__item .avatar {
  --size: 2.9rem;
}

.rest__name {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
}

.rest__title {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-dim);
}

/* --- Foot: QR + share --- */

/* Sin QR (el resultado completo ya vive en los telefonos): el pie es una sola
 * fila compacta, para que las acciones nunca se salgan de la pantalla. */
.podium__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-lg);
  border-top: 1px solid var(--line-soft);
  padding-top: 1.1rem;
  flex-wrap: wrap;
}

.podium__actions {
  display: flex;
  gap: 1rem;
}

/* --- Share overlay --- */

.share {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  place-items: center;
  background: color-mix(in srgb, var(--bg-sink) 88%, transparent);
  backdrop-filter: blur(0.4rem);
}

.share.is-open {
  display: grid;
}

.share__panel {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: var(--gap-lg);
  padding: var(--gap-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raise);
  box-shadow: 0 3rem 8rem rgb(0 0 0 / 0.7);
}

.share__preview {
  width: min(21rem, 32vh);
  border-radius: var(--radius);
  box-shadow: 0 1.4rem 3.4rem rgb(0 0 0 / 0.6);
}

.share__side {
  display: grid;
  justify-items: start;
  gap: 1rem;
  max-width: 22rem;
}

.share__side .qr__code > * {
  width: 11rem;
}

.share__title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

/* Estado de "listos para otra ronda" y cuenta atras automatica */
.ready-line {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  min-height: 1.6rem;
}

.ready-line.is-hot {
  color: var(--gold, #d9c94a);
  font-weight: 700;
  font-size: 1.6rem;
}

/* Modo ligero: el podio y el duelo sin desenfoques ni halos animados. */
:root[data-perf="lite"] .podium *,
:root[data-perf="lite"] .duel * {
  filter: none !important;
  backdrop-filter: none !important;
}

:root[data-perf="lite"] .compat__ring {
  animation: none !important;
}
