/* ==========================================================================
   AimPro — thème « terminal » noir / vert.
   Toute la DA passe par ces variables.
   ========================================================================== */
:root {
  --bg: #050505;
  --bg-2: #0a0b0b;
  --surface: #0e100f;
  --surface-2: #141716;
  --line: #1c201e;
  --line-2: #2a302d;
  --ink: #e9e7e1;
  --chrome: #a9a49a;
  --dim: #6d6b66;
  --accent: #00ff9c;
  --accent-ink: #03140c;
  --accent-soft: rgba(0, 255, 156, 0.09);
  --accent-line: rgba(0, 255, 156, 0.35);
  --danger: #ff3b5c;
  --warn: #ffb347;
  --r: 3px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --sl-h: 24px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  padding-bottom: var(--sl-h);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.08; margin: 0 0 .6em; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.9rem, 4vw, 3rem); }
h3 { font-size: .78rem; font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: .14em; color: var(--chrome); }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; color: var(--accent); }
code, kbd {
  font-family: var(--mono); font-size: .82em;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: .05em .4em; color: var(--ink);
}
kbd { color: var(--accent); }
b { font-weight: 600; }
hr { border: 0; border-top: 1px dashed var(--line-2); margin: 1.5rem 0; }
.muted { color: var(--chrome); }
.small { font-size: .82rem; }
.note { font-family: var(--mono); font-size: .78rem; color: var(--dim); margin: 0 0 .8rem; letter-spacing: 0; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: .4rem .8rem; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  height: 52px;
  background: rgba(5, 5, 5, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem; text-decoration: none;
  font-family: var(--mono); font-size: .9rem; color: var(--ink);
}
.brand svg { width: 18px; height: 18px; color: var(--accent); }
.brand:hover { color: var(--ink); }
.tabs { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; display: inline-flex; align-items: center; gap: .45rem;
  text-decoration: none; white-space: nowrap;
  color: var(--dim); font-family: var(--mono); font-size: .8rem;
  padding: 0 .85rem; height: 52px;
  transition: color .2s var(--ease);
}
.tabs a kbd { background: none; border: 0; padding: 0; color: var(--dim); font-size: .72rem; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); }
.tabs a.active kbd { color: var(--accent); }
.tabs a.active::after {
  content: ''; position: absolute; left: .85rem; right: .85rem; bottom: -1px; height: 2px; background: var(--accent);
}
.cmd-hint {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  background: none; border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--chrome); font-family: var(--mono); font-size: .75rem; padding: .3rem .6rem;
}
.cmd-hint:hover { color: var(--ink); border-color: var(--accent-line); }
.lang { text-decoration: none; letter-spacing: .08em; }
.cmd-hint .glyph { color: var(--accent); }

/* ---------- setup ---------- */
.setup { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.setup-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem;
  padding: .6rem clamp(1rem, 4vw, 2.5rem);
  font-family: var(--mono); font-size: .78rem;
}
.setup .label { color: var(--dim); }
.setup label { display: inline-flex; align-items: center; gap: .5rem; color: var(--dim); }
.setup input, .setup select { padding: .3rem .5rem; font-size: .8rem; }
.setup input { width: 92px; }
.readout { display: inline-flex; align-items: baseline; gap: .5rem; color: var(--dim); }
.readout b { color: var(--accent); font-weight: 500; font-size: .92rem; }

/* ---------- formulaires ---------- */
input, select, button, textarea { font: inherit; }
input[type=number], input[type=text], input[type=search], select {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r);
  padding: .5rem .65rem; outline: none; min-width: 0;
  font-family: var(--mono); font-size: .88rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select option, select optgroup { background: var(--surface); color: var(--ink); }
input[type=color] {
  width: 44px; height: 34px; padding: 3px; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer;
}
input[type=range] { accent-color: var(--accent); width: 120px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; align-items: end; margin-bottom: 1.1rem; }
.form label, .options-grid label {
  display: flex; flex-direction: column; gap: .35rem;
  font-family: var(--mono); font-size: .72rem; color: var(--dim);
}
.search { width: 100%; margin-bottom: .8rem; }
.inline-select { margin-left: .6rem; font-size: .78rem; padding: .25rem .5rem; text-transform: none; letter-spacing: 0; }

