/* Encuesta de Halloween — «¿Qué disfraz uso?» (soykoru.net)
 * Calabazas-tarrito de vidrio que se llenan de dulces. Pensada primero para el
 * teléfono: las calabazas caben en una fila y siempre se ve cuál va ganando.
 * Todo vive bajo .hwe (no toca el resto de la página). */

.hwe {
  --hwe-noche: #120b24;
  --hwe-noche-2: #24123f;
  --hwe-naranja: #ff9a1f;
  --hwe-naranja-2: #ff6a13;
  --hwe-vela: #ffd36b;
  --hwe-oro: #ffd23f;
  --hwe-texto: #fff6ea;
  --hwe-suave: #cdbfe6;
  --hwe-borde: rgba(255, 154, 31, 0.35);
  position: relative;
  margin: 14px auto 18px;
  max-width: 980px;
  border-radius: 26px;
  overflow: hidden;
  isolation: isolate;
  color: var(--hwe-texto);
  background:
    radial-gradient(120% 80% at 50% -10%, #3b1d6b 0%, transparent 60%),
    radial-gradient(60% 50% at 85% 10%, rgba(255, 154, 31, 0.18) 0%, transparent 70%),
    linear-gradient(180deg, var(--hwe-noche-2), var(--hwe-noche));
  border: 1px solid var(--hwe-borde);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-family: "Outfit", system-ui, sans-serif;
}
.hwe.hwe-primera { animation: hwe-entrar 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }
@keyframes hwe-entrar { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ── Cielo: estrellas, luna, niebla y murciélagos ─────────────────────── */
.hwe-cielo { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.hwe-estrella {
  position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px #fff; opacity: 0.7; animation: hwe-titilar 3.2s ease-in-out infinite;
}
@keyframes hwe-titilar { 50% { opacity: 0.15; transform: scale(0.6); } }
.hwe-luna {
  position: absolute; top: -26px; right: 7%; width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #fff8d6, #ffe08a 55%, #e7b84f 100%);
  box-shadow: 0 0 40px 10px rgba(255, 214, 120, 0.35), 0 0 120px 30px rgba(255, 180, 80, 0.15);
  opacity: 0.85;
}
.hwe-luna::after {
  content: ""; position: absolute; left: 22%; top: 30%; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(196, 150, 60, 0.35); box-shadow: 30px 18px 0 -3px rgba(196, 150, 60, 0.3), 12px 34px 0 -5px rgba(196, 150, 60, 0.25);
}
.hwe-niebla {
  position: absolute; left: -20%; right: -20%; bottom: -30px; height: 120px;
  background: radial-gradient(50% 60% at 30% 70%, rgba(190, 160, 255, 0.16), transparent 70%),
    radial-gradient(45% 55% at 75% 75%, rgba(255, 170, 90, 0.12), transparent 70%);
  filter: blur(6px); animation: hwe-niebla 14s ease-in-out infinite alternate;
}
@keyframes hwe-niebla { to { transform: translateX(8%); } }
.hwe-murcielago {
  position: absolute; top: 18%; left: -40px; width: 34px; height: 16px; opacity: 0.8;
  animation: hwe-volar 13s linear infinite;
}
.hwe-murcielago svg { width: 100%; height: 100%; animation: hwe-aletear 0.32s ease-in-out infinite alternate; transform-origin: center; }
@keyframes hwe-aletear { to { transform: scaleY(0.45); } }
@keyframes hwe-volar {
  0% { transform: translate(0, 0); }
  25% { transform: translate(30vw, 24px); }
  50% { transform: translate(60vw, -6px); }
  75% { transform: translate(85vw, 20px); }
  100% { transform: translate(115vw, 0); }
}

/* ── Cabecera ─────────────────────────────────────────────────────────── */
.hwe-cab { position: relative; padding: 18px 18px 6px; text-align: center; }
.hwe-kicker {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: #1a0d05; background: linear-gradient(135deg, var(--hwe-oro), var(--hwe-naranja));
  box-shadow: 0 4px 14px rgba(255, 140, 30, 0.35);
}
.hwe-titulo {
  margin: 8px 0 2px; font-family: "Chewy", "Outfit", system-ui, sans-serif; font-weight: 400;
  font-size: clamp(30px, 8.5vw, 44px); line-height: 1.02; letter-spacing: 0.01em; text-wrap: balance;
  background: linear-gradient(180deg, #fff3d6 10%, #ffb44a 60%, #ff7a1a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #4a1d06) drop-shadow(0 8px 18px rgba(255, 120, 20, 0.35));
}
.hwe-sub { font-size: 13.5px; color: var(--hwe-suave); line-height: 1.4; }
.hwe-sub b { color: var(--hwe-texto); font-variant-numeric: tabular-nums; }
.hwe-reloj { white-space: nowrap; }

/* ── Marcador: quién va ganando (siempre a la vista) ───────────────────── */
.hwe-marcador {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 16px 0;
  padding: 8px 12px; border-radius: 14px; background: rgba(255, 210, 63, 0.1);
  border: 1px solid rgba(255, 210, 63, 0.35); font-size: 13.5px; font-weight: 700;
}
.hwe-marcador .hwe-m-corona { font-size: 18px; animation: hwe-corona 1.6s ease-in-out infinite; }
.hwe-marcador b { color: var(--hwe-oro); }
.hwe-marcador small { color: var(--hwe-suave); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Fila de calabazas ────────────────────────────────────────────────── */
.hwe-fila {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 4px;
  padding: 12px 8px 8px; align-items: end;
}
@media (min-width: 560px) { .hwe-fila { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 14px; padding: 18px 18px 10px; } }

.hwe-cal {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 18px 2px 8px; border: 0; border-radius: 18px; background: transparent; color: inherit;
  font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.25, 1.3), background 0.25s;
}
.hwe-cal:hover { background: rgba(255, 255, 255, 0.04); }
.hwe-cal:active { transform: scale(0.94); }
.hwe-cal:focus-visible { outline: 2px solid var(--hwe-oro); outline-offset: 2px; }
.hwe-cal.elegida { background: rgba(255, 154, 31, 0.12); box-shadow: inset 0 0 0 1.5px rgba(255, 154, 31, 0.55); }
.hwe-tarro {
  width: 100%; max-width: 150px; aspect-ratio: 160 / 170; overflow: visible;
  animation: hwe-flotar 3.6s ease-in-out infinite; animation-delay: var(--hwe-retraso, 0s);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 10px rgba(255, 140, 30, 0.35));
}
@keyframes hwe-flotar { 50% { transform: translateY(-5px) rotate(-1.5deg); } }
.hwe-cal.lider .hwe-tarro {
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 14px rgba(255, 210, 63, 0.75));
}
.hwe-cal.lider::before {
  content: ""; position: absolute; inset: 10px 0 34px; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 210, 63, 0.35), transparent);
  animation: hwe-halo 2.4s ease-in-out infinite;
}
@keyframes hwe-halo { 50% { opacity: 0.45; transform: scale(1.08); } }
.hwe-corona {
  position: absolute; top: -6px; left: 50%; width: 38px; margin-left: -19px; z-index: 2;
  animation: hwe-corona 1.6s ease-in-out infinite; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
@keyframes hwe-corona { 50% { transform: translateY(-3px) rotate(-6deg); } }
.hwe-puesto {
  position: absolute; top: 14px; left: 4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #1a0d05;
  background: linear-gradient(135deg, #fff1b8, var(--hwe-oro)); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.hwe-cal:not(.lider) .hwe-puesto { background: rgba(255, 255, 255, 0.16); color: var(--hwe-texto); }
.hwe-nombre {
  margin-top: 2px; max-width: 100%; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 800; line-height: 1.2;
  text-align: center; overflow-wrap: break-word; hyphens: auto; background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hwe-cal.lider .hwe-nombre { background: linear-gradient(135deg, #ffe08a, #ffb02e); color: #2a1505; border-color: transparent; }
@media (min-width: 560px) { .hwe-nombre { font-size: 14px; } }
.hwe-cuenta {
  font-family: "Chewy", "Outfit", system-ui, sans-serif; font-size: 18px; color: var(--hwe-vela);
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.hwe-cuenta.subio { animation: hwe-subio 0.6s ease; }
@keyframes hwe-subio { 30% { transform: scale(1.35); color: #fff; } }
.hwe-pct { font-size: 10.5px; color: var(--hwe-suave); font-weight: 700; font-variant-numeric: tabular-nums; }
.hwe-mios { font-size: 10px; font-weight: 800; color: #ffb4d6; }
.hwe-por { font-size: 9.5px; color: var(--hwe-suave); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* El montón sube al aparecer (solo la primera vez) */
.hwe-primera .hwe-relleno { animation: hwe-subir 1.2s cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }
@keyframes hwe-subir { from { transform: translateY(70px); } }
.hwe-llama { opacity: 0.8; animation: hwe-llama 3.6s ease-in-out infinite alternate; }

/* Dulces cayendo, parpadeo y piezas que se mueven: van con SMIL dentro del SVG
   (ver encuesta.js). Acá solo se muestra u oculta la lluvia. */
.hwe-cae-extra { display: none; }
.hwe-cal.llueve .hwe-cae-extra { display: inline; }
.hwe-brillo-ojo { animation: hwe-brillo-ojo 2.2s ease-in-out infinite; }
@keyframes hwe-brillo-ojo { 50% { opacity: 0.35; } }
.hwe-talla { animation: hwe-talla 3.2s ease-in-out infinite alternate; }
@keyframes hwe-talla { to { fill: #ffc65c; } }
.hwe-chispazo { opacity: 0; animation: hwe-chispazo 2.2s steps(1) infinite; }
@keyframes hwe-chispazo { 0%, 100% { opacity: 0; } 8% { opacity: 1; } 14% { opacity: 0; } 18% { opacity: 1; } 24% { opacity: 0; } }
.hwe-tarro.chico { animation: none; max-width: none; }

/* Tira de actividad (quién tiró qué) */
.hwe-ticker {
  margin: 8px 16px 0; height: 22px; overflow: hidden; text-align: center; font-size: 12.5px; color: var(--hwe-suave);
}
.hwe-ticker b { color: var(--hwe-texto); }
.hwe-ticker small { color: var(--hwe-suave); opacity: 0.8; }
.hwe-ticker-txt { display: inline-block; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hwe-ticker-txt.entra { animation: hwe-ticker 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.2); }
@keyframes hwe-ticker { from { transform: translateY(14px); opacity: 0; } }
@keyframes hwe-llama { to { opacity: 1; } }
.hwe-cal.nam .hwe-tarro { animation: hwe-nam 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.4); }
@keyframes hwe-nam { 30% { transform: scale(1.14, 0.88); } 60% { transform: scale(0.94, 1.08); } }

/* Calabaza «comprar la tuya» */
.hwe-nueva .hwe-tarro { animation: none; opacity: 0.95; }
.hwe-nueva .hwe-nombre { color: var(--hwe-oro); }
.hwe-nueva .hwe-cuenta { font-family: "Outfit", system-ui, sans-serif; font-size: 11px; font-weight: 800; color: var(--hwe-suave); }

.hwe-pie {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; padding: 4px 16px 16px;
  font-size: 12px; color: var(--hwe-suave);
}
.hwe-pie b { color: var(--hwe-texto); }
.hwe-cta {
  display: block; width: calc(100% - 32px); margin: 2px auto 16px; padding: 13px 16px; border: 0; border-radius: 16px;
  font: inherit; font-weight: 900; font-size: 15.5px; color: #1a0d05; cursor: pointer;
  background: linear-gradient(135deg, #ffe08a, var(--hwe-naranja) 55%, var(--hwe-naranja-2));
  box-shadow: 0 8px 22px rgba(255, 120, 20, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.2s;
}
.hwe-cta:active { transform: scale(0.97); }
.hwe-cerrada .hwe-cta { display: none; }

/* ── Hoja de abajo: tienda de dulces / comprar calabaza ────────────────── */
.hwe-velo {
  position: fixed; inset: 0; z-index: 1000; background: rgba(8, 4, 18, 0.55); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.25s;
}
.hwe-velo.ver { opacity: 1; }
.hwe-hoja {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; max-width: 520px; margin: 0 auto;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 26px 26px 0 0; color: #fff6ea;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 154, 31, 0.22), transparent 60%),
    linear-gradient(180deg, #2a1548, #160b2b);
  border: 1px solid rgba(255, 154, 31, 0.35); border-bottom: 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.5);
  transform: translateY(105%); transition: transform 0.38s cubic-bezier(0.2, 0.9, 0.25, 1.1);
  font-family: "Outfit", system-ui, sans-serif;
}
.hwe-hoja.ver { transform: none; }
.hwe-asa { width: 44px; height: 5px; margin: 0 auto 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.25); }
.hwe-hoja-cab { display: flex; align-items: center; gap: 12px; }
.hwe-hoja-cab svg { width: 74px; height: 79px; flex: none; filter: drop-shadow(0 0 12px rgba(255, 140, 30, 0.55)); }
.hwe-hoja-cab h3 { font-family: "Chewy", "Outfit", system-ui, sans-serif; font-weight: 400; font-size: 26px; line-height: 1; color: #ffd36b; }
.hwe-hoja-cab p { font-size: 13px; color: #cdbfe6; margin-top: 3px; }
.hwe-hoja-cab p b { color: #fff6ea; }
.hwe-x {
  margin-left: auto; align-self: flex-start; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.08); color: #fff6ea; font-size: 18px; line-height: 1;
}
.hwe-paquetes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 10px; }
.hwe-paq {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px 9px;
  border-radius: 16px; border: 1.5px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.05);
  color: inherit; font: inherit; cursor: pointer; transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.hwe-paq:active { transform: scale(0.95); }
.hwe-paq.sel { border-color: var(--hwe-oro, #ffd23f); background: rgba(255, 210, 63, 0.14); box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.15); }
.hwe-paq-ic { font-size: 22px; line-height: 1; letter-spacing: -6px; padding-right: 6px; }
.hwe-paq b { font-family: "Chewy", "Outfit", system-ui, sans-serif; font-weight: 400; font-size: 18px; }
.hwe-paq small { font-size: 11.5px; color: #cdbfe6; font-weight: 700; font-variant-numeric: tabular-nums; }
.hwe-paq .hwe-paq-tag {
  position: absolute; top: -8px; right: -4px; padding: 2px 6px; border-radius: 999px; font-size: 9.5px; font-weight: 900;
  color: #1a0d05; background: #ffd23f;
}
.hwe-saldo { display: flex; justify-content: space-between; font-size: 12.5px; color: #cdbfe6; margin: 2px 2px 10px; }
.hwe-saldo b { color: #fff6ea; font-variant-numeric: tabular-nums; }
.hwe-tirar {
  width: 100%; padding: 15px 16px; border: 0; border-radius: 18px; cursor: pointer;
  font: inherit; font-weight: 900; font-size: 16.5px; color: #1a0d05;
  background: linear-gradient(135deg, #ffe08a, #ff9a1f 55%, #ff6a13);
  box-shadow: 0 10px 26px rgba(255, 120, 20, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.hwe-tirar:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.hwe-nota { margin-top: 9px; font-size: 11.5px; text-align: center; color: #b9abd6; line-height: 1.4; }
.hwe-campo {
  width: 100%; margin: 14px 0 6px; padding: 13px 14px; border-radius: 14px; font: inherit; font-size: 16px;
  color: #fff6ea; background: rgba(255, 255, 255, 0.07); border: 1.5px solid rgba(255, 154, 31, 0.45); outline: none;
}
.hwe-campo:focus { border-color: #ffd23f; box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.18); }
.hwe-error { min-height: 16px; font-size: 12px; color: #ff9db0; margin-bottom: 8px; }
.hwe-normas {
  margin: 4px 0 8px; border-radius: 14px; background: rgba(255, 210, 63, 0.08); border: 1px solid rgba(255, 210, 63, 0.3);
}
.hwe-normas summary {
  cursor: pointer; list-style: none; padding: 10px 12px; font-size: 12.5px; font-weight: 800; color: #ffd36b; line-height: 1.35;
}
.hwe-normas summary::before { content: "🛡️ "; }
.hwe-normas summary::after { content: " ▾"; color: #cdbfe6; }
.hwe-normas[open] summary::after { content: " ▴"; }
.hwe-normas ul { margin: 0; padding: 0 14px 10px 30px; font-size: 12px; color: #e9def8; line-height: 1.5; }
.hwe-acepto { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: #e9def8; margin: 2px 2px 4px; cursor: pointer; }
.hwe-acepto input { width: 18px; height: 18px; accent-color: #ff9a1f; margin-top: 1px; flex: none; }

/* Dulces que vuelan */
.hwe-vuela {
  position: fixed; z-index: 1002; left: 0; top: 0; font-size: 22px; pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45)); will-change: transform;
}
.hwe-mas-dulces {
  position: fixed; z-index: 1002; pointer-events: none; font-family: "Chewy", "Outfit", system-ui, sans-serif;
  font-size: 22px; color: #ffd36b; text-shadow: 0 2px 0 #4a1d06, 0 0 12px rgba(255, 160, 40, 0.8);
  animation: hwe-flota-txt 1.2s ease-out forwards;
}
@keyframes hwe-flota-txt { to { transform: translateY(-46px); opacity: 0; } }

/* Pastilla flotante: quién va ganando aunque bajes en la página */
.hwe-pastilla {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 900;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 999px; border: 0;
  font: 800 13px "Outfit", system-ui, sans-serif; color: #fff6ea; cursor: pointer;
  background: linear-gradient(135deg, rgba(42, 21, 72, 0.96), rgba(22, 11, 43, 0.96));
  border: 1px solid rgba(255, 154, 31, 0.45); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 140, 30, 0.25);
  transform: translate(-50%, 140%); transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.25, 1.2);
  max-width: calc(100vw - 32px);
}
.hwe-pastilla.ver { transform: translate(-50%, 0); }
.hwe-pastilla .hwe-p-cal { font-size: 18px; animation: hwe-corona 1.6s ease-in-out infinite; }
.hwe-pastilla { white-space: nowrap; }
.hwe-pastilla > span { flex: none; }
.hwe-pastilla b { color: #ffd23f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hwe-pastilla small { color: #cdbfe6; font-variant-numeric: tabular-nums; }

/* Panel del dueño */
.hwe-admin-fila { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border, #2a264a); }
.hwe-admin-fila small { color: var(--muted, #9b97b8); }
.hwe-admin-total { margin: 10px 0; color: var(--muted, #9b97b8); }

@media (prefers-reduced-motion: reduce) {
  .hwe *, .hwe, .hwe-hoja, .hwe-pastilla { animation: none !important; transition: none !important; }
}
