/* =========================================================
   Mimetica — stile "street / mobile game"
   ========================================================= */
:root {
  color-scheme: only light;
  --ink: #1c1838;
  --y1: #ffe45c; --y2: #ffb000;
  --g1: #6dff8f; --g2: #17b851;
  --b1: #6fd3ff; --b2: #2a7bff;
  --p1: #c58bff; --p2: #7c3dff;
  --r1: #ff8a8a; --r2: #ff2d55;
  --w1: #ffffff; --w2: #dcd6ff;
  --pink: #ff2d7a;
  --muted: #6b628c;
  --sheet1: #3b22b8; --sheet2: #22107a;
  --ui: 'Nunito', system-ui, sans-serif;
  --disp: 'Lilita One', 'Nunito', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font: 800 15px/1.3 var(--ui); color: var(--ink); background: #24127a; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.bgfx {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.22) 0 2px, transparent 3px) 0 0/60px 60px,
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.16) 0 1.5px, transparent 2.5px) 0 0/44px 44px,
    repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 22px, transparent 22px 44px),
    radial-gradient(ellipse at 50% 25%, #7c4dff 0%, #4a2bd8 45%, #24127a 100%);
  background-attachment: fixed;
}
.screen { display: none; position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; }
.screen.active { display: block; }
#screen-game { overflow: hidden; }

