/* Tennis Analysis: «Tavole di sequenza».
   Carta opaca da manuale, nero di stampa, filetti da 2 punti, un solo colore piatto (arancio)
   per il fotogramma dell'impatto e per lo scambio in corso. Il giallo della palla sta solo sul video. */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin-ext.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --carta: #F4F3EE;
  --tavola: #FFFFFF;
  --inchiostro: #14181C;
  --tenue: #5C6168;
  --filetto: #C9C8C1;
  --spento: #E4E3DD;
  --segno: #E8591A;
  --segno-scuro: #A83A06;
  --pericolo: #9A1B0B;
  --palla: #D7F23A;
  --lente-scambio: #FFFFFF;
  --lente-scartato: #E4E3DD;
  --lente-onda: #9BA0A6;
  --lente-colpo: #14181C;
  --lente-bordo: #E8591A;
  --lente-testina: #14181C;
  --barra-schede: 64px;
  --sotto: 0px;
  color-scheme: light;
}

/* lo spazio sotto, sui telefoni con la barra dei gesti */
@supports (padding: env(safe-area-inset-bottom)) {
  :root { --sotto: env(safe-area-inset-bottom); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--carta);
  color: var(--inchiostro);
  font-family: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  scrollbar-color: var(--inchiostro) transparent;
  scrollbar-width: thin;
}
h1, h2, h3, p, ol, ul, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; }
::selection { background: var(--inchiostro); color: var(--carta); }
:focus-visible { outline: 3px solid var(--segno); outline-offset: 2px; }
.nascosto { position: fixed; width: 2px; height: 2px; opacity: 0; pointer-events: none; left: -10px; top: -10px; }

