/* Encuesta · Matadoria Family — estilos compartidos (celular, pantalla grande y admin)
   Paleta tomada de universidad.tecmilenio.mx: #00534C, #26D07C, #50A819, #00A499, #007864 + Montserrat. */

:root {
  --deep: #00534c;       /* verde petróleo: texto sobre blanco */
  --mint: #26d07c;       /* verde menta: botones y acentos */
  --teal: #00a499;
  --leaf: #50a819;
  --green: #007864;
  --paper: #f8f9fa;
  --bg: #002d29;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, 0.8);
  --ink-3: rgba(255, 255, 255, 0.58);
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(0, 45, 41, 0.82);
  --danger: #ff6b6b;
  --o0: var(--mint);
  --o1: var(--teal);
  --o2: var(--leaf);
  --o3: var(--green);
  --radius: 24px;
  --font: 'Montserrat', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; }

/* ---------- fondo ---------- */
.aurora {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(1100px 760px at 6% -12%, #00806e 0%, transparent 60%),
    radial-gradient(900px 700px at 108% 112%, #006b5f 0%, transparent 56%),
    linear-gradient(160deg, #002a26, #00453f 55%, #002824);
}
.aurora::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 25%, transparent 75%);
}
.aurora i {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(90px); opacity: 0.3; mix-blend-mode: screen;
  animation: drift 26s ease-in-out infinite alternate;
}
.aurora i:nth-child(1) { background: var(--mint); top: -16vmax; left: -12vmax; }
.aurora i:nth-child(2) { background: var(--teal); bottom: -18vmax; right: -12vmax; opacity: 0.34; animation-duration: 32s; animation-delay: -8s; }
.aurora i:nth-child(3) { background: var(--leaf); top: 34%; left: 44%; width: 30vmax; height: 30vmax; opacity: 0.16; animation-duration: 38s; animation-delay: -14s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8vmax, 6vmax) scale(1.12); }
  100% { transform: translate(-6vmax, 10vmax) scale(0.92); }
}

