/* Opción B2 · Con confeti — fuentes en css/fonts.css */

:root {
  --night: #0E0E0F;
  --night-2: #1C1C1E;
  --night-3: #2A2A2D;
  --ink: #231F20;
  --muted: #C9C7C8;
  --teal: #388395;
  --purple: #7A3A92;
  --magenta: #C8287A;
  --white: #FFFFFF;
  --brand-gradient: linear-gradient(90deg, var(--teal), var(--purple), var(--magenta));
  --brand-gradient-rev: linear-gradient(90deg, var(--magenta), var(--purple), var(--teal));
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--white);
  overflow: hidden;
}
a { color: #7FC3D4; }
a:hover { color: #A9DCE8; }
button { font-family: inherit; cursor: pointer; }

/* Lienzo 1920×1080 escalado a la ventana */
.viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.stage {
  width: 1920px;
  height: 1080px;
  flex-shrink: 0;
  background: var(--night);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 50px;
  padding: 0 50px;
  transform: scale(var(--scale, 1));
  transform-origin: center center;
}

/* ---------- Columna izquierda ---------- */
.intro {
  width: 420px;
  height: 940px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.intro__brand { display: flex; align-items: center; gap: 16px; }
.intro__brand img { width: 64px; height: 64px; }
.intro__brand span { font-size: 16px; font-weight: 600; letter-spacing: 0.3em; }

.intro__hero { display: flex; flex-direction: column; gap: 28px; }
.intro__title { font-size: 128px; font-weight: 900; letter-spacing: -0.03em; line-height: 0.95; }
.intro__rule { width: 140px; height: 8px; border-radius: 4px; background: var(--brand-gradient); }

.cta {
  margin-top: 16px;
  height: 88px;
  width: 360px;
  border: none;
  border-radius: 999px;
  background: var(--brand-gradient);
  color: var(--white);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.16em;
  box-shadow: 0 12px 40px rgba(200, 40, 122, 0.35);
}
.cta:focus-visible { outline: 4px solid var(--white); outline-offset: 4px; }
.cta:disabled { cursor: default; opacity: 0.45; box-shadow: none; }

/* ---------- Agregar participantes ---------- */
.adder { width: 360px; margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.adder__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.adder__label { font-size: 13px; font-weight: 600; letter-spacing: 0.22em; color: var(--muted); white-space: nowrap; }
.adder__clear {
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--night-3);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}
.adder__clear:hover { color: #E0418F; border-color: #E0418F; }
.adder__clear:focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }
.adder__clear.is-confirming { background: var(--magenta); border-color: var(--magenta); color: var(--white); }
.adder__clear:disabled { opacity: 0; pointer-events: none; }
.adder__row { display: flex; gap: 10px; }
.adder__input {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 24px;
  border: 2px solid var(--night-3);
  border-radius: 999px;
  background: var(--night-2);
  color: var(--white);
  font: 500 18px/1 "Inter", system-ui, sans-serif;
  transition: border-color 0.2s ease;
}
.adder__input::placeholder { color: #7A7879; }
.adder__input:focus { outline: none; border-color: var(--teal); }
.adder__input:disabled { opacity: 0.5; }
.adder__input.is-invalid { border-color: var(--magenta); animation: shake 0.35s ease; }
.adder__btn {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: var(--white);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.15s ease;
}
.adder__btn:hover { transform: scale(1.06); }
.adder__btn:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }
.adder__btn:disabled { opacity: 0.45; transform: none; cursor: default; }
.adder__hint { margin: 0; min-height: 20px; font-size: 14px; font-weight: 500; color: #8E8C8D; }
.adder__hint.is-error { color: #E0418F; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.intro__event { display: flex; flex-direction: column; gap: 12px; }
.intro__event img { height: 62px; width: 237px; }
.intro__event span { font-size: 18px; font-weight: 500; color: var(--muted); }

/* ---------- Ruleta ---------- */
.wheel { position: relative; width: 860px; height: 860px; flex-shrink: 0; }
.wheel__base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--night-2);
  box-shadow: 0 0 0 2px var(--night-3);
}
.wheel__ring {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--teal), var(--purple), var(--magenta), var(--purple), var(--teal));
}
.wheel__disc {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  overflow: hidden;
}
.wheel__disc.is-spinning { transition: transform 6.4s cubic-bezier(0.1, 0.65, 0.06, 1); }
/* Cada nombre es un botón: clic = quitar de la ruleta */
.wheel__label {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 404px;
  height: 40px;
  margin: -20px 0 0;
  padding: 0 24px 0 0;
  border: 0;
  background: none;
  color: inherit;
  transform-origin: 0 50%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: var(--label-size, 22px);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none; /* solo el "chip" con el texto es clicable */
}
.wheel__label:focus { outline: none; }
.wheel__chip {
  display: inline-flex;
  align-items: center;
  max-width: 250px;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: auto;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.wheel__text { overflow: hidden; text-overflow: ellipsis; }
.wheel__x {
  width: 0;
  opacity: 0;
  overflow: hidden;
  font-weight: 800;
  flex-shrink: 0;
  transition: width 0.2s ease, opacity 0.2s ease, margin 0.2s ease;
}
.wheel__label:hover .wheel__chip,
.wheel__label:focus-visible .wheel__chip { background: rgba(35, 31, 32, 0.1); }
.wheel__label:focus-visible .wheel__chip { box-shadow: 0 0 0 3px var(--magenta); }
.wheel__label:hover .wheel__x,
.wheel__label:focus-visible .wheel__x { width: 14px; margin-right: 8px; opacity: 1; }

/* Vista vacía */
.wheel__empty {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.55) 0 55%, rgba(255, 255, 255, 0.92) 75%),
    conic-gradient(from 15deg, #D3E8EE 0 90deg, #E5D8EF 0 180deg, #F6D6E6 0 270deg, #FFFFFF 0 360deg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 120px 0 112px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.wheel__empty::before {
  content: "";
  position: absolute;
  inset: 34px;
  border: 2px dashed rgba(35, 31, 32, 0.18);
  border-radius: 50%;
}
.wheel__empty.is-visible { opacity: 1; visibility: visible; transition: opacity 0.4s ease; }
.wheel__empty-top,
.wheel__empty-bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wheel__empty-eyebrow { font-size: 14px; font-weight: 600; letter-spacing: 0.24em; color: var(--purple); }
.wheel__empty-title { font-size: 44px; font-weight: 800; letter-spacing: -0.01em; }
.wheel__empty-arrow {
  font-size: 32px;
  font-weight: 700;
  color: var(--magenta);
  animation: nudge 1.4s ease-in-out infinite;
}
.wheel__empty-text { font-size: 19px; font-weight: 500; line-height: 1.4; color: #5B5859; }

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-10px); }
}