/* boutons façon touches */
.key {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-family: var(--mono); font-size: .82rem; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease), transform .1s;
}
.key:hover { border-color: var(--accent); color: var(--accent); }
.key:active { transform: translateY(1px); }
.key-solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.key-solid:hover { color: var(--accent-ink); filter: brightness(1.12); box-shadow: 0 0 28px rgba(0, 255, 156, .28); }
.key-danger { color: var(--danger); border-color: rgba(255, 59, 92, .35); background: transparent; }
.key-danger:hover { border-color: var(--danger); color: var(--danger); }
.key.small { padding: .35rem .7rem; font-size: .75rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

/* ---------- layout ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem; }
.page { display: none; }
.page.active { display: block; animation: rise .4s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { padding: clamp(2rem, 5vw, 3.5rem) 0 1.6rem; }
.page-head p.muted { max-width: 680px; }
.page-head.compact { padding: 1.6rem 0 1rem; }
.page-head.compact h2 { margin-bottom: 0; }

.panel {
  background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.3rem 1.4rem; margin-bottom: 1.2rem;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 1.2rem; align-items: start; margin-bottom: 1.2rem; }
.grid-2 .panel { margin-bottom: 0; }
.faq-title { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
.faq h3 { margin: 1.4rem 0 .4rem; font-family: inherit; font-size: 1rem; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink); }
.faq p { margin: 0; color: var(--chrome); max-width: 75ch; }
.span-2 { grid-column: 1 / -1; }
.hint {
  font-size: .86rem; color: var(--chrome);
  border-left: 2px solid var(--accent); padding-left: .85rem; margin: 1rem 0 0;
}
ul, ol { padding-left: 1.2rem; margin: 0; }
li { margin: .4rem 0; }
li::marker { color: var(--accent); font-family: var(--mono); }
.panel p { margin: .2rem 0 .6rem; }

/* ---------- accueil ---------- */
.hero {
  position: relative; margin: 0 calc(-1 * clamp(1rem, 4vw, 2.5rem));
  min-height: min(78vh, 720px); display: flex; align-items: center;
  border-bottom: 1px solid var(--line); overflow: hidden;
}
.wall { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-content {
  position: relative; z-index: 1; max-width: 720px;
  padding: 4rem clamp(1rem, 4vw, 2.5rem);
}
.hero h1 { font-size: clamp(2.8rem, 8vw, 6rem); font-weight: 800; letter-spacing: -0.045em; line-height: .95; margin-bottom: 1.4rem; }
.hero h1 em { font-weight: 400; letter-spacing: -0.03em; }
.lead { color: var(--chrome); font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 560px; margin: 0; }
.cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }
.cta .key { padding: .75rem 1.3rem; font-size: .9rem; }

.rows { border-top: 1px solid var(--line); margin-top: 3rem; }
.row {
  display: grid; grid-template-columns: 3.2rem 14rem 1fr 2rem; gap: 1rem; align-items: baseline;
  padding: 1.4rem .2rem; border-bottom: 1px solid var(--line); text-decoration: none;
  transition: background .25s var(--ease), padding .25s var(--ease);
}
.row:hover { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); padding-left: .8rem; color: var(--ink); }
.row-n { font-family: var(--mono); font-size: .78rem; color: var(--dim); }
.row-t { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.row-d { color: var(--chrome); font-size: .95rem; }
.row-a { font-family: var(--mono); color: var(--dim); text-align: right; transition: transform .25s var(--ease), color .2s; }
.row:hover .row-a { color: var(--accent); transform: translateX(4px); }
.block { margin-top: 3rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chips span {
  font-family: var(--mono); font-size: .76rem; color: var(--chrome);
  border: 1px solid var(--line-2); border-radius: var(--r); padding: .3rem .65rem;
}
.chips span b { color: var(--accent); font-weight: 500; margin-right: .4rem; }

/* ---------- tableaux / chiffres ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; color: var(--dim); font-weight: 400; font-family: var(--mono); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .1em; padding: .5rem .45rem; border-bottom: 1px solid var(--line-2);
}
.table td { padding: .55rem .45rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td.num, .num { font-family: var(--mono); color: var(--accent); }
.table td.yaw { white-space: nowrap; font-family: var(--mono); color: var(--dim); font-size: .78rem; }
.table tr.current td { background: var(--accent-soft); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover td { background: rgba(255,255,255,.02); }
.warn { color: var(--warn); cursor: help; font-size: .85em; }
.tag { font-family: var(--mono); font-size: .68rem; color: var(--dim); margin-left: .35rem; }
.copy {
  background: none; border: 1px solid transparent; color: var(--dim); cursor: pointer;
  font-family: var(--mono); font-size: .72rem; padding: .15rem .45rem; border-radius: var(--r);
}
.copy:hover { color: var(--accent); border-color: var(--accent-line); }
.big-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.big-stats div, .stat-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem .9rem;
}
.big-stats small, .stat-card small {
  display: block; color: var(--dim); font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
}
.big-stats b, .stat-card b { font-family: var(--mono); font-size: 1.45rem; font-weight: 500; }
.stat-card .sub { color: var(--chrome); font-size: .78rem; font-family: var(--mono); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat-cards .stat-card b { color: var(--accent); }
.meter { margin-top: 1rem; }
.meter-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .68rem; color: var(--dim); margin-bottom: .3rem; }
.meter-bar { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #00ff9c33, #00ff9c11 50%, #00ff9c33); border: 1px solid var(--line); }
.meter-bar i { position: absolute; top: -5px; width: 2px; height: 14px; background: var(--accent); box-shadow: 0 0 10px var(--accent); transition: left .3s var(--ease); }
.chart { width: 100%; min-height: 200px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.empty { color: var(--dim); text-align: center; padding: 2rem 0; font-family: var(--mono); font-size: .85rem; }

/* ---------- entrainement ---------- */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.mode {
  position: relative; text-align: left; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; cursor: pointer; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1rem 1.05rem 1.1rem; transition: border-color .2s var(--ease), background .2s var(--ease);
}
.mode:hover { border-color: var(--line-2); background: var(--surface); }
.mode.active { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent 80%); }
.mode .m-key { font-family: var(--mono); font-size: .7rem; color: var(--dim); }
.mode.active .m-key { color: var(--accent); }
.mode b { display: block; font-size: 1.1rem; margin: .3rem 0 .25rem; letter-spacing: -0.01em; }
.mode .m-desc { display: block; color: var(--chrome); font-size: .82rem; line-height: 1.45; }
.mode .best { display: block; margin-top: auto; padding-top: .6rem; font-family: var(--mono); font-size: .72rem; color: var(--accent); }
.options { padding: 0; }
.options summary {
  cursor: pointer; list-style: none; padding: .85rem 1.2rem; font-family: var(--mono); font-size: .78rem; color: var(--chrome);
  display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center;
}
.options summary::-webkit-details-marker { display: none; }
.options summary::before { content: '+'; color: var(--accent); width: 1ch; }
.options[open] summary::before { content: '−'; }
.options-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem;
  padding: 0 1.2rem 1.2rem; border-top: 1px dashed var(--line-2); padding-top: 1rem;
}

