/* ROTKwiki : palette inspirée de ROTK (encre, papier, rouge signal). Mode clair par défaut. */
:root,
:root[data-theme="light"] {
  --bg: #f6f4ee;
  --surface: #fcfcfb;
  --surface-2: #eeebe3;
  --text: #121211;
  --text-2: #3d3c38;
  --muted: #6b6963;
  --line: rgba(18, 18, 17, 0.12);
  --line-strong: rgba(18, 18, 17, 0.24);
  --red: #d23a2f;          /* traits de graphique, pastilles, boutons */
  --red-text: #b92c24;     /* liens et texte rouge (contraste ≥ 4.5:1) */
  --red-wash: rgba(210, 58, 47, 0.10);
  --on-red: #ffffff;
  --shadow: 0 1px 2px rgba(18, 18, 17, 0.06);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #090909;
  --surface: #10100f;
  --surface-2: #1a1a19;
  --text: #eeece4;
  --text-2: #c8c4ba;
  --muted: #96948d;
  --line: rgba(238, 236, 228, 0.14);
  --line-strong: rgba(238, 236, 228, 0.28);
  --red: #e64034;
  --red-text: #ff6a5e;
  --red-wash: rgba(230, 64, 52, 0.14);
  --on-red: #ffffff;
  --shadow: none;
  color-scheme: dark;
}
:root {
  --radius: 10px;
  --wrap: 1140px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--red-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
code { font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 62px; }
.logo { font-family: var(--display); font-weight: 700; font-size: 27px; letter-spacing: .5px; color: var(--text); text-decoration: none; text-transform: uppercase; display: flex; align-items: center; gap: 4px; flex: none; }
.logo span { background: var(--red); color: var(--on-red); padding: 0 6px; border-radius: 4px; font-size: 20px; line-height: 1.3; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { color: var(--red-text); background: var(--red-wash); }
.header-tools { display: flex; gap: 6px; align-items: center; }
.theme-toggle, .nav-toggle { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); border-radius: 8px; height: 36px; min-width: 36px; padding: 0 10px; font: 600 14px var(--body); cursor: pointer; }
.theme-toggle span { font-size: 18px; line-height: 1; }
.nav-toggle { display: none; }
@media (max-width: 1060px) {
  .nav-toggle { display: block; }
  .header-tools { margin-left: auto; }
  .nav { display: none; position: absolute; top: 62px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px; font-size: 16px; }
}

/* ---------- Titres ---------- */
h1, h2, h3 { font-family: var(--display); text-transform: uppercase; line-height: 1.05; letter-spacing: .3px; margin: 0 0 12px; color: var(--text); }
h1 { font-size: clamp(38px, 7vw, 68px); font-weight: 700; }
h2 { font-size: clamp(26px, 4vw, 36px); font-weight: 700; margin-top: 36px; }
section .wrap > h2:first-child, .item > h2:first-child { margin-top: 0; }
h3 { font-size: 21px; font-weight: 600; }
.accent { color: var(--red); }
.eyebrow { display: inline-block; font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--red-text); margin-bottom: 10px; }
.lead { font-size: 19px; color: var(--text-2); max-width: 760px; margin: 0; }
.section-lead { color: var(--text-2); max-width: 760px; margin-top: -4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Hero ---------- */
.page-hero { padding: 40px 0 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.home-hero { padding: 64px 0 48px; background: radial-gradient(ellipse 60% 80% at 100% 0%, var(--red-wash), transparent 70%), var(--surface); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }

/* ---------- Sections ---------- */
section { padding: 44px 0; }
section + section { border-top: 1px solid var(--line); }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 440px) { .grid-4 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card p:last-child { margin-bottom: 0; }
a.card { display: block; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--red); transform: translateY(-2px); }
.card-kicker { display: block; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.more { color: var(--red-text); font-weight: 600; font-size: 14px; }

.btn { display: inline-block; padding: 10px 16px; border-radius: 8px; font-weight: 700; font-size: 15px; text-decoration: none; border: 1px solid var(--line-strong); color: var(--text); background: var(--surface); cursor: pointer; font-family: var(--body); margin: 4px 6px 4px 0; }
.btn:hover { border-color: var(--red); }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn.primary:hover { filter: brightness(1.06); }

.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: var(--red-wash); color: var(--red-text); }
.tag.dev { background: var(--surface-2); color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 24px; }
.chips a { font-size: 14px; padding: 6px 11px; border: 1px solid var(--line-strong); border-radius: 999px; text-decoration: none; color: var(--text-2); background: var(--surface); }
.chips a:hover { color: var(--red-text); border-color: var(--red); }
.note { border-left: 3px solid var(--red); background: var(--surface); padding: 12px 16px; border-radius: 0 8px 8px 0; color: var(--text-2); margin: 20px 0; }
.rules { padding-left: 20px; }
.rules li { margin-bottom: 8px; }

/* Chiffres clés : valeur en sans-serif (jamais en police d'affichage) */
.tiles { margin-top: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-family: var(--body); font-weight: 700; font-size: clamp(30px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.5px; }
.stat .l { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.stat .d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.live-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.live-strip strong { font-size: 18px; }
.live-strip a { margin-left: auto; font-weight: 600; font-size: 14px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 var(--red); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 8px 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-family: var(--display); text-transform: uppercase; letter-spacing: .5px; font-size: 14px; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody th { font-weight: 600; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.stats td strong { font-weight: 700; }
.unit { color: var(--muted); font-size: 14px; }
.avant { font-size: 13px; color: var(--muted); margin-top: 2px; }
.na { color: var(--muted); font-style: italic; }
tr.unknown th { color: var(--muted); font-weight: 500; }
.src { font-size: 13px; font-weight: 600; white-space: nowrap; }
span.src { color: var(--muted); }
table.ladder td a { font-weight: 600; }
.item { margin-bottom: 28px; scroll-margin-top: 80px; }

/* ---------- Chronologie ---------- */
.timeline { list-style: none; margin: 16px 0 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line-strong); }
.timeline li { position: relative; padding: 0 0 24px 36px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--red); }
.timeline li.past::before { border-color: var(--muted); }
.timeline li.future::before { border-style: dashed; }
.timeline .date { font-family: var(--display); font-weight: 600; font-size: 16px; text-transform: uppercase; letter-spacing: .5px; color: var(--red-text); }
.timeline li.past .date { color: var(--muted); }
.timeline h3 { margin: 2px 0 4px; font-size: 20px; }
.timeline p { margin: 0; color: var(--text-2); }

/* ---------- Patch notes ---------- */
.patch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px; scroll-margin-top: 80px; }
.patch header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 6px; }
.patch h2 { margin: 0; font-size: 24px; }
.patch .when { color: var(--muted); font-size: 14px; }
.patch ul { margin: 6px 0 0; padding-left: 20px; }
.patch li { margin-bottom: 5px; }
.patch:target { border-color: var(--red); }

/* Étapes */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 18px 72px; }
.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 18px; top: 12px; font-family: var(--display); font-weight: 700; font-size: 34px; color: var(--red); }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { margin: 10px 0 0; color: var(--text-2); }

