/* Bocciofila anni '60: crema, terracotta, verde bottiglia, senape. */
:root {
  --paper: #fbf5e8;
  --cream: #f4ead5;
  --clay: #e3c9a0;
  --line: #d6c19c;
  --ink: #2a1e16;
  --ink-soft: #5e4c3d;
  --terra: #b5482a;
  --terra-dark: #8e3820;
  --green: #1e4a3a;
  --green-2: #2d6450;
  --green-soft: #dfe8dc;
  --mustard: #d9a23a;
  --mustard-soft: #f6e3b4;
  --red: #a8321f;
  --ok: #2d6450;

  --font-display: 'Abril Fatface', Georgia, serif;
  --font-num: 'Alfa Slab One', Georgia, serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

  --r: 14px;
  --shadow: 0 2px 0 var(--line), 0 6px 18px rgba(42, 30, 22, .08);
  --nav-h: 68px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.55), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(217,162,58,.10), transparent 45%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 .8em; }
a { color: var(--terra-dark); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ avvio */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--ink-soft); }
.boot-ball { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 12px; background: var(--terra);
  box-shadow: inset -8px -8px 0 rgba(0,0,0,.15); animation: roll 1.2s ease-in-out infinite alternate; }
@keyframes roll { from { transform: translateX(-40px) rotate(0); } to { transform: translateX(40px) rotate(220deg); } }

/* ------------------------------------------------------------ struttura */
.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
.awning { height: 14px; background: repeating-linear-gradient(90deg, var(--terra) 0 22px, var(--paper) 22px 44px);
  border-bottom: 3px solid var(--terra-dark); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; }
.brand { font-family: var(--font-display); font-size: 1.35rem; color: var(--green); text-decoration: none; line-height: 1; }
.brand small { display: block; font-family: var(--font-body); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--terra); margin-top: 4px; }
.page { padding: 8px 16px 16px; }
.offline { background: var(--mustard-soft); color: var(--ink); text-align: center; font-size: .85rem; padding: 6px 12px; }

.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--green);
  padding-bottom: env(safe-area-inset-bottom); border-top: 3px solid var(--mustard); }
.bottomnav ul { list-style: none; margin: 0 auto; padding: 0; display: flex; max-width: 560px; }
.bottomnav li { flex: 1; }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h);
  color: #cfdcc9; text-decoration: none; font-size: .72rem; font-weight: 500; position: relative; }
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a[aria-current="page"] { color: var(--paper); }
.bottomnav a[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 4px; background: var(--mustard); border-radius: 0 0 4px 4px; }
.bottomnav .dot { position: absolute; top: 10px; right: calc(50% - 18px); width: 10px; height: 10px; border-radius: 50%; background: var(--mustard); border: 2px solid var(--green); }

/* ------------------------------------------------------------ componenti */
.card { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.green { background: var(--green); color: var(--paper); border-color: var(--green); }
.card.green h2, .card.green h3 { color: var(--mustard-soft); }
.card.mustard { background: var(--mustard-soft); border-color: var(--mustard); }
.card.terra { background: var(--terra); color: var(--paper); border-color: var(--terra-dark); }
.card.terra h2, .card.terra h3 { color: #fff3dc; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.eyebrow { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--terra); font-weight: 700; margin-bottom: 4px; }
.card.green .eyebrow, .card.terra .eyebrow { color: var(--mustard-soft); }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.spread { flex-wrap: wrap; row-gap: 6px; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
hr { border: 0; border-top: 1.5px dashed var(--line); margin: 14px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 999px; border: 2px solid var(--green); background: var(--green); color: var(--paper); font-weight: 700;
  text-decoration: none; cursor: pointer; transition: transform .12s ease, background-color .15s ease; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.terra { background: var(--terra); border-color: var(--terra); }
.btn.mustard { background: var(--mustard); border-color: var(--mustard); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--green); }
.card.green .btn.ghost, .card.terra .btn.ghost { color: var(--paper); border-color: var(--paper); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: .875rem; }
.btn svg { width: 20px; height: 20px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.field small { display: block; color: var(--ink-soft); font-size: .8rem; margin-top: 4px; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 16px; }
.input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(30,74,58,.18); }
textarea.input { min-height: 110px; resize: vertical; }
.check { display: flex; gap: 12px; align-items: center; min-height: 48px; cursor: pointer; }
.check input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--green); }
.error { color: var(--red); font-weight: 500; font-size: .9rem; margin: 6px 0 10px; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--clay); flex-shrink: 0; border: 2px solid var(--paper);
  box-shadow: 0 0 0 1.5px var(--line); display: inline-grid; place-items: center; color: var(--ink-soft); font-weight: 700; overflow: hidden; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -12px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: var(--green-soft); color: var(--green); white-space: nowrap; }
