html, body { height: 100%; overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* A prova di dita: niente zoom col doppio tocco, niente evidenziazione o menu del tocco lungo, immagini non trascinabili. */
* { touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; user-select: none; }
/* iPhone ingrandisce la pagina se un campo ha il testo sotto i 16 px */
input, textarea, select { font-size: max(16px, 1em); -webkit-touch-callout: default; user-select: text; -webkit-user-select: text; }
body {
  display: flex; flex-direction: column; min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}

#top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg-2); }
.hf-logo { background: url('/shared/brand/hollyfood-horizontal-soft.png') center / 100% auto no-repeat; aspect-ratio: 2084 / 400; width: 86px; flex-shrink: 0; }
#me { flex: 1; min-width: 0; text-align: center; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#me .dot { display: inline-block; width: 10px; height: 10px; background: var(--c); margin-right: 6px; }
#leave { border: 2px solid var(--line); background: none; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 5px 6px; cursor: pointer; flex-shrink: 0; }
#timer { font-weight: 900; font-size: 16px; min-width: 3ch; text-align: right; color: var(--peach); }

#join.card { margin: 24px 16px; padding: 24px 20px; background: var(--surface); display: grid; gap: 16px; border-top: 6px solid transparent; border-image: var(--hatch) 6; }
#join.card h1 { margin: 0; font-family: var(--font-shadow); font-weight: 500; font-size: 30px; text-transform: uppercase; line-height: 1; }
#join.card .eyebrow { font-size: 12px; }
#join label { display: grid; gap: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
#join label small { color: var(--muted); }
#join input { font: inherit; font-size: 18px; padding: 14px; border-radius: 0; border: 2px solid var(--line); background: var(--bg-2); color: var(--text); text-transform: none; letter-spacing: .02em; }
#join input:focus { outline: none; border-color: var(--cyan); }
#join .btn { padding: 16px; border: 0; border-radius: 0; background: var(--gold); color: var(--ink-on-accent); font-weight: 900; font-size: 18px; text-transform: uppercase; letter-spacing: .1em; cursor: pointer; box-shadow: 6px 6px 0 0 var(--bg-2); }
#join .btn:active { background: var(--bg-2); color: var(--gold); }
/* scelta del personaggio */
#join .pick { display: grid; gap: 8px; }
#join .pick-head { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
#join .pick-head span { color: var(--gold); margin-left: 6px; }
#join .pick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 196px; overflow-y: auto; padding: 4px; background: var(--bg-2); border: 2px solid var(--line); }
#join .pick-grid button { background: none; border: 2px solid transparent; padding: 4px 0; height: 58px; display: grid; place-items: end center; cursor: pointer; }
#join .pick-grid button img { height: 50px; width: auto; image-rendering: pixelated; }
#join .pick-grid button.taken { cursor: not-allowed; }
#join .pick-grid button.taken img { filter: brightness(0) opacity(.35); }
#join .pick-grid button.on { border-color: var(--gold); background: var(--surface-2); }
#me .ava { height: 22px; width: auto; image-rendering: pixelated; vertical-align: middle; margin-right: 6px; }
#join .error { color: var(--red); margin: 0; min-height: 1em; font-size: 14px; text-transform: uppercase; }

#view { flex: 1; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
#view h2 { font-family: var(--font-shadow); font-weight: 500; font-size: 34px; line-height: 1; margin: 10px 0; text-transform: uppercase; }
#view .eyebrow { font-size: 12px; justify-content: center; }
#view p { color: var(--muted); font-size: 15px; margin: 10px 0; text-transform: uppercase; letter-spacing: .04em; line-height: 1.35; }
#view ul { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; text-align: left; }
#view li { background: var(--surface); padding: 12px 14px; font-size: 14px; border-left: 5px solid var(--gold); text-transform: uppercase; letter-spacing: .03em; line-height: 1.3; }
#view .look-up { color: var(--cyan) !important; animation: blink 1.6s infinite; }
#view .big-num { font-family: var(--font-shadow); font-size: 72px; color: var(--gold); line-height: 1; }
#view .place { font-family: var(--font-shadow); font-size: 88px; line-height: 1; color: var(--gold); }
#view .code { font-weight: 900; font-size: 44px; letter-spacing: .14em; background: #fff; color: #161616; padding: 12px 20px; display: inline-block; margin: 12px 0; box-shadow: 8px 8px 0 0 var(--cyan); }
#view .hatch-rule { height: 8px; width: 96px; background: var(--hatch); margin: 14px auto; }

/* Area controller: il gioco la riempie tutta. */
#pad { flex: 1; position: relative; display: flex; flex-direction: column; overflow: hidden; }
#pad .game-error { margin: auto; color: var(--muted); }

/* Vittoria: coriandoli, titolo che esplode, premio con immagine e tasto "Riscatta premio". */
#view .vittoria { position: relative; width: 100%; max-width: 420px; }
#view .coriandoli { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
#view .coriandoli i { position: absolute; top: -20px; width: 9px; height: 15px; opacity: 0; animation-name: coriandolo; animation-timing-function: linear; animation-iteration-count: 2; }
@keyframes coriandolo { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(110dvh) rotate(var(--giro)); opacity: .9; } }
#view .vittoria > *:not(.coriandoli) { position: relative; z-index: 1; }
#view .esplode { color: var(--gold); font-size: 44px; animation: esplode .9s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes esplode { 0% { transform: scale(.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
#view .premio { margin: 18px auto 8px; background: var(--surface); padding: 16px; display: grid; gap: 12px; justify-items: center; box-shadow: 8px 8px 0 0 var(--cyan); animation: entra .6s .5s ease-out both; }
@keyframes entra { 0% { transform: translateY(30px); opacity: 0; } 100% { transform: none; opacity: 1; } }
#view .premio img { width: 100%; max-height: 240px; object-fit: contain; }
#view .premio .coppa { font-size: 80px; line-height: 1; animation: oscilla 1.4s ease-in-out infinite alternate; }
@keyframes oscilla { 0% { transform: rotate(-8deg) scale(1); } 100% { transform: rotate(8deg) scale(1.08); } }
#view .premio .nome { font-weight: 900; font-size: 22px; text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
#view .riscatta { display: block; margin: 20px auto 6px; padding: 18px; background: #25d366; color: #0b2e17; font-weight: 900; font-size: 20px; text-transform: uppercase; letter-spacing: .08em; text-decoration: none; box-shadow: 6px 6px 0 0 var(--bg-2); animation: entra .6s 1s ease-out both, pulsa 1.6s 1.6s ease-in-out infinite; }
#view .riscatta:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 0 var(--bg-2); }
@keyframes pulsa { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { #view .coriandoli { display: none; } #view .esplode, #view .premio, #view .riscatta, #view .premio .coppa { animation: none; } }

/* Regole sul telefono: le stesse del monitor, nello stesso momento, a caratteri grandi. */
#view .intro-tel { width: 100%; max-width: 440px; }
#view .regole { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; text-align: left; }
#view .regole li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; background: var(--surface); padding: 12px 14px; font-size: 17px; line-height: 1.25; text-transform: uppercase; letter-spacing: .02em; border-left: 5px solid var(--line);
  opacity: 0; animation: tel-regola-entra .5s var(--entra) ease-out both, tel-regola-accesa .8s var(--entra) both, tel-regola-spenta .4s var(--esce) forwards; }
#view .regole li.ultima { animation: tel-regola-entra .5s var(--entra) ease-out both, tel-regola-accesa .8s var(--entra) both; }
#view .regole .num { display: grid; place-items: center; width: 40px; height: 40px; background: var(--gold); color: var(--ink-on-accent); font-family: var(--font-shadow); font-size: 24px; }
@keyframes tel-regola-entra { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tel-regola-accesa { to { border-left-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); } }
@keyframes tel-regola-spenta { to { opacity: .45; box-shadow: none; border-left-color: var(--line); } }
#view .intro-tel .parte { margin-top: 18px; }
#view .intro-tel .parte b { color: var(--gold); font-size: 22px; }
@media (prefers-reduced-motion: reduce) { #view .regole li { animation: none !important; opacity: 1; } }
#view .tua-squadra { margin: 12px auto 0; padding: 10px 14px; background: var(--c); color: #fff; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
#view .tua-squadra b { font-weight: 900; }
