/* Ruleta del Evento 2027, con la estética de www.electricfeel.com.ar: los mismos grises, la letra del sistema
   (Geist donde no está la de Apple), títulos en negrita apretada y el amarillo solo donde importa.
   Escenario de 16:9: la ruleta grande a la izquierda; a la derecha el nombre, el botón y los ganadores. */
@font-face {
  font-family: "Geist";
  src: url("/assets/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --canvas: #0b0b0c;
  --surface: #1c1c1e;
  --bubble: #232326;
  --fill: #2c2c2e;
  --fill-hover: #3a3a3c;
  --segment: #505054;
  --hairline: rgba(255, 255, 255, 0.1);
  --fg: #f5f5f7;
  --fg-2: #a1a1a6;
  --fg-3: #8e8e93;
  --brand: #f6e200;
  --on-brand: #141414;
  --ok: #30d158;
  --ok-fg: #5be584;
  --warn-fg: #ffc45c;
  --danger: #ff6961;
  --scrim: rgba(0, 0, 0, 0.55);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Geist", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box }
html, body { height: 100% }
body {
  margin: 0; background: var(--canvas); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
[hidden] { display: none !important }
button { font-family: inherit; -webkit-tap-highlight-color: transparent }
:focus-visible { outline: 2px solid rgba(245, 245, 247, 0.7); outline-offset: 3px }

/* ---------- Botones ---------- */
.primary, .secondary, .icon-btn, .close, .seg button, .switch, .link { cursor: pointer; touch-action: manipulation }
.primary {
  display: flex; align-items: center; justify-content: center; border: 0; border-radius: 14px; min-height: 50px; padding: 0 20px;
  background: var(--brand); color: var(--on-brand); font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  transition: transform 160ms var(--ease-out), opacity 160ms ease;
}
.primary:active { transform: scale(0.98) }
.primary:disabled, .primary[aria-busy="true"] { opacity: 0.55; cursor: default }
.secondary {
  flex: 1; min-width: 140px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--fill); color: var(--fg);
  font-size: 15px; font-weight: 600; transition: background-color 150ms ease, transform 160ms var(--ease-out);
}
.secondary:active { transform: scale(0.98) }
.secondary.danger { color: var(--danger) }
.secondary.danger.armed { background: rgba(255, 105, 97, 0.16) }
@media (hover: hover) and (pointer: fine) {
  .secondary:hover, .icon-btn:hover, .close:hover { background: var(--fill-hover) }
  .seg button[aria-pressed="false"]:hover { color: var(--fg) }
}
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 0; background: transparent; color: var(--fg-3); transition: background-color 150ms ease, color 150ms ease }
.icon-btn:hover { color: var(--fg) }
.close { width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--fill); color: var(--fg-2); transition: background-color 150ms ease }
.link { background: none; border: 0; color: var(--fg-2); font-size: 15px; min-height: 44px; padding: 0 4px }
.link:hover { color: var(--fg) }

/* ---------- Campos ---------- */
.field-group { display: flex; flex-direction: column; gap: 6px; background: var(--fill); border-radius: 14px; padding: 10px 14px 12px }
.field-group label { font-size: 12px; font-weight: 600; color: var(--fg-2) }
.field-group input { font: 17px var(--font); color: var(--fg); background: transparent; border: 0; padding: 0; outline: none; min-height: 26px }
.field-group:focus-within { box-shadow: 0 0 0 2px rgba(246, 226, 0, 0.5) }
.form-error { margin: -4px 2px 0; font-size: 14px; color: var(--danger) }

