/* Échecs du dîner — feuille de style principale.
   Palette reprise du site du CFP Marie-Rollet (cfpmr.com) : bleu marine, bleu vif, jaune, fonds clairs. */
:root {
  --paper: #f5f7fb;
  --surface: #ffffff;
  --ink: #002744;          /* bleu marine du CFPMR : texte, en-tête, boutons */
  --ink-2: #4a5d70;
  --line: #d5dde8;
  --brand: #0b6fae;        /* bleu des liens (version assez foncée pour rester lisible) */
  --brand-bright: #0e82c9; /* bleu vif du CFPMR */
  --brand-dark: #002744;
  --square: #dcebf6;
  --amber: #facc15;        /* jaune du CFPMR : accents, « en cours » */
  --yellow: #ffe563;
  --amber-soft: #fff7cf;
  /* Les couleurs ci-dessus sont recalculées quand on personnalise le site (Gestion → Réglages du site).
     Les suivantes en découlent : fond de l'en-tête, texte lisible sur fond coloré. */
  --primary: var(--ink);
  --on-primary: #ffffff;
  --on-secondary: #ffffff;
  --on-accent: var(--ink);
  --header-accent: var(--yellow);
  --focus: #1863dc;
  --win: #23694a;
  --loss: #a93a2b;
  --draw: #5b6778;
  --radius: 6px;
  --head: "Manrope", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 1rem/1.55 var(--sans); min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; padding-block: 1.75rem 3rem; }
.wrap { width: min(100% - 2rem, 62rem); margin-inline: auto; }
.narrow { max-width: 30rem; }
.narrow-wide { max-width: 44rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--yellow); color: var(--on-accent); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.muted { color: var(--ink-2); }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* ---------- typographie */
h1, h2, h3 { font-family: var(--head); font-weight: 800; line-height: 1.2; margin: 0 0 .6rem; letter-spacing: -.015em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); }
h2 { font-size: 1.4rem; margin-top: 2.25rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; }
p { margin: 0 0 .9rem; max-width: 68ch; }
.lead { font-size: 1.1rem; color: var(--ink-2); }
.hint { display: block; font-size: .875rem; color: var(--ink-2); font-weight: 400; margin-top: .2rem; }
.help { font-size: .95rem; color: var(--ink-2); margin-top: 1rem; }
.empty { color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1rem; }
a { color: var(--brand); text-underline-offset: .15em; }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- en-tête bleu marine, avec une frise de cases d'échiquier dessous */
.site-header { background: var(--primary); color: var(--on-primary); position: relative; }
.site-header::after {
  content: ""; display: block; height: 8px;
  background: repeating-conic-gradient(var(--brand-bright) 0 25%, var(--yellow) 0 50%) 0 0 / 16px 16px;
}
.site-header :focus-visible { outline-color: var(--header-accent); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .75rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--on-primary);
  font: 800 1.3rem/1 var(--head); letter-spacing: -.015em; }
.brand:hover { color: var(--header-accent); }
.brand-text { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.brand-full { font: 500 .9rem/1.2 var(--sans); letter-spacing: 0; opacity: .85; }
.mark { width: 1.75rem; height: 1.75rem; }
.mark-a { fill: var(--yellow); }
.mark-b { fill: var(--brand-bright); }
.logo { height: 2.5rem; width: auto; max-width: 9rem; object-fit: contain; }
.kicker { font: 700 .85rem/1.2 var(--head); letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin: 0 0 .4rem; }
.nav { display: flex; align-items: center; gap: .25rem 1.1rem; flex-wrap: wrap; }
.nav a:not(.btn), .linkish { color: var(--ink); text-decoration: none; padding: .35rem 0; border-bottom: 2px solid transparent; }
.nav a:not(.btn):hover, .linkish:hover { border-bottom-color: var(--brand); }
.site-header .nav a:not(.btn), .site-header .linkish { color: var(--on-primary); }
.site-header .nav a:not(.btn):hover, .site-header .linkish:hover { border-bottom-color: var(--header-accent); color: var(--on-primary); }
.site-header .nav a[aria-current="page"] { border-bottom-color: var(--header-accent); font-weight: 700; }
.site-header .btn { background: var(--yellow); border-color: var(--yellow); color: var(--on-accent); }
.site-header .btn:hover { background: var(--on-primary); border-color: var(--on-primary); color: var(--primary); }
.nav-sep { width: 1px; height: 1.2rem; background: var(--on-primary); opacity: .35; }
.nav-toggle { display: none; }
form.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; border-bottom: 2px solid transparent; font: inherit; cursor: pointer; }

