/* Tabellone TV — pensato per 16:9 (1920×1080 o 1280×720). Niente CSS grid né variabili:
   i browser Tizen più vecchi non li supportano. Le misure sono in vw/vh. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: #050b2e;
  background-image: radial-gradient(ellipse at 50% 35%, #1b3fa0 0%, #0b1a5e 45%, #050b2e 80%);
  color: #fff; font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
}
.hidden { display: none !important; }

.logo { font-size: 4vw; letter-spacing: .05em; text-transform: uppercase; color: #ffd54f;
  text-shadow: 0 .3vw 0 #b8860b, 0 0 2vw rgba(255, 213, 79, .6); text-align: center; line-height: 1.1; }
.logo span { font-size: .55em; color: #fff; text-shadow: 0 .2vw 0 #0d47a1; vertical-align: middle; }
.logo.big { font-size: 5.2vw; }

.start { position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.start-btn { margin-top: 5vh; font: inherit; font-size: 2.2vw; padding: 1.6vw 3vw; border-radius: 3vw; border: .3vw solid #fff;
  background: #ffd54f; color: #0b1a5e; cursor: pointer; }
.start-btn:focus { outline: none; box-shadow: 0 0 0 .6vw rgba(255, 255, 255, .5); }
.hint { margin-top: 3vh; font-family: Arial, sans-serif; font-size: 1.3vw; opacity: .8; }

.app { position: fixed; top: 0; left: 0; right: 0; bottom: 0; }

/* ---- accoglienza ---- */
.lobby, .wait { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.wait p { margin-top: 4vh; font-family: Arial, sans-serif; font-size: 2vw; opacity: .85; }
.lobby-row { display: flex; align-items: center; margin-top: 4vh; }
.qr-box { background: #fff; padding: 1.4vw; border-radius: 1.2vw; text-align: center; box-shadow: 0 0 3vw rgba(255, 213, 79, .5); }
.qr { width: 24vw; height: 24vw; }
.qr img, .qr canvas, .qr svg { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.qr-url { color: #0b1a5e; font-family: Arial, sans-serif; font-weight: bold; font-size: 1.15vw; margin-top: .8vw; }
.lobby-side { margin-left: 5vw; width: 46vw; }
.lobby-side h2 { font-size: 2.4vw; line-height: 1.2; }
.lobby-code { font-family: Arial, sans-serif; font-size: 1.6vw; margin: 1.5vh 0 3vh; opacity: .9; }
.lobby-code b { font-family: "Arial Black", Arial, sans-serif; letter-spacing: .2em; color: #ffd54f; }
.seats { display: flex; }
.seat { flex: 1; margin-right: 1.2vw; height: 12vw; border-radius: 1vw; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: .3vw dashed rgba(255, 255, 255, .4); font-size: 1.8vw; text-align: center; padding: .5vw; }
.seat.on { border-style: solid; border-color: #fff; color: #fff; box-shadow: 0 0 2vw rgba(255, 255, 255, .3); }
.seat small { display: block; font-family: Arial, sans-serif; font-size: 1vw; opacity: .8; margin-top: .6vw; }

/* ---- gioco ---- */
.game { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; padding-top: 1.5vh; }
.top { width: 92vw; display: flex; align-items: center; justify-content: space-between; min-height: 8vh; }
.round-name { font-size: 1.7vw; color: #ffd54f; text-transform: uppercase; width: 26vw; }
.def { flex: 1; text-align: center; font-size: 2.3vw; text-transform: uppercase; background: #0d47a1; border: .25vw solid #ffd54f;
  border-radius: 3vw; padding: .5vw 1.5vw; box-shadow: 0 0 1.5vw rgba(0, 0, 0, .5); line-height: 1.15; }
.def.m { font-size: 1.8vw; }
.def.s { font-size: 1.35vw; }
.value { width: 26vw; text-align: right; font-size: 2vw; color: #fff; }
.value b { color: #ffd54f; }

.board-wrap { position: relative; margin-top: 1.5vh; padding: 1vw 1.2vw; border-radius: 1.5vw;
  background: linear-gradient(#1a237e, #0d1450); border: .45vw solid #ffd54f; box-shadow: 0 0 3vw rgba(79, 195, 247, .45), inset 0 0 2vw rgba(0, 0, 0, .6); }
.board .row { display: flex; justify-content: center; margin: .3vw 0; }
.cell { width: 5.2vw; height: 6.1vw; margin: 0 .175vw; border-radius: .35vw; position: relative;
  background: linear-gradient(135deg, #0f6b5a, #0a4a3f); border: .12vw solid rgba(0, 0, 0, .35); }
.cell.off { background: linear-gradient(135deg, #12855f, #0b5a41); box-shadow: inset 0 0 .6vw rgba(0, 0, 0, .35); }
.cell.blank { background: #fafafa; box-shadow: inset 0 -.4vw 0 #d6d6d6; }
.cell.lit { background: #4fc3f7; box-shadow: 0 0 1.6vw #81d4fa, inset 0 0 1vw #e1f5fe; }
.cell.shown { background: #fafafa; box-shadow: inset 0 -.4vw 0 #d6d6d6; animation: flip .35s ease-out; }
.cell.flash { background: #fff59d; box-shadow: 0 0 1.5vw #fff176; }
.cell span { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center;
  color: #0b1a5e; font-size: 4.2vw; line-height: 1; }
@keyframes flip { 0% { -webkit-transform: rotateY(90deg); transform: rotateY(90deg); } 100% { -webkit-transform: rotateY(0); transform: rotateY(0); } }
@-webkit-keyframes flip { 0% { -webkit-transform: rotateY(90deg); } 100% { -webkit-transform: rotateY(0); } }

.timer { position: absolute; right: -8.4vw; top: 50%; margin-top: -3.4vw; width: 6.8vw; height: 6.8vw; border-radius: 50%;
  background: #b71c1c; border: .35vw solid #fff; display: flex; align-items: center; justify-content: center; font-size: 2.9vw; box-shadow: 0 0 2vw rgba(255, 82, 82, .7); }
.timer.calm { background: #0d47a1; box-shadow: 0 0 2vw rgba(79, 195, 247, .7); }

.letters { display: flex; justify-content: center; margin-top: 1.2vh; }
.letters i { font-style: normal; width: 2.2vw; height: 2.5vw; margin: 0 .12vw; border-radius: .3vw; display: flex; align-items: center; justify-content: center;
  font-size: 1.5vw; background: rgba(255, 255, 255, .92); color: #0b1a5e; }
.letters i.v { background: #ffe082; }
.letters i.used { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .3); text-decoration: line-through; }

.msg { margin-top: .8vh; height: 4.5vh; font-family: Arial, sans-serif; font-weight: bold; font-size: 1.8vw; text-align: center; width: 90vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 .15vw .3vw #000; }

.podiums { position: absolute; bottom: 1.5vh; left: 0; right: 0; display: flex; justify-content: center; }
.podium { width: 25vw; margin: 0 1.3vw; border-radius: 1vw 1vw .4vw .4vw; padding: .6vw 1.2vw; position: relative; color: #fff;
  border: .3vw solid rgba(255, 255, 255, .25); box-shadow: 0 .5vw 1.5vw rgba(0, 0, 0, .5); -webkit-transition: -webkit-transform .3s; transition: transform .3s; }
.podium .name { font-size: 1.6vw; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 5vw; }
.podium .score { font-size: 2.6vw; margin-top: .1vw; }
.podium .partial { font-family: Arial, sans-serif; font-size: 1vw; opacity: .9; height: 1.3vw; }
.podium .badges { position: absolute; right: .9vw; top: .8vw; }
.badge { display: inline-block; font-family: Arial, sans-serif; font-weight: bold; font-size: .9vw; padding: .2vw .55vw; border-radius: 1vw; margin-left: .3vw;
  background: #fff; color: #6a1b9a; }
.badge.car { color: #00695c; }
.badge.off { background: rgba(0, 0, 0, .35); color: #fff; }
.podium.p0 { background: linear-gradient(#ef5350, #b71c1c); }
.podium.p1 { background: linear-gradient(#ffd54f, #f9a825); color: #3e2723; }
.podium.p1 .badge.off { color: #fff; }
.podium.p2 { background: linear-gradient(#42a5f5, #0d47a1); }
.podium.active { -webkit-transform: translateY(-1.2vh) scale(1.05); transform: translateY(-1.2vh) scale(1.05); border-color: #fff; box-shadow: 0 0 2.5vw rgba(255, 255, 255, .8); }
.podium.buzz { -webkit-animation: pulse .6s infinite alternate; animation: pulse .6s infinite alternate; }
.podium.dim { opacity: .45; }
.podium.champ { width: 30vw; }
@keyframes pulse { from { box-shadow: 0 0 1vw #fff; } to { box-shadow: 0 0 4vw #fff; } }
@-webkit-keyframes pulse { from { box-shadow: 0 0 1vw #fff; } to { box-shadow: 0 0 4vw #fff; } }

.envelopes { position: absolute; right: 2.5vw; bottom: 2.5vh; display: flex; }
.env { width: 8vw; height: 6vw; margin-left: .8vw; background: #ffd54f; color: #4a148c; border-radius: .4vw; display: flex; align-items: center; justify-content: center;
  font-size: 1.2vw; text-align: center; box-shadow: 0 .4vw 1vw rgba(0, 0, 0, .5); position: relative; }
.env.open { background: #fff; }
.env.lost { opacity: .35; }

/* ---- ruota ---- */
.wheel-layer { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(3, 8, 35, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.wheel-layer canvas { width: 80vh; height: 80vh; }
.wheel-label { margin-top: 1.5vh; font-size: 3vw; color: #ffd54f; height: 4vw; text-shadow: 0 .2vw 0 #000; }

.banner { position: fixed; left: 0; right: 0; top: 38%; text-align: center; font-size: 7vw; text-transform: uppercase; color: #fff;
  text-shadow: 0 .4vw 0 #000, 0 0 3vw rgba(255, 213, 79, .9); -webkit-animation: pop .4s ease-out; animation: pop .4s ease-out; pointer-events: none; }
.banner.bad { color: #ff5252; }
.banner.gold { color: #ffd54f; }
.banner small { display: block; font-size: .35em; margin-top: 1vw; }
@keyframes pop { from { -webkit-transform: scale(.4); transform: scale(.4); opacity: 0; } to { -webkit-transform: scale(1); transform: scale(1); opacity: 1; } }
@-webkit-keyframes pop { from { -webkit-transform: scale(.4); opacity: 0; } to { -webkit-transform: scale(1); opacity: 1; } }

.final-rank { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---- accoglienza: istruzioni e regia dal tablet ---- */
.lobby-code span { font-size: .85em; opacity: .8; }
.lobby-hint { margin-top: 3vh; font-family: Arial, sans-serif; font-size: 1.6vw; color: #ffd54f; min-height: 2vw; }
.lobby-hint b { color: #fff; }
.regia-qr { margin-left: 3vw; width: 11vw; text-align: center; font-family: Arial, sans-serif; font-size: 1vw; opacity: .9; }
.qr-box.small { padding: .7vw; border-radius: .7vw; box-shadow: none; }
.qr-box.small .qr { width: 9.6vw; height: 9.6vw; }
.regia-qr p { margin-top: .8vw; }

/* ---- menù del telecomando ---- */
.menu { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(3, 8, 35, .82);
  display: flex; align-items: center; justify-content: center; }
.menu-box { width: 62vw; background: #0d1a6b; border: .35vw solid #ffd54f; border-radius: 1.6vw; padding: 2.2vw 2.6vw;
  box-shadow: 0 0 4vw rgba(0, 0, 0, .7); }
.menu-box h2 { font-size: 2.6vw; color: #ffd54f; text-align: center; margin-bottom: 1.6vw; text-transform: uppercase; }
.mrow { display: flex; align-items: center; min-height: 4.6vw; margin: .7vw 0; padding: .6vw 1.4vw; border-radius: 1vw;
  border: .25vw solid transparent; background: rgba(255, 255, 255, .06); font-size: 1.7vw; cursor: pointer; }
.mrow.focus { border-color: #fff; background: rgba(255, 255, 255, .16); box-shadow: 0 0 1.5vw rgba(255, 255, 255, .25); }
.mrow.btn { justify-content: center; text-transform: uppercase; }
.mrow.btn.go { background: #ffd54f; color: #0b1a5e; }
.mrow.btn.go.focus { border-color: #fff; background: #ffe27a; }
.ml { width: 11vw; color: #9fb4ff; font-family: Arial, sans-serif; font-weight: bold; font-size: 1.4vw; text-transform: uppercase; }
.mv { flex: 1; text-align: center; }
.mv i { font-style: normal; color: #ffd54f; opacity: .35; padding: 0 1vw; }
.mrow.focus .mv i { opacity: 1; }
.mv small { display: block; font-family: Arial, sans-serif; font-size: 1.1vw; opacity: .75; margin-top: .2vw; }
.mv .dots { display: block; letter-spacing: .4em; min-height: 2vw; }
.pad { display: flex; justify-content: center; margin-top: .4vw; }
.pad span { width: 3.2vw; height: 3.2vw; line-height: 3.2vw; margin: 0 .2vw; border-radius: .6vw; background: rgba(255, 255, 255, .1); font-size: 1.5vw; }
.pad span.on { background: #ffd54f; color: #0b1a5e; }
.menu-err { min-height: 2vw; color: #ff8a80; text-align: center; font-family: Arial, sans-serif; font-size: 1.4vw; margin-top: .6vw; }
.menu-keys { text-align: center; font-family: Arial, sans-serif; font-size: 1.1vw; opacity: .6; }
.ok-hint { position: fixed; right: 2vw; bottom: 2vh; z-index: 30; font-family: Arial, sans-serif; font-size: 1.3vw; padding: .6vw 1.2vw;
  border-radius: 2vw; background: rgba(0, 0, 0, .55); border: .15vw solid rgba(255, 255, 255, .4); }
.ok-hint b { color: #ffd54f; }
