/* styles.css — Bilal e Sami. Sfondo SEMPRE bianco; arancione = azioni/progressi, blu = navigazione/informazioni.
   Usa proprietà logiche (inline-start/end) così LTR e RTL funzionano senza regole duplicate. */

/* Font inclusi nel progetto (licenza OFL, vedi assets/fonts): niente richieste esterne. */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 400; font-display: swap; src: url("../fonts/BricolageGrotesque-Regular.woff") format("woff"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700 800; font-display: swap; src: url("../fonts/BricolageGrotesque-Bold.woff") format("woff"); }
@font-face { font-family: "Outfit"; font-weight: 400 500; font-display: swap; src: url("../fonts/Outfit-Regular.woff") format("woff"); }
@font-face { font-family: "Outfit"; font-weight: 600 800; font-display: swap; src: url("../fonts/Outfit-Bold.woff") format("woff"); }

:root {
  --bg: #FFFFFF;
  --orange: #F97316;
  --orange-dark: #C2410C;      /* testo arancione su bianco con contrasto AA */
  --orange-light: #FFF1E6;
  --blue: #2563EB;
  --blue-dark: #1E3A8A;
  --text: #172033;
  --text-2: #64748B;
  --border: #E2E8F0;
  --ok: #16A34A;
  --ok-dark: #166534;
  --err: #DC2626;
  --err-dark: #991B1B;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(23, 32, 51, .06), 0 2px 8px rgba(23, 32, 51, .04);
  --font-latin: "Outfit", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Outfit", Inter, system-ui, sans-serif;
  --font-arabic: "Cairo", "Tajawal", "Noto Sans Arabic", system-ui, "Geeza Pro", Tahoma, Arial, sans-serif;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { background: var(--bg) !important; }   /* regola non negoziabile: mai sfondo colorato */
body {
  margin: 0; color: var(--text); font-family: var(--font-latin); font-size: 1rem; line-height: 1.55;
  padding-block-end: calc(var(--nav-h) + 24px);
}
[lang="ar"] body, [dir="rtl"] body { font-family: var(--font-arabic), var(--font-latin); line-height: 1.75; }
.ar-text, [lang="ar"].ar-text { font-family: var(--font-arabic); direction: rtl; unicode-bidi: isolate; line-height: 1.75; }
.it-text { direction: ltr; unicode-bidi: isolate; }

h1, h2, h3, .brand, .logo-big, .xp-big, .stat-value, .q-prompt, .flash-front, .profile-name, .chip, .btn, .nav-item, .ex-card strong { font-family: var(--font-display); letter-spacing: -.01em; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .brand, [dir="rtl"] .logo-big, [dir="rtl"] .xp-big, [dir="rtl"] .stat-value, [dir="rtl"] .q-prompt, [dir="rtl"] .flash-front, [dir="rtl"] .profile-name, [dir="rtl"] .chip, [dir="rtl"] .btn, [dir="rtl"] .nav-item, [dir="rtl"] .ex-card strong { font-family: var(--font-arabic); letter-spacing: 0; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; color: var(--text); }
h1 { font-size: 1.85rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }   /* titoli e contenitori messi a fuoco solo da codice, non interattivi */
.skip-link { position: absolute; inset-inline-start: 8px; inset-block-start: -60px; background: var(--blue-dark); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { inset-block-start: 8px; }

/* ---------- Layout ---------- */
.app-header {
  position: sticky; inset-block-start: 0; z-index: 20; background: var(--bg); border-block-end: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px;
}
.brand { white-space: nowrap; font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; color: var(--blue-dark); display: flex; align-items: center; gap: 8px; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; font-family: inherit; }
.brand b { color: var(--orange-dark); font-weight: 800; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--orange); display: grid; place-items: center; }
.header-actions { display: flex; align-items: center; gap: 8px; }
main { max-width: 980px; margin-inline: auto; padding: 20px 16px; }
.screen { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.nav {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 30; background: var(--bg); border-block-start: 1px solid var(--border);
  display: flex; justify-content: space-around; height: var(--nav-h); padding-block-end: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: 0; color: var(--text-2); font: inherit; font-size: .7rem; font-weight: 600; cursor: pointer; padding: 6px 2px;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.nav-item[aria-current="page"] { color: var(--blue); box-shadow: inset 0 3px 0 var(--blue); }
.nav-item:hover { color: var(--blue-dark); }

@media (min-width: 820px) {
  body { padding-block-end: 24px; }
  .nav { position: sticky; inset-block-start: 57px; inset-block-end: auto; height: auto; justify-content: center; gap: 4px; padding: 6px 16px; border-block-start: 0; border-block-end: 1px solid var(--border); z-index: 19; }
  .nav-item { flex: 0 0 auto; flex-direction: row; gap: 8px; font-size: .95rem; padding: 10px 16px; border-radius: 999px; }
  .nav-item[aria-current="page"] { box-shadow: none; background: #EFF4FF; }
  main { padding-block: 28px; }
}

/* ---------- Componenti ---------- */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-block-start: 14px; }
.stack-sm > * + * { margin-block-start: 8px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.btn {
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 2px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background-color .12s ease, border-color .12s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--orange); color: #1B1306; }          /* testo scuro: contrasto AA su arancione */
.btn-primary:hover:not(:disabled) { background: #EA580C; color: #fff; }
.btn-secondary { background: #fff; color: var(--blue-dark); border-color: var(--blue); }
.btn-secondary:hover:not(:disabled) { background: #EFF4FF; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--blue); color: var(--blue-dark); }
.btn-danger { background: #fff; color: var(--err-dark); border-color: var(--err); }
.btn-danger:hover:not(:disabled) { background: #FEF2F2; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.is-loading { opacity: .7; pointer-events: none; }

.lang-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.lang-toggle button { border: 0; background: #fff; padding: 8px 14px; min-height: 40px; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--text-2); }
.lang-toggle button[aria-pressed="true"] { background: var(--blue-dark); color: #fff; }
.lang-toggle button:first-child { font-family: var(--font-latin); }
.lang-toggle button:last-child { font-family: var(--font-arabic); }

.chip[hidden] { display: none; }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--orange-light); color: var(--orange-dark); font-weight: 700; font-size: .85rem; border: 0; }
.chip-blue { background: #EFF4FF; color: var(--blue-dark); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; border: 1px solid var(--border); color: var(--text-2); background: #fff; }
.tag-verified { color: var(--ok-dark); border-color: var(--ok); }
.tag-needs_review { color: var(--orange-dark); border-color: var(--orange); background: var(--orange-light); }
.tag-illustrative { color: var(--blue-dark); border-color: var(--blue); background: #EFF4FF; }
.tag-new { color: var(--text-2); }
.tag-review { color: var(--orange-dark); border-color: var(--orange); }
.tag-known { color: var(--ok-dark); border-color: var(--ok); }

.banner { border: 1px solid var(--border); border-inline-start: 5px solid var(--blue); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff; font-size: .92rem; }
.banner-warn { border-inline-start-color: var(--orange); background: var(--orange-light); }
.banner-ok { border-inline-start-color: var(--ok); }

.progress { height: 12px; border-radius: 999px; background: var(--orange-light); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--orange); border-radius: inherit; transition: width .4s ease; }
.progress-blue { background: #E0E9FF; }
.progress-blue > span { background: var(--blue); }

.stat { padding: 14px; }
.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--blue-dark); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value.orange { color: var(--orange-dark); }
.stat-label { font-size: .85rem; color: var(--text-2); font-weight: 600; }

.hero { display: grid; gap: 16px; }
.xp-big { font-size: 2.4rem; font-weight: 800; color: var(--orange-dark); font-variant-numeric: tabular-nums; line-height: 1; }

.badges-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-item { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--orange); background: var(--orange-light); color: var(--orange-dark); font-weight: 700; font-size: .85rem; }
.badge-item.locked { border-color: var(--border); background: #fff; color: var(--text-2); font-weight: 600; }
.badge-item svg { width: 16px; height: 16px; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-block-end: 1px solid var(--border); font-size: .92rem; }
.activity li:last-child { border-block-end: 0; }
.empty { text-align: center; padding: 28px 16px; color: var(--text-2); border: 2px dashed var(--border); border-radius: var(--radius); }
.empty svg { width: 40px; height: 40px; color: var(--blue); margin-block-end: 6px; }

/* ---------- Form ---------- */
.field { display: grid; gap: 6px; }
.field label, .field .label { font-weight: 700; font-size: .9rem; }
input[type="search"], input[type="text"], input[type="number"], select {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 2px solid var(--border); border-radius: 12px; font: inherit; color: var(--text); background: #fff;
}
input:hover, select:hover { border-color: #CBD5E1; }
input:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; }
.filters { display: none; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.filters.open { display: grid; }
@media (min-width: 820px) { .filters { display: grid; } .filters-toggle { display: none; } }

/* ---------- Vocabolario ---------- */
.word-list { display: grid; gap: 10px; }
.word-item { display: flex; align-items: center; gap: 12px; text-align: start; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.word-item:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.word-main { flex: 1; min-width: 0; }
.word-it { font-weight: 700; }
.word-ar { color: var(--blue-dark); font-size: 1.05rem; }
.word-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 4px; }
.fav-btn { background: none; border: 0; padding: 8px; cursor: pointer; color: var(--text-2); border-radius: 50%; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.fav-btn[aria-pressed="true"] { color: var(--orange); }
.fav-btn svg { width: 22px; height: 22px; }
.detail-block { padding: 12px 0; border-block-end: 1px solid var(--border); }
.detail-block:last-of-type { border-block-end: 0; }
.detail-label { font-size: .8rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.detail-value { font-size: 1.15rem; font-weight: 600; }
.detail-value.ar-text { font-size: 1.4rem; }

/* ---------- Esercizi ---------- */
.ex-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ex-card { text-align: start; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; font: inherit; color: inherit; display: grid; gap: 4px; box-shadow: var(--shadow); }
.ex-card:hover { border-color: var(--orange); }
.ex-card strong { color: var(--blue-dark); }
.ex-card.featured { border-color: var(--orange); background: var(--orange-light); }

.q-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.q-card { padding: 20px; }
.q-prompt { font-size: 1.5rem; font-weight: 800; margin-block: 6px 16px; color: var(--blue-dark); overflow-wrap: anywhere; }
.q-prompt.ar-text { font-size: 1.8rem; }
.q-prompt.sentence { font-size: 1.25rem; font-weight: 700; }
.q-hint { font-size: .9rem; color: var(--text-2); margin-block-end: 14px; }
.sign-art { width: 140px; height: 140px; margin: 4px auto 14px; display: block; }
.sign-art svg { width: 100%; height: 100%; display: block; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 10px; text-align: start; min-height: 54px; padding: 12px 14px; font: inherit; font-weight: 600; font-size: 1.05rem;
  background: #fff; color: var(--text); border: 2px solid var(--border); border-radius: 14px; cursor: pointer; width: 100%;
}
.option:hover:not(:disabled) { border-color: var(--blue); background: #F8FAFF; }
.option:disabled { cursor: default; }
.option .mark { margin-inline-start: auto; font-weight: 800; }
.option.is-correct { border-color: var(--ok); background: #F0FDF4; color: var(--ok-dark); }
.option.is-wrong { border-color: var(--err); background: #FEF2F2; color: var(--err-dark); }
.option.is-dim { opacity: .6; }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tf-statement { font-size: 1.2rem; font-weight: 700; padding: 14px; border: 1px solid var(--border); border-radius: 12px; display: grid; gap: 6px; margin-block-end: 14px; }

.feedback { margin-block-start: 16px; padding: 14px; border-radius: 14px; border: 2px solid var(--border); }
.feedback.ok { border-color: var(--ok); background: #F0FDF4; }
.feedback.bad { border-color: var(--err); background: #FEF2F2; }
.feedback h3 { margin-block-end: 4px; }
.feedback.ok h3 { color: var(--ok-dark); }
.feedback.bad h3 { color: var(--err-dark); }
.fb-word { margin-block-start: 8px; padding-block-start: 8px; border-block-start: 1px dashed var(--border); display: grid; gap: 2px; }
.fb-xp { font-weight: 800; color: var(--orange-dark); }

.timer { min-width: 64px; text-align: center; padding: 4px 10px; border-radius: 999px; font-weight: 800; background: #EFF4FF; color: var(--blue-dark); font-variant-numeric: tabular-nums; }
.timer.low { background: #FEF2F2; color: var(--err-dark); }

.flash-card { min-height: 220px; display: grid; place-content: center; text-align: center; gap: 10px; padding: 24px; border: 2px solid var(--border); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.flash-front { font-size: 2rem; font-weight: 800; color: var(--blue-dark); overflow-wrap: anywhere; }
.flash-back { display: grid; gap: 6px; }
.flash-back .ar-text { font-size: 1.8rem; font-weight: 700; color: var(--blue-dark); }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-block-start: 14px; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.match-col { display: grid; gap: 8px; align-content: start; }
.match-col h3 { font-size: .85rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.match-item { min-height: 54px; padding: 8px 10px; border: 2px solid var(--border); border-radius: 12px; background: #fff; font: inherit; font-weight: 600; cursor: pointer; text-align: center; color: var(--text); overflow-wrap: anywhere; }
.match-item:hover:not(:disabled) { border-color: var(--blue); }
.match-item.is-selected { border-color: var(--blue); background: #EFF4FF; box-shadow: 0 0 0 3px #BFD3FF; }
.match-item.is-done { border-color: var(--ok); background: #F0FDF4; color: var(--ok-dark); cursor: default; }
.match-item.is-bad { border-color: var(--err); background: #FEF2F2; }

.result { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 28px 18px; }
.result .xp-big { font-size: 3rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- Segnali ---------- */
.sign-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.sign-card { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 16px; }
.sign-card .sign-art { margin: 0; width: 96px; height: 96px; }
.sign-card .meaning { font-size: .9rem; color: var(--text-2); text-align: start; width: 100%; }
.sign-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 2px solid var(--border); background: #fff; border-radius: 999px; padding: 8px 14px; min-height: 40px; font: inherit; font-weight: 700; cursor: pointer; color: var(--text); }
.pill[aria-pressed="true"] { border-color: var(--blue); background: #EFF4FF; color: var(--blue-dark); }

/* ---------- Home / profili / confronto ---------- */
.welcome { min-height: calc(100vh - 220px); align-content: center; max-width: 560px; margin: 0 auto; display: grid; gap: 22px; text-align: center; padding-block: 8px; }
.welcome .privacy-line { font-size: .9rem; color: var(--text-2); margin: 0; }
.logo-big { font-size: 3rem; font-weight: 800; color: var(--blue-dark); letter-spacing: -.02em; line-height: 1.1; }
.logo-big b { color: var(--orange-dark); }
.profile-choose { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.profile-btn { display: grid; gap: 4px; justify-items: center; padding: 20px 10px; border: 2px solid var(--border); border-radius: 18px; background: #fff; cursor: pointer; font: inherit; color: var(--text); }
.profile-btn:hover { border-color: var(--orange); box-shadow: var(--shadow); }
.avatar-photo { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; display: block; background: #fff; border: 4px solid var(--blue); box-shadow: var(--shadow); }
.avatar-photo.sami { border-color: var(--orange); }
.avatar-photo.sm { width: 56px; height: 56px; border-width: 3px; }
.profile-btn .avatar-photo { width: min(34vw, 132px); height: min(34vw, 132px); }
.profile-btn { transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.profile-btn:hover { transform: translateY(-2px); }
.profile-btn:active { transform: scale(.98); }
.greet { display: flex; align-items: center; gap: 14px; }
.greet h1 { margin: 0; flex: 1; min-width: 0; }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; color: #fff; }
.avatar.bilal { background: var(--blue); }
.avatar.sami { background: var(--orange); color: #1B1306; }
.profile-name { font-size: 1.5rem; font-weight: 800; }
.compare { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.compare-col { text-align: center; display: grid; gap: 8px; justify-items: center; }
.compare-col.lead { border-color: var(--orange); }
.compare-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 10px 0; border-block-end: 1px solid var(--border); text-align: center; }
.compare-row:last-child { border-block-end: 0; }
.compare-row .lbl { font-size: .85rem; color: var(--text-2); font-weight: 600; }
.compare-row .val { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.compare-row .val.win { color: var(--orange-dark); }

/* ---------- Modale e toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(23, 32, 51, .45); display: grid; place-items: center; padding: 16px; z-index: 60; }
.modal { background: #fff; border-radius: 18px; padding: 22px; max-width: 460px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(23, 32, 51, .25); }
.modal .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-block-start: 16px; }
.toasts { position: fixed; inset-inline: 0; inset-block-end: calc(var(--nav-h) + 12px); display: grid; gap: 8px; justify-items: center; z-index: 70; pointer-events: none; padding: 0 12px; }
@media (min-width: 820px) { .toasts { inset-block-end: 20px; } }
.toast { background: var(--blue-dark); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); max-width: 420px; animation: fade .18s ease-out; }
.toast.badge { background: var(--orange); color: #1B1306; }

/* Frecce e icone direzionali si specchiano in RTL */
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

/* ---------- Movimento ridotto ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }

@media (max-width: 560px) { #xpChip { display: none; } .app-header { padding-inline: 12px; } .lang-toggle button { padding-inline: 10px; } }

@media (max-width: 380px) {
  main { padding-inline: 12px; }
  .logo-big { font-size: 2.1rem; }
  .match-grid { gap: 8px; }
  .match-item { font-size: .9rem; padding: 6px; }
  .q-prompt { font-size: 1.3rem; }
  .stat-value { font-size: 1.6rem; }
}


/* ---------- Schermata di avvio (3 secondi) ---------- */
.splash { position: fixed; inset: 0; z-index: 200; background: #fff; transition: opacity .4s ease; }
.splash.is-leaving { opacity: 0; pointer-events: none; }
.splash-stage { position: relative; width: 100%; height: 100%; max-width: 560px; margin-inline: auto; overflow: hidden; background: #fff; display: grid; place-items: center; padding-block-end: 14%; }
/* L'immagine si vede intera (volti compresi) e sfuma nel bianco sopra e sotto. */
.splash-img { width: 100%; height: auto; max-height: 100%; object-fit: contain; display: block; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%); }
.splash-load {
  position: absolute; inset-inline: 7%; inset-block-end: calc(6% + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 12px 18px; box-shadow: 0 6px 24px rgba(23, 32, 51, .18);
}
.splash-track { flex: 1; height: 14px; border-radius: 999px; background: var(--orange-light); overflow: hidden; }
.splash-fill { display: block; height: 100%; width: 0; background: var(--orange); border-radius: inherit; }
.splash-pct { min-width: 3.2ch; text-align: end; font-family: var(--font-display); font-weight: 800; color: var(--blue-dark); font-variant-numeric: tabular-nums; }
.no-splash .splash { display: none; }
