/* La Sfida - stile unico, mobile first */
:root {
  --brand: #e8432a;
  --brand-d: #c22f18;
  --amber: #f59e0b;
  --sun: #fcd116;
  --ink: #1c1917;
  --ink-2: #57534e;
  --muted: #8a817a;
  --line: #ebe4dd;
  --bg: #f8f5f1;
  --card: #ffffff;
  --win: #15803d;
  --win-bg: #e7f6ec;
  --loss: #c62828;
  --loss-bg: #fdeaea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 4px 14px rgba(28, 25, 23, .05);
  --grad: linear-gradient(100deg, #e11d48 0%, #e8432a 35%, #f7931e 75%, #fcd116 100%);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--brand-d); }
img { max-width: 100%; }
h1, h2, h3 { font-family: "Barlow Condensed", Inter, sans-serif; letter-spacing: .01em; line-height: 1.1; }
h1 { font-size: 28px; margin: 6px 0 12px; }
h2 { font-size: 21px; margin: 18px 0 10px; }
h3 { font-size: 17px; margin: 18px 0 8px; text-transform: uppercase; color: var(--ink-2); }
small { font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.c-win { color: var(--win); }
.c-loss { color: var(--loss); }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px; background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: var(--grad); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand span { display: flex; flex-direction: column; line-height: 1; }
.brand b { font: 800 20px/1 "Barlow Condensed", sans-serif; letter-spacing: .04em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.topnav { display: flex; gap: 2px; }
.topnav a {
  text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px;
  padding: 7px 10px; border-radius: 999px;
}
.topnav a.on { background: var(--ink); color: #fff; }
.topnav .nav-admin { color: var(--brand-d); }

.adminbar {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px 6px; background: #fff7ed;
  border-bottom: 1px solid #fde4c4; scrollbar-width: none;
}
.adminbar::-webkit-scrollbar { display: none; }
.adminbar a {
  flex: none; text-decoration: none; font-size: 13px; font-weight: 600; color: #9a3412;
  padding: 6px 11px; border-radius: 999px; background: #fff; border: 1px solid #fed7aa;
}
.adminbar a.on { background: #9a3412; color: #fff; border-color: #9a3412; }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; text-align: center; }

.wrap { max-width: 640px; margin: 0 auto; padding: 14px 14px 10px; }
.foot { max-width: 640px; margin: 0 auto; padding: 12px 14px 18px; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.foot a { color: var(--muted); }

/* ---------- hero ---------- */
.hero { text-align: center; margin: 6px 0 12px; }
.hero-img { width: 100%; max-width: 350px; height: auto; }
.hero-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }

/* ---------- live ---------- */
.live {
  display: flex; align-items: center; gap: 8px; overflow: hidden;
  background: var(--ink); color: #fff; border-radius: 999px; padding: 7px 14px; margin-bottom: 12px; font-size: 13px;
}
.live b { color: #ff6b5b; letter-spacing: .08em; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff3b30; flex: none; animation: pulse 1.4s infinite; }
.live-track { overflow: hidden; white-space: nowrap; flex: 1; }
.live-track span { display: inline-block; }
.live-track.scroll span { padding-left: 100%; animation: scroll 16s linear infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@keyframes scroll { to { transform: translateX(-100%); } }

/* ---------- strip risultati/prossime ---------- */
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; margin-bottom: 4px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: flex; flex-direction: column; gap: 1px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 7px 11px; font-size: 13px; min-width: 130px;
}
.chip small { color: var(--muted); font-size: 11px; }
.chip .score { font-weight: 700; color: var(--win); font-size: 12px; }
.chip-next { border-style: dashed; }

.hint { font-size: 12.5px; color: var(--ink-2); margin: 4px 2px 8px; }
.tag-up, .tag-down { font-weight: 700; padding: 0 6px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.tag-up { color: var(--win); background: var(--win-bg); }
.tag-down { color: var(--loss); background: var(--loss-bg); }

/* ---------- classifica ---------- */
.rank { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.rank .zone {
  font: 700 12px/1 Inter, sans-serif; text-transform: uppercase; letter-spacing: .06em;
  color: #9a3412; background: #fff4e6; padding: 8px 14px; border-top: 1px solid #fde4c4; border-bottom: 1px solid #fde4c4;
}
.rank .zone:first-child { border-top: 0; }
.rank .zone-mid { color: var(--ink-2); background: #f5f2ee; border-color: var(--line); }
.row {
  display: grid; grid-template-columns: 30px 38px 1fr auto auto; align-items: center; gap: 8px;
  padding: 8px 10px 8px 8px; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background .15s, opacity .15s; -webkit-tap-highlight-color: transparent;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: #fcfaf8; }
.pos { font: 800 19px/1 "Barlow Condensed", sans-serif; text-align: center; color: var(--ink-2); }
.row:nth-of-type(-n+4) .pos { color: var(--brand); }
.av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #efe9e3; display: block; }
.av-txt { display: flex; align-items: center; justify-content: center; font: 700 14px/1 Inter, sans-serif; color: var(--ink-2); }
.av-xl { width: 72px; height: 72px; font-size: 24px; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--brand); }
.name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico { font-size: 13px; margin-left: 2px; }
.grp { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; background: var(--muted); border-radius: 4px; padding: 1px 4px; vertical-align: 2px; }
.grp-A { background: #b45309; } .grp-B { background: #1d4ed8; } .grp-C { background: #7e22ce; }
.pts { font: 800 22px/1 "Barlow Condensed", sans-serif; min-width: 34px; text-align: right; }
.acts { display: flex; gap: 4px; }
.btn-ico {
  width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); background: #f4f0ec; text-decoration: none;
}
.btn-ico.wa { color: #128c4b; background: #e6f6ec; }
.is-inj .name { color: var(--muted); }
/* evidenziazione sfide */
.selecting .row.dim { opacity: .35; }
.row.sel { background: #fff7d6 !important; box-shadow: inset 4px 0 0 var(--amber); }
.row.can-up { background: var(--win-bg); box-shadow: inset 4px 0 0 var(--win); }
.row.can-down { background: var(--loss-bg); box-shadow: inset 4px 0 0 var(--loss); }

.selbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  width: min(612px, calc(100% - 24px)); display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; border-radius: 16px; padding: 10px 10px 10px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.selbar > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.selbar b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selbar small { color: #d6d3d1; }
.btn-x { background: transparent; color: #fff; border: 0; font-size: 24px; line-height: 1; padding: 4px 8px; cursor: pointer; }

.note-small { font-size: 12px; color: var(--muted); margin: 10px 2px; }
.cta { text-align: center; margin: 14px 0 0; }
body.has-selbar .wrap { padding-bottom: 90px; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); margin: 10px 0; }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 14px/1 Inter, sans-serif; padding: 11px 16px; min-height: 42px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #d6ccc2; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-danger { color: var(--loss); border-color: #f3c4c4; }
.btn-amber { background: #fff4e0; border-color: #fbd38d; color: #92400e; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-sm { padding: 7px 11px; min-height: 32px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.danger-zone { justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: 12px; }
.back { text-decoration: none; font-weight: 600; }

/* ---------- alert / badge ---------- */
.alert { padding: 11px 14px; border-radius: 11px; margin: 0 0 12px; font-size: 14px; border: 1px solid; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert-ok { background: var(--win-bg); border-color: #b7e4c7; color: #14532d; }
.alert-err { background: var(--loss-bg); border-color: #f5c2c2; color: #7f1d1d; }
.alert-warn { background: #fff7e0; border-color: #fbe0a0; color: #78350f; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #f1ece6; color: var(--ink-2); }
.badge-red { background: var(--loss-bg); color: var(--loss); }
.badge-amber { background: #fff1d6; color: #92400e; }

/* ---------- partite ---------- */
.filter { display: flex; gap: 8px; margin-bottom: 4px; }
.filter select { flex: 1; }
.sec { display: flex; align-items: center; gap: 8px; }
.count { font: 600 12px/1 Inter, sans-serif; background: var(--ink); color: #fff; padding: 3px 8px; border-radius: 999px; }
.match { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.match-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.match-body { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 12px; }
.pl { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; font-weight: 600; font-size: 14px; }
.pl span { display: flex; flex-direction: column; min-width: 0; }
.pl small { color: var(--muted); font-weight: 400; font-size: 11px; }
.pl-r { justify-content: flex-end; text-align: right; }
.pl.win { color: var(--win); }
.pl.win .av { box-shadow: 0 0 0 2px var(--win); }
.done .pl:not(.win) { color: var(--ink-2); }
.mid { text-align: center; }
.vs { font: 800 14px/1 "Barlow Condensed", sans-serif; color: #fff; background: var(--brand); border-radius: 999px; padding: 6px 9px; }
.score { font-weight: 700; font-size: 14px; white-space: nowrap; }
.match-note { margin: 0; padding: 0 12px 10px; font-size: 12.5px; color: var(--ink-2); }
.match-adm { display: flex; gap: 6px; align-items: center; padding: 8px 12px; background: #fffaf3; border-top: 1px solid #f6e7d3; }

/* ---------- scheda giocatore ---------- */
.pcard-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.pcard-head h1, .pcard-head h2 { margin: 0 0 4px; font-size: 26px; }
.pcard-meta { display: flex; align-items: baseline; gap: 12px; }
.big-pos { font: 800 28px/1 "Barlow Condensed", sans-serif; color: var(--brand); }
.big-pts { font: 800 24px/1 "Barlow Condensed", sans-serif; }
.big-pts small { font: 500 12px Inter, sans-serif; color: var(--muted); }
.reach { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.reach div { border-radius: 11px; padding: 8px 10px; display: flex; flex-direction: column; }
.reach .up { background: var(--win-bg); color: var(--win); }
.reach .down { background: var(--loss-bg); color: var(--loss); }
.reach small { color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.stats div { background: #f7f3ef; border-radius: 10px; padding: 8px; text-align: center; display: flex; flex-direction: column; }
.stats b { font: 800 22px/1.1 "Barlow Condensed", sans-serif; }
.stats small { color: var(--muted); }
.forma { display: flex; align-items: center; gap: 4px; margin: 6px 0 12px; }
.forma small { color: var(--muted); margin-right: 4px; }
.forma span { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #fff; }
.f-V { background: var(--win); } .f-S { background: var(--loss); }
.mlist, .movs, .simple { list-style: none; margin: 0; padding: 0; }
.mlist li, .movs li, .simple li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.mlist small { color: var(--muted); width: 100%; margin-top: -4px; }
.wl { display: inline-block; width: 20px; text-align: center; font-weight: 800; border-radius: 5px; color: #fff; font-size: 12px; }
.mlist .w .wl { background: var(--win); } .mlist .l .wl { background: var(--loss); }
.movs li span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.movs li small { color: var(--muted); }
.movs b { font-size: 16px; }
.btn-block + h3, .pcard .btn-block { margin-top: 12px; }

/* ---------- form ---------- */
.form-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.form-card.narrow { max-width: 440px; margin: 10px auto; }
.form-card h2:first-child { margin-top: 0; }
.form-logo { display: block; margin: 0 auto 6px; width: 130px; height: auto; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: 16px/1.3 Inter, sans-serif; color: var(--ink); background: #fff;
  border: 1px solid #ddd3c9; border-radius: 10px; padding: 10px 11px; min-height: 44px; width: 100%;
}
input:focus, select:focus { outline: 2px solid #fbb59f; border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); margin: 0; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp { position: absolute; left: -9999px; }
.lead { font-size: 16px; }
details.adv summary { cursor: pointer; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
form.inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
form.inline input[type=date] { width: auto; min-height: 32px; padding: 4px 8px; font-size: 14px; }
.verifica .alert { margin: 0; }
.esito, .vinc { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; }
.esito label, .vinc label { flex-direction: row !important; align-items: center; gap: 6px !important; color: var(--ink) !important; font-weight: 500 !important; }
.vinc { background: #fff7e0; padding: 10px 12px; border-radius: 10px; }
.sets { width: 100%; border-collapse: collapse; }
.sets th, .sets td { padding: 6px 3px; text-align: center; }
.sets thead th { font-size: 12px; color: var(--muted); font-weight: 600; }
.sets tbody th { text-align: left; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.sets tbody th span { display: flex; flex-direction: column; }
.sets tbody th small { font-weight: 400; color: var(--muted); }
.sets input { width: 54px; text-align: center; font-size: 20px; font-weight: 700; padding: 8px 4px; }
.sets input:disabled { background: #f3efeb; }

.tbl { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; margin: 8px 0 12px; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl thead th { background: var(--ink); color: #fff; font-weight: 600; font-size: 13px; }
.tbl-list a { color: var(--ink); font-weight: 600; text-decoration: none; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 14px; }
.kpis div { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; text-align: center; display: flex; flex-direction: column; }
.kpis b { font: 800 28px/1 "Barlow Condensed", sans-serif; color: var(--brand); }
.kpis small { color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.card-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; margin-bottom: 8px; }
.card-row.st-nuova { box-shadow: inset 4px 0 0 var(--brand), var(--shadow); }
.card-row.st-rifiutata { opacity: .6; }
.bars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; height: 120px; align-items: end; }
.bar { height: 100%; display: flex; align-items: flex-end; }
.bar span { display: block; width: 100%; min-height: 2px; background: var(--grad); border-radius: 3px 3px 0 0; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.log li { font-size: 13px; }

/* ---------- regolamento ---------- */
.doc { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.doc section { scroll-margin-top: 70px; }
.doc p, .doc li { color: #3a3633; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.toc a { font-size: 13px; text-decoration: none; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }

/* ---------- modale ---------- */
.modal { border: 0; padding: 0; background: transparent; width: min(560px, 100%); max-height: 92vh; margin: auto auto 0; }
.modal::backdrop { background: rgba(20, 16, 12, .55); }
.modal-box { position: relative; background: var(--bg); border-radius: 20px 20px 0 0; padding: 20px 16px 26px; max-height: 92vh; overflow-y: auto; }
.modal-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; font-size: 22px; cursor: pointer; box-shadow: var(--shadow); z-index: 2; }
.loading { text-align: center; color: var(--muted); padding: 30px; }
@media (min-width: 600px) {
  .modal { margin: auto; }
  .modal-box { border-radius: 20px; }
}

.brand b { white-space: nowrap; }
@media (max-width: 420px) {
  .topbar { padding: 8px 10px; gap: 6px; }
  .topnav { gap: 0; }
  .topnav a { padding: 6px 7px; font-size: 13px; }
  .brand { gap: 6px; }
  .brand img { width: 26px; height: auto; }
  .brand b { font-size: 18px; }
  .brand small { display: none; }
  .row { grid-template-columns: 26px 34px 1fr auto auto; gap: 6px; padding-left: 6px; }
  .av { width: 34px; height: 34px; }
  .btn-ico { width: 30px; height: 30px; }
  .grid2 { grid-template-columns: 1fr; }
  .pl { font-size: 13px; }
  .pl .av { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) { .live-track span, .live-dot { animation: none; } }
@media (max-width: 400px) {
  .is-admin .brand span { display: none; }
}

/* ---------- invito installazione app ---------- */
.install {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 25;
  width: min(612px, calc(100% - 24px)); display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 8px 10px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.install img { border-radius: 10px; flex: none; }
.install > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.install small { color: var(--ink-2); }
.install .btn-x { color: var(--ink-2); }
.selbar:not([hidden]) ~ .install, body:has(.selbar:not([hidden])) .install { display: none; }
@media (display-mode: standalone) {
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); }
}

/* ---------- impostazioni: sezioni attivabili ---------- */
.set-sec { border-top: 1px solid var(--line); padding-top: 4px; }
.set-sec:first-of-type { border-top: 0; padding-top: 0; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.set-head h2 { margin: 14px 0 8px; }
.set-sec.off .set-body { display: none; }
.set-sec.off h2 { color: var(--muted); }
.span2 { grid-column: 1 / -1; }
.switch { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 8px !important; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .sw { width: 44px; height: 26px; border-radius: 13px; background: #d6cfc8; position: relative; transition: background .15s; flex: none; }
.switch .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .sw { background: var(--win); }
.switch input:checked + .sw::after { transform: translateX(18px); }
.switch input:focus-visible + .sw { outline: 2px solid #fbb59f; outline-offset: 2px; }
.sw-txt { font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 62px; }

/* regolamento */
.doc h3 { text-transform: none; color: var(--ink); font-size: 17px; margin: 14px 0 6px; }
.doc section { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 8px; }
.note-box { background: #fff7e0; border-left: 4px solid var(--amber); border-radius: 8px; padding: 2px 14px; }

/* ---------- selettore torneo ---------- */
.tswitch {
  display: flex; gap: 4px; justify-content: center; padding: 10px 14px 0;
  max-width: 640px; margin: 0 auto;
}
.tswitch a {
  flex: 1; max-width: 200px; text-align: center; text-decoration: none; font-weight: 700; font-size: 14px;
  padding: 8px 10px; border-radius: 999px; color: var(--ink-2); background: #fff; border: 1px solid var(--line);
}
.tswitch a.on { color: #fff; border-color: transparent; }
.tswitch a.t-m.on { background: #e8432a; }
.tswitch a.t-f.on { background: #b0306f; }
.hero-title { font-size: 40px; margin: 6px 0 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-img-alt { max-height: 180px; width: auto; }

/* ---------- tema torneo femminile ---------- */
body.tema-lady {
  --brand: #b0306f;
  --brand-d: #8a1f55;
  --amber: #e0789f;
  --bg: #faf5f8;
  --line: #eee0e8;
  --grad: linear-gradient(100deg, #6a3fd1 0%, #b0306f 40%, #e8608f 75%, #f6b5a0 100%);
}
.tema-lady .rank .zone { color: #8a1f55; background: #fbeef4; border-color: #f3d3e2; }
.tema-lady .rank .zone-mid { color: var(--ink-2); background: #f6f0f3; border-color: var(--line); }
.tema-lady input:focus, .tema-lady select:focus { outline-color: #f0b3cd; }
.tema-lady .row.sel { background: #fdeef5 !important; }
.tema-lady .adminbar { background: #fbeef4; border-color: #f3d3e2; }
.tema-lady .adminbar a { color: #8a1f55; border-color: #f3c6da; }
.tema-lady .adminbar a.on { background: #8a1f55; color: #fff; border-color: #8a1f55; }

/* ---------- avviso all'apertura ---------- */
.avviso {
  --av: #2563eb; --av2: #60a5fa; --av-bg: #eff6ff;
  border: 0; padding: 0; background: transparent; width: min(440px, calc(100% - 28px)); max-height: calc(100% - 28px);
  margin: auto; overflow: visible;
}
.av-importante { --av: #c2410c; --av2: #f59e0b; --av-bg: #fff7ed; }
.av-urgente { --av: #b91c1c; --av2: #ef4444; --av-bg: #fef2f2; }
.av-evento { --av: #7c3aed; --av2: #ec4899; --av-bg: #faf5ff; }
.av-meteo { --av: #0f766e; --av2: #38bdf8; --av-bg: #f0fdfa; }
.avviso::backdrop { background: rgba(15, 12, 10, .62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.avviso[open] .av-card { animation: av-in .32s cubic-bezier(.2, .9, .3, 1.2); }
.avviso.av-out .av-card { animation: av-out .18s ease-in forwards; }
@keyframes av-in { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes av-out { to { opacity: 0; transform: translateY(12px) scale(.97); } }
.av-card {
  position: relative; background: #fff; border-radius: 24px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35); max-height: calc(100dvh - 28px); display: flex; flex-direction: column;
}
.av-top {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px 20px 18px; color: #fff; text-align: center;
  background: linear-gradient(135deg, var(--av) 0%, var(--av2) 100%);
}
.av-top::after { /* onda decorativa */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 16px;
  background: #fff; border-radius: 16px 16px 0 0;
}
.av-ico {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; background: rgba(255, 255, 255, .22); box-shadow: 0 0 0 6px rgba(255, 255, 255, .12);
  animation: av-pulse 2.4s ease-in-out infinite;
}
@keyframes av-pulse { 50% { box-shadow: 0 0 0 12px rgba(255, 255, 255, .06); } }
.av-tag { font: 700 11px/1 Inter, sans-serif; letter-spacing: .12em; text-transform: uppercase; opacity: .92; }
.av-body { padding: 4px 22px 18px; overflow-y: auto; }
.av-body h2 { font-size: 26px; margin: 2px 0 10px; text-align: center; color: var(--ink); }
.av-img { display: block; width: 100%; border-radius: 14px; margin: 4px 0 12px; }
.av-text { font-size: 15.5px; line-height: 1.55; color: #33302d; }
.av-text p { margin: 0 0 10px; }
.av-text a { color: var(--av); font-weight: 600; word-break: break-word; }
.av-check {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; padding: 10px 12px; border-radius: 12px;
  background: var(--av-bg); font-size: 14px; font-weight: 600; cursor: pointer;
}
.av-check input { width: 20px; height: 20px; accent-color: var(--av); }
.avviso .av-ok { margin-top: 12px; min-height: 50px; font-size: 16px; border: 0; background: linear-gradient(135deg, var(--av), var(--av2)); }
.avviso .av-ok:disabled { opacity: .45; cursor: not-allowed; }
.av-firma { text-align: center; color: var(--muted); font-size: 11.5px; margin: 10px 0 0; }
.av-x {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .25); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
@media (prefers-reduced-motion: reduce) { .avviso[open] .av-card, .av-ico { animation: none; } }

/* editor avviso in impostazioni */
.av-admin textarea { min-height: 130px; resize: vertical; font: 15px/1.45 Inter, sans-serif; }
.av-tipi { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin-bottom: 4px; }
.av-tipo { cursor: pointer; }
.av-tipo input { position: absolute; opacity: 0; }
.av-tipo span {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px;
  border: 2px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: center; background: #fff;
}
.av-tipo i { font-style: normal; font-size: 22px; }
.av-tipo input:checked + span { border-color: var(--brand); background: #fff7f3; color: var(--ink); box-shadow: 0 0 0 3px rgba(232, 67, 42, .12); }
.av-tipo input:focus-visible + span { outline: 2px solid var(--brand); }
.av-thumb { display: flex; align-items: center; gap: 12px; }
.av-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