/* ---------- Graphiques ---------- */
.chart { position: relative; margin: 12px 0 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 8px 4px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 12px var(--body); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--red); opacity: .10; }
.chart .dot, .chart .cursor-dot { fill: var(--red); stroke: var(--surface); stroke-width: 2; }
.chart .dlabel { fill: var(--text); font: 600 13px var(--body); }
.chart .cursor { stroke: var(--line-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart svg [hidden] { display: none; }
.chart .tip { position: absolute; transform: translate(-50%, -100%); background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 6px; font-size: 13px; pointer-events: none; white-space: nowrap; display: flex; flex-direction: column; line-height: 1.3; }
.chart-empty { color: var(--muted); font-style: italic; }
.bars { display: grid; gap: 10px; margin: 12px 0 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; gap: 12px; align-items: center; font-size: 14px; }
.bar-track { height: 18px; }
.bar-fill { display: block; height: 100%; background: var(--red); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-value { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 1fr auto; } .bar-track { grid-column: 1 / -1; order: 3; } }
.data-table summary { cursor: pointer; font-weight: 600; color: var(--red-text); }

/* ---------- Classement et recherche ---------- */
.search { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 24px; }
.search label { display: block; font-weight: 700; margin-bottom: 8px; }
.search-row { display: flex; flex-wrap: wrap; gap: 8px; }
.search input, .search select { font: 16px var(--body); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--text); }
.search input { flex: 1 1 220px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tabs button { font: 600 14px var(--body); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--red); border-color: var(--red); color: var(--on-red); }
.player-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin-bottom: 12px; }
.player-head h2 { margin: 0; }

/* ---------- Pied de page ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: 14px; background: var(--surface); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 16px; }
.footer-links a { color: var(--text-2); text-decoration: none; }
.footer-links a:hover { color: var(--red-text); }
.disclaimer { max-width: 820px; }
