/* Votazione maratona horror di Halloween: si appoggia a style.css del sito principale. */
.halloween-page {
  --pumpkin: #FF7A1A;
  --pumpkin-glow: rgba(255, 122, 26, 0.35);
  --font-creepy: 'Creepster', var(--font-display);
  background: radial-gradient(circle at 50% 0, rgba(255, 122, 26, 0.08), transparent 40rem), var(--color-background);
}

/* Hero */
.halloween-hero {
  position: relative;
  display: flex;
  min-height: min(44rem, 100vh);
  align-items: center;
  padding: calc(var(--nav-clearance) + 3rem) 0 7rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 28%, rgba(255, 122, 26, 0.2), transparent 22rem),
    radial-gradient(circle at 12% 80%, rgba(198, 92, 231, 0.18), transparent 26rem),
    linear-gradient(160deg, #05070F, var(--color-surface-alt));
}

.halloween-hero > .container { position: relative; z-index: 3; }

.halloween-moon {
  position: absolute;
  top: 16%;
  right: 8%;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #FFF3C4, #F5C46A 55%, #C9822E);
  box-shadow: 0 0 80px 20px rgba(245, 196, 106, 0.25);
  opacity: 0.85;
}

.halloween-badge {
  border-color: rgba(255, 122, 26, 0.5);
  color: var(--pumpkin);
  background: rgba(255, 122, 26, 0.1);
}

.halloween-title {
  font-family: var(--font-creepy);
  font-size: clamp(3.2rem, 9vw, 6.5rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--pumpkin);
  text-shadow: 0 0 24px var(--pumpkin-glow), 0 4px 0 rgba(42, 26, 59, 0.9);
}

.halloween-countdown {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1.4rem;
  border: 1px solid rgba(255, 122, 26, 0.4);
  border-radius: var(--radius-md);
  background: rgba(9, 13, 27, 0.6);
  backdrop-filter: blur(8px);
}