.arena {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 110px);
  border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden;
  background: var(--bg); margin-bottom: 1.2rem; user-select: none;
}
.arena:fullscreen { border-radius: 0; border: 0; aspect-ratio: auto; max-height: none; width: 100vw; height: 100vh; }
.arena canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.hud {
  position: absolute; top: 0; left: 0; right: 0; pointer-events: none;
  display: flex; justify-content: center; gap: clamp(1rem, 4vw, 3.2rem);
  padding: .8rem; font-family: var(--mono);
}
.hud div { text-align: center; min-width: 64px; }
.hud small { display: block; font-size: .62rem; color: var(--dim); text-transform: uppercase; letter-spacing: .14em; }
.hud b { font-size: clamp(1rem, 2.2vw, 1.5rem); font-weight: 500; font-variant-numeric: tabular-nums; }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1.5rem; gap: .35rem; overflow-y: auto;
  background: rgba(5, 5, 5, 0.84); backdrop-filter: blur(5px);
}
.overlay[hidden] { display: none; }
.overlay .note { margin: 0; }
.overlay h3 {
  font-family: var(--sans); text-transform: none; letter-spacing: -0.03em; color: var(--ink);
  font-size: clamp(1.7rem, 4vw, 2.8rem); font-weight: 800; margin: 0;
}
.overlay > p { color: var(--chrome); max-width: 560px; margin: 0 0 .5rem; }
.overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin: .7rem 0 .5rem; }
.result-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin: .5rem 0; }
.result-grid .stat-card { min-width: 118px; text-align: left; }
.result-grid .stat-card .delta { font-family: var(--mono); font-size: .72rem; }
.up { color: var(--accent); } .down { color: var(--danger); }
.progress { width: min(320px, 70%); height: 3px; background: var(--line-2); border-radius: 2px; overflow: hidden; margin: .4rem 0; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .4s var(--ease); }
.routine-steps { display: flex; gap: .35rem; justify-content: center; margin: .4rem 0; font-family: var(--mono); font-size: .72rem; }
.routine-steps span { padding: .2rem .5rem; border: 1px solid var(--line-2); border-radius: var(--r); color: var(--dim); }
.routine-steps span.done { color: var(--accent); border-color: var(--accent-line); }
.routine-steps span.now { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.mouse-warning { border: 1px solid var(--warn); color: var(--warn); border-radius: var(--r); padding: .8rem 1rem; margin-bottom: 1rem; font-family: var(--mono); font-size: .82rem; }

/* ---------- résultats sensi ---------- */
.reco { display: grid; grid-template-columns: auto 1fr; gap: 1.8rem; align-items: center; }
.reco-value { font-family: var(--mono); font-size: clamp(2.6rem, 8vw, 4.6rem); font-weight: 500; color: var(--accent); line-height: 1; letter-spacing: -0.03em; }
.reco-sub { color: var(--chrome); font-family: var(--mono); font-size: .82rem; margin-top: .5rem; }
.verdict { padding: .8rem 1rem; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); font-size: .95rem; }
.hist-list { margin-top: 1.2rem; border-top: 1px dashed var(--line-2); padding-top: 1rem; }
.hist-list .note { margin-bottom: .5rem; }