.site-footer { color: var(--ink-2); font-size: .875rem; padding-block: 1.25rem; border-top: 1px solid var(--line); }

/* ---------- boutons et formulaires */
.btn {
  display: inline-block; font: 700 1rem/1.2 var(--sans); background: var(--ink); color: #fff;
  border: 2px solid var(--ink); border-radius: var(--radius); padding: .65rem 1.1rem; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-quiet { background: transparent; color: var(--ink); }
.btn-quiet:hover { background: var(--square); border-color: var(--ink); color: var(--ink); }
.btn-small { padding: .35rem .7rem; font-size: .9rem; }
.btn-danger { background: transparent; border-color: var(--loss); color: var(--loss); }
.btn-danger:hover { background: var(--loss); border-color: var(--loss); color: #fff; }

label { display: block; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  display: block; width: 100%; margin-top: .3rem; font: 400 1rem var(--sans); color: var(--ink);
  background: var(--surface); border: 1.5px solid #8b98aa; border-radius: var(--radius); padding: .6rem .7rem;
}
textarea { resize: vertical; }
input.tiny { width: 5.5rem; padding: .35rem .5rem; margin: 0; }
td select { margin: 0; padding: .35rem .5rem; min-width: 14rem; }
td input[type=text], td input[type=email] { margin: 0 0 .3rem; padding: .35rem .5rem; min-width: 15rem; }
table.players td select { min-width: 9rem; }
.stack { display: grid; gap: 1.1rem; }
.stack + .stack, .aside-form { margin-top: 1rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.1rem; }
fieldset .row { grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); margin-top: .8rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
fieldset { border: 1.5px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin: 0; background: var(--surface); }
legend { font-weight: 700; padding-inline: .3rem; }
fieldset:disabled { opacity: .7; }
.choice { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin: .4rem 0; }
.choice input { margin-top: .3rem; }
.inline-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.inline-form label { min-width: 16rem; }
.inline-form select { min-width: 0; }

/* ---------- messages */
.flashes { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.flash { margin: 0; max-width: none; padding: .75rem 1rem; border-radius: var(--radius); border-left: 5px solid var(--brand-bright); background: var(--surface); }
.flash-success { border-left-color: var(--win); }
.flash-error { border-left-color: var(--loss); background: #fbeeec; }
.flash-info { border-left-color: var(--amber); background: var(--amber-soft); }

/* ---------- avatars et titres */
.avatar { display: inline-grid; place-items: center; width: 1.8em; height: 1.8em; border-radius: 50%; flex: none;
  background: var(--square); color: var(--ink); line-height: 1; vertical-align: middle; margin-right: .45rem;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", var(--sans); }
.avatar-initial { font: 800 .9em/1 var(--head); color: var(--ink); }
.avatar-lg { font-size: 2rem; margin-right: 0; }
h1 .avatar { font-size: .8em; }
.rank { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; font-weight: 700; line-height: 1.5;
  padding: .05rem .65rem .05rem .5rem; border-radius: 999px; white-space: nowrap; background: #e6ecf3; color: var(--ink); }
.rank-sym { font-size: 1.2em; line-height: 1; }
.rank-cavalier { background: #cfe6f6; color: #06426b; }
.rank-fou { background: var(--brand); color: #fff; }
.rank-tour { background: var(--ink); color: #fff; }
.rank-dame { background: var(--yellow); color: var(--on-accent); }
.rank-roi { background: var(--ink); color: var(--yellow); box-shadow: 0 0 0 2px var(--amber); }
.rank-mini { color: var(--ink-2); font-size: 1.1em; cursor: help; }
.rank-link { text-decoration: none; }
h2 .rank { font-size: 1rem; vertical-align: middle; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.3rem, 1fr)); gap: .5rem; }
.avatar-choice { position: relative; font-weight: 400; }
.avatar-choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.avatar-choice > span:not(.sr) { display: grid; place-items: center; height: 3.3rem; font-size: 1.7rem; line-height: 1;
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.avatar-choice > span.avatar-initial { font-size: 1.4rem; }
.avatar-choice input:checked + span { border-color: var(--ink); background: var(--yellow); box-shadow: 0 0 0 2px var(--ink); }
.avatar-choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.avatar-choice:hover > span:not(.sr) { border-color: var(--brand-bright); }

/* ---------- accueil */
.hero { padding-block: .5rem 1rem; }
.hero-rating { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.big-num { font: 800 clamp(3rem, 2rem + 5vw, 5rem)/1 var(--head); font-variant-numeric: tabular-nums; color: var(--brand-bright); letter-spacing: -.03em; }
.callout { background: var(--surface); border-left: 6px solid var(--amber); border-radius: var(--radius); padding: 1rem 1.25rem; margin-top: 1.5rem; }
.callout h2 { margin: 0 0 .4rem; font-size: 1.2rem; }
.callout p:last-child { margin-bottom: 0; }
.mini-board, .roster { list-style: none; margin: 0 0 1rem; padding: 0; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.mini-board { counter-reset: rang; max-width: 26rem; }
.mini-board li, .roster li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line); }
.mini-board li:last-child, .roster li:last-child { border-bottom: 0; }
.mini-board li::before { counter-increment: rang; content: counter(rang); width: 1.5rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mini-board li a { flex: 1; }
.roster { columns: 2 16rem; display: block; column-gap: 0; padding: 0; }
.roster li { break-inside: avoid; }
ul.plain { padding-left: 1.1rem; }
ul.plain li { margin-bottom: .3rem; }

/* ---------- liste de tournois */
.t-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.t-row { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: 1rem; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.t-date { display: grid; line-height: 1.3; }
.t-date span { color: var(--ink-2); font-size: .9rem; }
.t-name { font: 800 1.15rem/1.3 var(--head); }
.t-meta { color: var(--ink-2); font-size: .9rem; }
.t-side { display: grid; justify-items: end; gap: .15rem; font-size: .9rem; }
.mine { color: var(--win); font-weight: 600; }
.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: var(--square); color: var(--ink); white-space: nowrap; }
.badge-in_progress { background: var(--yellow); color: var(--on-accent); }
.badge-open { background: #d6eadf; color: #164b34; }
.badge-cancelled, .badge-draft { background: #e5e8ec; color: var(--ink-2); }

/* ---------- pages de tournoi et de joueur */
.page-head { display: flex; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.page-head h1 { margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: .6rem 2rem; margin: 1rem 0; }
.facts div { min-width: 8rem; }
.facts dt { font-size: .85rem; color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 600; }
.facts.compact { margin: 0; }
.desc { white-space: pre-line; }
.signup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.25rem 0 0; }
.signup p:last-child, .signup form:last-child { margin-bottom: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-top: 1.25rem; }
.panel h2 { margin-top: 0; font-size: 1.2rem; }
.subnav { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-block: .5rem 1rem; }
.rating-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; display: grid; gap: 1rem; margin-top: 1rem; }
.rating-main { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.rating-note { color: var(--ink-2); }
/* Graphique de la cote : un point par tournoi, échelle de cote à gauche, tournois en bas. */
.chart { width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axis { stroke: var(--ink-2); stroke-width: 1.5; }
.ch-tick { fill: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.ch-axis-title { fill: var(--ink-2); font-size: 13px; font-weight: 600; }
.ch-title-line { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .7; }
.ch-title { fill: var(--ink-2); font-size: 13px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.ch-line { fill: none; stroke: var(--brand-bright); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--surface); stroke: var(--brand-bright); stroke-width: 2.5; }
.ch-mark circle { fill: var(--surface); stroke: var(--brand-bright); stroke-width: 3; }
.ch-mark text { fill: var(--ink); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.ch-line-ex { stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 8 5; }
.ch-dot-ex { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.ch-mark-ex rect { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.ch-mark-ex text { fill: var(--ink); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; list-style: none; margin: 0; padding: 0; color: var(--ink-2); font-size: .9rem; }
.chart-legend li { display: inline-flex; align-items: center; gap: .5rem; }
.lg-swatch { display: inline-block; width: 28px; height: 0; border-top: 3px solid var(--brand-bright); }
.lg-swatch.lg-ex { border-top: 3px dashed var(--ink); }
.ch-mark.ch-last circle { fill: var(--amber); stroke: var(--ink); stroke-width: 2; }
@media (max-width: 600px) {
  .ch-tick { font-size: 20px; }
  .ch-axis-title, .ch-title { font-size: 18px; }
  .ch-mark text, .ch-mark-ex text { font-size: 23px; }
}

/* ---------- réglages du site */
.palettes { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.palette { display: inline-flex; align-items: center; gap: .5rem; font: 600 .9rem var(--sans); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: .3rem .8rem .3rem .4rem; cursor: pointer; }
.palette:hover { border-color: var(--ink); }
.swatches { display: inline-flex; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.swatches span { width: 1rem; height: 1.25rem; }
.colors input[type=color] { display: block; width: 100%; height: 2.75rem; margin-top: .3rem; padding: .15rem; background: var(--surface);
  border: 1.5px solid #8b98aa; border-radius: var(--radius); cursor: pointer; }
.theme-preview { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--pv-paper); color: var(--pv-ink); }
.pv-head { display: flex; gap: 1.25rem; align-items: baseline; padding: .6rem 1rem; background: var(--pv-primary); color: var(--pv-on-primary); }
.pv-head strong { font: 800 1.1rem var(--head); }
.pv-strip { height: 8px; background: repeating-conic-gradient(var(--pv-secondary) 0 25%, var(--pv-accent) 0 50%) 0 0 / 16px 16px; }
.pv-body { padding: .8rem 1rem .4rem; }
.pv-link { color: var(--pv-link); text-decoration: underline; }
.pv-badge { background: var(--pv-accent); color: var(--pv-on-accent); font-size: .8rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; }
.pv-btn { display: inline-block; background: var(--pv-ink); color: #fff; font-weight: 700; padding: .4rem .9rem; border-radius: var(--radius); }
.pv-table { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; vertical-align: middle; background: var(--pv-secondary); color: #fff; font: 800 1.1rem var(--head); border-radius: var(--radius); }
.theme-warnings { margin: .6rem 0 0; padding: 0; list-style: none; }
.theme-warnings li { background: var(--amber-soft); border-left: 5px solid var(--amber); border-radius: var(--radius); padding: .5rem .8rem; margin-top: .4rem; font-size: .95rem; }
.logo-current { display: flex; align-items: center; gap: .8rem; }
.logo-current img { height: 3rem; width: auto; max-width: 12rem; object-fit: contain; background: var(--primary); padding: .3rem; border-radius: var(--radius); }
input[type=file] { display: block; width: 100%; margin-top: .3rem; font: 400 1rem var(--sans); }

/* ---------- tableaux */
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: .6rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { font-size: .875rem; color: var(--ink-2); font-weight: 600; background: var(--paper); white-space: nowrap; }
table.data th.num, table.data td.num { text-align: right; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr.me td { background: var(--amber-soft); }
table.titles { max-width: 34rem; }
.faded { opacity: .6; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.results select { min-width: 15rem; }
.chip { display: inline-block; font-size: .85rem; font-weight: 600; padding: .05rem .55rem; border-radius: 999px; }
.chip-win { background: #d6eadf; color: var(--win); }
.chip-loss { background: #f6dcd8; color: var(--loss); }
.chip-draw, .chip-bye, .chip-double_forfeit, .chip-cancelled { background: #e5e8ec; color: var(--draw); }
.delta.up { color: var(--win); font-weight: 600; }
.delta.down { color: var(--loss); font-weight: 600; }

/* ---------- bandes de parties : Blancs (fond clair) contre Noirs (fond sombre) */
details.round { margin: .75rem 0; }
details.round > summary { cursor: pointer; font: 800 1.05rem var(--head); padding: .4rem 0; }
.pairings { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .5rem; }
.pairing { display: grid; grid-template-columns: 3.25rem 1fr 1fr auto; align-items: stretch; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--ink); background: var(--surface); }
.pairing .table-no { display: grid; place-items: center; background: var(--brand-bright); color: var(--on-secondary); font: 800 1.3rem var(--head); }
.pairing .side { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .6rem; padding: .55rem .9rem; }
.pairing .white { background: #fff; color: var(--ink); }
.pairing .black { background: var(--ink); color: #fff; }
.pairing .black a { color: #fff; }
.pairing .color-tag { flex-basis: 100%; font-size: .75rem; opacity: .75; }
.pairing .pname { font-weight: 600; }
.pairing .prating { font-variant-numeric: tabular-nums; opacity: .8; }
.pairing .presult { display: grid; place-items: center; padding-inline: .9rem; background: var(--square); font: 800 1.05rem var(--head); min-width: 6.5rem; text-align: center; }
.pairing:not(.is-done):not(.pairing-bye) .presult { background: var(--amber-soft); font: 400 .9rem var(--sans); }
.pairing-bye { grid-template-columns: 3.25rem 1fr 1fr; border-style: dashed; }
.pairing-bye .side.bye { background: var(--paper); color: var(--ink-2); }

/* ---------- petits écrans */
@media (max-width: 720px) {
  .nav-toggle { display: inline-block; background: none; color: var(--on-primary); border: 1.5px solid var(--on-primary); border-radius: var(--radius); padding: .4rem .8rem; font: 600 .95rem var(--sans); cursor: pointer; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; padding-block: .5rem; }
  .nav.is-open { display: flex; }
  .nav-sep { display: none; }
  .brand-full { display: none; }
  .t-row { grid-template-columns: 1fr; gap: .4rem; }
  .t-side { justify-items: start; }
  .pairing { grid-template-columns: 2.75rem 1fr 1fr; }
  .pairing .presult { grid-column: 1 / -1; padding-block: .35rem; }
  .pairing-bye { grid-template-columns: 2.75rem 1fr; }
  .pairing-bye .side.bye { grid-column: 2; }
  .results select { min-width: 11rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media print { .site-header, .site-footer, .actions, .nav { display: none; } body { background: #fff; } }

/* ---------- Statistiques et palmarès ---------- */
.subnav a[aria-current="page"] { font-weight: 700; color: var(--ink); text-decoration: none; border-bottom: 3px solid var(--amber); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin: 1rem 0 0; }
.tiles div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.tiles dt { font-size: .9rem; color: var(--ink-2); }
.tiles dd { margin: 0; font: 800 2.2rem/1.15 var(--head); font-variant-numeric: tabular-nums; }
.panel > :first-child { margin-top: 0; }
.private-note { margin-bottom: .75rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; }

.split-bar { display: flex; gap: 2px; height: 2.25rem; border-radius: var(--radius); overflow: hidden; }
.split-bar span { display: grid; place-items: center; min-width: 2.75rem; font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; }
.split-white { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.split-draw { background: var(--square); color: var(--ink); }
.split-black { background: var(--ink); color: var(--paper); }
.split-legend { list-style: none; padding: 0; margin: .75rem 0 0; display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.split-key { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; margin-right: .4rem; vertical-align: -.1rem; }

.ch-bar { fill: var(--brand-bright); }
.ch-hit { fill: transparent; }
.ch-bar-g:hover .ch-bar { fill: var(--ink); }
.ch-value { fill: var(--ink); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.table-view { margin-top: .75rem; }
.table-view summary, .season-past summary { cursor: pointer; font-weight: 600; }
.season-past summary { font: 800 1.15rem var(--head); }
.season-past summary .muted { font: 400 .95rem var(--sans); margin-left: .5rem; }
.season-past .inline-form { margin-top: .75rem; }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.hbars li { display: grid; grid-template-columns: 7rem 1fr 2.5rem; align-items: center; gap: .75rem; }
.hbar-track { height: 1.1rem; background: var(--paper); border-radius: 3px; }
.hbar-fill { display: block; height: 100%; min-width: 2px; background: var(--brand-bright); border-radius: 3px; }
.hbar-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1.25rem; align-items: start; }
.board { border-top: 6px solid var(--amber); }
.board-sub { color: var(--ink-2); margin: 0 0 .75rem; }
.award-list { list-style: none; margin: 0; padding: 0; }
.award-list.panel { padding: .25rem 1.25rem; margin-top: .5rem; }
.award-list li { display: grid; grid-template-columns: 7.5rem 1fr; gap: .1rem .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.award-list li:last-child { border-bottom: 0; }
.award-label { grid-row: span 2; font: 800 .8rem/1.3 var(--head); letter-spacing: .06em; text-transform: uppercase; color: var(--brand); padding-top: .2rem; }
.award-who { display: flex; flex-wrap: wrap; gap: .15rem 1rem; font-weight: 700; }
.award-who .muted { font-weight: 400; }
.award-value { color: var(--ink-2); font-size: .95rem; }
.glossary { margin: 0; display: grid; gap: .6rem; }
.glossary div { display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0; color: var(--ink-2); }
.display-option { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; }
@media (max-width: 520px) {
  .award-list li, .glossary div { grid-template-columns: 1fr; }
  .award-label { grid-row: auto; }
  .hbars li { grid-template-columns: 5.5rem 1fr 2rem; }
}
.award-wide li { grid-template-columns: 13rem 1fr; }
@media (max-width: 520px) { .award-wide li { grid-template-columns: 1fr; } }

/* ---------- exercices d'échecs */
.crumb { margin: 0 0 .4rem; color: var(--ink-2); font-size: .95rem; }
.exo-list { margin: .5rem 0 0; padding-left: 1.4rem; display: grid; gap: .35rem; }
.exo-list .chip { margin-left: .4rem; }
progress { width: 100%; max-width: 24rem; height: 1rem; accent-color: var(--win); }
.exo { display: grid; grid-template-columns: minmax(0, 32rem) minmax(14rem, 1fr); gap: 1.5rem; align-items: start; margin-top: 1rem; }
@media (max-width: 52rem) { .exo { grid-template-columns: minmax(0, 1fr); } }
.exo-instructions { color: var(--ink); max-width: 44rem; }
.exo-side { display: grid; gap: .9rem; align-content: start; }
.exo-side p { margin: 0; }
.exo-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.feedback { min-height: 1.5em; font-weight: 600; }
.feedback-ok { color: var(--win); }
.feedback-bad { color: var(--loss); }

/* L'échiquier : les cases sont de vrais boutons (clavier et écran tactile). */
.chessboard { position: relative; width: 100%; max-width: 32rem; container-type: inline-size; }
.cb-grid { display: grid; grid-template-columns: repeat(8, 1fr); border: 3px solid var(--ink); border-radius: 4px; overflow: hidden; background: var(--ink); }
.sq { position: relative; aspect-ratio: 1; margin: 0; padding: 0; border: 0; border-radius: 0; cursor: pointer;
      font-family: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", "Apple Symbols", sans-serif;
      font-size: 2.2rem; font-size: 9.5cqw; line-height: 1; display: flex; align-items: center; justify-content: center; }
.sq.light { background: #eaf2f9; background: color-mix(in srgb, var(--brand-bright) 12%, #fff); }
.sq.dark { background: #86b3d6; background: color-mix(in srgb, var(--brand-bright) 55%, #fff); }
.sq:disabled { cursor: default; }
.sq[data-piece="w"] { color: #fff; -webkit-text-stroke: 1.5px #14212e; paint-order: stroke fill; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.sq[data-piece="b"] { color: #14212e; -webkit-text-stroke: 1px #14212e; }
.sq.is-selected { box-shadow: inset 0 0 0 4px var(--amber); background: var(--amber-soft); }
.sq.is-target { background-image: radial-gradient(circle, rgba(0, 39, 68, .38) 0 14%, transparent 15%); }
.sq.is-capture { box-shadow: inset 0 0 0 4px rgba(0, 39, 68, .45); }
.sq.is-ok { box-shadow: inset 0 0 0 5px var(--win); }
.sq.is-bad { box-shadow: inset 0 0 0 5px var(--loss); }
.sq.is-last { box-shadow: inset 0 0 0 5px var(--amber); }
.sq:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; z-index: 1; }
.sq[data-file]::before, .sq[data-rank]::after { position: absolute; font: 700 .65rem var(--sans); color: var(--ink); opacity: .75; -webkit-text-stroke: 0; text-shadow: none; }
.sq[data-file]::before { content: attr(data-file); right: .2rem; bottom: .1rem; }
.sq[data-rank]::after { content: attr(data-rank); left: .2rem; top: .1rem; }
.cb-promo { position: absolute; inset: 35% 8%; z-index: 2; display: flex; flex-wrap: wrap; gap: .5rem; align-content: center; justify-content: center;
               background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); padding: .8rem; text-align: center; }
.cb-promo[hidden] { display: none; }
.cb-promo p { flex-basis: 100%; margin: 0; font-weight: 600; }

/* L'éditeur d'exercices (Gestion) */
.palette { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .8rem; }
.tool { min-width: 2.6rem; height: 2.6rem; padding: 0 .6rem; border: 1.5px solid #8b98aa; border-radius: var(--radius); background: var(--surface);
        font: 600 1rem var(--sans); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tool[data-piece] { font-size: 1.7rem; font-family: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", sans-serif; line-height: 1; }
.tool[data-piece="w"] { background: #86b3d6; color: #fff; -webkit-text-stroke: 1px #14212e; paint-order: stroke fill; }
.tool[data-piece="b"] { background: #eaf2f9; color: #14212e; }
.tool.is-on { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
#ed-board, #ed-solve-board { margin-bottom: .8rem; }
.castle { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: 1rem 0; }
.castle legend { font-size: .95rem; }
.exo-source { margin: 1rem 0 0; font-size: .95rem; }
.exo-links { display: grid; gap: .8rem; margin: 0; }

/* Sections d'exercices repliables */
.exo-section > summary { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; cursor: pointer; list-style: none; }
.exo-section > summary::-webkit-details-marker { display: none; }
.exo-section > summary::before { content: "▸"; font-size: 1.1rem; transition: transform .15s; }
.exo-section[open] > summary::before { transform: rotate(90deg); }
.exo-section > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.exo-section-title { font-size: 1.25rem; font-weight: 700; flex: 1 1 auto; }
.exo-section-progress { display: inline-flex; align-items: center; gap: .5rem; }
.exo-section-progress progress { width: 7rem; }
.exo-section[open] > summary { margin-bottom: .5rem; }
.exo-fold-actions { margin: 0 0 .5rem; }

/* Page d'importation Lichess */
.form-grid { display: grid; gap: .8rem 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); align-items: end; margin: .75rem 0; }
.form-grid > .hint, .form-grid > button { grid-column: 1 / -1; }
.exo-theme-group { margin: 1rem 0; }
.exo-theme-group .hint { display: block; }
