/* =====================================================================
   THE STARTING LINE — foglio di stile unico (app.css)
   Unisce i vecchi tre livelli (styles.css, premium.css, raceday.css) nello stesso ordine:
   base → effetti → identità "linea di partenza". Tolte solo le dichiarazioni che un'altra
   più avanti, sullo stesso selettore, sovrascriveva comunque.
   ===================================================================== */

/* The Starting Line — "Global Athletic Luxury"
   Dark mode profonda, accenti Adventure Orange / Aurora Volt, vetro sfocato su barre e header,
   numeri come tabelloni di cronometraggio (tabular-nums, monospace). */

:root {
  --obsidian: #07090E;
  --surface: #10141D;
  --surface-2: #1A2232;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --text: #F2F4F8;
  --muted: #8E98AA;
  --faint: #848EA0;            /* ≥ 4,5:1 su sfondo e superfici scure (WCAG AA) */
  --orange: #FF5722;
  --orange-soft: rgba(255, 87, 34, 0.14);
  --volt: #CCFF00;
  --volt-soft: rgba(204, 255, 0, 0.12);
  --danger: #FF4D6A;
  --text-2: #D0D5DE;
  --volt-ink: #CCFF00;
  --map-bg: #0B0F16;
  --chip-on: #F2F4F8;
  --chip-on-text: #07090E;
  /* Margini di sicurezza (notch, Dynamic Island, barra gesti). Su Android l'app nativa
     (Capacitor 8, edge-to-edge) li passa come --safe-area-inset-*; altrove si usa env(). */
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --safe-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --ad-h: 0px;
  --tabbar-h: 64px;
  --topbar-h: 60px;
  color-scheme: dark light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 12px); }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(255, 87, 34, 0.10), transparent 60%),
              radial-gradient(900px 500px at -10% 10%, rgba(204, 255, 0, 0.05), transparent 60%),
              var(--obsidian);
  background-attachment: fixed;
  color: var(--text);
  font: 0.9375rem/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img, svg { display: block; }
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--orange); color: #000; padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- Vetro ---------- */
.glass {
  background: rgba(10, 13, 20, 0.62);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--hairline);
}

/* ---------- Header ---------- */
.topbar {
  top: 0; z-index: 40;
  display: flex; align-items: center; 
  min-height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(16px + var(--safe-right)) 0 calc(16px + var(--safe-left));
  border-width: 0 0 1px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1; letter-spacing: 0.06em; }
.brand-text b { font-size: 0.625rem; color: var(--muted); }
.brand-text span { font-size: 0.9375rem; }
.topnav { display: none; gap: 4px; }
.topnav a { text-decoration: none; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.topnav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.units { display: inline-flex; border: 1px solid var(--hairline); }
.units button { border: 0; background: transparent; padding: 6px 12px; min-width: 44px; min-height: 32px; border-radius: 999px; font-size: 0.75rem; color: var(--muted); cursor: pointer; }


/* ---------- Tab bar (zona del pollice) ---------- */
.tabbar {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px calc(8px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(8px + var(--safe-left));
  border-width: 1px 0 0;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; text-decoration: none; letter-spacing: 0.02em; border-radius: 14px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--text); }


main {
  max-width: 1200px; margin: 0 auto;
  padding: 16px calc(16px + var(--safe-right)) calc(var(--tabbar-h) + var(--safe-bottom) + 32px) calc(16px + var(--safe-left));
  outline: none;
}

/* ---------- Tipografia ---------- */
h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -0.02em; margin: 0; }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font-weight: 700; }
.section-head p { margin: 2px 0 0; color: var(--muted); }
.eyebrow { font-family: var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; }
.link-btn { background: none; border: 0; font-weight: 600; cursor: pointer; padding: 8px 0; text-decoration: none; white-space: nowrap; }

/* ---------- Hero / prossima gara ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 300px; padding: 22px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px;
  cursor: pointer;
}
.hero .art, .card .art, .sheet-hero .art { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; }
.hero::after, .card .media::after, .sheet-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(7, 9, 14, 0.05) 0%, rgba(7, 9, 14, 0.55) 55%, rgba(7, 9, 14, 0.96) 100%);
}
.hero h1 { font-size: clamp(1.75rem, 7vw + 0.5rem, 3rem); line-height: 1.02; font-weight: 700; max-width: 18ch; text-wrap: balance; }
.hero .where { color: var(--text-2); font-weight: 500; }
.countdown { display: flex; gap: 8px; flex-wrap: wrap; }
.countdown .cell { min-width: 64px; padding: 8px 10px 6px; border: 1px solid var(--hairline-strong); text-align: center; }
.countdown .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.625rem; line-height: 1; }
.countdown .u { letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; margin-top: 4px; }
.countdown.small .cell { min-width: 44px; padding: 5px 6px 4px; }
.countdown.small .v { font-size: 1rem; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Bottoni ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid var(--hairline-strong); color: var(--text); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: rgba(255, 255, 255, 0.28); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }

.btn.ghost { background: transparent; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Ricerca + chips ---------- */
.search { position: relative; }
.search input { width: 100%; min-height: 52px; padding: 14px 16px 14px 46px; }
.search input::placeholder { color: var(--faint); }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; }
.chips { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 16px 4px; margin: 12px -16px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; scroll-snap-align: start; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { color: var(--chip-on-text); border-color: var(--chip-on); }
.chip.toggle[aria-pressed="true"] { background: var(--volt); color: #0A0D05; border-color: var(--volt-ink); }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { position: relative; overflow: hidden; border-radius: var(--radius); padding: 16px; min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; }
.tile .big { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1; }
.tile .lbl { color: var(--muted); font-size: 0.75rem; font-weight: 500; }


.tile button { all: unset; cursor: pointer; position: absolute; inset: 0; }
.circuits { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.circuit-tile { text-align: left; min-height: 92px; border-radius: 18px; border: 1px solid var(--hairline); background: var(--surface); padding: 14px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.circuit-tile b { font-family: var(--font-display); font-size: 1rem; }
.circuit-tile span { color: var(--muted); font-size: 0.75rem; }
.circuit-tile::before { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, var(--glow, rgba(255, 87, 34, 0.35)), transparent 70%); }

/* ---------- Carosello ---------- */


.rail > * { scroll-snap-align: start; }

/* ---------- Card gara "Global Traveler" ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { position: relative; border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; }
.card:hover { border-color: var(--hairline-strong); }

.card .media { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.badge { font-size: 0.6875rem; color: var(--text); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.badge.sport { border-color: var(--sport, var(--hairline-strong)); }
.badge.live { border-color: var(--volt-ink); }

.badge.circuit { background: var(--orange-soft); border-color: rgba(255, 87, 34, 0.5); }
.card .title { font-family: var(--font-display); font-size: 1.125rem; line-height: 1.15; text-wrap: balance; }
.card .info { padding: 12px 14px 14px; display: grid; }
.card .place { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; font-size: 0.875rem; min-width: 0; }
.card .place span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metrics { display: flex; gap: 6px 14px; flex-wrap: wrap; }
.metric { display: flex; flex-direction: column; gap: 1px; }
.metric .k { letter-spacing: 0.12em; text-transform: uppercase; }
.metric .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.875rem; font-weight: 700; }
.save-btn { position: absolute; top: 10px; right: 10px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--hairline-strong); background: rgba(7, 9, 14, 0.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: grid; place-items: center; cursor: pointer; }
.save-btn svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; }
.save-btn[aria-pressed="true"] svg { fill: var(--orange); stroke: var(--orange); }

/* ---------- Esplora ---------- */
.explore-bar { position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: 20; margin: -16px -16px 0; padding: 12px 16px 8px; background: linear-gradient(180deg, var(--obsidian) 75%, rgba(7, 9, 14, 0)); }
.explore-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.count { color: var(--muted); font-size: 0.8125rem; }
.count b { color: var(--text); font-family: var(--font-mono); }
.seg { display: inline-flex; border: 1px solid var(--hairline); }
.seg button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.map-wrap { position: relative; height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - var(--safe-top) - var(--safe-bottom) - 210px); min-height: 380px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--hairline); background: var(--map-bg); }
.map-wrap .map { position: absolute; inset: 0; }
.map-overlay { position: absolute; z-index: 500; left: 12px; top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.map-note { position: absolute; z-index: 500; left: 12px; bottom: 12px; right: 60px; font-size: 0.75rem; color: var(--muted); }
.map-note span { background: rgba(7, 9, 14, 0.75); padding: 4px 8px; border-radius: 8px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); border: 1px dashed var(--hairline-strong); border-radius: var(--radius); }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 1.125rem; }
.more { display: flex; justify-content: center; margin-top: 18px; }

/* Leaflet: marker e cluster al neon */
.neon-pin span { display: block; width: 14px; height: 14px; margin: 2px; border-radius: 50%; background: var(--pin); box-shadow: 0 0 0 3px rgba(7, 9, 14, 0.8), 0 0 14px 3px var(--pin); }
.neon-cluster { display: grid !important; place-items: center; border-radius: 50%; background: radial-gradient(circle, rgba(255, 87, 34, 0.95) 0%, rgba(255, 87, 34, 0.55) 45%, rgba(255, 87, 34, 0.12) 72%); box-shadow: 0 0 22px 6px rgba(255, 87, 34, 0.45); }
.neon-cluster span { font-family: var(--font-mono); font-weight: 700; font-size: 0.75rem; color: #fff; }
.leaflet-container { background: var(--map-bg) !important; font-family: var(--font-ui) !important; }
.leaflet-control-attribution { background: rgba(7, 9, 14, 0.7) !important; color: var(--faint) !important; font-size: 0.625rem !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--hairline) !important; }

/* ---------- Filtri (bottom sheet) ---------- */
.form { display: grid; gap: 14px; }
.form .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.form > *, .sheet-body > * { min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); letter-spacing: 0.02em; }
.field input, .field select { width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; border: 1px solid var(--hairline); background: var(--surface); font-weight: 500; color: var(--text); }
.field input[type="range"] { padding: 0; accent-color: var(--orange); border: 0; background: none; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--hairline); }
.switch-row small { display: block; color: var(--muted); font-size: 0.75rem; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--hairline-strong); position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .18s ease, background .18s ease; }
.switch:checked { background: var(--volt-soft); border-color: var(--volt-ink); }
.switch:checked::after { transform: translateX(20px); background: var(--volt); }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; -webkit-backdrop-filter: blur(4px); animation: fade .2s ease; }
.sheet {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: 0;
  max-height: calc(100dvh - var(--safe-top) - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--hairline); 
  padding: 0 0 calc(24px + var(--safe-bottom));
  overflow-x: hidden;
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet-handle { position: sticky; top: 0; z-index: 3; height: 26px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-handle::before { content: ""; width: 44px; height: 5px; border-radius: 99px; background: var(--hairline-strong); }
.sheet-close { position: absolute; z-index: 4; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--hairline-strong); background: rgba(7, 9, 14, 0.7); cursor: pointer; font-size: 0.9375rem; }
.sheet-body { padding: 0 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.sheet-hero { isolation: isolate; overflow: hidden; margin: -26px -18px 0; padding: 60px 18px 18px; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; }
.sheet-hero h2 { font-size: clamp(1.625rem, 6vw + 0.5rem, 2.375rem); line-height: 1.05; text-wrap: balance; }
.sheet h3 { font-size: 0.9375rem; font-family: var(--font-display); margin-bottom: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { border: 1px solid var(--hairline); border-radius: 14px; padding: 12px; }
.stat .k { letter-spacing: 0.14em; text-transform: uppercase; }
.stat .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.125rem; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.stat .v.small { font-size: 0.875rem; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn.primary { grid-column: 1 / -1; min-height: 52px; font-size: 1rem; }
.weather { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: linear-gradient(135deg, var(--surface-2), var(--obsidian)); border: 1px solid var(--hairline); }
.weather .ico { font-size: 2.125rem; line-height: 1; }
.weather .t { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.375rem; font-weight: 700; }
.weather small { color: var(--muted); display: block; font-size: 0.75rem; }
.mini-map { overflow: hidden; }


/* ---------- Profilo / footer privacy ---------- */
.panel { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.panel h2 { font-size: 1.125rem; }
.panel p { margin: 0; color: var(--muted); }
.privacy { margin-top: 40px; padding: 18px; border-radius: var(--radius); border: 1px solid rgba(204, 255, 0, 0.25); background: linear-gradient(135deg, rgba(204, 255, 0, 0.06), transparent 60%); }
.privacy h2 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.privacy h2 svg { width: 18px; height: 18px; fill: none; stroke: var(--volt); stroke-width: 2; }
.privacy p { margin: 8px 0 0; color: var(--muted); font-size: 0.8125rem; }
.foot { margin-top: 16px; color: var(--faint); font-size: 0.75rem; text-align: center; }

/* ---------- Toast ---------- */
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); transform: translateX(-50%); background: var(--text); color: var(--obsidian); padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: up .2s ease; max-width: calc(100% - 32px); }

/* ---------- Skeleton ---------- */
.sk { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--radius); border: 1px solid var(--hairline); }
.sk-hero { height: 300px; border-radius: 28px; }
.sk-row { display: flex; gap: 10px; margin-top: 16px; overflow: hidden; }
.sk-pill { width: 90px; height: 38px; border-radius: 999px; flex: none; }
.sk-bento { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 24px; }
.sk-tile { height: 104px; }
.sk-card { flex: none; width: min(82%, 320px); height: 260px; }
.sk-text { height: 14px; border-radius: 6px; }

@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  main { padding-bottom: 48px; }
  .bento { grid-template-columns: repeat(4, 1fr); }
  .sk-bento { grid-template-columns: repeat(4, 1fr); }
  .hero { min-height: 380px; padding: 36px; }
  .rail { grid-auto-columns: 320px; margin: 0; padding: 2px 0 8px; }
  .chips { margin: 12px 0 0; padding: 2px 0 4px; flex-wrap: wrap; overflow: visible; }
  .sheet { left: auto; right: 24px; top: 24px; bottom: 24px; width: 520px; max-height: none; border-radius: 28px; padding-bottom: 24px; animation: side .28s cubic-bezier(.2, .8, .2, 1); }
  .sheet-handle { display: none; }
  .sheet-hero { margin-top: 0; border-radius: 28px 28px 0 0; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .explore-bar { margin: -16px 0 0; padding: 12px 0 8px; }
  .toast { bottom: 24px; }
  @keyframes side { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
}


/* =====================================================================
   Aggiunte: suggerimenti, colori distanze, stati, onboarding, diario, medaglie
   ===================================================================== */
.chip[style*="--sport"]::before { content: ""; display: inline-block; border-radius: 50%; background: var(--sport); margin-right: 8px; vertical-align: 1px; }
.chip[style*="--sport"][aria-pressed="true"] { background: var(--sport); border-color: var(--sport); color: #07090E; }
.chip[style*="--sport"][aria-pressed="true"]::before { box-shadow: none; }
.chip.removable { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-color: var(--hairline-strong); color: var(--text); }
.chip.removable svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tool-row { display: flex; gap: 8px; align-items: center; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.8125rem; border-radius: 11px; }
.btn.block { width: 100%; }
.icon-btn { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--hairline-strong); background: var(--surface-2); cursor: pointer; font-size: 1rem; }
.page-title { font-size: 1.75rem; }
.sheet-title { font-size: 1.5rem; margin-top: 8px; padding-right: 48px; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 0.8125rem; margin: 0; }

/* Suggerimenti di ricerca */
.search { z-index: 5; }
.suggest { list-style: none; margin: 6px 0 0; padding: 6px; position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 360px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--hairline-strong); border-radius: 16px; box-shadow: 0 18px 40px rgba(0, 0, 0, .55); }
.suggest.static { position: static; box-shadow: none; max-height: none; background: transparent; border: 0; padding: 0; margin-top: 10px; }
.suggest li { padding: 10px 12px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.suggest li b { font-weight: 600; font-size: 0.9375rem; }
.suggest li small { color: var(--muted); font-size: 0.75rem; }
.suggest li:hover, .suggest li[aria-selected="true"], .suggest li:focus-visible { background: rgba(255, 255, 255, .06); }
.suggest .sg-city b::after, .suggest .sg-country b::after { content: ""; }
.suggest.static li { border: 1px solid var(--hairline); margin-bottom: 6px; background: var(--surface); }

/* Distanze: un colore per fascia */
.dist-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dist { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 7px;
  color: var(--band); border: 1px solid color-mix(in srgb, var(--band) 55%, transparent); background: color-mix(in srgb, var(--band) 12%, transparent); }
.dist-chips.small .dist { font-size: 0.6875rem; padding: 2px 7px; }
.stat.wide { grid-column: 1 / -1; }

/* Stati */
.badge.past { background: rgba(142, 152, 170, .18); color: #C7CDD8; border-color: rgba(142, 152, 170, .45); }

.card.is-past { opacity: .62; filter: saturate(.35); }
.card.is-past:hover { opacity: .9; }
.past-banner { align-self: flex-start; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 6px 10px; border-radius: 8px; background: rgba(142, 152, 170, .2); border: 1px solid rgba(142, 152, 170, .45); }

/* Saluto e call to action */
.greet { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; color: var(--text-2); }
.greet-medals { text-decoration: none; font-family: var(--font-mono); font-size: 0.875rem; padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hairline); }
.cta-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--radius); border: 1px solid rgba(204, 255, 0, .3); background: linear-gradient(135deg, rgba(204, 255, 0, .08), var(--surface) 65%); }
.cta-card b { font-family: var(--font-display); font-size: 1.125rem; }
.cta-card p { margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Legenda */
.legend { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); padding: 12px 16px; }
.legend summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.legend-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--text-2); }
.legend-item i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* Mappa */
.map-loading { position: absolute; inset: 0; z-index: 400; display: grid; place-items: center; }
.map-loading span { position: relative; color: var(--muted); font-weight: 600; }
.map-overlay { align-items: center; }
.mini-map { width: 100%; height: 220px; border: 1px solid var(--hairline); border-radius: 16px; display: block; background: var(--map-bg);
  filter: invert(.92) hue-rotate(180deg) brightness(.95) contrast(.9) saturate(.6); }
.map-links { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.report-row { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding-top: 8px; border-top: 1px solid var(--hairline); }

/* Onboarding */
.onboarding { position: fixed; inset: 0; z-index: 90; overflow-y: auto; display: grid; place-items: center;
  padding: calc(24px + var(--safe-top)) calc(16px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(16px + var(--safe-left));
  background: radial-gradient(900px 600px at 80% 0%, rgba(255, 87, 34, .22), transparent 60%), radial-gradient(700px 500px at 0% 100%, rgba(204, 255, 0, .1), transparent 60%), var(--obsidian); }
.onb-card { width: min(100%, 460px); display: grid; gap: 16px; animation: up .35s cubic-bezier(.2, .8, .2, 1); }
.onb-card h1 { font-size: clamp(1.75rem, 7vw + 0.5rem, 2.375rem); line-height: 1.05; text-wrap: balance; }
.onb-sub { margin: 0; color: var(--text-2); font-size: 1rem; }
.lang-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-row .chip { min-height: 40px; }
.onb-pin { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--volt-soft); border: 1px solid rgba(204, 255, 0, .4); }
.onb-pin svg { width: 32px; height: 32px; fill: none; stroke: var(--volt); stroke-width: 2; }
.onb-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.onb-points li { display: flex; gap: 10px; align-items: center; color: var(--text-2); }
.onb-points li::before { content: "✓"; color: var(--volt-ink); font-weight: 700; }
.onb-card .field input { min-height: 54px; font-size: 1.0625rem; }

/* Le mie gare / diario */
.seg.wide { display: flex; width: 100%; margin-top: 12px; }
.seg.wide button { flex: 1; }
.diary { display: grid; gap: 10px; }
.diary-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 14px; border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--surface); }
.diary-main { display: grid; gap: 6px; min-width: 0; }
.diary-main b { font-family: var(--font-display); font-size: 1.0625rem; }
.diary-main small { color: var(--muted); }
.diary-notes { margin: 0; color: var(--text-2); font-size: 0.875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.diary-actions { display: flex; }
.feelings { display: flex; gap: 8px; border: 0; padding: 0; margin: 0; }
.feelings label { cursor: pointer; }
.feelings input { position: absolute; opacity: 0; pointer-events: none; }
.feelings span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; font-size: 1.5rem; border: 1px solid var(--hairline); background: var(--surface); }
.feelings input:checked + span { border-color: var(--volt-ink); background: var(--volt-soft); box-shadow: 0 0 0 2px rgba(204, 255, 0, .25); }
.feelings input:focus-visible + span { outline: 2px solid var(--volt); }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.field textarea { width: 100%; min-height: 90px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--surface); font-size: 0.9375rem; resize: vertical; }

