/* Fillupz — foglio di stile del sito www (vanilla, nessuna dipendenza).
   Palette allineata al tema dell'app (game/ui/fz_theme.gd): scuro di default,
   schema chiaro con prefers-color-scheme. Scala spaziatura 4 px. */

:root {
  color-scheme: dark;
  --bg: #12141a;
  --surface: #1c2129;
  --surface-2: #262e3b;
  --border: #323b4a;
  --text: #edf2f7;
  --text-dim: #a3afbf;
  --accent: #4fc2f7;
  --accent-ink: #0b1a24;
  --amber: #f29c12;
  --ok: #3dcc73;
  --warn: #ffcc1a;
  --danger: #f56565;
  --ai: #a673f2;
  --ai-bg: #2b2140;
  --focus: #ffcc1a;
  --radius: 10px;
  --radius-sm: 6px;
  --maxw: 68rem;
  --shadow: none;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #e9edf3;
    --border: #d3dae3;
    --text: #15202b;
    --text-dim: #4a5868;
    --accent: #0b6f9f;
    --accent-ink: #ffffff;
    --amber: #9a5a00; /* 5,06:1 su --bg e 5,47:1 su --surface (AA per .kicker e tr.top td.rank) */
    --ok: #1d7a3f;
    --warn: #8a6d00;
    --danger: #b42318;
    --ai: #5b2fb8;
    --ai-bg: #ece4fb;
    --focus: #b85c00;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Primo paint solo dopo che i18n.js ha applicato la lingua: l'attributo lo
   mette lo script inline del <head> e lo toglie apply() (o DOMContentLoaded). */
html[data-i18n-pending] body { visibility: hidden; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95em; }
small, .muted { color: var(--text-dim); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }

.skip-link {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--surface); color: var(--text); padding: 0.5rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); z-index: 10;
}
.skip-link:focus { top: 1rem; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  min-height: 3.75rem; padding-top: 0.5rem; padding-bottom: 0.5rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand svg { width: 28px; height: 28px; flex: none; }
.site-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-inline-start: auto; }
.site-nav a {
  color: var(--text-dim); text-decoration: none; padding: 0.4rem 0.65rem; border-radius: var(--radius-sm); font-weight: 500;
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.lang-picker { display: inline-flex; align-items: center; gap: 0.4rem; }
.lang-picker label { color: var(--text-dim); font-size: 0.9rem; }

select, input[type="date"], button {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.45rem 0.65rem; min-height: 2.5rem;
}
select:hover, input[type="date"]:hover { border-color: var(--text-dim); }
button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700;
}
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  text-decoration: none; font-weight: 700; padding: 0.7rem 1.25rem; min-height: 2.75rem;
  border-radius: var(--radius); border: 1px solid var(--border); color: var(--text); background: var(--surface);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:hover { text-decoration: none; }

main { flex: 1; }
section { padding: 2.5rem 0; }
section + section { border-top: 1px solid var(--border); }
.section-head { margin-bottom: 1.25rem; }
.section-head p { color: var(--text-dim); max-width: 60ch; }

/* Hero */
.hero { padding: 3rem 0 2.5rem; }
.hero .wrap { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .hero .wrap { grid-template-columns: 3fr 2fr; } }
.kicker { color: var(--amber); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; margin-bottom: 0.75rem; }
.lead { font-size: 1.15rem; color: var(--text-dim); max-width: 55ch; }
.cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.5rem 0 0.75rem; }
.hero-note { font-size: 0.9rem; color: var(--text-dim); }
.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: min(100%, 260px); height: auto; }

/* Store badges (segnaposto propri, nessun logo di terzi) */
.stores { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.store-badge {
  display: inline-flex; flex-direction: column; min-width: 10rem; padding: 0.5rem 0.9rem;
  border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-dim); background: var(--surface);
}
.store-badge strong { color: var(--text); font-size: 0.95rem; }
.store-badge span { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: 1fr; counter-reset: step; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; counter-increment: step; }
.steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-bottom: 0.75rem;
}
.steps h3 { margin-bottom: 0.35rem; }
.steps p { margin: 0; color: var(--text-dim); font-size: 0.95rem; }

