/* Concept : un tableau d'affichage de station. Fond neige, encre sapin, orange de balise de piste. Tout se lit en plein soleil, le pouce sur le telephone. */
:root {
  --snow: #EDF3F4; --panel: #FFFFFF; --panel-2: #E0E9EB; --ink: #0E2229; --muted: #4A6069; --line: #C5D3D7;
  --balise: #C8410B; --on-balise: #FFFFFF; --glacier: #0A6480; --live: #08734A; --warn: #8A5000; --warn-bg: #FBEFD9;
  --pole-dark: #0E2229;
  --display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --snow: #0A1519; --panel: #12222A; --panel-2: #1B2F38; --ink: #EAF2F3; --muted: #9FB4BC; --line: #2C424C;
  --balise: #FF7D38; --on-balise: #1C0B00; --glacier: #62BEDA; --live: #55D597; --warn: #F2B860; --warn-bg: #33260F;
  --pole-dark: #EAF2F3; color-scheme: dark } }
:root[data-theme="dark"] {
  --snow: #0A1519; --panel: #12222A; --panel-2: #1B2F38; --ink: #EAF2F3; --muted: #9FB4BC; --line: #2C424C;
  --balise: #FF7D38; --on-balise: #1C0B00; --glacier: #62BEDA; --live: #55D597; --warn: #F2B860; --warn-bg: #33260F;
  --pole-dark: #EAF2F3; color-scheme: dark }
* { box-sizing: border-box }
body { background: var(--snow); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.4; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) }
button, select, input { font: inherit; color: inherit }
button { cursor: pointer }
:focus-visible { outline: 3px solid var(--glacier); outline-offset: 2px }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
.pole { height: 10px; background: repeating-linear-gradient(90deg, var(--balise) 0 44px, var(--pole-dark) 44px 88px) }
header .wrap { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 20px; padding-block: 14px 12px }
.brand { font-family: var(--display); font-weight: 900; font-size: 2.5rem; line-height: .95; letter-spacing: .01em; text-transform: uppercase; margin: 0 }
.sub { color: var(--muted); font-size: .9rem; margin: 3px 0 0 }
.sync { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: .86rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel) }
.sync i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted) }
.sync.ok i { background: var(--live) } .sync.wait i { background: var(--warn) }
.demo { background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: .9rem }
.demo .wrap { padding-block: 7px }
nav { position: fixed; z-index: 5; inset: auto 0 0 0; background: var(--panel); border-top: 2px solid var(--ink); padding-bottom: env(safe-area-inset-bottom, 0px) }
nav .wrap { display: grid; padding-left: max(4px, env(safe-area-inset-left, 0px)); padding-right: max(4px, env(safe-area-inset-right, 0px)) }
nav a { display: block; text-align: center; padding: 15px 1px 13px; color: var(--muted); font-weight: 700; font-size: .84rem; text-decoration: none; border-top: 4px solid transparent; margin-top: -2px }
nav a[aria-current="page"] { color: var(--ink); border-top-color: var(--balise) }
main { padding-block: 18px 30px }
main .stack { display: grid; gap: 22px }
h2 { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.65rem; line-height: 1.05; letter-spacing: .015em; margin: 0; text-wrap: balance }
h3 { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.3rem; letter-spacing: .02em; margin: 0 }
.sec { display: grid; gap: 10px; min-width: 0 }
.sec-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px }
.note { color: var(--muted); font-size: .92rem; margin: 0; max-width: 68ch }
.bn { display: inline-block; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--muted); vertical-align: -2px; background: linear-gradient(90deg, var(--c1) 50%, var(--c2) 50%) }
.tm { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; overflow-wrap: anywhere }
.tm.ph { color: var(--muted); font-weight: 500; font-style: italic }
.num { font-variant-numeric: tabular-nums }
.chip { display: inline-block; font-size: .76rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); white-space: nowrap }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted) }
.pill.live { color: var(--live) }
.pill.live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite }
@keyframes pulse { 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .pill.live::before { animation: none } }
.alert { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; font-weight: 600; font-size: .94rem; border-radius: 4px }
.alert ul { margin: 4px 0 0; padding-left: 18px; font-weight: 500 }

/* Tableau des terrains */
.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px }
.board { background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--ink); border-radius: 3px; padding: 12px 14px; display: grid; gap: 10px; align-content: start; min-width: 0 }
.board-h { display: flex; justify-content: space-between; align-items: center; gap: 8px }
.vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center }
.vs .tm { font-size: .98rem; line-height: 1.18 }
.vs .tm:first-child { justify-content: flex-end; text-align: right; flex-direction: row-reverse }
.big { font-family: var(--display); font-weight: 900; font-size: 3.5rem; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums }
.big.idle { color: var(--muted); font-size: 1.6rem }
.next { border-top: 1px solid var(--line); padding-top: 8px; color: var(--muted); font-size: .88rem }
.next b { color: var(--ink); font-weight: 600 }