/* ---------- tipografia ---------- */
.t3 { font-family: var(--disp); font-weight: 400; color: #fff; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); letter-spacing: .01em; }
.t3s { font-family: var(--disp); font-weight: 400; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.cap { font: 400 13px var(--disp); letter-spacing: .02em; }
.lbl { font: 400 15px var(--disp); margin: 12px 0 6px; }
.block > .lbl:first-child, .block > div:first-child > .lbl:first-child { margin-top: 0; }
.sub { color: #e7dcff; text-align: center; margin: 0; font-weight: 800; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.error { color: #fff; background: var(--r2); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 10px; text-align: center; margin: 0; }
.error:empty { display: none; }

/* ---------- componenti ---------- */
.b3 {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 3px solid var(--ink); border-radius: 18px; padding: 10px 18px; color: #fff;
  background: linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow: inset 0 -7px 0 rgba(0,0,0,.18), inset 0 3px 0 rgba(255,255,255,.55), 0 5px 0 var(--ink);
  position: relative; transition: transform .06s, box-shadow .06s, filter .15s; user-select: none;
}
.b3::after { content: ''; position: absolute; left: 10px; right: 10px; top: 5px; height: 28%; border-radius: 12px; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0)); pointer-events: none; }
.b3:active { transform: translateY(4px); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), inset 0 3px 0 rgba(255,255,255,.55), 0 1px 0 var(--ink); }
.b3:disabled { filter: grayscale(.85) brightness(.85); cursor: not-allowed; }
.b3.y { --c1: var(--y1); --c2: var(--y2); } .b3.g { --c1: var(--g1); --c2: var(--g2); } .b3.b { --c1: var(--b1); --c2: var(--b2); }
.b3.p { --c1: var(--p1); --c2: var(--p2); } .b3.r { --c1: var(--r1); --c2: var(--r2); } .b3.w { --c1: var(--w1); --c2: var(--w2); color: var(--ink); }
.b3.big { min-height: 66px; width: 100%; border-radius: 20px; }
.b3.big .t3 { font-size: 32px; }
.b3.wide { width: 100%; flex-direction: column; gap: 0; padding: 8px 16px; }
.b3.wide .t3s { font-size: 20px; }
.b3 small { font: 900 12px var(--ui); color: rgba(255,255,255,.92); text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.b3.big small { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font: 400 16px var(--disp); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.b3.sq { width: 46px; height: 46px; padding: 0; border-radius: 14px; font: 400 20px var(--disp); }
.b3.sq.small { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
.b3.small { padding: 6px 12px; border-radius: 14px; }
.card { background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink); }
.block { padding: 12px 14px; }
.inp { width: 100%; border: 3px solid var(--ink); border-radius: 14px; padding: 11px 14px; background: #f3f0ff; font: 900 17px var(--ui); color: var(--ink); outline: none; }
.inp:focus { background: #fff; box-shadow: 0 0 0 4px rgba(124,61,255,.35); }
.pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(20,12,60,.65); border: 3px solid var(--ink); border-radius: 99px; padding: 4px 12px; color: #fff; font: 400 15px var(--disp); box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.ribbon { position: relative; display: inline-block; padding: 4px 24px; background: linear-gradient(180deg, #ff5fae, #ff2d7a); border: 3px solid var(--ink); clip-path: polygon(0 0, 100% 0, 93% 50%, 100% 100%, 0 100%, 7% 50%); font: 400 15px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; white-space: nowrap; }
.ribbon.yellow { background: linear-gradient(180deg, var(--y1), var(--y2)); }
.ribbon.small { font-size: 13px; padding: 2px 18px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 44px; border: 3px solid var(--ink); border-radius: 12px; background: #f1edff; padding: 6px 8px; font: 400 16px var(--disp); box-shadow: 0 3px 0 var(--ink); }
.seg button.on { background: linear-gradient(180deg, var(--y1), var(--y2)); }
.seg button:disabled { cursor: default; }
.row2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row2 .seg button { min-width: 0; padding: 6px 2px; font-size: 14px; }
.fig svg { display: block; overflow: visible; }
/* balletti di esultanza (danceFig in client.js): l'omino che balla occupa lo spazio di quello fermo e può uscirne */
.dz { display: block; position: relative; flex: none; }
.dz > svg { position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; }
.mate.me-tap .fig { cursor: pointer; }
.bubble { position: absolute; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 4px 12px; font: 400 18px var(--disp); box-shadow: 0 3px 0 var(--ink); white-space: nowrap; z-index: 2; }
.bubble::after { content: ''; position: absolute; left: 18px; bottom: -11px; width: 14px; height: 14px; background: #fff; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); }
.bubble.pop { animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
svg.i { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; flex: none; filter: drop-shadow(0 2px 0 var(--ink)); }

/* ---------- colonne (home, lobby, locale) ---------- */
.col { max-width: 460px; margin: 0 auto; padding: calc(var(--safe-t) + 18px) 16px calc(var(--safe-b) + 28px); display: flex; flex-direction: column; gap: 14px; }
.hdr { display: flex; align-items: center; gap: 10px; }
.hdr .title { font-size: clamp(22px, 7vw, 30px); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* HOME */
.brand { text-align: center; }
/* logo disegnato: in home e nel benvenuto solo la scritta (logo-scritta.svg), intero nella splash (logo.svg) */
.brandlogo { --lw: min(330px, 86vw); display: block; margin: 0 auto; width: var(--lw); height: calc(var(--lw) * .494); flex: none; }
.brandlogo img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 5px 0 rgba(20,10,70,.35)); }
.tagline { margin: 8px 0 0; color: #fff; font: 900 15px var(--ui); text-shadow: 0 2px 0 var(--ink); }
.showcase { position: relative; height: 250px; display: flex; justify-content: center; }
.plat { position: absolute; bottom: 4px; width: 210px; height: 54px; border-radius: 50%; background: radial-gradient(ellipse, #b78bff 0%, #6b3dff 55%, #3a1fb0 100%); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink), 0 0 40px rgba(180,140,255,.7); }
.showcase .fig { position: absolute; bottom: 26px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
/* l'omino parla: frasi a rotazione (talk() in client.js), al massimo 2 righe, si tocca per andare dove dice */
.showcase .bubble { top: auto; bottom: 224px; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: min(260px, calc(100% - 140px)); white-space: normal; text-align: center; font-size: 16px; line-height: 1.15; padding: 5px 12px; }
.showcase .bubble.go, #home-fig { cursor: pointer; }
.col.home .showcase { height: 290px; }
.showcase .bubble::after { left: calc(50% - 7px); }
.showcase .fig { z-index: 1; }
.profile { padding: 12px 14px; }
.profile .lbl:first-child { margin-top: 0; }
.color-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.color-picks button { width: 34px; height: 34px; border-radius: 11px; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); padding: 0; }
.color-picks button.on { outline: 3px solid var(--ink); outline-offset: 3px; transform: translateY(-2px); }
.join { display: flex; gap: 10px; }
.join .code { text-transform: uppercase; letter-spacing: .3em; text-align: center; font: 400 22px var(--disp); flex: 1; }
.join .b3 { min-width: 112px; }
.join .b3 .t3s { font-size: 20px; }
.howto { padding: 10px 14px; font: 800 14px var(--ui); }
.howto summary { font: 400 17px var(--disp); cursor: pointer; }
.howto ol { padding-left: 20px; margin: 8px 0 2px; }
.howto li { margin-bottom: 4px; }

/* LOBBY */
.codebox { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; }
.codebox b { font: 400 24px var(--disp); letter-spacing: .14em; }
.squad { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 12px; padding-top: 24px; } /* righe distanziate: la nuvoletta delle emoji sta nello spazio sopra la card */
.mate { height: 138px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 8px; background: linear-gradient(180deg, var(--bgc), #fff 88%); }
.mate .fig { position: absolute; bottom: 40px; }
.mate .n { font: 400 17px var(--disp); max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mate .crown { position: absolute; left: -10px; top: -14px; font-size: 26px; filter: drop-shadow(0 2px 0 var(--ink)); }
.mate .bubble { top: -30px; left: 0; right: 0; margin: 0 auto; width: fit-content; font-size: 15px; padding: 2px 9px; }
/* coda: triangolino centrato sotto la nuvoletta, verso l'omino (prima era un quadratino che finiva sopra il badge Lv) */
.mate .bubble::after { left: calc(50% - 5px); bottom: -8px; width: 10px; height: 10px; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.mate.off { opacity: .5; }
.mate.empty { background: rgba(255,255,255,.12); border: 3px dashed rgba(255,255,255,.55); box-shadow: none; color: #fff; justify-content: center; font: 400 16px var(--disp); height: 138px; border-radius: 18px; }
.emotes { display: flex; justify-content: space-between; gap: 8px; }
.emotes .b3 { flex: 1; height: 46px; padding: 0; font-size: 22px; }
.emotes .b3 .gg { font: 400 16px var(--disp); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modes button { text-align: left; border: 3px solid var(--ink); border-radius: 14px; background: #f1edff; padding: 8px 10px; box-shadow: 0 3px 0 var(--ink); }
.modes button b { display: block; font: 400 16px var(--disp); }
.modes button span { font: 800 12px var(--ui); color: var(--muted); }
.modes button.on { background: linear-gradient(180deg, #fff7c2, #ffe066); }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.themes button { border: 3px solid var(--ink); border-radius: 14px; padding: 6px 4px; box-shadow: 0 3px 0 var(--ink); background: linear-gradient(180deg, var(--t1), var(--t2)); color: #fff; display: flex; flex-direction: column; align-items: center; }
.themes button .e { font-size: 24px; line-height: 1.1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }
.themes button .t3s { font-size: 14px; }
.themes button.on { outline: 4px solid var(--ink); outline-offset: 2px; transform: translateY(-2px); }
.themes button:not(.on) { filter: saturate(.55) brightness(.92); }
.local-names { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.local-row { display: flex; gap: 8px; align-items: center; }
.local-row .sw { width: 38px; height: 44px; border-radius: 12px; border: 3px solid var(--ink); flex: none; display: grid; place-items: center; }

/* =========================================================
   PARTITA
   ========================================================= */
.stage { position: absolute; top: calc(var(--safe-t) + 100px); left: 24px; right: 24px; bottom: 24px; border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; background: #140a46; box-shadow: 0 7px 0 var(--ink), 0 24px 50px rgba(0,0,0,.35); }
#main-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.zoom-ctrls { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.caption { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 80px); background: rgba(20,12,60,.75); color: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 3px 9px; font: 800 11.5px var(--ui); z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caption:empty { display: none; }
.caption b { font: 400 13px var(--disp); }

/* disposizione per fase (computer) */
#screen-game.is-hiding .stage { left: 120px; right: 372px; bottom: 116px; }
#screen-game.has-side .stage { right: 340px; }

.hud-top { position: absolute; left: 20px; right: 20px; top: calc(var(--safe-t) + 12px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; pointer-events: none; z-index: 30; }
.hud-top > * { pointer-events: auto; }
.hud-l { display: flex; gap: 8px; align-items: center; padding-top: 6px; }
.hud-r { display: flex; justify-content: flex-end; padding-top: 4px; }
.timerbox { display: flex; flex-direction: column; align-items: center; }
.timerbox .tb { min-width: 120px; height: 58px; padding: 0 16px; border-radius: 18px; cursor: default; }
.timerbox .tb:active { transform: none; }
.timerbox .tb .t3 { font-size: 36px; font-variant-numeric: tabular-nums; }
.timerbox .ribbon { margin-top: -10px; z-index: 1; }
.timerbox.urgent .tb { animation: shake .5s infinite; }
@keyframes shake { 25% { transform: rotate(-3deg) scale(1.04); } 75% { transform: rotate(3deg) scale(1.04); } }
.info-chip { position: absolute; left: 50%; top: calc(var(--safe-t) + 94px); transform: translateX(-50%); z-index: 4; background: rgba(20,12,60,.8); border: 2px solid var(--ink); color: #fff; border-radius: 99px; padding: 2px 12px; font: 800 12px var(--ui); white-space: nowrap; }
#screen-game.is-hiding .info-chip, #screen-game.has-side .info-chip { display: none; }

.players-strip { position: absolute; right: 20px; top: calc(var(--safe-t) + 14px); display: flex; gap: 8px; z-index: 30; }
.pl { position: relative; display: flex; align-items: center; gap: 6px; background: rgba(20,12,60,.65); border: 3px solid var(--ink); border-radius: 14px; padding: 3px 9px 3px 3px; box-shadow: 0 3px 0 var(--ink); color: #fff; }
.pl .av { width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.pl .nm { font: 400 14px var(--disp); max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .pips { display: flex; gap: 2px; }
.pl .pips i { width: 8px; height: 13px; border-radius: 3px; border: 2px solid var(--ink); background: #e9e4ff; }
.pl .pips i.f { background: var(--c); }
.pl .ok { position: absolute; left: 24px; bottom: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--g2); border: 2px solid var(--ink); color: #fff; font: 900 11px var(--ui); display: grid; place-items: center; }
.pl.off { opacity: .45; }
.pl .bubble { top: auto; bottom: -40px; left: 0; font-size: 15px; padding: 1px 8px; }
.pl .bubble::after { top: -10px; bottom: auto; transform: rotate(225deg); }

.ammo { display: flex; gap: 3px; padding: 4px 8px; align-items: center; }
.can { width: 16px; height: 28px; position: relative; }
.can i { position: absolute; left: 1px; right: 1px; bottom: 0; top: 7px; border-radius: 4px 4px 3px 3px; border: 2px solid var(--ink); background: linear-gradient(90deg, #ff6fb5, #ff2d7a); }
.can b { position: absolute; left: 5px; top: 1px; width: 6px; height: 7px; border: 2px solid var(--ink); border-radius: 2px; background: #ddd; }
.can.used { opacity: .45; } .can.used i { background: #8b84a8; }
#screen-game .hud-l .ammo { padding: 3px 8px; }

/* ---------- chi si nasconde (computer) ---------- */
.hider-ui { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.hider-ui > * { pointer-events: auto; }
.toolbar { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px; }
.toolbar .b3 { width: 78px; height: 66px; padding: 0; flex-direction: column; gap: 0; border-radius: 18px; }
.toolbar .b3 span { font: 400 12px var(--disp); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; color: #fff; }
.toolbar .tool.active { outline: 4px solid #fff; outline-offset: 2px; transform: scale(1.04); }
.side-r { position: absolute; right: 20px; top: calc(var(--safe-t) + 100px); width: 332px; display: flex; flex-direction: column; gap: 12px; }
.lens { height: 250px; overflow: hidden; position: relative; padding: 0; }
.lens canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; image-rendering: pixelated; }
.lens .ribbon { position: absolute; left: 8px; top: 8px; }
.camo { padding: 10px 14px; }
.camo .row { display: flex; align-items: center; gap: 6px; }
.camo .stars { display: flex; gap: 1px; margin-left: auto; }
.camo .stars svg { width: 20px; height: 20px; fill: #ffc400; stroke: var(--ink); stroke-width: 2; }
.camo .stars svg.e { fill: #ddd6f3; }
.camo .val { font: 400 40px/1 var(--disp); }
.camo .ql { font: 900 12px var(--ui); margin-left: auto; text-align: right; }
.meter { height: 16px; border-radius: 9px; border: 3px solid var(--ink); background: #e9e4ff; overflow: hidden; margin-top: 6px; position: relative; }
.meter i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #ff2d55, #ffb000 45%, #17d36a); transition: width .3s; }
.tipcard { padding: 10px 12px; display: flex; gap: 10px; align-items: center; background: linear-gradient(90deg, #fff6c9, #fff); font: 900 13px var(--ui); }
.tipcard .e { font-size: 24px; }
.dock { position: absolute; left: 120px; right: 372px; bottom: 16px; display: flex; align-items: center; gap: 14px; padding: 10px 12px; min-height: 84px; }
.curc { position: relative; width: 52px; height: 52px; flex: none; cursor: pointer; }
.curc i { position: absolute; inset: 0; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 3px var(--ink), 0 4px 0 3px var(--ink); }
.curc input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dock-pal { flex: 1; min-width: 0; }
.palette { display: flex; gap: 7px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.palette::-webkit-scrollbar { display: none; }
.palette button { width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); flex: none; padding: 0; }
.palette button.on { outline: 3px solid var(--ink); outline-offset: 2px; transform: translateY(-2px); }
.dock-size { width: 130px; }
.dock-size input { width: 100%; accent-color: var(--p2); }
.readyb { min-width: 200px; height: 60px; border-radius: 18px; }
.readyb .t3 { font-size: 28px; }
.readyb.is-ready { --c1: #fff7c2; --c2: #ffd84a; }

/* ---------- cercatore (computer) ---------- */
.info-ui { position: absolute; right: 20px; top: calc(var(--safe-t) + 100px); width: 300px; z-index: 4; }
.infocard { padding: 12px 14px; }
.info-title { font: 400 22px var(--disp); }
.info-body { font: 800 14px var(--ui); color: var(--muted); display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.info-body .big { font: 400 34px var(--disp); color: var(--ink); }
.targets { position: absolute; right: 20px; width: 300px; top: calc(var(--safe-t) + 300px); z-index: 4; }
.targets .lbl2 { font: 400 15px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; display: block; margin-bottom: 6px; }
.tgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tg { height: 86px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 5px; overflow: hidden; }
.tg .fig { position: absolute; top: 8px; }
.tg .q { position: absolute; top: 8px; font: 400 32px var(--disp); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.tg .n { font: 400 14px var(--disp); max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg .stamp { position: absolute; top: 26px; left: 50%; transform: translateX(-50%) rotate(-12deg); font: 400 14px var(--disp); color: #ff2d55; border: 3px solid #ff2d55; border-radius: 8px; padding: 0 6px; background: rgba(255,255,255,.9); }

/* ---------- effetti ---------- */
.burst { position: absolute; transform: translate(-50%, -50%); width: 200px; height: 150px; display: grid; place-items: center; animation: burst 1.4s ease-out forwards; }
.burst svg { position: absolute; inset: 0; }
.burst .t3 { font-size: 30px; position: relative; transform: rotate(-6deg); }
.burst .pts { position: absolute; bottom: 4px; right: 12px; font: 400 26px var(--disp); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; transform: rotate(6deg); }
@keyframes burst { 0% { transform: translate(-50%, -50%) scale(.2) rotate(-20deg); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.15) rotate(3deg); opacity: 1; } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -80%) scale(.9); opacity: 0; } }
.puff { position: absolute; transform: translate(-50%, -50%); animation: puff 1s ease-out forwards; text-align: center; }
.puff .t3s { font-size: 14px; display: block; }
@keyframes puff { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; } 100% { transform: translate(-50%, -70%) scale(1); opacity: 0; } }

/* ---------- overlay ---------- */
.stage-overlay { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: calc(var(--safe-t) + 20px) 16px calc(var(--safe-b) + 20px); text-align: center; overflow-y: auto; }
.stage-overlay.solid { background: inherit; background: radial-gradient(ellipse at 50% 25%, #7c4dff 0%, #4a2bd8 45%, #24127a 100%); }
.stage-overlay.dim { background: rgba(20,10,70,.82); backdrop-filter: blur(4px); }
.stage-overlay.sheet { justify-content: flex-end; background: linear-gradient(180deg, transparent 30%, rgba(20,10,70,.55)); pointer-events: none; }
.stage-overlay.sheet > * { pointer-events: auto; }
.stage-overlay .big-emoji { font-size: 72px; filter: drop-shadow(0 4px 0 var(--ink)); animation: bob 2s ease-in-out infinite; }
.stage-overlay h2 { margin: 0; }
.stage-overlay h2.t3 { font-size: 40px; }
.stage-overlay p { color: #fff; font: 900 16px var(--ui); margin: 0; text-shadow: 0 2px 0 var(--ink); max-width: 420px; }
.resultcard { width: min(520px, 100%); padding: 14px; text-align: left; }
.resultcard h3 { margin: 0 0 8px; font: 400 24px var(--disp); text-align: center; }
.rrow { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 14px; background: #f1edff; border: 3px solid var(--ink); margin-bottom: 6px; }
.rrow.win { background: linear-gradient(90deg, #fff3a8, #ffe066); }
.rrow .av { width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--ink); display: grid; place-items: center; flex: none; }
.rrow .nm { flex: 1; font: 400 16px var(--disp); min-width: 0; }
.rrow .nm small { display: block; font: 800 11.5px var(--ui); color: var(--muted); }
.rrow .pts { font: 400 22px var(--disp); }
.awards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.aw { border: 3px solid var(--ink); border-radius: 14px; padding: 6px; text-align: center; background: linear-gradient(180deg, #efe7ff, #fff); }
.aw .e { font-size: 26px; display: block; }
.aw b { display: block; font: 400 14px var(--disp); }
.aw span { font: 800 11px var(--ui); color: var(--muted); }
.ov-actions { display: flex; gap: 10px; width: min(520px, 100%); align-items: center; }
.ov-actions .b3 { flex: 1; height: 58px; }
.ov-actions .b3 .t3 { font-size: 26px; }
.ov-emotes { display: flex; gap: 6px; }
.ov-emotes .b3::before, .emotes .b3::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 0; border-radius: inherit; background: rgba(255,255,255,.6); pointer-events: none; }
/* pulsanti delle reazioni in ricarica (2,5 s) o finiti per questo turno */
.ov-emotes.cool .b3, .emotes.cool .b3, .ov-emotes.spent .b3 { filter: grayscale(.85) brightness(.88); pointer-events: none; }
.ov-emotes.cool .b3::before, .emotes.cool .b3::before { animation: emote-cd 2.5s linear var(--cd-delay, 0ms) both; }
.ov-emotes.spent .b3 { opacity: .55; }
@keyframes emote-cd { from { height: 100%; } to { height: 0; } }
/* emoji che volano nel fine turno (posizione e dissolvenza da stepFlies in client.js) */
.fly-layer { position: fixed; inset: 0; z-index: 25; pointer-events: none; overflow: hidden; }
.fly { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; will-change: transform, opacity; }
.fly .e { font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
.fly .gg { font: 400 20px var(--disp); color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.fly .x { position: absolute; right: -18px; top: -6px; font: 400 14px var(--disp); color: var(--y1); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.fly .x.pop { animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.fly .dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink); margin-top: 2px; }
.no-po .fly .gg, .no-po .fly .x { -webkit-text-stroke: 0; text-shadow: 0 2px 0 var(--ink), 0 -1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink); }
.recap-nav { position: relative; display: flex; justify-content: center; align-items: center; width: min(520px, 100%); min-height: 34px; flex: none; }
.recap-nav .recap-skip { position: absolute; right: 0; top: 50%; transform: translateY(-50%); height: 34px; padding: 0 12px; border-radius: 12px; }
.recap-nav .recap-skip:active { transform: translateY(calc(-50% + 3px)); }
.recap-nav .recap-skip .t3s { font-size: 15px; }
.ov-actions .votebtn { min-width: 0; }
.ov-actions .votebtn .t3s { font-size: 20px; }
.votebtn:disabled { filter: none; cursor: default; }
.votebtn .vc { position: absolute; top: -12px; right: -8px; z-index: 2; min-width: 34px; padding: 1px 7px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); font: 400 16px var(--disp); text-align: center; }
.ov-emotes .b3 { width: 46px; height: 42px; padding: 0; font-size: 20px; }
.next-bar { width: min(520px, 100%); height: 10px; border-radius: 9px; border: 3px solid var(--ink); background: rgba(255,255,255,.3); overflow: hidden; }
.next-bar i { display: block; height: 100%; background: var(--y1); width: 0; transition: width .25s linear; }
.win-ribbon { padding: 6px 40px; font-size: 0; }
.win-ribbon .t3 { font-size: 40px; }
.podium { position: relative; width: 360px; max-width: 100%; height: 300px; margin-top: 46px; }
.step { position: absolute; bottom: 0; width: 33%; border: 3px solid var(--ink); border-radius: 14px 14px 0 0; box-shadow: inset 0 -10px 0 rgba(0,0,0,.15), inset 0 4px 0 rgba(255,255,255,.4); display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.step .t3 { font-size: 34px; }
.step .fig { position: absolute; bottom: 100%; margin-bottom: 4px; animation: bob 2.4s ease-in-out infinite; }
.step .nm { font: 400 14px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.step .sc { font: 400 18px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border: 2px solid var(--ink); border-radius: 3px; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.others { width: min(420px, 100%); }

.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 12px); transform: translate(-50%, -160%); z-index: 100; background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); padding: 8px 14px; font: 900 14px var(--ui); transition: transform .3s cubic-bezier(.2,1.4,.4,1); max-width: calc(100vw - 24px); text-align: center; }
.toast:not(.show) { opacity: 0; visibility: hidden; transition: transform .3s, opacity .2s, visibility .3s; }
.toast.show { transform: translate(-50%, 0); }

/* =========================================================
   TELEFONO — regole comuni (verticale e orizzontale)
   ========================================================= */
.grab { display: none; }
@media (max-width: 820px), (max-height: 500px) {
  .stage, #screen-game.is-hiding .stage, #screen-game.has-side .stage {
    left: 0; right: 0; bottom: var(--sheet-h, 0px); border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; box-shadow: none;
  }
  .info-chip { display: none; }
  /* la didascalia non copre la scena: si vede solo a fine turno, in alto */
  .caption { top: 6px; bottom: auto; left: 6px; font-size: 10.5px; max-width: calc(100% - 60px); }
  #screen-game:not(.ph-reveal) .caption { display: none; }
  /* zoom: si usa il pizzico; resta solo "adatta" piccolo in alto a destra */
  .zoom-ctrls { top: 6px; right: 6px; bottom: auto; }

  .zoom-ctrls .b3.sq.small { width: 34px; height: 34px; border-radius: 11px; font-size: 16px; opacity: .9; }
  .pl { padding: 2px; border-radius: 12px; }
  .pl .nm { display: none; }
  .pl .av { width: 30px; height: 30px; border-radius: 9px; }
  .pl .pips i { width: 6px; height: 11px; }
  .pl .ok { left: 18px; }
  .pl:has(.pips) { padding-right: 5px; }

  /* ---- pannello di chi si nasconde: una griglia unica ---- */
  .hider-ui {
    inset: auto 0 0 0; display: grid; gap: 8px 10px; align-items: center;
    grid-template-columns: 46px 1fr 128px;
    grid-template-areas: "grab grab grab" "tools tools tools" "cur pal pal" "size size camo" "tip tip tip" "ready ready ready";
    padding: 4px 10px calc(var(--safe-b) + 10px);
    background: linear-gradient(180deg, var(--sheet1), var(--sheet2)); border-top: 3px solid var(--ink); border-radius: 22px 22px 0 0;
  }
  .side-r, .dock { display: contents; }
  .lens, #recent-colors { display: none !important; }
  .grab { display: block; grid-area: grab; justify-self: center; width: 64px; height: 18px; border: 0; background: none; padding: 0; position: relative; }
  .grab::before { content: ''; position: absolute; left: 14px; right: 14px; top: 7px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.45); }
  .toolbar { grid-area: tools; position: static; transform: none; flex-direction: row; justify-content: space-between; gap: 6px; }
  .toolbar .b3 { flex: 1; width: auto; height: 46px; border-radius: 14px; }
  .toolbar .b3 span { display: none; }
  .toolbar .b3 svg.i { width: 22px; height: 22px; }
  .curc { grid-area: cur; width: 44px; height: 44px; }
  .dock-pal { grid-area: pal; }
  .dock-pal .cap { display: none; }
  .palette { padding: 3px 2px 6px; gap: 6px; }
  .palette button { width: 32px; height: 32px; }
  .dock-size { grid-area: size; width: auto; display: flex; align-items: center; gap: 8px; }
  .dock-size .cap { color: #fff; font-size: 12px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
  .dock-size input { flex: 1; min-width: 0; }
  .size-dot { display: block; }
  .camo { grid-area: camo; padding: 4px 8px; border-radius: 14px; box-shadow: 0 3px 0 var(--ink); }
  .camo .cap { font-size: 10px; }
  .camo .stars svg { width: 13px; height: 13px; }
  .camo .val { font-size: 20px; }
  .camo .ql { display: none; }
  .meter { height: 9px; margin-top: 2px; border-width: 2px; }
  .tipcard { grid-area: tip; background: none; border: 0; box-shadow: none; padding: 0 2px; color: #fff; font-size: 12px; min-height: 30px; gap: 6px; display: flex; }
  .tipcard.hidden { display: flex !important; visibility: hidden; }
  .tipcard .e { font-size: 16px; }
  .tipcard b { color: var(--y1); }
  .readyb { grid-area: ready; width: 100%; height: 52px; min-width: 0; }
  .readyb .t3 { font-size: 26px; }
  /* pannello ridotto: solo strumenti, mimetismo e PRONTO */
  .hider-ui.mini { grid-template-areas: "grab grab grab" "tools tools tools" "ready ready camo"; }
  .hider-ui.mini .curc, .hider-ui.mini .dock-pal, .hider-ui.mini .dock-size, .hider-ui.mini .tipcard { display: none !important; }

  /* ---- ricerca ---- */
  .info-ui { left: 0; right: 0; bottom: 0; top: auto; width: auto; }
  .infocard { border-radius: 22px 22px 0 0; border-left: 0; border-right: 0; border-bottom: 0; box-shadow: none; padding: 8px 14px calc(var(--safe-b) + 10px); }
  .info-title { font-size: 17px; }
  .info-body { font-size: 12.5px; gap: 2px; }
  .info-body .big { font-size: 20px; }
  .info-body .hint { display: none; }
  #screen-game.has-targets .info-ui { display: none; }
  .targets { left: 0; right: 0; width: auto; top: auto; bottom: 0; padding: 8px 10px calc(var(--safe-b) + 10px); background: linear-gradient(180deg, var(--sheet1), var(--sheet2)); border-top: 3px solid var(--ink); border-radius: 22px 22px 0 0; }
  .targets .lbl2 { font-size: 13px; margin-bottom: 4px; }
  .tgs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .tgs::-webkit-scrollbar { display: none; }
  .tg { height: 62px; min-width: 84px; flex: 1; }
  .tg .fig svg { max-height: 30px; max-width: 60px; }
  .tg .q { font-size: 24px; top: 4px; }
  .tg .stamp { top: 16px; font-size: 12px; }

  /* ---- fine turno ---- */
  .stage-overlay.sheet { padding-top: calc(var(--safe-t) + 100px); }
  .stage-overlay.sheet .resultcard { max-height: 52vh; overflow-y: auto; }
  .resultcard h3 { font-size: 19px; }
  .rrow { padding: 5px 7px; }
  .rrow .nm { font-size: 14px; }
  .rrow .pts { font-size: 18px; }
  .aw .e { font-size: 20px; }
  .stage-overlay h2.t3 { font-size: 32px; }
  .podium { height: 250px; }
}

/* =========================================================
   TELEFONO IN VERTICALE
   ========================================================= */
@media (max-width: 820px) and (min-height: 501px) {
  .stage, #screen-game.is-hiding .stage, #screen-game.has-side .stage { top: calc(var(--safe-t) + 102px); }
  .hud-top { left: 8px; right: 8px; top: calc(var(--safe-t) + 6px); }
  .hud-l .pill { font-size: 13px; padding: 2px 9px; }
  .timerbox .tb { min-width: 92px; height: 44px; border-radius: 15px; }
  .timerbox .tb .t3 { font-size: 26px; -webkit-text-stroke-width: 5px; }
  .timerbox .ribbon { font-size: 12px; padding: 1px 16px; margin-top: -8px; }
  .ammo { padding: 3px 5px; gap: 2px; }
  .can { width: 12px; height: 22px; }
  .can i { top: 6px; }
  .can b { left: 3px; width: 5px; height: 6px; }
  .players-strip { left: 8px; right: 8px; top: calc(var(--safe-t) + 64px); justify-content: center; gap: 5px; }
  .pl .bubble { display: none; }
}
@media (max-width: 820px) and (max-height: 740px) and (min-height: 501px) {
  .hider-ui:not(.mini) { grid-template-areas: "grab grab grab" "tools tools tools" "cur pal pal" "size size camo" "tip tip tip" "ready ready ready"; gap: 6px 8px; }
  .toolbar .b3 { height: 42px; }
  .readyb { height: 46px; }
  .tipcard { min-height: 28px; font-size: 11.5px; }
}

/* =========================================================
   TELEFONO IN ORIZZONTALE: scena a sinistra, pannello a destra
   ========================================================= */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --side-w: min(300px, 40vw); }
  .stage, #screen-game.is-hiding .stage, #screen-game.has-side .stage { top: calc(var(--safe-t) + 54px); bottom: 0; left: env(safe-area-inset-left, 0px); }
  #screen-game.is-hiding .stage, #screen-game.has-side .stage, #screen-game.has-targets .stage { right: var(--side-w); }
  .hud-top { left: 10px; right: 10px; top: 4px; }
  .timerbox .tb { min-width: 84px; height: 38px; border-radius: 13px; }
  .timerbox .tb .t3 { font-size: 22px; -webkit-text-stroke-width: 5px; }
  .timerbox .ribbon { font-size: 11px; padding: 0 14px; margin-top: -8px; }
  .hud-r { display: none; }
  .players-strip { top: 6px; right: 10px; gap: 5px; }
  .pl .bubble { display: none; }
  /* pannelli laterali a destra */
  .hider-ui, .targets, .info-ui {
    inset: calc(var(--safe-t) + 54px) env(safe-area-inset-right, 0px) 0 auto; width: var(--side-w);
    border-radius: 18px 0 0 0; border-top: 3px solid var(--ink); border-left: 3px solid var(--ink); overflow-y: auto;
  }
  .hider-ui { padding: 8px 10px 12px; align-content: start; grid-template-columns: 40px 1fr 122px; }
  .camo .stars svg { width: 11px; height: 11px; }
  .camo .cap { font-size: 9px; }
  body.in-game .toast { top: auto; bottom: 12px; left: 32%; }
  .hider-ui .grab { display: none; }
  .hider-ui, .hider-ui.mini { grid-template-areas: "tools tools tools" "cur pal pal" "size size camo" "tip tip tip" "ready ready ready"; }
  .hider-ui.mini .curc, .hider-ui.mini .dock-pal, .hider-ui.mini .dock-size, .hider-ui.mini .tipcard { display: flex !important; }
  .toolbar .b3 { height: 38px; border-radius: 12px; }
  .curc { width: 38px; height: 38px; }
  .palette button { width: 28px; height: 28px; }
  .readyb { height: 44px; }
  .readyb .t3 { font-size: 22px; }
  .targets { padding: 8px 10px; background: linear-gradient(180deg, var(--sheet1), var(--sheet2)); }
  .tgs { flex-wrap: wrap; overflow: visible; }
  .tg { min-width: 0; flex: 1 1 40%; }
  .info-ui { background: #fff; }
  .infocard { border: 0; border-radius: 0; padding: 10px 12px; }
  .ammo { display: none; }
  /* fine turno: riepilogo a destra, scena visibile a sinistra */
  .stage-overlay.sheet { padding: calc(var(--safe-t) + 54px) 10px 10px; align-items: flex-end; justify-content: flex-start; background: linear-gradient(90deg, transparent 40%, rgba(20,10,70,.6)); }
  .stage-overlay.sheet .resultcard { width: min(420px, 55vw); max-height: calc(100vh - 130px); }
  .stage-overlay.sheet .next-bar, .stage-overlay.sheet .ov-actions { width: min(420px, 55vw); }
  .stage-overlay .big-emoji { font-size: 44px; }
  .stage-overlay h2.t3 { font-size: 26px; }
  .podium { height: 300px; margin-top: 46px; transform: none; zoom: .62; flex: none; }
  .stage-overlay .ribbon { flex: none; }
  /* il pulsante PRONTO! resta sempre visibile in fondo al pannello, anche se gli strumenti scorrono */
  .hider-ui .readyb { position: sticky; bottom: 4px; z-index: 3; }
}

/* home e lobby su schermi bassi */
@media (max-height: 740px) {
  .col.home { gap: 10px; padding-top: calc(var(--safe-t) + 12px); }
  .tagline { display: none; }
  .showcase { height: 150px; }
  .showcase .fig { bottom: 20px; }
  .showcase .fig svg { max-height: 118px; max-width: 220px; }
  .col.home .showcase { height: 150px; margin-top: 34px; }
  .showcase .bubble { bottom: 156px; font-size: 14px; padding: 3px 10px; }
  .side-btns { top: 0; gap: 4px; }
  .sqb { width: 44px !important; height: 44px !important; font-size: 20px !important; border-radius: 14px; }
  .lab { font-size: 11px; }
  .plat { width: 150px; height: 40px; }
  .home .brandlogo, .welcome .brandlogo { --lw: min(250px, 78vw); }
  .profile { padding: 10px 12px; }
  .profile .inp { padding: 8px 12px; }
  .color-picks button { width: 30px; height: 30px; }
  .side-btns { gap: 8px; }
  .sqb { width: 50px; height: 50px; font-size: 22px; }
}
@media (max-width: 820px) {
  .mate { height: 118px; }
  .mate .fig svg { max-height: 66px; max-width: 120px; }
  .mate.empty { grid-column: 1 / -1; height: 52px; }
}
@media (max-width: 380px) {
  .themes .t3s { font-size: 12px; }
}

/* lobby su due colonne (computer) */
@media (min-width: 900px) {
  .lobbycol { max-width: 940px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; align-items: start; }
  .lobbycol > .hdr { grid-column: 1 / -1; }
  .lobbycol > #lobby-players { grid-column: 1; grid-row: 2; }
  .lobbycol > .emotes { grid-column: 1; grid-row: 3; }
  .lobbycol > #lobby-settings { grid-column: 2; grid-row: 2 / span 2; }
  .lobbycol > #lobby-hint { grid-column: 2; grid-row: 4; }
  .lobbycol > #btn-start { grid-column: 2; grid-row: 5; }
}

/* =========================================================
   PROGRESSI: profilo, negozio, classifica, sfide, ricompense
   ========================================================= */
.home-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.prof { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; text-align: left; position: relative; }
.pav { width: 52px; height: 52px; border-radius: 14px; border: 3px solid var(--ink); background: linear-gradient(180deg, #ff6bb5, #ff2d7a); box-shadow: 0 4px 0 var(--ink); display: grid; place-items: center; overflow: hidden; flex: none; }
.prof .lvl { position: absolute; left: -6px; top: 34px; width: 26px; height: 26px; background: linear-gradient(var(--b1), var(--b2)); border: 3px solid var(--ink); border-radius: 8px; transform: rotate(45deg); display: grid; place-items: center; }
.prof .lvl span { transform: rotate(-45deg); font: 400 13px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.pinfo { display: flex; flex-direction: column; gap: 3px; }
.pinfo .t3s { font-size: 18px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp { width: 124px; height: 16px; border-radius: 9px; background: rgba(20,12,60,.6); border: 3px solid var(--ink); position: relative; overflow: hidden; }
.xp i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #8cf0ff, #2ab0ff); transition: width .6s; }
.xp span { position: absolute; inset: 0; display: grid; place-items: center; font: 400 10px var(--disp); color: #fff; -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; }
.cur { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.cur .pill { padding: 2px 12px 2px 4px; font-size: 16px; }
.cur .pill b { font-weight: 400; }
.pill .ico { width: 26px; height: 26px; display: grid; place-items: center; font-size: 16px; }
.coin { display: inline-block; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(circle at 35% 30%, #fff6b0 0 18%, #ffd23d 19% 60%, #e09a00 61%); flex: none; position: relative; }
.coin::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; border: 2px solid rgba(160,90,0,.55); }
.side-btns { position: absolute; top: 10px; display: flex; flex-direction: column; gap: 12px; z-index: 2; }
.side-btns.left { left: 0; } .side-btns.right { right: 0; }
.side-btns > div { display: flex; flex-direction: column; align-items: center; }
.sqb { width: 58px; height: 58px; padding: 0; border-radius: 18px; font-size: 26px; }
.lab { font: 400 12px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; margin-top: 3px; }
.badge { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--r2); border: 3px solid var(--ink); color: #fff; font: 400 13px var(--disp); display: grid; place-items: center; padding: 0 4px; }
.sub.small { font-size: 12.5px; opacity: .85; }
/* negozio */
/* ---------- negozio ---------- */
#screen-shop { overflow: hidden; }
.shopwrap { height: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; }
.shop-hdr { flex: none; padding: calc(var(--safe-t) + 14px) 16px 0; }
/* camerino: il personaggio dentro il suo riquadro, come in sala d'attesa */
.camerino { flex: none; position: relative; height: clamp(150px, 27vh, 236px); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; padding-bottom: 8px;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,255,255,.28) 0 30%, transparent 62%); }
.camerino .mate { width: clamp(132px, 40vw, 168px); height: clamp(104px, 19vh, 176px); flex: none; }
.camerino .mate .fig { top: 8px; bottom: 34px; display: flex; align-items: flex-end; }
.camerino .mate .fig svg { max-height: 100% !important; max-width: 100% !important; width: auto !important; }
.camerino .mate .bubble { top: -30px; }
@media (max-height: 640px) and (min-height: 501px) { .camerino .mate .bubble { display: none; } }
.camerino .itnm { font: 400 18px var(--disp); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; line-height: 1.3; }
.camerino .side { position: absolute; right: max(8px, calc(25% - 60px)); top: 42%; transform: translateY(-50%); display: grid; grid-template-columns: repeat(2, auto); gap: 8px 6px; }
.camerino .side .b3 { width: 38px; height: 38px; padding: 0; border-radius: 12px; font-size: 19px; }
.camerino .side .b3 .gg { font: 400 15px var(--disp); }
/* schede */
.shop-tabs { flex: none; display: flex; gap: 5px; padding: 6px 12px 8px; }
.shop-tabs button { flex: 1; min-width: 0; border: 3px solid var(--ink); border-radius: 14px; background: #f1edff; padding: 4px 2px 3px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 3px 0 var(--ink); position: relative; }
.shop-tabs button i { font-style: normal; font-size: 21px; line-height: 1.15; }
.shop-tabs button span { font: 400 11.5px var(--disp); white-space: nowrap; max-width: 100%; overflow: hidden; }
.shop-tabs button.on { background: linear-gradient(180deg, var(--y1), var(--y2)); transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); }
.shop-tabs button.xmas { background: linear-gradient(180deg, #ff6b6b, #d4142c); color: #fff; }
.shop-tabs button.xmas span { -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; }
.shop-tabs button.xmas.on { box-shadow: 0 5px 0 var(--ink), inset 0 0 0 3px #fff; }
/* con 6 schede (Natale + Balletti) sui telefoni stretti: meno spazio tra le schede, i nomi si rimpiccioliscono (fitText) */
@media (max-width: 380px) { .shop-tabs { gap: 3px; padding-left: 8px; padding-right: 8px; } .shop-tabs button { padding-left: 1px; padding-right: 1px; } }
.shop-tabs .badge { top: -9px; right: -6px; min-width: 20px; height: 20px; font-size: 11px; overflow: visible; -webkit-text-stroke: 0; }
/* griglia */
.shop-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); align-content: start; gap: 12px 9px; padding: 10px 12px 18px; }
.shop-grid.cols3 { grid-template-columns: repeat(3, 1fr); }
.it { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); display: flex; flex-direction: column; align-items: center; padding: 4px 3px 3px; min-width: 0; cursor: pointer; }
.it .ic { height: 62px; width: 100%; display: grid; place-items: center; border-radius: 10px; background: radial-gradient(ellipse at 50% 85%, #d9ccff 0 30%, #f3efff 65%); overflow: hidden; }
.it .ic svg { max-width: 100%; }
.it .pr { display: flex; align-items: center; gap: 3px; font: 400 14px var(--disp); margin-top: 2px; height: 20px; white-space: nowrap; }
.it .pr .coin, .bundle .coin { width: 16px; height: 16px; border-width: 2px; }
.it .pr .coin::after, .bundle .coin::after { inset: 2px; border-width: 1.5px; }
.it .pr.own { color: var(--g2); }
.it.on { background: linear-gradient(180deg, var(--y1), var(--y2)); box-shadow: 0 0 0 3px #fff, 0 3px 0 3px var(--ink); z-index: 1; }
.it.on .ic { background: rgba(255,255,255,.6); }
.it .use, .it .new { position: absolute; top: -9px; font: 400 10.5px var(--disp); color: #fff; border: 2px solid var(--ink); border-radius: 7px; padding: 0 5px; white-space: nowrap; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; z-index: 2; }
.it .use { left: 50%; transform: translateX(-50%); background: var(--g2); }
.it .new { right: -6px; background: var(--r2); }
.emo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px 4px; font-size: 21px; line-height: 1.2; text-align: center; align-items: center; }
.emo .gg { font: 400 15px var(--disp); }
.shop-grid.cols3 .it .ic { height: 70px; }
.mate.minif { width: 58px; height: 52px; border-width: 2.5px; border-radius: 10px; box-shadow: 0 2px 0 var(--ink); padding: 0; }
.mate.minif .fig { bottom: 4px; }
.mate.minif .lights { transform: scale(.55); left: -14px; right: -14px; top: -7px; }
/* pacchetto (es. Natale) */
.bundle { grid-column: 1 / -1; position: relative; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); padding: 8px 10px 9px; color: #fff; cursor: pointer; margin-top: 4px;
  background: radial-gradient(circle at 12% 30%, rgba(255,255,255,.9) 0 1.5px, transparent 2.5px) 0 0/34px 30px, radial-gradient(circle at 60% 70%, rgba(255,255,255,.7) 0 1.2px, transparent 2px) 0 0/26px 24px, linear-gradient(160deg, #1f8a4c, #0c5a35 70%); display: flex; flex-direction: column; gap: 6px; }
.bundle.on { box-shadow: 0 0 0 3px #fff, 0 4px 0 3px var(--ink); }
.bundle .bh { display: flex; align-items: center; gap: 8px; }
.bundle .bt { font: 400 19px var(--disp); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 3px; margin: -2px -3px; }
.bundle .till { font: 400 12px var(--disp); background: rgba(0,0,0,.35); border: 2px solid var(--ink); border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.bundle .row { display: flex; gap: 6px; }
.bundle .row > div { flex: 1; min-width: 0; height: 54px; border-radius: 10px; background: rgba(255,255,255,.9); border: 2.5px solid var(--ink); display: grid; place-items: center; overflow: hidden; color: var(--ink); }
.bundle .row > div.frc { background: none; border: 0; overflow: visible; }
.bundle .row .emo { font-size: 14px; gap: 0 2px; }
.bundle .bp { display: flex; align-items: center; gap: 8px; justify-content: flex-end; font: 400 17px var(--disp); }
.bundle .bp s { opacity: .85; font-size: 14px; }
.bundle .bp .off { background: var(--y1); color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 0 6px; font-size: 14px; transform: rotate(-4deg); }
.bundle .bp .v { display: flex; align-items: center; gap: 4px; -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill; font-size: 20px; }
.bundle .bp .v .coin { width: 22px; height: 22px; border-width: 3px; }
.lights { position: absolute; left: 10px; right: 10px; top: -6px; height: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.lights i { width: 9px; height: 12px; border-radius: 50% 50% 45% 45%; border: 2px solid var(--ink); }
.lbl3 { grid-column: 1 / -1; font: 400 14px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; margin: 2px 2px -4px; }
/* barra in fondo: un solo pulsante */
.buybar { flex: none; padding: 10px 16px calc(var(--safe-b) + 14px); background: #2b1a8c; border-top: 3px solid var(--ink); }
.buybar .b3 { width: 100%; min-height: 58px; }
.buybar .b3 .t3 { font-size: 26px; }
.buybar .coin { width: 28px; height: 28px; }
.badge.xm { background: var(--g2); font-size: 12px; }

@media (max-height: 500px) {
  .shopwrap { max-width: none; display: grid; grid-template-columns: minmax(180px, 32%) 1fr; grid-template-rows: auto auto 1fr auto; }
  .shop-hdr { grid-column: 1 / -1; padding-top: calc(var(--safe-t) + 8px); }
  .camerino { grid-column: 1; grid-row: 2 / span 3; height: auto; justify-content: center; }
  .camerino .mate { height: min(150px, 46vh); }
  .shop-tabs, .shop-grid, .buybar { grid-column: 2; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .buybar { padding: 8px 16px calc(var(--safe-b) + 8px); }
  .buybar .b3 { min-height: 48px; }
}

/* ---------- riquadri della sala d'attesa (classe sulla .mate) ---------- */
.mate .n { position: relative; z-index: 1; }
.mate.fr-legno { background: repeating-linear-gradient(90deg, #c98a4b 0 9px, #b97a3d 9px 11px, #d39657 11px 23px, #b4743a 23px 25px); box-shadow: 0 5px 0 var(--ink), inset 0 0 0 5px #7a4a1f; }
.mate.fr-neon { background: radial-gradient(ellipse at 50% 70%, #3a1580, #120a33 75%); box-shadow: 0 5px 0 var(--ink), inset 0 0 0 3px #ff2d7a, inset 0 0 14px 4px rgba(255,45,122,.75), 0 0 14px rgba(61,214,255,.8); }
.mate.fr-neon .n { color: #3dd6ff; text-shadow: 0 0 8px #3dd6ff; }
.mate.fr-oro { background: radial-gradient(ellipse at 50% 30%, #fffbe2, #ffe9a6 80%); box-shadow: 0 5px 0 var(--ink), inset 0 0 0 4px #ffcc33, inset 0 0 0 7px #b8860b, inset 0 0 0 9px #fff1a8; }
.mate.fr-oro::before, .mate.fr-oro::after { content: '✦'; position: absolute; top: 4px; font-size: 18px; line-height: 1; color: #e0a800; -webkit-text-stroke: 1.5px var(--ink); }
.mate.fr-oro::before { left: 12px; } .mate.fr-oro::after { right: 12px; bottom: 6px; top: auto; }
.mate.fr-fiori { background: radial-gradient(circle at 15% 18%, #ff8fc2 0 6px, #ffe45c 6px 8px, transparent 9px), radial-gradient(circle at 88% 78%, #9fd8ff 0 6px, #fff 6px 8px, transparent 9px), radial-gradient(circle at 10% 82%, #c58bff 0 5px, #ffe45c 5px 7px, transparent 8px), linear-gradient(180deg, #e9ffe8, #c9f2c1); }
.mate.fr-spazio { background: radial-gradient(circle at 80% 22%, #ffb000 0 9px, #ff8a00 9px 11px, transparent 12px), radial-gradient(circle at 20% 30%, #fff 0 1.3px, transparent 2px) 0 0/28px 26px, radial-gradient(circle at 70% 60%, #fff 0 1px, transparent 1.8px) 0 0/22px 30px, linear-gradient(180deg, #0b0630, #2a1170); }
.mate.fr-neve { background: radial-gradient(ellipse 120% 30% at 50% 108%, #fff 0 60%, transparent 61%), radial-gradient(circle at 25% 20%, #fff 0 1.8px, transparent 2.6px) 0 0/30px 28px, radial-gradient(circle at 70% 65%, rgba(255,255,255,.8) 0 1.3px, transparent 2px) 0 0/24px 22px, linear-gradient(180deg, #123a7a, #2d6cc4); }
.mate.fr-legno .n, .mate.fr-spazio .n, .mate.fr-neve .n { color: #fff; -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill; }
.mate .lights { top: -8px; left: 6px; right: 6px; }
.mate .lights::before { content: ''; position: absolute; left: 0; right: 0; top: -3px; height: 8px; border-bottom: 2px solid #0c5a35; border-radius: 0 0 50% 50%; }
/* classifica */
.ranks { display: flex; flex-direction: column; gap: 8px; }
.rk { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.rk.me { background: linear-gradient(90deg, #fff3a8, #ffe066); }
.rk .pos { width: 34px; text-align: center; font: 400 20px var(--disp); }
.rk .pos.medal { font-size: 26px; }
.rk .fig { flex: none; }
.rk .nm { flex: 1; min-width: 0; font: 400 17px var(--disp); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk .nm small { display: block; font: 800 12px var(--ui); color: var(--muted); }
.rk .tr { font: 400 20px var(--disp); white-space: nowrap; }
.mine { padding: 10px 14px; display: flex; align-items: center; gap: 10px; font: 900 14px var(--ui); background: linear-gradient(90deg, #e5f7ff, #fff); }
.mine b { font: 400 26px var(--disp); }
.empty-note { text-align: center; color: #fff; font: 900 15px var(--ui); padding: 20px; }
/* sfide */
.daily-list { display: flex; flex-direction: column; gap: 12px; }
.ch { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ch .top { display: flex; align-items: center; gap: 10px; }
.ch .txt { flex: 1; font: 400 17px var(--disp); }
.ch .rew { font: 900 12px var(--ui); color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.ch .rew .coin { width: 18px; height: 18px; border-width: 2px; }
.ch .bar { height: 18px; border-radius: 10px; border: 3px solid var(--ink); background: #ece7ff; overflow: hidden; position: relative; }
.ch .bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, var(--g1), var(--g2)); }
.ch .bar span { position: absolute; inset: 0; display: grid; place-items: center; font: 400 12px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.ch .b3 { height: 46px; }
.ch.claimed { opacity: .7; }
/* figure con livello in lobby */
.mate .lv { position: absolute; right: 8px; top: 8px; font: 400 12px var(--disp); background: linear-gradient(var(--b1), var(--b2)); color: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 0 6px; -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; }
/* ricompense di fine partita */
.rewards { width: min(420px, 100%); padding: 12px; }
.rewards .rw { display: flex; gap: 8px; }
.rewards .rw > div { flex: 1; border-radius: 14px; background: #f1edff; border: 3px solid var(--ink); text-align: center; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; }
.rewards .rw b { display: block; font: 400 22px var(--disp); }
.rewards .rw small { font: 900 11px var(--ui); color: var(--muted); }
.rewards .lvrow { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.rewards .lvrow .xp { flex: 1; width: auto; height: 22px; }
.rewards .lvrow .xp span { font-size: 12px; }
.rewards .lvbadge { width: 34px; height: 34px; background: linear-gradient(var(--b1), var(--b2)); border: 3px solid var(--ink); border-radius: 9px; transform: rotate(45deg); display: grid; place-items: center; flex: none; margin: 0 4px; }
.rewards .lvbadge span { transform: rotate(-45deg); font: 400 15px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.levelup { animation: pop .5s cubic-bezier(.2,1.6,.4,1); display: inline-block; }
body.in-game .toast { top: calc(var(--safe-t) + 112px); }
@media (max-width: 820px) and (min-height: 501px) { body.in-game .toast { top: calc(var(--safe-t) + 106px); font-size: 13px; padding: 6px 12px; } }
.stage-overlay > *:not(.confetti) { position: relative; z-index: 1; }

/* partita veloce */
.b3.big.quick { min-height: 76px; }
.b3.big.quick .t3 { font-size: 40px; }
.b3.big.quick { flex-direction: column; gap: 0; }
.b3.big.quick small { position: static; transform: none; font-size: 14px; -webkit-text-stroke: 3px var(--ink); margin-top: -4px; }
.public-box { padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.public-box .big-n { font: 400 40px/1 var(--disp); min-width: 56px; text-align: center; }
.public-box .txt b { display: block; font: 400 19px var(--disp); }
.public-box .txt span { font: 800 13px var(--ui); color: var(--muted); }
.public-box .radar { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(circle, #6dff8f 0 18%, #17b851 19% 30%, #e9fff0 31%); position: relative; flex: none; }
.public-box .radar::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid #17b851; animation: ping 1.4s ease-out infinite; }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@media (min-width: 900px) { .lobbycol > #public-box { grid-column: 2; grid-row: 2; } }

/* anteprima della dimensione del pennello */
.size-dot { display: none; flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); position: relative; }
.size-dot i { position: absolute; left: 50%; top: 50%; border-radius: 50%; transform: translate(-50%, -50%); background: var(--dot, #fff); box-shadow: 0 0 0 2px var(--ink); }

/* =========================================================
   HOME PULITA · BENVENUTO · PANNELLI
   ========================================================= */
.home-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-row .b3 { min-height: 54px; padding: 6px 8px; }
.home-row .t3s { font-size: 16px; }
.welcome { gap: 12px; }
.welcome .tagline { text-align: center; margin-top: -4px; }
.showcase.small { height: 200px; }
.showcase.small .fig { bottom: 22px; }
.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20,10,70,.6); backdrop-filter: blur(3px); animation: fadein .2s; }
.modal .sheetc { position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 10px; animation: slideup .28s cubic-bezier(.2,1.3,.4,1); }
@keyframes fadein { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }
.mclose { position: absolute; top: 10px; right: 10px; z-index: 2; }
.mtitle { font: 400 24px var(--disp); margin: 0 44px 4px 0; }
.mhint { margin: -2px 0 0; font: 800 13px var(--ui); color: var(--muted); text-align: center; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font: 800 12.5px var(--ui); margin: 4px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 3px; border-radius: 3px; background: #e6e0fb; }
.prof-head { display: flex; gap: 14px; align-items: center; padding-right: 40px; }
.pm-fig { width: 84px; height: 110px; border-radius: 18px; border: 3px solid var(--ink); background: radial-gradient(ellipse at 50% 95%, #c7b3ff 0 30%, #efe9ff 62%); display: grid; place-items: end center; padding-bottom: 6px; flex: none; }
.pm-info { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pm-level { font: 400 22px var(--disp); }
.xp.big { width: 100%; height: 22px; }
.xp.big span { font-size: 12px; }
.pm-cur { display: flex; gap: 14px; font: 900 15px var(--ui); align-items: center; }
.pm-cur > span { display: flex; align-items: center; gap: 4px; }
.pm-cur .coin { width: 20px; height: 20px; border-width: 2px; }
.pm-cur b { font: 400 18px var(--disp); }
.pm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pm-stats div { border: 3px solid var(--ink); border-radius: 12px; background: #f1edff; text-align: center; padding: 5px 2px; }
.pm-stats b { display: block; font: 400 20px var(--disp); }
.pm-stats small { font: 800 11px var(--ui); color: var(--muted); }
.help { text-align: center; }
.help-slide { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 6px; min-height: 250px; }
.help-slide .ill { height: 130px; display: grid; place-items: center; font-size: 80px; filter: drop-shadow(0 4px 0 var(--ink)); }
.help-slide .ill .row { display: flex; align-items: flex-end; gap: 10px; }
.help-slide h3 { margin: 0; font: 400 26px var(--disp); }
.help-slide p { margin: 0; font: 800 15px var(--ui); color: var(--muted); max-width: 330px; }
.help-dots { display: flex; justify-content: center; gap: 8px; }
.help-dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: #e6e0fb; }
.help-dots i.on { background: var(--y2); width: 26px; border-radius: 8px; }
@media (max-width: 820px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal .sheetc { width: 100%; border-radius: 24px 24px 0 0; border-bottom: 0; box-shadow: none; padding-bottom: calc(var(--safe-b) + 18px); max-height: 92vh; }
}
@media (max-height: 740px) {
  .showcase.small { height: 150px; }
  .welcome .tagline { display: block; }
}

/* home: contenuto centrato in verticale sugli schermi alti */
.col.home, .col.welcome { min-height: 100vh; min-height: 100dvh; }
.col.home .brand { margin-top: auto; }
.col.home #home-error { margin-bottom: auto; }
.col.home #home-error:empty { display: block; visibility: hidden; padding: 0; border: 0; min-height: 0; }
.col.welcome .brandlogo { margin-top: auto; }
.col.welcome #btn-welcome { margin-bottom: auto; }

/* =========================================================
   POSE
   ========================================================= */
.posecard { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.posecard .b3.small { width: 40px; height: 32px; padding: 0; border-radius: 10px; }
.posecard .b3.small .t3s { font-size: 18px; }
.pose-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 3px 3px 7px; }
.pose-row::-webkit-scrollbar { display: none; }
.pose-row.wrap { flex-wrap: wrap; overflow: visible; }
.pose-row button { flex: none; width: 48px; height: 54px; border: 3px solid var(--ink); border-radius: 12px; background: linear-gradient(#fff, #dcd6ff); box-shadow: 0 3px 0 var(--ink); position: relative; display: grid; place-items: center; padding: 2px; }
.pose-row button svg { max-width: 40px; max-height: 44px; }
.pose-row button.on { background: linear-gradient(#fff7c2, #ffd84a); outline: 3px solid var(--ink); outline-offset: 2px; }
.pose-row button.lk { background: linear-gradient(#cfc9e6, #9a92bd); }
.pose-row button.lk::after { content: '🔒'; position: absolute; right: -7px; bottom: -7px; font-size: 13px; }
.pose-row button .lv { position: absolute; left: -6px; top: -8px; font: 400 10px var(--disp); background: #7c3dff; color: #fff; border: 2px solid var(--ink); border-radius: 6px; padding: 0 3px; line-height: 1.3; }
.muted-s { font: 800 11.5px var(--ui); color: var(--muted); }
.newpose { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 10px; border: 3px solid var(--ink); border-radius: 12px; background: linear-gradient(90deg, #fff3a8, #fff); font: 800 13px var(--ui); }
.newpose b { font: 400 15px var(--disp); }
/* le figure nei menu non devono deformarsi con le pose larghe */
.mate .fig svg, .tg .fig svg, .rk .fig svg { max-width: 100%; }
@media (max-width: 820px), (max-height: 500px) {
  .posecard { grid-area: pose; background: none; border: 0; box-shadow: none; padding: 0; flex-direction: row-reverse; align-items: center; gap: 8px; }
  .posecard .b3.small { width: 40px; height: 40px; }
  .pose-row { flex: 1; min-width: 0; padding: 4px 2px 6px; }
  .pose-row button { width: 42px; height: 46px; border-radius: 11px; }
  .pose-row button svg { max-width: 34px; max-height: 38px; }
  .hider-ui { grid-template-areas: "grab grab grab" "tools tools tools" "pose pose pose" "cur pal pal" "size size camo" "tip tip tip" "ready ready ready"; }
  .hider-ui.mini .posecard { display: none !important; }
}
@media (max-width: 820px) and (max-height: 740px) and (min-height: 501px) {
  .hider-ui:not(.mini) { grid-template-areas: "grab grab grab" "tools tools tools" "pose pose pose" "cur pal pal" "size size camo" "ready ready ready"; }
  .tipcard { display: none !important; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .hider-ui, .hider-ui.mini { grid-template-areas: "tools tools tools" "pose pose pose" "cur pal pal" "size size camo" "tip tip tip" "ready ready ready"; }
  .hider-ui.mini .posecard { display: flex !important; }
}

/* Browser di sistema vecchi (Chrome < 123): niente bordo del testo con paint-order, si usa un contorno con le ombre */
.no-po * { -webkit-text-stroke: 0 !important; }
.no-po .t3,
.no-po .t3s,
.no-po .b3.big small,
.no-po .ribbon,
.no-po .toolbar .b3 span,
.no-po .targets .lbl2,
.no-po .tg .q,
.no-po .burst .pts,
.no-po .step .nm,
.no-po .step .sc,
.no-po .dock-size .cap,
.no-po .timerbox .tb .t3,
.no-po .prof .lvl span,
.no-po .xp span,
.no-po .lab,
.no-po .ch .bar span,
.no-po .mate .lv,
.no-po .camerino .itnm,
.no-po .shop-tabs .xmas span,
.no-po .it .use,
.no-po .it .new,
.no-po .bundle .bt,
.no-po .bundle .bp .v,
.no-po .lbl3,
.no-po .mate.fr-legno .n,
.no-po .mate.fr-spazio .n,
.no-po .mate.fr-neve .n,
.no-po .rewards .lvbadge span,
.no-po .b3.big.quick small { text-shadow: 2px 0px 0 var(--ink), -2px 0px 0 var(--ink), 0px 2px 0 var(--ink), 0px -2px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 2px 1px 0 var(--ink), -2px 1px 0 var(--ink), 0 3px 0 var(--ink) !important; }
.no-po .t3, .no-po .t3 * { text-shadow: 3px 0px 0 var(--ink), -3px 0px 0 var(--ink), 0px 3px 0 var(--ink), 0px -3px 0 var(--ink), 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink), 3px 1px 0 var(--ink), -3px 1px 0 var(--ink), 0 5px 0 var(--ink) !important; }

/* ---------- zoom e pannello a scomparsa (telefono) ---------- */
@media (max-width: 820px), (max-height: 500px) {
  .zoom-ctrls { gap: 6px; }
  .grab { touch-action: none; width: 100%; height: 26px; justify-self: stretch; }
  .grab::before { left: calc(50% - 26px); right: calc(50% - 26px); top: 8px; }
  .grab-label { display: none; position: absolute; left: 50%; top: 3px; transform: translateX(-50%); font: 400 13px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; white-space: nowrap; }
  .hider-ui.closed .grab::before { display: none; }
  .hider-ui.closed .grab-label { display: block; }
  .hider-ui.closed { grid-template-areas: "grab grab grab" "ready ready camo"; padding-top: 2px; }
  .hider-ui.closed > :not(.grab):not(.dock):not(.side-r) { display: none !important; }
  .hider-ui.closed .curc, .hider-ui.closed .dock-pal, .hider-ui.closed .dock-size, .hider-ui.closed .tipcard,
  .hider-ui.closed .posecard, .hider-ui.closed .toolbar { display: none !important; }
  .hider-ui.closed .readyb { height: 46px; }
  .hider-ui { transition: padding .15s; }
}
/* cliccabilità */
.curc i { pointer-events: none; }
#screen-game.ph-final .zoom-ctrls, #screen-game.ph-pass .zoom-ctrls, #screen-game.ph-loading .zoom-ctrls { display: none; }
@media (max-width: 820px), (max-height: 500px) {
  .grab { height: 34px; }
  .grab::before { top: 12px; }
  .grab-label { top: 7px; }
  /* la riga delle pose scorre: una sfumatura indica che ce ne sono altre */
  .pose-row { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .palette button { width: 32px !important; height: 32px !important; }
  #screen-game.ph-reveal .zoom-ctrls, #screen-game.ph-preview .zoom-ctrls { right: auto; left: 6px; }
}

/* ---------- fine turno: scheda risultati riducibile ---------- */
.resultcard { position: relative; padding-top: 30px; }
.rc-grab { position: absolute; left: 0; right: 0; top: 0; height: 30px; border: 0; background: none; touch-action: none; cursor: pointer; }
.rc-grab span { font: 400 12px var(--disp); color: var(--muted); letter-spacing: .03em; }
.rc-grab::before { content: ''; position: absolute; left: calc(50% - 24px); top: 5px; width: 48px; height: 5px; border-radius: 9px; background: #d8d0f3; }
.rc-grab span { position: relative; top: 6px; }
.resultcard.min { padding-bottom: 6px; }
.resultcard.min .rc-body > :not(h3) { display: none; }
.resultcard.min .rc-body h3 { margin: 0; font-size: 16px; }
.stage-overlay.sheet .resultcard.min { max-height: none; }

/* ---------- cartoline di fine partita ---------- */
.recap-head .ribbon { padding: 6px 30px; }
.recap-head .t3s { font-size: 20px; }
.postcard { width: min(460px, 100%); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, var(--pc1), var(--pc2)); animation: slideup .35s cubic-bezier(.2,1.3,.4,1); }
.pc-title { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pc-title .e { font-size: 34px; filter: drop-shadow(0 3px 0 var(--ink)); }
.pc-title .t3s { font-size: 24px; }
.pc-shot { border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; background: #140a46; box-shadow: 0 4px 0 var(--ink); }
.pc-shot canvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; }
.pc-text { margin: 0; background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 12px; color: var(--ink) !important; text-shadow: none !important; font: 800 15px/1.35 var(--ui) !important; text-align: center; max-width: none !important; }
.pc-text b { font: 400 17px var(--disp); }
@media (max-height: 740px) {
  .pc-title .t3s { font-size: 19px; }
  .pc-text { font-size: 13px !important; }
  .postcard { gap: 8px; padding: 10px; }
}

/* ---------- scritte: mai a capo nei pulsanti, contorni mai tagliati ---------- */
/* il testo dei pulsanti resta su una riga: se non entra, client.js (fitText) riduce il corpo */
.b3 .t3, .b3 .t3s, .b3 > span, .pill, .pill *, .lv, .pose-row button .lv, .ribbon, .badge, .tag, .chip { white-space: nowrap; }
.b3 { min-width: 0; max-width: 100%; }
/* gli elementi con i puntini di sospensione tagliano anche il bordo delle lettere: un po' di spazio interno lo salva */
.hdr .title, .pinfo .t3s, .rk .nm, .mate .n, .step .nm, .rrow .nm {
  padding: 3px 5px; margin: -3px -5px;
}
.rrow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .nm small { overflow: hidden; text-overflow: ellipsis; }
/* titoli delle schermate sopra al gioco: possono andare a capo, ma in modo bilanciato e senza sbordare */
.stage-overlay h2.t3 { font-size: clamp(26px, 8.5vw, 40px); line-height: 1.08; text-wrap: balance; overflow-wrap: anywhere; max-width: 100%; }
.stage-overlay p { text-wrap: pretty; }
.stage-overlay .pass-lead { font: 400 20px var(--disp); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; margin-bottom: -6px; }
.stage-overlay h2.pass-name { font-size: clamp(34px, 12vw, 56px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 4px 8px; max-width: 100%; color: var(--y1); }
.no-po .stage-overlay .pass-lead { text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 0 3px 0 var(--ink) !important; }
.step > * { flex: none; }
/* contenuto più alto dello schermo (telefono in orizzontale): centrato ma scorrevole, senza tagliare la parte alta */
.stage-overlay:not(.sheet) { justify-content: center; justify-content: safe center; }

/* logo sui telefoni piccoli e in orizzontale */
@media (max-height: 600px) { .home .brandlogo, .welcome .brandlogo { --lw: min(210px, 70vw); } }
@media (max-height: 700px) and (min-height: 501px) {
  .welcome .brandlogo { --lw: min(190px, 64vw); }
  .showcase.small { height: 120px; }
  .showcase.small .fig svg { max-height: 96px; }
}
@media (max-height: 500px) and (orientation: landscape) { .home .brandlogo, .welcome .brandlogo { --lw: 180px; } }

/* ---------- splash all'apertura dell'app ---------- */
#splash {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh;
  padding: calc(var(--safe-t, 0px) + 16px) 16px 16px;
  /* se client.js non parte, la splash sparisce comunque da sola */
  animation: splash-gone .4s 9s forwards;
}
#splash.out { animation: splash-out .45s ease-in forwards; pointer-events: none; }
.splash-logo {
  width: min(560px, 88vw); max-height: 62vh; object-fit: contain; flex: none;
  filter: drop-shadow(0 8px 0 rgba(20,10,70,.35));
  animation: splash-pop .7s cubic-bezier(.2,1.6,.4,1) both, splash-float 3s 0.7s ease-in-out infinite;
}
.splash-load { display: flex; align-items: center; gap: 12px; flex: none; animation: splash-fade .4s .5s both; }
.splash-load .t3s { color: #fff; font-family: var(--disp); font-size: 20px; white-space: nowrap; }
.drops { display: flex; gap: 7px; }
.drops i { width: 17px; height: 17px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2.5px solid var(--ink); animation: drop 1s ease-in-out infinite; }
.drops i:nth-child(1) { background: #ff3fa4; }
.drops i:nth-child(2) { background: #2fb3ff; animation-delay: .15s; }
.drops i:nth-child(3) { background: #ffd21a; animation-delay: .3s; }
@keyframes drop { 0%, 60%, 100% { transform: translateY(0) rotate(-45deg); } 30% { transform: translateY(-9px) rotate(-45deg); } }
@keyframes splash-pop { 0% { transform: scale(.4) rotate(-8deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes splash-float { 50% { transform: translateY(-8px) rotate(-1deg); } }
@keyframes splash-fade { from { opacity: 0; transform: translateY(8px); } }
@keyframes splash-out { to { opacity: 0; transform: scale(1.08); visibility: hidden; } }
@keyframes splash-gone { to { opacity: 0; visibility: hidden; } }
@media (max-height: 500px) and (orientation: landscape) {
  #splash { gap: 2vh; }
  .splash-logo { max-height: 72vh; }
  .splash-load .t3s { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-logo, .drops i { animation: none; }
}

/* =========================================================
   TELEFONO IN VERTICALE · interfaccia compatta (design/v3-verticale)
   La foto deve vedersi il più possibile: testata senza la riga degli omini,
   barra strumenti di 2 righe sempre aperta, PRONTO e mimetismo in alto,
   dimensione con slider verticale sotto lo zoom, fine turno a striscia.
   ========================================================= */
.posebtn, .vsize, .rc-mini, .rc-credit { display: none; }
@media (max-width: 820px) and (min-height: 501px) {
  /* testata: timer grande al centro come prima, senza la riga degli omini */
  #screen-game .players-strip { display: none; }
  .stage, #screen-game.is-hiding .stage, #screen-game.has-side .stage { top: calc(var(--safe-t) + 74px); }

  /* PRONTO in alto a destra, mimetismo sotto il turno */
  #panel-hider .readyb { position: fixed; top: calc(var(--safe-t) + 8px); right: 8px; width: auto; min-width: 0; max-width: calc(50vw - 58px); height: 42px; padding: 0 12px; border-radius: 14px; z-index: 31; }
  #panel-hider .readyb .t3 { font-size: 19px; -webkit-text-stroke-width: 4px; }
  #panel-hider .camo { position: fixed; top: calc(var(--safe-t) + 37px); left: 8px; z-index: 31; display: flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 11px; box-shadow: 0 2px 0 var(--ink); }
  #panel-hider .camo::before { content: '🦎'; font-size: 13px; }
  #panel-hider .camo .row { display: contents; }
  #panel-hider .camo .cap, #panel-hider .camo .stars, #panel-hider .camo .ql { display: none; }
  #panel-hider .camo .val { font-size: 15px; line-height: 1.2; }
  #panel-hider .camo .meter { width: 34px; height: 8px; margin: 0; border-width: 2px; }

  /* barra strumenti: 2 righe, sempre aperta (niente tendina) */
  #panel-hider, #panel-hider.mini, #panel-hider.closed, #panel-hider:not(.mini) {
    grid-template-areas: "tools tools tools" "cur pal pal"; gap: 8px; padding-top: 9px;
  }
  #panel-hider .grab, #panel-hider .dock-size, #panel-hider .tipcard { display: none !important; }
  #panel-hider .curc, #panel-hider .dock-pal, #panel-hider .toolbar { display: flex !important; }
  #panel-hider .curc { display: block !important; }
  #panel-hider .dock-pal { display: block !important; }
  #panel-hider .toolbar .b3 { height: 46px; }
  #panel-hider .posebtn { display: inline-flex; }
  .posebtn .pose-ico svg { display: block; max-width: 28px; max-height: 30px; }

  /* pose: riquadro sopra la barra, aperto dal pulsante con l'omino */
  #panel-hider .posecard { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 8px); display: none !important; flex-direction: column; align-items: stretch; gap: 4px;
    background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 8px 4px; box-shadow: 0 4px 0 var(--ink); z-index: 5; }
  #panel-hider.pose-open .posecard { display: flex !important; }
  #panel-hider.pose-open .posebtn { outline: 3px solid #fff; outline-offset: 2px; }

  /* dimensione della punta: slider verticale sotto i pulsanti dello zoom */
  #screen-game.is-hiding .vsize { display: flex; }
  .vsize { flex-direction: column; align-items: center; gap: 6px; margin-top: 2px; touch-action: none; padding-bottom: 4px; }
  .vs-dot { width: 34px; height: 34px; border-radius: 11px; background: #fff; border: 2.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink); display: grid; place-items: center; }
  .vs-dot i { display: block; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
  .vs-track { position: relative; width: 14px; height: 128px; border-radius: 8px; background: linear-gradient(180deg, #fff, #c9c1f0); border: 2.5px solid var(--ink); }
  .vs-knob { position: absolute; left: 50%; width: 30px; height: 20px; transform: translate(-50%, -50%); border-radius: 9px; background: linear-gradient(180deg, var(--p1), var(--p2)); border: 2.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }

  /* ricerca: con tanti avversari i bersagli diventano icone senza nome */
  .targets.many .tg { min-width: 0; height: 54px; }
  .targets.many .tg .n { display: none; }
  .targets.many .tg .fig { top: 14px; }
  .targets.many .tg .q { font-size: 18px; top: 0; }
  .targets.many .tg .stamp { font-size: 0; top: 2px; padding: 0 3px; transform: translateX(-50%); }
  .targets.many .tg .stamp::after { content: '✓'; font-size: 13px; }

  /* fine turno: striscia dei punti in alto, foto intera senza niente sopra, pulsanti in basso */
  #screen-game.ph-reveal .stage, #screen-game.ph-preview .stage { top: calc(var(--safe-t) + 132px); bottom: calc(var(--safe-b) + 88px); }
  #screen-game.ph-reveal .caption { display: none; }
  .stage-overlay.sheet { padding: calc(var(--safe-t) + 76px) 8px calc(var(--safe-b) + 10px); gap: 8px; }
  .stage-overlay.sheet .resultcard { width: 100%; margin-bottom: auto; padding: 0; max-height: calc(100% - 110px); overflow-y: auto; }
  .stage-overlay.sheet .resultcard.min { max-height: none; overflow: hidden; }
  .resultcard .rc-grab { height: 44px; z-index: 2; }
  .resultcard .rc-grab span, .resultcard .rc-grab::before { display: none; }
  .resultcard .rc-mini { display: flex; align-items: center; gap: 6px; padding: 6px 8px; min-height: 42px; }
  .rc-mini .cup { font-size: 16px; }
  .rc-mini .who-list { flex: 1; min-width: 0; display: flex; gap: 8px; overflow: hidden; }
  .rc-mini .who { display: flex; align-items: center; gap: 3px; font: 400 15px var(--disp); white-space: nowrap; }
  .rc-mini .who .av { width: 24px; height: 24px; border-radius: 7px; border: 2.5px solid var(--ink); display: grid; place-items: center; overflow: hidden; }
  .rc-mini .more { font: 900 12px var(--ui); color: #7c3dff; white-space: nowrap; }
  .resultcard .rc-body { padding: 0 8px 8px; }
  .resultcard.min .rc-body { display: none; }
  .resultcard .rc-credit { display: block; margin: 8px 0 0; font: 800 11px var(--ui); color: var(--muted); }
  .resultcard .rc-credit b { font: 400 12px var(--disp); }
  .stage-overlay.sheet .next-bar, .stage-overlay.sheet .ov-actions { flex: none; }
  .resultcard .rc-credit { text-shadow: none !important; max-width: none; }
  /* pulsante della posa: la regola dei telefoni nasconde gli span nei pulsanti degli strumenti */
  .toolbar .b3 .pose-ico { display: block; }
  /* avvisi appena sotto la testata; a fine turno sotto la striscia dei punti */
  body.in-game .toast { top: calc(var(--safe-t) + 82px); }
  body.in-game:has(#screen-game.ph-reveal) .toast { top: calc(var(--safe-t) + 136px); }
  /* colori della scena: tutti visibili, senza scorrere */
  #panel-hider .palette { overflow: visible; padding: 3px 2px 5px; gap: 6px; }
  #panel-hider .palette button { flex: 1 1 0; width: auto; min-width: 0; max-width: 44px; height: 34px; }
  /* strumento attivo: contorno sottile e uguale per tutti (anche la posa), senza ingrandire il pulsante */
  #panel-hider .toolbar .tool.active, #panel-hider.pose-open .posebtn { outline: 3px solid #fff; outline-offset: 1px; transform: none; }
}
@media (max-width: 359px) and (min-height: 501px) {
  #panel-hider .readyb { height: 38px; padding: 0 9px; }
  #panel-hider .readyb .t3 { font-size: 15px; -webkit-text-stroke-width: 3px; }
  #panel-hider .camo .meter { display: none; }
}

/* lente del contagocce: si trascina il dito sulla scena, al rilascio si prende il colore */
.pick-lens { position: absolute; z-index: 6; width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--ink); box-shadow: 0 0 0 5px var(--pc, #fff), 0 0 0 8px var(--ink); overflow: hidden; pointer-events: none; }
.pick-lens.hidden { display: none; }
.pick-lens canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.pick-lens i { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; transform: translate(-50%, -50%); border: 2px solid #fff; border-radius: 3px; box-shadow: 0 0 0 1.5px var(--ink); }

/* ===================== SFIDE TRA AMICI ===================== */
/* il pallino non deve sporgere in larghezza: fitText rimpicciolirebbe la scritta */
.home-row .b3 .badge { top: -12px; right: 6px; }
.sf-lists { display: flex; flex-direction: column; gap: 10px; }
.sf-lbl { font: 400 15px var(--disp); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; margin: 6px 2px -2px; }
.sf-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.sf-row .av, .sf-fr .av { flex: none; width: 46px; height: 46px; border-radius: 14px; border: 3px solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.sf-row .tx { flex: 1; min-width: 0; }
.sf-row .nm { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sf-row .nm .n { font: 400 17px var(--disp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sf-row .sc, .sf-fr .sc { flex: none; font: 400 13px var(--disp); background: #f1edff; border: 2.5px solid var(--ink); border-radius: 9px; padding: 0 6px; white-space: nowrap; }
.sf-row .st { font: 800 12.5px var(--ui); color: #6b6290; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sf-row .st b { color: var(--ink); }
.sf-row .st .sc { font: 400 12px var(--disp); color: var(--ink); padding: 0 5px; margin-right: 5px; border-width: 2px; border-radius: 7px; }
.sf-row .b3 { flex: none; padding: 6px 12px; border-radius: 14px; max-width: 46%; }
.sf-row .b3 .t3s { font-size: 16px; white-space: nowrap; }
.sf-row.new { background: linear-gradient(180deg, #fff, #fff6c2); }
.sf-row.done { background: #f6f3ff; }
.sf-code { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.sf-code .tx { flex: 1; font: 800 12.5px var(--ui); color: #6b6290; }
.sf-code .tx b { display: block; font: 400 20px var(--disp); color: var(--ink); letter-spacing: .06em; }
.sf-code .b3 .t3s { font-size: 15px; white-space: nowrap; }
.empty-note { text-align: center; color: #e7dcff; font: 800 14px var(--ui); padding: 10px; }

/* manda la sfida: lista che scorre, pulsante MANDA sempre in fondo */
#screen-send.active { display: flex; flex-direction: column; overflow: hidden; }
.sf-send { flex: 1; min-height: 0; width: 100%; max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; padding: calc(var(--safe-t) + 18px) 16px 0; }
.sf-search { position: relative; flex: none; }
.sf-search .inp { padding-left: 42px; }
.sf-search::before { content: '🔍'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 18px; pointer-events: none; }
.sf-pick { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 12px; }
.sf-fr { flex: none; display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; text-align: left; color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.sf-fr .av { width: 38px; height: 38px; border-radius: 11px; border-width: 2.5px; }
.sf-fr .av.link { background: #e6e0fb; font-size: 20px; }
.sf-fr .nm { flex: 1; min-width: 0; font: 400 17px var(--disp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-fr .nm .hl { background: var(--y1); border-radius: 4px; }
.sf-fr .sc { background: transparent; border: 0; padding: 0; font: 800 12.5px var(--ui); color: #4b4370; }
.sf-fr .rd { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; display: grid; place-items: center; font: 900 14px var(--ui); }
.sf-fr.on { background: linear-gradient(180deg, var(--y1), var(--y2)); }
.sf-fr.on .rd { background: var(--g2); color: #fff; }
.sf-sendbar { flex: none; padding: 10px 16px calc(var(--safe-b) + 14px); background: #2b1a8c; border-top: 3px solid var(--ink); }
.sf-sendbar .b3 { display: flex; max-width: 460px; margin: 0 auto; }

/* pagina di chi apre la sfida */
#screen-chlink.active { display: flex; flex-direction: column; overflow: hidden; }
.sf-land { flex: 1; min-height: 0; width: 100%; max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 12px) 16px calc(var(--safe-b) + 16px); }
.sf-land .hdr { width: 100%; flex: none; }
.sf-land .brandlogo { --lw: min(170px, 44vw); margin: 0 auto; transform: translateX(-23px); }
.sf-who { display: flex; align-items: flex-end; gap: 10px; width: 100%; flex: none; }
.sf-who .av { flex: none; width: 56px; height: 56px; border-radius: 16px; border: 3px solid var(--ink); display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink); overflow: hidden; }
.sf-who .bubble { position: relative; white-space: normal; font-size: 17px; line-height: 1.2; padding: 6px 12px; flex: 1; }
.sf-who .bubble::after { left: -9px; bottom: 14px; transform: rotate(135deg); }
.sf-photo { flex: 1 1 0; min-height: 0; max-width: 100%; aspect-ratio: 2 / 3; border: 3px solid var(--ink); border-radius: 12px; background: #2b1a8c center/cover no-repeat; display: grid; place-items: center; overflow: hidden; position: relative; box-shadow: 0 4px 0 var(--ink); }
.sf-photo::before { content: ''; position: absolute; inset: -20px; background: inherit; filter: blur(10px) saturate(1.2); }
.sf-photo .q { position: relative; font: 400 64px var(--disp); color: #fff; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; filter: drop-shadow(0 4px 0 var(--ink)); }
.sf-rules { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; flex: none; }
.sf-rules .pill { font-size: 14px; padding: 3px 10px; }
.sf-land > .b3.big { flex: none; }
.sf-note { margin: 0; font: 800 12.5px var(--ui); color: #e7dcff; text-align: center; flex: none; }
.sf-note:empty { display: none; }

/* risultato della sfida (sopra la scena) */
.stage-overlay.sf-ov { justify-content: space-between; background: none; }
.sf-res { width: min(520px, 100%); padding: 8px 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); flex: none; }
.sf-res .big { font: 400 28px/1.1 var(--disp); color: #fff; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.sf-res .big.g { color: var(--g1); }
.sf-res .line { font: 800 13px var(--ui); color: #4b4370; }
.sf-res .line b { color: var(--ink); }
.sf-res .line .bit { white-space: nowrap; }
.sf-res .line .coin { width: 14px; height: 14px; vertical-align: -2px; }
.sf-res .score { display: flex; align-items: center; gap: 6px; font: 400 17px var(--disp); max-width: 100%; }
.sf-res .score .av { flex: none; width: 28px; height: 28px; border-radius: 9px; border: 2.5px solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.sf-res .score .n { background: var(--ink); color: #fff; border-radius: 10px; padding: 0 9px; white-space: nowrap; }
.sf-res .score .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sf-name { width: min(520px, 100%); display: flex; gap: 8px; padding: 8px; flex: none; margin-top: auto; }
.sf-name .b3 { flex: none; padding: 6px 16px; }
.sf-resbar { flex-direction: column; gap: 8px; flex: none; }
.sf-resrow { display: flex; gap: 8px; width: 100%; }
.sf-resrow .b3.sq { flex: none; width: 52px; height: 52px; }
.sf-resrow .b3 { height: 52px; }
.sf-resrow .b3 .t3s { font-size: 18px; white-space: nowrap; }
.ov-actions .b3.sf-again { flex: none; width: 100%; height: 62px; flex-direction: column; gap: 0; }
.ov-actions .b3.sf-again .t3 { font-size: 26px; }
.ov-actions .b3.sf-again small { position: static; transform: none; font: 400 13px var(--disp); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; margin-top: -3px; }
#btn-chexit { flex: none; }
@media (max-height: 500px) and (orientation: landscape) {
  .stage-overlay.sf-ov { justify-content: flex-start; }
  .stage-overlay.sf-ov .sf-res, .stage-overlay.sf-ov .sf-name, .stage-overlay.sf-ov .sf-resbar { width: min(420px, 55vw); }
  .stage-overlay.sf-ov .sf-resbar { margin-top: auto; }
}

/* fine turno: pulsante per togliere contorni ed etichette e guardare il mimetismo */
.deco-btn { display: none !important; }
#screen-game.ph-reveal .deco-btn, #screen-game.ph-preview .deco-btn { display: inline-flex !important; }
.deco-btn svg.i { width: 20px; height: 20px; stroke: var(--ink); filter: none; stroke-width: 2.2; }
.deco-btn .slash { display: none; stroke: #ff2d55; stroke-width: 2.8; stroke-dasharray: none; }
.deco-btn.off { --c1: var(--y1); --c2: var(--y2); }
.deco-btn.off .slash { display: inline; }

/* ===================== PROFILO SALVATO (account) — mockup in design/profilo/ ===================== */
.col.start, .col.register { min-height: 100vh; min-height: 100dvh; gap: 10px; padding-top: calc(var(--safe-t) + 14px); padding-bottom: calc(var(--safe-b) + 14px); }
.col.start .brandlogo { margin: 0; display: flex; justify-content: center; flex: none; }
.col.start .brandlogo img { height: clamp(64px, 12vh, 104px); width: auto; }
.wstage { flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: center; gap: 4px; position: relative; }
.wstage .plat { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 210px; height: 34px; border-radius: 50%; background: radial-gradient(ellipse, #8f6bff 0 55%, #5a33e0 56% 70%, transparent 71%); }
.wstage .f { position: relative; z-index: 1; margin-bottom: 14px; }
.wstage .f.s { margin-bottom: 18px; }
.wstage svg { display: block; }
.perks { flex: none; padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.perks h3 { margin: 0; font: 400 18px var(--disp); }
.perk-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.perk-list li { display: flex; align-items: center; gap: 6px; background: #f3f0ff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 4px 7px; font: 900 13px/1.1 var(--ui); min-width: 0; }
.perk-list li i { font-style: normal; font-size: 20px; flex: none; }
.perk-list li.gift { background: linear-gradient(180deg, var(--y1), var(--y2)); grid-column: 1 / -1; justify-content: center; }
.modal .perks { padding: 0; }
.acc-btns { display: flex; flex-direction: column; gap: 10px; flex: none; }
.acc-btn { flex-direction: row !important; gap: 10px !important; justify-content: center; }
.acc-btn .gl { width: 24px; height: 24px; flex: none; background: #fff; border-radius: 50%; display: grid; place-items: center; }
.acc-btn .gl svg { width: 19px; height: 19px; display: block; }
.acc-btn .em { font-size: 21px; line-height: 1; }
.acc-keep { margin: -2px 0 0; text-align: center; font: 900 13px var(--ui); color: var(--muted); }
.acc-keep b { color: var(--ink); }
.acc-keep:empty { display: none; }
.col.start .divider { color: #d9ceff; margin: 0; flex: none; }
.col.start .divider::before, .col.start .divider::after { background: rgba(255,255,255,.25); }
.col.start .guest { flex: none; }
.sv-big { text-align: center; font-size: 54px; line-height: 1; margin: 2px 0 -2px; }
.mtitle.center { margin: 0; text-align: center; }
.mhint.left { text-align: left; }
.sv-mail { text-align: center; font: 900 16px var(--ui); background: #f3f0ff; border: 3px solid var(--ink); border-radius: 12px; padding: 6px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-link { align-self: center; border: 0; background: none; font: 900 14px var(--ui); color: var(--b2); text-decoration: underline; padding: 4px; cursor: pointer; }
#em-step1, #em-step2 { display: flex; flex-direction: column; gap: 10px; }
#em-step1.hidden, #em-step2.hidden { display: none; }
#em-code { letter-spacing: .25em; }
/* crea il profilo */
.hdr2 { flex: none; display: flex; align-items: center; gap: 10px; }
.hdr2 .t3 { font-size: 26px; }
.regfig { flex: 1; min-height: 0; display: flex; }
.reg { flex: none; padding: 10px 12px 12px; display: flex; flex-direction: column; }
.reg .lbl { margin: 8px 0 5px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.reg .lbl:first-child { margin-top: 0; }
.reg .st { font: 900 13px var(--ui); white-space: nowrap; }
.reg .st.ok { color: var(--g2); } .reg .st.no { color: #e0213f; }
.reg .inp.ok { border-color: var(--g2); box-shadow: 0 0 0 2px var(--g1); }
.reg .inp.no { border-color: #e0213f; box-shadow: 0 0 0 2px #ffb3c0; }
.reg .sugg { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.reg .sugg:empty { display: none; }
.reg .sugg button { border: 2.5px solid var(--ink); border-radius: 10px; background: #fff; font: 400 14px var(--disp); padding: 2px 8px; box-shadow: 0 2px 0 var(--ink); color: var(--ink); }
.reg .color-picks { gap: 6px; }
.inp.sel { width: 50%; padding: 9px 10px; font-size: 16px; appearance: none; -webkit-appearance: none; background: #f3f0ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0h10L5 6z' fill='%236b6290'/%3E%3C/svg%3E") right 10px center / 11px no-repeat; }
.inp.sel.ph { color: #9b93c2; }
.check { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; font: 800 13.5px/1.3 var(--ui); cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .bx { width: 26px; height: 26px; flex: none; border: 3px solid var(--ink); border-radius: 8px; background: #fff; display: grid; place-items: center; font: 400 17px var(--disp); color: #fff; }
.check input:checked + .bx { background: var(--g2); }
.check input:checked + .bx::after { content: '✓'; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.check input:focus-visible + .bx { outline: 3px solid var(--b2); outline-offset: 2px; }
.check a { color: var(--b2); font-weight: 900; }
#btn-register { flex: none; }
.b3.off { filter: grayscale(.85) brightness(1.05); opacity: .7; }
.col.welcome { position: relative; }
.back-start { position: absolute; top: calc(var(--safe-t) + 14px); left: 16px; z-index: 2; }
/* riga in cima al profilo: ospite / salvato */
.sv-row { display: flex; align-items: center; gap: 8px; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 6px 6px 10px; margin-top: 4px; }
.sv-row.hidden { display: none; }
.sv-row.warn { background: #fff2c7; }
.sv-row.ok { background: #dcf7e6; }
.sv-row .tx { flex: 1; min-width: 0; font: 400 16px var(--disp); line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-row .tx small { display: block; font: 800 12.5px var(--ui); color: #6b6290; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-row .b3 { flex: none; }
.sv-row .b3 .t3s { font-size: 16px; }
/* quale profilo tieni? */
.sv-pick { display: flex; flex-direction: column; gap: 8px; }
.sv-keep { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 10px; text-align: left; color: var(--ink); width: 100%; cursor: pointer; }
.sv-keep .av { width: 46px; height: 46px; flex: none; border-radius: 13px; border: 3px solid var(--ink); display: grid; place-items: end center; overflow: hidden; }
.sv-keep .tx { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sv-keep .where { font: 800 12.5px var(--ui); color: #6b6290; }
.sv-keep .nm { font: 400 18px var(--disp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-keep .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.sv-keep .chips span { display: inline-flex; align-items: center; gap: 3px; font: 900 12.5px var(--ui); background: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.sv-keep .coin { width: 13px; height: 13px; border-width: 2px; }
.sv-keep .coin::after { inset: 1.5px; border-width: 1px; }
.sv-keep.on { background: linear-gradient(180deg, var(--y1), var(--y2)); box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.sv-keep.on .where { color: var(--ink); }
@media (max-height: 640px) {
  #start-stage { display: none; }
  .regfig { display: none; }
  .col.register .reg { margin-top: auto; }
  .perk-list li { font-size: 12px; }
  .perk-list li i { font-size: 17px; }
}
