/*
  FFHL — la pista come sistema grafico.
  Ghiaccio chiaro come fondo, testata blu notte come le balaustre, linea rossa centrale
  e linea blu sotto la testata; risultati in stile tabellone del palazzetto.
  Caratteri: Barlow Condensed (maglie e tabelloni) per titoli e numeri, Barlow per il testo.
*/
:root {
  --ice: #eef3f8;
  --ice-2: #e2eaf3;
  --paper: #ffffff;
  --ink: #0e2238;
  --ink-2: #4b5d74;
  --line: #d4dde8;
  --navy: #0e2238;
  --navy-2: #16304d;
  --red: #c8102e;
  --blue: #1e5aa8;
  --gold: #e3a72f;
  --green: #17804a;
  --r: 8px;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-family: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--ice);
}
* { box-sizing: border-box; min-width: 0; }
body { margin: 0; background: var(--ice) linear-gradient(180deg, #f7fafd 0, var(--ice) 420px) no-repeat; min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--cond); line-height: 1.05; margin: 0; }
h1 { font-size: 2.1rem; font-weight: 800; margin-bottom: .4rem; }
h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: .8rem; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
h3 { font-size: 1.05rem; font-weight: 700; margin: .5rem 0 .3rem; }
.more { font-family: Barlow, sans-serif; font-size: .85rem; font-weight: 600; }
.sub { color: var(--ink-2); margin: 0 0 1rem; }
.muted { color: var(--ink-2); }
.note { color: var(--ink-2); font-size: .85rem; }
.warn { color: var(--red); font-weight: 600; }
.ok { color: var(--green); font-weight: 600; }
.err { color: var(--red); }
code { background: var(--ice-2); padding: 0 .25rem; border-radius: 3px; font-size: .85em; }

.badge { border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; background: var(--ice-2); }

/* competizione */
.comp { font-family: Barlow, sans-serif; font-size: .72rem; font-weight: 700; color: #fff; background: var(--navy); padding: .18rem .55rem; border-radius: 99px; vertical-align: middle; white-space: nowrap; }
.comp.coppa { background: var(--gold); color: var(--navy); }
.comp.playoff { background: var(--red); }

/* testata: balaustra blu notte, poi linea rossa e linea blu */
.top { position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff; }
.top .bar { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 1.4rem; padding: .55rem 1rem; flex-wrap: wrap; }
.top .lines { height: 9px; background: linear-gradient(var(--red) 0 4px, var(--ice) 4px 6px, var(--blue) 6px 9px); }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand b { font-family: var(--cond); font-style: italic; font-weight: 800; font-size: 1.7rem; letter-spacing: .02em; line-height: 1; display: block; }
.brand small { display: block; font-size: .68rem; color: #9fb3cc; margin-top: 1px; }
.top nav { display: flex; gap: .1rem; flex-wrap: wrap; }
.top nav a { color: #c6d3e4; font-family: var(--cond); font-weight: 600; font-size: 1.08rem; padding: .3rem .6rem; border-radius: 6px; }
.top nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.top nav a.on { color: #fff; box-shadow: inset 0 -3px 0 var(--red); border-radius: 0; }
.who { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .88rem; }
.who a { color: #c6d3e4; }
.who a:hover { color: #fff; }
.who .me { display: flex; align-items: center; gap: .4rem; color: #fff; font-weight: 600; }
.who .login { background: var(--red); color: #fff; padding: .35rem .9rem; border-radius: 6px; font-weight: 700; }

main { max-width: 1180px; margin: 0 auto; padding: 1.6rem 1rem 3rem; }
footer { display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--ink-2); font-size: .8rem; padding: 2rem 1rem; text-align: center; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.narrow { max-width: 440px; margin: 2rem auto; }
.narrow.wide { max-width: 560px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1rem; align-items: start; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }

/* squadra dell'utente */
.teamhead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem 1.2rem; background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--tc, var(--blue)); border-radius: var(--r); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.teamhead h1 { margin: 0; font-size: 2rem; }
.slogan { margin: .15rem 0 0; font-style: italic; color: var(--ink-2); }
.facts { display: flex; gap: 1.6rem; margin: 0; flex-wrap: wrap; }
.facts dt { font-size: .75rem; color: var(--ink-2); }
.facts dd { margin: 0; font-family: var(--cond); font-weight: 800; font-size: 1.7rem; line-height: 1.05; }
.facts dd.txt { font-family: Barlow, sans-serif; font-size: .95rem; font-weight: 600; line-height: 1.3; }
.facts dd small { font-family: Barlow, sans-serif; font-size: .78rem; font-weight: 500; color: var(--ink-2); }
.rosterhead { display: flex; align-items: center; gap: .9rem; margin-bottom: .5rem; }
.rosterhead h2 { margin: 0; }

/* hero: il cerchio d'ingaggio e il conto alla rovescia */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.5rem; align-items: center; background: var(--navy); color: #fff; border-radius: var(--r); padding: 1.6rem 1.8rem; margin-bottom: 1rem; }
.hero .faceoff { position: absolute; left: -175px; top: 50%; width: 360px; height: 360px; transform: translateY(-50%); color: var(--red); opacity: .5; pointer-events: none; }
.hero-main { position: relative; }
.kicker { margin: 0 0 .3rem; color: #9fb3cc; font-weight: 600; }
.countdown { font-family: var(--cond); font-weight: 800; font-size: clamp(2.8rem, 7vw, 4.6rem); line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: .15em; text-shadow: 0 0 18px rgba(227, 167, 47, .35); }
.countdown small { font-size: .32em; color: #c6d3e4; margin-right: .35em; font-weight: 700; text-shadow: none; }
.when { margin: .4rem 0 0; color: #c6d3e4; }
.nextlist { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: .6rem; }
.nextlist li { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--r); padding: .75rem .9rem; display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.nextlist b { font-family: var(--cond); font-size: 1.35rem; font-weight: 800; }
.nextlist .opp { display: flex; align-items: center; gap: .35rem; color: #c6d3e4; font-size: .9rem; margin-top: .25rem; }
.nextlist .act { display: flex; align-items: center; gap: .7rem; font-size: .88rem; }
.nextlist .ok { color: #6fd39a; }
.nextlist .warn { color: #ff8f9f; }

.flash { background: #fff6e2; border: 1px solid #f0d49b; padding: .7rem 1rem; border-radius: var(--r); margin-bottom: 1rem; }
.flash.ok { background: #e8f6ee; border-color: #b4dfc5; color: var(--ink); font-weight: 500; }
.flash.err { background: #fdecef; border-color: #f3bcc6; }
.flash ul { margin: 0; padding-left: 1.2rem; }

/* moduli */
form label { display: block; margin-bottom: .75rem; font-size: .9rem; color: var(--ink-2); font-weight: 500; }
input, select, textarea { font: inherit; width: 100%; padding: .55rem .65rem; border: 1px solid #c3cfdd; border-radius: 6px; background: #fff; color: var(--ink); margin-top: .25rem; min-height: 44px; }
input[type=color] { padding: .2rem; width: 80px; }
input[type=checkbox] { min-height: 0; }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; min-height: 0; }
button, .btn { font: inherit; font-weight: 700; background: var(--red); color: #fff; border: 0; border-radius: 6px; padding: .55rem 1.1rem; cursor: pointer; display: inline-block; min-height: 40px; line-height: 1.6; }
button:hover, .btn:hover { background: #a90d26; text-decoration: none; }
button:disabled { background: #b4c0cf; cursor: not-allowed; }
button.big { width: 100%; padding: .85rem; font-size: 1.05rem; margin-top: .5rem; font-family: var(--cond); font-size: 1.3rem; }
.small { padding: .25rem .75rem; font-size: .85rem; min-height: 34px; }
.ghost { background: transparent; color: var(--ink); border: 1px solid #c3cfdd; }
.ghost:hover { background: var(--ice); }
.inline { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin: .6rem 0; }
.inline > * { width: auto; margin-bottom: 0; }
.inline input, .inline select { width: auto; }
.chk { display: flex !important; gap: .45rem; align-items: center; margin: .2rem 0 !important; color: var(--ink) !important; font-weight: 400 !important; }
.chk input { width: auto; margin: 0; }
input.link { font-size: .75rem; min-height: 0; }
.logoprev { display: flex; align-items: center; gap: 1rem; margin: .3rem 0 1rem; }
.logoprev img { border-radius: 50%; border: 1px solid var(--line); object-fit: cover; }

/* formazione */
.lineup .counter { position: sticky; top: 68px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: .5rem .9rem; margin-bottom: 1rem; z-index: 2; font-weight: 600; }
.lineup .counter strong { font-family: var(--cond); font-size: 1.3rem; }
.lineup .counter.bad { background: #fdecef; border-color: var(--red); color: var(--red); }
.lblocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.lblock { border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); padding: .6rem 1rem 1rem; margin: 0 0 1rem; }
.lblock legend { font-family: var(--cond); font-weight: 800; font-size: 1.25rem; padding: 0 .35rem; }
.lblock label { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.lblock label span { font-family: var(--cond); font-weight: 700; font-size: 1rem; color: var(--ink-2); }
.lblock label select, .lblock label input { margin: 0; }
.lblock.res { background: #f6f9fc; }
.fbadge { background: var(--gold); color: var(--navy); font-size: .72rem; font-weight: 700; padding: .15rem .45rem; border-radius: 4px; }
.fbadge[hidden] { display: none; }

/* risultati: tabellone del palazzetto */
.score { font-family: var(--cond); font-weight: 800; font-variant-numeric: tabular-nums; background: var(--navy); color: var(--gold); padding: .12rem .6rem; border-radius: 5px; white-space: nowrap; font-size: 1.2rem; letter-spacing: .03em; box-shadow: inset 0 0 0 2px #24405f; }
.score em { font-style: normal; font-size: .7rem; color: #c6d3e4; margin-left: .25rem; letter-spacing: 0; }
.score.live { background: var(--red); color: #fff; box-shadow: none; }
.score.muted { background: var(--ice-2); color: var(--ink-2); box-shadow: none; }
.matches { list-style: none; padding: 0; margin: 0; }
.matches li a { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .7rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 500; }
.matches li:last-child a { border: 0; }
.matches li a:hover { text-decoration: none; background: var(--ice); }
.matches .t { display: flex; align-items: center; gap: .45rem; }
.matches .t.home { justify-content: flex-end; text-align: right; }

.match { border-top: 4px solid var(--navy); }
.match .mhead { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1rem; }
.match .tn { display: flex; align-items: center; gap: .6rem; font-family: var(--cond); font-weight: 800; font-size: 1.45rem; line-height: 1.05; }
.match .tn small { display: block; font-family: Barlow, sans-serif; font-weight: 500; color: var(--ink-2); font-size: .75rem; }
.match .tn.r { justify-content: flex-end; text-align: right; }
.match .score { font-size: 2rem; padding: .2rem 1rem; }
.totals { display: flex; justify-content: space-between; color: var(--ink-2); font-size: .85rem; margin: .7rem 0; gap: .5rem; flex-wrap: wrap; }
.totals .blocks span { margin: 0 .2rem; padding: .1rem .45rem; border-radius: 4px; background: var(--ice); }
.totals .blocks .home { background: #dbe8f8; color: var(--blue); font-weight: 600; }
.totals .blocks .away { background: #f9dfe4; color: var(--red); font-weight: 600; }
details summary { cursor: pointer; color: var(--blue); font-size: .9rem; margin: .4rem 0; font-weight: 600; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
table { border-collapse: collapse; width: 100%; }
table.block { margin-bottom: .6rem; font-size: .9rem; }
table.block caption { text-align: left; font-family: var(--cond); font-weight: 700; font-size: 1rem; color: var(--ink-2); padding: .3rem 0; }
table.block td { padding: .32rem .3rem; border-top: 1px solid var(--line); vertical-align: top; }
td.role { width: 1.6rem; color: var(--ink-2); font-family: var(--cond); font-weight: 700; }
td.pts { text-align: right; font-family: var(--cond); font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.empty td, tr.absent td { color: var(--red); }
tr.pending td { color: var(--ink-2); }
.det { font-size: .76rem; color: var(--ink-2); }
.out { font-size: .76rem; color: var(--red); text-decoration: line-through; }
.in { color: var(--green); font-weight: 700; }
.club { font-size: .72rem; color: var(--ink-2); font-weight: 600; }
.fx { font-size: .62rem; font-weight: 700; color: var(--navy); background: var(--gold); border-radius: 3px; padding: 0 .25rem; vertical-align: 1px; }
.fixtures td { padding: .38rem .3rem; border-top: 1px solid var(--line); font-size: .9rem; }
td.l, th.l { text-align: left; }

/* classifica */
table.standings th, table.standings td { padding: .48rem .35rem; text-align: center; font-variant-numeric: tabular-nums; }
table.standings th { font-size: .78rem; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid var(--navy); }
table.standings td { border-bottom: 1px solid var(--line); }
table.standings td.l, table.standings th.l { text-align: left; }
table.standings td.tm { font-weight: 600; }
table.standings td.tm .badge { margin-right: .5rem; }
table.standings td.pt { font-family: var(--cond); font-weight: 800; font-size: 1.2rem; }
table.standings tr.cut td { border-bottom: 3px solid var(--red); }
table.standings tr.po td { color: var(--ink-2); }
table.standings tr.po td.tm { font-weight: 500; }

.rounds { list-style: none; padding: 0; margin: 0; }
.rounds a { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.rounds strong { font-family: var(--cond); font-size: 1.15rem; }
.rounds span { color: var(--ink-2); font-size: .85rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.tabs a { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem .3rem .35rem; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); font-size: .9rem; font-weight: 500; }
.tabs a:not(:has(.badge)) { padding-left: .8rem; }
.tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
table.roster caption { text-align: left; font-family: var(--cond); font-weight: 700; font-size: 1.1rem; padding: .3rem 0; }
table.roster td { padding: .32rem; border-top: 1px solid var(--line); font-size: .9rem; text-align: right; }
table.roster td.l { text-align: left; }
table.admin td, table.admin th { padding: .4rem .3rem; border-top: 1px solid var(--line); font-size: .88rem; text-align: left; vertical-align: top; }
.log { padding-left: 1.1rem; }
.log li { margin: .25rem 0; }
.log li.win { color: var(--green); }
.teamusers { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .6rem; }
td.acts { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
td.acts form { margin: 0; }
.tag { background: var(--navy); color: #fff; border-radius: 4px; padding: 0 .35rem; font-size: .7rem; }

/* tabelloni */
.bracket { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; align-items: start; }
.stage h3 { color: var(--ink-2); }
.serie { border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 6px; padding: .5rem .7rem; margin-bottom: .6rem; background: #fff; }
.serie > div { display: flex; justify-content: space-between; align-items: center; padding: .2rem 0; gap: .4rem; }
.serie > div span { display: flex; align-items: center; gap: .35rem; }
.serie > div b { font-family: var(--cond); font-size: 1.1rem; min-width: 1.6rem; text-align: center; background: var(--navy); color: var(--gold); border-radius: 4px; }
.serie .win { font-weight: 700; color: var(--green); }
.serie.done { border-left-color: var(--green); }

/* tabellini */
table.edit select, table.edit input { margin: 0; padding: .35rem; font-size: .85rem; min-height: 36px; }
table.edit th { font-size: .75rem; color: var(--ink-2); }

/* regolamento */
.rules { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1rem; align-items: start; }
.toc { position: sticky; top: 72px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem; display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; max-height: calc(100vh - 90px); overflow: auto; }
.md-body { line-height: 1.62; max-width: 860px; }
.md-body h1 { font-size: 2.2rem; }
.md-body h2 { font-size: 1.45rem; margin: 1.8rem 0 .5rem; padding-top: .8rem; border-top: 3px solid var(--blue); display: block; scroll-margin-top: 80px; }
.md-body blockquote { margin: .3rem 0 .3rem 1.2rem; padding: 0; }
.md-body p { margin: .5rem 0; }
table.md { border-collapse: collapse; margin: .6rem 0; }
table.md th, table.md td { border: 1px solid var(--line); padding: .35rem .5rem; font-size: .85rem; text-align: center; }
.scroll { overflow-x: auto; }
textarea.mdedit { font-size: .85rem; line-height: 1.5; }

.mystrip { display: none; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 1.3rem; }
  .hero .faceoff { left: auto; right: -90px; top: -60px; transform: none; width: 260px; height: 260px; opacity: .35; }
  .teamhead { grid-template-columns: auto minmax(0, 1fr); }
  .teamhead .facts { grid-column: 1 / -1; }
  .rules { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .sides { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top .bar { padding: .45rem .7rem; gap: .4rem .8rem; }
  .brand small { display: none; }
  .who .me span { display: none; }
  .top nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .top nav a { font-size: 1rem; padding: .3rem .5rem; white-space: nowrap; flex: none; }
  .lineup .counter { top: 104px; }
  main { padding: 1rem .7rem 2rem; }
  h1 { font-size: 1.75rem; }
  .match .tn { font-size: 1.1rem; }
  .match .tn .badge { width: 28px; height: 28px; }
  .match .score { font-size: 1.5rem; padding: .15rem .6rem; }
  .facts { gap: 1rem; }
  .facts dd { font-size: 1.4rem; }
  table.edit thead { display: none; }
  table.edit tr { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; border-top: 1px solid var(--line); padding: .4rem 0; }
  table.edit td { border: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
table.freet th[data-k] { cursor: pointer; }
table.freet th.on { color: var(--ink); border-bottom-color: var(--red); }
table.freet td { font-size: .9rem; }
table.freet td.rk { color: var(--ink-2); }
table.freet tr[hidden] { display: none; }
.filt { margin-bottom: .8rem; }
