/* TV: palcoscenico fisso 1920×1080 scalato allo schermo (leggibile da lontano). Stile «Quaderno». */
body.tv { overflow: hidden; height: 100vh; background-size: 36px 36px; }
body.tv::before { content: ''; position: fixed; left: 4.2vw; top: 0; bottom: 0; width: 3px; background: var(--margin); }
#stage {
  position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(var(--k, .5)); transform-origin: center;
  color: var(--ink);
}
.screen { position: absolute; inset: 0; }

/* ---------- sala d'attesa ---------- */
#lobby { display: grid; grid-template-columns: 1fr 760px; gap: 60px; padding: 70px 80px; }
.lobby-logo .logo { font-size: 128px; }
.tagline { font-family: var(--f-hand); font-size: 46px; margin: 30px 0 46px; }
.join { border-radius: var(--wob); display: flex; gap: 40px; align-items: center; padding: 36px 40px; color: var(--ink); }
.join-text { flex: 1; }
.step { display: flex; gap: 18px; align-items: flex-start; font-size: 34px; font-weight: 800; margin-bottom: 18px; line-height: 1.2; }
.step b { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; font-family: var(--f-hand); border: 3px solid var(--ink); }
.url { color: var(--blue); }
.code { font-family: var(--f-display); font-size: 150px; letter-spacing: .14em; line-height: 1; margin-top: 10px; color: var(--ink); text-shadow: 0 6px 0 #ffd84d; }
.qr { width: 330px; height: 330px; border-radius: 16px; background: #fff; flex: none; }
.lobby-right h2 { font-size: 56px; margin: 10px 0 24px; }
.slots { display: grid; gap: 20px; }
.slot { display: flex; align-items: center; gap: 26px; padding: 18px 26px; border-radius: var(--wob); background: rgba(31, 47, 86, .04); border: 3px dashed rgba(31, 47, 86, .3); color: var(--ink-2); font-size: 40px; font-weight: 800; min-height: 124px; }
.slot.on { color: var(--ink); animation: pop .35s ease-out backwards; }
.slot .avbox, .pl .avbox, .pod .avbox { background: rgba(255, 255, 255, .75); }
.slot .avbox { width: 88px; height: 88px; }
.slot .tag { margin-left: auto; font-size: 26px; padding: 6px 16px; border-radius: var(--wob); background: #fff; border: 3px solid var(--ink); }
.slot .empty { opacity: .6; font-weight: 600; }
.slot.off .avbox { opacity: .45; }
.hint { font-family: var(--f-hand); font-size: 40px; margin: 34px 0 16px; }
.summary { font-size: 28px; line-height: 1.5; opacity: .9; }

/* ---------- partita ---------- */
#game { display: grid; grid-template-columns: 392px 1024px 392px; gap: 28px; padding: 28px; }
.side { display: flex; flex-direction: column; gap: 22px; min-height: 0; }
.game-logo .logo { font-size: 56px; margin: 4px 0 0 6px; }
.turninfo { border-radius: var(--wob); color: var(--ink); padding: 16px 22px; font-family: var(--f-display); font-size: 34px; display: flex; justify-content: space-between; align-items: baseline; }
.turninfo small { font-family: var(--f-text); font-size: 24px; font-weight: 800; color: var(--ink-2); }
.players { display: flex; flex-direction: column; gap: 16px; }
.pl { display: grid; grid-template-columns: 84px 1fr auto; grid-template-rows: auto auto; column-gap: 16px; align-items: center; color: var(--ink); padding: 12px 18px; transition: transform .25s; }
.pl .avbox { grid-row: 1 / 3; width: 84px; height: 84px; }
.pl .nm { font-family: var(--f-hand); font-size: 34px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .sc { grid-row: 1 / 3; grid-column: 3; font-family: var(--f-display); font-size: 54px; min-width: 70px; text-align: right; }
.pl .role { font-size: 22px; font-weight: 900; color: var(--ink-2); }
.pl.drawing { transform: rotate(0) scale(1.03) !important; outline: 5px dashed var(--coral); outline-offset: 6px; }
.pl.drawing .role { color: var(--coral); }
.pl.got .role { color: var(--ok); }
.pl.off { opacity: .6; }
.pl.left { opacity: .35; }
.sc.bump { animation: pulse .5s 2; color: var(--ok); }

.board { position: relative; }
.canvas-wrap { position: relative; width: 1024px; height: 1024px; background: #fff; border: 4px solid var(--ink); border-radius: var(--wob); box-shadow: 8px 12px 0 rgba(31, 47, 86, .15); overflow: hidden; }
/* nastro adesivo sugli angoli del foglio */
.board::before, .board::after { content: ''; position: absolute; z-index: 3; top: -18px; width: 190px; height: 46px; }
.board::before { left: 60px; background: var(--tape-1); transform: rotate(-5deg); }
.board::after { right: 60px; width: 170px; background: var(--tape-2); transform: rotate(4deg); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--ink); padding: 60px; background: rgba(251, 247, 236, .96); }
.overlay.result { background: linear-gradient(to top, rgba(251, 247, 236, .98) 52%, rgba(251, 247, 236, .2)); place-items: end center; padding-bottom: 50px; }
.overlay h2 { font-size: 76px; line-height: 1.05; margin: 18px 0; }
.overlay p { font-size: 38px; font-weight: 800; margin: 8px 0; }
.ov-big-av { width: 230px; height: 230px; margin: 0 auto; }
.ov-turn { font-family: var(--f-text); font-size: 40px; color: var(--ink-2); }
.ov-word { font-family: var(--f-hand); font-size: 110px; line-height: 1; color: var(--coral); margin: 10px 0 14px; text-shadow: 0 5px 0 #ffd84d; }
.ov-pts { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 18px; }
.ov-pts .chip { font-size: 30px; padding: 10px 22px; }
.ov-pts .chip .avbox { width: 44px; height: 44px; border-width: 2px; padding: 2px; }
.ov-mode { margin-top: 28px; background: var(--postit-4); color: var(--ink); border-radius: 3px; padding: 22px 30px; box-shadow: 6px 8px 0 rgba(31, 47, 86, .15); transform: rotate(-1deg); }
.ov-mode b { display: block; font-family: var(--f-hand); font-size: 52px; }
.ov-mode span { font-size: 30px; font-weight: 800; }
.pencil-wiggle { display: inline-block; font-size: 90px; animation: wiggle 1s infinite; }
.count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-display); font-size: 380px; color: var(--coral); text-shadow: 0 12px 0 #ffd84d; background: rgba(255, 255, 255, .6); }
.count span { animation: pop .4s ease-out both; }

.timer { border-radius: var(--wob); position: relative; width: 392px; height: 330px; color: var(--ink); display: grid; place-items: center; }
.timer svg { width: 290px; height: 290px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #e3ebf6; stroke-width: 12; }
.ring { fill: none; stroke: var(--blue); stroke-width: 12; stroke-linecap: round; stroke-dasharray: 326.7; transition: stroke-dashoffset .2s linear, stroke .3s; }
.timer-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.timer-num span { font-family: var(--f-display); font-size: 130px; line-height: 1; }
.timer-num small { font-size: 24px; font-weight: 900; color: var(--ink-2); }
.timer.warn .ring { stroke: var(--orange); }
.timer.danger .ring { stroke: var(--bad); }
.timer.danger .timer-num span { color: var(--bad); animation: pulse 1s infinite; }
.timer.idle .timer-num span { color: #b9c4d8; }

.roundinfo { background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: var(--wob); padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.roundinfo:empty { display: none; }
.ri-label { font-size: 22px; font-weight: 900; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.ri-cat { font-family: var(--f-hand); font-size: 42px; line-height: 1.05; }
.ri-letters { font-family: ui-monospace, 'Courier New', monospace; font-weight: 900; font-size: 34px; letter-spacing: .12em; word-break: break-word; line-height: 1.3; }
.roundinfo .chip { font-size: 24px; align-self: flex-start; }
.feed { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 10px; }
.fd { background: #fff; color: var(--ink); box-shadow: 3px 4px 0 rgba(31, 47, 86, .1); border-radius: var(--wob); padding: 10px 16px; font-size: 28px; font-weight: 800; display: flex; gap: 12px; align-items: center; animation: pop .3s ease-out both; }
.fd .avbox { width: 40px; height: 40px; border-width: 2px; padding: 2px; }
.fd s { opacity: .8; text-decoration-thickness: 3px; }
.fd.good { background: var(--green); color: #fff; }

/* ---------- fine partita ---------- */
#final { padding: 50px 80px; display: grid; grid-template-columns: 1fr 760px; gap: 60px; }
.fin-title { font-size: 112px; line-height: 1; margin: 10px 0 30px; }
.podium { display: flex; flex-direction: column; gap: 18px; }
.pod { display: grid; grid-template-columns: 70px 110px 1fr auto; align-items: center; gap: 22px; color: var(--ink); padding: 16px 26px; animation: pop .4s ease-out backwards; }
.pod .rank { font-family: var(--f-display); font-size: 60px; text-align: center; }
.pod .avbox { width: 104px; height: 104px; }
.pod .nm { font-family: var(--f-hand); font-size: 50px; }
.pod .nm small { display: block; font-family: var(--f-text); font-size: 24px; font-weight: 800; color: var(--ink-2); }
.pod .sc { font-family: var(--f-display); font-size: 80px; }
.pod.win { outline: 5px dashed var(--coral); outline-offset: 6px; }
.fin-stats { display: flex; flex-direction: column; gap: 20px; }
.hl { background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: var(--wob); padding: 22px 28px; box-shadow: var(--shadow); }
.hl .ri-label { font-size: 24px; }
.hl b { display: block; font-family: var(--f-display); font-size: 46px; margin-top: 6px; }
.hl span { font-size: 28px; font-weight: 800; }
.fin-next { font-family: var(--f-hand); font-size: 38px; margin-top: 10px; }

/* ---------- strumenti e avvisi ---------- */
.tools { position: absolute; right: 18px; bottom: 14px; display: flex; gap: 10px; opacity: .35; transition: opacity .2s; z-index: 10; }
.tools:hover, .tools:focus-within { opacity: 1; }
.tbtn { width: 58px; height: 58px; border-radius: var(--wob); border: 3px solid var(--ink); background: #fff; color: var(--ink); font-size: 30px; cursor: pointer; display: grid; place-items: center; }
.net, .err { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--bad); color: #fff; font-size: 34px; font-weight: 900; padding: 14px 30px; border-radius: 999px; border: 4px solid #fff; z-index: 20; }
.err { bottom: auto; top: 30px; }

.big-ic { font-size: 130px; line-height: 1; color: var(--blue); }
.fin-title .ic { margin-right: 18px; }
.pod .rank .ic { font-size: 64px; }
.hl .ri-label .ic { font-size: 30px; margin-right: 6px; }
.pencil-wiggle { color: var(--coral); }
.fd .ic { color: #ff8fa0; font-size: 30px; }
