/* La Ruota della Fortuna — stile pulito e moderno, pensato per il display della Tesla (landscape) */
:root {
  --bg0: #060a20; --bg1: #0f1745; --bg2: #1a2565;
  --ink: #eef1ff; --muted: #9aa6d6; --line: rgba(255, 255, 255, .12);
  --glass: rgba(255, 255, 255, .06);
  --blue: #4f86ff; --violet: #7a5cff; --gold: #ffc83d; --gold2: #ff9d00;
  --green: #27c9a8; --red: #ff4d5e; --pink: #ff5d9e;
  --radius: 18px;
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg0); }
html, body { margin: 0; height: 100%; color: var(--ink); font-family: var(--font); overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
input { user-select: text; -webkit-user-select: text; }
#setup-msg { color: var(--muted); }
#bg { position: fixed; inset: 0; z-index: -2; background:
  radial-gradient(900px 600px at 15% 10%, rgba(79, 134, 255, .35), transparent 60%),
  radial-gradient(800px 600px at 90% 90%, rgba(255, 93, 158, .22), transparent 60%),
  radial-gradient(700px 500px at 80% 5%, rgba(122, 92, 255, .28), transparent 60%),
  linear-gradient(160deg, var(--bg0), var(--bg1) 60%, #0b1030); }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
button { font-family: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }

/* ---------- schermate ---------- */
.screen { display: none; position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left)); animation: fadeIn .35s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.center-col { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.topbar h2 { margin: 0; font-size: 28px; font-weight: 800; }
.spacer { flex: 1; }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.card { padding: 22px; }
.card h3 { margin: 0 0 14px; font-size: 20px; font-weight: 800; }
.card h4 { margin: 18px 0 8px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.panel-wrap { max-width: 1280px; margin: 0 auto; }
.panel-wrap.narrow { max-width: 760px; display: grid; gap: 18px; }
.section-title { margin: 26px 0 12px; font-size: 20px; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; line-height: 1.4; }
.msg { min-height: 20px; margin: 10px 0 0; color: #ff8a96; font-size: 15px; }
.msg.ok { color: #6ee7b7; }
.row { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ---------- pulsanti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 12px 20px; font-size: 17px; font-weight: 600; text-decoration: none; color: var(--ink); transition: transform .12s, background .2s, box-shadow .2s; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .15); }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .38; }
.btn.primary { background: linear-gradient(135deg, var(--blue), var(--violet)); border-color: rgba(255, 255, 255, .3); box-shadow: 0 6px 24px rgba(79, 134, 255, .45); font-weight: 800; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #6a9bff, #8f74ff); }
.btn.danger { background: rgba(255, 77, 94, .18); border-color: rgba(255, 77, 94, .5); }
.btn.ghost { background: transparent; }
.btn.big { padding: 16px 28px; font-size: 20px; border-radius: 16px; }
.btn.huge { padding: 24px 28px; font-size: 26px; font-weight: 800; border-radius: 20px; justify-content: flex-start; }
.btn.huge b { font-size: 30px; width: 44px; text-align: center; }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.icon-btn { width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .08); font-size: 22px; display: inline-grid; place-items: center; transition: transform .12s, background .2s; }
.icon-btn:active { transform: scale(.92); }
.icon-btn:hover { background: rgba(255, 255, 255, .16); }

.seg { display: inline-flex; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 11px 18px; border-radius: 10px; font-size: 16px; font-weight: 600; color: var(--muted); }
.seg button.on { background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; box-shadow: 0 4px 14px rgba(79, 134, 255, .4); }
.seg.wrap button { background: rgba(255, 255, 255, .07); color: var(--ink); font-size: 14px; padding: 9px 13px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.stepper button { width: 52px; height: 48px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1); font-size: 26px; font-weight: 700; }
.stepper b { min-width: 86px; text-align: center; font-size: 22px; }
input[type=text], input[type=email], input[type=password], textarea, select { width: 100%; padding: 14px 16px; font: inherit; font-size: 18px; color: var(--ink); background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 12px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79, 134, 255, .3); }
input[type=range] { accent-color: var(--gold); width: 260px; height: 36px; }

/* ---------- logo ---------- */
.logo { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; justify-content: center; }
.logo h1 { margin: 0; font-size: 34px; line-height: 1; font-weight: 900; letter-spacing: -.01em; }
.logo h1 span { background: linear-gradient(90deg, var(--gold), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo.big h1 { font-size: 64px; }
.logo-wheel { width: 64px; height: 64px; border-radius: 50%; flex: none; border: 4px solid #1a2142; background: conic-gradient(#ff5d73 0 12.5%, #ffb020 0 25%, #27c9a8 0 37.5%, #4f86ff 0 50%, #a06bff 0 62.5%, #ff7ac6 0 75%, #3ed16a 0 87.5%, #ff8a3d 0); box-shadow: 0 0 0 3px rgba(255, 200, 61, .8), 0 8px 24px rgba(0, 0, 0, .5); position: relative; }
.logo-wheel::after { content: ''; position: absolute; inset: 40%; border-radius: 50%; background: #1a2142; border: 2px solid var(--gold); }
.logo.big .logo-wheel { width: 110px; height: 110px; }
.spin-slow { animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- accesso ---------- */
#s-auth { display: none; }
#s-auth.active { display: grid; place-items: center; }
.auth-card { width: min(520px, 100%); padding: 32px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: rgba(0, 0, 0, .3); border-radius: 14px; padding: 5px; margin-bottom: 20px; }
.tab { border: 0; background: transparent; padding: 13px; border-radius: 10px; font-size: 18px; font-weight: 700; color: var(--muted); }
.tab.active { background: rgba(255, 255, 255, .14); color: #fff; }
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 7px; font-size: 14px; font-weight: 600; color: var(--muted); }

/* ---------- menu ---------- */
.userchip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: 15px; }
.userchip .av { width: 34px; height: 34px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); border-radius: 50%; }
.userchip em { font-style: normal; font-size: 11px; font-weight: 800; background: var(--gold); color: #3a2400; padding: 3px 8px; border-radius: 6px; }
.menu-wrap { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 26px; padding-top: 2vh; }
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; width: 100%; }
.menu-grid .btn:first-child { grid-column: 1 / -1; font-size: 34px; padding: 30px; justify-content: center; }

/* ---------- nuova partita ---------- */
.setup-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
.chooser { display: grid; gap: 10px; }
.pchip { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 2px solid transparent; font-size: 19px; font-weight: 700; text-align: left; transition: .15s; }
.pchip .av { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--pc) 35%, transparent); font-size: 22px; }
.pchip.on { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 22%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--pc) 45%, transparent); }
.btn.huge.start { margin: 24px auto 0; display: flex; width: min(560px, 100%); justify-content: center; font-size: 30px; }
.sub { margin-top: 6px; }

/* ---------- giocatori ---------- */
.players-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 20px; }
.pcard-l { display: grid; gap: 10px; justify-items: center; text-align: center; border-color: color-mix(in srgb, var(--pc) 70%, transparent); box-shadow: 0 0 28px color-mix(in srgb, var(--pc) 25%, transparent); }
.pcard-l b { font-size: 22px; }
.av.big { width: 76px; height: 76px; font-size: 40px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--pc) 30%, transparent); }
.add-card { display: grid; place-items: center; gap: 4px; border-style: dashed; color: var(--muted); font-size: 18px; min-height: 190px; }
.add-card span { font-size: 54px; line-height: 1; }
.editor { max-width: 640px; margin: 0 auto; display: grid; gap: 14px; }
.swatches, .avatars { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.sw { width: 46px; height: 46px; border-radius: 50%; border: 3px solid transparent; }
.sw.on { border-color: #fff; box-shadow: 0 0 16px rgba(255, 255, 255, .5); }
.avb { width: 52px; height: 52px; border-radius: 14px; border: 2px solid transparent; background: rgba(255, 255, 255, .08); font-size: 26px; }
.avb.on { border-color: var(--gold); background: rgba(255, 200, 61, .2); }

/* ---------- statistiche ---------- */
.stats-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 18px; }
.scard { border-color: color-mix(in srgb, var(--pc) 60%, transparent); }
.sc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.sc-head b { font-size: 26px; flex: 1; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(closest-side, #12194a 74%, transparent 76%), conic-gradient(var(--pc) calc(var(--p) * 1%), rgba(255, 255, 255, .12) 0); }
.ring span { font-size: 22px; font-weight: 800; line-height: 1; }
.ring small { font-size: 10px; color: var(--muted); }
.sc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cell { background: rgba(0, 0, 0, .22); border-radius: 12px; padding: 10px 14px; display: grid; }
.cell b { font-size: 22px; }
.cell span { font-size: 13px; color: var(--muted); }
.history { overflow-x: auto; padding: 8px 14px; }
.history table { width: 100%; border-collapse: collapse; font-size: 16px; }
.history th { text-align: left; color: var(--muted); font-weight: 600; font-size: 13px; padding: 10px 8px; }
.history td { padding: 10px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.history td.w { color: var(--gold); }

/* ---------- impostazioni ---------- */
.settings { display: grid; gap: 4px; }
.row-set { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.row-set:last-child { border-bottom: 0; }
.row-set label { font-size: 18px; font-weight: 600; }
.settings input[type=password] { margin-bottom: 10px; }

/* ====================================================================== */
/*  PARTITA                                                               */
/* ====================================================================== */
.screen.game { padding: 0; overflow: hidden; }
.screen.game.active { display: grid; grid-template-columns: minmax(0, 17.5%) minmax(0, 1fr) minmax(0, 17.5%); grid-template-rows: auto minmax(0, 1fr) auto; }
.g-top { grid-column: 1 / 4; display: grid; grid-template-columns: minmax(0, 24%) minmax(0, 1fr) minmax(0, 24%); gap: 12px; padding: 10px 14px 0; align-items: stretch; }
.pcard { --pc: #5b8cff; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 30%, #0d1340), #0d1340); border: 2px solid color-mix(in srgb, var(--pc) 55%, transparent); transition: .3s; position: relative; min-width: 0; }
.pcard.right { flex-direction: row; justify-content: flex-end; text-align: right; }
.pcard .av { width: 54px; height: 54px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 28px; background: color-mix(in srgb, var(--pc) 40%, transparent); }
.pcard .pinfo { display: grid; min-width: 0; flex: 1; }
.pcard.right .pinfo { text-align: right; }
.pcard .nm { font-weight: 800; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard small { color: var(--muted); font-size: 11px; letter-spacing: .12em; font-weight: 600; }
.money { font-size: clamp(22px, 2.6vw, 44px); font-weight: 900; font-variant-numeric: tabular-nums; color: var(--gold); text-shadow: 0 0 18px rgba(255, 200, 61, .45); white-space: nowrap; }
.pcard.turn, .rcard.turn { border-color: var(--pc); box-shadow: 0 0 0 2px var(--pc), 0 0 34px color-mix(in srgb, var(--pc) 70%, transparent); transform: translateY(2px) scale(1.02); }
.pcard.turn::after { content: 'TOCCA A TE'; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 900; letter-spacing: .14em; background: var(--pc); color: #fff; padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
body.pc-turn .pcard.turn::after { content: 'TURNO DEL PC'; }

.g-center { display: grid; gap: 6px; min-width: 0; }
.topic { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 18px; border-radius: 18px; background: linear-gradient(135deg, rgba(79, 134, 255, .35), rgba(122, 92, 255, .35)); border: 1px solid rgba(255, 255, 255, .25); box-shadow: 0 0 30px rgba(79, 134, 255, .3); text-align: center; }
.topic small { font-size: 11px; letter-spacing: .3em; color: #cfd8ff; font-weight: 700; }
.topic strong { font-size: clamp(22px, 3vw, 46px); font-weight: 900; line-height: 1.05; background: linear-gradient(90deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; text-transform: uppercase; letter-spacing: .02em; }
.g-meta { display: flex; align-items: center; gap: 10px; justify-content: center; }
.chip { padding: 6px 14px; border-radius: 99px; background: rgba(255, 255, 255, .1); font-size: 14px; font-weight: 700; white-space: nowrap; }
.chip.type.express { background: linear-gradient(90deg, #ff9d00, #ff5d73); }
.chip.type.triplete { background: linear-gradient(90deg, #a06bff, #ff5d9e); }
.timer { position: relative; flex: 1; max-width: 260px; height: 30px; border-radius: 99px; background: rgba(0, 0, 0, .4); border: 1px solid var(--line); overflow: hidden; }
.timer.off { visibility: hidden; }
.timer i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width .1s linear; }
.timer b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.timer.low i { background: linear-gradient(90deg, #ff4d5e, #ff9d00); }
.timer.low b { animation: blink .5s infinite alternate; }
@keyframes blink { to { transform: scale(1.25); } }
.g-ctl { display: flex; gap: 8px; }
.g-ctl .icon-btn { width: 44px; height: 38px; border-radius: 12px; font-size: 18px; }

/* lettere ai lati */
.keys { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(6, 1fr); gap: clamp(6px, 1vh, 12px); padding: 12px clamp(6px, 1vw, 14px); min-height: 0; }
.keys.left { grid-column: 1; grid-row: 2; }
.keys.right { grid-column: 3; grid-row: 2; }
.key { position: relative; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .18); background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05)); font-size: clamp(24px, 4.4vh, 52px); font-weight: 900; display: grid; place-items: center; transition: transform .12s, opacity .2s, box-shadow .2s, border-color .2s; min-height: 0; padding: 0; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.key .lt { line-height: 1; }
.key.vowel { border-color: rgba(255, 200, 61, .55); background: linear-gradient(160deg, rgba(255, 200, 61, .26), rgba(255, 157, 0, .08)); }
.key .cost { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: clamp(9px, 1.4vh, 13px); font-weight: 700; color: var(--gold); letter-spacing: .02em; }
.key.dim { opacity: .5; }
.key.active { opacity: 1; border-color: #fff; box-shadow: 0 0 22px rgba(255, 255, 255, .55), 0 4px 0 rgba(0, 0, 0, .3); animation: keyPulse 1s ease-in-out infinite alternate; }
.key.active:active, .key.pressed { transform: scale(.88); background: #fff; color: #10206b; }
@keyframes keyPulse { to { box-shadow: 0 0 34px rgba(255, 255, 255, .8), 0 4px 0 rgba(0, 0, 0, .3); } }
.key .x { position: absolute; inset: 0; display: none; place-items: center; font-style: normal; font-size: clamp(40px, 7vh, 84px); color: var(--red); font-weight: 900; text-shadow: 0 0 12px rgba(255, 77, 94, .8), 0 2px 0 #3a0008; }
.key.miss { pointer-events: none; border-color: rgba(255, 77, 94, .7); background: rgba(255, 77, 94, .08); box-shadow: none; animation: none; }
.key.miss .x { display: grid; animation: xIn .35s cubic-bezier(.2, 1.6, .4, 1); }
.key.miss .lt { opacity: .3; }
.key.miss .cost { display: none; }
@keyframes xIn { from { transform: scale(3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.key.hit { pointer-events: none; animation: keyHit .7s ease forwards; }
@keyframes keyHit {
  0% { transform: scale(1); } 30% { transform: scale(1.3); background: #fff; color: #10206b; box-shadow: 0 0 40px #fff; }
  99% { opacity: 0; transform: scale(.2) rotate(40deg); visibility: visible; } 100% { opacity: 0; transform: scale(.2); visibility: hidden; }
}
body.pc-turn .key { pointer-events: none; }

/* centro: tabellone + ruota */
.g-mid { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 8px 0 0; }
.board { --th: 90px; flex: 0 0 51%; display: grid; grid-template-columns: repeat(14, 1fr); grid-template-rows: repeat(4, 1fr); gap: calc(var(--th) * .06); padding: calc(var(--th) * .12); border-radius: 22px; background: linear-gradient(160deg, rgba(0, 0, 0, .45), rgba(0, 0, 40, .45)); border: 2px solid rgba(255, 255, 255, .15); box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 10px 40px rgba(0, 0, 0, .4); min-height: 0; }
.tile { position: relative; display: grid; place-items: center; border-radius: calc(var(--th) * .1); min-width: 0; min-height: 0; transform-style: preserve-3d; perspective: 700px; }
.tile .ch { font-size: calc(var(--th) * .6); font-weight: 900; line-height: 1; color: #0c1650; opacity: 0; }
.tile.void { background: rgba(255, 255, 255, .02); border: 1px solid rgba(255, 255, 255, .04); }
.tile.letter, .tile.fixed { opacity: 0; }
.tile.letter { background: #1f3bc4; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14), inset 0 -10px 18px rgba(0, 0, 40, .45), 0 4px 10px rgba(0, 0, 0, .4); }
.tile.letter::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(160deg, rgba(255, 255, 255, .28), transparent 45%); pointer-events: none; }
.tile.fixed { background: transparent; }
.tile.fixed .ch { color: #fff; opacity: 1; }
.tile.letter.in, .tile.fixed.in { opacity: 1; animation: tileIn .55s var(--d, 0ms) cubic-bezier(.2, 1.2, .3, 1) backwards; }
@keyframes tileIn { from { opacity: 0; transform: translateY(-60%) scale(.3) rotateX(80deg); } to { opacity: 1; transform: none; } }
.tile.letter.lit { animation: lit .45s ease-in-out infinite alternate; }
@keyframes lit { to { background: #5b7bff; box-shadow: 0 0 26px 6px rgba(255, 220, 120, .85); transform: scale(1.08); } }
.tile.letter.on { background: #f4f7ff; box-shadow: inset 0 -8px 14px rgba(120, 140, 220, .35), 0 0 16px rgba(255, 214, 102, .35), 0 4px 10px rgba(0, 0, 0, .4); }
.tile.letter.on .ch { opacity: 1; }
.tile.letter.flip { animation: tileFlip .95s cubic-bezier(.2, .8, .2, 1) both; }
.tile.letter.flip .ch { animation: chIn .95s ease both; }
.tile.letter.flip::after { content: ''; position: absolute; inset: -30%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 244, 190, .95), transparent); animation: shine .95s ease-out both; pointer-events: none; }
.tile.letter.late { box-shadow: inset 0 -8px 14px rgba(120, 140, 220, .35), 0 4px 10px rgba(0, 0, 0, .4); }
@keyframes tileFlip {
  0% { transform: rotateX(90deg) scale(.6); background: #3b63ff; }
  35% { transform: rotateX(-16deg) scale(1.3); background: #fffbe0; box-shadow: 0 0 46px 16px rgba(255, 214, 102, .95); }
  65% { transform: rotateX(6deg) scale(1.08); }
  100% { transform: none; background: #f4f7ff; }
}
@keyframes chIn { 0%, 30% { opacity: 0; transform: scale(.3); } 60% { opacity: 1; transform: scale(1.25); } 100% { opacity: 1; transform: none; } }
@keyframes shine { 0% { opacity: 0; transform: scale(.2); } 35% { opacity: 1; } 100% { opacity: 0; transform: scale(1.8); } }

.wheel-wrap { flex: 1; position: relative; min-height: 0; margin-top: 6px; -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
.wheel-wrap canvas { position: absolute; left: 0; top: 0; }

/* parte bassa */
.g-bot { grid-column: 1 / 4; display: grid; grid-template-columns: minmax(0, 24%) minmax(0, 1fr) minmax(0, 24%); gap: 12px; padding: 4px 14px 12px; align-items: stretch; }
.rcard { --pc: #5b8cff; position: relative; display: grid; align-content: center; justify-items: center; padding: 8px 14px; border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 22%, #0d1340), #0d1340); border: 2px solid color-mix(in srgb, var(--pc) 50%, transparent); transition: .3s; min-width: 0; }
.rcard small { font-size: 11px; letter-spacing: .14em; color: var(--muted); font-weight: 600; }
.rcard .money { color: #fff; text-shadow: 0 0 14px color-mix(in srgb, var(--pc) 80%, transparent); font-size: clamp(24px, 3vw, 48px); }
.rcard .jolly { position: absolute; top: -10px; right: 10px; background: linear-gradient(90deg, #ffd23f, #ff9d00); color: #5a3300; font-weight: 900; font-size: 12px; padding: 3px 10px; border-radius: 99px; box-shadow: 0 0 14px rgba(255, 210, 63, .8); animation: pulseS 1.2s infinite alternate; }
@keyframes pulseS { to { transform: scale(1.12); } }
.float { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); font-size: clamp(22px, 2.6vw, 40px); font-weight: 900; pointer-events: none; animation: floatUp 1.6s ease-out forwards; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); white-space: nowrap; z-index: 20; }
.float.pos { color: #6bffb8; } .float.neg { color: #ff7b8a; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -10px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -90px); } }
.g-actions { display: grid; gap: 8px; align-content: center; justify-items: center; min-width: 0; }
.status { min-height: 26px; font-size: clamp(15px, 1.7vw, 22px); color: #dfe5ff; text-align: center; line-height: 1.2; }
.btns { display: flex; gap: 12px; width: 100%; justify-content: center; }
.act { flex: 1; max-width: 340px; padding: 14px 10px; font-size: clamp(16px, 1.9vw, 26px); font-weight: 900; letter-spacing: .02em; border-radius: 16px; flex-direction: column; gap: 0; line-height: 1.1; }
.act small { font-size: 12px; font-weight: 700; color: var(--gold); }
#b-spin { flex: 1.5; background: linear-gradient(135deg, #ffc83d, #ff8a00); color: #3b2200; border-color: rgba(255, 255, 255, .5); box-shadow: 0 6px 26px rgba(255, 157, 0, .5); }
#b-spin.pulse { animation: spinPulse 1.1s ease-in-out infinite alternate; }
@keyframes spinPulse { to { transform: scale(1.05); box-shadow: 0 8px 40px rgba(255, 157, 0, .85); } }

/* ---------- sovrimpressioni ---------- */
#ovl { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.ov { position: fixed; inset: 0; display: none; place-items: center; background: rgba(4, 7, 24, .74); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); pointer-events: auto; z-index: 60; padding: 16px; }
.ov.show { display: grid; animation: ovIn .3s ease; }
.ov.through { background: transparent; backdrop-filter: none; pointer-events: none; }
@keyframes ovIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(620px, 100%); padding: 30px; display: grid; gap: 18px; text-align: center; max-height: 94vh; overflow: auto; animation: popIn .4s cubic-bezier(.2, 1.3, .4, 1); background: rgba(14, 20, 70, .9); }
.modal.small { width: min(480px, 100%); }
.modal.wide { width: min(860px, 100%); }
.modal h2 { margin: 0; font-size: 34px; font-weight: 900; }
.modal p { margin: 0; font-size: 18px; color: #cfd6ff; line-height: 1.4; }
.modal-btns { display: grid; gap: 12px; }
.modal-btns.row { display: flex; justify-content: center; }
.modal .row-set { justify-content: center; border: 0; padding: 4px; }
@keyframes popIn { from { opacity: 0; transform: scale(.8) translateY(20px); } to { opacity: 1; transform: none; } }
.rules-text { text-align: left; display: grid; gap: 10px; font-size: 17px; line-height: 1.45; color: #d8defa; }
.rules-text p { font-size: inherit; }
.scroll { overflow: auto; }

#ov-banner { background: radial-gradient(circle at 50% 50%, rgba(79, 134, 255, .35), rgba(4, 7, 24, .92) 70%); }
.banner { text-align: center; display: grid; gap: 8px; animation: bannerIn .9s cubic-bezier(.2, 1.1, .3, 1); }
.b-round { font-size: clamp(20px, 3vw, 38px); font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: #cfd8ff; }
.b-type { font-size: clamp(18px, 2.4vw, 30px); font-weight: 900; color: var(--gold); letter-spacing: .08em; min-height: 1.2em; }
.b-label { font-size: clamp(14px, 1.8vw, 22px); letter-spacing: .6em; color: var(--pink); font-weight: 800; margin-top: 10px; }
.b-topic { font-size: clamp(48px, 9vw, 150px); font-weight: 900; line-height: 1; text-transform: uppercase; background: linear-gradient(90deg, #fff, var(--gold), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 10px 40px rgba(255, 157, 0, .45)); }
@keyframes bannerIn { 0% { opacity: 0; transform: scale(.4) rotateX(60deg); filter: blur(12px); } 100% { opacity: 1; transform: none; filter: none; } }

.spinres { display: grid; gap: 4px; text-align: center; padding: 22px 60px; border-radius: 30px; background: rgba(8, 12, 45, .86); border: 3px solid var(--gold); box-shadow: 0 0 80px rgba(255, 200, 61, .6); animation: resPop .55s cubic-bezier(.2, 1.5, .4, 1); }
.spinres b { font-size: clamp(54px, 9vw, 130px); font-weight: 900; line-height: 1; color: var(--gold); text-shadow: 0 0 40px rgba(255, 200, 61, .8); font-variant-numeric: tabular-nums; }
.spinres small { font-size: clamp(16px, 2vw, 26px); color: #e6ebff; font-weight: 600; }
.spinres.bankrupt { border-color: var(--red); box-shadow: 0 0 90px rgba(255, 77, 94, .7); animation: resPop .5s cubic-bezier(.2, 1.5, .4, 1), shakeX .6s .3s; }
.spinres.bankrupt b { color: #ff5d6c; text-shadow: 0 0 40px rgba(255, 77, 94, .9); }
.spinres.pass { border-color: #b7c2f0; box-shadow: 0 0 60px rgba(183, 194, 240, .5); }
.spinres.pass b { color: #e1e7ff; text-shadow: none; }
.spinres.jolly b { background: linear-gradient(90deg, #fff6c8, #ffc83d, #ff9d00); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes resPop { from { transform: scale(.2) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shakeX { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-18px); } 40% { transform: translateX(16px); } 60% { transform: translateX(-10px); } 80% { transform: translateX(8px); } }
body.shake .g-mid { animation: shakeX .45s; }
body.flash-red #bg::after { content: ''; position: fixed; inset: 0; background: radial-gradient(circle, transparent 20%, rgba(255, 0, 40, .55)); animation: flashR 1.5s ease-out forwards; }
@keyframes flashR { from { opacity: 1; } to { opacity: 0; } }
body.paused .tile, body.paused .key { animation-play-state: paused !important; }

.scoreline { display: flex; gap: 14px; justify-content: center; }
.sc { --pc: #5b8cff; flex: 1; display: grid; gap: 4px; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 2px solid color-mix(in srgb, var(--pc) 50%, transparent); }
.sc span { font-weight: 700; font-size: 18px; }
.sc b { font-size: 30px; color: var(--gold); }
.sc.win { border-color: var(--gold); box-shadow: 0 0 30px rgba(255, 200, 61, .45); background: rgba(255, 200, 61, .1); }
.scoreline.big .sc b { font-size: 44px; }
.phrase { font-size: 24px !important; font-weight: 800; color: #fff !important; text-transform: uppercase; letter-spacing: .04em; }
.trophy { font-size: 90px; line-height: 1; animation: trophy 1.2s ease-in-out infinite alternate; }
@keyframes trophy { to { transform: translateY(-10px) rotate(6deg) scale(1.08); } }
.end-stats { display: grid; gap: 6px; }
.row-st { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; padding: 8px 14px; background: rgba(255, 255, 255, .05); border-radius: 10px; font-size: 18px; }
.row-st span { color: var(--muted); font-size: 15px; }
#solve-input { font-size: 26px; text-transform: uppercase; text-align: center; letter-spacing: .06em; }

#toast { position: fixed; left: 50%; bottom: 20%; transform: translate(-50%, 20px); background: rgba(10, 15, 50, .96); border: 1px solid var(--gold); color: #fff; padding: 14px 26px; border-radius: 99px; font-size: 20px; font-weight: 700; opacity: 0; pointer-events: none; transition: .3s; z-index: 80; max-width: 90vw; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- adattamenti ---------- */
@media (max-width: 1100px) {
  .setup-grid { grid-template-columns: 1fr; }
  .stats-cards { grid-template-columns: 1fr; }
  .logo.big h1 { font-size: 44px; }
}
@media (max-height: 760px) {
  .pcard .av { width: 40px; height: 40px; font-size: 20px; }
  .pcard .nm { font-size: 16px; }
  .topic small { display: none; }
  .btn.huge { padding: 16px 22px; font-size: 22px; }
}
@media (orientation: portrait) {
  body[data-screen="game"]::before { content: '↻ Ruota il dispositivo in orizzontale per giocare'; position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; text-align: center; padding: 30px; background: #060a20; font-size: 26px; font-weight: 700; }
}
@media (prefers-reduced-motion: reduce) {
  .spin-slow, .key.active, #b-spin.pulse { animation: none; }
}

/* ---------- amministrazione ---------- */
.adm-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.adm-tabs button { border: 1px solid var(--line); background: var(--glass); padding: 12px 22px; border-radius: 12px; font-size: 17px; font-weight: 700; color: var(--muted); position: relative; }
.adm-tabs button.on { background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; }
.adm-tabs .badge { position: absolute; top: -8px; right: -8px; background: var(--red); color: #fff; font-size: 12px; min-width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; padding: 0 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px; }
.kpi b { display: block; font-size: 34px; color: var(--gold); }
.kpi span { color: var(--muted); font-size: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 16px; }
.tbl th { text-align: left; color: var(--muted); font-size: 13px; padding: 10px 8px; font-weight: 600; }
.tbl td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.tag.pending { background: rgba(255, 200, 61, .2); color: var(--gold); }
.tag.approved { background: rgba(39, 201, 168, .2); color: var(--green); }
.tag.blocked { background: rgba(255, 77, 94, .2); color: #ff8a96; }
.tag.admin { background: var(--gold); color: #3a2400; }
.adm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.adm-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.adm-row > * { flex: 1; min-width: 160px; }
.adm-row .btn { flex: none; }
textarea { min-height: 140px; resize: vertical; font-size: 16px; font-family: ui-monospace, Menlo, monospace; }
.pz-text { font-weight: 700; letter-spacing: .03em; }
.off-row td { opacity: .45; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }
.cat-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pills span { background: rgba(255, 255, 255, .08); padding: 6px 12px; border-radius: 99px; font-size: 14px; }
.cat-pills b { color: var(--gold); margin-left: 6px; }
.report { background: rgba(0, 0, 0, .3); border-radius: 12px; padding: 12px 16px; margin-top: 12px; font-size: 15px; line-height: 1.5; }
@media (max-width: 980px) { .adm-grid { grid-template-columns: 1fr; } }