/* Pannello "oggi" */
.today-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.today-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.today-head h3 { margin: 0; }
.today-meta { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.status-pill {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; background: var(--surface-2); color: var(--text);
}
.status-pill::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--text-dim); }
.status-pill[data-state="open"]::before { background: var(--ok); }
.status-pill[data-state="closing"]::before { background: var(--warn); }
.status-pill[data-state="closed"]::before, .status-pill[data-state="frozen"]::before { background: var(--accent); }
.params { margin: 0; display: grid; gap: 0.5rem 1.5rem; grid-template-columns: 1fr; min-height: 11rem; }
@media (min-width: 640px) { .params { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .params { grid-template-columns: repeat(3, 1fr); } }
.params div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.params dt { color: var(--text-dim); }
.params dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 50%; vertical-align: -0.1em; margin-inline-end: 0.35em; border: 1px solid var(--border); }

.state { padding: 0.9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.state[data-kind="error"] { border-inline-start: 4px solid var(--danger); }
.state[data-kind="loading"] { color: var(--text-dim); }
.state[hidden] { display: none; }

/* Classifiche */
.controls { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: end; margin-bottom: 1.25rem; }
@media (min-width: 760px) { .controls { grid-template-columns: auto auto 1fr auto; } }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span, .field > label { font-size: 0.85rem; color: var(--text-dim); font-weight: 600; }
.day-nav { display: flex; gap: 0.35rem; }
.day-nav input { flex: 1; min-width: 9.5rem; }
.day-nav button { padding-inline: 0.75rem; min-width: 2.5rem; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.segmented span { display: inline-block; padding: 0.5rem 0.9rem; min-height: 2.5rem; line-height: 1.5; color: var(--text-dim); font-weight: 600; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.lb-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-bottom: 0.75rem; min-height: 2rem; }
.lb-meta h2 { margin: 0; font-size: 1.25rem; }

/* min-height ≈ 8 righe: lo skeleton del markup e le righe vere occupano lo
   stesso spazio, cosi' ai-note e footer non si spostano quando arrivano i dati. */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-height: 24rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.65rem 0.75rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
td.rank { font-variant-numeric: tabular-nums; width: 3.5rem; color: var(--text-dim); font-weight: 600; }
tr.top td.rank { color: var(--amber); }
td.time { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; font-weight: 600; }
.player { display: flex; flex-direction: column; gap: 0.1rem; }
.player .name { display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.player .where { font-size: 0.85rem; color: var(--text-dim); }
.flag { font-size: 1.1em; line-height: 1; }
.badge-ai {
  display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; padding: 0.1rem 0.4rem;
  border-radius: 4px; background: var(--ai-bg); color: var(--ai); border: 1px solid var(--ai);
}
.perfect { color: var(--amber); font-size: 0.9em; }
tbody.skeleton td { color: transparent; }
tbody.skeleton td span { display: inline-block; background: var(--surface-2); border-radius: 4px; height: 1em; width: 60%; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.pager p { margin: 0; color: var(--text-dim); }
.pager div { display: flex; gap: 0.5rem; }
.ai-note { font-size: 0.9rem; color: var(--text-dim); margin-top: 1rem; }

/* Privacy e testi lunghi */
.prose { max-width: 72ch; }
.prose p, .prose li { overflow-wrap: anywhere; } /* URL lunghi (pv_ads_p2) a 360 px e 320 px */
.prose h2 { margin-top: 2rem; font-size: 1.3rem; }
.prose ul { padding-inline-start: 1.25rem; }
.prose li { margin-bottom: 0.35rem; }
.placeholder { background: var(--surface-2); border: 1px dashed var(--amber); padding: 0.1rem 0.4rem; border-radius: 4px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; color: var(--text-dim); font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Pagina 404 */
.notfound { text-align: center; padding: 5rem 0; }
.notfound .code { font-size: 5rem; font-weight: 800; color: var(--surface-2); line-height: 1; }

/* Animazione del recipiente che si riempie */
@keyframes fz-fill { from { transform: translateY(100%); } to { transform: translateY(0); } }
.fz-fluid { transform-box: fill-box; animation: fz-fill 6s ease-in-out infinite alternate; transform-origin: bottom; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fz-fluid { transform-box: fill-box; animation: none; transform: translateY(15%); }
  * { transition: none !important; }
}

/* Elenco "fatti" (stessa grafica dei passi, senza numerazione) */
.steps.facts { grid-template-columns: 1fr; }
@media (min-width: 640px) { .steps.facts { grid-template-columns: repeat(2, 1fr); } }
.steps.facts li::before { display: none; }
fieldset.field { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
fieldset.field legend { padding: 0; font-size: 0.85rem; color: var(--text-dim); font-weight: 600; margin-bottom: 0.35rem; }