/* ---------- Clave (como la pantalla de entrar de ElectricFeel) ---------- */
.gate {
  min-height: 100%; display: grid; place-items: center; background: #0f0f0f url("/assets/fondo.svg") center / 480px repeat;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.gate-card { width: min(100%, 380px); display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 22px; padding: 28px 24px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45) }
.gate-logo { width: 156px; height: auto }
.gate h1 { margin: 6px 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15 }

/* ---------- Escenario ---------- */
.stage {
  position: relative; min-height: 100%; display: flex; flex-direction: column; isolation: isolate; outline: none;
  padding: max(20px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
}
.stage::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(42% 58% at 30% 52%, rgba(246, 226, 0, 0.07), transparent 70%);
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap }
.logo { height: clamp(22px, 3vh, 34px); width: auto; display: block; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none }
.event { font-size: clamp(11px, 1.35vh, 14px); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3) }
.event b { color: var(--fg); font-weight: 700 }

.grid { flex: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); align-items: center; gap: clamp(24px, 4vw, 80px); padding-block: clamp(12px, 2vh, 28px) }
.wheel-col { min-width: 0; display: flex; justify-content: center }
.wheel-box { position: relative; width: min(100%, 80vh, 940px); aspect-ratio: 1; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent }
.wheel-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block }
.confetti { pointer-events: none }

.side { min-width: 0; max-width: 560px; display: flex; flex-direction: column; gap: clamp(18px, 3vh, 36px) }
.reveal { min-height: clamp(150px, 24vh, 270px); display: flex; flex-direction: column; justify-content: flex-end }
.eyebrow { font-size: clamp(11px, 1.4vh, 14px); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); transition: color 200ms ease }
.reveal.won .eyebrow { color: var(--brand) }
.who { margin-top: 8px; font-size: clamp(34px, 6.4vh, 76px); line-height: 1; font-weight: 700; letter-spacing: -0.035em; text-wrap: balance; overflow-wrap: anywhere; color: var(--fg); transition: color 120ms ease }
.reveal.spinning .who { color: var(--fg-2) }
.reveal.idle .who { font-variant-numeric: tabular-nums }
.co { margin-top: 10px; min-height: 1.3em; font-size: clamp(16px, 2.3vh, 26px); font-weight: 500; letter-spacing: -0.01em; color: var(--fg-2) }
.reveal.pop .eyebrow, .reveal.pop .who, .reveal.pop .co { animation: rise 520ms var(--ease-out) both }
.reveal.pop .who { animation-delay: 40ms }
.reveal.pop .co { animation-delay: 90ms }
@keyframes rise { from { opacity: 0; transform: translateY(10px); filter: blur(6px) } }

.spin { min-height: clamp(60px, 9vh, 96px); border-radius: clamp(14px, 2vh, 22px); font-size: clamp(20px, 3vh, 32px); font-weight: 700; letter-spacing: -0.02em }

.winners { background: var(--surface); border: 1px solid var(--hairline); border-radius: 20px; padding: 16px 18px 6px; min-height: 0 }
.winners-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px }
.winners-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em }
.winners-head span { font-size: 13px; color: var(--fg-3); font-variant-numeric: tabular-nums }
.winners ol { margin: 0; padding: 0; list-style: none; max-height: 24vh; overflow: auto; overscroll-behavior: contain }
.winners li { display: grid; grid-template-columns: 2em minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--hairline) }
.winners li:first-child { border-top: 0 }
.winners li .n { font-size: 14px; color: var(--fg-3); font-variant-numeric: tabular-nums }
.winners li .nm { min-width: 0; font-size: clamp(15px, 1.9vh, 19px); font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.winners li .nm small { font-weight: 400; color: var(--fg-2); font-size: 0.88em }
.winners li.fresh { animation: rise 420ms var(--ease-out) both }

.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--fg-3); font-size: 13px }
.status.offline { color: var(--warn-fg) }

/* ---------- Hojas y ventana de la clave ---------- */
.sheet, .modal { position: fixed; inset: 0; z-index: 20; background: var(--scrim); animation: fade 200ms ease both }
@keyframes fade { from { opacity: 0 } }
.sheet { display: flex; justify-content: flex-end; padding: 12px }
.sheet-card:focus { outline: none }
.sheet-card {
  width: min(100%, 420px); height: 100%; overflow: auto; background: var(--surface); border: 1px solid var(--hairline); border-radius: 22px;
  display: flex; flex-direction: column; gap: 18px; padding: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: slide 320ms var(--ease-drawer) both;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0 } }