/* Entrada y salida de nombres */
.wheel__label.is-entering .wheel__chip { animation: chipIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.wheel__label.is-leaving .wheel__chip { animation: chipOut 0.45s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.wheel__disc.is-locked .wheel__chip { pointer-events: none; }

@keyframes chipIn {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes chipOut {
  0% { transform: scale(1); background: rgba(200, 40, 122, 0.25); }
  35% { transform: scale(1.08); background: rgba(200, 40, 122, 0.35); }
  100% { transform: scale(0.3) translateX(-60px); opacity: 0; background: rgba(200, 40, 122, 0); }
}
.wheel__hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 220px;
  height: 220px;
  margin: -110px 0 0 -110px;
  border-radius: 50%;
  background: var(--night);
  box-shadow: 0 0 0 8px var(--night-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wheel__hub img { width: 180px; height: 180px; }
.wheel__pointer { position: absolute; left: 398px; top: -26px; }

/* ---------- Lanyard + gafete ---------- */
.lanyard {
  width: 440px;
  height: 1080px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lanyard__strap {
  width: 74px;
  height: 200px;
  background: var(--night-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding-bottom: 18px;
}
.lanyard__accent { width: 6px; height: 54px; border-radius: 3px; background: linear-gradient(180deg, var(--teal), var(--magenta)); }
.lanyard__strap img { width: 40px; height: 40px; }
.lanyard__clip {
  width: 22px;
  height: 40px;
  background: linear-gradient(90deg, #8E8C8D, #D9D8D8, #8E8C8D);
  border-radius: 0 0 6px 6px;
}

.badge {
  margin-top: 6px;
  width: 420px;
  background: var(--white);
  color: var(--ink);
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.badge__strip { height: 8px; background: var(--brand-gradient); }
.badge__body {
  padding: 22px 34px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.badge__slot { width: 70px; height: 12px; border-radius: 6px; background: #DAD8D6; }
.badge__logo { margin-top: 10px; width: 104px; height: 104px; }
.badge__eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.22em; }
.pill {
  margin-top: 20px;
  background: var(--brand-gradient);
  color: var(--white);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.12em;
  padding: 8px 22px;
  border-radius: 999px;
}

.badge__name { display: flex; flex-direction: column; line-height: 1.05; }
.badge__name[hidden] { display: none; }
.badge__first { font-size: 44px; font-weight: 300; }
.badge__last { font-size: 50px; font-weight: 800; }

/* Signos de interrogación animados mientras no hay ganador */
.badge__waiting {
  height: 106px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.badge__waiting[hidden] { display: none; }
.badge__waiting span {
  display: inline-block;
  font-size: 84px;
  font-weight: 900;
  line-height: 1;
  animation: qbounce 1.1s ease-in-out infinite;
}
.badge__waiting span:nth-child(1) { color: var(--teal); }
.badge__waiting span:nth-child(2) { color: var(--purple); animation-delay: 0.18s; }
.badge__waiting span:nth-child(3) { color: var(--magenta); animation-delay: 0.36s; }

.badge__rule { width: 96px; height: 5px; border-radius: 3px; background: var(--brand-gradient-rev); }
.badge__foot {
  background: var(--ink);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.badge__foot img { height: 36px; }
.badge__foot span { color: var(--white); font-size: 14px; font-weight: 500; }

/* ---------- Confeti ---------- */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.confetti__piece {
  position: absolute;
  top: 0;
  opacity: 0;
  animation-name: confetti;
  animation-timing-function: cubic-bezier(0.25, 0.4, 0.5, 1);
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

@keyframes qbounce {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-18px) rotate(6deg); }
}
@keyframes confetti {
  0% { transform: translate3d(0, -60px, 0) rotate(0deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate3d(var(--dx), 1180px, 0) rotate(var(--rz)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wheel__disc.is-spinning { transition-duration: 1.2s; }
  .badge__waiting span { animation: none; }
  .wheel__empty-arrow { animation: none; }
  .wheel__label.is-entering .wheel__chip,
  .wheel__label.is-leaving .wheel__chip { animation-duration: 0.01s; }
  .confetti { display: none; }
}
