:root {
  --abyss: #06121f;
  --night: #0b2238;
  --sea: #123a5a;
  --sea-2: #174a70;
  --foam: #e8f1f2;
  --muted: #8facbf;
  --lamp: #ffb547;
  --lamp-2: #ffd27f;
  --coral: #ff6b5a;
  --kelp: #4fd1a5;
  --gold: #f6c453;

  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-label: "Barlow Condensed", "DIN Condensed", "Arial Narrow", sans-serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius: 22px;
  --gutter: clamp(16px, 5vw, 32px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--abyss); }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--abyss);
  color: var(--foam);
  font: 400 16px/1.55 var(--f-body);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------------------------------------------------------- cielo */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; background: linear-gradient(180deg, var(--night) 0%, var(--abyss) 75%); }
.stars span {
  position: absolute; border-radius: 50%; background: var(--foam);
  animation: twinkle var(--d, 4s) ease-in-out infinite var(--delay, 0s);
}
@keyframes twinkle { 0%,100% { opacity: var(--o, .6); } 50% { opacity: .15; } }
.moon {
  position: absolute; top: 18px; left: 26px; width: 40px; height: 40px; border-radius: 50%;
  box-shadow: -9px 4px 0 0 #ffe4b0;
  transform: rotate(-20deg);
  filter: drop-shadow(0 0 18px rgba(255, 210, 140, .35));
}
.lampara {
  position: absolute; top: -30vh; right: -30vw; width: 90vw; height: 90vw; max-width: 900px; max-height: 900px;
  background: radial-gradient(circle, rgba(255, 181, 71, .22), transparent 60%);
}

/* ---------------------------------------------------------------- mare */
.sea { position: fixed; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none; z-index: 1; }
.wave { position: absolute; left: -10%; width: 120%; height: 100%; bottom: 0; }
.wave path { fill: var(--sea); }
.w1 { opacity: .45; animation: sway 9s ease-in-out infinite; }
.w2 { opacity: .65; bottom: -14px; animation: sway 7s ease-in-out infinite reverse; }
.w2 path { fill: var(--sea-2); }
.w3 { opacity: .95; bottom: -34px; animation: sway 11s ease-in-out infinite; }
.w3 path { fill: var(--night); }
@keyframes sway { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-6%); } }

/* ---------------------------------------------------------------- layout */
main { position: relative; z-index: 2; }
.scene {
  display: none;
  max-width: 560px; margin: 0 auto;
  padding: calc(84px + env(safe-area-inset-top)) var(--gutter) 160px;
  min-height: 100svh;
  flex-direction: column; align-items: center; text-align: center;
}
.scene.active { display: flex; animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
#scene-hero { justify-content: center; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font: 600 15px/1 var(--f-label); letter-spacing: .22em; text-transform: uppercase;
  color: var(--lamp); margin: 0 0 18px;
}
.display {
  font: 700 clamp(42px, 11vw, 68px)/1.02 var(--f-display);
  letter-spacing: -.02em; margin: 0 0 20px;
  font-variation-settings: "opsz" 144;
}
.display em { font-style: italic; font-weight: 800; color: var(--lamp); }
.display.small { font-size: clamp(34px, 8.5vw, 50px); }
.lede { color: var(--muted); font-size: 18px; max-width: 30em; margin: 0 0 36px; }
.lede strong { color: var(--foam); font-weight: 600; }

.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 17px/1 var(--f-body); padding: 18px 28px; border-radius: 999px;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  min-height: 56px;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--lamp); color: var(--abyss);
  box-shadow: 0 10px 40px -8px rgba(255, 181, 71, .55);
}
.btn-primary:hover { background: var(--lamp-2); }
.btn-primary:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn-ghost { background: rgba(232, 241, 242, .07); color: var(--foam); border: 1px solid rgba(232, 241, 242, .16); }
.btn-ghost:hover { background: rgba(232, 241, 242, .12); }