.modal { display: grid; place-items: center; padding: 16px }
.modal-card { width: min(100%, 360px); display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 22px; padding: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); animation: pop 240ms var(--ease-out) both }
@keyframes pop { from { transform: scale(0.96); opacity: 0 } }
.modal-card.shake { animation: shake 320ms var(--ease-out) }
@keyframes shake { 20%, 60% { transform: translateX(-6px) } 40%, 80% { transform: translateX(6px) } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px }
.sheet-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em }
.group { display: flex; flex-direction: column; gap: 8px }
.group-label { font-size: 13px; font-weight: 600; color: var(--fg-2) }
.seg { display: flex; gap: 2px; background: var(--fill); border-radius: 12px; padding: 2px }
.seg button { flex: 1; min-width: 0; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--fg-2); font-size: 14px; font-weight: 600; line-height: 1.2; transition: background-color 180ms ease, color 180ms ease }
.seg button small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--fg-3) }
.seg button[aria-pressed="true"] { background: var(--segment); color: var(--fg); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) }
.seg button[aria-pressed="true"] small { color: var(--fg-2) }
.list { background: var(--bubble); border-radius: 14px; padding: 0 14px }
.list .switch + .switch { border-top: 1px solid var(--hairline) }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 50px; padding: 0; border: 0; background: none; color: var(--fg); font-size: 16px; text-align: left }
.switch .track { position: relative; flex: none; width: 51px; height: 31px; border-radius: 999px; background: rgba(142, 142, 147, 0.4); transition: background-color 200ms ease }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 240ms var(--ease-out) }
.switch[aria-checked="true"] .track { background: var(--ok) }
.switch[aria-checked="true"] .track::after { transform: translateX(20px) }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap }
.note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--fg-3) }
.kbd { font-size: 12px; border: 1px solid var(--hairline); border-radius: 6px; padding: 0 5px; color: var(--fg-2); white-space: nowrap }
.sheet-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--hairline) }
.script-list { list-style: none; margin: 0; padding: 0 14px; background: var(--bubble); border-radius: 14px }
.script-list li { display: grid; grid-template-columns: 1.6em minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 42px; font-size: 15px; border-top: 1px solid var(--hairline) }
.script-list li:first-child { border-top: 0 }
.script-list .n { color: var(--fg-3); font-variant-numeric: tabular-nums; font-size: 13px }
.script-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.tag { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap }
.tag.salio { color: var(--ok-fg); background: rgba(48, 209, 88, 0.14) }
.tag.no-esta { color: var(--warn-fg); background: rgba(255, 159, 10, 0.14) }
.tag.proximo { color: var(--on-brand); background: var(--brand) }
.tag.espera, .tag.apagada { color: var(--fg-3); background: var(--fill) }
textarea { width: 100%; resize: vertical; background: var(--fill); color: var(--fg); border: 0; border-radius: 14px; padding: 12px 14px; font: 15px/1.5 var(--font); outline: none }
textarea:focus { box-shadow: 0 0 0 2px rgba(246, 226, 0, 0.5) }

/* ---------- Celular y pantallas verticales ---------- */
@media (max-width: 860px), (max-aspect-ratio: 1/1) {
  .stage { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)) }
  .grid { grid-template-columns: minmax(0, 1fr); align-items: start; align-content: start; gap: 28px }
  .wheel-box { width: min(100%, 60vh) }
  .side { max-width: none }
  .reveal { min-height: 0 }
  .who { font-size: clamp(30px, 9vw, 48px) }
  .winners ol { max-height: 34vh }
  .sheet { padding: 0 }
  .sheet-card { border-radius: 0; border: 0 }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important }
}
