/* Même palette et mêmes polices que RunFrame */
:root {
  --bg: #E7EBE8;
  --surface: #F5F7F5;
  --ink: #172026;
  --muted: #5F6B72;
  --line: #C9D0CC;
  --accent: #2443A8;
  --accent-soft: #DCE3F5;
  --warn: #C2366B;
  --z-e: #2F8F5B;
  --z-m: #2443A8;
  --z-s: #4F6FD0;
  --z-t: #B8860B;
  --z-i: #D0612F;
  --z-r: #C2366B;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #162026; --surface: #1D2930; --ink: #E4EAE6; --muted: #93A0A6; --line: #2E3C44;
    --accent: #7E9BFF; --accent-soft: #24325A; --warn: #F0709C;
    --z-e: #5FC48D; --z-m: #7E9BFF; --z-s: #A3B7FF; --z-t: #E3B341; --z-i: #F08A5D; --z-r: #F0709C;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.5 var(--body); -webkit-text-size-adjust: 100%; }
main, .top, footer { max-width: 760px; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }
h1, h2 { font-family: var(--display); font-weight: 600; margin: 0; }
h1 { font-size: 2rem; display: flex; align-items: center; gap: .55rem; }
h2 { font-size: 1.35rem; margin-bottom: .5rem; }
p { margin: 0 0 .6rem; }
small { font-weight: 400; color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.top { padding-top: 1.4rem; padding-bottom: .6rem; }
.mark { width: 2rem; height: 2rem; border-radius: 8px; background: url(/favicon.svg) center / cover; }
.tagline { color: var(--muted); margin: .2rem 0 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin: 1rem 0; }
.hint { color: var(--muted); font-size: .9rem; }
.card > .hint:last-child { margin: .7rem 0 0; }

/* Formulaires */
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; font-size: .92rem; }
input, select {
  font: 500 1.05rem var(--body); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line);
  border-radius: 8px; padding: .5rem .6rem; min-height: 2.75rem; width: 100%;
}
input:focus, select:focus { border-color: var(--accent); outline: none; }
input::placeholder { color: var(--muted); opacity: .7; }

fieldset.perf { border: 0; padding: 0; margin: 0 0 .8rem; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; align-items: end; }
fieldset.perf legend { font-family: var(--display); font-weight: 600; font-size: 1.05rem; padding: 0; margin-bottom: .35rem; }
fieldset.perf .autre { grid-column: span 1; }
fieldset.perf:has(.autre:not([hidden])) { grid-template-columns: 1.4fr .8fr 1fr; }
fieldset.perf .link { grid-column: 1 / -1; justify-self: start; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .4rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

.link { background: none; border: 0; padding: .3rem 0; color: var(--accent); font: 600 .95rem var(--body); cursor: pointer; }
.link:hover { text-decoration: underline; }
.erreur { color: var(--warn); font-weight: 500; margin: .7rem 0 0; }

/* Profil */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .6rem; margin: 1rem 0 .4rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.stat .k { color: var(--muted); font-size: .85rem; font-weight: 500; }
.stat .v { font: 600 2rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat .v small { font: 500 1rem var(--body); }
.profil { background: var(--accent-soft); border-radius: 10px; padding: .7rem .9rem; margin: .6rem 0 0; }

/* Tableaux */
.scroll { overflow-x: auto; margin: 0 -1rem; padding: 0 1rem; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
tbody th { font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
td.t { font-weight: 600; white-space: nowrap; }
td.u { color: var(--muted); font-size: .9rem; }
table.num td, table.num th { white-space: nowrap; }
tr.fort { background: var(--accent-soft); }
tr.fort > * { font-weight: 600; }
th:first-child, td:first-child { padding-left: 0; }
tr.fort > :first-child { padding-left: .5rem; }

.zone { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 6px; margin-right: .5rem;
  font: 700 .85rem var(--display); color: var(--surface); vertical-align: 1px; }
.z-E { background: var(--z-e); } .z-M { background: var(--z-m); } .z-S { background: var(--z-s); }
.z-T { background: var(--z-t); } .z-I { background: var(--z-i); } .z-R { background: var(--z-r); }

/* Objectif */
.objectif { margin-top: 1rem; }
.objectif:empty { display: none; }
.big { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .6rem; }
.big span { display: flex; flex-direction: column; font: 600 1.7rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.big span small:first-child { font: 500 .85rem var(--body); margin-bottom: .15rem; }
.big span small:last-child:not(:first-child) { font: 500 .85rem var(--body); }
.dur { color: var(--warn); font-weight: 600; }
details { margin-top: .4rem; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: .3rem 0; }
#o-passages { max-width: 18rem; }

footer { color: var(--muted); font-size: .85rem; padding-bottom: 2rem; }

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .grid:has(.autre:not([hidden])) { grid-template-columns: repeat(5, 1fr); }
  .big span { font-size: 2.2rem; }
  .card { padding: 1.2rem 1.4rem; }
  .scroll { margin: 0 -1.4rem; padding: 0 1.4rem; }
}