.sound-toggle {
  position: fixed; z-index: 20; top: calc(14px + env(safe-area-inset-top)); right: 14px;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(232,241,242,.16);
  background: rgba(6, 18, 31, .5); backdrop-filter: blur(8px); color: var(--foam); font-size: 18px; cursor: pointer;
}
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* ---------------------------------------------------------------- recupero */
.fishing { position: relative; width: 120px; height: 300px; margin: -10px 0 10px; }
.fishing .line { position: absolute; left: 55px; top: 0; width: 10px; height: var(--line, 200px); transition: height .1s linear; }
.fishing .line line { stroke: rgba(232, 241, 242, .5); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.bobber {
  position: absolute; left: 44px; top: var(--line, 200px); width: 32px; height: 56px;
  transform: translateY(var(--dip, 0px)) rotate(var(--tilt, 0deg)); transform-origin: 50% 0;
  transition: top .1s linear;
}
.bobber-top { height: 50%; background: var(--coral); border-radius: 16px 16px 4px 4px; }
.bobber-bottom { height: 50%; background: var(--foam); border-radius: 4px 4px 16px 16px; }
.ripple {
  position: absolute; left: 50%; top: calc(var(--line, 200px) + 40px); width: 140px; height: 26px; margin-left: -70px;
  border: 2px solid rgba(232, 241, 242, .35); border-radius: 50%;
  animation: ripple 2.4s ease-out infinite; transition: top .1s linear;
}
.ripple.r2 { animation-delay: 1.2s; }
@keyframes ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }

.reel {
  position: relative; width: 168px; height: 168px; border-radius: 50%; border: 0; padding: 0;
  background: radial-gradient(circle at 35% 30%, #1f5a86, var(--sea) 70%);
  box-shadow: 0 20px 50px -10px rgba(0,0,0,.6), inset 0 2px 0 rgba(255,255,255,.08);
  cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.reel.holding { transform: scale(.96); }
.reel-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.reel-ring circle { fill: none; stroke-width: 9; }
.reel-ring .track { stroke: rgba(232, 241, 242, .12); }
.reel-ring .progress { stroke: var(--lamp); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; }
.reel-knob { position: absolute; inset: 34px; border-radius: 50%; background: var(--night); transform: rotate(var(--spin, 0deg)); }
.reel-handle { position: absolute; top: 8px; left: 50%; width: 14px; height: 30px; margin-left: -7px; border-radius: 7px; background: var(--lamp); }
.reel-label { position: absolute; left: 0; right: 0; bottom: -36px; font: 700 15px/1 var(--f-label); letter-spacing: .3em; color: var(--muted); }
.shake { animation: shake .4s linear infinite; }
@keyframes shake { 0%,100% { translate: 0 0; } 25% { translate: -2px 1px; } 75% { translate: 2px -1px; } }

/* ---------------------------------------------------------------- biglietto */
.ticket {
  position: relative; width: 100%; text-align: left;
  background:
    radial-gradient(circle at 105% -5%, rgba(255,181,71,.28), transparent 45%),
    linear-gradient(180deg, var(--night), var(--abyss));
  border: 1px solid rgba(232, 241, 242, .1);
  border-radius: 28px; padding: 28px 26px 24px; margin-bottom: 28px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.7);
  overflow: hidden;
}
.t-head { display: flex; justify-content: space-between; align-items: flex-start; }
.t-head > div { display: flex; flex-direction: column; gap: 4px; }
.t-label { font: 600 14px/1 var(--f-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.t-label.lamp { color: var(--lamp); }
.t-label.light { color: var(--foam); }
.t-moon { width: 40px; height: 40px; border-radius: 50%; box-shadow: -9px 4px 0 0 #ffe4b0; transform: rotate(-20deg); margin-right: 6px; }
.t-title { font: 800 italic clamp(44px, 13vw, 60px)/.95 var(--f-display); margin: 26px 0 10px; letter-spacing: -.02em; }
.t-title em { color: var(--lamp); }
.t-sub { font: italic 17px/1.3 var(--f-display); color: var(--muted); margin: 0 0 22px; }
.t-route {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  background: var(--sea); border-radius: 20px; padding: 18px 20px;
}
.t-route > div { display: flex; flex-direction: column; gap: 4px; }
.t-route .right { align-items: flex-end; }
.t-code { font: 700 52px/1 var(--f-label); letter-spacing: .02em; }
.t-path { position: relative; height: 2px; background: repeating-linear-gradient(90deg, var(--muted) 0 8px, transparent 8px 16px); }
.t-fish { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scaleX(-1); font-size: 22px; animation: swim 3s ease-in-out infinite; }
@keyframes swim { 0%,100% { margin-left: -14px; } 50% { margin-left: 14px; } }
.t-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; margin: 24px 0 6px; }
.t-grid dt { font: 600 13px/1 var(--f-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.t-grid dd { margin: 0; font: 600 21px/1.15 var(--f-label); letter-spacing: .02em; }
.t-validsub { margin: 8px 0 0; font-size: 13px; }
.t-perf { position: relative; margin: 22px -26px 18px; border-top: 2px dashed rgba(143, 172, 191, .35); }
.t-perf::before, .t-perf::after {
  content: ""; position: absolute; top: -15px; width: 28px; height: 28px; border-radius: 50%; background: var(--abyss);
}
.t-perf::before { left: -14px; } .t-perf::after { right: -14px; }
.t-foot p { margin: 0 0 8px; color: var(--muted); font-size: 14.5px; }
.t-foot strong { color: var(--foam); font-weight: 600; }
.t-from { font: italic 15px/1.3 var(--f-display); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; margin-bottom: 44px; }
.actions .btn-primary { flex: 1 1 100%; }
.actions .btn-ghost { flex: 1 1 140px; }

/* ---------------------------------------------------------------- info */
.info { display: grid; gap: 14px; width: 100%; text-align: left; }
.info-card {
  background: rgba(18, 58, 90, .35); border: 1px solid rgba(232, 241, 242, .08);
  border-radius: var(--radius); padding: 20px 22px;
}
.info-ico { font-size: 24px; }
.info-card h4 { font: 700 italic 22px/1.2 var(--f-display); margin: 6px 0 6px; }
.info-card p { margin: 0; color: var(--muted); font-size: 15.5px; }
.info-card strong { color: var(--foam); font-weight: 600; }

/* ---------------------------------------------------------------- bottiglia */
.bottle-zone { position: relative; margin-top: 90px; height: 170px; width: 100%; }
.whisper {
  font: italic 16px/1.4 var(--f-display); color: var(--muted); margin: 0;
  opacity: 0; transition: opacity 2s ease;
}
.whisper.show { opacity: .85; }
.bottle {
  position: absolute; left: 62%; top: 60px; width: 56px; height: 110px; padding: 0; border: 0; background: none; cursor: pointer;
  animation: bob 4s ease-in-out infinite; transform-origin: 50% 80%;
}
.bottle svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 0 transparent); transition: filter .6s; }
.bottle.glint svg { filter: drop-shadow(0 0 14px rgba(255, 210, 127, .7)); }
.bottle .cork { fill: #a87a4a; }
.bottle .glass { fill: rgba(79, 209, 165, .28); stroke: rgba(232, 241, 242, .55); stroke-width: 2; }
.bottle .note { fill: #f3e2bf; transform: rotate(-6deg); transform-origin: 30px 75px; }
.bottle .note-lines { stroke: #a87a4a; stroke-width: 1.5; fill: none; transform: rotate(-6deg); transform-origin: 30px 75px; }
.bottle .shine { stroke: rgba(255,255,255,.7); stroke-width: 2.5; fill: none; stroke-linecap: round; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-62deg); } 50% { transform: translateY(10px) rotate(-54deg); } }
.bottle.opening { animation: lift 1s cubic-bezier(.5,0,.3,1) forwards; }
@keyframes lift { to { transform: translateY(-80px) rotate(0deg) scale(1.3); opacity: 0; } }

/* ---------------------------------------------------------------- ruota */
.wheel-wrap { position: relative; width: min(92vw, 440px); aspect-ratio: 1; margin: 6px 0 34px; }
.wheel { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 30px 50px rgba(0,0,0,.55)); }
.wheel .rim { fill: #5b3a22; stroke: #3b2414; stroke-width: 4; }
.wheel .rim-inner { fill: none; stroke: #8a5a34; stroke-width: 3; }
.wheel .spoke { fill: #7a4d2b; stroke: #3b2414; stroke-width: 3; }
.wheel .knob { fill: #8a5a34; stroke: #3b2414; stroke-width: 3; }
.wheel .slice { stroke: rgba(6, 18, 31, .55); stroke-width: 2; }
.wheel .s0 { fill: #123a5a; } .wheel .s1 { fill: #1d5f7f; }
.wheel .s-decoy { fill: url(#goldGrad); }
.wheel .lbl { font: 700 21px/1 var(--f-label); letter-spacing: .06em; fill: var(--foam); text-transform: uppercase; }
.wheel .sub { font: 500 12px/1 var(--f-label); letter-spacing: .04em; fill: var(--muted); }
.wheel .s-decoy-text .lbl { fill: #3a2300; font-size: 23px; }
.wheel .s-decoy-text .sub { fill: #5a3a00; font-weight: 700; }
.wheel .hub { fill: var(--abyss); stroke: #8a5a34; stroke-width: 6; }
.pointer {
  position: absolute; left: 50%; top: -14px; z-index: 3; width: 34px; height: 46px; margin-left: -17px;
  background: var(--coral); clip-path: polygon(50% 100%, 0 0, 100% 0);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); transform-origin: 50% 10%;
  transition: transform .08s ease-out;
}
.pointer.flick { transform: rotate(-14deg); }
.wheel-banner {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.6);
  white-space: nowrap; pointer-events: none; opacity: 0;
  font: 800 italic clamp(30px, 9vw, 44px)/1 var(--f-display); color: var(--gold);
  text-shadow: 0 4px 24px rgba(0,0,0,.8), 0 0 30px rgba(246,196,83,.6);
  transition: opacity .3s, transform .4s cubic-bezier(.2,1.6,.4,1);
}
.wheel-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.wheel-banner.cold { color: var(--foam); text-shadow: 0 4px 24px rgba(0,0,0,.9); font-size: clamp(22px, 6vw, 30px); }

.prize {
  width: 100%; margin-top: 34px; padding: 28px 24px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,181,71,.14), rgba(18,58,90,.35));
  border: 1px solid rgba(255,181,71,.3);
  animation: rise .8s cubic-bezier(.2,.7,.2,1) both;
}
.prize[hidden] { display: none; }
.prize p { color: var(--muted); margin: 0 0 14px; }
.prize .prize-note { color: var(--foam); font-weight: 500; margin-bottom: 24px; }
.prize .actions { margin-bottom: 0; }

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

/* come si usa + timbro OPEN */
.t-how { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; margin-bottom: 14px; }
.t-stamp {
  width: 104px; height: 104px; border-radius: 50%; border: 3px solid var(--lamp);
  outline: 1px solid var(--lamp); outline-offset: -9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--lamp); transform: rotate(-12deg); font-family: var(--f-label); text-transform: uppercase;
}
.t-stamp span { font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.t-stamp b { font-size: 36px; line-height: .95; letter-spacing: .02em; }
.t-how ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14.5px; }
.t-how li { margin-bottom: 4px; }

.reset-link {
  margin-top: 28px; padding: 10px 16px; border: 0; background: none; cursor: pointer;
  font: 500 14px/1 var(--f-body); color: var(--muted); opacity: .7; text-decoration: underline; text-underline-offset: 3px;
}
.reset-link:hover { opacity: 1; color: var(--foam); }