.halloween-countdown__label { color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.halloween-countdown__value { font-family: var(--font-display); font-size: 1.8rem; color: var(--color-text); font-variant-numeric: tabular-nums; }

/* Decorazioni */
.halloween-web {
  position: absolute;
  top: calc(var(--nav-clearance) - 2rem);
  width: 12rem;
  height: 12rem;
  fill: none;
  stroke: rgba(238, 243, 237, 0.22);
  stroke-width: 1.2;
  pointer-events: none;
  z-index: 1;
}

.halloween-web--left { left: 0; }
.halloween-web--right { right: 0; transform: scaleX(-1); }

.halloween-spider {
  position: absolute;
  top: calc(var(--nav-clearance) - 2rem);
  left: 9rem;
  z-index: 2;
  width: 2px;
  height: 7rem;
  background: rgba(238, 243, 237, 0.35);
  transform-origin: top center;
  animation: halloween-spider-drop 6s ease-in-out infinite;
}

.halloween-spider span {
  position: absolute;
  bottom: -0.9rem;
  left: -0.75rem;
  width: 1.5rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #0B0B12;
  box-shadow: -0.55rem -0.15rem 0 -0.4rem #0B0B12, 0.55rem -0.15rem 0 -0.4rem #0B0B12;
}

.halloween-spider span::before,
.halloween-spider span::after {
  content: '';
  position: absolute;
  top: 0.45rem;
  width: 2.3rem;
  height: 0.35rem;
  left: -0.4rem;
  border-top: 2px solid #0B0B12;
  border-bottom: 2px solid #0B0B12;
}

.halloween-spider span::after { top: 0.15rem; transform: rotate(8deg); }

.halloween-bats { position: absolute; inset: 0; pointer-events: none; z-index: 2; }

.halloween-bat {
  position: absolute;
  width: 3.4rem;
  fill: #05070F;
  filter: drop-shadow(0 0 6px rgba(255, 122, 26, 0.35));
  animation: halloween-bat-fly 14s linear infinite;
}

.halloween-bat:nth-child(1) { top: 22%; left: -10%; }
.halloween-bat:nth-child(2) { top: 36%; left: -10%; width: 2.4rem; animation-duration: 18s; animation-delay: -6s; }
.halloween-bat:nth-child(3) { top: 14%; left: -10%; width: 2rem; animation-duration: 22s; animation-delay: -12s; }

.halloween-wisps i { background: var(--pumpkin) !important; box-shadow: 0 0 14px var(--pumpkin) !important; }

.halloween-pumpkins { position: relative; display: flex; justify-content: center; align-items: flex-end; gap: 0.5rem; }
.halloween-pumpkin { width: 13rem; filter: drop-shadow(0 0 30px var(--pumpkin-glow)); animation: halloween-pumpkin-glow 3.5s ease-in-out infinite; }
.halloween-pumpkin--small { width: 7.5rem; animation-delay: -1.4s; }
.halloween-pumpkin__body { fill: var(--pumpkin); }
.halloween-pumpkin__rib { fill: none; stroke: rgba(120, 45, 0, 0.45); stroke-width: 3; }
.halloween-pumpkin__stem { fill: var(--color-primary-dark); }
.halloween-pumpkin__face { fill: #FFE27A; }

.halloween-fog { position: absolute; left: 0; right: 0; bottom: 0; height: 12rem; z-index: 2; pointer-events: none; overflow: hidden; }

.halloween-fog span {
  position: absolute;
  bottom: -4rem;
  left: -50%;
  width: 200%;
  height: 10rem;
  background: radial-gradient(ellipse at 25% 50%, rgba(238, 243, 237, 0.14), transparent 45%), radial-gradient(ellipse at 70% 60%, rgba(198, 92, 231, 0.14), transparent 40%);
  filter: blur(14px);
  animation: halloween-fog-drift 26s linear infinite;
}

.halloween-fog span + span { bottom: -6rem; opacity: 0.7; animation-duration: 38s; animation-direction: reverse; }

/* Sezioni: due ragnatele di scala diversa sovrapposte, così la trama non sembra una piastrella ripetuta. */
.halloween-crypt {
  padding: 1rem 0 3rem;
  background:
    radial-gradient(ellipse at 12% 18%, rgba(255, 122, 26, 0.08), transparent 32rem),
    radial-gradient(ellipse at 88% 72%, rgba(198, 92, 231, 0.12), transparent 34rem),
    url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22360%22 height=%22360%22 viewBox=%220 0 360 360%22%3E%3Cpath d=%22M180 180L435.6 180.0M180 180L360.7 360.7M180 180L180.0 435.6M180 180L-0.7 360.7M180 180L-75.6 180.0M180 180L-0.7 -0.7M180 180L180.0 -75.6M180 180L360.7 -0.7M208.0 180.0Q200.2 188.4 199.8 199.8Q188.4 200.2 180.0 208.0Q171.6 200.2 160.2 199.8Q159.8 188.4 152.0 180.0Q159.8 171.6 160.2 160.2Q171.6 159.8 180.0 152.0Q188.4 159.8 199.8 160.2Q200.2 171.6 208.0 180.0M238.0 180.0Q221.8 197.3 221.0 221.0Q197.3 221.8 180.0 238.0Q162.7 221.8 139.0 221.0Q138.2 197.3 122.0 180.0Q138.2 162.7 139.0 139.0Q162.7 138.2 180.0 122.0Q197.3 138.2 221.0 139.0Q221.8 162.7 238.0 180.0M272.0 180.0Q246.3 207.5 245.1 245.1Q207.5 246.3 180.0 272.0Q152.5 246.3 114.9 245.1Q113.7 207.5 88.0 180.0Q113.7 152.5 114.9 114.9Q152.5 113.7 180.0 88.0Q207.5 113.7 245.1 114.9Q246.3 152.5 272.0 180.0M310.0 180.0Q273.7 218.8 271.9 271.9Q218.8 273.7 180.0 310.0Q141.2 273.7 88.1 271.9Q86.3 218.8 50.0 180.0Q86.3 141.2 88.1 88.1Q141.2 86.3 180.0 50.0Q218.8 86.3 271.9 88.1Q273.7 141.2 310.0 180.0M352.0 180.0Q303.9 231.3 301.6 301.6Q231.3 303.9 180.0 352.0Q128.7 303.9 58.4 301.6Q56.1 231.3 8.0 180.0Q56.1 128.7 58.4 58.4Q128.7 56.1 180.0 8.0Q231.3 56.1 301.6 58.4Q303.9 128.7 352.0 180.0%22 fill=%22none%22 stroke=%22rgba(238,243,237,0.07)%22 stroke-width=%221%22/%3E%3C/svg%3E") 0 0 / 360px 360px,
    url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22560%22 height=%22560%22 viewBox=%220 0 560 560%22%3E%3Cpath d=%22M280 280L677.6 280.0M280 280L561.1 561.1M280 280L280.0 677.6M280 280L-1.1 561.1M280 280L-117.6 280.0M280 280L-1.1 -1.1M280 280L280.0 -117.6M280 280L561.1 -1.1M320.0 280.0Q308.8 291.9 308.3 308.3Q291.9 308.8 280.0 320.0Q268.1 308.8 251.7 308.3Q251.2 291.9 240.0 280.0Q251.2 268.1 251.7 251.7Q268.1 251.2 280.0 240.0Q291.9 251.2 308.3 251.7Q308.8 268.1 320.0 280.0M365.0 280.0Q341.3 305.4 340.1 340.1Q305.4 341.3 280.0 365.0Q254.6 341.3 219.9 340.1Q218.7 305.4 195.0 280.0Q218.7 254.6 219.9 219.9Q254.6 218.7 280.0 195.0Q305.4 218.7 340.1 219.9Q341.3 254.6 365.0 280.0M415.0 280.0Q377.3 320.3 375.5 375.5Q320.3 377.3 280.0 415.0Q239.7 377.3 184.5 375.5Q182.7 320.3 145.0 280.0Q182.7 239.7 184.5 184.5Q239.7 182.7 280.0 145.0Q320.3 182.7 375.5 184.5Q377.3 239.7 415.0 280.0M472.0 280.0Q418.4 337.3 415.8 415.8Q337.3 418.4 280.0 472.0Q222.7 418.4 144.2 415.8Q141.6 337.3 88.0 280.0Q141.6 222.7 144.2 144.2Q222.7 141.6 280.0 88.0Q337.3 141.6 415.8 144.2Q418.4 222.7 472.0 280.0M535.0 280.0Q463.8 356.1 460.3 460.3Q356.1 463.8 280.0 535.0Q203.9 463.8 99.7 460.3Q96.2 356.1 25.0 280.0Q96.2 203.9 99.7 99.7Q203.9 96.2 280.0 25.0Q356.1 96.2 460.3 99.7Q463.8 203.9 535.0 280.0%22 fill=%22none%22 stroke=%22rgba(198,92,231,0.08)%22 stroke-width=%221%22/%3E%3C/svg%3E") 190px 130px / 560px 560px,
    var(--color-background);
}

.halloween-section { position: relative; padding: 3rem 0; }

.halloween-panel {
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid rgba(255, 122, 26, 0.22);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(42, 26, 59, 0.75), rgba(18, 27, 54, 0.9));
  box-shadow: var(--shadow-card), inset 0 0 60px rgba(255, 122, 26, 0.05);
}

.halloween-panel--form { max-width: 40rem; margin: 0 auto; }

.halloween-kicker { display: inline-block; margin-bottom: 0.35rem; color: var(--pumpkin); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.halloween-total { color: var(--text-secondary); font-size: 0.95rem; }

/* Grafico */
.vote-chart { position: relative; overflow-x: clip; }
.vote-chart__svg { display: block; width: 100%; max-width: 46rem; height: auto; margin: 0 auto; overflow: visible; }

.vote-chart__slice {
  stroke: var(--color-background);
  stroke-width: 3;
  cursor: pointer;
  transition: opacity 0.2s ease, filter 0.2s ease;
  outline: none;
}

.vote-chart__slices:has(.is-active) .vote-chart__slice:not(.is-active) { opacity: 0.45; }
.vote-chart__slice.is-active, .vote-chart__slice:focus-visible { filter: drop-shadow(0 0 12px rgba(255, 122, 26, 0.6)); }

.vote-chart__percent { fill: #0B0B12; font-family: var(--font-display); font-size: 20px; font-weight: 700; pointer-events: none; }
.vote-chart__leader { fill: none; stroke-width: 1.5; opacity: 0.8; }

.vote-chart__label {
  fill: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.vote-chart__label.is-active, .vote-chart__label:hover, .vote-chart__label:focus-visible { fill: var(--pumpkin); text-decoration: underline; }

.vote-chart__empty { margin: 2rem 0; padding: 3rem 1rem; border: 1px dashed rgba(255, 122, 26, 0.35); border-radius: var(--radius-md); color: var(--text-secondary); text-align: center; }

.vote-tooltip {
  position: fixed;
  z-index: 2000;
  min-width: 11rem;
  max-width: 17rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 122, 26, 0.5);
  border-radius: var(--radius-sm);
  background: rgba(9, 13, 27, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.vote-tooltip strong { display: block; color: var(--pumpkin); font-family: var(--font-display); }
.vote-tooltip__meta { display: block; margin-bottom: 0.4rem; color: var(--text-secondary); font-size: 0.8rem; }
.vote-tooltip ul { max-height: 12rem; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; font-size: 0.9rem; }
.vote-tooltip li::before { content: '🦇 '; }

/* Form */
.vote-form .form-label { font-weight: 600; }
.vote-form legend.form-label { float: none; margin-bottom: 0.5rem; font-size: 1rem; }

.vote-form .form-control {
  border-color: var(--border-strong);
  color: var(--color-text);
  background-color: rgba(9, 13, 27, 0.7);
}

.vote-form .form-control::placeholder { color: var(--text-muted); }

.vote-form .form-control:focus {
  border-color: var(--pumpkin);
  box-shadow: 0 0 0 0.2rem var(--pumpkin-glow);
}

/* Scelta del gioco: radio nascosti dietro pulsanti a pillola. */
.vote-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: 0.6rem; }

.vote-game { position: relative; display: block; margin: 0; cursor: pointer; }
.vote-game__input { position: absolute; opacity: 0; pointer-events: none; }

.vote-game__body {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--slice-color, var(--border-strong));
  border-radius: var(--radius-sm);
  background: rgba(9, 13, 27, 0.7);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.vote-game__name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.vote-game__count { color: var(--text-secondary); font-size: 0.78rem; }

.vote-game:hover .vote-game__body { border-color: rgba(255, 122, 26, 0.6); transform: translateY(-1px); }

.vote-game__input:checked + .vote-game__body {
  border-color: var(--pumpkin);
  background: rgba(255, 122, 26, 0.16);
  box-shadow: 0 0 0 1px var(--pumpkin), 0 8px 24px var(--pumpkin-glow);
}

.vote-game__input:checked + .vote-game__body .vote-game__name::before { content: '🎃 '; }
.vote-game__input:focus-visible + .vote-game__body { outline: 2px solid var(--pumpkin); outline-offset: 2px; }
.vote-game__input:disabled + .vote-game__body { opacity: 0.55; cursor: not-allowed; transform: none; }

.vote-game--new .vote-game__body { flex-direction: row; align-items: center; justify-content: flex-start; gap: 0.5rem; border-style: dashed; border-left-width: 1px; color: var(--pumpkin); font-weight: 600; }

.vote-form__input-icon { position: relative; }
.vote-form__input-icon i { position: absolute; top: 50%; left: 0.9rem; color: #A970FF; transform: translateY(-50%); }
.vote-form__input-icon .form-control { padding-left: 2.4rem; }

.vote-form__hint { min-height: 1.2rem; margin: 0.4rem 0 0; color: var(--pumpkin); font-size: 0.85rem; }

.btn-halloween {
  border: 0;
  color: #0B0B12;
  background: linear-gradient(135deg, var(--pumpkin), #FFC145);
  box-shadow: 0 10px 30px var(--pumpkin-glow);
}

.btn-halloween:hover, .btn-halloween:focus-visible { color: #0B0B12; background: linear-gradient(135deg, #FF8F3D, #FFD36E); transform: translateY(-1px); }
.btn-halloween:disabled { color: #0B0B12; opacity: 0.55; }

.vote-form__feedback { min-height: 1.5rem; margin: 1rem 0 0; text-align: center; }
.vote-form__feedback[data-tone="error"] { color: #FF8A8A; }
.vote-form__feedback[data-tone="success"] { color: var(--color-primary); }

/* Animazioni */
@keyframes halloween-bat-fly {
  0% { transform: translate(0, 0) scaleY(1); }
  10% { transform: translate(12vw, -2rem) scaleY(0.6); }
  20% { transform: translate(24vw, 1rem) scaleY(1); }
  30% { transform: translate(36vw, -1.5rem) scaleY(0.6); }
  40% { transform: translate(48vw, 0.5rem) scaleY(1); }
  50% { transform: translate(60vw, -2rem) scaleY(0.6); }
  60% { transform: translate(72vw, 1rem) scaleY(1); }
  70% { transform: translate(84vw, -1rem) scaleY(0.6); }
  100% { transform: translate(125vw, -3rem) scaleY(1); }
}

@keyframes halloween-spider-drop { 0%, 100% { height: 5rem; } 50% { height: 9rem; } }
@keyframes halloween-pumpkin-glow { 0%, 100% { filter: drop-shadow(0 0 22px var(--pumpkin-glow)); } 50% { filter: drop-shadow(0 0 40px rgba(255, 122, 26, 0.6)); } }
@keyframes halloween-fog-drift { from { transform: translateX(0); } to { transform: translateX(25%); } }

@media (max-width: 767.98px) {
  .halloween-moon { top: 12%; right: -2rem; width: 7rem; height: 7rem; }
  .halloween-web { width: 7rem; height: 7rem; }
  .halloween-spider { left: 5rem; }
  .halloween-bat:nth-child(n+2) { display: none; }
  .halloween-pumpkins { display: none; }

  .halloween-hero { min-height: 0; padding: calc(var(--nav-clearance) + 2rem) 0 5rem; }
  .halloween-hero .lead { font-size: 1.05rem; }
  .halloween-countdown { display: flex; width: 100%; padding: 0.8rem 1rem; text-align: center; }
  .halloween-countdown__value { font-size: 1.5rem; }

  .halloween-crypt { padding: 0 0 1.5rem; }
  .halloween-section { padding: 1.5rem 0; }
  .halloween-panel { border-radius: var(--radius-md); }
  .halloween-total { font-size: 0.85rem; }

  .vote-chart__svg[data-size="compact"] .vote-chart__label { font-size: 13px; }
  .vote-chart__svg[data-size="compact"] .vote-chart__percent { font-size: 14px; }
  .vote-chart__svg[data-size="phone"] .vote-chart__label { font-size: 14px; }
  .vote-chart__svg[data-size="phone"] .vote-chart__percent { font-size: 13px; }
  .vote-chart__empty { margin: 1rem 0; padding: 2rem 1rem; }
  .vote-tooltip { max-width: calc(100% - 1rem); }

  /* Su touch niente salto all'hover e input a 16px per evitare lo zoom automatico di iOS. */
  .vote-game:hover .vote-game__body { transform: none; }
  .vote-games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vote-game__body { min-height: 3.25rem; }
  .vote-form .form-control { font-size: 1rem; }
  .vote-form__feedback { font-size: 0.95rem; }
}

@media (max-width: 380px) {
  .vote-games { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .halloween-bat, .halloween-spider, .halloween-pumpkin, .halloween-fog span { animation: none; }
  .halloween-bats { display: none; }
}