/* ---------- piezas base ---------- */
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; padding: 7px;
  width: 2.5rem; height: 2.5rem; border-radius: 12px; background: var(--mint); color: var(--deep);
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.6);
}
.brand-mark .shape { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1; text-align: left; }
.brand-name {
  font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em;
  background: linear-gradient(90deg, #fff, #b6f3d3 55%, var(--mint));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { margin-top: 0.25rem; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); }

.shape { display: inline-grid; width: 1.35em; height: 1.35em; flex: none; }
.shape svg { width: 100%; height: 100%; fill: currentColor; }

/* El ícono de cada respuesta va en una insignia de su color. */
.opt .shape, .vote-btn .shape, .win-chip .shape, .winner-opt .shape, .your-pick .shape, .mini-bars .shape, .opt-input .shape {
  padding: 0.24em; border-radius: 30%; background: var(--c); color: #fff;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

.display { font-size: clamp(1.7rem, 5.5vw, 3.1rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }
.lead { font-size: 1.1rem; font-weight: 600; color: var(--ink-2); text-wrap: balance; }
.muted { color: var(--ink-3); }
.center-text { text-align: center; }

.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

.pill {
  display: inline-flex; align-items: center; gap: 0.5rem; max-width: 100%;
  padding: 0.4rem 0.9rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill.live::before {
  content: ''; flex: none; width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: var(--mint); animation: ping 1.6s infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(38, 208, 124, 0.8); }
  80%, 100% { box-shadow: 0 0 0 10px rgba(38, 208, 124, 0); }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  padding: 0.75rem 1.3rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line);
  font-weight: 700; font-size: 0.95rem; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s, background 0.2s, box-shadow 0.2s, opacity 0.2s, filter 0.2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.18); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn-primary {
  border-color: transparent; background: var(--mint); color: var(--deep); font-weight: 800;
  box-shadow: 0 14px 30px -14px rgba(38, 208, 124, 0.9);
}
.btn-primary:hover { background: #45de91; }
.btn-ghost { background: transparent; }
.btn-danger { color: #ffb0b0; }
.btn-danger:hover { background: rgba(255, 107, 107, 0.18); }
.btn-icon { width: 2.6rem; height: 2.6rem; padding: 0; font-size: 1.05rem; }
.btn-xl { font-size: 1.15rem; padding: 1rem 1.8rem; }
.btn kbd {
  font: 700 0.6rem/1 var(--font); letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.3rem 0.5rem; border-radius: 999px; background: rgba(0, 83, 76, 0.16);
}
.link { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }

.field {
  width: 100%; padding: 0.85rem 1.1rem; border-radius: 16px;
  background: rgba(255, 255, 255, 0.07); border: 1.5px solid var(--line); outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.field:focus { border-color: var(--mint); background: rgba(255, 255, 255, 0.11); box-shadow: 0 0 0 4px rgba(38, 208, 124, 0.22); }
.field::placeholder { color: var(--ink-3); }
.field-xl { font-size: 1.2rem; font-weight: 700; padding: 1rem 1.2rem; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.4rem; }
select.field option { background: #00453f; }
textarea.field { resize: vertical; line-height: 1.4; }
.form-error { color: #ffb0b0; font-weight: 600; min-height: 1.2em; }

.spinner {
  width: 46px; height: 46px; margin: 1rem auto; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15); border-top-color: var(--mint);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dots { display: flex; gap: 0.5rem; justify-content: center; }
.dots i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--mint); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
.dots.inline { display: inline-flex; gap: 0.25rem; margin-left: 0.4rem; }
.dots.inline i { width: 0.35rem; height: 0.35rem; }
@keyframes dot { 0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

.big-emoji { font-size: clamp(3.5rem, 14vw, 5.5rem); line-height: 1; }
.float { animation: float 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12px) rotate(4deg); } }
.pulse { animation: beat 1s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.bump { animation: bump 0.4s cubic-bezier(0.2, 1.8, 0.4, 1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(0.9); } to { opacity: 1; transform: none; } }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }
.offline {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 0.45rem 0.9rem; border-radius: 999px; font-weight: 700; font-size: 0.85rem;
  background: rgba(214, 60, 60, 0.92);
}
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 0.5rem; width: min(92vw, 420px); }
.toast {
  padding: 0.8rem 1.1rem; border-radius: 16px; font-weight: 600; text-align: center;
  background: rgba(0, 45, 41, 0.96); border: 1px solid var(--line); box-shadow: 0 18px 40px -16px #000;
  animation: rise 0.3s both; transition: opacity 0.35s, transform 0.35s;
}
.toast.error { border-color: rgba(255, 107, 107, 0.7); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- acceso ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login { width: min(100%, 440px); padding: 2rem; display: flex; flex-direction: column; gap: 1rem; animation: pop 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
.login h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 0.5rem; }

/* ---------- celular ---------- */
.page-voter #app {
  min-height: 100dvh; max-width: 620px; margin: 0 auto; display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
}
.screen { flex: 1; display: flex; flex-direction: column; gap: 1rem; animation: rise 0.35s ease both; }
.screen.still { animation: none; }
.screen.center { justify-content: center; align-items: center; text-align: center; gap: 1.1rem; }
.screen.center > .brand { margin-bottom: 0.5rem; }
.screen.center::before { content: ''; margin-top: auto; } /* con el margin-top:auto del pie, centra el contenido */
.voter-foot {
  margin-top: auto; padding-top: 1rem; width: 100%;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  color: var(--ink-3); font-weight: 600; font-size: 0.9rem;
}
.voter-foot .link { color: var(--ink-3); font-size: 0.85rem; }

.join-avatar { font-size: 4.5rem; line-height: 1; animation: float 3s ease-in-out infinite; }
.join-form { width: 100%; display: flex; flex-direction: column; gap: 0.8rem; margin-top: 0.5rem; }
.join-form .field { text-align: center; }

.q-top { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.q-phone { font-size: clamp(1.25rem, 5vw, 1.75rem); font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
.q-phone.small { font-size: 1.05rem; color: var(--ink-2); }
.time { display: flex; align-items: center; gap: 0.6rem; flex: 1; max-width: 55%; }
.time-bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.time-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--teal)); transition: width 0.25s linear; }
.time-left { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2.4ch; text-align: right; }
.time.hurry .time-bar i { background: var(--danger); }
.time.hurry .time-left { color: #ffa3a3; animation: beat 1s infinite; }

.vote-grid { flex: 1; display: grid; gap: 0.75rem; grid-auto-rows: minmax(76px, 1fr); max-height: 62dvh; }
.vote-btn {
  --c: var(--o0);
  position: relative; display: flex; align-items: center; gap: 0.9rem;
  padding: 1rem 1.1rem; border: 0; border-radius: 22px; text-align: left;
  font-weight: 700; font-size: clamp(1rem, 4.2vw, 1.2rem); line-height: 1.2; color: var(--deep);
  background: #fff;
  box-shadow: inset 0 -5px 0 var(--c), 0 16px 30px -18px rgba(0, 0, 0, 0.7);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s, opacity 0.25s, filter 0.25s, box-shadow 0.25s, background 0.25s;
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.vote-btn:nth-child(2) { animation-delay: 0.06s; }
.vote-btn:nth-child(3) { animation-delay: 0.12s; }
.vote-btn:nth-child(4) { animation-delay: 0.18s; }
.still .vote-btn { animation: none; }
.vote-btn .shape { width: 2.2rem; height: 2.2rem; }
.vote-btn:active { transform: scale(0.97); }
.vote-label { flex: 1; overflow-wrap: anywhere; }
.vote-btn .check {
  display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--deep); color: #fff; font-weight: 800;
  transform: scale(0); transition: transform 0.3s cubic-bezier(0.2, 1.7, 0.4, 1);
}
.vote-grid.has-vote .vote-btn:not(.chosen) { opacity: 0.42; filter: saturate(0.5); }
.vote-btn.chosen { background: var(--mint); box-shadow: 0 0 0 3px #fff, 0 0 44px -6px var(--mint); transform: scale(1.015); }
.vote-btn.chosen .check { transform: scale(1); }
.vote-hint { text-align: center; font-weight: 700; color: var(--ink-3); }
.vote-hint.done { color: #8ef5c0; }

.your-pick {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.9rem 1.2rem; border-radius: 20px; flex-wrap: wrap; justify-content: center;
  background: #fff; color: var(--deep); font-weight: 800; font-size: 1.15rem; box-shadow: inset 0 -4px 0 var(--c);
}
.your-pick small { width: 100%; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.75; }

.winner {
  --c: var(--o0);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center;
  padding: 1.3rem 1.2rem; border-radius: 26px;
  background: linear-gradient(160deg, rgba(38, 208, 124, 0.2), rgba(255, 255, 255, 0.05));
  border: 2px solid var(--mint);
  box-shadow: 0 0 50px -14px var(--mint);
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.winner.empty { border-color: var(--line); box-shadow: none; background: rgba(255, 255, 255, 0.06); }
.winner-label { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.winner-opt {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 1.1rem 0.6rem 0.7rem; border-radius: 999px;
  background: #fff; color: var(--deep); font-size: 1.25rem; font-weight: 800; line-height: 1.15;
}
.winner-opt .shape { width: 1.8rem; height: 1.8rem; }
.winner-meta { font-weight: 700; color: var(--ink-2); }

.mini-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.mini-bars li {
  --c: var(--o0);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.35rem 0.65rem;
  padding: 0.65rem 0.8rem; border-radius: 16px; background: rgba(255, 255, 255, 0.07); font-weight: 700;
}
.mini-bars li .shape { width: 1.6rem; height: 1.6rem; }
.mini-bars li.is-win { background: rgba(38, 208, 124, 0.16); box-shadow: inset 0 0 0 1.5px var(--mint); }
.mb-count { font-variant-numeric: tabular-nums; font-weight: 800; }
.mb-bar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); position: relative; overflow: hidden; }
.mb-bar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--p); border-radius: inherit; background: var(--c); animation: grow 1.1s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
@keyframes grow { from { width: 0; } }

.final-phone { gap: 1rem; }
.final-phone > .pill { align-self: flex-start; }

/* lista final (celular y pantalla grande) */
.final-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.final-item {
  display: grid; grid-template-columns: auto 1fr; gap: 0.9rem; align-items: start;
  padding: 1rem 1.1rem; border-radius: 20px;
  animation: rise 0.5s cubic-bezier(0.2, 1, 0.4, 1) both; animation-delay: calc(var(--i) * 110ms + 200ms);
}
.final-num {
  display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  background: var(--mint); color: var(--deep); font-weight: 800;
}
.final-body { min-width: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.final-q { font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.win-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.win-chip {
  --c: var(--o0);
  display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.95rem 0.4rem 0.45rem; border-radius: 999px;
  background: #fff; color: var(--deep); font-weight: 800; line-height: 1.15;
}
.win-chip .shape { width: 1.6em; height: 1.6em; }
.final-meta { color: var(--ink-3); font-weight: 600; font-size: 0.88rem; }
.no-votes { color: var(--ink-3); font-weight: 600; font-style: italic; }

/* ---------- pantalla grande ---------- */
.page-host { overflow: hidden; }
.stage {
  height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(10px, 2.2vh, 26px); padding: clamp(14px, 2.2vw, 36px);
}
.stage-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.stage-top .brand-mark { width: 3rem; height: 3rem; }
.stage-top .brand-name { font-size: 1.5rem; }
.top-center { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.steps { display: flex; gap: 0.35rem; }
.steps i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: rgba(255, 255, 255, 0.2); transition: all 0.3s; }
.steps i.done { background: rgba(255, 255, 255, 0.6); }
.steps i.now { width: 1.6rem; border-radius: 99px; background: var(--mint); }
.controls { justify-self: end; display: flex; align-items: center; gap: 0.5rem; transition: opacity 0.5s; }
.controls.busy { opacity: 0.5; pointer-events: none; }
.mouse-idle .controls { opacity: 0.18; }
.mouse-idle .controls:hover { opacity: 1; }
.stage-main { min-height: 0; display: flex; flex-direction: column; }
.center-fill { flex: 1; display: grid; place-items: center; }

.picker { width: min(100%, 720px); padding: clamp(1.4rem, 3vw, 2.6rem); display: flex; flex-direction: column; gap: 1.2rem; align-items: flex-start; animation: pop 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
.picker-list { width: 100%; display: flex; flex-direction: column; gap: 0.7rem; max-height: 50vh; overflow: auto; }
.picker-item {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'title go' 'meta go'; gap: 0.2rem 1rem; align-items: center;
  width: 100%; padding: 1rem 1.3rem; border-radius: 20px; text-align: left;
  background: #fff; color: var(--deep); border: 0; transition: transform 0.15s, box-shadow 0.2s;
}
.picker-item:hover { transform: translateX(4px); box-shadow: 0 0 0 3px var(--mint); }
.picker-title { grid-area: title; font-size: 1.15rem; font-weight: 800; }
.picker-meta { grid-area: meta; color: var(--green); font-weight: 600; font-size: 0.9rem; }
.picker-go { grid-area: go; font-weight: 800; padding: 0.5rem 1rem; border-radius: 999px; background: var(--mint); }
.picker-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.lobby { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 48px); align-items: center; }
.lobby-join { display: flex; flex-direction: column; gap: clamp(14px, 2.6vh, 28px); align-items: flex-start; animation: rise 0.5s both; }
.lobby-title { font-size: clamp(2rem, 4.6vw, 4.8rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.025em; text-wrap: balance; }
.join-box { display: flex; align-items: center; gap: clamp(16px, 2vw, 32px); padding: clamp(14px, 1.6vw, 24px); }
.qr { flex: none; width: clamp(150px, 17vw, 270px); aspect-ratio: 1; padding: 10px; border-radius: 20px; background: #fff; box-shadow: 0 20px 50px -20px rgba(38, 208, 124, 0.7); }
.qr-svg { display: block; width: 100%; height: 100%; }
.qr-svg path { fill: var(--deep); }
.join-steps { display: flex; flex-direction: column; gap: 0.5rem; }
.join-lead { font-size: clamp(1rem, 1.4vw, 1.3rem); font-weight: 600; color: var(--ink-2); }
.join-url {
  font-size: clamp(1.3rem, 2.4vw, 2.6rem); font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; overflow-wrap: anywhere;
  background: linear-gradient(90deg, #fff, var(--mint)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.start-btn { font-size: clamp(1.05rem, 1.4vw, 1.4rem); }
.players { align-self: stretch; min-height: 0; display: flex; flex-direction: column; gap: 1rem; padding: clamp(16px, 2vw, 30px); }
.players-count { display: flex; align-items: baseline; gap: 0.7rem; }
.players-count b { font-size: clamp(3rem, 7vw, 6.5rem); font-weight: 800; line-height: 0.9; font-variant-numeric: tabular-nums; color: var(--mint); }
.players-count span { font-size: clamp(0.95rem, 1.4vw, 1.3rem); font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em; }
.chips { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0.6rem; overflow: auto; min-height: 0; }
.chip {
  display: inline-flex; align-items: center; padding: 0.55rem 1.05rem; border-radius: 999px;
  background: #fff; color: var(--deep);
  font-weight: 700; font-size: clamp(0.95rem, 1.4vw, 1.35rem);
  transform: rotate(var(--r)); animation: chip-in 0.55s cubic-bezier(0.2, 1.7, 0.4, 1) both;
}
@keyframes chip-in { from { opacity: 0; transform: scale(0.2) rotate(-20deg); } to { opacity: 1; transform: scale(1) rotate(var(--r)); } }
.waiting { font-size: 1.15rem; font-weight: 600; }

.q-screen { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: clamp(14px, 3vh, 34px); }
.q-hero { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(16px, 3vw, 48px); }
.q-title {
  font-size: clamp(1.8rem, 4vw, 4.3rem); font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance;
  animation: rise 0.55s cubic-bezier(0.2, 1, 0.4, 1) both;
}
.q-title.still { animation: none; }
.q-stats { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }
.votes { display: flex; flex-direction: column; align-items: center; text-align: center; }
.votes b { font-size: clamp(2.3rem, 4.8vw, 4.4rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.votes span { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); max-width: 10ch; }

.ring { --size: clamp(96px, 11vw, 168px); position: relative; width: var(--size); height: var(--size); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: rgba(255, 255, 255, 0.06); stroke: rgba(255, 255, 255, 0.14); stroke-width: 8; }
.ring .bar { fill: none; stroke: url(#ringGrad); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.2s linear; }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--size) * 0.34); font-weight: 800; font-variant-numeric: tabular-nums; }
.ring.hurry .bar { stroke: var(--danger); }
.ring.hurry .num { color: #ffa3a3; animation: beat 1s infinite; }
.ring.done .num { color: var(--ink-3); }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.5vw, 22px); }
.opts.n3 .opt:last-child { grid-column: 1 / -1; }
.opt {
  --c: var(--o0);
  position: relative; overflow: hidden; display: flex; align-items: center; gap: clamp(12px, 1.4vw, 24px);
  min-height: clamp(84px, 14vh, 170px); padding: clamp(14px, 1.6vw, 26px) clamp(16px, 2vw, 32px); border-radius: 28px;
  font-size: clamp(1.15rem, 2.15vw, 2.4rem); font-weight: 700; line-height: 1.15; color: var(--deep);
  background: #fff;
  box-shadow: inset 0 -7px 0 var(--c), 0 24px 44px -26px rgba(0, 0, 0, 0.8);
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: calc(var(--d) + 150ms);
  transition: opacity 0.6s, filter 0.6s, transform 0.5s, box-shadow 0.5s;
}
.opt .shape { width: 1.75em; height: 1.75em; position: relative; z-index: 1; }
.opt .txt { flex: 1; position: relative; z-index: 1; overflow-wrap: anywhere; }
.opt .stat { position: relative; z-index: 1; display: none; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.opt .stat b { font-size: 1.25em; font-weight: 800; line-height: 1; }
.opt .stat small { font-size: 0.55em; font-weight: 700; opacity: 0.8; }
.opt .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--c) 34%, #fff); border-right: 4px solid var(--c); transition: width 1.3s cubic-bezier(0.2, 0.9, 0.2, 1); }
.opts.reveal .opt { animation: none; box-shadow: 0 24px 44px -26px rgba(0, 0, 0, 0.8); }
.opts.reveal .opt .stat { display: flex; }
.opts.reveal .opt.lose { opacity: 0.5; filter: saturate(0.5); transition-delay: 1.2s; }
.opts.reveal .opt.win { transform: scale(1.025); box-shadow: 0 0 0 5px var(--mint), 0 0 70px 6px rgba(38, 208, 124, 0.55); transition-delay: 1.2s; }
.crown { display: inline-block; margin-right: 0.35em; animation: crown 0.7s 1.25s cubic-bezier(0.2, 1.8, 0.4, 1) both; }
@keyframes crown { from { opacity: 0; transform: translateY(-30px) scale(0.3) rotate(-30deg); } to { opacity: 1; transform: none; } }

.final { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: clamp(12px, 2.4vh, 28px); }
.final-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; animation: rise 0.5s both; }
.final-head .display { font-size: clamp(2rem, 4.2vw, 4.4rem); margin-top: 0.6rem; }
.final-actions { display: flex; gap: 0.6rem; }
.page-host .final-list { overflow: auto; align-content: start; padding: 4px 4px 12px; }
.page-host .final-list.many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-host .final-item { padding: clamp(14px, 1.4vw, 22px); }
.page-host .final-q { font-size: clamp(0.95rem, 1.4vw, 1.35rem); }
.page-host .win-chip { font-size: clamp(1rem, 1.6vw, 1.6rem); }
.page-host .final-meta { font-size: clamp(0.85rem, 1.05vw, 1.05rem); }
.page-host .final-num { width: 2.8rem; height: 2.8rem; font-size: 1.2rem; }

@media (max-width: 900px) {
  .page-host { overflow: auto; }
  .stage { height: auto; min-height: 100dvh; }
  .stage-top { grid-template-columns: 1fr; justify-items: center; }
  .controls { justify-self: center; flex-wrap: wrap; justify-content: center; }
  .lobby, .q-hero { grid-template-columns: 1fr; }
  .join-box { flex-direction: column; align-items: flex-start; }
  .opts, .page-host .final-list.many { grid-template-columns: 1fr; }
  .btn kbd { display: none; }
}

/* ---------- admin ---------- */
.page-admin #app { max-width: 1040px; margin: 0 auto; padding: 16px 16px 120px; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.5rem 0 1.5rem; }
.admin-nav { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.admin-head .muted { margin-top: 0.5rem; font-size: 1rem; }

.live-banner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.2rem; margin-bottom: 1.5rem; border-color: rgba(38, 208, 124, 0.55); }
.live-info { flex: 1; min-width: 12rem; display: flex; flex-direction: column; }

.poll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.poll-card { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.3rem; animation: rise 0.45s both; animation-delay: calc(var(--i) * 60ms); }
.poll-card h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; overflow-wrap: anywhere; }
.poll-card-shapes { display: flex; gap: 0.35rem; font-size: 0.85rem; }
.poll-card-shapes .shape { width: 1.7rem; height: 1.7rem; color: var(--mint); }
.poll-card-actions { display: flex; gap: 0.5rem; margin-top: auto; padding-top: 0.6rem; flex-wrap: wrap; }
.poll-card-actions .btn-icon { margin-left: auto; }
.empty-state { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 0.8rem; text-align: center; padding: 3rem 1.5rem; }
.empty-state h2 { font-size: 1.5rem; font-weight: 800; }

.editor { display: flex; flex-direction: column; gap: 1rem; }
.back { align-self: flex-start; color: var(--ink-2); text-decoration: none; font-weight: 700; }
.back:hover { color: #fff; }
.editor-meta { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 1rem; padding: 1.2rem; }
.editor-meta label { display: flex; flex-direction: column; gap: 0.45rem; }
.editor-meta label > span, .q-num { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.q-list { display: flex; flex-direction: column; gap: 1rem; }
.q-card { display: flex; flex-direction: column; gap: 0.8rem; padding: 1.1rem 1.2rem 1.2rem; animation: rise 0.35s both; }
.q-card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.q-tools { display: flex; gap: 0.3rem; }
.q-tools .btn-icon { width: 2.2rem; height: 2.2rem; font-size: 0.95rem; }
.q-input { font-size: 1.15rem; font-weight: 700; }
.opt-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.opt-input {
  --c: var(--o0);
  display: flex; align-items: center; gap: 0.6rem; padding: 0 0.4rem 0 0.55rem; border-radius: 16px;
  background: rgba(255, 255, 255, 0.07); border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.opt-input:focus-within { border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
.opt-input .shape { width: 1.7rem; height: 1.7rem; }
.opt-input input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 0.8rem 0.4rem; font-weight: 600; }
.opt-input input::placeholder { color: var(--ink-3); }
.add-q { align-self: stretch; padding: 1rem; border-style: dashed; border-width: 2px; font-size: 1rem; }
.bulk { padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.bulk summary { cursor: pointer; font-weight: 700; }
.bulk[open] > * + * { margin-top: 0.8rem; }
.bulk .btn { align-self: flex-start; }

.save-bar {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  width: min(1008px, calc(100% - 32px)); display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.7rem 0.8rem 0.7rem 1.3rem; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: 0 20px 50px -20px #000;
}
.save-actions { display: flex; gap: 0.5rem; }
.page-admin .toast-wrap { bottom: 110px; }
.save-status { font-weight: 700; color: var(--ink-3); }
.save-status.pending { color: #ffd37a; }
.save-status.ok { color: #8ef5c0; }
.save-status.error { color: #ffb0b0; }

@media (max-width: 640px) {
  .editor-meta, .opt-inputs { grid-template-columns: 1fr; }
  .save-bar { flex-direction: column; align-items: stretch; border-radius: 24px; }
  .save-actions .btn { flex: 1; }
  .admin-nav .btn { padding: 0.6rem 0.8rem; font-size: 0.85rem; }
}

/* ---------- fotos en las respuestas ---------- */
.photo { display: block; object-fit: cover; object-position: center 22%; background: rgba(255, 255, 255, 0.12); }

/* pantalla grande: tarjetas verticales con la foto arriba */
.q-screen.has-photos { grid-template-rows: auto minmax(0, 1fr); }
.has-photos .q-title { font-size: clamp(1.5rem, 3.1vw, 3.3rem); }
.has-photos .ring { --size: clamp(80px, 8.5vw, 130px); }
.has-photos .q-stats { flex-direction: row; gap: 1.6rem; }
.opts.photos { min-height: 0; height: 100%; grid-template-rows: minmax(0, 1fr); grid-template-columns: repeat(4, minmax(0, 1fr)); justify-content: center; }
.opts.photos.n2 { grid-template-columns: repeat(2, minmax(0, 440px)); }
.opts.photos.n3 { grid-template-columns: repeat(3, minmax(0, 400px)); }
.opts.photos.n3 .opt:last-child { grid-column: auto; }
.opt.photo-card {
  flex-direction: column; align-items: stretch; gap: 0; min-height: 0; height: 100%;
  padding: clamp(8px, 0.8vw, 12px) clamp(8px, 0.8vw, 12px) 0; border-radius: 28px;
}
.photo-card .photo-wrap {
  position: relative; flex: 1; min-height: 0; border-radius: 20px; overflow: hidden;
  background: color-mix(in srgb, var(--c) 22%, #fff);
}
.photo-card .photo-wrap .photo { width: 100%; height: 100%; }
.opt.photo-card .photo-wrap > .shape { position: absolute; inset: 0; margin: auto; width: 42%; height: auto; aspect-ratio: 1; padding: 8%; border-radius: 22%; }
.photo-card .txt { flex: none; text-align: center; padding: 0.45em 0.4em 0.6em; font-size: clamp(1.05rem, 1.9vw, 2rem); font-weight: 800; }
.photo-card .stat {
  position: absolute; top: 10px; right: 10px; z-index: 2; padding: 0.35em 0.7em; border-radius: 16px;
  background: rgba(0, 45, 41, 0.86); color: #fff; font-size: clamp(1rem, 1.6vw, 1.7rem);
}
.opt.photo-card .fill { top: auto; bottom: 0; height: 12px; border-right: 0; background: var(--c); z-index: 2; }
.opts.reveal .photo-card.lose .photo { filter: grayscale(0.85); }

/* celular: 2×2 con foto grande */
.vote-grid.photos { flex: none; max-height: none; grid-template-columns: 1fr 1fr; grid-auto-rows: auto; }
.vote-btn.photo-card { flex-direction: column; align-items: stretch; gap: 0.5rem; padding: 7px 7px 11px; text-align: center; border-radius: 22px; }
.vote-btn.photo-card .photo { width: 100%; aspect-ratio: 4 / 5; border-radius: 16px; }
.vote-btn.photo-card > .shape { width: 100%; height: auto; aspect-ratio: 4 / 5; padding: 26% 22%; border-radius: 16px; }
.vote-btn.photo-card .vote-label { font-size: 1.05rem; font-weight: 800; }
.vote-btn.photo-card .check { position: absolute; top: 14px; right: 14px; }

.winner-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.winner-opts.photos .winner-opt { flex-direction: column; gap: 0.5rem; padding: 8px 8px 12px; border-radius: 22px; }
.winner-opts.photos .winner-opt .photo { width: 150px; aspect-ratio: 4 / 5; border-radius: 16px; }
.winner-opts.photos .winner-opt > .shape { width: 150px; height: auto; aspect-ratio: 4 / 5; padding: 30px; border-radius: 16px; }
.mini-bars .photo { width: 2.4rem; height: 2.4rem; border-radius: 50%; }
.your-pick .photo { width: 3.4rem; height: 3.4rem; border-radius: 50%; }
.win-chip .photo { width: 2.3em; height: 2.3em; border-radius: 50%; }
.win-chip.with-photo { padding-left: 0.3rem; }
.page-host .win-chip .photo { width: 3.2em; height: 3.2em; }

/* admin: miniatura de la foto junto a la respuesta */
.opt-input { padding: 0.35rem 0.35rem 0.35rem 0.45rem; min-height: 3.5rem; }
.opt-thumb { flex: none; width: 2.6rem; height: 3.2rem; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: none; }
.opt-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.opt-input .opt-photo { flex: none; width: 2.3rem; height: 2.3rem; border: 0; background: rgba(255, 255, 255, 0.1); font-size: 0.95rem; }

/* ---------- admin: pestañas y respuestas guardadas ---------- */
.admin-tabs {
  display: flex; gap: 0.35rem; width: fit-content; max-width: 100%; margin-bottom: 1.5rem; padding: 0.35rem;
  border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line);
}
.admin-tab { padding: 0.6rem 1.25rem; border-radius: 999px; font-weight: 700; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.admin-tab:hover { color: #fff; }
.admin-tab.active { background: var(--mint); color: var(--deep); }
.head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.82rem; }
.btn-icon.btn-sm { width: 2.1rem; height: 2.1rem; }
.editor-tip { color: var(--ink-3); font-weight: 600; font-size: 0.9rem; padding: 0 0.3rem; }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 1rem; }
.lib-card {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 7px 7px 9px; border-radius: 22px; border: 0;
  background: #fff; color: var(--deep); text-align: center; animation: rise 0.35s both;
  box-shadow: 0 18px 34px -20px rgba(0, 0, 0, 0.7);
}
.lib-photo { position: relative; display: block; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--mint) 22%, #fff); }
.lib-photo .photo { width: 100%; height: 100%; }
.lib-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.lib-empty .shape { width: 44%; height: auto; aspect-ratio: 1; padding: 9%; border-radius: 24%; background: var(--green); color: #fff; }
.lib-photo-btn { position: relative; padding: 0; border: 0; background: none; border-radius: 16px; }
.lib-photo-hint {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 0.3rem 0.7rem; border-radius: 999px;
  background: rgba(0, 45, 41, 0.82); color: #fff; font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  opacity: 0; transition: opacity 0.2s;
}
.lib-photo-btn:hover .lib-photo-hint, .lib-photo-btn:focus-visible .lib-photo-hint { opacity: 1; }
.lib-card:has(.lib-empty) .lib-photo-hint { opacity: 1; }
.lib-name-input {
  width: 100%; padding: 0.35rem 0.4rem; border: 0; border-bottom: 2px dashed transparent; border-radius: 8px;
  background: transparent; color: var(--deep); font-weight: 800; font-size: 1rem; text-align: center; outline: none;
}
.lib-name-input:hover { border-bottom-color: rgba(0, 83, 76, 0.25); }
.lib-name-input:focus { border-bottom-color: var(--mint); background: rgba(38, 208, 124, 0.12); }
.lib-name-input.pending { color: #b7791f; }
.lib-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.lib-card .btn { color: var(--deep); background: rgba(0, 83, 76, 0.08); border-color: transparent; }
.lib-card .btn:hover { background: rgba(0, 83, 76, 0.16); }
.lib-card .btn-danger { color: #c53030; }
.lib-name { font-weight: 800; padding: 0 0.3rem; overflow-wrap: anywhere; }
.lib-card.pickable { cursor: pointer; transition: transform 0.15s, box-shadow 0.2s; }
.lib-card.pickable:hover, .lib-card.pickable:focus-visible { transform: translateY(-3px); box-shadow: 0 0 0 4px var(--mint), 0 18px 34px -20px rgba(0, 0, 0, 0.7); outline: none; }
.lib-none { grid-column: 1 / -1; text-align: center; padding: 2rem 1rem; }

.modal.wide { width: min(100%, 880px); max-height: min(86dvh, 820px); gap: 1rem; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.modal .lib-grid.pick { overflow: auto; min-height: 0; padding: 4px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
.opt-input .opt-photo + .opt-photo { margin-left: -0.15rem; }

/* ---------- diálogo de confirmación ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 20, 18, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade 0.18s both; transition: opacity 0.18s;
}
.modal-backdrop.out { opacity: 0; }
.modal {
  width: min(100%, 460px); padding: 1.6rem; display: flex; flex-direction: column; gap: 1.4rem;
  border-radius: var(--radius); border: 1px solid var(--line); background: rgba(0, 62, 56, 0.97);
  box-shadow: 0 40px 80px -30px #000; animation: pop 0.3s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.modal-text { font-size: 1.15rem; font-weight: 700; line-height: 1.4; text-wrap: balance; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }
.btn-danger-solid { border-color: transparent; background: #e5484d; color: #fff; font-weight: 800; box-shadow: 0 14px 30px -14px rgba(229, 72, 77, 0.9); }
.btn-danger-solid:hover { background: #f05a5f; }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