/* Profilo e medaglie */
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head > div:nth-child(2) { flex: 1; min-width: 0; }
.avatar { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; font-family: var(--font-display); font-size: 1.75rem; font-weight: 700;
  color: #07090E; background: linear-gradient(135deg, var(--volt), var(--orange)); flex: none; }
.medal { flex: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.medal-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
.medal-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 10px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--hairline); }
.medal-item small { font-size: 0.6875rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.achv { display: grid; gap: 4px; padding: 14px; border-radius: 16px; border: 1px solid var(--hairline); background: var(--surface); opacity: .5; }
.achv.got { opacity: 1; border-color: rgba(204, 255, 0, .35); background: linear-gradient(135deg, rgba(204, 255, 0, .08), var(--surface) 70%); }
.achv-ico { font-size: 1.5rem; }
.achv small { color: var(--muted); font-size: 0.75rem; }
.panel select { min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--obsidian); font-size: 0.9375rem; width: 100%; }



/* ---------- The Starting Line: accessibilità, condivisione, gemme, manifesto, gel ---------- */
.a11y-btn { min-width: 44px; min-height: 40px; border-radius: 999px; border: 1px solid var(--hairline); font-family: var(--font-display); font-weight: 700; font-size: 0.9375rem; cursor: pointer; color: var(--text); }
.share-btn { position: absolute; top: 10px; right: 58px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--hairline-strong); background: rgba(7, 9, 14, 0.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: grid; place-items: center; cursor: pointer; }
.share-btn svg { width: 17px; height: 17px; fill: none; stroke: #fff; stroke-width: 2; }
.card.is-past .share-btn { right: 10px; }
.card .badges { padding-right: 96px; }
.badge.soon { background: rgba(34, 184, 240, 0.18); border-color: rgba(34, 184, 240, 0.6); color: #A8E4FF; }
.badge.gem { background: rgba(167, 139, 250, 0.2); border-color: rgba(167, 139, 250, 0.6); color: #DCD0FF; }
.gem-note { margin-top: 8px; }
.gem-note .link-btn { padding: 0; }
.notify-btn[aria-pressed="true"] { border-color: var(--volt); color: var(--volt-ink); background: var(--volt-soft); }
.notify-btn { grid-column: 1 / -1; }
.ethics { margin-top: 40px; padding: 20px; border-radius: var(--radius); border: 1px solid var(--hairline-strong); background: linear-gradient(160deg, var(--orange-soft), var(--surface) 55%); }
.ethics h2 { font-size: 1.375rem; margin: 6px 0 12px; }
.ethics-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ethics-list li { display: grid; gap: 2px; padding-left: 16px; border-left: 2px solid var(--orange); }
.ethics-list b { font-family: var(--font-display); }
.ethics-list span { color: var(--muted); font-size: 0.875rem; }
.gel { margin-top: 28px; padding: 12px 0 0; border-top: 1px dashed var(--hairline); color: var(--faint); font-size: 0.8125rem; text-align: center; }
.gel p { margin: 0 auto; max-width: 60ch; }
.gel b { color: var(--muted); }


/* ---------- Ricerca per luoghi, ordinamento, PB ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.theme-btn span { font-size: 1.05rem; }
.sort-select { min-height: 44px; max-width: 46vw; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--hairline-strong); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 0.8125rem; }
.tool-row { flex-wrap: wrap; }
.disclaimer { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--hairline); }
.widened { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--volt-soft); border: 1px solid rgba(204, 255, 0, 0.35); color: var(--text); font-weight: 500; }
.active-filters.center { justify-content: center; margin: 12px 0 16px; }
.link-info { display: grid; gap: 6px; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--hairline-strong); }
.link-info .link-btn { text-align: left; }
.pb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pb { display: grid; gap: 4px; padding: 14px; border-radius: 16px; border: 1px solid var(--hairline); background: var(--surface); opacity: .65; }
.pb.has { opacity: 1; border-color: var(--hairline-strong); }
.pb-dist { font-size: 0.75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pb-time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 700; color: var(--volt-ink); }
.pb small { color: var(--muted); font-size: 0.75rem; }
.pb-race { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-src { justify-self: start; font-size: 0.6875rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.suggest .sg-place b { color: var(--volt-ink); }
@media (max-width: 380px) { .brand-text span { font-size: 0.8125rem; } .units button { } }


/* ---------- Tema "linea di partenza": dettagli discreti ---------- */
:root { --checker: repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 8px 8px; }
.topbar { position: sticky; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 4px; background: repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 4px 4px; opacity: .14; pointer-events: none; }
.hero::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: var(--checker); background-size: 10px 10px; opacity: .22; z-index: 0; }
.tile::after { content: ""; position: absolute; top: 0; bottom: 0; right: 18px; width: 0; border-right: 2px dashed var(--hairline); pointer-events: none; }
.eyebrow::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px; background: repeating-conic-gradient(currentColor 0 25%, transparent 0 50%) 0 0 / 5px 5px; }
.tabbar a[aria-current="page"]::after { content: ""; width: 18px; height: 4px; margin-top: 2px; background: repeating-conic-gradient(var(--orange) 0 25%, transparent 0 50%) 0 0 / 4px 4px; }
.countdown .cell { position: relative; }


/* ---------- Caricamento: corsa, nuoto, bici ---------- */
.loader { display: grid; justify-items: center; gap: 6px; color: var(--volt-ink); }
.loader-figs { width: 120px; height: 64px; }
.loader.small .loader-figs { width: 72px; height: 40px; }
.loader-figs .fig { opacity: 0; animation: figcycle 3.6s infinite, bob .6s ease-in-out infinite alternate; transform-origin: 60px 40px; }
.loader-figs .fig-swim { animation-delay: 1.2s, 0s; }
.loader-figs .fig-bike { animation-delay: 2.4s, 0s; }
@keyframes figcycle { 0% { opacity: 0; transform: translateX(-14px); } 6% { opacity: 1; transform: translateX(0); } 30% { opacity: 1; transform: translateX(6px); } 36%, 100% { opacity: 0; transform: translateX(16px); } }
@keyframes bob { from { translate: 0 0; } to { translate: 0 -2px; } }
.loader-line { width: 120px; height: 6px; background: repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 6px 6px; opacity: .35; border-radius: 2px; }
.loader.small .loader-line { width: 72px; height: 4px; background-size: 4px 4px; }
.loader-text { color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.sentinel { display: grid; place-items: center; padding: 24px 0; }
.map-loading { background: var(--map-bg); }
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px; transition: opacity .4s ease; }
.splash.out { opacity: 0; pointer-events: none; }
.splash img { border-radius: 18px; }
.splash-name { margin: 0; font-size: 1.25rem; }
.splash-name b { color: var(--muted); font-weight: 600; font-size: .8em; }
.splash-ready { margin: 0; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: .22em; color: var(--faint); }

/* ---------- Scopri il luogo ---------- */

.discover summary { cursor: pointer; padding: 14px; display: flex; flex-direction: column; gap: 2px; list-style: none; }
.discover summary::-webkit-details-marker { display: none; }
.discover summary span { font-family: var(--font-display); font-weight: 700; }
.discover summary small { color: var(--muted); font-size: 0.8125rem; }
.discover[open] summary { border-bottom: 1px solid var(--hairline); }
.discover-body { padding: 12px 14px 14px; display: grid; gap: 12px; }
.photo-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 160px; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.photo-strip::-webkit-scrollbar { display: none; }
.photo { scroll-snap-align: start; text-decoration: none; display: grid; gap: 4px; }
.photo img { width: 160px; height: 110px; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.photo small { color: var(--faint); font-size: 0.625rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disc-list { display: grid; gap: 6px; }
.disc-item { text-decoration: none; }
.disc-item b { font-weight: 600; font-size: 0.9375rem; }
.disc-item small { color: var(--muted); font-size: 0.75rem; }
.disc-credits { font-size: 0.6875rem; }
.pb-wrap { display: grid; gap: 12px; }

/* ---------- Tema chiaro, alto contrasto (impostazioni di accessibilità) ---------- */
html { font-size: 100%; }
html[data-text="large"] { font-size: 112.5%; }
html[data-text="xl"] { font-size: 131.25%; }
:root[data-theme="light"] {
  --orange-soft: rgba(255, 87, 34, 0.12); 
  --map-bg: #DDE2EA; 
  color-scheme: light;
}
:root[data-theme="light"] body { background: radial-gradient(1200px 600px at 80% -10%, rgba(255, 87, 34, 0.10), transparent 60%), var(--obsidian); }
:root[data-theme="light"] .glass { background: rgba(255, 255, 255, 0.78); }
:root[data-theme="light"] .mini-map { filter: none; }
:root[data-theme="light"] .tabbar a { color: var(--muted); }
:root[data-theme="light"] .card .title, :root[data-theme="light"] .hero h1, :root[data-theme="light"] .sheet-hero h2 { color: #FFFFFF; }
:root[data-theme="light"] .hero .where, :root[data-theme="light"] .sheet-hero .place { color: #E8EBF0; }
:root[data-theme="light"] .hero .eyebrow { color: #CCFF00; }
:root[data-theme="light"] .toast { background: #0B0E14; color: #FFFFFF; }
:root[data-contrast="high"] { --hairline: rgba(255, 255, 255, 0.4); --hairline-strong: rgba(255, 255, 255, 0.7); --text: #FFFFFF; --text-2: #FFFFFF; --muted: #E3E7EE; --faint: #C4CAD5; }
:root[data-contrast="high"][data-theme="light"] { --hairline: rgba(0, 0, 0, 0.5); --hairline-strong: rgba(0, 0, 0, 0.85); --text: #000000; --text-2: #000000; --muted: #1F2430; --faint: #303746; --volt-ink: #2F4600; }
:root[data-contrast="high"] .card, :root[data-contrast="high"] .tile, :root[data-contrast="high"] .panel { border-width: 2px; }
:root[data-contrast="high"] .badge { border-width: 2px; }
:root[data-contrast="high"] :focus-visible { outline-width: 3px; }
:root[data-reduce-motion="on"] *, :root[data-reduce-motion="on"] *::before, :root[data-reduce-motion="on"] *::after { animation: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.field .search input { padding-left: 44px; }

/* ---------- Meno animazioni: anche scorrimenti, mappa e schermata di avvio ---------- */
:root[data-reduce-motion="on"] { scroll-behavior: auto; }
:root[data-reduce-motion="on"] .loader-figs .fig-run { opacity: 1; }
:root[data-reduce-motion="on"] .card:hover, :root[data-reduce-motion="on"] .tile:hover { transform: none; }
@media (prefers-reduced-motion: reduce) { .loader-figs .fig-run { opacity: 1; } }

/* ---------- Modalità daltonici: stati con colori sicuri (blu/arancio) e simboli, non solo colore ---------- */
:root[data-cvd="on"] { --danger: #E69F00; }
:root[data-cvd="on"] .badge.live { background: #56B4E9; color: #04121C; border-color: #56B4E9; }
:root[data-cvd="on"] .badge.live::before { content: "✓ "; }
:root[data-cvd="on"] .badge.closed { background: rgba(230, 159, 0, .16); color: #FFD27A; border-color: #E69F00; }
:root[data-cvd="on"] .badge.closed::before { content: "✕ "; }
:root[data-cvd="on"] .badge.soon { background: rgba(240, 228, 66, .14); color: #F0E442; border-color: #F0E442; }
:root[data-cvd="on"] .badge.soon::before { content: "◷ "; }
:root[data-cvd="on"] .badge.past::before { content: "■ "; }
:root[data-cvd="on"][data-theme="light"] .badge.closed { color: #7A4A00; }
:root[data-cvd="on"][data-theme="light"] .badge.soon { color: #6B6200; background: rgba(240, 228, 66, .3); }
/* Ogni disciplina ha anche una forma (● ▲ ◆ ■ …): si riconosce senza distinguere i colori. */
:root[data-cvd="on"] .badge.sport[data-mark]::before { content: attr(data-mark) " "; }
:root[data-cvd="on"] .chip[data-mark]::before { content: attr(data-mark); width: auto; height: auto; border-radius: 0; background: none; box-shadow: none; color: var(--sport); font-size: 0.875rem; line-height: 1; vertical-align: 0; }
:root[data-cvd="on"] .chip[data-mark][aria-pressed="true"]::before { color: #07090E; background: none; }
:root[data-cvd="on"] .legend-item i[data-mark] { background: none !important; width: auto; height: auto; font-style: normal; color: var(--text); }
:root[data-cvd="on"] .legend-item i[data-mark]::before { content: attr(data-mark); }
:root[data-cvd="on"] .neon-pin span[data-mark] { display: grid; place-items: center; width: 18px; height: 18px; margin: 0; border-radius: 4px; background: #07090E; color: #fff; border: 2px solid var(--pin); box-shadow: none; font-size: 10px; line-height: 1; }
:root[data-cvd="on"] .neon-pin span[data-mark]::before { content: attr(data-mark); }
/* Il colore d'accento verde-lime diventa azzurro: resta ben distinto dall'arancio anche con deuteranopia e protanopia. */
:root[data-cvd="on"] { --volt-soft: rgba(86, 180, 233, 0.14); }
:root[data-cvd="on"][data-theme="light"] { --volt-soft: rgba(0, 114, 178, 0.12); }

/* ---------- File orizzontali: frecce sul computer, sfumatura che invita a scorrere ---------- */
.rail-wrap { position: relative; }
.rail-arrow { display: none; }
@media (hover: hover) and (pointer: fine) {
  .rail { scrollbar-width: thin; scrollbar-color: var(--hairline-strong) transparent; }
  .rail::-webkit-scrollbar { display: block; height: 6px; }
  .rail::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 3px; }
  .rail-arrow { display: grid; place-items: center; position: absolute; top: 38%; width: 44px; height: 44px; border-radius: 50%; z-index: 3;
    border: 1px solid var(--hairline-strong); background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text);
    font-size: 1.75rem; line-height: 1; cursor: pointer; backdrop-filter: blur(10px); box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
  .rail-arrow:hover { border-color: var(--orange); color: var(--orange); }
  .rail-arrow[hidden] { display: none; }
  .rail-arrow.prev { left: -6px; }
  .rail-arrow.next { right: -6px; }
}
.rail-wrap.more-right::after { content: ""; position: absolute; top: 0; right: 0; bottom: 8px; width: 48px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--obsidian)); }
@media (max-width: 759px) { .rail-wrap.more-right::after { right: -16px; } }

/* ---------- Gemma ---------- */
.gem-box { display: grid; gap: 6px; justify-items: start; padding: 14px; border-radius: 16px; border: 1px dashed rgba(167, 139, 250, .5); background: rgba(167, 139, 250, .07); }
.gem-btn { background: transparent; border: 1px solid rgba(167, 139, 250, .6); color: #DCD0FF; }
.gem-btn.on { background: rgba(167, 139, 250, .25); border-color: #A78BFA; color: #FFFFFF; }
:root[data-theme="light"] .gem-btn { color: #5B3FD0; }
:root[data-theme="light"] .gem-btn.on { color: #2E1A8A; }

/* ---------- Scopri il luogo: voce + "Apri in Mappe" ---------- */

.disc-main { display: grid; gap: 2px; text-decoration: none; color: inherit; min-width: 0; }
.disc-main b { font-weight: 600; font-size: 0.9375rem; }
.disc-main small { color: var(--muted); font-size: 0.75rem; }
.disc-map { display: inline-flex; align-items: center; gap: 4px; padding: 8px 10px; min-height: 40px; border-radius: 10px; border: 1px solid var(--hairline-strong);
  font-size: 0.75rem; font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; }
.disc-map svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.disc-map:hover { border-color: var(--orange); color: var(--orange); }
.sheet .rail-wrap.more-right::after { display: none; }

/* =====================================================================
   DESIGN A TRE PIANI
   1. Sfondo: arte della gara e foto.
   2. Centro: schede e contenuti, con ombre morbide che le staccano dallo sfondo.
   3. Primo piano: pulsanti e azioni, con luce dall'alto, ombra netta e pressione al tocco.
   ===================================================================== */
:root {
  --elev-1: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 2px 6px rgba(0, 0, 0, .28), 0 14px 32px -14px rgba(0, 0, 0, .7);
  --elev-2: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 6px 14px rgba(0, 0, 0, .32), 0 24px 48px -18px rgba(0, 0, 0, .8);
  --elev-btn: 0 1px 0 rgba(255, 255, 255, .14) inset, 0 -1px 0 rgba(0, 0, 0, .35) inset, 0 6px 14px -6px rgba(0, 0, 0, .8), 0 2px 4px rgba(0, 0, 0, .35);
  --elev-btn-press: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 2px 4px -2px rgba(0, 0, 0, .8);
  --btn-sheen: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, 0) 55%);
}
:root[data-theme="light"] {
  --elev-1: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 1px 3px rgba(16, 24, 40, .08), 0 14px 30px -16px rgba(16, 24, 40, .25);
  --elev-2: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 4px 10px rgba(16, 24, 40, .1), 0 24px 44px -18px rgba(16, 24, 40, .3);
  --elev-btn: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 -1px 0 rgba(16, 24, 40, .08) inset, 0 4px 10px -4px rgba(16, 24, 40, .35), 0 1px 2px rgba(16, 24, 40, .15);
  --elev-btn-press: 0 1px 2px rgba(16, 24, 40, .2) inset;
  --btn-sheen: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 60%);
}

.year-divider b { position: relative; z-index: 1; font-family: var(--font-mono); font-size: 0.875rem; letter-spacing: .2em; color: var(--orange); }
.year-divider::after { content: ""; position: absolute; z-index: 1; left: 64px; right: 0; bottom: 18px; height: 1px; background: linear-gradient(90deg, var(--hairline-strong), transparent); }

/* 2 — Centro: schede staccate dallo sfondo */
.card, .tile, .panel, .discover, .hero, .gem-box, .link-info { box-shadow: var(--elev-1); }

.card:hover, .tile:hover { box-shadow: var(--elev-2); }

.sheet { box-shadow: 0 -20px 60px -10px rgba(0, 0, 0, .7); }

/* 3 — Primo piano: pulsanti con luce e profondità */

.btn, .icon-btn { background-image: var(--btn-sheen); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.btn:active, .icon-btn:active, .save-btn:active, .share-btn:active, .rail-arrow:active { transform: translateY(1px) scale(.98); box-shadow: var(--elev-btn-press); }
.btn.primary { background-image: linear-gradient(180deg, #FF7A4D, var(--orange) 60%); }
.btn.volt { background-image: linear-gradient(180deg, #E4FF66, var(--volt) 60%); box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 -2px 0 rgba(0, 0, 0, .15) inset, 0 10px 24px -10px rgba(204, 255, 0, .55), 0 2px 4px rgba(0, 0, 0, .3); }
.btn.ghost { background-image: none; box-shadow: none; }
.save-btn, .share-btn, .rail-arrow { box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 18px -6px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .25); }
.save-btn[aria-pressed="true"] { box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 22px -6px rgba(255, 87, 34, .65); }

.tabbar { box-shadow: 0 -12px 30px -12px rgba(0, 0, 0, .6); }
.topbar { box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .8); }

/* Gare B: scelta dell'ordine */
.seg.small { padding: 3px; }
.seg.small button { min-height: 32px; padding: 4px 10px; font-size: 0.75rem; }

/* "Pagina non aggiornata o gara chiusa?": su iPhone il testo andava a capo fuori dallo schermo */
.link-info .link-btn { white-space: normal; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 10px 12px; border-radius: 12px;
  background: var(--orange-soft); color: var(--text); border: 1px solid rgba(255, 87, 34, .45); font-size: 0.875rem; line-height: 1.3; overflow-wrap: anywhere; }
.link-info .note { overflow-wrap: anywhere; }
:root[data-theme="light"] .link-info .link-btn { color: #8A2A08; }

/* =====================================================================
   SCOPRI IL LUOGO — sezione in evidenza
   ===================================================================== */
.discover { display: grid; gap: 12px; padding: 0 0 14px; overflow: hidden; border-radius: 22px; border: 1px solid var(--hairline); background: var(--surface); }
.discover > :not(.disc-cover) { margin: 0 14px; }
.disc-cover { position: relative; isolation: isolate; overflow: hidden; min-height: 230px; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; padding: 18px 16px 14px;
  background: radial-gradient(120% 90% at 80% 0%, rgba(255, 87, 34, .35), transparent 60%), radial-gradient(90% 80% at 0% 100%, rgba(56, 189, 248, .25), transparent 60%), var(--surface-2); }
.disc-cover::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--cover, none) center / cover no-repeat; opacity: 0; transform: scale(1.06); transition: opacity .6s ease, transform 1.2s ease; }
.disc-cover.has-photo::before { opacity: 1; transform: none; }
.disc-cover::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(7, 9, 14, .1) 0%, rgba(7, 9, 14, .55) 50%, rgba(7, 9, 14, .95) 100%); }
.disc-head { position: relative; z-index: 1; display: grid; gap: 4px; color: #fff; }
.disc-head .eyebrow { color: var(--volt); margin: 0; }
.disc-head h3 { font-family: var(--font-display); font-size: clamp(1.75rem, 7vw, 2.5rem); line-height: 1; margin: 0; text-shadow: 0 4px 24px rgba(0, 0, 0, .6); }
.disc-sub { margin: 0; color: rgba(255, 255, 255, .8); font-size: 0.875rem; }
.disc-thumbs { position: relative; z-index: 2; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.disc-thumbs::-webkit-scrollbar { display: none; }
.disc-thumbs .photo { flex: none; width: 76px; height: 56px; border-radius: 12px; overflow: hidden; border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 10px 20px -6px rgba(0, 0, 0, .9); transform: rotate(-2deg); transition: transform .2s ease; }
.disc-thumbs .photo:nth-child(even) { transform: rotate(2deg); }
.disc-thumbs .photo:hover { transform: rotate(0) scale(1.06); }
.disc-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.disc-credit { position: absolute; z-index: 2; top: 10px; right: 10px; max-width: 60%; font-size: 0.625rem; color: rgba(255, 255, 255, .75); text-decoration: none; background: rgba(0, 0, 0, .45); padding: 3px 7px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.disc-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; border-radius: 14px; background: var(--obsidian); border: 1px solid var(--hairline); box-shadow: var(--elev-1); }
.disc-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; display: grid; place-items: center; background: var(--surface-2); font-size: 1.375rem; }
.disc-explore { display: flex; flex-wrap: wrap; gap: 8px; }
.disc-explore .btn { flex: 1 1 160px; }
:root[data-theme="light"] .disc-item { background: var(--surface); }
:root[data-reduce-motion="on"] .disc-cover::before { transition: none; transform: none; }

/* Spazio pubblicitario (solo versione gratuita, solo se attivato in config): sempre etichettato e separato */
.ad-slot { grid-column: 1 / -1; position: relative; min-height: 90px; border-radius: var(--radius); border: 1px dashed var(--hairline-strong); padding: 22px 12px 12px; background: var(--surface); }
.ad-slot::before { content: attr(data-label); position: absolute; top: 6px; left: 12px; font-size: 0.625rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.plan-tier { font-size: 1.125rem; }
.plan-code { display: flex; gap: 8px; }
.plan-code input { flex: 1; min-width: 0; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--obsidian); color: var(--text); }
.consent-form { display: grid; gap: 12px; }
.consent-form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.consent-form legend { font-weight: 600; margin-bottom: 6px; }
.radio-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--obsidian); cursor: pointer; }
.radio-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--orange); }
.radio-row span { display: grid; gap: 2px; }
.radio-row small { color: var(--muted); font-size: 0.75rem; }
#view { overflow-x: clip; }
.discover > .disc-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: auto; }
.disc-tabs button { padding: 8px 6px; font-size: 0.8125rem; line-height: 1.15; text-align: center; }
@media (max-width: 420px) { .disc-tabs button { flex-direction: column; gap: 2px; } }


/* ---------- Schede: più aria tra disciplina, circuito, stato iscrizioni e nome della gara ---------- */
.card .media { height: auto; min-height: 176px; gap: 14px; padding: 14px; }
.card .badges { gap: 8px; row-gap: 8px; }
.card .badges .badge.live, .card .badges .badge.closed, .card .badges .badge.soon, .card .badges .badge.past { margin-top: 2px; }
.card .title { margin-top: auto; padding-top: 4px; }
.card .info { gap: 12px; }

/* ---------- App nativa: banner AdMob in basso (solo versione gratuita) ---------- */
.has-banner .tabbar { bottom: var(--ad-h); }
.has-banner main#view { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--ad-h) + 32px); }
.has-banner .toast { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--ad-h) + 16px); }
/* Nell'app niente evidenziazione grigia al tocco e niente selezione accidentale dei pulsanti */
.native { -webkit-tap-highlight-color: transparent; }
.native .btn, .native .chip, .native .tabbar a, .native .seg button { -webkit-user-select: none; user-select: none; }

/* ---------- Acquisto "senza pubblicità" ---------- */
.paywall { display: grid; gap: 14px; }
.paywall-points { margin: 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; }
.paywall-offer { display: grid; gap: 4px; text-align: left; padding: 16px; border-radius: 16px; cursor: pointer; color: var(--text);
  border: 1px solid rgba(255, 87, 34, .55); background: linear-gradient(180deg, rgba(255, 87, 34, .16), rgba(255, 87, 34, .05)); box-shadow: var(--elev-btn); font: inherit; }
.paywall-offer b { font-family: var(--font-display); font-size: 1.0625rem; }
.paywall-offer small { color: var(--muted); font-size: 0.75rem; }
.paywall-offer[disabled] { opacity: .6; }
.paywall-price { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; color: var(--orange); }
.legal-links { font-size: 0.8125rem; color: var(--muted); margin: 0; }
.legal-links a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.foot { display: grid; gap: 6px; }
.foot a { color: var(--text-2); }
.offline { text-align: center; display: grid; justify-items: center; gap: 12px; padding: 48px 16px; }

/* Mappa sentieri / ciclabili dentro "Scopri il luogo" */
.trail-map { height: 300px; border-radius: 14px; overflow: hidden; border: 1px solid var(--hairline); background: var(--surface-2); }
.trail-map .leaflet-control-attribution { font-size: 10px; }
.disc-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .14) inset, 0 4px 10px -4px rgba(0, 0, 0, .7); }
.start-pin span { width: 22px; height: 22px; }

/* ---------- Accessibilità (European Accessibility Act · EN 301 549 · WCAG 2.2 AA) ---------- */
/* Fasce di distanza leggibili anche sul tema chiaro (contrasto ≥ 4,5:1) */
:root[data-theme="light"] .dist { color: color-mix(in srgb, var(--band) 38%, #000); border-color: color-mix(in srgb, var(--band) 70%, #000 10%); background: color-mix(in srgb, var(--band) 18%, #fff); }
.sheet-close { color: var(--text); }
:root[data-theme="light"] .sheet-close { background: rgba(255, 255, 255, .92); color: #0B0E14; }
/* Focus sempre visibile con la tastiera */

:root[data-theme="light"] :focus-visible { outline-color: #1D4ED8; }
.chip:focus-visible, .btn:focus-visible, .seg button:focus-visible, .tabbar a:focus-visible { outline-offset: 3px; }
/* Avviso nelle schede (es. segnalazioni non ancora attive) */
.note.warn { color: var(--text); background: var(--orange-soft); border: 1px solid rgba(255, 87, 34, .45); border-radius: 10px; padding: 8px 10px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
/* Schermi strettissimi (320 px) e testo molto grande: la barra in alto non deve uscire dallo schermo (WCAG 1.4.10) */
@media (max-width: 380px) {
  .topbar { gap: 6px; padding-left: max(10px, var(--safe-left)); padding-right: max(10px, var(--safe-right)); }
  .brand-text { display: none; }
  .units button { min-width: 36px; padding: 6px 8px; }
  .a11y-btn { width: 40px; min-width: 40px; }
}
.topbar { min-width: 0; }
.topbar > * { flex-shrink: 0; }
.topbar .brand { flex-shrink: 1; min-width: 0; }

/* Nota sull'interruttore silenzioso dell'iPhone, sotto "Effetti sonori" */
.switch-row small.ios-note { display: block; margin-top: 4px; color: var(--text-2); }

/* =====================================================================
   THE STARTING LINE — "Notturno premium"
   Secondo livello grafico, caricato dopo styles.css (che resta la base).
   - sfondo vivo: shader WebGL (js/fx.js) con aurora arancio/volt e pista in prospettiva;
   - superfici di vetro con bordi di luce, profondità e riflessi che seguono il puntatore;
   - movimento morbido (molle, cascate, transizioni tra pagine) e sempre disattivabile;
   - iPhone: barra di navigazione fluttuante; iPad verticale: schede in griglia e dettaglio
     a finestra centrale; iPad orizzontale e computer: barra laterale e dettaglio affiancato.
   Il logo e i suoi colori restano identici a quelli del marchio depositato.
   ===================================================================== */

:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --ring-a: rgba(255, 255, 255, .20);
  --ring-b: rgba(255, 255, 255, .03);
  --ring-c: rgba(255, 87, 34, .38);
  --glass-strong: rgba(9, 11, 18, .66);
  --glass-soft: rgba(255, 255, 255, .035);
  --glow-orange: 0 0 0 1px rgba(255, 87, 34, .35), 0 12px 32px -10px rgba(255, 87, 34, .55);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root { --ease-spring: linear(0, .009, .035 2.1%, .141 4.4%, .723 12.9%, .938 16.7%, 1.017 19.4%, 1.067, 1.077 24.6%, 1.067 27.4%, 1.031 31.6%, .998 36.4%, .989 42.4%, 1.001 58.6%, 1); }
}

:root[data-theme="light"] {
  --ring-a: rgba(255, 255, 255, .9);
  --ring-b: rgba(16, 24, 40, .06);
  --ring-c: rgba(255, 87, 34, .35);
  --glass-soft: rgba(255, 255, 255, .55);
}
:root[data-cvd="on"] { --ring-c: rgba(86, 180, 233, .4); }

/* ---------- Sfondo shader ---------- */
.fx-bg {
  position: fixed; inset: 0; z-index: -1; width: 100vw; height: 100vh; height: 100lvh;
  pointer-events: none; animation: fx-bg-in 1.6s var(--ease-out) both;
  view-transition-name: fx-bg;
}
@keyframes fx-bg-in { from { opacity: 0; } }
.fx-shader .rail-wrap.more-right::after { background: linear-gradient(90deg, transparent, rgba(4, 5, 10, .85)); }
:root[data-theme="light"].fx-shader .rail-wrap.more-right::after { background: linear-gradient(90deg, transparent, rgba(238, 240, 244, .9)); }

/* ---------- Tipografia: titoli più netti, marchio come nel logo depositato ---------- */



.section-head h2 { font-size: clamp(1.25rem, 1.2vw + 1rem, 1.625rem); letter-spacing: -.03em; }
:root:not([data-theme="light"]) .section-head h2 {
  background: linear-gradient(180deg, #FFFFFF 30%, #B7BFCE); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-contrast="high"] .section-head h2 { background: none; color: var(--text); }

:root[data-theme="light"] .eyebrow { text-shadow: none; }

/* ---------- Barra in alto: vetro più profondo, bordo di luce ---------- */
.topbar.glass {
  background: linear-gradient(180deg, rgba(4, 5, 10, .78), rgba(4, 5, 10, .42));
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, .14) 30%, rgba(255, 87, 34, .3) 70%, transparent) 1;
  view-transition-name: topbar;
}
:root[data-theme="light"] .topbar.glass { background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .6)); }
.a11y-btn, .units { border-color: rgba(255, 255, 255, .1); }

/* ---------- Navigazione: pillola fluttuante (telefono e iPad verticale) ---------- */
.tabbar.glass {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(26px) saturate(180%); backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .1);
  view-transition-name: tabbar;
}
:root[data-theme="light"] .tabbar.glass { border-color: rgba(16, 24, 40, .1); box-shadow: 0 18px 40px -18px rgba(16, 24, 40, .35), 0 1px 0 #fff inset; }
.tabbar a { position: relative; transition: color .25s ease, background-color .25s ease; }
.tabbar a[aria-current="page"] {
  background: radial-gradient(120% 140% at 50% 0%, rgba(255, 87, 34, .30), rgba(255, 87, 34, .07) 58%, rgba(255, 87, 34, 0));
  box-shadow: inset 0 0 0 1px rgba(255, 87, 34, .38), 0 8px 22px -12px rgba(255, 87, 34, .9);
  view-transition-name: tab-indicator;
}
:root[data-cvd="on"] .tabbar a[aria-current="page"] { background: radial-gradient(120% 140% at 50% 0%, rgba(86, 180, 233, .3), transparent 70%); box-shadow: inset 0 0 0 1px rgba(86, 180, 233, .5); }
.tabbar a[aria-current="page"]::after { display: none; }
.tabbar a:active { transform: scale(.94); }

@media (max-width: 1099px) {
  .tabbar {
    left: calc(10px + var(--safe-left)); right: calc(10px + var(--safe-right));
    bottom: calc(8px + var(--safe-bottom)); padding: 6px; gap: 4px; border-radius: 28px;
  }
  .tabbar a { min-height: 54px; border-radius: 22px; }
  main { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 52px); }
  .toast { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 30px); }
}
@media (min-width: 700px) and (max-width: 1099px) {
  .topnav { display: none; }
  .tabbar { display: grid; left: 0; right: 0; margin-inline: auto; width: min(560px, calc(100% - 48px)); bottom: calc(14px + var(--safe-bottom)); }
}

/* ---------- iPad orizzontale e computer: barra laterale ---------- */
@media (min-width: 1100px) {
  .topnav { display: none; }
  .tabbar {
    display: flex; flex-direction: column; gap: 6px;
    top: calc(var(--topbar-h) + var(--safe-top) + 20px); bottom: auto;
    left: calc(18px + var(--safe-left)); right: auto; width: 92px; padding: 8px; border-radius: 28px;
  }
  .tabbar a { min-height: 74px; border-radius: 20px; font-size: 0.75rem; text-align: center; padding: 6px 4px; }
  .tabbar a:hover:not([aria-current="page"]) { color: var(--text); background: rgba(255, 255, 255, .05); }
  main { max-width: 1360px; padding: 24px calc(36px + var(--safe-right)) 56px calc(136px + var(--safe-left)); }
  .toast { bottom: 28px; }
}

/* ---------- Ricerca e filtri rapidi ---------- */
.search svg { z-index: 2; pointer-events: none; }
.search input {
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: border-color .2s ease, box-shadow .3s ease;
}
.search input:focus { outline: none; }
:root[data-theme="light"] .search input { background: rgba(255, 255, 255, .85); border-color: rgba(16, 24, 40, .12); }
.chip {
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .25s var(--ease-spring), background-color .2s ease, box-shadow .3s ease, border-color .2s ease;
}
:root[data-theme="light"] .chip { border-color: rgba(16, 24, 40, .1); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { box-shadow: 0 8px 24px -10px rgba(255, 255, 255, .45); }
.chip[style*="--sport"][aria-pressed="true"] { box-shadow: 0 0 0 1px var(--sport), 0 10px 28px -10px var(--sport); }

/* ---------- Schede gara: vetro, bordo di luce, inclinazione e riflesso ---------- */
.card {
  border: 0; isolation: isolate;
  background: linear-gradient(180deg, rgba(22, 27, 39, .94), rgba(10, 13, 20, .96));
  will-change: transform;
}
:root[data-theme="light"] .card { background: linear-gradient(180deg, #FFFFFF, #F6F7FA); }
.card::after {
  content: ""; position: absolute; inset: 0; z-index: 6; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(150deg, var(--ring-a), var(--ring-b) 36%, var(--ring-b) 64%, var(--ring-c));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 5; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .13), transparent 42%);
  transition: opacity .35s ease;
}
.card.is-tilting { transition: transform .12s linear, box-shadow .35s ease; }
.card.is-tilting::before, .hero.is-tilting::before { opacity: 1; }

.card:active { transform: scale(.985); transition-duration: .15s; }


.card .badge, .hero .badge, .sheet-hero .badge { -webkit-backdrop-filter: blur(10px) saturate(150%); backdrop-filter: blur(10px) saturate(150%); background-color: rgba(4, 5, 10, .45); }
.card .title { text-shadow: 0 2px 18px rgba(0, 0, 0, .6); }
.card .metric .v { letter-spacing: -.02em; }

/* ---------- Prossima gara: anello di luce che gira come un giro di pista ---------- */
@property --race-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.hero {
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from var(--race-angle), rgba(255, 255, 255, .08) 0 58%, rgba(255, 87, 34, .2) 66%, #FF5722 78%, #CCFF00 86%, rgba(255, 255, 255, .08) 94%) border-box;
  animation: race-orbit 8s linear infinite;
  transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .7s var(--ease-out);
}
:root[data-cvd="on"] .hero { background: linear-gradient(var(--surface), var(--surface)) padding-box, conic-gradient(from var(--race-angle), rgba(255, 255, 255, .08) 0 58%, #E69F00 78%, #56B4E9 86%, rgba(255, 255, 255, .08) 94%) border-box; }
@keyframes race-orbit { to { --race-angle: 360deg; } }
.hero.is-tilting { transition: transform .12s linear; }
.hero .art { transition: transform 2s var(--ease-out); }
.hero:hover .art { transform: scale(1.04); }
.hero h1 { letter-spacing: -.035em; text-shadow: 0 4px 30px rgba(0, 0, 0, .55); }

/* ---------- Cronometro: celle di vetro e cifre che scattano ---------- */
.countdown .cell {
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 10px 24px -14px rgba(0, 0, 0, .9);
}
.countdown .v { display: inline-block; }
.countdown .v.tick { animation: digit-tick .5s var(--ease-out); }
@keyframes digit-tick { from { transform: translateY(-55%); opacity: 0; filter: blur(3px); } to { transform: none; opacity: 1; filter: none; } }
.countdown .cell:last-child .v { color: var(--orange); text-shadow: 0 0 18px rgba(255, 87, 34, .5); }

/* ---------- Numeri chiave e circuiti ---------- */
.tile {
  border: 0; isolation: isolate;
  background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015) 55%), rgba(10, 12, 19, .82);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 0 0 1px rgba(255, 255, 255, .07), 0 24px 44px -24px rgba(0, 0, 0, .9);
  transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .6s var(--ease-out), box-shadow .3s ease;
}
:root[data-theme="light"] .tile { background: rgba(255, 255, 255, .8); box-shadow: 0 0 0 1px rgba(16, 24, 40, .08), 0 18px 34px -22px rgba(16, 24, 40, .35); }
.tile.is-tilting { transition: transform .12s linear; }
.tile .big { font-size: clamp(1.75rem, 1.5vw + 1.3rem, 2.375rem); letter-spacing: -.04em; }
:root:not([data-theme="light"]) .tile .big { background: linear-gradient(180deg, #FFFFFF, #A9B2C3); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root:not([data-theme="light"]) .tile.accent .big { background: linear-gradient(180deg, #F2FFB3, var(--volt)); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 16px rgba(204, 255, 0, .35)); }
:root[data-cvd="on"]:not([data-theme="light"]) .tile.accent .big { background: linear-gradient(180deg, #CDEBFF, #56B4E9); -webkit-background-clip: text; background-clip: text; }
:root[data-contrast="high"] .tile .big { background: none !important; color: var(--text) !important; filter: none; }

.circuit-tile { transition: transform .5s var(--ease-out), box-shadow .3s ease; transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.circuit-tile:hover { box-shadow: var(--glow-orange); }

/* ---------- Pulsanti: lucentezza che scorre sul pulsante principale ---------- */
.btn { transition: transform .25s var(--ease-spring), box-shadow .25s ease, border-color .2s ease, filter .2s ease; }

.btn:active { transform: scale(.96); }
.btn.primary { position: relative; overflow: hidden; isolation: isolate; }
.btn.primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .38) 48%, transparent 66%);
  transform: translateX(-130%); animation: sheen 5s var(--ease-out) 1.2s infinite;
}
@keyframes sheen { 0%, 62% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
.save-btn, .share-btn { -webkit-backdrop-filter: blur(12px); transition: transform .3s var(--ease-spring); }
.save-btn:active, .share-btn:active { transform: scale(.88); }
.save-btn[aria-pressed="true"] svg { animation: heart-pop .5s var(--ease-spring); }
@keyframes heart-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---------- Pannelli e riquadri ---------- */
.panel, .cta-card, .legend, .gem-box, .weather, .stat {
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
:root:not([data-theme="light"]) .panel, :root:not([data-theme="light"]) .legend { background: linear-gradient(160deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015)), rgba(10, 12, 19, .82); border-color: rgba(255, 255, 255, .08); }
:root:not([data-theme="light"]) .stat { background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .01)), rgba(4, 5, 10, .6); border-color: rgba(255, 255, 255, .08); }
.privacy { -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* ---------- Dettaglio gara (foglio) ---------- */
.sheet-backdrop { background: rgba(2, 3, 6, .55); -webkit-backdrop-filter: blur(10px) saturate(120%); backdrop-filter: blur(10px) saturate(120%); }
:root:not([data-theme="light"]) .sheet {
  background: linear-gradient(180deg, rgba(16, 20, 30, .97), rgba(7, 9, 14, .985));
  border-color: rgba(255, 255, 255, .1);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, .1) inset, 0 -30px 80px -20px rgba(0, 0, 0, .85);
}

.sheet.morphing { animation: none; }

.sheet-hero h2 { text-shadow: 0 4px 30px rgba(0, 0, 0, .55); }
.sheet-close { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: transform .3s var(--ease-spring); }
.sheet-close:active { transform: scale(.9) rotate(90deg); }

/* iPad verticale: dettaglio come finestra centrale */
@media (min-width: 700px) and (max-width: 1099px) {
  .sheet {
    left: 0; right: 0; margin-inline: auto; width: min(720px, calc(100% - 56px));
    top: max(4vh, calc(var(--safe-top) + 16px)); bottom: max(4vh, calc(var(--safe-bottom) + 16px));
    max-height: none; border-radius: 34px; padding-bottom: 28px;
    animation: sheet-pop .45s var(--ease-out);
  }
  .sheet-handle { display: none; }
  .sheet-hero { margin-top: 0; border-radius: 34px 34px 0 0; min-height: 340px; padding: 40px 28px 24px; }
  .sheet-body { padding: 0 28px; }
  .sheet-hero { margin-inline: -28px; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { min-height: 400px; padding: 32px; }
  .rail { grid-auto-columns: 300px; }
  .bento { grid-template-columns: repeat(4, 1fr); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
  main { padding-left: calc(28px + var(--safe-left)); padding-right: calc(28px + var(--safe-right)); }
}
@keyframes sheet-pop { from { opacity: 0; transform: translateY(28px) scale(.97); } to { opacity: 1; transform: none; } }

/* iPad orizzontale e computer: dettaglio affiancato a destra */
@media (min-width: 1100px) {
  .sheet { width: 600px; right: 24px; top: calc(var(--safe-top) + 24px); bottom: 24px; border-radius: 34px; }
  .sheet-hero { border-radius: 34px 34px 0 0; min-height: 320px; }
  .hero { min-height: 440px; padding: 44px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 20px; }
  .rail { grid-auto-columns: 330px; gap: 16px; }
}

/* ---------- Comparsa a cascata ---------- */
:root.fx-reveal:not([data-reduce-motion="on"]) .rv:not(.rv-in) { opacity: 0; }
:root.fx-reveal:not([data-reduce-motion="on"]) .rv.rv-in { animation: rv-up .85s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rv-up { from { opacity: 0; transform: translateY(22px) scale(.98); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

/* ---------- Transizioni tra pagine e dalla scheda al dettaglio ---------- */
::view-transition-group(root) { animation-duration: .42s; }
:root[data-vt="page"]::view-transition-old(root) { animation: vt-out .28s var(--ease-out) both; }
:root[data-vt="page"]::view-transition-new(root) { animation: vt-in .5s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px) scale(.992); filter: blur(6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px) scale(1.008); filter: blur(8px); } }
:root[data-vt="race"]::view-transition-old(root) { animation: fade-out .3s ease both; }
:root[data-vt="race"]::view-transition-new(root) { animation: fade-in .45s var(--ease-out) both; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
::view-transition-group(race-art) { z-index: 50; }
::view-transition-old(race-art), ::view-transition-new(race-art) { height: 100%; object-fit: cover; }
::view-transition-group(tab-indicator) { animation-duration: .5s; animation-timing-function: var(--ease-spring); }
::view-transition-group(fx-bg), ::view-transition-group(topbar), ::view-transition-group(tabbar) { animation: none; }
::view-transition-old(fx-bg) { display: none; }
::view-transition-new(fx-bg) { animation: none; }

/* ---------- Avvio: logo che si accende ---------- */
.splash { background: radial-gradient(60% 40% at 50% 42%, rgba(255, 87, 34, .22), transparent 70%), #04050A; }
.splash img { animation: splash-glow 1.6s var(--ease-out) both; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 20px 60px -10px rgba(255, 87, 34, .6); }
@keyframes splash-glow { from { opacity: 0; transform: scale(.82); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
.splash-name { font-family: "Inter", var(--font-ui); font-weight: 800; letter-spacing: .06em; }

/* ---------- Meno animazioni: tutto fermo ---------- */
:root[data-reduce-motion="on"] .hero, :root[data-reduce-motion="on"] .card, :root[data-reduce-motion="on"] .tile, :root[data-reduce-motion="on"] .circuit-tile { transform: none !important; }
:root[data-reduce-motion="on"] .btn.primary::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .hero, .card, .tile, .circuit-tile { transform: none !important; }
  .btn.primary::after { display: none; }
  :root.fx-reveal .rv:not(.rv-in) { opacity: 1; }
}

/* =====================================================================
   LINGUAGGIO DI MOVIMENTO "RUNNING" (js/motion.js)
   ===================================================================== */
/* 1. Volo in Pista: lo shader copre i contenuti, le card aspettano l'atterraggio */
.flight { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 38; pointer-events: none; opacity: 0; transform-origin: 50% 30%; view-transition-name: flight; }
::view-transition-group(flight) { animation: none; }
::view-transition-old(flight) { display: none; }
::view-transition-new(flight) { animation: none; }
:root.fx-flying .rv.rv-in { animation-play-state: paused !important; }

/* 2. Scia cinetica: piega, allungamento e scia arancione secondo la velocità dello scorrimento */
.card {
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) skewY(calc(var(--kv, 0) * -2.2deg)) skewX(calc(var(--kh, 0) * -3deg)) scaleY(calc(1 + var(--kva, 0) * .018));
  box-shadow: 0 calc(var(--kv, 0) * -26px) 34px -16px rgba(255, 87, 34, calc(var(--kva, 0) * .6)), var(--elev-1);
  transition: transform .45s var(--ease-out), box-shadow .3s ease;
}
:root[data-cvd="on"] .card { box-shadow: 0 calc(var(--kv, 0) * -26px) 34px -16px rgba(86, 180, 233, calc(var(--kva, 0) * .6)), var(--elev-1); }

.card .art { transform: translateY(calc(var(--py, 0) * -14px)) scale(1.1); transition: transform .35s var(--ease-out); }
.card:hover .art { transform: translateY(calc(var(--py, 0) * -14px)) scale(1.16); }
.rail .card { transition: transform .3s var(--ease-out), box-shadow .3s ease; }

/* 3a. Pettorale che vola in "Le mie gare" */
.bib-fly { position: fixed; z-index: 90; pointer-events: none; will-change: transform; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .55)); }
.bib-fly svg { display: block; overflow: visible; }
.tabbar a.bump svg, .topnav a.bump { animation: tab-bump .55s var(--ease-spring); }
@keyframes tab-bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* 3b. Cronometro sul pulsante del sito ufficiale */
.btn.stopwatch-run { gap: 10px; }
.btn.stopwatch-run .sw-face { width: 24px; height: 24px; overflow: visible; }
.btn.stopwatch-run .sw-digits { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.0625rem; letter-spacing: .02em; }

/* 4. Tracciato luminoso */
.route-block .route-svg { display: block; width: 100%; max-width: 640px; height: auto; margin-top: 6px; overflow: visible; }
.route-ghost { fill: none; stroke: var(--hairline-strong); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.route-glow { fill: none; stroke: var(--orange); stroke-opacity: .22; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; }
.route-line { fill: none; stroke: #FF8A5C; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.route-line.elev { stroke: var(--volt); }
.route-head { fill: var(--volt); stroke: rgba(4, 5, 10, .6); stroke-width: 1.5; }
.route-start { fill: var(--orange); }
.elev-fill { fill: var(--volt-soft); opacity: 0; transition: opacity .6s ease; }
.elev-fill.in { opacity: 1; }
.route-tick { stroke: var(--hairline); stroke-width: 1; }
.route-tick-label { fill: var(--faint); font: 600 9px var(--font-mono); }
.route-label { fill: var(--muted); font: 600 10px var(--font-ui); }
.route-label.strong { fill: var(--text); font: 700 11px var(--font-mono); }
.route-finish { opacity: 0; transform-box: fill-box; transform-origin: center; }
.route-finish rect, .route-finish circle { fill: #FFFFFF; }
.route-finish path { fill: #07090E; }
.route-finish.in { opacity: 1; animation: flag-pop .55s var(--ease-spring); }
@keyframes flag-pop { from { transform: scale(.2); } to { transform: scale(1); } }
:root[data-cvd="on"] .route-line { stroke: #E69F00; }
:root[data-theme="light"] .route-line { stroke: #E2470F; }
:root[data-theme="light"] .route-finish rect { stroke: #07090E; stroke-width: 1; }

/* Meno animazioni: niente volo, niente scia, niente pettorale in volo */
:root[data-reduce-motion="on"] .flight, :root[data-reduce-motion="on"] .bib-fly { display: none; }
:root[data-reduce-motion="on"] .card .art { transform: scale(1.1); }
@media (prefers-reduced-motion: reduce) {
  .flight, .bib-fly { display: none; }
  .card .art { transform: scale(1.1); }
}

/* =====================================================================
   SECONDA ONDATA DI INTERAZIONI (js/extras.js)
   ===================================================================== */

/* ---------- Corsia delle distanze ---------- */
.lane-field { display: grid; gap: 10px; }
.lane-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .8125rem; color: var(--muted); }
.lane-out { font-family: var(--font-mono, ui-monospace, monospace); color: var(--text); font-weight: 700; }
.lane-wrap { position: relative; height: 64px; }
.lane-track { position: absolute; left: 14px; right: 14px; top: 30px; height: 10px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 2px, transparent 2px 18px), linear-gradient(#5a2a1c, #3d1c13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
.lane-fill { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, var(--orange), #ff8a3d); box-shadow: 0 0 18px rgba(255, 87, 34, .55); }
:root[data-cvd="on"] .lane-fill { background: linear-gradient(90deg, #56B4E9, #8fd0f5); box-shadow: 0 0 18px rgba(86, 180, 233, .5); }
.lane-km { position: absolute; top: 16px; transform: translateX(-50%); font: 700 .625rem/1 var(--font-mono, ui-monospace, monospace); color: var(--muted);
  padding: 3px 4px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--hairline-strong, rgba(255,255,255,.12)); }
.lane-runner { position: absolute; top: -30px; width: 26px; height: 26px; margin-left: -13px; color: var(--volt-ink); pointer-events: none; transition: left .12s var(--ease-out); }
.lane-runner.b { color: var(--orange); transform: scaleX(-1); }
.lane-runner.stride svg { animation: stride .32s ease; }
.lane-runner.sign::after { content: ''; position: absolute; left: 50%; top: 100%; width: 34px; height: 34px; margin: -6px 0 0 -17px; border-radius: 50%; border: 2px solid currentColor; animation: ring-out .4s ease-out forwards; }
@keyframes stride { 30% { transform: translateY(-4px) rotate(-8deg); } 70% { transform: translateY(1px) rotate(4deg); } }
@keyframes ring-out { from { opacity: 1; transform: scale(.4); } to { opacity: 0; transform: scale(1.4); } }
.lane-input { position: absolute; inset: 14px 0 0; width: 100%; height: 44px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.lane-input::-webkit-slider-runnable-track { background: none; height: 44px; }
.lane-input::-moz-range-track { background: none; }
.lane-input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 30px; height: 30px; margin-top: 7px; border-radius: 50%; cursor: grab;
  background: #fff; border: 3px solid var(--orange); box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.lane-input::-moz-range-thumb { pointer-events: auto; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--orange); cursor: grab; }
.lane-input:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--volt); outline-offset: 2px; }
.lane-input:focus-visible::-moz-range-thumb { outline: 3px solid var(--volt); outline-offset: 2px; }

/* ---------- Stato vuoto: tapis roulant ---------- */
.treadmill { width: 180px; margin: 0 auto 10px; }
.treadmill svg { width: 100%; height: auto; overflow: visible; }
.tm-belt rect { fill: var(--surface-2); stroke: var(--hairline-strong, rgba(255,255,255,.15)); }
.tm-lines { stroke: rgba(255,255,255,.35); stroke-width: 2; stroke-dasharray: 6 10; animation: belt .5s linear infinite; }
.tm-rail { fill: none; stroke: var(--muted); stroke-width: 4; stroke-linecap: round; }
.tm-runner { fill: var(--orange); stroke: var(--orange); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.tm-runner path { fill: none; }
.tm-runner { animation: bob .5s ease-in-out infinite; }
.tm-leg-a, .tm-arm-b { transform-origin: 104px 54px; animation: swing .5s ease-in-out infinite alternate; }
.tm-leg-b, .tm-arm-a { transform-origin: 104px 54px; animation: swing .5s ease-in-out infinite alternate-reverse; }
@keyframes belt { to { stroke-dashoffset: 16; } }
@keyframes bob { 50% { transform: translateY(2px); } }
@keyframes swing { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
.empty .btn + .btn { margin-left: 8px; }
.radius-ring { position: fixed; z-index: 80; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--volt); box-shadow: 0 0 30px rgba(204, 255, 0, .45); animation: radius-grow .9s var(--ease-out) forwards; }
@keyframes radius-grow { from { transform: scale(.5); opacity: 1; } to { transform: scale(16); opacity: 0; } }

/* ---------- Ricarica "Ai blocchi" ---------- */
.pull-blocks { position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-top, 0px) + 6px); width: 150px; margin-left: -75px; display: grid; justify-items: center; gap: 2px;
  pointer-events: none; opacity: 0; transform: translateY(calc(var(--p, 0) * 60px - 60px)); transition: opacity .2s ease; }
.pull-blocks.show { opacity: 1; }
.pb-scene { width: 110px; padding: 4px 8px; border-radius: 18px; background: var(--glass-strong); border: 1px solid var(--ring-a); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.pb-scene svg { width: 100%; height: auto; display: block; }
.pb-block { fill: var(--muted); }
.pb-ground { stroke: var(--hairline-strong, rgba(255,255,255,.2)); stroke-width: 2; }
.pb-runner { fill: var(--orange); stroke: var(--orange); stroke-width: 4; stroke-linecap: round; transform-origin: 60px 40px; transform: rotate(calc(var(--p, 0) * 22deg)) translateY(calc(var(--p, 0) * 4px)); }
.pull-blocks.armed .pb-block { fill: var(--volt-ink); }
.pull-blocks.done .pb-scene { display: none; }
.pull-blocks.done .pb-text { padding: 6px 12px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--ring-a); text-shadow: none; color: var(--volt-ink); }
.pull-blocks.go .pb-runner { animation: blast .45s var(--ease-out) forwards; }
@keyframes blast { to { transform: translateX(80px) rotate(-6deg); opacity: 0; } }
.pb-text { font: 700 .6875rem/1.2 var(--font-mono, ui-monospace, monospace); letter-spacing: .08em; text-transform: uppercase; color: var(--text); text-shadow: 0 1px 6px rgba(0,0,0,.6); }

/* ---------- Meteo vivo sulla copertina ---------- */
.wx-fx { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sheet-hero > :not(.wx-fx):not(.art):not(svg) { position: relative; z-index: 1; }
.wx-fx i { position: absolute; inset: -20%; display: block; }
.wx-fx .rain { background-image: repeating-linear-gradient(calc(100deg + var(--wind, 0) * 14deg), transparent 0 7px, rgba(200, 225, 255, .28) 7px 8px, transparent 8px 22px);
  background-size: 120px 120px; animation: rain .45s linear infinite; }
.wx-fx .rain.r2 { opacity: .55; background-size: 70px 70px; animation-duration: .7s; }
@keyframes rain { to { background-position: calc(-30px * var(--wind, 0)) 120px; } }
.wx-fx .snow { background-image: radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 52%), radial-gradient(3px 3px at 80px 70px, rgba(255,255,255,.9) 50%, transparent 52%), radial-gradient(2px 2px at 50px 110px, rgba(255,255,255,.8) 50%, transparent 52%);
  background-size: 120px 140px; animation: snow 6s linear infinite; opacity: .85; }
.wx-fx .snow.s2 { background-size: 80px 90px; animation-duration: 9s; opacity: .5; }
@keyframes snow { to { background-position: calc(-40px * var(--wind, 0)) 140px; } }
.wx-fx .fog { background: radial-gradient(60% 40% at 30% 60%, rgba(220, 228, 240, .22), transparent 70%), radial-gradient(50% 30% at 75% 40%, rgba(220, 228, 240, .16), transparent 70%); animation: fog 14s ease-in-out infinite alternate; }
.wx-cloud .fog { opacity: .5; }
.wx-fx .fog.f2 { animation-duration: 20s; animation-direction: alternate-reverse; }
@keyframes fog { from { transform: translateX(-8%); } to { transform: translateX(8%); } }
.wx-fx .glare { inset: auto; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 220, 140, .55), rgba(255, 170, 60, .12) 45%, transparent 70%); animation: glare 6s ease-in-out infinite alternate; }
.wx-fx .flare { inset: auto; right: 40px; top: 30px; width: 300px; height: 2px; background: linear-gradient(90deg, transparent, rgba(255, 230, 170, .6), transparent); transform: rotate(-28deg); transform-origin: right; opacity: .6; }
@keyframes glare { to { transform: scale(1.12); opacity: .8; } }
.wx-fx .flash { inset: 0; background: rgba(220, 230, 255, .0); animation: flash 7s steps(1) infinite; }
@keyframes flash { 0%, 61%, 63%, 66%, 100% { background: rgba(220,230,255,0); } 62%, 65% { background: rgba(220,230,255,.35); } }
.wx-flags { position: absolute; right: 14px; top: 56px; display: flex; gap: 6px; }
.wx-flags svg { width: 18px; height: 24px; overflow: visible; }
.wx-flags .pole { stroke: rgba(255,255,255,.7); stroke-width: 1.5; }
.wx-flags .pennant { fill: var(--orange); transform-origin: 4px 10px; animation: flutter calc(.9s - var(--wind, 0) * .2s) ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
@keyframes flutter { from { transform: skewY(-8deg) scaleX(.85); } to { transform: skewY(6deg) scaleX(1); } }

/* ---------- Punti di passaggio e calcolatore di passo ---------- */
.route-chips { margin-top: 10px; }
.route .lane, svg .lane { transition: opacity .3s ease; }
svg .lane.dim { opacity: .28; }
svg .lane.sel path, svg .lane.sel line, svg .lane.sel rect { stroke-width: 4; }
.wp-mark { animation: wp-in .4s var(--ease-spring) backwards; animation-delay: var(--d, 0ms); }
.wp-mark circle { fill: var(--surface); stroke: var(--volt); stroke-width: 2.5; }
.wp-mark text { fill: var(--text); font: 700 9px var(--font-mono, ui-monospace, monospace); }
.wp-mark.wp-wall circle { stroke: #ff3b30; fill: rgba(255, 59, 48, .25); }
.wp-mark.wp-half circle { stroke: var(--orange); }
@keyframes wp-in { from { opacity: 0; transform: translateY(-8px); } }
.pace-box, .pace-wheel-wrap { min-width: 0; }
.pace-panel { grid-template-columns: minmax(0, 1fr); min-width: 0; margin-top: 12px; padding: 14px; border-radius: 18px; background: var(--glass-soft); border: 1px solid var(--ring-a); display: grid; gap: 12px; }
.pace-head { display: flex; justify-content: space-between; font-weight: 700; }
.pace-unit { font-family: var(--font-mono, ui-monospace, monospace); color: var(--muted); }
.pace-wheel-wrap { position: relative; }
.pace-wheel-wrap::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 64px; margin-left: -32px; border-radius: 12px; background: var(--orange-soft); border: 1px solid rgba(255, 87, 34, .5); pointer-events: none; }
.pace-wheel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 calc(50% - 32px); scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); }
.pace-wheel::-webkit-scrollbar { display: none; }
.pace-wheel:focus-visible { outline: 2px solid var(--volt); outline-offset: 4px; border-radius: 12px; }
.pace-v { flex: 0 0 64px; scroll-snap-align: center; text-align: center; padding: 12px 0; font: 600 1rem var(--font-mono, ui-monospace, monospace); color: var(--muted); cursor: pointer; transition: color .15s, transform .15s; }
.pace-v.on { color: var(--text); transform: scale(1.18); font-weight: 800; }
.pace-result { display: flex; justify-content: space-between; align-items: baseline; }
.pace-finish { font-size: 1.75rem; color: var(--volt-ink); }
.pace-wps { display: grid; gap: 4px; }
.pace-wps .wp { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.03); font-size: .875rem; }
.pace-wps .wp-half { box-shadow: inset 3px 0 0 var(--orange); }
.pace-wps .wp-wall { box-shadow: inset 3px 0 0 #ff3b30; }
.pace-wps .wp-finish { box-shadow: inset 3px 0 0 var(--volt); font-weight: 700; }
.wp-t { color: var(--text-2); }

/* ---------- Cerimonia della medaglia ---------- */
.ceremony { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px;
  background: radial-gradient(70% 50% at 50% 35%, rgba(255, 87, 34, .25), transparent 70%), rgba(4, 5, 10, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fade-in .3s ease; text-align: center; }
.ceremony.is-pb { background: radial-gradient(70% 50% at 50% 35%, rgba(232, 185, 49, .35), transparent 70%), rgba(4, 5, 10, .9); }
.ceremony.out { animation: fade-out .3s ease forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.cer-stage { perspective: 800px; }
.cer-swing { width: min(56vw, 220px); transform-origin: 50% 0; animation: medal-drop 1.6s var(--ease-out) both; }
.cer-swing svg { width: 100%; height: auto; filter: drop-shadow(0 20px 30px rgba(0,0,0,.5)); }
.cer-sheen { animation: sheen 1.4s 1s ease-in-out; }
@keyframes medal-drop { 0% { transform: translateY(-120vh) rotate(0); } 45% { transform: translateY(0) rotate(14deg); } 62% { transform: rotate(-9deg); } 76% { transform: rotate(5deg); } 88% { transform: rotate(-2deg); } 100% { transform: rotate(0); } }
@keyframes sheen { to { transform: skewX(-20deg) translateX(360px); } }
.cer-copy { display: grid; gap: 8px; justify-items: center; max-width: 420px; animation: up .5s .7s var(--ease-out) backwards; }
.cer-copy h2 { font-size: clamp(1.5rem, 5vw, 2.2rem); }
.cer-pb { color: #FFD24A !important; font-size: .9rem; }
.cer-flash { position: absolute; inset: 0; background: #FFF6D0; pointer-events: none; animation: pb-flash 1.2s .75s ease-out both; }
@keyframes pb-flash { 0% { opacity: 0; } 8% { opacity: .9; } 100% { opacity: 0; } }

/* ---------- Bacheca dei pettorali ---------- */
.bib-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; padding: 18px 12px; border-radius: 22px;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0 2px, transparent 2px 9px), var(--surface); border: 1px solid var(--ring-a); }
.bib-card { position: relative; display: grid; gap: 4px; padding: 16px 12px 12px; border-radius: 10px; background: #F7F7F2; color: #12151C; cursor: pointer;
  transform: rotate(var(--tilt, 0deg)); box-shadow: 0 10px 22px -8px rgba(0,0,0,.55); border-top: 6px solid var(--sport, var(--orange)); transition: transform .3s var(--ease-spring); }
.bib-card:hover, .bib-card:focus-visible { transform: rotate(0) translateY(-3px) scale(1.02); }
.bib-card:focus-visible { outline: 3px solid var(--volt); outline-offset: 3px; }
.bib-top { font: 800 .5625rem/1 var(--font-mono, ui-monospace, monospace); letter-spacing: .12em; color: #5b6170; }
.bib-num, .bib-input { font: 800 2.4rem/1 var(--font-mono, ui-monospace, monospace); color: #12151C; background: none; border: 0; padding: 2px 0; text-align: left; cursor: text; border-radius: 6px; }
.bib-num:hover { background: rgba(0,0,0,.05); }
.bib-num:focus-visible { outline: 2px dashed var(--orange); }
.bib-input { background: #fff; box-shadow: inset 0 0 0 2px var(--orange); font-size: 2rem; }
.bib-name { font-size: .8125rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bib-card small { color: #4b5160; font-size: .6875rem; }
.bib-pin { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #8d96a8 60%, #4c5466); }
.bib-pin.a { left: 6px; top: 5px; } .bib-pin.b { right: 6px; top: 5px; } .bib-pin.c { left: 6px; bottom: 6px; } .bib-pin.d { right: 6px; bottom: 6px; }
.medal-hooks { grid-column: 1 / -1; display: flex; gap: 14px; overflow-x: auto; padding: 10px 4px 2px; border-top: 2px solid rgba(255,255,255,.08); }
.medal-hooks .hang { flex: 0 0 72px; display: grid; justify-items: center; gap: 4px; transform-origin: 50% 0; animation: hang 3s ease-in-out infinite alternate; }
.medal-hooks .hang:nth-child(2n) { animation-delay: -1.3s; }
.medal-hooks small { font-size: .625rem; color: var(--muted); text-align: center; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes hang { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }



/* ---------- Il tuo anno di gare ---------- */
.yr-cta { display: grid; gap: 4px; width: 100%; text-align: left; padding: 18px; border-radius: 22px; cursor: pointer; color: var(--text);
  background: radial-gradient(120% 140% at 0% 0%, rgba(255, 87, 34, .35), transparent 60%), radial-gradient(100% 120% at 100% 100%, rgba(204, 255, 0, .18), transparent 60%), var(--surface);
  border: 1px solid var(--ring-c); font-size: 1.125rem; }
.yr-cta:focus-visible { outline: 3px solid var(--volt); outline-offset: 3px; }
.year-review { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: calc(var(--safe-top, 0px) + 40px) 24px calc(var(--safe-bottom, 0px) + 24px);
  background: radial-gradient(80% 60% at 50% 70%, rgba(255, 87, 34, .35), transparent 70%), #04050A; color: #fff; animation: fade-in .3s ease; }
.yr-bars { position: absolute; left: 16px; right: 16px; top: calc(var(--safe-top, 0px) + 12px); display: flex; gap: 4px; }
.yr-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.25); overflow: hidden; }
.yr-bars b { display: block; height: 100%; width: 0; background: #fff; }
.yr-bars .done b { width: 100%; }
.yr-bars .now b { animation: yr-bar 4.2s linear forwards; }
@keyframes yr-bar { to { width: 100%; } }
.yr-close { position: absolute; right: 12px; top: calc(var(--safe-top, 0px) + 24px); z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 1.1rem; cursor: pointer; }
.yr-nav { position: absolute; top: 70px; bottom: 0; width: 34%; border: 0; background: none; cursor: pointer; z-index: 1; }
.yr-nav.prev { left: 0; } .yr-nav.next { right: 0; }
.yr-nav:focus-visible { outline: 2px solid var(--volt); outline-offset: -6px; }
.yr-stage { position: relative; z-index: 2; pointer-events: none; width: min(100%, 520px); }
.yr-stage button { pointer-events: auto; }
.yr-slide { display: grid; gap: 10px; justify-items: center; text-align: center; animation: up .5s var(--ease-out); }
.yr-slide .eyebrow { color: var(--volt); }
.yr-big { font-size: clamp(4.5rem, 24vw, 9rem); font-weight: 800; line-height: .95; letter-spacing: -.03em; background: linear-gradient(180deg, #fff, #ffb59a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.yr-track { width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.yr-track i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--orange), var(--volt)); transform-origin: left; animation: yr-track 1.3s var(--ease-out) both; }
@keyframes yr-track { from { transform: scaleX(0); } }
.yr-flags { font-size: clamp(2.5rem, 12vw, 4rem); line-height: 1.3; }
.yr-medal-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 12px; }

/* ---------- Testimone nella barra di navigazione ---------- */
.baton { position: absolute; z-index: 2; width: 26px; height: 6px; margin-left: -13px; border-radius: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--orange) 0 30%, #fff 30% 36%, var(--volt) 36%); box-shadow: 0 0 12px rgba(255, 87, 34, .6); }
:root[data-cvd="on"] .baton { background: linear-gradient(90deg, #56B4E9 0 30%, #fff 30% 36%, #F0E442 36%); }

/* ---------- "Via!": tieni premuto ---------- */
.onb-go { justify-items: center; text-align: center; }
.hold-wrap { display: grid; gap: 12px; justify-items: center; width: 100%; }
.hold-btn { position: relative; width: 168px; height: 168px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; touch-action: none; -webkit-user-select: none; user-select: none;
  background: radial-gradient(circle at 50% 40%, #ff7a45, var(--orange) 55%, #b9330b); box-shadow: var(--glow-orange), inset 0 -8px 20px rgba(0,0,0,.25);
  transform: scale(calc(1 - var(--p, 0) * .06)); transition: transform .2s var(--ease-spring); }
.hold-btn:focus-visible { outline: 3px solid var(--volt); outline-offset: 6px; }
.hold-ring { position: absolute; inset: -12px; }
.hold-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hold-ring circle { fill: none; stroke-width: 6; }
.hold-ring .bg { stroke: rgba(255,255,255,.12); }
.hold-ring .fg { stroke: var(--volt); stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(204,255,0,.7)); }
.hold-label { position: relative; font: 800 1.05rem/1.15 var(--font-display, inherit); text-transform: uppercase; letter-spacing: .04em; padding: 0 18px; }
.hold-btn.loaded { animation: loaded .5s ease-in-out infinite alternate; }
@keyframes loaded { to { box-shadow: 0 0 0 10px rgba(204, 255, 0, .18), 0 0 40px rgba(204, 255, 0, .55); } }

/* ---------- Meno animazioni: restano le funzioni, non il movimento ---------- */
:root[data-reduce-motion="on"] :is(.tm-lines, .tm-runner, .tm-leg-a, .tm-leg-b, .tm-arm-a, .tm-arm-b, .wx-fx i, .wx-flags .pennant, .wp-mark, .cer-swing, .cer-sheen, .cer-copy, .cer-flash, .medal-hooks .hang, .yr-slide, .yr-track i, .hold-btn.loaded, .lane-runner svg),
:root[data-reduce-motion="on"] .yr-bars .now b { animation: none !important; }
:root[data-reduce-motion="on"] .yr-bars .now b { width: 100%; }
:root[data-reduce-motion="on"] .wx-fx .flash, :root[data-reduce-motion="on"] .cer-flash, :root[data-reduce-motion="on"] .radius-ring { display: none; }
@media (prefers-reduced-motion: reduce) {
  :is(.tm-lines, .tm-runner, .tm-leg-a, .tm-leg-b, .tm-arm-a, .tm-arm-b, .wx-fx i, .wx-flags .pennant, .wp-mark, .cer-swing, .cer-sheen, .cer-copy, .cer-flash, .medal-hooks .hang, .yr-slide, .yr-track i, .hold-btn.loaded) { animation: none !important; }
  .wx-fx .flash, .cer-flash { display: none; }
}

/* =====================================================================
   THE STARTING LINE — "Mattino di gara"
   Terzo livello grafico, caricato dopo styles.css e premium.css.
   Idea: l'interfaccia come l'attrezzatura di un atleta, non come un'insegna al neon.
   - un solo carattere variabile, Archivo: titoli larghi e pieni, numeri stretti e tabulari;
   - colori dell'alba di gara, vivi e vicini al logo: blu inchiostro, arancio, lime, azzurro;
   - niente bagliori: profondità con superfici e bordi sottili, griglia da 8 punti;
   - risposte da iPhone: pressione che affonda, conferme brevi, menu al tocco prolungato.
   Il logo e i suoi colori non cambiano.
   ===================================================================== */

@font-face { font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url("fonts/Archivo-var.woff") format("woff"); }
@font-face { font-family: "Archivo"; font-style: italic; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url("fonts/Archivo-Italic-var.woff") format("woff"); }

/* ---------- Gettoni ---------- */
:root {
  /* Archivo: un solo carattere variabile (peso e larghezza). Titoli larghi e pieni, testo normale,
     numeri stretti e tabulari: dà ritmo, come le scritte sulle maglie e sui cronometri. */
  --plex: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--plex);
  --font-ui: var(--plex);
  --font-mono: var(--plex);

  /* spazi: griglia da 8 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --radius: 16px;
  --radius-sm: 10px;
  --press: .97;
  --dur-tap: 120ms;
  --ease-ios: cubic-bezier(.32, .72, 0, 1);
}
/* Alba di gara: notte che diventa giorno. Blu inchiostro profondo (come il fondo del logo),
   arancio del marchio per agire e scegliere, lime del logo per i numeri che contano,
   azzurro del cielo per le informazioni. Vivi ma mai fluo. */
:root:not([data-theme="light"]) {
  --obsidian: #0D1330;
  --surface: #161F45;
  --surface-2: #202B5A;
  --surface-3: #2B386F;
  --hairline: rgba(150, 172, 255, .14);
  --hairline-strong: rgba(150, 172, 255, .26);
  --text: #FFF8F0;
  --text-2: #DCE3FF;
  --muted: #A9B4E2;
  --faint: #9DA9DA;
  --volt: #D2F55A;          /* lime del logo, ammorbidito */
  --volt-ink: #D2F55A;
  --volt-soft: rgba(210, 245, 90, .14);
  --sky: #5CC6FF;
  --orange-soft: rgba(255, 87, 34, .18);
  --map-bg: #0B1029;
  --chip-on: #FF5722;
  --ring-a: rgba(150, 172, 255, .16);
  --ring-b: rgba(150, 172, 255, .04);
  --ring-c: rgba(255, 87, 34, .5);
  --glass-strong: rgba(14, 20, 50, .8);
  --glass-soft: rgba(150, 172, 255, .06);
  --glow-orange: 0 10px 28px -12px rgba(255, 87, 34, .7);
}
:root[data-theme="light"] {
  --obsidian: #F3F5FF;
  --surface: #FFFFFF;
  --surface-2: #E6EBFF;
  --surface-3: #D5DDFF;
  --hairline: rgba(30, 44, 110, .12);
  --hairline-strong: rgba(30, 44, 110, .22);
  --text: #121839;
  --text-2: #2A3466;
  --muted: #4A5584;
  --faint: #4F5A89;
  --volt: #4E7A00;
  --volt-ink: #3F6600;
  --volt-soft: rgba(78, 122, 0, .12);
  --sky: #0070B8;
  --chip-on-text: #FFFFFF;
  --glass-strong: rgba(255, 255, 255, .82);
  --glow-orange: 0 10px 24px -12px rgba(232, 70, 26, .55);
}
:root[data-cvd="on"] { --volt: #F0E442; --volt-ink: #F0E442; }
:root[data-cvd="on"][data-theme="light"] { --volt-ink: #0072B2; }

/* ---------- Base ---------- */
body,
:root[data-theme="light"] body {
  font: 400 0.9375rem/1.5 var(--plex);
}
h1, h2, h3, h4 { font-family: var(--plex); font-stretch: 118%; font-weight: 800; letter-spacing: -0.02em; }
.display, .card .title, .hero h1, .sheet-hero h2, .yr-big, .cer-copy h2 { font-stretch: 122%; font-weight: 850; letter-spacing: -0.025em; }
.num, .mono, .countdown .v, .tile .big, .stat .v, .metric .v { font-variant-numeric: tabular-nums; font-stretch: 88%; letter-spacing: 0; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Etichette in maiuscolo spaziato: via. Si legge meglio e non sembra un template. */
.eyebrow, .stat .k, .countdown .u, .field, .tabbar a, .lane-km, .pb-text, .bib-top, .yr-slide .eyebrow {
  text-transform: none; letter-spacing: 0;
}
.eyebrow { font-size: .75rem; font-weight: 500; color: var(--muted); text-shadow: none; }
.section-head h2,
:root:not([data-theme="light"]) .section-head h2 {
  background: none; color: var(--text); -webkit-background-clip: border-box; background-clip: border-box;
  font-size: clamp(1.125rem, .8vw + 1rem, 1.375rem); letter-spacing: -.035em;
}
.section-head { margin-bottom: var(--s3); }
.section-head p { font-size: .75rem; }
.section { margin-top: var(--s6); }

/* ---------- Barre ---------- */
.glass, :root[data-theme="light"] .glass {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-color: var(--hairline);
}
.topbar { gap: var(--s3); }
.brand-text { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; } /* il marchio depositato non cambia carattere */
.brand-text b { letter-spacing: .08em; font-weight: 500; }
.brand-text span { font-weight: 700; letter-spacing: -.02em; }
.tabbar.glass { box-shadow: 0 12px 30px -18px rgba(0, 0, 0, .7); }
.tabbar a { font-size: .6875rem; font-weight: 500; color: var(--muted); }
.tabbar a[aria-current="page"],
:root[data-cvd="on"] .tabbar a[aria-current="page"] { box-shadow: none; }
.tabbar a[aria-current="page"] svg { stroke: var(--orange); filter: none; }
.baton, :root[data-cvd="on"] .baton { background: var(--orange); box-shadow: none; }
.units { border-radius: 999px; }

/* ---------- Ricerca e campi ---------- */
.search input { border-color: var(--hairline); font-family: var(--plex); }
.search input:focus { border-color: var(--hairline-strong); }
.field { font-size: .75rem; font-weight: 500; }
.field input, .field select { border-radius: 10px; font-family: var(--plex); font-size: .875rem; }

/* ---------- Selezione: capsule chiare, spunta, nessun bagliore ---------- */
.chip {
  min-height: 36px; font-size: .8125rem;
  border-color: var(--hairline-strong); box-shadow: none;
}
.chip[aria-pressed="true"],
.chip[style*="--sport"][aria-pressed="true"],
.chip.toggle[aria-pressed="true"] {
  border-color: var(--chip-on); box-shadow: none;
}
.chip[aria-pressed="true"]::after {
  content: ""; display: inline-block; width: 10px; height: 6px; margin-left: 8px; vertical-align: 2px;
  border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px);
}
.chip[style*="--sport"]::before { box-shadow: none; width: 7px; height: 7px; }

.seg { border-radius: 10px; padding: 2px; background: var(--surface-2); border-color: transparent; }
.seg button { border-radius: 8px; font-weight: 500; min-height: 34px; }
.seg button[aria-pressed="true"] { box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }


/* ---------- Pulsanti ---------- */
.btn { font-weight: 600; letter-spacing: -.01em; box-shadow: none; background: var(--surface-2); border-color: transparent; }

.btn.ghost { border-color: var(--hairline-strong); }
.btn.volt { background: var(--volt); color: #14171B; border-color: transparent; }
.btn:hover { filter: brightness(1.06); }

/* ---------- Schede gara ---------- */
.card, .tile, .hero, .panel, .stat, .circuit-tile {
  border-radius: var(--radius); border-color: var(--hairline); box-shadow: none;
}
.card, :root[data-cvd="on"] .card { background: var(--surface); box-shadow: none; }
.card:hover { box-shadow: none; transform: none; }
.card .title { letter-spacing: -.03em; font-weight: 600; }
.badge { font-family: var(--plex); }
.badge.live { background: var(--volt); color: #14171B; }
.badge.circuit { color: #FFB59C; }
.tile .big, .stat .v { font-weight: 600; }

.tile.orange { background: var(--surface); }
.stat { background: var(--surface); }
.stat .k { font-size: .75rem; font-weight: 500; }
.panel { background: var(--surface); }

/* Il conto alla rovescia sembra un display di cronometraggio, non un'insegna. */
.countdown .cell { border-color: transparent; border-radius: 10px; }
.countdown .v { text-shadow: none; font-weight: 600; }
.countdown .u { font-size: .6875rem; }

/* Stati vuoti senza bordo tratteggiato */
.empty { border-style: solid; border-color: var(--hairline); background: var(--surface); }

/* ---------- Foglio di dettaglio ---------- */
.sheet { border-radius: 20px 20px 0 0; }
.sheet-hero h2 { letter-spacing: -.04em; font-weight: 600; }

/* ---------- Risposta al tocco (iOS): affonda leggermente, poi torna ---------- */
.btn, .chip, .card, .tile, .seg button, .tabbar a, .save-btn, .share-btn, .disc-item, .circuit-tile {
  transition: transform var(--dur-tap) var(--ease-ios), background-color .2s ease, filter .2s ease, opacity .2s ease;
  -webkit-touch-callout: none;
}
.btn:active, .chip:active, .seg button:active, .tabbar a:active, .save-btn:active, .share-btn:active { transform: scale(var(--press)); }
.card:active, .tile:active, .disc-item:active, .circuit-tile:active { transform: scale(.985); }
.card.is-pressing { transform: scale(.96); transition-duration: .45s; }

/* =====================================================================
   PATTERN DI FEEDBACK iOS (js/feedback.js)
   ===================================================================== */

/* HUD di conferma al centro (come "Aggiunto" su iOS) */
.ios-hud {
  position: fixed; z-index: 140; left: 50%; top: 50%; width: 156px; min-height: 156px; padding: 22px 16px 18px;
  transform: translate(-50%, -50%); display: grid; justify-items: center; align-content: center; gap: 12px; text-align: center;
  border-radius: 22px; color: var(--text);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  pointer-events: none; animation: hud-in .32s var(--ease-ios) both;
}
:root[data-theme="light"] .ios-hud { background: rgba(255, 255, 255, .86); box-shadow: 0 10px 40px -10px rgba(0, 0, 0, .25); }
.ios-hud.out { animation: hud-out .28s ease forwards; }
.ios-hud svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ios-hud svg path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: hud-draw .42s .08s var(--ease-ios) forwards; }
.ios-hud b { font-weight: 600; font-size: .875rem; }
@keyframes hud-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.86); } }
@keyframes hud-out { to { opacity: 0; transform: translate(-50%, -50%) scale(.94); } }
@keyframes hud-draw { to { stroke-dashoffset: 0; } }

/* Banner dall'alto (al posto del toast in basso), con "Annulla" quando serve */
.toast-host { position: fixed; z-index: 130; left: 0; right: 0; top: calc(var(--safe-top) + 8px); display: grid; justify-items: center; pointer-events: none; padding: 0 var(--s4); }
.ios-banner {
  pointer-events: auto; width: min(100%, 420px); display: flex; align-items: center; gap: var(--s3);
  padding: 12px 14px; border-radius: 18px; background: var(--glass-strong); color: var(--text);
  border: 1px solid var(--hairline); box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  animation: banner-in .42s var(--ease-ios) both; touch-action: pan-x;
}
.ios-banner.out { animation: banner-out .3s var(--ease-ios) forwards; }
.ios-banner .ico { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--orange); color: #fff; }
.ios-banner .ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ios-banner p { margin: 0; flex: 1; font-size: .8125rem; line-height: 1.35; }
.ios-banner button { flex: none; border: 0; background: var(--surface-3); color: var(--text); font: 600 .8125rem var(--plex); padding: 7px 12px; border-radius: 999px; cursor: pointer; }
@keyframes banner-in { from { opacity: 0; transform: translateY(-120%); } }
@keyframes banner-out { to { opacity: 0; transform: translateY(-120%); } }

/* Menu contestuale al tocco prolungato: anteprima sollevata + elenco di azioni */
.ctx-scrim { position: fixed; inset: 0; z-index: 125; background: rgba(8, 10, 12, .45); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: fade-in .25s ease; }
.ctx-scrim.out { animation: fade-out .2s ease forwards; }
.ctx-wrap { position: fixed; z-index: 126; left: var(--s4); right: var(--s4); display: grid; gap: var(--s2); max-width: 420px; margin: 0 auto; animation: ctx-in .38s var(--ease-ios) both; }
.ctx-preview { border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .9); pointer-events: none; }
.ctx-preview .card { margin: 0; border: 0; }
.ctx-menu { margin: 0; padding: 0; list-style: none; border-radius: 14px; overflow: hidden; background: var(--glass-strong); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); border: 1px solid var(--hairline); }
.ctx-menu button { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 13px 16px; font: 400 .9375rem var(--plex); color: var(--text); cursor: pointer; }
.ctx-menu li + li button { border-top: 1px solid var(--hairline); }
.ctx-menu button:active, .ctx-menu button:focus-visible { background: rgba(236, 233, 226, .08); }
.ctx-menu button.danger { color: #FF6B6B; }
.ctx-menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes ctx-in { from { opacity: 0; transform: scale(.94); } }

/* Scheletri di caricamento */
.skeleton { border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* =====================================================================
   CINEMA: transizione in prima persona (js/cinema.js)
   ===================================================================== */
.cinema { position: fixed; inset: 0; z-index: 150; overflow: hidden; touch-action: none; cursor: pointer; }
.cinema canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cinema .bars::before, .cinema .bars::after { content: ""; position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 2; transition: height .7s var(--ease-ios); }
.cinema .bars::before { top: 0; } .cinema .bars::after { bottom: 0; }
.cinema.rolling .bars::before, .cinema.rolling .bars::after { height: 9vh; }
.cinema .rec { position: absolute; z-index: 3; top: calc(var(--safe-top) + 9vh + 10px); left: 16px; display: flex; gap: 8px; align-items: center; font: 500 .6875rem var(--plex); color: rgba(255, 255, 255, .85); opacity: 0; transition: opacity .6s ease; }
.cinema.rolling .rec { opacity: 1; }
.cinema .rec i { width: 8px; height: 8px; border-radius: 50%; background: #FF3B30; animation: rec 1s steps(1) infinite; }
@keyframes rec { 50% { opacity: .2; } }
.cinema .skip-hint { position: absolute; z-index: 3; right: 16px; font: 500 .75rem var(--plex); color: rgba(255, 255, 255, .7); }
.cinema .title-card { position: absolute; z-index: 3; left: 20px; right: 20px; color: #fff; opacity: 0; transform: translateY(8px); transition: opacity .8s ease, transform .8s var(--ease-ios); text-shadow: 0 2px 20px rgba(0, 0, 0, .6); }
.cinema .title-card.on { opacity: 1; transform: none; }
.cinema .title-card small { display: block; font: 500 .75rem var(--plex); opacity: .8; margin-bottom: 4px; }
.cinema .title-card b { display: block; font: 600 clamp(1.25rem, 5vw, 2rem)/1.1 var(--plex); letter-spacing: -.04em; }

@keyframes cinema-out { to { opacity: 0; } }

/* Meno animazioni: niente transizioni di pressione o banner che scorrono */
:root[data-reduce-motion="on"] :is(.ios-hud, .ios-banner, .ctx-wrap, .skeleton) { animation: none !important; }
:root[data-reduce-motion="on"] .ios-hud svg path { animation: none; stroke-dashoffset: 0; }
:root[data-reduce-motion="on"] :is(.btn, .chip, .card, .tile):active { transform: none; }
@media (prefers-reduced-motion: reduce) {
  :is(.ios-hud, .ios-banner, .ctx-wrap, .skeleton) { animation: none !important; }
  .ios-hud svg path { animation: none; stroke-dashoffset: 0; }
}

/* ---------- Ritocchi dopo la prima revisione ---------- */
.btn, .icon-btn, .a11y-btn, .units, .seg { box-shadow: none; background-image: none; }
.units { background: var(--surface-2); border-color: transparent; padding: 2px; }
.units button { font-family: var(--plex); font-weight: 600; }


.a11y-btn { background: var(--surface-2); border-color: transparent; }
.seg button { font-size: .75rem; padding: 6px 10px; white-space: nowrap; }
.tile, :root[data-theme="light"] .tile { background: var(--surface); box-shadow: none; }
.hero { box-shadow: none; }
.save-btn, .share-btn { background: rgba(20, 23, 27, .55); border-color: rgba(236, 233, 226, .14); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
/* sulle copertine grandi il testo sta sopra il cielo: lo scuriamo come un controluce */


.metric .k, .disc-head small, .badge { text-transform: none; letter-spacing: 0; }
.metric .k { font-size: .6875rem; font-weight: 500; }



/* =====================================================================
   ALBA DI GARA — colori vivi e ritmo
   ===================================================================== */
body, :root[data-theme="light"] body {
  background:
    radial-gradient(900px 520px at 85% -8%, rgba(255, 87, 34, .16), transparent 62%),
    radial-gradient(800px 480px at -10% 8%, rgba(92, 198, 255, .10), transparent 60%),
    var(--obsidian);
  background-attachment: fixed;
}
.btn.primary { box-shadow: var(--glow-orange); }
.btn.primary:hover { filter: brightness(1.08); }
.countdown .cell { background: var(--surface-2); }
.countdown .v { color: var(--volt-ink); }
.tile.accent .big { color: var(--volt-ink); }
.tile .big { color: var(--text); }
.stat .k { color: var(--sky); }
.metric .k { color: var(--muted); }
.section-head h2::after { content: ""; width: 28px; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--orange); }

.chip[style*="--sport"][aria-pressed="true"]::before { background: #fff; }

.units button[aria-pressed="true"] { background: var(--orange); }
.ios-hud { background: rgba(32, 43, 90, .88); }
.link-btn { color: #FF7A4A; }
.badge { background: rgba(13, 19, 48, .72); }
.hero .art, .sheet-hero .art { filter: brightness(.74) saturate(1.05); }
:root[data-theme="light"] .hero .art, :root[data-theme="light"] .sheet-hero .art { filter: brightness(.78); }
:root[data-theme="light"] .link-btn { color: #C2400F; }
:root[data-theme="light"] .btn.volt { background: #3F6600; color: #FFFFFF; }

:root[data-theme="light"] .stat .k { color: #0060A0; }

/* Ogni elemento al suo passo: comparsa in rapida successione */

@keyframes step-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
:root[data-reduce-motion="on"] .step { animation: none; }
@media (prefers-reduced-motion: reduce) { .step { animation: none; } }

/* La scena in prima persona entra dalla scheda toccata e si dissolve nel dettaglio */
.cinema { background: transparent; transition: clip-path .55s cubic-bezier(.2, .8, .2, 1), border-radius .55s ease; }
.cinema.out { animation: none; opacity: 0; transform: scale(1.06); filter: blur(6px); transition: opacity .45s ease, transform .5s cubic-bezier(.2, .8, .2, 1), filter .45s ease; }
.cinema .rec, .cinema .bars { display: none; }
.cinema .title-card { bottom: calc(var(--safe-bottom) + 40px); }
.cinema .skip-hint { bottom: calc(var(--safe-bottom) + 16px); }
/* testo sull'arancio: inchiostro scuro (contrasto AA), nel tema chiaro arancio più profondo */
:root:not([data-theme="light"]) { --chip-on-text: #0D1330; }
.units button[aria-pressed="true"] { color: #0D1330; font-weight: 700; }
:root[data-theme="light"] { --chip-on: #C4390F; }
:root[data-theme="light"] .units button[aria-pressed="true"] { background: #C4390F; color: #fff; }

/* =====================================================================
   COPERTINA VIVA — la partenza è la testata della gara (js/cinema.js)
   ===================================================================== */
.sheet-hero {
  /* più alta e "appiccicata": scorrendo si accorcia fino a una fascia, e la corsa continua lì */
  --hero-h: min(56vh, 480px);
  height: var(--hero-h); min-height: 0;
}
.live-cover {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; display: block;
  opacity: 0; transition: opacity .55s ease;
}
.live-cover.on { opacity: 1; }
/* sopra la scena, una sfumatura che tiene leggibili titolo e countdown */
.sheet-hero::after { background: linear-gradient(180deg, rgba(13, 19, 48, .0) 35%, rgba(13, 19, 48, .82) 100%) !important; }
/* titolo che entra parola per parola */
.sheet-hero h2 .w { display: inline-block; animation: word-in .6s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--d0, 0ms) + var(--i, 0) * 32ms + 120ms); }
@keyframes word-in { from { opacity: 0; transform: translateY(.45em) rotate(2deg); filter: blur(4px); } }
/* il passaggio scheda → gara è più lungo e morbido */
::view-transition-group(race-art) { animation-duration: .62s; animation-timing-function: cubic-bezier(.2, .9, .1, 1); }
:root[data-reduce-motion="on"] .sheet-hero h2 .w { animation: none; }
@media (prefers-reduced-motion: reduce) { .sheet-hero h2 .w { animation: none; } }
:root[data-reduce-motion="on"] .sheet-hero { position: relative; top: auto; height: auto; min-height: 280px; }
.sheet-hero > canvas.live-cover { position: absolute !important; inset: 0; z-index: 0 !important; will-change: transform; }
.sheet-hero > .art { z-index: -1; }
.sheet-hero::after { z-index: 0; }

/* =====================================================================
   IDENTITÀ "LINEA DI PARTENZA" — niente card morbide e pillole tonde:
   tagli diagonali a 12° (come una linea di partenza vista in corsa), liste come una start list,
   schede in evidenza come pettorali, numeri da tabellone.
   ===================================================================== */
:root { --cut: 10px; }
/* --- selezione: parallelogrammi pieni al posto delle pillole --- */
.chip, .seg button, .units button, .badge {
  clip-path: polygon(var(--cut) 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%);
}
.chip { border: 0; border-radius: 0; padding: 8px 20px; background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.chip:hover { background: var(--surface-3); }
.chip[aria-pressed="true"], .chip[style*="--sport"][aria-pressed="true"], .chip.toggle[aria-pressed="true"] { background: var(--orange); color: #0D1330; }
.chip[data-mark]::before, .chip[style*="--sport"]::before {
  content: attr(data-mark); width: auto; height: auto; border-radius: 0; background: none !important; box-shadow: none;
  color: var(--sport, var(--orange)); font-size: .8em; margin-right: 7px; vertical-align: 1px;
}
.chip[aria-pressed="true"][data-mark]::before { color: #0D1330; }
.chip:focus-visible, .seg button:focus-visible, .units button:focus-visible { clip-path: none; outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
.seg, .units { background: transparent; border: 0; padding: 0; gap: 4px; border-radius: 0; }
.seg button, .units button { border-radius: 0; background: var(--surface-2); padding: 7px 16px; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--obsidian); }
.badge { border: 0; border-radius: 0; padding: 4px 12px; font-weight: 700; letter-spacing: .02em; }
.badge.sport { background: var(--sport, var(--orange)); color: #0D1330; }

/* --- titoli di sezione: una barra obliqua arancio, come un segno di corsia --- */
.section-head h2::after { display: none; }
.section-head h2::before { content: ""; display: inline-block; width: 9px; height: .82em; margin-right: 10px; background: var(--orange); transform: skewX(-14deg); vertical-align: -.05em; }

/* --- ricerca: una riga da scrivere, non una pillola --- */
.search input { border: 0; border-bottom: 2px solid var(--hairline-strong); border-radius: 0; background: transparent; font-size: 1.125rem; font-stretch: 108%; font-weight: 600; padding-left: 36px; }
.search input:focus { border-bottom-color: var(--orange); box-shadow: none; }

/* --- barra in basso: niente pillola, solo l'icona che si accende e il testimone --- */
.tabbar a[aria-current="page"], :root[data-cvd="on"] .tabbar a[aria-current="page"] { background: transparent; color: var(--orange); }
.baton, :root[data-cvd="on"] .baton { width: 24px; margin-left: -12px; height: 4px; transform: skewX(-20deg); }

/* --- pulsanti: spigoli vivi e taglio obliquo sul principale --- */
.btn { border-radius: 6px; }
.btn.primary { border-radius: 0; clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%); padding-inline: 26px; }
.btn.primary:focus-visible { clip-path: none; border-radius: 6px; }

/* --- la "gara in evidenza" in home: taglio diagonale in basso, numeri da tabellone --- */
.hero { border-radius: 8px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), 0 100%); padding-bottom: 40px; }

/* --- binari orizzontali (Vicino a te…): schede-pettorale con perforazione --- */



.rail .card .info::before, .rail .card .info::after { content: ""; position: absolute; top: -9px; width: 16px; height: 16px; border-radius: 50%; background: var(--obsidian); }

.rail .card .info::before { left: -22px; } .rail .card .info::after { right: -22px; }

/* --- liste (Esplora, Le mie gare): una START LIST, righe sottili con lo spicchio di copertina --- */
#grid, .section .grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
#grid .card, .section .grid .card {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 14px;
  border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; background: transparent; box-shadow: none;
  padding: 16px 0; overflow: visible;
}
#grid .card::before, #grid .card::after, .section .grid .card::before, .section .grid .card::after { display: none; }
#grid .card .media, .section .grid .card .media { display: contents; }
#grid .card .media::after, .section .grid .card .media::after { display: none; }
#grid .card .art, .section .grid .card .art {
  position: relative; inset: auto; grid-column: 1; grid-row: 1 / 4; width: 84px; height: 100%; min-height: 108px;
  clip-path: polygon(16px 0, 100% 0, calc(100% - 16px) 100%, 0 100%); z-index: 0; filter: saturate(1.1);
}
#grid .card .badges, .section .grid .card .badges { grid-column: 2; grid-row: 1; padding-right: 92px; }
#grid .card .title, .section .grid .card .title { grid-column: 2; grid-row: 2; margin: 6px 0 0; padding: 0; font-size: 1.0625rem; color: var(--text); text-shadow: none; }
#grid .card .info, .section .grid .card .info { grid-column: 2; grid-row: 3; padding: 8px 0 0; gap: 8px; }
#grid .card .save-btn, #grid .card .share-btn, .section .grid .card .save-btn, .section .grid .card .share-btn { top: 12px; width: 38px; height: 38px; }
#grid .card .badge, .section .grid .card .badge { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: var(--surface-2); }
#grid .card .badge.sport, .section .grid .card .badge.sport { background-color: var(--sport, var(--orange)); }
#grid .card:active, .section .grid .card:active { background: var(--glass-soft); }
:root[data-theme="light"] #grid .card .title { color: var(--text); }

/* --- dentro la gara: ogni elemento al suo passo, rapido ma in fila --- */
.step { animation: step-in .5s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--d0, 0ms) + var(--i, 0) * 42ms + 80ms); }
@keyframes step-in { from { opacity: 0; transform: translate3d(-12px, 18px, 0) scale(.97); } }
.search input, .search input[type="search"] { padding-left: 42px !important; }
:root[data-theme="light"] .seg button[aria-pressed="true"] { background: #121839; color: #FFFFFF; }

/* =====================================================================
   GESTI E RISPOSTE AL TOCCO (js/touch.js e app.js)
   ===================================================================== */
/* 2. pettorale da strappare */
.tearable { touch-action: pan-y; position: relative; will-change: transform; }
.tear-under { position: absolute; z-index: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 22px;
  background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255,255,255,.18) 6px 10px) right 64px top 0 / 2px 100% no-repeat, #3A1A2A;
  color: #FFB4A6; font-weight: 700; font-size: .8125rem; pointer-events: none; transition: background-color .2s ease, opacity .3s ease; }
.tear-under.armed { background-color: #B3261E; color: #fff; }
.tear-under span { transform: skewX(-10deg); }
.tear-half { background: var(--obsidian); }
/* 4. countdown che respira e semaforo del giorno di gara */
.countdown.near .cell { animation: breathe 2.4s ease-in-out infinite; }
.countdown.near .cell:nth-child(2) { animation-delay: .15s; } .countdown.near .cell:nth-child(3) { animation-delay: .3s; } .countdown.near .cell:nth-child(4) { animation-delay: .45s; }
@keyframes breathe { 50% { transform: scale(1.06); box-shadow: 0 0 0 1px rgba(255, 87, 34, .5), 0 8px 24px -10px rgba(255, 87, 34, .7); } }
.semaphore { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: rgba(13, 19, 48, .8); clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.semaphore .l { width: 18px; height: 18px; border-radius: 50%; background: #2A2F45; }
.semaphore .red { animation: sem-red 3s steps(1) infinite; } .semaphore .amber { animation: sem-amber 3s steps(1) infinite; } .semaphore .green { animation: sem-green 3s steps(1) infinite; }
@keyframes sem-red { 0%, 33% { background: #FF3B30; box-shadow: 0 0 14px #FF3B30; } }
@keyframes sem-amber { 33%, 66% { background: #FFB020; box-shadow: 0 0 14px #FFB020; } }
@keyframes sem-green { 66%, 100% { background: #34C759; box-shadow: 0 0 14px #34C759; } }
.semaphore b { font-weight: 800; font-stretch: 115%; margin-left: 4px; }
/* 5. filtri a scatto: la capsula si riempie da sinistra a destra */
.chip[aria-pressed="true"] { background: linear-gradient(90deg, var(--orange) 0 0) left / 100% 100% no-repeat, var(--surface-2); animation: chip-fill .32s cubic-bezier(.2,.9,.1,1); }
@keyframes chip-fill { from { background-size: 0% 100%, auto; } }
/* 6. schede che volano sulla mappa */
.map-ghost { position: fixed; z-index: 90; pointer-events: none; background: var(--c, #FF5722); box-shadow: 0 0 0 2px rgba(255,255,255,.7), 0 10px 30px -8px rgba(0,0,0,.6); }
/* 8. staffetta: la pagina entra dal lato verso cui corre il testimone */
:root[data-vt="page"][data-dir="fwd"]::view-transition-old(root) { animation: relay-out-l .32s cubic-bezier(.4,0,.2,1) both; }
:root[data-vt="page"][data-dir="fwd"]::view-transition-new(root) { animation: relay-in-r .46s cubic-bezier(.2,.9,.1,1) both; }
:root[data-vt="page"][data-dir="back"]::view-transition-old(root) { animation: relay-out-r .32s cubic-bezier(.4,0,.2,1) both; }
:root[data-vt="page"][data-dir="back"]::view-transition-new(root) { animation: relay-in-l .46s cubic-bezier(.2,.9,.1,1) both; }
@keyframes relay-out-l { to { opacity: 0; transform: translateX(-12%) skewX(4deg); } }
@keyframes relay-out-r { to { opacity: 0; transform: translateX(12%) skewX(-4deg); } }
@keyframes relay-in-r { from { opacity: 0; transform: translateX(16%) skewX(-4deg); } }
@keyframes relay-in-l { from { opacity: 0; transform: translateX(-16%) skewX(4deg); } }
.baton { transition: none; }
/* 9. distanza da tenere premuta */
.route-chips .chip.holding { background: var(--volt); color: #0D1330; }
.lane.drawing .route-line, .lane.drawing .route-glow { transition: none; }
.wp-mark { transition: opacity .2s ease; }
.lane.drawing .wp-mark:not(.lit) { opacity: .2; }
.wp-mark.lit circle { fill: var(--volt); }
/* meno animazioni: nessun movimento */
:root[data-reduce-motion="on"] :is(.countdown.near .cell, .chip[aria-pressed="true"]) { animation: none; }
:root[data-reduce-motion="on"] .semaphore .l { animation: none; }
:root[data-reduce-motion="on"] .semaphore .green { background: #34C759; }
:root[data-reduce-motion="on"]::view-transition-old(root), :root[data-reduce-motion="on"]::view-transition-new(root) { animation: none !important; }
.section .grid { position: relative; }
.section .grid .card.tearable { background: var(--obsidian); z-index: 1; }
#grid .card:hover, .section .grid .card:hover, #grid .card.is-tilting, .section .grid .card.is-tilting { transform: none; }
.tearable.tearing { animation: none !important; }

/* la copertina non resta appiccicata: scorrendo esce di scena (la scena sfuma) e torna risalendo */
.sheet-hero { position: relative; top: auto; z-index: auto; }

/* ---------- Ghiera dei tempi (PB e diario) ---------- */
.time-wheel { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; background: var(--surface-2); clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%); }
.time-wheel::before { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: 40px; margin-top: -20px; background: rgba(255, 87, 34, .16); border-top: 1px solid rgba(255, 87, 34, .6); border-bottom: 1px solid rgba(255, 87, 34, .6); pointer-events: none; }
.tw-cell { display: grid; justify-items: center; gap: 2px; }
.tw-col { position: relative; width: 64px; height: 120px; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.tw-col::-webkit-scrollbar { display: none; }
.tw-col:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.tw-list { padding: 40px 0; }
.tw-item { height: 40px; display: grid; place-items: center; scroll-snap-align: center; font-size: 1.375rem; font-weight: 600; font-variant-numeric: tabular-nums; font-stretch: 90%; color: var(--muted); cursor: pointer; transition: color .15s, transform .15s; }
.tw-item.on { color: var(--text); font-weight: 800; transform: scale(1.12); }
.tw-unit { font-size: .6875rem; color: var(--muted); }
.tw-sep { font-size: 1.5rem; font-weight: 800; color: var(--orange); margin-top: -16px; }

/* ---------- Home: corsie di locandine (Esplora resta la start list) ----------
   Stesso linguaggio di Esplora (taglio obliquo, barra del colore dello sport, Archivo largo),
   ma in Home le gare scorrono in orizzontale come locandine affiancate. */
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(72vw, 258px); grid-template-columns: none;
  gap: 12px; overflow-x: auto; overflow-y: visible; scroll-snap-type: x mandatory; scroll-padding-left: 16px;
  margin: 0 -16px; padding: 4px 16px 16px; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-wrap::after { display: none; }
.rail > .card { scroll-snap-align: start; }
.rail .card {
  position: relative; display: flex; flex-direction: column; min-height: 0; padding: 0; margin: 0;
  border: 0; border-radius: 0; background: var(--surface); box-shadow: none; overflow: hidden;
  clip-path: polygon(16px 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
}
.rail .card::before { display: none; }
.rail .card .media { position: relative; display: block; height: 176px; min-height: 0; clip-path: none; overflow: hidden; }
.rail .card .media::after { content: ''; position: absolute; inset: 40% 0 0; background: linear-gradient(to bottom, transparent, rgba(13,19,48,.92)); display: block; }
.rail .card .art { position: absolute; inset: 0; width: 100%; height: 100%; clip-path: none; }
.rail .card .badges { position: absolute; left: 24px; top: 14px; right: 96px; z-index: 2; padding: 0; }
.rail .card .title {
  position: absolute; left: 24px; right: 22px; bottom: 12px; z-index: 2; margin: 0; padding: 0;
  font-size: 1.28rem; font-weight: 850; font-stretch: 115%; line-height: 1.04; color: #FFF8F0; text-shadow: 0 2px 12px rgba(0,0,0,.5);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rail .card::after { content: ''; position: absolute; left: 0; right: 0; top: 176px; height: 4px; background: var(--sport, var(--orange)); display: block; z-index: 2; }
.rail .card .info { position: static; padding: 14px 24px 18px; margin: 0; gap: 8px; border-top: 0; flex: 1; }
.rail .card .info::before, .rail .card .info::after { display: none; }
.rail .card .save-btn, .rail .card .share-btn { top: 10px; width: 38px; height: 38px; z-index: 3; }
.rail .card .save-btn { right: 12px; } .rail .card .share-btn { right: 56px; }
.rail .card:hover { transform: none; }
:root[data-theme="light"] .rail .card { background: #FFFFFF; }
:root[data-theme="light"] .rail .card .title { color: #FFF8F0; }
.card, .sheet-hero { touch-action: manipulation; }

/* ---------- Macro tasto "Trova la tua gara" ---------- */
.macro {
  position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; column-gap: 14px;
  width: 100%; margin: 14px 0 6px; padding: 20px 24px 18px; border: 0; cursor: pointer; text-align: left; font: inherit; color: #0D1330;
  background: linear-gradient(115deg, #5CC6FF 0%, #7FD8FF 42%, #D2F55A 100%);
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); overflow: hidden; isolation: isolate;
  transition: transform .18s var(--ease-out, ease-out);
}
.macro:active { transform: scale(.975); }
.macro:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.macro-ico { width: 56px; height: 56px; display: grid; place-items: center; background: #0D1330; color: #D2F55A; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.macro-ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.macro-txt { display: grid; gap: 4px; min-width: 0; }
.macro-txt b { font-size: 1.5rem; font-weight: 850; font-stretch: 120%; line-height: 1.02; letter-spacing: -.01em; }
.macro-txt small { font-size: .84rem; line-height: 1.3; color: #14204A; font-weight: 550; }
.macro-marks { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 14px; }
.macro-marks i { flex: 1; height: 5px; background: var(--sport); transform: skewX(-24deg); }
/* acqua che respira sotto il tasto: tre anelli che si allargano lenti */
.macro-water { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.macro-water i { position: absolute; left: 52px; top: 48px; width: 60px; height: 60px; margin: -30px; border: 2px solid rgba(255,255,255,.75); border-radius: 50%; opacity: 0; animation: macro-ring 3.6s cubic-bezier(.2,.6,.3,1) infinite; }
.macro-water i:nth-child(2) { animation-delay: 1.2s; } .macro-water i:nth-child(3) { animation-delay: 2.4s; }
@keyframes macro-ring { 0% { transform: scale(.4); opacity: 0; } 12% { opacity: .9; } 100% { transform: scale(7); opacity: 0; } }
.macro.diving { transform: scale(.96); }
:root[data-reduce-motion="on"] .macro-water i { animation: none; }
@media (prefers-reduced-motion: reduce) { .macro-water i { animation: none; } }

.splash-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 10000; pointer-events: auto; }

/* ---------- Cuore del doppio tocco ---------- */
.heart-burst { position: fixed; z-index: 9999; width: 0; height: 0; pointer-events: none; }
.heart-burst svg { position: absolute; left: -44px; top: -44px; width: 88px; height: 88px; fill: #FF5722; stroke: #FFF8F0; stroke-width: 1.2; filter: drop-shadow(0 6px 18px rgba(255,87,34,.55)); }
.heart-burst i { position: absolute; left: 0; top: 0; width: 9px; height: 9px; transform: translate(-50%,-50%); clip-path: polygon(30% 0, 100% 0, 70% 100%, 0 100%); }

/* ---------- Record personali: ogni distanza è un tasto ---------- */
button.pb { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
button.pb:not(.has) { opacity: 1; border-style: dashed; }
button.pb:active { transform: scale(.97); }
.pb-wheel .time-wheel { margin-top: 6px; }

/* ---------- Menu delle corsie (dopo il tocco sul macro tasto) ---------- */
.relay-ui { position: fixed; inset: 0; z-index: 10001; pointer-events: none; animation: relay-ui-in .3s ease-out both; }
.relay-ui.out { animation: relay-ui-out .2s ease-in forwards; }
.relay-hint {
  position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 18px); transform: translateX(-50%); margin: 0;
  padding: 8px 16px; background: #0D1330; color: #FFF8F0; font: 800 .9rem/1.1 var(--plex); font-stretch: 112%; white-space: nowrap;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.relay-close, .relay-all { pointer-events: auto; border: 0; cursor: pointer; background: #0D1330; color: #FFF8F0; }
.relay-close { position: absolute; right: 14px; top: calc(env(safe-area-inset-top, 0px) + 12px); width: 48px; height: 44px; display: grid; place-items: center; clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.relay-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.relay-all {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translateX(-50%);
  padding: 14px 26px; font: 850 1rem/1 var(--plex); font-stretch: 115%; white-space: nowrap;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.relay-all:active, .relay-close:active { filter: brightness(1.3); }
.relay-all:focus-visible, .relay-close:focus-visible { outline: 3px solid #FFF8F0; outline-offset: 3px; }
@keyframes relay-ui-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes relay-ui-out { to { opacity: 0; } }

/* ---------- Altoparlante ---------- */
.sound-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound-btn .spk { fill: currentColor; }
.sound-btn .off { display: none; }
.sound-btn.muted .on { display: none; }
.sound-btn.muted .off { display: inline; stroke: #FF5722; stroke-width: 2.4; }
.sound-btn.muted { color: var(--muted); }

/* ---------- Tasto indietro a portata di pollice ---------- */
.back-fab {
  position: fixed; z-index: 140; left: 14px; bottom: calc(var(--safe-bottom, env(safe-area-inset-bottom, 0px)) + 84px);
  width: 54px; height: 48px; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center;
  background: #FF5722; color: #0D1330; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.45)); animation: back-in .32s var(--ease-ios, ease-out) both;
}
.back-fab[hidden] { display: none; }
.back-fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.back-fab:active { transform: scale(.92); }
.back-fab:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.back-fab.over-sheet { bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); }
@keyframes back-in { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@media (min-width: 900px) { .back-fab { bottom: 24px; } }
:root[data-reduce-motion="on"] .back-fab { animation: none; }
/* con l'altoparlante in più la barra in alto si stringe: il marchio resta intero */
.brand { flex: none; }
.brand-text span { white-space: nowrap; }
/* l'altoparlante apre il gruppo di tasti a destra: mai attaccato al marchio */
.sound-btn { margin-left: auto; }
.brand { margin-right: 12px; }
@media (max-width: 440px) {
  /* sul telefono il tema si cambia da "Aa" (Accessibilità): un tasto in meno, più aria attorno al logo */
  .theme-btn { display: none; }
  .topbar { gap: 6px; }
  .a11y-btn { width: 36px; min-width: 36px; min-height: 36px; padding: 0; }
  .units button { min-width: 34px; padding: 6px 6px; }
}
@media (max-width: 360px) { .brand-text { display: none; } }

/* ---------- Profilo: numero di pettorale leggibile e dentro il riquadro ---------- */
.bib-form { display: flex; gap: 8px; align-items: stretch; min-width: 0; max-width: 100%; }
.bib-form input {
  flex: 1 1 auto; min-width: 0; width: 100%; box-sizing: border-box;
  padding: 10px 14px; border: 2px solid var(--hairline-strong, rgba(255,255,255,.2)); border-radius: 0;
  background: #F7F7F2; color: #0D1330; -webkit-text-fill-color: #0D1330; caret-color: #FF5722;
  font: 850 1.4rem/1.1 var(--plex); font-stretch: 88%; letter-spacing: .08em; text-align: center;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.bib-form input::placeholder { color: #8A90A6; -webkit-text-fill-color: #8A90A6; }
.bib-form input:focus-visible { outline: 3px solid #FF5722; outline-offset: 2px; }
.bib-form .btn { flex: none; }
.bib-input { min-width: 0; width: 100%; box-sizing: border-box; color: #12151C; -webkit-text-fill-color: #12151C; caret-color: #FF5722; }

/* ---------- Iscrizioni: sempre chiare ---------- */
.badge.closed { background: #E5384F; color: #FFFFFF; border-color: #E5384F; font-weight: 800; }
.badge.closed::before { content: "✕ "; }
.badge.unk { background: transparent; color: var(--muted); border: 1px dashed var(--hairline-strong, rgba(255,255,255,.25)); font-weight: 700; }
.reg-banner {
  display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 12px; margin: 14px 0 4px; padding: 12px 16px;
  background: var(--surface); border-left: 6px solid var(--muted); clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}
.reg-banner b { display: block; font: 850 1rem/1.15 var(--plex); font-stretch: 112%; text-transform: uppercase; letter-spacing: .01em; }
.reg-banner small { display: block; margin-top: 3px; color: var(--muted); font-size: .86rem; line-height: 1.3; }
.reg-ico { width: 40px; height: 40px; display: grid; place-items: center; font: 900 1.15rem/1 var(--plex); color: #0D1330; background: var(--muted);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.reg-banner.closed { border-color: #E5384F; background: rgba(229, 56, 79, .14); }
.reg-banner.closed .reg-ico { background: #E5384F; color: #FFFFFF; }
.reg-banner.closed b { color: #FF8A9C; }
.reg-banner.open { border-color: var(--volt); } .reg-banner.open .reg-ico { background: var(--volt); }
.reg-banner.closing { border-color: #FFB020; background: rgba(255, 176, 32, .12); } .reg-banner.closing .reg-ico { background: #FFB020; }
.reg-banner.soon { border-color: var(--sky); } .reg-banner.soon .reg-ico { background: var(--sky); }
.reg-banner.past .reg-ico { background: var(--surface-2); color: var(--muted); }
:root[data-theme="light"] .reg-banner.closed b { color: #B3122B; }
:root[data-theme="light"] .badge.unk { color: #4A5275; }

/* ---------- Pettorale simbolico e strappo ---------- */
.bib-sym { justify-self: start; padding: 2px 6px; font: 800 .55rem/1 var(--plex); letter-spacing: .12em; color: #FFFFFF; background: #FF5722; transform: rotate(-3deg); }
.bib-wall { position: relative; }
.rip-half { animation: none !important; transition: none; will-change: transform; filter: drop-shadow(0 8px 14px rgba(0,0,0,.35)); }
.rippable { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
/* invito al sito ufficiale: piccolo, in sordina, con un filo arancio a sinistra */
.reg-note { margin: 10px 2px 2px; padding-left: 10px; border-left: 2px solid rgba(255, 87, 34, .55); font-size: .8rem; line-height: 1.45; font-style: italic; color: var(--muted); max-width: 52ch; }
/* ---------- Triathlon: corsie divise per disciplina ---------- */
.tri-svg .tri-line { stroke-linecap: butt; }
.tri-svg .route-glow { stroke-opacity: .18; }
.tri-svg .tri-t { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 2 2; opacity: .7; }
.tri-svg .tri-tl { font-size: 8px; font-weight: 800; fill: var(--muted); }
.tri-svg .tri-km { font-size: 9px; fill: var(--text); opacity: .85; }
.tri-svg .tri-leg { font-size: 10px; font-weight: 700; fill: var(--text); }
.tri-svg .tri-iron { font-size: 13px; font-weight: 900; font-stretch: 112%; fill: #FFC93C; letter-spacing: .02em; }
.tri-svg .route-finish.gold rect { fill: #FFC93C; }
:root[data-theme="light"] .tri-svg .tri-iron { fill: #B07A00; }

/* copertina "girata" (video Blender): stessa posizione della scena disegnata */
.sheet-hero > video.live-cover { position: absolute !important; inset: 0; z-index: 0 !important; object-fit: cover; pointer-events: none; will-change: transform, opacity; transition: opacity .6s ease; }

/* medaglia 3D (video animato in WebP): la caduta e l'oscillazione sono già nel filmato */
.cer-swing.wait { visibility: hidden; animation: none; }
.cer-swing.is-3d { animation: none; width: min(64vw, 260px); }
.cer-swing .cer-3d { display: block; width: 100%; height: auto; filter: drop-shadow(0 24px 34px rgba(0, 0, 0, .5)); }
/* Esplora: discipline come icone 3D nei colori del menu arcobaleno (corsia colorata sotto ogni icona) */
.sport-strip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 16px 6px; margin: 0 -16px 10px; scrollbar-width: none; }
.sport-strip::-webkit-scrollbar { display: none; }
.sport-tile { position: relative; flex: 0 0 auto; width: 84px; --ink: color-mix(in srgb, var(--sport) 14%, #070912); scroll-snap-align: start; display: grid; justify-items: center; gap: 1px; padding: 8px 4px 10px; border-radius: 18px; border: 1px solid var(--hairline); cursor: pointer; color: inherit; font: inherit; overflow: hidden; background: var(--surface);
  background: radial-gradient(90% 70% at 50% 38%, color-mix(in srgb, var(--sport) 30%, #070912), #070912 78%); color: #fff; transition: transform .2s var(--ease-out), border-color .2s ease, background-color .2s ease; }
.sport-tile small { color: rgba(255, 255, 255, .62); }
.sport-tile::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--sport); transform: skewX(-14deg) scaleX(1.1); }
.sport-tile:active { transform: scale(.95); }
.sport-tile:focus-visible { outline: 2px solid var(--sport); outline-offset: 2px; }
.sport-tile[aria-pressed="true"] { background: var(--sport); border-color: var(--sport); color: #0D1330; }
.sport-tile[aria-pressed="true"] small { color: rgba(13, 19, 48, .7); }
.sport-ico { width: 56px; height: 56px; overflow: visible; animation: tile-float 3.4s ease-in-out infinite; }
.sport-tile:nth-child(2n) .sport-ico { animation-delay: -1.1s; } .sport-tile:nth-child(3n) .sport-ico { animation-delay: -2.2s; }
@keyframes tile-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.sport-ico .si-rings { opacity: .28; stroke-width: 1; }
.sport-ico .si-glow { filter: drop-shadow(0 0 3px var(--sport)) drop-shadow(0 0 7px var(--sport)); }
.sport-tile[aria-pressed="true"] .sport-ico .si-glow path { stroke: #0D1330; }
.sport-tile[aria-pressed="true"] .sport-ico .si-glow { filter: none; }
.sport-tile[aria-pressed="true"] .sport-ico .si-rings { stroke: #0D1330; opacity: .25; }
/* al primo arrivo in Esplora il tubo luminoso "disegna" ogni icona */
.sport-strip.draw .sport-ico :is(.si-glow, .si-core) path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ico-draw .9s cubic-bezier(.3,.7,.3,1) forwards; }
.sport-strip.draw .sport-tile .sport-ico path { animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes ico-draw { to { stroke-dashoffset: 0; } }
.sport-tile b { font-size: .74rem; line-height: 1.1; text-align: center; font-style: italic; font-weight: 850; }
.sport-tile small { font-size: .66rem; }
@media (prefers-reduced-motion: reduce) { .sport-tile img { animation: none; } }
/* pettorale in Tyvek vero e spille da balia renderizzati in Blender */
.bib-card { background: #F7F7F2 url(cinema/bib-paper.webp) center / cover; }
.bib-pin { width: 34px; height: 34px; border-radius: 0; background: url(cinema/bib-pin.webp) center / contain no-repeat; }
.bib-pin.a { left: -3px; top: -5px; } .bib-pin.b { right: -3px; top: -5px; transform: scaleX(-1); }
.bib-pin.c { left: -3px; bottom: -5px; transform: scaleY(-1); } .bib-pin.d { right: -3px; bottom: -5px; transform: scale(-1, -1); }
.route-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 10001; cursor: pointer; touch-action: none; }
.ceremony .cer-stage { touch-action: none; cursor: grab; display: grid; place-items: center; }
.ceremony .cer-stage:active { cursor: grabbing; }
.cer-swing.is-3d { width: min(60vw, 250px); margin-inline: auto; }
.cer-hint { margin: 2px 0 10px; font-size: .78rem; color: var(--muted); }

/* Esplora: la barra di ricerca scorre con la pagina (non resta più bloccata in cima) */
.explore-bar { position: relative; top: auto; background: none; }
.explore-bar .sport-strip { margin: 10px -16px 0; }
.sport-tile { width: 70px; padding: 6px 3px 8px; border-radius: 15px; }
.sport-ico { width: 42px; height: 42px; }
.sport-tile b { font-size: .66rem; }
.sport-tile small { font-size: .6rem; }
.sport-tile:hover .sport-ico { animation-duration: 1.2s; }

/* cerimonia: medaglia ferma al centro, entra con una dissolvenza e un riflesso che la attraversa */
.ceremony .cer-stage { width: 100%; justify-items: center; }
.cer-swing.is-3d { position: relative; width: min(58vw, 240px); margin: 0 auto; transform: none !important; animation: cer-in .45s cubic-bezier(.2,.9,.3,1.2) both !important; }
@keyframes cer-in { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }
/* suggerimenti nel modulo del risultato */
.sugg-wrap { position: relative; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; display: grid; background: var(--surface-2); border: 1px solid var(--hairline-strong); border-radius: 12px; overflow: hidden; box-shadow: 0 18px 40px -12px rgba(0,0,0,.6); }
.sugg[hidden] { display: none; }
.sugg-item { display: grid; gap: 2px; text-align: left; padding: 10px 12px; background: none; border: 0; border-bottom: 1px solid var(--hairline); color: var(--text); font: inherit; cursor: pointer; }
.sugg-item:last-child { border-bottom: 0; }
.sugg-item b { font-size: .9rem; font-weight: 650; }
.sugg-item small { color: var(--muted); font-size: .76rem; }
.sugg-item.on, .sugg-item:hover { background: rgba(255, 87, 34, .14); }
/* tempo da scrivere */
.time-fields { display: grid; gap: 4px; justify-items: start; }
.tf-in { width: 100%; max-width: 220px; height: 56px; font-size: 1.75rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.time-fields.bad .tf-in { border-color: #E5484D; box-shadow: 0 0 0 2px rgba(229, 72, 77, .35); }
.tf-unit { font-size: .6875rem; color: var(--muted); }
/* medaglie: si toccano (scheda) o si trascinano nel cestino */
.medal-hooks .hang, .medal-wall .medal-item, .diary-medal { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.diary-medal { display: grid; place-items: center; }
.trash-bin { position: fixed; z-index: 9000; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--hairline-strong); box-shadow: 0 10px 30px -8px rgba(0,0,0,.6); opacity: 0; transform: scale(.6); transition: opacity .2s ease, transform .25s cubic-bezier(.34,1.45,.64,1), background-color .2s ease; pointer-events: none; }
.trash-bin.in { opacity: 1; transform: scale(1); }
.trash-bin.armed { background: #E5484D; border-color: #E5484D; transform: scale(1.14); }
.trash-bin svg { width: 26px; height: 26px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.trash-bin.armed svg { stroke: #fff; }
.trash-bin .bin-lid { transform-origin: 24px 9px; transition: transform .18s ease; }
.trash-bin.armed .bin-lid { transform: rotate(28deg) translateY(-2px); }
.trash-bin.shut .bin-lid { transform: none; }
.medal-info { display: grid; gap: 10px; justify-items: center; text-align: center; }
.medal-info .metrics { justify-content: center; }
.medal-info .actions { justify-content: center; flex-wrap: wrap; }
.ceremony, .ceremony .cer-copy h2, .ceremony .cer-copy p:not(.cer-pb) { color: #F2F4F8; }
.ceremony .cer-hint { color: rgba(242, 244, 248, .62); }
/* manifesto e privacy: chiusi in un menu a tendina, si aprono per approfondire */
details.fold { margin-top: 16px; padding: 14px 16px; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); min-height: 28px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s ease; flex: none; }
details.fold[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
details.fold > summary svg { width: 18px; height: 18px; fill: none; stroke: var(--volt); stroke-width: 2; flex: none; }
details.ethics.fold > summary { flex-wrap: wrap; row-gap: 2px; }
details.ethics.fold > summary .eyebrow { flex-basis: 100%; margin: 0; }
details.fold[open] > :not(summary) { animation: fold-in .25s ease both; }
@keyframes fold-in { from { opacity: 0; transform: translateY(-4px); } }

/* Avvio: solo il logo che si presenta. Con il video l'arco si gonfia e poi compare il marchio,
   scritto come nella barra in alto (stesso carattere e stesse proporzioni). */
.splash { gap: 10px; }
.splash .splash-logo { animation: splash-logo-in .7s cubic-bezier(.2,.9,.3,1.25) both; }
@keyframes splash-logo-in { from { opacity: 0; transform: scale(.7); filter: blur(6px); } }
.splash .splash-intro { width: min(86vw, 380px); height: auto; mix-blend-mode: screen; margin-bottom: -26px;
  -webkit-mask-image: linear-gradient(to bottom, #000 64%, transparent 97%); mask-image: linear-gradient(to bottom, #000 64%, transparent 97%); }
.splash .splash-name { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.05; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #F2F4F8; }
.splash .splash-name b { font-size: .75rem; font-weight: 500; letter-spacing: .32em; color: #A3ACBC; animation: splash-word .6s .25s cubic-bezier(.2,.8,.2,1) both; }
.splash .splash-name span { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; animation: splash-word .7s .35s cubic-bezier(.2,.8,.2,1) both; }
.splash.has-intro .splash-name b { animation-delay: 1.35s; }
.splash.has-intro .splash-name span { animation-delay: 1.45s; }
@keyframes splash-word { from { opacity: 0; letter-spacing: .6em; filter: blur(4px); } }

/* medaglie disegnate (js/medal.js) */
.medal-art { display: block; overflow: visible; }
.cer-swing.is-art { width: min(62vw, 240px); margin: 0 auto; animation: cer-in .5s cubic-bezier(.2,.9,.3,1.2) both; transform: none; }
.cer-swing.is-art .medal-art { width: 100%; height: auto; }
.medal-art .medal-shine { animation: medal-shine 1.6s .45s ease-in-out both; }
@keyframes medal-shine { from { transform: rotate(18deg) translateX(0); } to { transform: rotate(18deg) translateX(340px); } }
@media (prefers-reduced-motion: reduce) { .medal-art .medal-shine, .cer-swing.is-art { animation: none; } }
.medal-hooks .hang .medal-art, .medal-wall .medal-item .medal-art { margin: 0 auto; }
body:has(.ceremony) #back-fab { display: none; }

/* cerimonia senza effetti che su iPhone disegnavano righe ai lati: niente sfocatura dello sfondo,
   niente prospettiva, niente ombre CSS; la medaglia è centrata sull'asse dello schermo */
.ceremony { backdrop-filter: none; -webkit-backdrop-filter: none; background: radial-gradient(70% 50% at 50% 35%, rgba(255, 87, 34, .22), transparent 70%), #05060C; }
.ceremony.is-pb { background: radial-gradient(70% 50% at 50% 35%, rgba(232, 185, 49, .3), transparent 70%), #05060C; }
.ceremony .cer-stage { perspective: none; width: 100%; display: flex; justify-content: center; }
.ceremony .cer-swing, .ceremony .cer-swing svg { filter: none; }
.cer-swing.is-art { margin: 0 auto; }

/* Avvio: il marchio si compone (tutto transform/opacity, fluido anche su telefoni lenti) */


/* studio di condivisione */
.share-studio { display: grid; gap: 14px; }
.share-stage { display: grid; place-items: center; padding: 10px; border-radius: 18px; background: #05060C; }
.share-preview { width: auto; max-width: 100%; max-height: 46vh; height: auto; border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .7); }
.share-studio .seg { display: flex; flex-wrap: wrap; }
.share-studio .seg button { flex: 1; padding: 6px 12px; }
.share-studio .seg button[aria-checked="true"] { background: var(--orange); color: #fff; font-weight: 700; }
.share-studio .check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .9rem; }
.share-studio .check input { width: 20px; height: 20px; accent-color: var(--orange); }
.share-studio .field-label { display: block; font-size: .8125rem; color: var(--muted); margin-bottom: 6px; }
.share-studio .actions .btn svg, .medal-info .actions .btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.bib-share { position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--sport, #FF5722); color: #0D1330; cursor: pointer; z-index: 2; box-shadow: 0 4px 10px rgba(0,0,0,.25); }
.bib-share svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.cer-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
body:has(.share-studio) #back-fab, body:has(.medal-info) #back-fab { display: none; }

/* ---------- Avvio: prima il logo con la scritta, poi i colori ----------
   1) il logo si apre e sotto compare la scritta, su fondo notte;
   2) dietro entrano in obliquo le dieci corsie di "Trova la tua gara", alternando i lati dal centro;
   3) quando l'app è pronta (classe .out) il fondo sparisce e le corsie escono dai lati scoprendo l'app.
   Solo transform/opacity di elementi HTML: animato dal compositore, fluido anche mentre l'app carica. */
.splash { overflow: hidden; gap: 16px; }
.splash .sp-lanes { position: absolute; left: 50%; top: 50%; width: 170vmax; height: 120vmax; margin: -60vmax 0 0 -85vmax;
  display: flex; flex-direction: column; transform: rotate(-13.75deg); pointer-events: none; }
.sp-lanes i { flex: 1; margin: -1px 0; background: var(--c); will-change: transform; backface-visibility: hidden;
  box-shadow: inset 0 -2px 0 rgba(255,255,255,.35);
  animation: spx-lane-in .9s calc(1.15s + var(--d)) cubic-bezier(.16,.84,.3,1) both; }
@keyframes spx-lane-in { from { transform: translateX(calc(var(--s) * 105%)); } to { transform: translateX(0); } }
@keyframes spx-lane-out { from { transform: translateX(0); } to { transform: translateX(calc(var(--s) * -105%)); } }
.splash .sp-logo { position: relative; width: 132px; height: 132px; border-radius: 30px; will-change: transform, opacity;
  box-shadow: 0 0 0 3px #0D1330, 0 24px 60px -10px rgba(13, 19, 48, .85);
  animation: spx-logo .9s .1s cubic-bezier(.2,1.3,.35,1) both; }
.splash .splash-name { position: relative; margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.05; color: #F2F4F8;
  padding: 9px 22px 10px; background: #0D1330; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  will-change: transform, opacity; animation: spx-word .7s .5s cubic-bezier(.2,.8,.2,1) both; }
.splash .splash-name b, .splash .splash-name span { display: block; animation: none; }
@keyframes spx-logo { 0% { transform: scale(.3) rotate(-10deg); opacity: 0; } 35% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes spx-word { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
/* uscita: il fondo è già coperto dalle corsie, quindi si toglie di colpo; le corsie scoprono l'app */
.splash.out { opacity: 1; background: transparent; transition: none; }
.splash.out .sp-lanes i { animation: spx-lane-out .75s calc(var(--d) * .8) cubic-bezier(.6,0,.84,.3) both; }
.splash.out .sp-logo, .splash.out .splash-name { animation: spx-leave .35s cubic-bezier(.5,0,.75,0) both; }
@keyframes spx-leave { to { transform: scale(.85); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .splash .sp-lanes { display: none; }
  .splash .sp-logo, .splash .splash-name { animation: none; }
  .splash.out { opacity: 0; transition: opacity .3s ease; }
}
:root[data-reduce-motion="on"] .splash .sp-lanes { display: none; }
:root[data-reduce-motion="on"] .splash.out { opacity: 0; transition: opacity .3s ease; }

/* ---------- Icone in linea al posto delle emoji ----------
   Stesso tratto delle icone della barra (linee arrotondate, colore del testo); le icone con un
   significato fisso prendono una tinta del menu arcobaleno, più scura nel tema chiaro per il contrasto. */
.ui-ico { display: inline-flex; flex: none; vertical-align: -0.16em; margin-right: 0.38em; }
.ui-ico svg, .icon-btn svg, .avatar svg, .achv-ico svg, .weather .ico svg, .theme-btn svg, .disc-thumb.empty svg, svg.face {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ui-ico svg { width: 1.08em; height: 1.08em; }
.ui-ico.t-orange { color: #FF8A3D; }
.ui-ico.t-gold { color: #FFD23F; }
.ui-ico.t-teal { color: #19E3C6; }
.ui-ico.t-violet { color: #A78BFA; }
.ui-ico.t-volt { color: var(--volt); }
:root[data-theme="light"] .ui-ico.t-orange { color: #C25400; }
:root[data-theme="light"] .ui-ico.t-gold { color: #9A6F00; }
:root[data-theme="light"] .ui-ico.t-teal { color: #00806F; }
:root[data-theme="light"] .ui-ico.t-violet { color: #6D4CD6; }
:root[data-theme="light"] .ui-ico.t-volt { color: var(--volt-ink); }
.chip .ui-ico, .seg button .ui-ico { margin-right: 0.3em; }
.icon-btn { display: inline-grid; place-items: center; color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.avatar svg { width: 30px; height: 30px; }
.achv-ico { display: grid; place-items: center; color: var(--faint, var(--muted)); }
.achv-ico.got { color: #FFD23F; }
:root[data-theme="light"] .achv-ico.got { color: #9A6F00; }
.achv-ico svg { width: 26px; height: 26px; }
.weather .ico { color: #FFD23F; }
:root[data-theme="light"] .weather .ico { color: #9A6F00; }
.weather .ico svg { width: 34px; height: 34px; }
.theme-btn { display: inline-grid; place-items: center; }
.theme-btn svg { width: 19px; height: 19px; }
.disc-thumb.empty { color: var(--muted); }
.disc-thumb.empty svg { width: 24px; height: 24px; }
.disc-credit .ui-ico { margin-right: 0.3em; }
svg.face { width: 26px; height: 26px; stroke-width: 1.8; }
.metric .v svg.face { width: 20px; height: 20px; display: inline-block; vertical-align: -4px; }
.feelings input:checked + span svg.face { color: var(--volt-ink); }
.greet-medals { display: inline-flex; align-items: center; }
/* le icone dei suggerimenti stanno dentro la barra di ricerca: non devono prendere la posizione della lente */
.search .ui-ico svg { position: static; transform: none; width: 1.08em; height: 1.08em; stroke: currentColor; }

/* ---------- Meno vetro sfocato ----------
   La sfocatura dello sfondo resta dove serve davvero: barre in alto e in basso, avvisi di sistema
   e pulsanti sopra le foto. Su pannelli, riquadri, chip e campo di ricerca (che stanno su fondo scuro)
   non si vedeva quasi, ma su iPhone pesava molto durante lo scorrimento: ora hanno un fondo pieno. */
.panel, .cta-card, .legend, .gem-box, .weather, .stat, .tile, .chip, .search input, .privacy, .pb-scene, .badge:not(.hero .badge):not(.sheet-hero .badge) {
  -webkit-backdrop-filter: none; backdrop-filter: none; }
.sheet-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(2, 3, 6, .72); }
.ctx-scrim { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(8, 10, 12, .66); }

/* ---------- Bersagli più facili da toccare ----------
   I pulsanti piccoli restano della stessa misura a vista, ma l'area che risponde al dito
   arriva a 44 punti (la misura consigliata da Apple). Le tendine sono alte almeno 44 punti. */
.a11y-btn, .icon-btn { position: relative; }
.a11y-btn::after, .save-btn::after, .share-btn::after, .icon-btn::after, .sheet-close::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
.legend summary, details.fold > summary { min-height: 44px; display: flex; align-items: center; }

/* ---------- Copia dei dati ---------- */
.panel.backup-remind { border: 1px solid rgba(255, 210, 63, .45); background: linear-gradient(135deg, rgba(255, 210, 63, .12), rgba(255, 138, 61, .06)); }
:root[data-theme="light"] .panel.backup-remind { border-color: rgba(154, 111, 0, .45); background: #FFF6D6; }
.backup-remind h2 { display: flex; align-items: center; }
.backup-last { font-weight: 700; }
.backup-last.none { color: #FFB35C; }
:root[data-theme="light"] .backup-last.none { color: #A64800; }