.shortcuts { display: flex; flex-wrap: wrap; gap: .7rem 1.6rem; font-size: .88rem; color: var(--chrome); }
.shortcuts code { margin-right: .2rem; }

/* ---------- statusline + cmdline ---------- */
.statusline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--sl-h);
  display: flex; align-items: stretch; background: var(--bg-2); border-top: 1px solid var(--line);
  font: 400 12px/var(--sl-h) var(--mono); color: var(--chrome); white-space: nowrap; overflow: hidden;
}
.statusline .mode { padding: 0 .8rem; background: var(--accent); color: var(--accent-ink); font-weight: 600; letter-spacing: .04em; }
.statusline .mode.m-aim { background: var(--danger); color: #fff; }
.statusline .mode.m-cmd { background: var(--ink); color: var(--bg); }
.statusline .mode.m-insert { background: var(--warn); color: #1a1000; }
.statusline .path { flex: 1; min-width: 0; padding: 0 .8rem; overflow: hidden; text-overflow: ellipsis; }
.statusline .pos { padding: 0 .8rem; color: var(--dim); }
.cmdline {
  position: fixed; left: 0; right: 0; bottom: var(--sl-h); z-index: 41;
  display: flex; align-items: center; gap: .2rem; padding: 0 .8rem; height: 30px;
  background: var(--bg); border-top: 1px solid var(--line-2);
  font-family: var(--mono); font-size: .85rem; color: var(--accent);
}
.cmdline[hidden] { display: none; }
.cmdline input { flex: 1; background: none; border: 0; box-shadow: none !important; padding: 0; color: var(--ink); font-size: .85rem; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--sl-h) + 14px); z-index: 42; transform: translate(-50%, 10px);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r);
  font-family: var(--mono); font-size: .8rem; padding: .5rem .9rem; color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease);
  max-width: calc(100vw - 2rem);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--danger); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); text-align: center; padding: 1.4rem 1rem; }
.footer .note { margin: 0; }

@media (max-width: 860px) {
  .row { grid-template-columns: 2.4rem 1fr 1.5rem; }
  .row-d { grid-column: 2 / 3; }
  .row-a { grid-row: 1; grid-column: 3; }
  .hide-sm { display: none; }
}
@media (max-width: 640px) {
  .hero::before { content: ''; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, rgba(5,5,5,.55), rgba(5,5,5,.8)); }
  .topbar { gap: .6rem; }
  .brand span, .cmd-hint:not(.lang) { display: none; }
  .tabs a kbd { display: none; }
  .big-stats { grid-template-columns: 1fr 1fr; }
  .reco { grid-template-columns: 1fr; }
  .hud { gap: .6rem; }
  .hud div { min-width: 0; }
  .statusline .pos { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- résultats de partie ---------- */
.result-tip { text-align: left; max-width: 560px; }
.routine-table { max-width: 520px; margin: .5rem auto; }