.icona { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icona.piena { fill: currentColor; stroke-width: 1.5; }

/* ---------- Impalcatura */
.vista { min-height: 100dvh; display: flex; flex-direction: column; }
.testata { height: 52px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 6px 0 16px; border-bottom: 2px solid var(--inchiostro); }
.testata h1 { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.testata > .tasto-icona:first-child { margin-left: -12px; }
.piede { margin-top: auto; padding: 28px 16px calc(20px + var(--sotto)); font-size: 12px; color: var(--tenue); }

/* ---------- Tasti */
.tasto-icona { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.tasto-icona:active { background: var(--spento); }
.tasto-pieno, .tasto-bordo { width: 100%; min-height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; font-weight: 700; border: 2px solid var(--inchiostro); transition: background-color .15s, color .15s; }
.tasto-pieno { background: var(--inchiostro); color: var(--carta); }
.tasto-pieno:active { background: #2c3238; }
.tasto-bordo:active { background: var(--spento); }
.tasto-pieno:disabled, .tasto-bordo:disabled { background: var(--spento); border-color: var(--spento); color: var(--tenue); }
.tasto-bordo.pericolo { color: var(--pericolo); border-color: var(--pericolo); }
.tasto-bordo.pericolo.conferma { background: var(--pericolo); color: #fff; }
.tasto-testo { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.tasto-testo:disabled { color: var(--tenue); text-decoration: none; }
.tasto-testo .icona { width: 18px; height: 18px; }
.collegamento { font-weight: 700; text-align: left; text-decoration: underline; text-underline-offset: 3px; }

.nota { font-size: 13px; line-height: 1.45; color: var(--tenue); max-width: 62ch; }
.nota.avvertenza { color: var(--segno-scuro); font-weight: 500; }
.esito { font-size: 16px; font-weight: 700; }

.scelte { display: flex; flex-wrap: wrap; gap: 8px; }
.scelta { min-height: 40px; padding: 0 14px; border: 2px solid var(--inchiostro); font-size: 14px; font-weight: 700; }
.scelta[aria-checked="true"] { background: var(--inchiostro); color: var(--carta); }

select { height: 44px; padding: 0 34px 0 10px; border: 2px solid var(--inchiostro); border-radius: 0; background: var(--carta) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2314181C' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 11px center / 12px 8px; font-size: 14px; font-weight: 500; appearance: none; -webkit-appearance: none; max-width: 100%; }
.campo { display: grid; gap: 4px; }
.campo > span { font-size: 13px; color: var(--tenue); }
.campo select { width: 100%; }
.campo-riga { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--tenue); }
input[type="checkbox"], input[type="radio"] { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 0; flex: none; border: 2px solid var(--inchiostro); border-radius: 0; background: var(--carta) no-repeat center; }
input[type="checkbox"]:checked { background-color: var(--inchiostro); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M3.5 9.5l3.5 3.5 7.5-8' fill='none' stroke='%23F4F3EE' stroke-width='2.5'/%3E%3C/svg%3E"); background-size: 18px 18px; }
input[type="radio"]:checked { background-image: linear-gradient(var(--inchiostro), var(--inchiostro)); background-size: 10px 10px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { border-color: var(--filetto); }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 32px; margin: 0; background: linear-gradient(var(--inchiostro), var(--inchiostro)) no-repeat center / 100% 2px; border-radius: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border: 0; border-radius: 0; background: var(--inchiostro); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 0; background: var(--inchiostro); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--inchiostro); }
.opzione { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; }
.opzione.spenta { color: var(--tenue); }
/* la scelta singola non è una casella: ogni voce è una riga bordata, quella scelta si riempie d'inchiostro */
.opzioni { display: grid; gap: 6px; }
.opzioni .opzione { position: relative; min-height: 48px; padding: 0 14px; border: 2px solid var(--inchiostro); font-weight: 700; cursor: pointer; }
.opzioni .opzione input { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: none; opacity: 0; cursor: pointer; }
.opzioni .opzione:has(input:checked) { background: var(--inchiostro); color: var(--carta); }
.opzioni .opzione:has(input:focus-visible) { outline: 3px solid var(--segno); outline-offset: 2px; }
.opzioni .opzione.spenta { border-color: var(--filetto); font-weight: 500; cursor: default; }
progress { display: block; width: 100%; height: 8px; border: 0; background: var(--spento); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--spento); }
progress::-webkit-progress-value { background: var(--inchiostro); }
progress::-moz-progress-bar { background: var(--inchiostro); }

.interruttore { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; font-weight: 700; }
.interruttore::before { content: ""; width: 36px; height: 20px; flex: none; border: 2px solid var(--inchiostro); background: linear-gradient(var(--inchiostro), var(--inchiostro)) no-repeat 2px 50% / 12px 12px; transition: background-position .15s; }
.interruttore[aria-checked="true"]::before { background: var(--inchiostro) linear-gradient(var(--carta), var(--carta)) no-repeat calc(100% - 2px) 50% / 12px 12px; }

/* ---------- Archivio */
#vista-archivio { max-width: 720px; width: 100%; margin: 0 auto; }
.nuova { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px; }
#filtri { padding: 0 16px 12px; }
.sessioni { border-top: 2px solid var(--inchiostro); margin: 0 16px; }
.sessione { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--filetto); text-decoration: none; }
.sessione:active { background: var(--tavola); }
.sessione-foto { display: block; width: 112px; aspect-ratio: 16 / 9; object-fit: cover; background: var(--spento); }
.sessione-testo { display: grid; gap: 2px; min-width: 0; }
.sessione-testo b { font-size: 17px; font-weight: 900; letter-spacing: -.01em; }
.sessione-testo b::first-letter { text-transform: uppercase; }
.sessione-testo span { font-size: 13px; color: var(--tenue); }
.sessione-testo .sessione-punteggio { color: var(--inchiostro); font-weight: 700; }
#archivio-spazio { padding: 14px 16px 0; }

.benvenuto { padding: 28px 16px 0; }
.benvenuto h2 { font-size: 30px; font-weight: 900; line-height: 1.05; letter-spacing: -.025em; text-wrap: balance; }
.benvenuto h2 + p { margin-top: 12px; font-size: 16px; max-width: 46ch; }
.benvenuto .nuova { padding: 20px 0 0; grid-template-columns: 1fr; }
.benvenuto h3 { margin-top: 32px; padding-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-bottom: 2px solid var(--inchiostro); }
.consigli li { padding: 11px 0; border-bottom: 1px solid var(--filetto); font-size: 15px; }
.benvenuto > .nota { margin-top: 16px; }

/* ---------- Sessione: video, tavola, comandi */
.palco { background: var(--carta); z-index: 3; }
.schermo { position: relative; aspect-ratio: 16 / 9; max-height: 56dvh; width: 100%; background: #000; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.schermo.ingrandito { touch-action: none; cursor: grab; }
.schermo video, .schermo canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.schermo video { object-fit: contain; }
.schermo canvas { pointer-events: none; }
.schermo:fullscreen { max-height: none; }
.schermo-tasti { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.tasto-video { min-width: 44px; height: 44px; padding: 0 11px; display: flex; align-items: center; gap: 4px; background: rgba(20, 24, 28, .78); color: #fff; font-size: 13px; font-weight: 700; }
.tasto-video .icona { width: 20px; height: 20px; }
.tasto-video.acceso { background: #fff; color: var(--inchiostro); }
.schermo-etichetta { position: absolute; left: 8px; top: 8px; padding: 5px 9px; background: var(--inchiostro); color: #fff; font-size: 13px; font-weight: 700; }
.schermo-avviso { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px 24px; background: rgba(20, 24, 28, .9); color: #fff; text-align: center; font-size: 15px; }
.schermo-avviso .tasto-pieno { width: auto; background: #fff; color: var(--inchiostro); border-color: #fff; }
.schermo-avviso progress { max-width: 260px; background: #3a4047; }
.schermo-avviso progress::-webkit-progress-bar { background: #3a4047; }
.schermo-avviso progress::-webkit-progress-value { background: #fff; }
.schermo-avviso progress::-moz-progress-bar { background: #fff; }

.tavola-zona { padding: 10px 0 10px; background: var(--tavola); border-bottom: 2px solid var(--inchiostro); }
.tavola-testa { display: grid; grid-template-columns: 1fr 44px 44px; align-items: center; padding: 0 4px 0 16px; }
.tavola-testa h2 { grid-column: 1; grid-row: 1; }
.tavola-testa #s-prima { grid-column: 2; grid-row: 1; }
.tavola-testa #s-dopo { grid-column: 3; grid-row: 1; }
.tavola-testa h2 { font-size: 26px; font-weight: 900; line-height: 1.1; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tavola-meta { grid-column: 1 / -1; grid-row: 2; display: flex; justify-content: space-between; gap: 12px; padding-right: 12px; font-size: 12px; font-weight: 500; color: var(--tenue); }
.tavola-meta b { color: var(--inchiostro); font-weight: 700; }
.tavola { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 20px 6px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: ew-resize; }
.cella { position: relative; display: block; min-width: 0; text-align: center; }
.cella.fuori { visibility: hidden; }
.cella-foto { display: block; aspect-ratio: 50 / 64; background: var(--spento); overflow: hidden; transition: opacity .2s; }
.cella-foto canvas { display: block; width: 100%; height: 100%; }
.cella-numero { display: block; padding-top: 4px; font-size: 11px; font-weight: 500; line-height: 1.2; color: var(--tenue); white-space: nowrap; }
.cella.ora .cella-numero { color: var(--inchiostro); font-weight: 900; }
.cella.ora .cella-foto { box-shadow: 0 3px 0 var(--inchiostro); }
.cella.impatto .cella-foto { outline: 3px solid var(--segno); outline-offset: 1px; }
.cella-impatto { display: none; position: absolute; left: -4px; right: -4px; top: -19px; background: var(--segno); color: var(--inchiostro); font-size: 10px; font-weight: 700; line-height: 15px; overflow: hidden; }
.cella.impatto .cella-impatto { display: block; }
.tavola.in-corsa .cella-foto { opacity: .3; }
.tavola.in-corsa .cella-impatto, .tavola.in-corsa .cella.impatto .cella-foto { outline-color: transparent; background-color: var(--spento); color: transparent; }

.comandi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 16px; }
.tasto-quadro { height: 48px; display: flex; align-items: center; justify-content: center; gap: 4px; border: 2px solid var(--inchiostro); font-size: 15px; font-weight: 700; transition: background-color .15s, color .15s; }
.tasto-quadro:active { background: var(--spento); }
.tasto-dopo { flex-direction: row-reverse; }
.tasto-velocita.acceso { background: var(--segno); }
.tasto-play { background: var(--inchiostro); color: var(--carta); }
.tasto-play:active { background: #2c3238; }

/* ---------- Sessione: schede e pannelli */
.quaderno { padding-bottom: calc(var(--barra-schede) + var(--sotto)); }
.schede { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; height: calc(var(--barra-schede) + var(--sotto)); padding-bottom: var(--sotto); display: grid; grid-template-columns: repeat(4, 1fr); background: var(--carta); border-top: 2px solid var(--inchiostro); }
.schede button { font-size: 13px; font-weight: 500; color: var(--tenue); }
.schede button[aria-selected="true"] { color: var(--inchiostro); font-weight: 900; box-shadow: inset 0 4px 0 var(--inchiostro); }
.pannello { padding: 0 16px 28px; }
.pannello h3 { margin-top: 24px; padding-bottom: 6px; margin-bottom: 12px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-bottom: 2px solid var(--inchiostro); }
.pannello h3 small { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--segno-scuro); margin-left: 6px; }
.pannello .nota + .nota, .pannello .campo-riga + .nota { margin-top: 10px; }
.pannello progress { margin: 12px 0; }
#palla-esito { margin: 12px 0; }
.pannello .interruttore { width: 100%; text-align: left; }
.pannello .interruttore + .nota { margin-top: 4px; }

.lista-testa { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 2px solid var(--inchiostro); }
.lista-testa h2 { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-testa h2 small { font-size: 12px; margin-left: 6px; color: var(--tenue); }
.lista-testa select { height: 44px; padding-left: 8px; padding-right: 28px; border-color: transparent; background-position: right 8px center; font-size: 13px; font-weight: 700; }
.tasto-testa { height: 44px; padding: 0 10px; display: flex; align-items: center; gap: 6px; border: 2px solid var(--inchiostro); font-size: 13px; font-weight: 700; }
.tasto-testa .icona { width: 18px; height: 18px; }
.tasto-testa.acceso { background: var(--inchiostro); color: var(--carta); }
.correzione { padding-bottom: 14px; border-bottom: 2px solid var(--inchiostro); }
.lente { display: block; width: 100%; height: 56px; margin: 12px 0; border: 1px solid var(--filetto); background: var(--carta); touch-action: none; cursor: ew-resize; }
.attrezzi { display: flex; flex-wrap: wrap; gap: 8px; }
.attrezzo { flex: 1 1 auto; justify-content: center; height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 6px; border: 2px solid var(--inchiostro); font-size: 13px; font-weight: 700; white-space: nowrap; }
.attrezzo .icona { width: 18px; height: 18px; }
.attrezzo:disabled { border-color: var(--filetto); color: #868B91; }
.attrezzo.acceso { background: var(--segno); }
.attrezzo:not(:disabled):active { background: var(--spento); }

.lista { }
.riga { display: grid; grid-template-columns: 1fr 48px; border-bottom: 1px solid var(--filetto); }
.riga-vai { display: grid; grid-template-columns: 40px auto 1fr auto; align-items: baseline; gap: 0 10px; min-height: 48px; padding: 9px 0 8px; text-align: left; }
.riga-vai b { font-size: 20px; font-weight: 900; }
.riga-quando { grid-column: 2; grid-row: 1; font-size: 13px; color: var(--tenue); }
.riga-quando::before { content: "a "; }
.riga-nota { grid-column: 3; grid-row: 1; font-size: 13px; color: var(--tenue); }
.riga-durata { grid-column: 4; grid-row: 1; font-size: 16px; }
.riga.ora { box-shadow: inset 0 -3px 0 var(--segno); }
.riga.scartato .riga-vai { color: #868B91; }
.riga.scartato .riga-vai b, .riga.scartato .riga-durata { text-decoration: line-through; }
.riga-stella { width: 48px; display: grid; place-items: center; color: var(--tenue); }
.riga-stella.acceso { color: var(--segno); }
.riga-stella.acceso .icona { fill: currentColor; }
#lista-vuota { padding: 16px 0; }

.numeri { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; border-top: 2px solid var(--inchiostro); margin-top: 16px; }
.numero-voce { display: flex; flex-direction: column-reverse; padding: 10px 0; border-bottom: 1px solid var(--filetto); }
.numero-voce dd { font-size: 26px; font-weight: 900; line-height: 1.15; letter-spacing: -.01em; }
.numero-voce dt { font-size: 13px; color: var(--tenue); }
.fasce li { display: grid; grid-template-columns: 76px 1fr 28px; align-items: center; gap: 10px; height: 32px; font-size: 13px; }
.fasce b { text-align: right; font-weight: 700; }
.fascia-pista { height: 12px; background: var(--spento); }
.fascia-barra { display: block; height: 100%; background: var(--inchiostro); }
#numeri-lungo { margin: 16px 0 8px; font-size: 15px; }

.tabellone { width: 100%; margin-top: 16px; border-collapse: collapse; border-top: 2px solid var(--inchiostro); }
.tabellone caption { caption-side: top; text-align: left; padding-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--segno-scuro); }
.tabellone tr { border-bottom: 1px solid var(--filetto); }
.tabellone th { display: flex; align-items: center; gap: 8px; height: 56px; text-align: left; }
.servizio { width: 10px; height: 10px; flex: none; border-radius: 50%; }
.servizio.acceso { background: var(--inchiostro); }
.nome { flex: 1; min-width: 0; height: 40px; padding: 0; border: 0; border-radius: 0; background: none; font-size: 17px; font-weight: 700; }
.tabellone td { width: 38px; text-align: center; font-size: 24px; font-weight: 400; color: var(--tenue); }
.tabellone td.vinto, .tabellone td.in-corso { color: var(--inchiostro); font-weight: 900; }
.tabellone td.punti { width: 60px; background: var(--inchiostro); color: var(--carta); font-size: 22px; font-weight: 900; border-bottom: 1px solid #3a4047; }
.tabellone .vince .nome { font-weight: 900; }
.punto-a { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.tasto-punto { min-height: 76px; padding: 8px 10px; display: grid; align-content: center; gap: 2px; border: 2px solid var(--inchiostro); text-align: center; overflow: hidden; }
.tasto-punto span { font-size: 12px; color: var(--tenue); }
.tasto-punto b { font-size: 19px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.tasto-punto:not(:disabled):active { background: var(--inchiostro); color: var(--carta); }
.tasto-punto:not(:disabled):active span { color: var(--carta); }
.tasto-punto:disabled { border-color: var(--filetto); color: var(--tenue); }
.punteggio-azioni { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 10px; }
.formato { margin-top: 18px; border-top: 2px solid var(--inchiostro); }
.formato summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; list-style: none; }
.formato summary::-webkit-details-marker { display: none; }
.formato summary::after { content: ""; width: 12px; height: 8px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2314181C' stroke-width='2'/%3E%3C/svg%3E") no-repeat center / contain; transition: transform .15s; }
.formato[open] summary::after { transform: rotate(180deg); }
.formato[open] { display: grid; gap: 12px; }

/* ---------- Fogli */
.foglio { width: min(100%, 520px); max-width: 100%; max-height: 92dvh; margin: auto auto 0; padding: 0 16px calc(20px + var(--sotto)); border: 0; border-top: 2px solid var(--inchiostro); background: var(--carta); color: var(--inchiostro); overflow-y: auto; }
.foglio::backdrop { background: rgba(20, 24, 28, .55); }
.foglio > header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; height: 56px; margin: 0 -16px; padding: 0 6px 0 16px; background: var(--carta); border-bottom: 2px solid var(--inchiostro); }
.foglio > header h2 { flex: 1; font-size: 20px; font-weight: 900; letter-spacing: -.01em; }
.foglio > * + *, .foglio form > * + *, .foglio > div > * + * { margin-top: 14px; }
.foglio legend { padding: 0 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cursore { display: grid; gap: 2px; }
.cursore > span { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 700; }
.cursore output { font-weight: 900; }
.cursore small { font-size: 12px; line-height: 1.4; color: var(--tenue); }
.riepilogo-anteprima { background: var(--spento); padding: 12px; }
.riepilogo-tela { display: block; width: 100%; height: auto; max-height: 56dvh; object-fit: contain; }

.avviso { position: fixed; left: 12px; right: 12px; bottom: calc(var(--barra-schede) + var(--sotto) + 12px); z-index: 30; max-width: 496px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--inchiostro); color: var(--carta); font-size: 14px; line-height: 1.35; }
.avviso span { flex: 1; }
.avviso button { flex: none; min-height: 32px; color: var(--carta); font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Registrazione */
.vista-registra { position: relative; background: #000; }
.reg-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.testata-sopra { position: relative; color: #fff; border-bottom-color: transparent; background: linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, 0)); }
.testata-sopra .tasto-icona:active { background: rgba(255, 255, 255, .2); }
.reg-pannello { position: relative; margin-top: auto; padding: 16px 16px calc(16px + var(--sotto)); background: var(--carta); border-top: 2px solid var(--inchiostro); display: grid; gap: 14px; }
.reg-stato { font-size: 15px; font-weight: 700; }
.reg-pannello .consigli { border-top: 1px solid var(--filetto); }
.reg-pannello .consigli li { padding: 8px 0; font-size: 14px; }
.reg-campi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pallino { width: 14px; height: 14px; flex: none; border-radius: 50%; background: #E0301E; }
.quadratino { width: 14px; height: 14px; flex: none; background: currentColor; }
.reg-contatore { display: flex; align-items: baseline; gap: 10px; font-size: 14px; color: var(--tenue); }
.reg-contatore b { font-size: 30px; font-weight: 900; line-height: 1; color: var(--inchiostro); }
.reg-contatore .pallino { align-self: center; }
.reg-set { font-size: 17px; font-weight: 700; }
.reg-pannello .punto-a { margin-top: 0; }
.reg-azioni { display: flex; justify-content: space-between; gap: 12px; }
.reg-buio { position: fixed; inset: 0; z-index: 40; width: 100%; background: #000; color: #6b6b6b; font-size: 14px; padding: 24px; }

/* ---------- Telefoni alti: il video e la tavola restano in vista mentre si scorre l'elenco */
@media (min-height: 760px) and (max-width: 899px) {
  .palco { position: sticky; top: 0; border-bottom: 2px solid var(--inchiostro); }
  /* quello che si porta in vista (col fuoco della tastiera, per esempio) non deve finire sotto il video o sotto le schede */
  html:has(#vista-sessione:not([hidden])) { scroll-padding-top: calc(var(--palco, 0px) + 8px); scroll-padding-bottom: calc(var(--barra-schede) + var(--sotto) + 8px); }
  html:has(#vista-sessione[data-scheda="numeri"]:not([hidden])), html:has(#vista-sessione[data-scheda="punteggio"]:not([hidden])) { scroll-padding-top: 0; }
  /* numeri e punteggio non hanno bisogno del video sempre in vista: lì scorre via con la pagina */
  #vista-sessione[data-scheda="numeri"] .palco, #vista-sessione[data-scheda="punteggio"] .palco { position: static; }
}

/* ---------- Schermi larghi: video e tavola a sinistra, schede a destra */
@media (min-width: 900px) {
  #vista-sessione { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(360px, 1fr); grid-template-rows: auto 1fr; height: 100dvh; min-height: 0; }
  #vista-sessione > .testata { grid-column: 1 / -1; }
  .palco { overflow-y: auto; border-right: 2px solid var(--inchiostro); }
  .schermo { max-height: 62dvh; }
  .tavola { gap: 8px; padding-left: 16px; padding-right: 16px; }
  .tavola-testa { padding-left: 16px; padding-right: 8px; }
  .tavola-zona { border-bottom: 2px solid var(--inchiostro); }
  .quaderno { overflow-y: auto; padding-bottom: 0; }
  .schede { position: sticky; top: 0; bottom: auto; height: 52px; padding-bottom: 0; border-top: 0; border-bottom: 2px solid var(--inchiostro); }
  .schede button[aria-selected="true"] { box-shadow: inset 0 -4px 0 var(--inchiostro); }
  .schede button { font-size: 14px; }
  .pannello { padding-top: 16px; }
  .foglio { margin: auto; border: 2px solid var(--inchiostro); }
  .avviso { bottom: 20px; }
  .vista-registra .reg-pannello { width: 420px; margin-left: auto; border-left: 2px solid var(--inchiostro); }
  button:hover:not(:disabled).tasto-icona, .tasto-bordo:hover:not(:disabled), .tasto-quadro:not(.tasto-play):hover, .attrezzo:hover:not(:disabled):not(.acceso), .tasto-testa:hover:not(.acceso), .sessione:hover { background: var(--spento); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
