:root {
  --gold: #d9a94a;
  --gold-hi: #f6d88a;
  --gold-lo: #8c6420;
  --red: #b3121b;
  --red-hi: #d42430;
  --black: #0c0c0e;
  --green: #0c6b2e;
  --panel: rgba(14, 14, 17, 0.86);
  --line: rgba(217, 169, 74, 0.28);
  --text: #f1ede4;
  --muted: #b9b2a3;
  --num: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --ui: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050506; overflow: hidden; }
body { font-family: var(--ui); color: var(--text); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* Tela fissa 1536×1024, scalata via JS per stare nello schermo. */
.stage { position: absolute; width: 1536px; height: 1024px; transform-origin: 0 0; overflow: hidden; user-select: none; }
.bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 45% at 50% 30%, rgba(90, 20, 20, 0.35), transparent 70%),
    radial-gradient(30% 35% at 8% 55%, rgba(200, 20, 30, 0.35), transparent 70%),
    radial-gradient(30% 35% at 92% 55%, rgba(200, 20, 30, 0.30), transparent 70%),
    radial-gradient(80% 30% at 50% 100%, rgba(120, 10, 15, 0.45), transparent 75%),
    linear-gradient(#0b0a0c, #140c0d 55%, #0a0708);
}

/* ---------- Barra superiore ---------- */
.topbar { position: absolute; left: 0; right: 0; top: 0; height: 88px; display: flex; align-items: center; padding: 0 18px 0 36px;
  background: linear-gradient(rgba(0,0,0,.75), rgba(0,0,0,.35)); border-bottom: 1px solid rgba(217,169,74,.12); }
