:root {
  --ink: #2b1b6b;
  --cream: #fff8ec;
  --pink: #ff5fa2;
  --orange: #ff9f1c;
  --yellow: #ffd23f;
  --mint: #3ee6b0;
  --sky: #4cc9ff;
  --violet: #8a4dff;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.2, 1.6, .4, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(180deg, #1c1253 0%, #3f1f9a 50%, #b32f8e 100%) fixed;
  color: var(--cream);
  font-family: Nunito, system-ui, -apple-system, sans-serif;
  font-weight: 600;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked-scroll { overflow: hidden; }

#bg, #fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bg { z-index: 0; }
#fx { z-index: 60; }

/* ---------- blob colorati ---------- */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; opacity: .75; }
.aurora i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; will-change: transform; animation: drift 30s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: radial-gradient(closest-side, rgba(53, 224, 255, .55), transparent); left: -35vmax; top: -25vmax; }
.aurora i:nth-child(2) { background: radial-gradient(closest-side, rgba(255, 95, 162, .6), transparent); right: -40vmax; top: 10vmax; animation-duration: 28s; animation-delay: -8s; }
.aurora i:nth-child(3) { background: radial-gradient(closest-side, rgba(255, 210, 63, .4), transparent); left: -10vmax; bottom: -30vmax; animation-duration: 34s; animation-delay: -14s; }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(10vmax, 8vmax, 0) scale(1.25); } }

/* ---------- emoji che salgono + colline ---------- */
#floaties { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
#floaties span { position: absolute; bottom: -60px; font-size: 1.6rem; opacity: 0; will-change: transform, opacity; animation: rise linear infinite; }
@keyframes rise { 0% { transform: translateY(0) rotate(-15deg); opacity: 0; } 10% { opacity: .9; } 85% { opacity: .9; } 100% { transform: translateY(-115vh) rotate(25deg); opacity: 0; } }
#forest { position: fixed; left: 0; right: 0; bottom: 0; height: 18vh; min-height: 110px; z-index: 1; pointer-events: none; }
#forest svg { width: 100%; height: 100%; display: block; }

/* ---------- layout ---------- */
#app {
  position: relative; z-index: 2; max-width: 780px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 26px) 16px calc(env(safe-area-inset-bottom) + 120px);
  opacity: 0; transition: opacity .6s;
}
.ready #app { opacity: 1; }