/* Mon equipe */
.follow { display: grid; gap: 10px; background: var(--panel-2); padding: 12px 14px; border-radius: 3px }
.field { display: grid; gap: 3px; font-size: .84rem; font-weight: 600; color: var(--muted); min-width: 0 }
select, input[type="number"] { background: var(--panel); border: 1px solid var(--muted); border-radius: 3px; padding: 9px; min-height: 44px; color: var(--ink); width: 100%; font-weight: 500; font-size: 1rem }
.follow-next { font-size: 1.05rem } .follow-next strong { font-family: var(--display); font-size: 1.45rem; font-weight: 800; margin-right: 4px }
.flag { color: var(--warn); font-weight: 700; font-size: .9rem }

/* Lignes de match */
.list { background: var(--panel); border: 1px solid var(--line); border-radius: 3px }
.row { display: grid; grid-template-columns: 148px minmax(0, 1fr) 72px minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left }
.row:first-child { border-top: 0 }
button.row:hover { background: var(--panel-2) }
.meta { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline }
.meta .h { font-weight: 700; font-variant-numeric: tabular-nums }
.row .a { justify-content: flex-end; text-align: right; flex-direction: row-reverse }
.score { text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.45rem; font-variant-numeric: tabular-nums; white-space: nowrap }
.score.none { color: var(--muted); font-weight: 700; font-size: 1.1rem }
.score.on { color: var(--live) }
.won { font-weight: 700 } .lost { font-weight: 500; color: var(--muted) }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; max-width: 560px }

/* Poules */
.pools { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr)); gap: 18px }
.tbl { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 3px }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .92rem }
th { font-size: .74rem; letter-spacing: .03em; color: var(--muted); font-weight: 700; text-align: center; padding: 7px 5px; border-bottom: 1px solid var(--line) }
td { text-align: center; padding: 8px 5px; border-top: 1px solid var(--line) }
th.l, td.l { text-align: left; padding-left: 10px }
table.pool td.l { min-width: 172px } table.pool .tm { overflow-wrap: normal }
.dest { white-space: nowrap }
td.pts { font-weight: 700; font-size: 1.04rem }
tr.mine td { background: var(--panel-2) }
.dest { color: var(--muted); font-size: .72rem; font-weight: 700; display: block; letter-spacing: .03em; text-transform: uppercase; margin-left: 22px }

/* Tableaux */
.brackets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 20px }
.bracket { display: grid; gap: 8px; min-width: 0 }
.b-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: stretch }
.bx { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 7px 9px; display: grid; gap: 4px; align-content: start; min-width: 0 }
.bx.final { border: 2px solid var(--ink) }
.bx-h { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em }
.bl { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: .9rem }
.bl .tm { font-size: .88rem; line-height: 1.15 }
.bl b { font-variant-numeric: tabular-nums; font-size: 1.02rem }
.col { display: grid; gap: 8px; align-content: start; min-width: 0 }
.rank { columns: 2 260px; column-gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 8px 12px; list-style: none; margin: 0 }
.rank li { display: flex; gap: 9px; align-items: center; break-inside: avoid; padding: 5px 0; border-bottom: 1px solid var(--line) }
.rank .p { font-family: var(--display); font-weight: 800; font-size: 1.25rem; width: 27px; text-align: right; font-variant-numeric: tabular-nums }

