/* Totem Coesione Italia 21-27 — sistema grafico piatto: colori pieni del brand,
   tipografia Titillium, la freccia del logo come segno ricorrente. */
:root {
  --primary: #164194;
  --accent: #e40d2b;
  --blue: var(--primary);
  --red: var(--accent);
  --green: #009346;
  --navy: #0e2a6b;
  --yellow: #ffcc00;
  --ink: #0b2260;
  --muted: #5b6a8f;
  --line: #dbe3f1;
  --tint: #eef2fa;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --r-lg: 28px;
  --r: 20px;
  --r-sm: 12px;
  --pad: clamp(18px, 4vmin, 48px);
  --foot-h: 0px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Titillium Web", system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
  --emoji: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
body.has-footer { --foot-h: clamp(84px, 7.2vh, 150px); }

[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
img { -webkit-user-drag: none; }
.ico { width: 1em; height: 1em; display: block; flex: none; }

/* ---------- sfondo: frecce del logo, ferme e nitide ---------- */

.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; background: var(--bg); }
.chev { position: absolute; overflow: visible; }
.chev path { stroke-width: 10; stroke-linejoin: round; }
.chev.c1 { width: 62vmax; right: -30vmax; top: 18vh; opacity: .05; }
.chev.c1 path { fill: var(--red); stroke: var(--red); }
.chev.c2 { width: 40vmax; left: -26vmax; top: 52vh; opacity: .05; }
.chev.c2 path { fill: var(--green); stroke: var(--green); }
.chev.c3 { width: 30vmax; right: -8vmax; bottom: -10vh; opacity: .05; }
.chev.c3 path { fill: var(--blue); stroke: var(--blue); }
.chev.c4 { display: none; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- footer loghi istituzionali ---------- */

.footbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  height: var(--foot-h);
  display: flex; align-items: center; justify-content: center;
  padding: 10px clamp(16px, 4vw, 60px);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
}
.footbar img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- elementi comuni ---------- */

#app { position: relative; z-index: 1; height: calc(100dvh - var(--foot-h)); }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: var(--pad);
  padding-top: max(var(--pad), env(safe-area-inset-top));
  animation: screenIn .45s var(--ease) both;
}
.screen.leaving { animation: screenOut .3s ease forwards; pointer-events: none; }
@keyframes screenIn { from { opacity: 0; transform: translateY(16px); } }
@keyframes screenOut { to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes pop { 50% { transform: scale(1.04); } }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow {
  display: inline-flex; align-items: center; gap: .55em; margin: 0;
  font-size: clamp(14px, 1.9vmin, 22px); font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--blue);
}
.eyebrow .ico { width: 1.35em; height: 1.35em; }

.gv { display: block; width: 100%; height: 100%; object-fit: contain; }
.gv-emoji { display: grid; place-items: center; font-family: var(--emoji); line-height: 1; }
.gv-mark { display: grid; place-items: center; }
.gv-mark .chevron { width: 46%; height: auto; }
.gv-mark .chevron path { fill: rgba(22, 65, 148, .2); }