.badge.terra { background: #f3d6cb; color: var(--terra-dark); }
.badge.mustard { background: var(--mustard-soft); color: #7a5410; }
.badge.live { background: var(--terra); color: #fff; }
.badge.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.tabs { display: flex; gap: 6px; background: var(--clay); padding: 4px; border-radius: 999px; margin-bottom: 14px; }
.tabs button { flex: 1; min-height: 42px; font-size: .875rem; border: 0; border-radius: 999px; background: transparent; font-weight: 700; cursor: pointer; color: var(--ink-soft); }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--green); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.list > li:last-child { border-bottom: 0; }
.list a.rowlink { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; flex: 1; min-width: 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  z-index: 50; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; max-width: calc(100% - 32px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 500; animation: toast-in .2s ease-out; }
.toast.err { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ------------------------------------------------------------ home */
.hero { text-align: center; padding: 18px 8px 8px; }
.hero h1 { font-size: 2.4rem; color: var(--green); }
.hero .sub { color: var(--terra); font-family: var(--font-display); font-size: 1.25rem; }
.ball-row { display: flex; justify-content: center; gap: 10px; margin: 14px 0; }
.ball { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset -5px -5px 0 rgba(0,0,0,.18); }
.callout { text-align: center; }
.callout .court-num { font-family: var(--font-num); font-size: 3.4rem; line-height: 1; color: var(--mustard-soft); margin: 4px 0 8px; }
.vs { display: flex; align-items: center; gap: 10px; justify-content: center; }
.vs .t { flex: 1; min-width: 0; text-align: center; font-weight: 700; }
.vs .x { font-family: var(--font-display); color: var(--mustard); }

/* ------------------------------------------------------------ partita */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; text-align: center; }
.scoreboard .team { min-width: 0; display: flex; flex-direction: column; align-items: center; }
.scoreboard .team .score { margin-top: auto; padding-top: 6px; }
.scoreboard .dash { align-self: end; padding-bottom: 14px; }
.scoreboard .team .name { font-weight: 700; font-size: .95rem; line-height: 1.2; margin-top: 6px; word-break: break-word; }
.scoreboard .score { font-family: var(--font-num); font-size: 4.2rem; line-height: 1; color: var(--green); }
.scoreboard .dash { font-family: var(--font-display); font-size: 2rem; color: var(--ink-soft); }
.scoreboard .lead .score { color: var(--terra); }
.target { text-align: center; color: var(--ink-soft); font-size: .85rem; margin-top: 6px; }

.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.who button { min-height: 76px; border-radius: 16px; border: 2.5px solid var(--line); background: #fff; cursor: pointer; padding: 8px;
  font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; line-height: 1.2; }
.who button[aria-pressed="true"] { border-color: var(--terra); background: #f8e1d8; box-shadow: 0 0 0 3px rgba(181,72,42,.2); }
.pts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.pts button { min-height: 72px; border-radius: 16px; border: 0; background: var(--green); color: var(--paper); cursor: pointer;
  font-family: var(--font-num); font-size: 2rem; box-shadow: 0 4px 0 #12302a; transition: transform .08s ease; }
.pts button:active { transform: translateY(3px); box-shadow: 0 1px 0 #12302a; }
.pts button:disabled { background: #a9b8ae; box-shadow: none; cursor: not-allowed; }
.ends { display: flex; flex-wrap: wrap; gap: 6px; }
.ends span { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--clay); }
.ends span.a { background: var(--green-soft); color: var(--green); }
.ends span.b { background: #f3d6cb; color: var(--terra-dark); }

/* ------------------------------------------------------------ torneo */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); padding: 6px 4px; border-bottom: 1.5px solid var(--line); }
.table td { padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.table td.num, .table th.num { text-align: center; width: 34px; font-variant-numeric: tabular-nums; }
.table tr.q td:first-child { box-shadow: inset 4px 0 0 var(--green); }
.table tr.mine td { background: var(--mustard-soft); }
.pos { font-family: var(--font-num); color: var(--terra); width: 26px; }

.mrow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); color: inherit; text-decoration: none; }
.mrow:last-child { border-bottom: 0; }
.mrow .l { text-align: right; min-width: 0; }
.mrow .r { text-align: left; min-width: 0; }
.mrow .mid { text-align: center; min-width: 64px; }
.mrow .sc { font-family: var(--font-num); font-size: 1.15rem; }
.mrow .w { font-weight: 700; }
.mrow .tn { font-size: .9rem; line-height: 1.2; word-break: break-word; }

.bracket { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.bracket .col { min-width: 220px; flex: 1; scroll-snap-align: start; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; }
.bracket .col h3 { font-size: 1rem; color: var(--terra); text-align: center; }
.bm { background: #fff; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; display: block; }
.bm .s { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; font-size: .9rem; }
.bm .s + .s { border-top: 1px dashed var(--line); }
.bm .s.w { font-weight: 700; background: var(--green-soft); }
.bm .s b { font-family: var(--font-num); font-weight: 400; }
.bm .tbd { color: var(--ink-soft); font-style: italic; font-size: .8rem; line-height: 1.25; }

.courts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.court { background: #c9a578; background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.06) 0 2px, transparent 2px 9px);
  border: 3px solid #8b6a43; border-radius: 12px; padding: 10px; color: var(--ink); text-decoration: none; display: block; min-height: 120px; min-width: 0; }
.court .n { font-family: var(--font-display); font-size: .95rem; color: #fff8ea; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
.court .p { background: rgba(251,245,232,.92); border-radius: 8px; padding: 6px 8px; margin-top: 6px; font-size: .85rem; }
.court .p .sc { font-family: var(--font-num); font-size: 1.2rem; }
.court.free .p { opacity: .7; font-style: italic; }

/* ------------------------------------------------------------ giocatori */
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pcard { text-align: center; text-decoration: none; color: inherit; min-width: 0; }
.pcard .avatar { width: 100% !important; height: auto !important; aspect-ratio: 1; border-width: 3px; }
.pcard .nm { font-weight: 700; font-size: .85rem; line-height: 1.2; margin-top: 6px; word-break: break-word; }
.pcard .nk { font-size: .75rem; color: var(--terra); }
.profile-head { text-align: center; }
.profile-head .avatar { width: 160px; height: 160px; border-width: 4px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats div { background: var(--cream); border-radius: 12px; padding: 8px 4px; }
.stats b { display: block; font-family: var(--font-num); font-weight: 400; font-size: 1.5rem; color: var(--green); }
.stats span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }

.dedica { position: relative; }
.dedica blockquote { margin: 0 0 10px; font-family: Georgia, serif; font-style: italic; font-size: 1.05rem; line-height: 1.5; }
.dedica blockquote::before { content: '“'; font-family: var(--font-display); font-size: 3rem; color: var(--terra); line-height: 0; vertical-align: -.4em; margin-right: 4px; }

/* ------------------------------------------------------------ foto della serata */
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.photo-tile { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--clay); cursor: pointer; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .ph { display: block; width: 100%; height: 100%; background: linear-gradient(110deg, var(--clay) 30%, var(--cream) 50%, var(--clay) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.fab { position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); z-index: 25;
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px; border-radius: 999px; background: var(--terra); color: #fff;
  font-weight: 700; text-decoration: none; box-shadow: 0 6px 18px rgba(142,56,32,.35), 0 0 0 3px var(--paper); }
.fab svg { width: 22px; height: 22px; }
.shell.has-fab { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 84px); }

/* ------------------------------------------------------------ selfie */
.selfie { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto 14px; border-radius: 50%; overflow: hidden;
  background: var(--green); border: 5px solid var(--paper); box-shadow: 0 0 0 3px var(--terra), var(--shadow); }
.selfie video, .selfie img { width: 100%; height: 100%; object-fit: cover; display: block; }
.selfie video { transform: scaleX(-1); }
.selfie .ph { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--mustard-soft); padding: 24px; }
.selfie .ph svg { width: 56px; height: 56px; margin: 0 auto 8px; }
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.steps i { width: 36px; height: 6px; border-radius: 6px; background: var(--line); }
.steps i.on { background: var(--terra); }

/* ------------------------------------------------------------ proiettore
   Pagina fissa: tutto deve stare nello schermo senza scorrere. Le aree con contenuti variabili
   (tabellone, classifiche, coda) usano <Fit>, che rimpicciolisce il contenuto se non entra.
   I campi usano unità del contenitore (cqh/cqw) per scalare con lo spazio disponibile. */
.tv { position: fixed; inset: 0; background: #163a2e; color: var(--paper); overflow: hidden; display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto; font-size: clamp(12px, min(1.05vw, 1.75vh), 30px); }
.tv.idle, .tv.idle * { cursor: none !important; }
.tv-head { display: flex; align-items: center; justify-content: space-between; gap: 1.5em; padding: .55em 1.4em .45em;
  background: repeating-linear-gradient(90deg, var(--terra) 0 2.2em, #c8593a 2.2em 4.4em); border-bottom: .25em solid var(--mustard); }
.tv-head h1 { font-size: 2.1em; margin: 0; color: #fff8ea; text-shadow: 0 .08em 0 rgba(0,0,0,.25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tv-head .ph { font-family: var(--font-display); font-size: 1.25em; background: var(--green); padding: .2em .8em; border-radius: 999px; white-space: nowrap; }
.tv-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1em; padding: .9em 1.4em; min-height: 0; }
.tv-col { display: grid; gap: .9em; min-height: 0; min-width: 0; }
.tv-panel { background: rgba(251,245,232,.07); border: .12em solid rgba(251,245,232,.18); border-radius: .8em; padding: .6em .85em;
  min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.tv-panel h2 { font-size: 1.35em; color: var(--mustard); margin: 0 0 .35em; flex: none; display: flex; justify-content: space-between; align-items: baseline; gap: .5em; }
.tv-panel h2 small { font-family: var(--font-body); font-size: .55em; color: #c4d4c7; font-weight: 500; }
.tv-fit { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.tv-fit-inner { transform-origin: top left; }
.tv-muted { color: #c4d4c7; }

.tv-courts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: .8em; min-height: 0; }
.tv-court { container-type: size; background: #b8915f; background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.07) 0 3px, transparent 3px 14px);
  border: .2em solid #7d5c36; border-radius: .7em; padding: .45em .55em; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tv-court .cn { font-family: var(--font-display); font-size: max(13px, 11cqh); line-height: 1.1; color: #fff8ea; text-shadow: 0 .06em 0 rgba(0,0,0,.35);
  display: flex; justify-content: space-between; align-items: center; gap: .4em; }
.tv-court .cn small { font-family: var(--font-body); font-size: .5em; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  background: rgba(22,58,46,.85); padding: .2em .7em; border-radius: 999px; white-space: nowrap; }
.tv-court .board { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 2cqw;
  background: rgba(251,245,232,.95); color: var(--ink); border-radius: .5em; padding: 2cqh 2cqw; margin-top: 2.5cqh; }
.tv-court .side { text-align: center; min-width: 0; }
.tv-court .faces { display: inline-flex; }
.tv-court .faces > span + span { margin-left: -4cqh; }
.tv-court .tn { font-weight: 700; font-size: max(12px, 9.5cqh); line-height: 1.1; margin-top: 1.5cqh; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tv-court .score { display: flex; align-items: center; gap: 1.5cqw; }
.tv-court .big { font-family: var(--font-num); font-size: 40cqh; line-height: 1; color: var(--green); min-width: .6em; text-align: center; }
.tv-court .big.lead { color: var(--terra); }
.tv-court .sep { font-family: var(--font-display); font-size: 15cqh; color: var(--ink-soft); }
.tv-court.free .board { place-content: center; grid-template-columns: 1fr; text-align: center; font-family: var(--font-display); font-size: 10cqh; color: var(--ink-soft); }
.tv-court.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 .4em var(--mustard); } 100% { box-shadow: 0 0 0 0 transparent; } }

.tv-bracket { display: flex; gap: 1em; align-items: stretch; }
.tv-bracket .col { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: space-around; gap: .45em; }
.tv-bracket .col h3 { font-family: var(--font-body); font-size: .75em; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #c4d4c7; margin: 0; text-align: center; }
.tv-bm { background: rgba(251,245,232,.95); color: var(--ink); border-radius: .45em; overflow: hidden; font-size: .95em; }
.tv-bm .s { display: flex; justify-content: space-between; gap: .6em; padding: .22em .55em; white-space: nowrap; }
.tv-bm .s + .s { border-top: .06em dashed var(--line); }
.tv-bm .s span { overflow: hidden; text-overflow: ellipsis; max-width: 18em; }
.tv-bm .s.w { font-weight: 700; background: var(--green-soft); }
.tv-bm .s b { font-family: var(--font-num); font-weight: 400; }
.tv-bm .tbd { color: var(--ink-soft); font-style: italic; font-size: .85em; }
.tv-bm.live { box-shadow: 0 0 0 .18em var(--terra); }
.tv-bm .bm-court { display: block; background: var(--terra); color: #fff; font-size: .7em; font-weight: 700; text-align: center; padding: .1em; letter-spacing: .08em; text-transform: uppercase; }
.tv-third { margin-top: .6em; }

.tv-q { list-style: none; margin: 0; padding: 0; }
.tv-q li { display: grid; grid-template-columns: 1.6em minmax(0, 1fr); gap: .5em; padding: .3em 0; border-bottom: .06em dashed rgba(251,245,232,.2); line-height: 1.2; }
.tv-q li:last-child { border-bottom: 0; }
.tv-q .i { font-family: var(--font-num); color: var(--mustard); }
.tv-q .lbl { font-size: .72em; text-transform: uppercase; letter-spacing: .08em; color: #c4d4c7; }
.tv-table { width: 100%; border-collapse: collapse; font-size: .95em; }
.tv-table td, .tv-table th { padding: .2em .3em; border-bottom: .06em dashed rgba(251,245,232,.2); }
.tv-table .num { text-align: center; width: 2.2em; font-variant-numeric: tabular-nums; }
.tv-table tr.q td:first-child { box-shadow: inset .25em 0 0 var(--mustard); }
.tv-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(15em, 1fr)); gap: .8em 1.2em; }
.tv-groups h3 { color: var(--mustard); font-size: 1.1em; margin-bottom: .2em; }

.tv-photo { position: relative; flex: 1; min-height: 0; border-radius: .6em; overflow: hidden; background: #0f2b22; }
.tv-photo .bg { position: absolute; inset: -5%; background-size: cover; background-position: center; filter: blur(24px) brightness(.55); }
.tv-photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; animation: fadein .8s ease-out; }
.tv-photo .cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: .6em; padding: 1.6em .8em .6em;
  background: linear-gradient(transparent, rgba(10,20,16,.85)); }
.tv-photo .cap .q { font-family: Georgia, serif; font-style: italic; }
.tv-photo .new { position: absolute; top: .6em; left: .6em; background: var(--terra); color: #fff; font-weight: 700; padding: .2em .7em; border-radius: 999px; font-size: .85em; }
.tv-photo .empty { position: absolute; inset: 0; display: grid; grid-template-columns: auto 1fr; gap: 1em; align-items: center; padding: 1em; }
.tv-photo .empty .qr { background: #fff; padding: .4em; border-radius: .5em; width: 7em; height: 7em; }
.tv-photo .empty .qr svg { width: 100%; height: 100%; display: block; }

.tv-foot { display: flex; align-items: center; gap: 1.2em; padding: .55em 1.4em; background: #0f2b22; border-top: .2em solid var(--mustard); min-height: 4.6em; overflow: hidden; }
.tv-foot .q { font-family: Georgia, serif; font-style: italic; font-size: 1.2em; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tv-foot .who { font-weight: 700; color: var(--mustard); font-size: .9em; }
.tv-fade { animation: fadein .6s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(.4em); } }

.tv-reg { display: block; }
.tv-reg .n { color: var(--mustard); font-family: var(--font-num); }
.tv-reg .face { width: 4.2em; height: 4.2em; display: inline-block; }
.tv-reg .qr { background: #fff; padding: 1em; border-radius: 1em; width: 17em; height: 17em; }
.tv-reg .qr svg { width: 100%; height: 100%; display: block; }
.tv-reg h2 { font-size: 2.8em; color: var(--mustard); }
.tv-reg .url { font-family: var(--font-num); font-size: 1.3em; word-break: break-all; }
.tv-faces { display: flex; flex-wrap: wrap; gap: .5em; margin-top: 1em; }
.tv-podium { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: end; gap: 1.5em; height: 100%; padding: 0 2em; text-align: center; }
.tv-podium .step { background: var(--terra); border-radius: .6em .6em 0 0; padding: 1em; }
.tv-podium .step .p { font-family: var(--font-num); font-size: 3em; color: var(--mustard-soft); }
.tv-podium .s1 { background: var(--mustard); color: var(--ink); min-height: 75%; }
.tv-podium .s2 { min-height: 55%; }
.tv-podium .s3 { min-height: 42%; background: var(--green-2); }
.tv-podium .tn { font-family: var(--font-display); font-size: 1.6em; margin-top: .3em; }
.tv-controls { position: fixed; right: .8em; bottom: .8em; opacity: 0; transition: opacity .3s; z-index: 5; }
.tv:not(.idle):hover .tv-controls { opacity: 1; }

/* ------------------------------------------------------------ desktop */
@media (min-width: 720px) {
  .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------ telefoni stretti (es. iPhone SE, Android piccoli) */
@media (max-width: 359px) {
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 2rem; }
  .page { padding-left: 12px; padding-right: 12px; }
  .courts { grid-template-columns: minmax(0, 1fr); }
  .court { min-height: 0; }
  .tabs { gap: 2px; }
  .tabs button { font-size: .78rem; padding: 0 4px; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats b { font-size: 1.25rem; }
  .scoreboard .score { font-size: 3.4rem; }
  .callout .court-num { font-size: 2.8rem; }
}

/* Conto alla rovescia per il sorteggio delle coppie */
.cd-banner { display: flex; align-items: center; gap: 12px; margin: 4px 16px 8px; padding: 10px 14px; border-radius: var(--r);
  background: var(--green); color: var(--paper); text-decoration: none; box-shadow: var(--shadow); }
.cd-banner .cd-time { font-family: var(--font-num); font-size: 2rem; line-height: 1; color: var(--mustard); font-variant-numeric: tabular-nums; min-width: 3.1em; text-align: center; }
.cd-banner .cd-txt { display: flex; flex-direction: column; min-width: 0; font-size: .88rem; line-height: 1.3; }
.cd-banner .cd-txt b { font-size: .95rem; }
.cd-banner .cd-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--mustard); color: var(--ink); }
.cd-banner .cd-ico svg { width: 20px; height: 20px; }
.cd-banner.urgent { background: var(--terra); }
.cd-banner.urgent .cd-time { color: var(--paper); animation: cd-pulse 1s ease-in-out infinite; }
.cd-banner.done { background: var(--mustard-soft); color: var(--ink); }
@keyframes cd-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .cd-banner.urgent .cd-time { animation: none; } }
.cd-admin-time { font-family: var(--font-num); font-size: 3.4rem; line-height: 1; color: var(--green); text-align: center; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }

.tv-cd { overflow: visible !important; flex-direction: row !important; align-items: center; justify-content: center; gap: 1.4em; padding: .6em 1.2em !important; background: var(--green) !important; }
.tv-cd .t { font-family: var(--font-num); font-size: 7.5em; line-height: .95; color: var(--mustard); font-variant-numeric: tabular-nums; }
.tv-cd .l { font-size: 2em; line-height: 1.25; max-width: 16em; }
.tv-cd .l b { font-family: var(--font-display); font-size: 1.35em; color: #fff8ea; display: block; }
.tv-cd.urgent { background: var(--terra) !important; }
.tv-cd.urgent .t { color: #fff8ea; animation: cd-pulse 1s ease-in-out infinite; }
.tv-cd.done { background: var(--mustard) !important; color: var(--ink); }
.tv-cd.done .l b { color: var(--ink); }

/* Informazioni della festa */
.event-card { background: var(--green); color: var(--paper); border-color: var(--green); }
.event-card .eyebrow { color: var(--mustard); }
.event-card h2 { color: var(--paper); margin: 2px 0 10px; }
.ev-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; line-height: 1.3; }
.ev-row .small { opacity: .85; }
.ev-ico { flex: none; width: 32px; height: 32px; border-radius: 50%; background: rgba(251,245,232,.14); display: grid; place-items: center; color: var(--mustard); }
.ev-ico svg { width: 18px; height: 18px; }
.ev-notes { margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(251,245,232,.3); font-size: .92rem; }
.ev-notes p { margin: 0 0 6px; }
.event-card .btn.ghost { color: var(--paper); border-color: rgba(251,245,232,.6); }
.event-strip { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r);
  background: var(--green); color: var(--paper); text-decoration: none; font-size: .9rem; line-height: 1.3; }
.event-strip svg { width: 20px; height: 20px; flex: none; color: var(--mustard); }
.event-strip > span { display: flex; flex-direction: column; min-width: 0; }