.brand { display: flex; align-items: center; gap: 12px; }
.spade { width: 60px; height: 60px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.brand-pg { font: 700 54px/1 var(--num); letter-spacing: 1px; background: linear-gradient(#ffe29a, #d9a94a 55%, #8c6420); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-name { font: 600 46px/1 var(--ui); letter-spacing: -.5px; }
.brand-sep { width: 1px; height: 34px; background: var(--line); margin: 0 8px; }
.brand-skin { font: 500 26px/1 var(--ui); letter-spacing: 6px; color: var(--gold); }

.round-status { margin: 0 auto; width: 330px; text-align: center; }
.status-line { display: flex; justify-content: center; gap: 12px; font: 600 17px/1.2 var(--ui); letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold-hi); }
.status-line .timer { font: 700 22px/1 var(--num); color: #fff; min-width: 54px; }
.progress { height: 5px; margin-top: 8px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transition: width .25s linear; }
.round-status.closing .progress i { background: linear-gradient(90deg, #7a1016, var(--red-hi)); }

.tools { display: flex; gap: 14px; margin-right: 110px; }
.icon-btn { width: 58px; height: 58px; border-radius: 10px; border: 1px solid rgba(255,255,255,.08); background: rgba(30,30,34,.8); display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--line); }
.icon-btn svg { width: 30px; height: 30px; fill: none; stroke: #cfc8b8; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#btnSound .mute { display: none; }
#btnSound.muted .mute { display: inline; }
#btnSound.muted .wave { display: none; }

.live { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 22px; border-radius: 10px; border: 1px solid rgba(255,255,255,.08); background: rgba(20,20,24,.85); font: 600 20px/1 var(--ui); color: #3fdc6f; }
.live .dot { width: 14px; height: 14px; border-radius: 50%; background: #2fd462; box-shadow: 0 0 10px #2fd462; }
.live.offline { color: #e0a33a; }
.live.offline .dot { background: #e0a33a; box-shadow: 0 0 10px #e0a33a; }
.live .clock { margin-left: 28px; color: var(--text); font-weight: 500; }

.settings-menu { position: absolute; top: 92px; right: 250px; z-index: 30; width: 300px; padding: 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.6); }
.settings-menu h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: 2px; color: var(--muted); }
.settings-menu button { display: block; width: 100%; margin-bottom: 8px; padding: 11px 12px; text-align: left; border-radius: 8px; border: 1px solid rgba(255,255,255,.08); background: rgba(40,40,46,.8); }
.settings-menu button.active { border-color: var(--gold); color: var(--gold-hi); }
.settings-menu .link-demo { display: block; margin-bottom: 8px; padding: 11px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.08); background: rgba(40,40,46,.8); color: inherit; text-decoration: none; }
.settings-menu .link-demo:hover { border-color: var(--gold); color: var(--gold-hi); }
.settings-menu .player { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Pannelli ---------- */
.panel { background: var(--panel); border: 1px solid rgba(255,255,255,.07); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.info-panels { position: absolute; left: 18px; top: 103px; width: 240px; display: grid; gap: 10px; }
.info-panels .panel { height: 82px; padding: 14px 20px; }
.info-panels small { display: block; font-size: 16px; letter-spacing: .5px; color: var(--muted); }
.info-panels strong { display: block; margin-top: 6px; font: 500 25px/1.1 var(--ui); }

.side-right { position: absolute; right: 18px; top: 95px; width: 338px; display: grid; gap: 10px; }
.side-right h3 { display: flex; align-items: center; gap: 10px; margin: 0; font: 500 19px/1 var(--ui); letter-spacing: .5px; }
.side-right h3 svg { width: 24px; height: 24px; fill: none; stroke: var(--gold); stroke-width: 2.4; }
.last-numbers { padding: 18px 18px 16px; }
.balls { display: flex; gap: 4px; margin-top: 16px; min-height: 38px; }
.ball { width: 37px; height: 37px; border-radius: 50%; display: grid; place-items: center; font: 600 20px/1 var(--num); border: 1px solid rgba(255,255,255,.15); }
.ball.red { background: radial-gradient(circle at 35% 30%, #e5323c, #9b0f17); }
.ball.black { background: radial-gradient(circle at 35% 30%, #3a3a3e, #0b0b0d); }
.ball.green { background: radial-gradient(circle at 35% 30%, #22a14d, #0a5a24); }
.ball.new { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 14px rgba(246,216,138,.6); }
.stats { padding: 18px 0 18px; }
.stats h3 { padding: 0 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); padding-top: 16px; }
.stat-grid > div { padding: 0 16px; border-left: 1px solid rgba(255,255,255,.07); }
.stat-grid > div:first-child { border-left: 0; }
.stat-grid small { font-size: 15px; color: var(--muted); }
.stat-grid strong { display: block; margin: 10px 0 14px; font: 500 22px/1 var(--ui); }
.bar { display: block; height: 12px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 6px; transition: width .6s; }
.bar.red i { background: var(--red-hi); }
.bar.black i { background: #6b6b70; }
.bar.green i { background: #22b455; }

/* ---------- Ruota ---------- */
.wheel-wrap { position: absolute; left: 398px; top: -85px; width: 740px; height: 740px; perspective: 1600px; pointer-events: none; }
.wheel-tilt { width: 100%; height: 100%; transform: rotateX(56deg); }
.wheel-tilt svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 30px 40px rgba(0,0,0,.7)); }
.result-badge { position: absolute; left: 708px; top: 222px; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; z-index: 5;
  font: 700 64px/1 var(--num); border: 4px solid var(--gold-hi); box-shadow: 0 0 40px rgba(246,216,138,.55), inset 0 -8px 20px rgba(0,0,0,.35); animation: pop .5s ease-out; }
.result-badge.red { background: radial-gradient(circle at 35% 30%, #e5323c, #8e0c14); }
.result-badge.black { background: radial-gradient(circle at 35% 30%, #3a3a3e, #09090a); }
.result-badge.green { background: radial-gradient(circle at 35% 30%, #22a14d, #084d1f); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Tavolo ---------- */
.board-wrap { position: absolute; left: 150px; top: 506px; width: 1236px; height: 340px; perspective: 1400px; }
.board-wrap::before { content: ''; position: absolute; inset: -34px -150px -26px; border-radius: 60px 60px 30px 30px;
  background: linear-gradient(#18161a, #0e0d10); border: 2px solid rgba(217,169,74,.55); transform: rotateX(22deg); transform-origin: 50% 100%;
  box-shadow: 0 -8px 60px rgba(0,0,0,.6), inset 0 2px 30px rgba(0,0,0,.8); }
.board { position: relative; width: 1236px; height: 330px; transform: rotateX(22deg); transform-origin: 50% 100%; }
.cell { position: absolute; display: grid; place-items: center; border: 1px solid rgba(217,169,74,.55); font: 600 36px/1 var(--num); color: #fff; }
.cell.red { background: linear-gradient(#bf1620, #9c0f17); }
.cell.black { background: linear-gradient(#141416, #0a0a0b); }
.cell.green { background: linear-gradient(#0f7a35, #0a5a26); font-size: 48px; font-style: italic; }
.cell.outside { background: rgba(10,10,12,.92); font: 500 30px/1 var(--num); letter-spacing: .5px; }
.cell.col2to1 { color: var(--gold-hi); }
.cell .diamond { width: 96px; height: 40px; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.cell .diamond.red { background: var(--red-hi); }
.cell .diamond.black { background: #050505; outline: 0; box-shadow: inset 0 0 0 2px #444; }
.cell.hl { filter: brightness(1.35); box-shadow: inset 0 0 0 3px var(--gold-hi); z-index: 1; }
.cell.win { animation: win 1s ease-in-out infinite alternate; z-index: 2; }
@keyframes win { from { box-shadow: inset 0 0 0 3px var(--gold-hi), 0 0 10px var(--gold-hi); } to { box-shadow: inset 0 0 0 5px #fff, 0 0 34px var(--gold-hi); filter: brightness(1.5); } }
.zone { position: absolute; cursor: pointer; }
.zone.line { z-index: 4; border-radius: 6px; }
.zone.line:hover { background: rgba(246,216,138,.38); }
.board.locked .zone { cursor: not-allowed; }

/* Fiches sul tavolo */
.bchip { position: absolute; z-index: 6; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; pointer-events: none;
  display: grid; place-items: center; font: 700 15px/1 var(--num); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7);
  box-shadow: 0 3px 6px rgba(0,0,0,.6); animation: drop .18s ease-out; }
.bchip::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.75); }
.bchip.pending { opacity: .82; }
.bchip.placed { box-shadow: 0 0 0 2px var(--gold-hi), 0 3px 8px rgba(0,0,0,.7); }
@keyframes drop { from { transform: translateY(-14px) scale(1.3); opacity: 0; } to { transform: none; opacity: 1; } }

/* Colori delle fiches (condivisi con la barra) */
.c1 { background: radial-gradient(circle, #f4f4f4 45%, #bdbdbd 46%); color: #222 !important; text-shadow: none !important; }
.c5 { background: radial-gradient(circle, #d8242e 45%, #9c0f17 46%); }
.c10 { background: radial-gradient(circle, #1f5fc9 45%, #123b85 46%); }
.c50 { background: radial-gradient(circle, #1f9a45 45%, #0f5e29 46%); }
.c100 { background: radial-gradient(circle, #2a2a2e 45%, #0b0b0c 46%); }
.c500 { background: radial-gradient(circle, #7a2fd0 45%, #4b1a86 46%); }
.c1k { background: radial-gradient(circle, #f1c24e 45%, #a8761d 46%); color: #3a2604 !important; text-shadow: none !important; }

/* ---------- Barra inferiore ---------- */
.bottombar { position: absolute; left: 38px; right: 40px; top: 888px; height: 94px; display: flex; align-items: center; gap: 24px; }
.ctl { width: 142px; height: 94px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); background: rgba(22,22,26,.9); display: grid; place-items: center; align-content: center; gap: 8px; font-size: 16px; letter-spacing: .5px; }
.ctl svg { width: 34px; height: 34px; fill: none; stroke: #d6cfbf; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ctl:hover:not(:disabled) { border-color: var(--line); }
.ctl:disabled { opacity: .45; cursor: default; }
.chips { display: flex; gap: 16px; margin-left: 38px; }
.chip { width: 82px; height: 82px; border-radius: 50%; border: 0; position: relative; display: grid; place-items: center; font: 700 30px/1 var(--num); color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); box-shadow: 0 6px 12px rgba(0,0,0,.55), inset 0 0 0 5px rgba(255,255,255,.12); transition: transform .15s; }
.chip::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; border: 5px dashed rgba(255,255,255,.8); }
.chip::after { content: ''; position: absolute; inset: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); }
.chip:hover { transform: translateY(-3px); }
.chip.active { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--gold-hi), 0 0 22px rgba(246,216,138,.7), 0 10px 16px rgba(0,0,0,.6); }
.ctl-arrow { width: 62px; height: 72px; margin-left: 4px; }
.ctl-arrow.open { border-color: var(--gold); }
.ctl-arrow.open svg { transform: rotate(180deg); }
.play { margin-left: auto; width: 276px; height: 90px; border-radius: 12px; border: 2px solid #f7dc8f;
  background: linear-gradient(#f4d27a, #d6a543 50%, #b98524); color: #2a1a02; font: 700 40px/1 var(--num); letter-spacing: 1.5px;
  box-shadow: 0 0 24px rgba(246,216,138,.35), inset 0 2px 0 rgba(255,255,255,.5); }
.play:hover:not(:disabled) { filter: brightness(1.08); }
.play:disabled { filter: grayscale(.7) brightness(.6); cursor: default; }

/* ---------- Giocate del cilindro ---------- */
.announced { position: absolute; right: 40px; bottom: 150px; width: 560px; z-index: 20; padding: 18px; border-radius: 14px;
  background: rgba(12,12,15,.96); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.7); }
.announced h4 { margin: 0 0 12px; font-size: 13px; letter-spacing: 2px; color: var(--muted); }
.announced .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.announced button.abet { padding: 12px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: rgba(40,40,46,.85); text-align: left; }
.announced button.abet:hover { border-color: var(--gold); }
.announced button.abet b { display: block; font-size: 15px; }
.announced button.abet span { font-size: 12px; color: var(--muted); }
.announced .row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; }
.announced select { background: #1d1d22; color: var(--text); border: 1px solid rgba(255,255,255,.15); border-radius: 6px; padding: 8px; font: inherit; }
.announced .row button.abet { flex: 1; }
.announced .hint { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Messaggi ---------- */
.toast { position: absolute; left: 50%; top: 400px; transform: translateX(-50%); z-index: 40; min-width: 360px; max-width: 700px; padding: 18px 28px; border-radius: 14px; text-align: center;
  background: rgba(12,12,15,.95); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.7); font-size: 20px; animation: pop .25s ease-out; }
.toast.error { border-color: rgba(212,36,48,.7); }
.toast.win { border: 2px solid var(--gold-hi); font: 700 44px/1.1 var(--num); letter-spacing: 1px; color: var(--gold-hi); box-shadow: 0 0 60px rgba(246,216,138,.4); }
.toast.win small { display: block; font: 500 16px/1.4 var(--ui); color: var(--text); letter-spacing: 0; }

/* ------------------------------------- aggiunte: evento, ticket, storico, giri */
.status-line .evento { margin-right: 10px; padding: 2px 8px; border-radius: 7px; font: 600 14px/1.4 var(--num); letter-spacing: 1px;
  color: #bfe0ff; background: rgba(47,143,224,.18); border: 1px solid rgba(47,143,224,.45); }

.settings-menu .scelte { display: flex; gap: 8px; margin-bottom: 8px; }
.settings-menu select { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.08);
  background: rgba(40,40,46,.8); color: inherit; font: 500 14px var(--ui); }

.info-panels .ticket { height: auto; padding: 10px 20px; text-align: left; cursor: pointer; }
.info-panels .ticket:hover { border-color: var(--gold); }
.info-panels .ticket strong { display: block; font: 600 20px/1.2 var(--num); letter-spacing: 1px; color: var(--gold-hi); }

.side-right .storico { padding: 14px 16px; }
.side-right .storico h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: 2px; color: var(--muted); }
.side-right .eventi { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.side-right .eventi li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.side-right .eventi b { font: 600 15px/1 var(--num); letter-spacing: .5px; }
.side-right .eventi .ora { margin-left: auto; font-size: 12px; color: var(--muted); }
.side-right .storico .altri { width: 100%; margin-top: 10px; padding: 9px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(40,40,46,.8); font-size: 13px; color: var(--gold-hi); }
.side-right .storico .altri:hover { border-color: var(--gold); }

.bottombar .giri { display: grid; place-items: center; line-height: 1.1; }
.bottombar .giri small { font-size: 11px; letter-spacing: 1px; color: var(--muted); }
.bottombar .giri b { font: 700 22px/1 var(--num); color: var(--gold-hi); }
.bottombar .giri.acceso { border-color: var(--gold-hi); box-shadow: 0 0 18px rgba(246,216,138,.35); }