.head { text-align: center; margin-bottom: 24px; }
.eyebrow { display: inline-block; margin: 0 0 10px; padding: 5px 14px; border-radius: 99px; background: rgba(255, 255, 255, .14); border: 2px solid rgba(255, 255, 255, .25); font-family: Fredoka, sans-serif; font-weight: 600; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow); }
h1 { margin: 0; font-family: Fredoka, sans-serif; font-weight: 700; line-height: 1; font-size: clamp(2.4rem, 10.5vw, 4.4rem); }
h1 .t1, h1 .t2 { display: block; }
h1 .t1 { color: #fff3b0; }
h1 .t2 { color: #fff; font-size: .82em; }
h1 .ch { display: inline-block; text-shadow: 0 4px 0 var(--pink), 0 8px 0 rgba(0, 0, 0, .22); animation: hop 3.6s ease-in-out infinite; animation-delay: calc(var(--k) * 70ms); white-space: pre; }
@keyframes hop { 0%, 12%, 100% { transform: translateY(0) rotate(0); } 5% { transform: translateY(-14px) rotate(-4deg); } 9% { transform: translateY(0) rotate(2deg); } }
.for { font-family: Caveat, cursive; font-size: 1.7rem; margin: 12px 0 0; color: var(--cream); }

.timer { margin: 14px auto 0; min-height: 1.5em; }
.timer .big { display: flex; gap: 10px; justify-content: center; }
.timer .unit { min-width: 66px; padding: 10px 6px 8px; border-radius: 20px; background: var(--cream); color: var(--ink); box-shadow: 0 5px 0 rgba(0, 0, 0, .25); }
.timer .unit:nth-child(1) { background: #ffe1ea; } .timer .unit:nth-child(2) { background: #fff0b8; }
.timer .unit:nth-child(3) { background: #c9f7e8; } .timer .unit:nth-child(4) { background: #d3ecff; }
.timer .unit b { display: block; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 2rem; font-variant-numeric: tabular-nums; }
.timer .unit small { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; opacity: .7; }
.timer .line { display: inline-block; padding: 10px 18px; border-radius: 20px; background: rgba(255, 255, 255, .14); border: 2px solid rgba(255, 255, 255, .22); font-size: .98rem; }
.timer .line b { font-family: Fredoka, sans-serif; font-variant-numeric: tabular-nums; color: var(--yellow); }
.timer .lead { display: block; margin-bottom: 10px; font-family: Fredoka, sans-serif; font-size: .95rem; letter-spacing: .06em; color: var(--yellow); }

.progress { margin: 18px auto 0; max-width: 270px; font-size: .8rem; font-weight: 800; }
.progress .bar { height: 14px; border-radius: 99px; background: rgba(0, 0, 0, .25); padding: 3px; }
.progress .bar i { display: block; height: 100%; width: 0; min-width: 8px; border-radius: 99px; background: repeating-linear-gradient(45deg, var(--pink) 0 10px, #ff8fc0 10px 20px); transition: width 1s var(--spring); }
.progress span { display: block; margin-top: 7px; }

/* ---------- griglia ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(6, 1fr); gap: 16px; } }

.cell { position: relative; aspect-ratio: 5 / 6; perspective: 700px; opacity: 0; }
.ready .cell { opacity: 1; animation: pop .8s both var(--spring); animation-delay: calc(var(--i) * 55ms + .15s); }
@keyframes pop { from { opacity: 0; transform: translateY(60px) scale(.4) rotate(-12deg); } to { opacity: 1; transform: none; } }

.inside {
  position: absolute; inset: 0; border-radius: 22px; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #fff7c2 0%, #ffd23f 45%, #ff8a3d 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55), 0 6px 0 rgba(0, 0, 0, .25);
}
.inside::before { content: ''; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 20deg, rgba(255, 255, 255, .65) 30deg, transparent 45deg 100deg, rgba(255, 255, 255, .55) 115deg, transparent 130deg 200deg, rgba(255, 255, 255, .6) 215deg, transparent 230deg); opacity: 0; transition: opacity .6s; animation: spin 8s linear infinite; }
.open .inside::before { opacity: .9; }
.gem { position: relative; font-size: clamp(1.8rem, 8vw, 2.7rem); transform: scale(.2) rotate(-40deg); opacity: 0; transition: transform .8s .2s var(--spring), opacity .3s .2s; }
.open .gem { transform: scale(1) rotate(0); opacity: 1; }
.open:hover .gem { transform: scale(1.15) rotate(-8deg); }
@keyframes spin { to { transform: rotate(360deg); } }

.door {
  position: absolute; inset: 0; margin: 0; padding: 0; border: 0; cursor: pointer; outline-offset: 3px;
  border-radius: 22px; color: #fff;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow: 0 6px 0 var(--c3), inset 0 4px 0 rgba(255, 255, 255, .4), inset 0 -6px 0 rgba(0, 0, 0, .14);
  transform-origin: left center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform .9s var(--ease), box-shadow .15s;
  overflow: hidden;
}
.cell:nth-child(5n+1) .door { --c1: #ff7a7a; --c2: #ff3d6e; --c3: #b41f4a; }
.cell:nth-child(5n+2) .door { --c1: #ffd23f; --c2: #ff9f1c; --c3: #b8690a; color: #5a2a00; }
.cell:nth-child(5n+3) .door { --c1: #3ee6b0; --c2: #12a99a; --c3: #0a7168; }
.cell:nth-child(5n+4) .door { --c1: #5cd0ff; --c2: #3a6bff; --c3: #2144b3; }
.cell:nth-child(5n)   .door { --c1: #c08bff; --c2: #7a3cff; --c3: #4d1fb3; }
.door::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255, 255, 255, .22) 2px, transparent 3px) 0 0 / 15px 15px; }
.door::after { content: ''; position: absolute; inset: 0; background: linear-gradient(155deg, rgba(255, 255, 255, .42), transparent 42%); }
.num { position: relative; z-index: 1; display: block; margin-top: 6%; font-family: Fredoka, sans-serif; font-weight: 700; font-size: clamp(1.9rem, 9.5vw, 3rem); text-shadow: 0 3px 0 rgba(0, 0, 0, .22); }
.deco { position: absolute; z-index: 1; top: 8%; left: 10%; font-size: .85rem; opacity: .95; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .2)); }
.knob { position: absolute; z-index: 1; right: 10%; bottom: 9%; width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.lock { position: absolute; z-index: 1; bottom: 7px; left: 50%; transform: translateX(-50%); font-size: .85rem; display: none; }

.cell.locked .door { box-shadow: 0 4px 0 rgba(0, 0, 0, .3), inset 0 3px 0 rgba(255, 255, 255, .25), inset 0 -5px 0 rgba(0, 0, 0, .14); }
.cell.locked .door::after { background: linear-gradient(155deg, rgba(255, 255, 255, .2), transparent 42%), rgba(40, 28, 95, .55); }
.cell.locked .lock { display: block; }
.cell.locked .knob { display: none; }
.cell:not(.locked):not(.open) .door:hover { transform: rotateY(-16deg) translateY(-4px); }
.cell:not(.locked):not(.open) .door:active { transform: translateY(5px) scale(.97); box-shadow: 0 1px 0 var(--c3), inset 0 4px 0 rgba(255, 255, 255, .4); transition-duration: .08s; }
.cell.open .door { transform: rotateY(-122deg); pointer-events: none; animation: none; }
.cell.open .door::before, .cell.open .door::after { opacity: 0; }
.cell.open { cursor: pointer; }

.cell.today .door { animation: ring 1.6s ease-in-out infinite; }
@keyframes ring { 0%, 100% { box-shadow: 0 6px 0 var(--c3), 0 0 0 0 rgba(255, 255, 255, .85), inset 0 4px 0 rgba(255, 255, 255, .4); } 50% { box-shadow: 0 6px 0 var(--c3), 0 0 0 9px rgba(255, 255, 255, 0), inset 0 4px 0 rgba(255, 255, 255, .4); } }
.cell.today:not(.open)::after { content: 'OGGI!'; position: absolute; z-index: 3; top: -12px; left: 50%; padding: 3px 10px; border-radius: 99px; background: #fff; color: var(--pink); font-family: Fredoka, sans-serif; font-weight: 700; font-size: .7rem; letter-spacing: .06em; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); transform: translateX(-50%) rotate(-6deg); animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-5px) rotate(4deg); } }
.cell.pending:not(.open)::after { content: ''; position: absolute; z-index: 3; top: -5px; right: -5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--pink); animation: ping 1.5s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .8); } 80%, 100% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } }

.ready .cell.shake { animation: shake .5s; }
@keyframes shake { 15% { transform: translateX(-7px) rotate(-3deg); } 35% { transform: translateX(7px) rotate(3deg); } 55% { transform: translateX(-5px) rotate(-2deg); } 75% { transform: translateX(3px); } }

/* ---------- stella finale ---------- */
.star { display: block; margin: 34px auto 0; border: 0; background: none; color: var(--yellow); cursor: pointer; text-align: center; font-family: Fredoka, sans-serif; font-weight: 600; }
.star span { display: block; font-size: 4.6rem; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .2)); animation: starPulse 1.6s var(--spring) infinite; }
.star small { padding: 5px 14px; border-radius: 99px; background: rgba(255, 255, 255, .15); letter-spacing: .1em; text-transform: uppercase; font-size: .75rem; }
.star[hidden] { display: none; }
@keyframes starPulse { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.2) rotate(12deg); } }

.foot { margin-top: 36px; text-align: center; font-family: Caveat, cursive; font-size: 1.6rem; }

/* ---------- finestra del messaggio ---------- */
[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 50; display: none; padding: 66px 16px 24px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.modal.on { display: flex; }
.veil { position: fixed; inset: 0; background: rgba(35, 12, 90, .82); opacity: 0; transition: opacity .3s; }
@media (hover: hover) and (pointer: fine) { .veil { background: rgba(35, 12, 90, .72); backdrop-filter: blur(8px); } }
.modal.in .veil { opacity: 1; }
.card {
  position: relative; width: min(94vw, 460px); margin: auto; text-align: center; color: var(--ink);
  padding: 74px 24px 28px; border-radius: 34px;
  background: var(--cream);
  box-shadow: 0 10px 0 rgba(0, 0, 0, .25), 0 30px 70px rgba(0, 0, 0, .45);
  transform: translateY(80px) scale(.6) rotate(-6deg); opacity: 0;
  transition: transform .8s var(--spring), opacity .3s;
}
.card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 100px; border-radius: 34px 34px 0 0; background: linear-gradient(135deg, var(--pink), var(--orange)); }
.card::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 100px; border-radius: 34px 34px 0 0; background: radial-gradient(circle, rgba(255, 255, 255, .3) 3px, transparent 4px) 0 0 / 22px 22px; }
.modal.in .card { transform: none; opacity: 1; }
.card > * { position: relative; z-index: 1; }
.close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); color: var(--ink); font-size: 1rem; font-weight: 800; cursor: pointer; z-index: 3; box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.close:active { transform: translateY(2px); }
.badge { position: absolute; left: 50%; top: -46px; width: 110px; height: 110px; margin-left: -55px; display: grid; place-items: center; z-index: 2; }
.badge::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: #fff; border: 6px solid var(--yellow); box-shadow: 0 6px 0 rgba(0, 0, 0, .22); }
.badge span { position: relative; font-size: 3.2rem; animation: float 2s ease-in-out infinite; }
.rays { position: absolute; width: 400px; height: 400px; left: 50%; top: 50%; margin: -200px 0 0 -200px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .35) 0 10deg, transparent 10deg 30deg); -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%); animation: spin 16s linear infinite; pointer-events: none; z-index: -1; }
@keyframes float { 50% { transform: translateY(-6px) rotate(8deg) scale(1.08); } }
.kicker { display: inline-block; margin: 0; padding: 4px 14px; border-radius: 99px; background: #ffe1ea; color: #c11f62; font-family: Fredoka, sans-serif; font-weight: 600; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.card h2 { margin: 12px 0 12px; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 1.9rem; line-height: 1.1; color: var(--ink); }
.body { font-family: Caveat, cursive; font-weight: 700; font-size: 1.75rem; line-height: 1.22; color: #4a2d9c; white-space: pre-wrap; min-height: 3em; text-align: left; padding: 0 4px; }
.body .caret { display: inline-block; width: 3px; height: 1em; background: var(--pink); margin-left: 2px; vertical-align: -.12em; animation: blink .7s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.card img { display: block; width: 100%; max-height: 32vh; object-fit: cover; margin-top: 18px; border-radius: 18px; border: 6px solid #fff; box-shadow: 0 6px 0 rgba(0, 0, 0, .18); transform: rotate(-2deg); }
.card img[hidden], .btn[hidden] { display: none; }
.btn { display: inline-block; margin-top: 20px; padding: 13px 28px; border-radius: 99px; background: linear-gradient(135deg, var(--pink), var(--orange)); color: #fff; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 1.05rem; text-decoration: none; box-shadow: 0 6px 0 #b4235f; }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b4235f; }

/* ---------- indovinello ---------- */
.rcard .kicker { background: #e6f0ff; color: #3a55c9; }
.fields { display: flex; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.fld { width: 100%; max-width: 84px; padding: 12px 4px; border: 3px solid #d7c9ff; border-radius: 18px; background: #fff; color: var(--ink); text-align: center; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 1.6rem; outline: none; box-shadow: 0 4px 0 rgba(0, 0, 0, .12); transition: border-color .15s, transform .15s; -moz-appearance: textfield; }
.fld::-webkit-outer-spin-button, .fld::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fld:focus { border-color: var(--pink); transform: translateY(-2px); }
.fld.y { max-width: 120px; }
.fld.wide { max-width: 100%; font-size: 1.4rem; }
.fld.pin { max-width: 220px; letter-spacing: .4em; text-indent: .4em; font-size: 2rem; }
.sep { align-self: center; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 1.6rem; color: #b9a6f3; }
.rmsg { min-height: 1.5em; margin: 12px 0 0; font-family: Fredoka, sans-serif; font-weight: 600; color: #c11f62; }
.hintbtn { margin-top: 6px; padding: 8px 16px; border: 0; border-radius: 99px; background: #fff0b8; color: #7a4a00; font-family: Fredoka, sans-serif; font-weight: 600; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.hintbtn[hidden], .rdebug[hidden] { display: none; }
.rdebug { margin: 14px 0 0; padding: 6px 10px; border-radius: 10px; background: #e8ffe9; color: #0a6b22; font-size: .75rem; }
.card.wrong { animation: cardShake .5s; }
@keyframes cardShake { 20% { transform: translateX(-10px) rotate(-1.5deg); } 40% { transform: translateX(10px) rotate(1.5deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.card.win .badge::before { background: #d6ffe9; border-color: var(--mint); }

/* ---------- buono / biglietto ---------- */
.ticket { position: relative; margin: 18px auto 0; max-width: 360px; border-radius: 20px; overflow: hidden; color: #fff; text-align: left; box-shadow: 0 6px 0 rgba(0, 0, 0, .2); transform: rotate(-1.5deg); background: linear-gradient(135deg, var(--t1), var(--t2)); }
.ticket.t-pink { --t1: #ff6b9a; --t2: #ff3d6e; } .ticket.t-yellow { --t1: #ffd23f; --t2: #ff9f1c; color: #5a2a00; }
.ticket.t-mint { --t1: #3ee6b0; --t2: #12a99a; } .ticket.t-sky { --t1: #5cd0ff; --t2: #3a6bff; } .ticket.t-violet { --t1: #c08bff; --t2: #7a3cff; }
.ticket .main { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 14px; background: radial-gradient(circle, rgba(255, 255, 255, .2) 2px, transparent 3px) 0 0 / 14px 14px; }
.ticket small { display: block; font-family: Fredoka, sans-serif; font-weight: 600; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.ticket .brand { display: block; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 1.5rem; line-height: 1.1; }
.ticket .big { font-family: Fredoka, sans-serif; font-weight: 700; font-size: 2.4rem; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, .2); white-space: nowrap; }
.ticket .foot { position: relative; padding: 9px 20px 11px; border-top: 3px dashed rgba(255, 255, 255, .6); font-size: .78rem; font-weight: 800; display: flex; justify-content: space-between; gap: 8px; background: rgba(0, 0, 0, .1); }
.ticket.t-yellow .foot { border-top-color: rgba(90, 42, 0, .4); }
.ticket .foot::before, .ticket .foot::after { content: ''; position: absolute; top: -13px; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); }
.ticket .foot::before { left: -11px; } .ticket .foot::after { right: -11px; }

/* ---------- gratta e vinci ---------- */
.scratch { position: relative; height: 130px; margin: 18px auto 0; max-width: 340px; border-radius: 20px; overflow: hidden; box-shadow: 0 6px 0 rgba(0, 0, 0, .2); transform: rotate(1deg); }
.scratch .prize { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; padding: 10px 16px; text-align: center; background: radial-gradient(circle at 50% 40%, #fff7c2, #ffd23f 70%); color: var(--ink); }
.scratch .prize small { font-family: Fredoka, sans-serif; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #c11f62; font-size: .78rem; }
.scratch .prize b { font-family: Fredoka, sans-serif; font-size: 1.15rem; line-height: 1.2; }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; transition: opacity .6s; }
.scratch canvas.gone { opacity: 0; pointer-events: none; }

/* ---------- intro ---------- */
.intro { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: pointer; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #7a3cff 0%, #2b1b6b 75%); transition: opacity .9s, visibility .9s, transform 1s var(--ease); }
.intro::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255, 255, 255, .18) 3px, transparent 4px) 0 0 / 34px 34px; }
.intro.gone { opacity: 0; visibility: hidden; transform: scale(1.2); pointer-events: none; }
.ornament { position: relative; width: 160px; height: 230px; display: grid; place-items: end center; transform-origin: 50% 0; animation: swing 2.8s ease-in-out infinite; }
.ornament .string { position: absolute; left: 50%; top: -60vh; width: 3px; height: calc(60vh + 78px); background: #fff; opacity: .8; }
.ornament b { display: grid; place-items: center; width: 160px; height: 160px; border-radius: 50%; font-family: Fredoka, sans-serif; font-size: 2.6rem; font-weight: 700; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); background: radial-gradient(circle at 32% 28%, #ff9ac4, #ff3d86 50%, #b3125c); box-shadow: 0 8px 0 rgba(0, 0, 0, .25), inset -10px -14px 24px rgba(0, 0, 0, .25), inset 10px 10px 18px rgba(255, 255, 255, .4); }
@keyframes swing { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.intro-for { position: relative; margin: 30px 0 0; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 2rem; color: #fff; text-shadow: 0 4px 0 var(--pink); text-align: center; padding: 0 20px; }
.intro-hint { position: relative; margin: 6px 0 0; padding: 9px 22px; border-radius: 99px; background: #fff; color: var(--pink); font-family: Fredoka, sans-serif; font-weight: 600; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 5px 0 rgba(0, 0, 0, .25); animation: tap 1.2s var(--spring) infinite; }
@keyframes tap { 50% { transform: scale(1.08) translateY(-3px); } }

/* ---------- varie ---------- */
.sound { position: fixed; z-index: 70; top: calc(env(safe-area-inset-top) + 12px); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; font-size: 1.2rem; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.sound:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.sound[hidden] { display: none; }
.sound.off { opacity: .65; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 26px); transform: translate(-50%, 40px) scale(.9); opacity: 0; max-width: 88vw; padding: 13px 22px; border-radius: 20px; background: #fff; color: var(--ink); font-family: Fredoka, sans-serif; font-weight: 600; text-align: center; box-shadow: 0 6px 0 rgba(0, 0, 0, .25); pointer-events: none; transition: transform .5s var(--spring), opacity .25s; }
.toast.on { transform: translate(-50%, 0) scale(1); opacity: 1; }

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

/* ---------- passi della guida + frase finale ---------- */
.steps { display: grid; gap: 10px; margin: 16px 0 4px; text-align: left; }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 18px; background: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .1); }
.step i { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: #ffe9a8; font-style: normal; font-size: 1.4rem; }
.step:nth-child(3n+2) i { background: #ffd0e1; } .step:nth-child(3n) i { background: #c9f7e8; }
.step b { display: block; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.step span { font-size: .9rem; line-height: 1.3; color: #4a3d86; }
.outro { margin: 16px 0 2px; font-family: Caveat, cursive; font-weight: 700; font-size: 2.6rem; color: var(--pink); opacity: 0; transform: scale(.6); transition: opacity .5s, transform .7s var(--spring); }
.outro.in { opacity: 1; transform: scale(1); }

/* ---------- stella gigante (25 dicembre) ---------- */
.bigstar { text-align: center; padding: 30px 0 20px; overflow: hidden; }
.starwrap { position: relative; width: min(84vw, 380px); aspect-ratio: 1; margin: 6px auto 0; display: grid; place-items: center; }
.starrays { position: absolute; inset: -14%; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255, 233, 160, .35) 0 8deg, transparent 8deg 24deg); -webkit-mask: radial-gradient(circle, #000 18%, transparent 66%); mask: radial-gradient(circle, #000 18%, transparent 66%); animation: spin 22s linear infinite; }
.giant { position: relative; border: 0; background: none; cursor: pointer; padding: 0; line-height: 1; font-size: min(66vw, 300px); filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .18)); animation: starPulse 2s var(--spring) infinite; }
.giant span { display: block; }
.giant:active { transform: scale(.94); }
@keyframes starPulse { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.08) rotate(6deg); } }
.startxt { margin: 6px 0 0; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 1.3rem; color: var(--yellow); }
.linkbtn { margin-top: 10px; padding: 8px 16px; border: 2px solid rgba(255, 255, 255, .35); border-radius: 99px; background: rgba(255, 255, 255, .12); color: #fff; font-family: Fredoka, sans-serif; font-weight: 600; cursor: pointer; }

/* ---------- barra in basso ---------- */
.tabs { position: fixed; z-index: 6; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 12px); transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; border-radius: 99px; background: rgba(35, 18, 90, .92); box-shadow: 0 6px 0 rgba(0, 0, 0, .25); }
.tabs button { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border: 0; border-radius: 99px; background: transparent; color: rgba(255, 255, 255, .75); font-family: Fredoka, sans-serif; font-weight: 600; font-size: .95rem; cursor: pointer; }
.tabs button i { font-style: normal; font-size: 1.2rem; }
.tabs button.on { background: #fff; color: var(--pink); box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }

/* ---------- scrigno ---------- */
.scr-title { margin: 0; text-align: center; font-family: Fredoka, sans-serif; font-weight: 700; font-size: clamp(2rem, 8vw, 2.8rem); text-shadow: 0 4px 0 var(--pink), 0 8px 0 rgba(0, 0, 0, .22); }
.scr-sub { margin: 10px 0 14px; text-align: center; opacity: .9; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 18px; }
.chips button { padding: 9px 15px; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .15); color: #fff; font-family: Fredoka, sans-serif; font-weight: 600; cursor: pointer; }
.chips button.on { background: #fff; color: var(--pink); box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.empty { padding: 26px 18px; text-align: center; border-radius: 22px; background: rgba(255, 255, 255, .1); border: 2px dashed rgba(255, 255, 255, .3); }
.polas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (min-width: 560px) { .polas { grid-template-columns: repeat(3, 1fr); } }
.pola { margin: 0; padding: 8px 8px 12px; border: 0; border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; text-align: center; box-shadow: 0 6px 0 rgba(0, 0, 0, .22); transition: transform .3s var(--spring); }
.pola:nth-child(odd) { transform: rotate(-2deg); } .pola:nth-child(even) { transform: rotate(2deg); }
.pola:hover, .pola:active { transform: rotate(0) scale(1.04); }
.pola .ph { display: grid; place-items: center; aspect-ratio: 1; background: #ffe9a8; font-size: 3rem; overflow: hidden; }
.pola .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pola b { display: block; margin-top: 8px; font-family: Caveat, cursive; font-size: 1.35rem; line-height: 1.1; }
.pola small { display: block; font-size: .7rem; opacity: .6; }
.wallet { display: grid; gap: 22px; }
.wallet .item { position: relative; }
.wallet .ticket { margin: 0; max-width: none; }
.wallet .item.used .ticket { filter: grayscale(.9); opacity: .6; }
.wallet .item.used::after { content: 'USATO'; position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) rotate(-12deg); padding: 4px 18px; border: 4px solid #fff; border-radius: 10px; color: #fff; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 1.8rem; letter-spacing: .1em; background: rgba(255, 61, 110, .85); pointer-events: none; }
.act { display: block; margin: 10px auto 0; padding: 8px 18px; border: 0; border-radius: 99px; background: #fff; color: var(--ink); font-family: Fredoka, sans-serif; font-weight: 600; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .22); }
.act:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .22); }
.todo { display: grid; gap: 10px; }
.todo .row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--cream); color: var(--ink); box-shadow: 0 4px 0 rgba(0, 0, 0, .2); }
.todo .row > i { flex: none; font-style: normal; font-size: 1.8rem; }
.todo .row .t { flex: 1; text-align: left; }
.todo .row .t b { display: block; font-family: Fredoka, sans-serif; font-weight: 700; line-height: 1.15; }
.todo .row .t small { opacity: .7; }
.todo .row.done .t b { text-decoration: line-through; opacity: .55; }
.todo .chk { flex: none; width: 40px; height: 40px; border: 3px solid #d7c9ff; border-radius: 50%; background: #fff; font-size: 1.2rem; cursor: pointer; }
.todo .row.done .chk { background: var(--mint); border-color: var(--mint); }
.todo .del { flex: none; border: 0; background: none; font-size: 1.1rem; opacity: .5; cursor: pointer; }
.idea { display: flex; gap: 8px; margin-top: 10px; }
.idea input { flex: 1; min-width: 0; padding: 12px 16px; border: 3px solid #d7c9ff; border-radius: 99px; background: #fff; color: var(--ink); font-family: Nunito, sans-serif; font-weight: 600; font-size: 1rem; outline: none; }
.idea button { padding: 0 18px; border: 0; border-radius: 99px; background: linear-gradient(135deg, var(--pink), var(--orange)); color: #fff; font-family: Fredoka, sans-serif; font-weight: 600; cursor: pointer; box-shadow: 0 4px 0 #b4235f; }
.subh { margin: 20px 4px 8px; font-family: Fredoka, sans-serif; font-weight: 600; color: var(--yellow); }
.msgs { display: grid; gap: 10px; }
.msgs .m { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 0; border-radius: 18px; background: var(--cream); color: var(--ink); text-align: left; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .2); }
.msgs .m i { flex: none; font-style: normal; font-size: 1.8rem; }
.msgs .m b { display: block; font-family: Fredoka, sans-serif; font-weight: 700; line-height: 1.15; }
.msgs .m small { opacity: .65; }
.cell.pending:not(.open)::after { top: -6px; }