.btn, .btn-primary, .btn-swap, .btn-light {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: clamp(64px, 8vmin, 96px);
  padding: 0 clamp(28px, 4.6vmin, 60px);
  border-radius: 18px;
  font-size: clamp(20px, 3vmin, 34px); font-weight: 700; letter-spacing: .01em;
  transition: transform .12s, background-color .2s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-swap { background: var(--red); color: #fff; }
.btn-light { background: #fff; color: var(--blue); }
.btn:active, .btn-primary:active, .btn-swap:active, .btn-light:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .45; }

.countdown { position: relative; width: 1.6em; height: 1.6em; display: grid; place-items: center; font-size: .7em; }
.countdown svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.countdown circle { fill: none; stroke: currentColor; opacity: .9; stroke-width: 3; stroke-dasharray: 94.25; animation: ring linear forwards; }
@keyframes ring { to { stroke-dashoffset: 94.25; } }

/* ---------- home ---------- */

.home { gap: clamp(18px, 3vmin, 40px); }

.home-head { display: flex; align-items: center; justify-content: space-between; }
.brand-logo { width: min(54vw, 600px); max-height: 15vh; object-fit: contain; object-position: left center; margin-left: -1.2%; mix-blend-mode: multiply; }

.hero { animation: rise .6s var(--ease) both; }
.hero-title { margin: clamp(6px, 1vmin, 12px) 0 0; font-size: clamp(48px, 9.4vmin, 128px); font-weight: 700; line-height: .95; letter-spacing: -.02em; color: var(--blue); }
.hero-sub { margin: clamp(10px, 1.6vmin, 18px) 0 0; max-width: 24em; font-size: clamp(19px, 3vmin, 36px); font-weight: 600; color: var(--muted); line-height: 1.3; }

.game-list { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: clamp(12px, 1.8vmin, 22px); min-height: 0; }
.game-row {
  --c: var(--blue);
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center;
  gap: clamp(16px, 2.6vmin, 34px);
  min-height: clamp(110px, 10.4vh, 210px);
  padding: 0 clamp(20px, 3.4vmin, 40px);
  border-radius: var(--r-lg);
  background: var(--c); color: #fff; text-align: left;
  animation: rise .55s var(--ease) both; animation-delay: calc(var(--d) + 120ms);
  transition: transform .12s;
}
.game-row:active { transform: scale(.985); }
.gr-chevron { position: absolute; z-index: -1; right: 5%; top: 50%; height: 175%; width: auto; transform: translateY(-50%); }
.gr-chevron path { fill: rgba(255,255,255,.09); }
.gr-num { font-size: clamp(22px, 3.2vmin, 42px); font-weight: 700; opacity: .55; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.gr-icon { display: grid; place-items: center; width: clamp(64px, 9vmin, 112px); aspect-ratio: 1; border-radius: var(--r); background: rgba(255,255,255,.14); }
.gr-icon .ico { width: 58%; height: 58%; }
.gr-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gr-text strong { font-size: clamp(28px, 4.8vmin, 62px); font-weight: 700; line-height: 1.02; letter-spacing: -.01em; }
.gr-text small { font-size: clamp(16px, 2.3vmin, 28px); font-weight: 600; opacity: .85; line-height: 1.25; }
.gr-go { display: grid; place-items: center; width: clamp(56px, 7.6vmin, 92px); aspect-ratio: 1; border-radius: 50%; background: #fff; color: var(--c); }
.gr-go .ico { width: 46%; height: 46%; animation: nudge 3.2s var(--ease) infinite; animation-delay: calc(var(--d) * 4 + 1.5s); }
@keyframes nudge { 0%, 78%, 100% { transform: none; } 86% { transform: translateX(6px); } 93% { transform: translateX(-2px); } }

@media (min-aspect-ratio: 4/3) {
  .game-list { display: grid; grid-template-columns: 1fr 1fr; align-content: center; }
}

.empty-note { flex: 1; display: grid; place-items: center; font-size: 28px; color: var(--muted); }

.prizes {
  padding: clamp(14px, 2.2vmin, 26px) 0 clamp(14px, 2.2vmin, 26px) clamp(16px, 2.6vmin, 30px);
  border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
  overflow: hidden;
  animation: rise .6s .45s var(--ease) both;
}
.prizes-head { display: flex; align-items: center; gap: 18px; margin-bottom: clamp(10px, 1.6vmin, 18px); }
.prizes-empty { color: var(--muted); font-size: clamp(16px, 2.2vmin, 24px); }
.prize-rail { overflow: hidden; mask-image: linear-gradient(90deg, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); }
.marquee-track { display: flex; gap: clamp(10px, 1.6vmin, 18px); width: max-content; animation: marquee 30s linear infinite; }
@keyframes marquee { to { transform: translateX(-50%); } }
.prize-tile { margin: 0; width: clamp(120px, 15vmin, 190px); }
.prize-tile-img { aspect-ratio: 1; border-radius: var(--r); background: #fff; border: 1px solid var(--line); padding: 8%; overflow: hidden; font-size: clamp(50px, 7vmin, 90px); }
.prize-tile figcaption { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: clamp(14px, 1.9vmin, 21px); font-weight: 700; color: var(--ink); line-height: 1.15; }
.prize-tile em { font-style: normal; font-size: .8em; color: #fff; background: var(--red); padding: 1px 8px; border-radius: 6px; }

/* ---------- cornice dei giochi ---------- */

.game-head { display: flex; align-items: center; gap: clamp(14px, 2.4vmin, 26px); }
.gh-icon { display: grid; place-items: center; width: clamp(60px, 8.4vmin, 100px); aspect-ratio: 1; border-radius: var(--r); background: var(--c); color: #fff; flex: none; }
.gh-icon .ico { width: 58%; height: 58%; }
.game-head .eyebrow { color: var(--muted); }
.game-title { margin: 2px 0 0; font-size: clamp(32px, 5.6vmin, 72px); font-weight: 700; line-height: 1; letter-spacing: -.01em; color: var(--ink); }
.game-body { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }

/* il tasto indietro sta in basso: su un 55" verticale l'alto non si raggiunge */
.game-foot { display: flex; }
.btn-back {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: clamp(58px, 7.4vmin, 88px); padding: 0 clamp(22px, 3.2vmin, 36px) 0 clamp(16px, 2.4vmin, 26px);
  border-radius: 16px; background: #fff; color: var(--blue); border: 2px solid var(--line);
  font-size: clamp(17px, 2.5vmin, 29px); font-weight: 700;
  transition: transform .12s, opacity .3s;
}
.btn-back .ico { width: 1.25em; height: 1.25em; }
.btn-back:active { transform: scale(.96); }
.is-busy .btn-back { opacity: 0; pointer-events: none; }

/* ---------- ruota ---------- */

.wheel-stage { display: flex; flex-direction: column; align-items: center; gap: clamp(16px, 3vmin, 40px); }
.wheel-wrap { position: relative; width: min(94vw, calc(100dvh - var(--foot-h) - 320px), 980px); aspect-ratio: 1; }
.wheel-rotor { position: absolute; inset: 4.7%; border-radius: 50%; overflow: hidden; will-change: transform; touch-action: none; box-shadow: 0 0 0 clamp(3px, .5vmin, 6px) #fff; }
.wheel-canvas { width: 100%; height: 100%; display: block; }
.wheel-rim { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 18px 30px rgba(11, 34, 96, .22)); }
.bulb { fill: #fff; }
.spinning .bulb { animation: chase .3s steps(1) infinite; }
.spinning .bulb.odd { animation-delay: .15s; }
.celebrate .bulb { animation: chase .16s steps(1) infinite; }
.celebrate .bulb.odd { animation-delay: .08s; }
@keyframes chase { 50% { fill: var(--yellow); } }
.wheel-pointer { position: absolute; left: 50%; top: -3%; width: 9.5%; transform: translateX(-50%); transform-origin: 50% 30%; z-index: 3; filter: drop-shadow(0 4px 6px rgba(11, 34, 96, .3)); }
.wheel-pointer svg { display: block; width: 100%; }
.wheel-pointer.flick { animation: flick .14s ease-out; }
@keyframes flick { 30% { transform: translateX(-50%) rotate(-14deg); } }
.wheel-hub {
  position: absolute; left: 50%; top: 50%; width: 21%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; z-index: 2;
  background: #fff; color: var(--blue);
  border: clamp(5px, 1vmin, 11px) solid var(--blue);
  box-shadow: 0 10px 24px rgba(11, 34, 96, .3);
  font-size: clamp(20px, 3.8vmin, 48px); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.wheel-hub::after { content: ""; position: absolute; inset: -12%; border-radius: 50%; border: 3px solid #fff; opacity: 0; animation: halo 2.2s var(--ease) infinite; pointer-events: none; }
@keyframes halo { 0% { opacity: .9; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.25); } }
.spinning .wheel-hub, .celebrate .wheel-hub, .sad .wheel-hub { pointer-events: none; }
.spinning .wheel-hub::after, .celebrate .wheel-hub::after, .sad .wheel-hub::after { display: none; }
.wheel-hint { margin: 0; font-size: clamp(18px, 2.8vmin, 34px); color: var(--muted); font-weight: 600; text-align: center; }
.wheel-hint b { color: var(--blue); }

/* ---------- quiz e testata comune (anche mappa) ---------- */

.quiz { width: min(1200px, 100%); display: flex; flex-direction: column; gap: clamp(20px, 3.4vmin, 44px); }
.quiz.loading { align-items: center; }
.spinner { width: 64px; height: 64px; border-radius: 50%; border: 6px solid var(--line); border-top-color: var(--blue); animation: spin 1s linear infinite; }

.quiz-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(14px, 2.4vmin, 28px); }
.quiz-progress { display: flex; gap: 8px; }
.dot { width: clamp(26px, 4vmin, 48px); height: clamp(7px, 1vmin, 10px); border-radius: 99px; background: var(--line); transition: background-color .3s; }
.dot.now { background: var(--blue); }
.dot.ok { background: var(--green); }
.dot.ko { background: var(--red); }
.quiz-count { font-size: clamp(15px, 2vmin, 24px); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.quiz-timer { display: flex; align-items: center; gap: 14px; }
.quiz-timer .track { display: block; width: clamp(120px, 20vmin, 260px); height: clamp(8px, 1vmin, 12px); border-radius: 99px; background: var(--line); overflow: hidden; }
.quiz-timer .fg { display: block; height: 100%; background: var(--blue); transform-origin: left; animation: drain linear forwards; }
@keyframes drain { to { transform: scaleX(0); } }
.answered .quiz-timer .fg { animation-play-state: paused; }
.quiz-timer b { min-width: 1.6em; text-align: right; font-size: clamp(26px, 4vmin, 48px); font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.quiz-timer.hurry .fg { background: var(--red); }
.quiz-timer.hurry b { color: var(--red); }

.quiz-q {
  margin: 0; padding-left: clamp(18px, 2.8vmin, 32px);
  border-left: clamp(6px, .9vmin, 10px) solid var(--blue);
  font-size: clamp(32px, 5.8vmin, 76px); font-weight: 700; line-height: 1.12; letter-spacing: -.01em; color: var(--ink);
  animation: rise .45s var(--ease) both;
}
.quiz-answers { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(12px, 1.8vmin, 22px); }
@media (max-aspect-ratio: 3/4) { .quiz-answers { grid-template-columns: 1fr; } }
.ans {
  display: flex; align-items: center; gap: clamp(16px, 2.4vmin, 28px); text-align: left;
  min-height: clamp(84px, 8.6vh, 160px);
  padding: 12px clamp(16px, 2.6vmin, 30px);
  border-radius: var(--r); background: var(--surface); border: 2px solid var(--line); color: var(--ink);
  font-size: clamp(22px, 3.6vmin, 44px); font-weight: 600;
  animation: rise .45s var(--ease) both; animation-delay: calc(var(--d) + 100ms);
  transition: transform .12s, background-color .25s, border-color .25s, opacity .25s, color .25s;
}
.ans:active { transform: scale(.985); }
.ans-letter { flex: none; display: grid; place-items: center; width: 1.8em; height: 1.8em; border-radius: var(--r-sm); background: var(--tint); color: var(--blue); font-weight: 700; transition: inherit; }
.answered .ans { opacity: .4; }
.answered .ans.picked { opacity: 1; border-color: var(--blue); }
.ans.right { opacity: 1 !important; background: var(--green); border-color: var(--green); color: #fff; }
.ans.right .ans-letter { background: rgba(255,255,255,.2); color: #fff; }
.ans.wrong { opacity: 1 !important; background: var(--red); border-color: var(--red); color: #fff; animation: shake .4s; }
.ans.wrong .ans-letter { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- estrazione a rullo ---------- */

.quiz-draw { display: flex; flex-direction: column; align-items: center; gap: clamp(18px, 3vmin, 40px); text-align: center; }
.draw-badge { padding: 8px 18px; border-radius: 10px; background: var(--green); color: #fff; font-size: clamp(15px, 2.1vmin, 24px); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.draw-title { margin: 0; max-width: 14em; font-size: clamp(32px, 5.8vmin, 76px); font-weight: 700; line-height: 1.05; letter-spacing: -.01em; color: var(--ink); }
.slot { position: relative; width: min(720px, 88vw); }
.slot-window {
  height: calc(clamp(92px, 10vh, 170px) * 3); overflow: hidden; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent);
  -webkit-mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent);
}
.slot-frame { position: absolute; left: -8px; right: -8px; top: 50%; height: clamp(92px, 10vh, 170px); transform: translateY(-50%); border-radius: var(--r); border: 4px solid var(--blue); pointer-events: none; }
.slot-reel { will-change: transform; }
.reel-item { height: clamp(92px, 10vh, 170px); display: flex; align-items: center; justify-content: center; gap: 20px; color: var(--ink); font-size: clamp(24px, 3.8vmin, 46px); font-weight: 700; }
.reel-item .gv { width: calc(clamp(92px, 10vh, 170px) * .72); height: calc(clamp(92px, 10vh, 170px) * .72); font-size: calc(clamp(92px, 10vh, 170px) * .55); }
.reel-item.lose { color: var(--muted); }
.reel-item.hit { animation: pop .5s 2; }

/* ---------- mappa delle regioni ---------- */

.cities { width: min(1100px, 100%); display: flex; flex-direction: column; gap: clamp(18px, 2.8vmin, 34px); }
.map-wrap { position: relative; border-radius: var(--r-lg); padding: clamp(8px, 1.4vmin, 18px); background: #e6eef9; overflow: hidden; }
.map { position: relative; width: 100%; display: block; overflow: visible; }
.ctx path { fill: #d9e1ee; stroke: #e6eef9; stroke-width: 2; }
.reg { stroke: #fff; stroke-width: 2.5; stroke-linejoin: round; transition: fill .2s; cursor: pointer; }
.reg[data-region="Basilicata"], .reg[data-region="Sicilia"] { fill: #c6e6d2; }
.reg[data-region="Calabria"], .reg[data-region="Molise"] { fill: #c9d7f1; }
.reg[data-region="Campania"], .reg[data-region="Sardegna"] { fill: #f6cfd5; }
.reg[data-region="Puglia"] { fill: #fbe9a8; }
.reg.hover { fill: var(--blue) !important; }
.reg.ok { fill: var(--green) !important; }
.reg.ko { fill: var(--red) !important; animation: blink .3s 3; }
@keyframes blink { 50% { opacity: .55; } }
.labels text {
  font-family: var(--font); font-weight: 700; font-size: 22px; letter-spacing: .08em;
  fill: var(--ink); text-anchor: middle; dominant-baseline: middle;
  paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 4px; stroke-linejoin: round;
}
.pin path { stroke: #fff; stroke-width: 2.5; }
.pin.ok path { fill: var(--ink); }
.pin.ko path { fill: var(--red); }
.pin text { font-family: var(--font); font-weight: 700; font-size: 20px; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-linejoin: round; }
.pin-drop { transform-box: fill-box; transform-origin: 50% 100%; animation: pinDrop .45s var(--ease) both; }
@keyframes pinDrop { from { transform: translateY(-24px); opacity: 0; } }

.city-tray { display: flex; flex-direction: column; align-items: center; gap: clamp(12px, 1.8vmin, 20px); min-height: clamp(130px, 13vh, 220px); }
.city-slot { min-height: clamp(84px, 9.6vmin, 124px); display: flex; align-items: center; }
.city-card {
  display: inline-flex; align-items: center; gap: 14px;
  padding: clamp(16px, 2.2vmin, 26px) clamp(28px, 4.2vmin, 52px) clamp(16px, 2.2vmin, 26px) clamp(20px, 3vmin, 36px);
  border-radius: var(--r); background: var(--blue); color: #fff;
  font-size: clamp(30px, 5.2vmin, 62px); font-weight: 700; line-height: 1;
  box-shadow: 0 18px 34px -16px rgba(11, 34, 96, .6);
  touch-action: none; cursor: grab; white-space: nowrap;
  animation: rise .4s var(--ease) both;
}
.city-pin .ico { width: .9em; height: .9em; }
.city-card.is-project {
  max-width: min(900px, 100%); align-items: flex-start; gap: 16px;
  white-space: normal; text-align: left; line-height: 1.15;
  font-size: clamp(22px, 3.6vmin, 42px);
  background: var(--navy);
}
.city-card.is-project .city-pin .ico { width: 1.1em; height: 1.1em; margin-top: .05em; }
.city-name { min-width: 0; }
.city-card.lifted { opacity: .25; }
.city-card.gone { visibility: hidden; }
.city-ghost { position: fixed; left: 0; top: 0; z-index: 45; margin: 0; pointer-events: none; animation: none; box-shadow: 0 28px 50px -18px rgba(11, 34, 96, .7); }
.city-ghost.flying { transition: transform .45s var(--ease), opacity .45s ease-in; }
.tray-hint { margin: 0; font-size: clamp(19px, 2.8vmin, 34px); color: var(--muted); text-align: center; }
.tray-hint b.ok { color: var(--green); }
.tray-hint b.ko { color: var(--red); }

/* ---------- pacchi delle regioni ---------- */

.pacchi-stage { display: flex; flex-direction: column; align-items: center; gap: clamp(20px, 4vmin, 56px); width: 100%; }
.pacchi-hint { margin: 0; min-height: 1.3em; font-size: clamp(26px, 4.2vmin, 54px); font-weight: 700; color: var(--ink); text-align: center; letter-spacing: -.01em; }
.pacchi-hint b { color: var(--red); }
.pacchi { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(34px, 5.4vmin, 70px) clamp(14px, 2.4vmin, 30px); max-width: 1100px; padding-top: 3vmin; }
.pacco {
  --w: clamp(140px, 22vmin, 250px);
  position: relative; width: var(--w); height: calc(var(--w) * 1.2);
  animation: rise .5s var(--ease) both; animation-delay: var(--d);
  transition: transform .4s var(--ease), opacity .35s, filter .35s;
}
.pacco::after { content: ""; position: absolute; inset: 4% -6% -4%; border-radius: 22px; border: 4px solid var(--blue); opacity: 0; transition: opacity .3s; pointer-events: none; }
.pacco-body {
  position: absolute; left: 4%; right: 4%; bottom: 4%; height: 78%; border-radius: 10px;
  background: #d8b07c;
  box-shadow: inset 0 -12px 0 rgba(120, 76, 24, .14);
}
.pacco-body::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 14%; transform: translateX(-50%); background: var(--tape); }
.pacco-lid {
  position: absolute; left: 0; right: 0; top: 10%; height: 16%; border-radius: 8px; z-index: 2;
  background: #e6c493;
  box-shadow: 0 5px 0 rgba(120, 76, 24, .18);
  transform-origin: 10% 100%;
  transition: transform .6s var(--ease), opacity .5s;
}
.pacco-lid::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 13%; transform: translateX(-50%); background: var(--tape); }
.pacco-num {
  position: absolute; left: 6%; top: 50%; transform: translateY(-50%);
  width: calc(var(--w) * .24); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff; border: 3px solid #fff;
  font-weight: 700; font-size: calc(var(--w) * .13);
}
.pacco-label {
  position: absolute; left: 13%; right: 13%; top: 16%; bottom: 12%; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%;
  background: #fff; border-radius: 10px; padding: 7%;
  transition: opacity .4s;
}
.pacco-shape { width: 100%; flex: 1; min-height: 0; display: grid; place-items: center; }
.pacco-shape svg { width: 100%; height: 100%; }
.pacco-shape path { fill: var(--tape); }
.pacco-name { font-weight: 700; font-size: calc(var(--w) * .105); color: var(--ink); line-height: 1.1; }
.pacco-mine {
  position: absolute; left: 50%; top: -14%; z-index: 3; transform: translateX(-50%) translateY(6px); opacity: 0;
  padding: .35em .8em; border-radius: 8px; background: var(--blue); color: #fff;
  font-weight: 700; font-size: calc(var(--w) * .08); letter-spacing: .12em; white-space: nowrap;
  transition: transform .3s var(--ease), opacity .3s;
}
.pacco-rays { position: absolute; left: 50%; top: 30%; width: 180%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(255, 204, 0, .45), rgba(255, 204, 0, 0) 62%); opacity: 0; transition: opacity .5s; pointer-events: none; }
.pacco-prize { position: absolute; left: 50%; top: 22%; width: 72%; aspect-ratio: 1; z-index: 4; transform: translate(-50%, 10%) scale(.2); opacity: 0; border-radius: 50%; background: #fff; padding: 10%; border: 4px solid var(--blue); transition: transform .6s var(--ease) .15s, opacity .3s .15s; font-size: calc(var(--w) * .38); }
.pacco:active { transform: scale(.96); }

.has-mine .pacco:not(.is-mine) { opacity: .4; filter: grayscale(.6); transform: scale(.92); }
.pacco.is-mine { transform: scale(1.08); z-index: 2; }
.pacco.is-mine::after { opacity: 1; }
.pacco.is-mine .pacco-mine { transform: translateX(-50%); opacity: 1; }
.swapping .pacco:not(.is-mine) { opacity: 1; filter: none; transform: none; }
.opening .pacco:not(.is-mine) { opacity: .1; transform: scale(.88); }
.opening .pacco.is-mine:not(.open) .pacco-body, .opening .pacco.is-mine:not(.open) .pacco-lid { animation: shake .4s ease-in-out infinite; }
.pacco.open::after, .pacco.open .pacco-mine { opacity: 0; }
.pacco.open .pacco-lid { transform: translate(8%, -160%) rotate(-24deg); opacity: 0; }
.pacco.open .pacco-prize { transform: translate(-50%, -62%) scale(1); opacity: 1; }
.pacco.won .pacco-rays { opacity: 1; }
.pacco.empty .pacco-prize { background: var(--tint); border-color: var(--line); }
.pacchi-actions { min-height: clamp(70px, 9vmin, 110px); display: flex; align-items: center; }

.phone { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: var(--pad); background: rgba(11, 34, 96, .55); opacity: 0; transition: opacity .25s; }
.phone.open { opacity: 1; }
.phone-card { width: min(780px, 100%); padding: clamp(32px, 5.4vmin, 64px); border-radius: var(--r-lg); background: #fff; text-align: center; transform: translateY(24px); transition: transform .35s var(--ease); position: relative; overflow: hidden; }
.phone-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: linear-gradient(90deg, var(--blue) 33.3%, var(--green) 33.3% 66.6%, var(--red) 66.6%); }
.phone.open .phone-card { transform: none; }
.phone-icon { display: inline-grid; place-items: center; width: clamp(88px, 13vmin, 150px); aspect-ratio: 1; border-radius: 50%; background: var(--blue); color: #fff; }
.phone-icon .ico { width: 46%; height: 46%; }
.ringing .phone-icon { animation: callPulse 1s var(--ease) infinite; }
.ringing .phone-icon .ico { animation: ringShake .12s ease-in-out infinite alternate; }
@keyframes callPulse { 0% { box-shadow: 0 0 0 0 rgba(22, 65, 148, .45); } 100% { box-shadow: 0 0 0 28px rgba(22, 65, 148, 0); } }
@keyframes ringShake { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
.phone-card h2 { margin: clamp(16px, 2.4vmin, 28px) 0 0; font-size: clamp(32px, 5.4vmin, 66px); color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.phone-text { margin: 12px 0 0; min-height: 1.2em; font-size: clamp(21px, 3.4vmin, 40px); color: var(--muted); line-height: 1.3; }
.phone-text b { color: var(--red); }
.phone-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(12px, 2vmin, 24px); margin-top: clamp(22px, 3.6vmin, 44px); }

/* ---------- risultato ---------- */

.result { justify-content: center; align-items: center; text-align: center; overflow: hidden; }
.result-inner { position: relative; z-index: 1; width: min(900px, 100%); display: flex; flex-direction: column; align-items: center; gap: clamp(12px, 2vmin, 26px); }
.result-title { margin: 0; font-size: clamp(64px, 13vmin, 176px); font-weight: 700; line-height: .9; letter-spacing: -.03em; animation: rise .5s var(--ease) both; }
.rs-chev { position: absolute; pointer-events: none; }
.rs-chev-1 { width: 70vmax; right: -34vmax; top: -10vh; }
.rs-chev-2 { width: 46vmax; left: -30vmax; bottom: -6vh; }

.is-win { background: var(--blue); color: #fff; }
.is-win .rs-chev path { fill: rgba(255,255,255,.06); }
.is-win .eyebrow { color: var(--yellow); }
.prize-card {
  width: 100%; display: grid; grid-template-columns: minmax(0, 42%) 1fr; align-items: center; gap: clamp(16px, 3vmin, 40px);
  margin-top: clamp(8px, 1.6vmin, 20px); padding: clamp(14px, 2.4vmin, 28px);
  border-radius: var(--r-lg); background: #fff; color: var(--ink); text-align: left;
  animation: rise .55s .12s var(--ease) both;
}
.prize-photo { aspect-ratio: 1; border-radius: var(--r); background: var(--bg); padding: 8%; overflow: hidden; font-size: clamp(80px, 14vmin, 180px); }
.prize-info { display: flex; flex-direction: column; gap: 6px; }
.prize-info .eyebrow { color: var(--blue); }
.prize-info strong { font-size: clamp(32px, 6vmin, 78px); font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.prize-info small { font-size: clamp(16px, 2.4vmin, 28px); color: var(--muted); line-height: 1.3; }
.ticket {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: clamp(18px, 3vmin, 34px) clamp(24px, 4vmin, 48px);
  background: #fff; color: var(--ink); border-radius: var(--r);
  -webkit-mask: radial-gradient(circle 18px at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 18px at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 18px at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 18px at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
  animation: rise .55s .24s var(--ease) both;
}
.ticket-label { font-size: clamp(14px, 1.9vmin, 22px); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.ticket-code { font-size: clamp(52px, 10vmin, 128px); font-weight: 700; letter-spacing: .1em; line-height: 1; color: var(--blue); font-variant-numeric: tabular-nums; }
.ticket-note { padding-top: 10px; margin-top: 6px; border-top: 2px dashed var(--line); width: 100%; font-size: clamp(16px, 2.4vmin, 28px); color: var(--muted); }
.is-win .btn-done { margin-top: clamp(8px, 1.6vmin, 20px); }

.is-lose .rs-chev path { fill: rgba(22, 65, 148, .05); }
.lose-icon { display: grid; place-items: center; width: clamp(96px, 15vmin, 180px); aspect-ratio: 1; border-radius: 50%; background: var(--tint); color: var(--blue); margin-bottom: clamp(8px, 1.6vmin, 18px); animation: rise .5s var(--ease) both; }
.lose-icon .ico { width: 46%; height: 46%; }
.is-lose .result-title { color: var(--blue); }
.lose-msg { margin: clamp(6px, 1vmin, 12px) 0 0; font-size: clamp(22px, 3.6vmin, 44px); font-weight: 600; color: var(--ink); line-height: 1.25; max-width: 20em; }
.lose-sub { margin: 0 0 clamp(18px, 3vmin, 40px); font-size: clamp(18px, 2.8vmin, 32px); color: var(--muted); }

/* ---------- varie ---------- */

.offline { justify-content: center; align-items: center; text-align: center; }
.offline h1 { font-size: 42px; color: var(--blue); }
#toast { position: fixed; left: 50%; bottom: calc(var(--foot-h) + 30px); transform: translate(-50%, 200px); padding: 16px 28px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 700; font-size: 22px; z-index: 60; transition: transform .35s var(--ease); }
#toast.show { transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .marquee-track, .gr-go .ico, .wheel-hub::after { animation: none !important; }
}