/* Saisie */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden }
.seg button { border: 0; background: var(--panel); padding: 12px 4px; font-weight: 700; min-height: 48px; border-left: 1px solid var(--line) }
.seg button:first-child { border-left: 0 }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--snow) }
.mark { background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--ink); border-radius: 3px; padding: 12px; display: grid; gap: 12px }
.mark-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: center }
.mark-h h3 { font-size: 1.35rem }
.sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px }
.side { display: grid; gap: 8px; align-content: start; min-width: 0 }
.side-n { display: flex; justify-content: center; min-height: 2.7em; align-items: center; text-align: center }
.side-n .tm { font-size: .98rem; line-height: 1.15; justify-content: center }
.digit { font-family: var(--display); font-weight: 900; font-size: 5.6rem; line-height: .95; text-align: center; font-variant-numeric: tabular-nums }
.plus { background: var(--balise); color: var(--on-balise); border: 0; border-radius: 5px; min-height: 92px; font-family: var(--display); font-weight: 900; font-size: 1.9rem; text-transform: uppercase; letter-spacing: .02em }
.plus:active { transform: translateY(2px) }
.minor { display: grid; grid-template-columns: 1fr; gap: 6px }
.btn { min-height: 46px; padding: 9px 14px; border: 2px solid var(--ink); border-radius: 4px; background: var(--panel); font-weight: 700 }
.btn.primary { background: var(--ink); color: var(--snow); min-height: 62px; font-size: 1.1rem; width: 100% }
.btn.small { min-height: 44px; padding: 6px 10px; font-size: .92rem }
.btn:disabled, .plus:disabled { opacity: .45; cursor: not-allowed }
.btn.sel { background: var(--glacier); color: var(--panel); border-color: var(--glacier) }
.btn.danger { border-color: var(--balise); color: var(--balise) }
.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 4px; font-size: .9rem; font-weight: 600; text-align: center; border: 1px solid var(--line); border-radius: 4px }
.stepper button { min-height: 44px; border: 0; background: none; font-weight: 800; font-size: 1.2rem }
.stepper span { line-height: 1.1; font-size: .84rem }
.actions { display: grid; gap: 8px } .inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.pager { display: grid; grid-template-columns: 52px minmax(0,1fr) 52px; gap: 8px; align-items: center; text-align: center; font-weight: 600; font-size: .92rem }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 20px; align-items: start }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 12px 14px; display: grid; gap: 10px; min-width: 0 }
.rule { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 4px 10px; font-size: .92rem; padding: 6px 0; border-top: 1px solid var(--line) }
.tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--glacier) } .tag.hyp { color: var(--warn) }
.hist { list-style: none; margin: 0; padding: 0; font-size: .9rem; display: grid; gap: 5px; max-height: 280px; overflow-y: auto }
.toast { position: fixed; z-index: 6; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-width: 520px; margin: 0 auto; background: var(--ink); color: var(--snow); padding: 12px 14px; border-radius: 5px; display: flex; gap: 12px; align-items: center; justify-content: space-between; font-weight: 600 }
.toast button { background: none; border: 2px solid var(--snow); color: var(--snow); border-radius: 4px; padding: 8px 12px; min-height: 44px; font-weight: 700 }

@media (max-width: 680px) {
  .row { grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr) }
  .row .meta { grid-column: 1 / -1 }
  .brand { font-size: 1.75rem; white-space: nowrap }
  .sub, .hide-sm { display: none }
  header .wrap { padding-block: 9px 7px; align-items: center }
  .sync { font-size: .76rem; padding: 3px 7px }
  .demo { font-size: .8rem } .demo .wrap { padding-block: 4px }
  main { padding-block: 12px 30px }
  .digit { font-size: 4.4rem } .plus { min-height: 84px }
}
@media (min-width: 821px) {
  body { padding-bottom: 0 }
  nav { position: static; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line) }
  nav .wrap { display: flex; gap: 22px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
  nav a { font-size: .98rem; padding: 10px 2px; border-top: 0; border-bottom: 4px solid transparent; margin: 0 }
  nav a[aria-current="page"] { border-bottom-color: var(--balise) }
  .toast { bottom: 24px }
  .plus { min-height: 110px } .digit { font-size: 7rem }
  .mark { max-width: 760px }
}
.top { display: flex; align-items: center; gap: 12px; min-width: 0 }
.top img { height: 46px; width: auto; flex: none }
.lg { flex: none; width: 26px; height: 26px; border-radius: 50%; object-fit: contain; background: #fff; box-shadow: 0 0 0 2px var(--c1); }
.side-n .lg, .vs .lg { width: 34px; height: 34px }
.foot { color: var(--muted); font-size: .9rem; padding-block: 8px 20px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center }
.foot a, .foot button { color: var(--glacier); font-weight: 600; background: none; border: 0; padding: 8px 0; text-decoration: underline; min-height: 44px }
.login { display: grid; gap: 12px; max-width: 420px }
input[type="email"], input[type="password"], input[type="text"], input[type="date"] { background: var(--panel); border: 1px solid var(--muted); border-radius: 3px; padding: 9px; min-height: 44px; color: var(--ink); width: 100%; font-size: 1rem }
.teamrow { display: grid; grid-template-columns: minmax(0, 1fr) 48px 48px 48px; gap: 8px; align-items: end; padding: 8px 0; border-top: 1px solid var(--line) }
.teamrow:first-of-type { border-top: 0 }
input[type="color"] { width: 48px; height: 44px; padding: 2px; background: var(--panel); border: 1px solid var(--muted); border-radius: 3px }
.logo-pick { position: relative; width: 48px; height: 44px; border: 1px dashed var(--muted); border-radius: 3px; display: grid; place-items: center; overflow: hidden; font-size: .7rem; font-weight: 700; text-align: center; color: var(--muted); cursor: pointer; background: var(--panel) }
.logo-pick img { width: 100%; height: 100%; object-fit: contain; background: #fff }
.logo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer }
.hint { color: var(--muted); font-size: .84rem }
nav .wrap { grid-template-columns: repeat(var(--tabs, 4), 1fr) }
.side-n { min-height: 3.8em }
@media (max-width: 680px) { .row .tm { font-size: .9rem; overflow-wrap: break-word } }
