/* ==========================================================================
   AimPro — thème « terminal » noir / vert.
   Toute la DA passe par ces variables.
   ========================================================================== */
:root {
  --bg: #060807;
  --bg-2: #0a0d0c;
  --surface: #0f1312;
  --surface-2: #151a18;
  --line: #1e2522;
  --line-2: #2b3430;
  --ink: #e6ebe8;
  --chrome: #a5aea9;
  --dim: #7d8782;
  --accent: #23a86a;
  --accent-rgb: 35, 168, 106;
  --accent-hi: #3fc985;
  --accent-ink: #04120b;
  --accent-soft: rgba(var(--accent-rgb), 0.1);
  --accent-line: rgba(var(--accent-rgb), 0.4);
  --danger: #ff5a72;
  --warn: #ffb347;
  --r: 3px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-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-style: normal; font-weight: 700; 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; flex: 1; min-width: 0; }
.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.1rem;
  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: 84px; }
.setup select { max-width: 250px; }
.setup .tip { margin-left: .15rem; }
.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; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.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[hidden] { display: none; }
.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(var(--accent-rgb), .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; }
.actions[hidden] { display: none; }

/* ---------- 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: 700; letter-spacing: -0.045em; line-height: .95; margin-bottom: 1.4rem; }
.hero h1 em { text-shadow: 0 0 40px rgba(var(--accent-rgb), .22); }
.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, rgba(var(--accent-rgb), .2), rgba(var(--accent-rgb), .07) 50%, rgba(var(--accent-rgb), .2)); 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;
}
/* décor de l'entraînement : préréglages et aperçu */
.decor-presets, .decor-preview { grid-column: 1 / -1; min-width: 0; }
.decor-label { display: block; font-family: var(--mono); font-size: .72rem; color: var(--dim); margin-bottom: .45rem; }
.presets { display: flex; flex-wrap: wrap; gap: .5rem; }
.preset {
  display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .75rem; cursor: pointer;
  font-family: var(--mono); font-size: .76rem; color: var(--chrome);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r);
}
.preset:hover:not(:disabled) { border-color: var(--accent-line); color: var(--ink); }
.preset[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.preset:disabled { cursor: not-allowed; opacity: .55; }
.preset i {
  width: 22px; height: 16px; border-radius: 2px; flex: none; border: 1px solid var(--line-2);
  background: radial-gradient(circle at 50% 50%, var(--tc) 0 3px, transparent 3.5px), linear-gradient(transparent 7px, var(--gc) 7px 8px, transparent 8px), var(--bc);
}
.decor-preview canvas {
  display: block; width: 100%; height: 150px; border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer;
}
.decor-preview p { margin: .4rem 0 0; }

.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):not(.acct-link) { 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; }

/* carte de score à partager (sous la barre d'état et les toasts) */
.share-modal {
  position: fixed; inset: 0 0 var(--sl-h); z-index: 39;
  display: grid; place-items: center; padding: 16px;
  background: rgba(5, 5, 5, .86); backdrop-filter: blur(4px);
}
.share-modal[hidden] { display: none; }
.share-box { width: min(760px, 100%); max-height: 100%; overflow: auto; margin: 0; }
.share-box img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); }

/* ---------- menu du haut : bien visible, style touches de clavier ---------- */
.topbar { height: 58px; border-bottom-color: var(--line-2); }
.tabs { gap: .3rem; padding: 0 .2rem; }
.tabs a {
  height: 34px; padding: 0 .75rem; color: var(--chrome); font-size: .82rem;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.tabs a kbd {
  display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem;
  border: 1px solid var(--line-2); border-radius: 2px; color: var(--accent); font-size: .68rem;
}
.tabs a:hover { color: var(--ink); border-color: var(--accent-line); }
.tabs a.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; box-shadow: 0 0 18px rgba(var(--accent-rgb), .25); }
.tabs a.active kbd { color: var(--accent-ink); border-color: rgba(3, 20, 12, .35); }
.tabs a.active::after { display: none; }
.new {
  margin-left: .1rem; padding: 0 .3rem; border-radius: 2px;
  background: var(--warn); color: #1a0f00; font-family: var(--mono); font-size: .6rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; line-height: 1.5; vertical-align: middle;
}
.tabs a.active .new { background: var(--accent-ink); color: var(--accent); }

/* ---------- infobulle ⚠ (sources divergentes) ---------- */
.warn { position: relative; display: inline-block; outline: none; }
.warn::after {
  content: attr(data-tip); position: absolute; z-index: 25; left: -.6rem; bottom: calc(100% + 8px);
  width: max-content; max-width: min(280px, 70vw); white-space: normal; text-align: left;
  padding: .5rem .65rem; border: 1px solid var(--warn); border-radius: var(--r); background: var(--bg-2);
  color: var(--ink); font-family: var(--mono); font-size: .72rem; line-height: 1.45; font-weight: 400;
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.warn:hover::after, .warn:focus-visible::after { opacity: 1; transform: none; }
.warn:focus-visible { box-shadow: 0 0 0 2px var(--warn); border-radius: 2px; }

/* ---------- boutons segmentés ---------- */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.seg button {
  background: none; border: 0; border-right: 1px solid var(--line-2); padding: .35rem .75rem; cursor: pointer;
  color: var(--chrome); font-family: var(--mono); font-size: .78rem;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- page viseur ---------- */
.chip {
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer;
  color: var(--chrome); font-family: var(--mono); font-size: .76rem; padding: .35rem .65rem;
}
.chip:hover { color: var(--ink); border-color: var(--accent-line); }
.xh-presets { margin-bottom: 1.1rem; }
.xh-form { display: grid; gap: .55rem; }
.xh-row, .xh-form label.check { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 4.6rem; align-items: center; gap: .6rem; font-family: var(--mono); font-size: .78rem; color: var(--chrome); }
.xh-form label.check { grid-template-columns: auto 1fr; justify-content: start; }
.xh-row.off { opacity: .4; }
.xh-row input[type=range] { width: 100%; min-width: 0; }
.xh-form input[type="color"] { width: 100%; height: 30px; }
.xh-form .xh-num { width: 100%; padding: .3rem .45rem; font-size: .8rem; text-align: right; color: var(--accent); }
.xh-form .xh-hex { text-transform: uppercase; }
.xh-form .xh-num:invalid { border-color: var(--danger); }
.xh-game { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.xh-game .note { margin: 0; }
.xh-file { position: relative; cursor: pointer; }
.xh-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.xh-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.xh-target { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .78rem; color: var(--chrome); }
.xh-warn { margin: 0; font-family: var(--mono); font-size: .72rem; color: var(--warn); }
.xh-preview { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 1px solid var(--line-2); border-radius: var(--r); image-rendering: pixelated; }
.xh-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem; margin: .8rem 0; }
.xh-codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1rem; margin-bottom: .8rem; }
.xh-code { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.xh-code .note { margin: 0; }
.xh-code pre {
  flex: 1; margin: 0; padding: .7rem .8rem; min-height: 4.5rem; white-space: pre-wrap; word-break: break-all;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--accent); font-family: var(--mono); font-size: .76rem; line-height: 1.5;
}
.xh-code .key { align-self: flex-start; }
.xh-import { display: flex; gap: .6rem; }
.xh-import .search { margin: 0; flex: 1; min-width: 0; font-family: var(--mono); }

/* ---------- page prise en main ---------- */
.grip-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.grip-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 340; background: #060807; border: 1px solid var(--line-2); border-radius: var(--r); }
.grip-stage .note { margin: .6rem 0 0; }
.grip-info ul { margin: .4rem 0 0; }
.grip-out { margin-top: .4rem; }
.grip-out h3 { margin-top: 0; }
.reco { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.reco li { border: 1px solid var(--line-2); border-radius: var(--r); padding: .6rem .7rem; }
.reco li:first-child { border-color: var(--accent-line); background: var(--accent-soft); }
.reco-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.reco-act { margin-left: auto; display: flex; gap: .4rem; }
.reco p { margin: .35rem 0 0; }
.badge { font-family: var(--mono); font-size: .7rem; border: 1px solid currentColor; border-radius: var(--r); padding: .05rem .4rem; color: var(--accent-hi); white-space: nowrap; }
.badge.old { color: var(--warn); }
.badge.unavailable { color: var(--chrome); }
.matches { list-style: none; margin: .4rem 0 .6rem; padding: 0; display: grid; gap: .55rem; }
.matches a { color: var(--ink); }
.matches a:hover { color: var(--accent-hi); }

/* ---------- page pros ---------- */
.pros-tools { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: .9rem; margin-bottom: 1rem; }
.pros-pages { margin: 1rem 0 0; }
.guide-links { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: .6rem; }
.guide-links a { display: block; height: 100%; padding: .7rem .85rem; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); text-decoration: none; color: var(--ink); }
.guide-links a:hover { border-color: var(--accent); }
.guide-links b { display: block; font-size: .92rem; }
.guide-links span { display: block; margin-top: .2rem; font-size: .8rem; color: var(--chrome); }
.pros-tools label { display: grid; gap: .3rem; font-family: var(--mono); font-size: .78rem; color: var(--chrome); }
.pros-tools input, .pros-tools select { width: 100%; min-width: 0; }
.pros-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .8rem; }
.pro-card { border: 1px solid var(--line-2); border-radius: var(--r); padding: .8rem .9rem; background: var(--surface); min-width: 0; transition: border-color .3s var(--ease), box-shadow .3s var(--ease); }
.pro-card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; }
.pro-card h3 { margin: 0; font-family: var(--sans); font-size: 1.05rem; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink); }
.pro-card header .badge { margin-left: auto; }
.pro-card p { margin: .5rem 0 0; overflow-wrap: anywhere; }
.pro-card .key { margin-left: .3rem; }
.pro-card.stale { opacity: .62; }
.pro-card.stale:hover, .pro-card.stale:focus-within { opacity: 1; }
.pro-card.flash { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-line); }
.pro-sets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; margin: .7rem 0 0; }
.pro-sets div { min-width: 0; }
.pro-sets dt { font-family: var(--mono); font-size: .68rem; color: var(--chrome); }
.pro-sets dd { margin: 0; font-size: 1rem; color: var(--ink); }
@media (max-width: 640px) {
  .pros-tools { grid-template-columns: 1fr; }
  .reco-act { margin-left: 0; width: 100%; }
}

@media (max-width: 640px) {
  .topbar { height: 54px; }
  .tabs a { padding: 0 .6rem; }
  .tabs a kbd { display: none; }
  .xh-row { grid-template-columns: 6.4rem minmax(0, 1fr) 5rem; gap: .5rem; }
  .xh-game { flex-wrap: wrap; }
}

/* ---- infobulles « ? » (js/aide.js) ---- */
.tip {
  position: relative; display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; margin-left: .3rem; padding: 0;
  border: 1px solid var(--line-2); border-radius: 50%; background: var(--surface-2); color: var(--chrome);
  font: 600 .62rem/1 var(--mono); letter-spacing: 0; text-transform: none; vertical-align: .12em; cursor: help;
  transition: color .15s, background .15s, border-color .15s;
}
.tip::after { content: ''; position: absolute; inset: -9px; } /* zone tactile d'environ 35 px */
.tip:hover, .tip[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tip-pop {
  position: fixed; z-index: 300; padding: .75rem .9rem; font-size: .84rem; line-height: 1.5; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--accent-line); border-radius: var(--r);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55), 0 0 24px rgba(var(--accent-rgb), .08);
}
.tip-pop b { display: block; margin-bottom: .3rem; font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.cm-explain { margin: .2rem 0 .9rem; font-size: .84rem; line-height: 1.6; color: var(--chrome); }
.cm-explain code { white-space: nowrap; }

/* ---------- mon setup : profils, verrou, compte, viseurs enregistrés ---------- */
.setup a.label { color: var(--dim); text-decoration: none; }
.setup a.label:hover { color: var(--accent); }
.lock-badge { font-family: var(--mono); font-size: .75rem; color: var(--accent); border: 1px solid rgba(var(--accent-rgb), .4); border-radius: var(--r); padding: .1rem .45rem; }
.lock-badge[hidden] { display: none; }
[data-lock] :disabled, :disabled[data-lock] { opacity: .45; cursor: not-allowed; }
.ptabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; margin-bottom: 1rem; scrollbar-width: thin; }
.ptabs button {
  flex: 0 0 auto; font: 500 .85rem var(--mono); color: var(--chrome); background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: var(--r); padding: .5rem .9rem; cursor: pointer; white-space: nowrap;
}
.ptabs button:hover { color: var(--ink); border-color: var(--accent); }
.ptabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.ptabs .ptab-add { min-width: 2.6rem; font-size: 1.05rem; color: var(--accent); }
.pr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.pr-bar h3 { margin: 0; }
.pr-bar .note { margin: 0; }
.pr-form { display: grid; gap: .7rem; }
.pr-form label { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; align-items: center; gap: .8rem; color: var(--dim); font-family: var(--mono); font-size: .8rem; }
.pr-form input, .pr-form select { width: 100%; min-width: 0; }
#pr-sens input { width: 7rem; }
.acct-mail { margin-top: 1rem; }
.acct-mail label { display: block; color: var(--dim); font-size: .9rem; margin-bottom: .4rem; }
#acct-msg.err { color: var(--danger); }
.cmd-hint.acct-link { color: var(--accent); border-color: var(--accent-line); white-space: nowrap; text-decoration: none; }
.cmd-hint.acct-link[hidden] { display: none; }
#acct { scroll-margin-top: 80px; }
.xh-list { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .5rem; }
.xh-item { display: grid; grid-template-columns: auto 1fr; gap: .4rem .8rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--line-2); border-radius: var(--r); }
.xh-item.current { border-color: var(--accent); background: var(--accent-soft); }
.xh-swatch { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); }
.xh-meta { display: grid; gap: .15rem; min-width: 0; }
.xh-meta .note { margin: 0; overflow-wrap: anywhere; }
.xh-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.merge-box { width: min(520px, 100%); }
@media (max-width: 640px) {
  .pr-form label { grid-template-columns: 1fr; gap: .3rem; }
  .setup select#p-profile { max-width: 140px; }
}

/* =========================================================================
   V2 (session D) : navigation, accueil, Mon setup, profil, mes jeux
   ========================================================================= */

/* ---------- navigation : outils principaux + « tous les outils » ---------- */
.nav-all {
  display: inline-flex; align-items: center; gap: .5rem; height: 34px; padding: 0 .8rem; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--chrome);
  font-family: var(--mono); font-size: .82rem; transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.nav-all svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; color: var(--accent); }
.nav-all:hover, .nav-all[aria-expanded="true"] { color: var(--ink); border-color: var(--accent-line); }
.nav-all[aria-expanded="true"] { background: var(--surface-2); }
.nav-cur { display: none; }
.nav-all.outside { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.nav-all.outside svg { color: var(--accent-ink); }
.nav-all.outside .nav-lbl { display: none; }
.nav-all.outside .nav-cur { display: inline; }
.nav-sheet {
  position: fixed; z-index: 29; top: 58px; left: 0; right: 0; max-height: calc(100vh - 58px - var(--sl-h)); overflow: auto;
  padding: 1.2rem clamp(1rem, 4vw, 2.5rem) 1rem; background: rgba(8, 11, 10, .97); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-2); box-shadow: 0 24px 48px rgba(0, 0, 0, .55);
  animation: sheet-in .18s var(--ease) both;
}
.nav-sheet[hidden] { display: none; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(-6px); } }
.nav-grid { max-width: 860px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.4rem; }
.nav-cat { margin: 0 0 .4rem; font-family: var(--mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.nav-col a {
  display: grid; grid-template-columns: 1.6rem 1fr; gap: 0 .6rem; align-items: baseline; padding: .55rem .6rem; margin: 0 -.6rem;
  border: 1px solid transparent; border-radius: var(--r); text-decoration: none; color: var(--ink);
}
.nav-col a kbd { grid-row: span 2; align-self: center; text-align: center; font-size: .7rem; }
.nav-col a b { font-weight: 600; font-size: .95rem; }
.nav-col a span { grid-column: 2; font-size: .8rem; color: var(--chrome); }
.nav-col a:hover, .nav-col a:focus-visible { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); outline: none; }
.nav-col a.active { border-color: var(--accent); }
.nav-col a.active b { color: var(--accent-hi); }
.nav-foot { max-width: 1240px; margin: 1rem auto 0; }
@media (max-width: 1180px) { .tabs a.t-wide { display: none; } .tabs a kbd { display: none; } } /* sans les onglets larges, pas de numéros à trous (1, 2, 5) */
@media (max-width: 760px) {
  .tabs { display: none; }
  .topbar .nav-all { margin-left: auto; }
  .nav-all .nav-lbl { display: none; }
  .nav-all .nav-cur { display: inline; }
  .nav-all.outside, .nav-all:not(.outside) { color: var(--ink); background: var(--surface); border-color: var(--line-2); font-weight: 500; }
  .nav-all svg, .nav-all.outside svg { color: var(--accent); }
  .nav-sheet { top: 54px; max-height: calc(100vh - 54px - var(--sl-h)); padding-top: .9rem; }
  .nav-grid { grid-template-columns: 1fr 1fr; gap: .8rem 1rem; }
  .nav-col a span { display: none; }
  .nav-foot { display: none; }
}
@media (max-width: 420px) { .nav-grid { grid-template-columns: 1fr; } .nav-col a span { display: block; } }

/* ---------- invitation à se connecter, près de « mon setup » ---------- */
.setup-cta {
  display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem; border: 1px dashed var(--accent-line); border-radius: 999px;
  color: var(--accent-hi); font-family: var(--mono); font-size: .74rem; text-decoration: none; white-space: nowrap;
}
.setup-cta svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.setup-cta:hover { border-style: solid; background: var(--accent-soft); color: var(--ink); }
.setup-cta[hidden] { display: none; }
.cta-short { display: none; }
@media (max-width: 1440px) { .cta-long { display: none; } .cta-short { display: inline; } }
@media (max-width: 640px) { .setup-cta svg { display: none; } }

/* ---------- accueil du premier passage ---------- */
.welcome {
  position: fixed; inset: 0 0 var(--sl-h); z-index: 60; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(ellipse at 50% 30%, rgba(var(--accent-rgb), .12), transparent 60%), rgba(4, 6, 5, .88);
  backdrop-filter: blur(6px); animation: fade-in .3s var(--ease) both;
}
.welcome.out { opacity: 0; transition: opacity .2s var(--ease); }
@keyframes fade-in { from { opacity: 0; } }
.welcome-box {
  width: min(760px, 100%); padding: clamp(1.4rem, 4vw, 2.4rem); text-align: center;
  background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(var(--accent-rgb), .06);
  animation: rise-in .45s var(--ease) both;
}
@keyframes rise-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.welcome-logo { width: 44px; height: 44px; margin: 0 auto .8rem; display: block; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
/* états de départ dans les animations seulement : sans animation (mouvement réduit), le logo reste visible */
.welcome-logo circle { stroke-dasharray: 1; animation: draw .9s .15s var(--ease) both; }
.welcome-logo path { animation: fade-in .4s .6s var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: 1; } }
.welcome-box h2 { font-size: clamp(1.7rem, 4.4vw, 2.5rem); margin-bottom: .5rem; }
.welcome-lead { margin: 0 auto 1.4rem; max-width: 480px; color: var(--chrome); font-size: 1.02rem; }
.welcome-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; text-align: left; }
.welcome-choice {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: 1rem 1rem 1.1rem; cursor: pointer; text-align: left;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line-2); border-radius: 8px;
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  animation: rise-in .45s calc(.25s + var(--i) * .08s) var(--ease) both;
}
.welcome-choice svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: .3rem; }
.welcome-choice b { font-size: 1.02rem; }
.welcome-choice span { color: var(--chrome); font-size: .85rem; line-height: 1.45; }
.welcome-choice kbd { position: absolute; top: .8rem; right: .8rem; font-size: .7rem; }
.welcome-choice:hover, .welcome-choice:focus-visible {
  border-color: var(--accent); background: var(--surface); transform: translateY(-2px); outline: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4), 0 0 0 1px var(--accent-line), 0 0 30px rgba(var(--accent-rgb), .12);
}
.welcome-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .6rem 1.2rem; margin-top: 1.3rem; }
.welcome-foot .note { margin: 0; }
@media (max-width: 640px) {
  .welcome { place-items: start center; }
  .welcome-choices { grid-template-columns: 1fr; }
  .welcome-choice { display: grid; grid-template-columns: 26px 1fr; gap: .1rem .8rem; padding: .85rem .9rem; }
  .welcome-choice svg { grid-row: span 2; margin: 0; align-self: center; }
  .welcome-choice kbd { display: none; }
  .welcome-foot .note { display: none; }
}

/* ---------- avatars ---------- */
.avatar { display: inline-block; flex: 0 0 auto; overflow: hidden; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-2); }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 20px; height: 20px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 88px; height: 88px; }
.cmd-hint.acct-link { gap: .45rem; }
.cmd-hint.acct-link span:last-child { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Mon setup ---------- */
.su-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.su-head h2 { margin-bottom: .4rem; }
.su-state {
  display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .75rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-hi); font-family: var(--mono); font-size: .74rem;
}
.su-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.su-state.warn { color: var(--warn); border-color: rgba(255, 179, 71, .4); background: rgba(255, 179, 71, .08); }
h3.su-h { font-family: var(--sans); font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; text-transform: none; color: var(--ink); margin: 0 0 .3rem; }
.su-account { border-color: var(--accent-line); background: linear-gradient(135deg, rgba(var(--accent-rgb), .07), transparent 55%), var(--surface); }
.su-invite { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1rem 2rem; align-items: center; }
.su-invite[hidden], .su-me[hidden] { display: none; }
.su-invite .actions { margin-top: 0; }
.su-invite .note { margin: .6rem 0 0; }
.su-me { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; }
.su-me-text { display: grid; gap: .1rem; min-width: 0; flex: 1; }
.su-me-text .note { margin: 0; overflow-wrap: anywhere; }
.su-me-name { font-size: 1.2rem; font-weight: 700; }
.su-me-name.dim { color: var(--dim); font-weight: 500; font-style: italic; }
.su-me-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
#acct-msg:empty { display: none; }
.su-menu { position: relative; }
.su-menu summary { list-style: none; }
.su-menu summary::-webkit-details-marker { display: none; }
.su-menu summary::after { content: ' ▾'; color: var(--dim); }
.su-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: .4rem; min-width: 230px; padding: .6rem;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 16px 36px rgba(0, 0, 0, .55);
}
.su-menu-list .key { width: 100%; text-align: left; }
.su-profiles .ptabs { flex-wrap: wrap; overflow: visible; margin-bottom: .7rem; }
.su-profiles .ptabs button { border-radius: 999px; padding: .45rem 1rem; }
.su-profiles .ptabs .ptab-add { border-style: dashed; }
.su-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.2rem; }
.su-bar-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; min-width: 0; }
.su-bar-title .su-h { margin: 0; font-size: 1.35rem; }
.su-bar-title .note { margin: 0; }
.su-bar-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.su-bar .hint { flex-basis: 100%; margin: 0; }
.su-rename { font: inherit; font-size: 1.1rem; padding: .2rem .5rem; width: min(22rem, 70vw); background: var(--bg); color: var(--ink); border: 1px solid var(--accent); border-radius: var(--r); }
.su-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; align-items: start; margin-bottom: 1.2rem; }
.su-grid .panel { margin-bottom: 0; }
.su-card { display: flex; flex-direction: column; gap: .7rem; border-radius: 8px; }
.su-card .actions { margin-top: .2rem; }
.su-card > p { margin: 0; }
.su-card-head { display: flex; align-items: center; gap: .6rem; }
.su-card-head h3 { margin: 0; font-family: var(--sans); font-size: 1rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
.su-head-act { margin-left: auto; }
.su-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.su-ico svg { width: 17px; height: 17px; fill: none; stroke: var(--accent-hi); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.su-sens { grid-row: span 2; }
.su-sens-list { display: grid; gap: .35rem; }
.su-sens-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 7rem 4.6rem 2rem; align-items: center; gap: .6rem;
  padding: .35rem .4rem .35rem .7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2);
}
.su-sens-row.current { border-color: var(--accent-line); background: var(--accent-soft); }
.su-sens-row label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.su-sens-row input { width: 100%; min-width: 0; text-align: right; color: var(--accent-hi); }
.su-sens-cm { font-family: var(--mono); font-size: .75rem; color: var(--chrome); text-align: right; }
.su-star { width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--line-2); font-size: 1rem; }
.su-star:hover:not(:disabled) { color: var(--accent-hi); background: var(--accent-soft); }
.su-star[aria-pressed="true"] { color: var(--accent-hi); cursor: default; }
.su-more summary { cursor: pointer; font-family: var(--mono); font-size: .8rem; color: var(--chrome); padding: .4rem 0; }
.su-more summary:hover { color: var(--ink); }
.su-more[open] summary { margin-bottom: .4rem; }
.su-more[hidden] { display: none; }
.su-empty { margin: 0; padding: .7rem .8rem; border: 1px dashed var(--line-2); border-radius: 6px; color: var(--chrome); font-size: .85rem; }
.su-empty[hidden] { display: none; }
.su-xh { display: flex; align-items: center; gap: .9rem; }
.su-xh p { margin: 0; }
.su-xh-preview {
  flex: 0 0 auto; width: 72px; height: 72px; border-radius: 8px; border: 1px solid var(--line-2);
  background: radial-gradient(circle at 50% 50%, #2c3a34, #121815 70%);
}
.su-xh-preview svg { display: block; width: 100%; height: 100%; shape-rendering: crispEdges; }
.su-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.su-card input:invalid { border-color: var(--danger); }
.su-card input[type=range] { width: 100%; }
@media (max-width: 900px) {
  .su-grid { grid-template-columns: 1fr; }
  .su-sens { grid-row: auto; }
  .su-invite { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .su-sens-row { grid-template-columns: minmax(0, 1fr) 6rem 2rem; }
  .su-sens-cm, .su-sens-row .badge { display: none; }
  .su-bar-actions .key { flex: 1 1 auto; }
  .su-me-actions { width: 100%; }
  .su-me-actions > * { flex: 1 1 auto; }
  .su-me-actions summary { text-align: center; }
  .su-menu-list { max-width: calc(100vw - 2rem); }
}

/* ---------- fenêtres : création de profil, mon profil, mes jeux ---------- */
.su-dialog { width: min(540px, 100%); border-radius: 10px; padding: 1.4rem; }
.su-dialog .note:first-child { margin-bottom: .3rem; }
.su-dialog .su-h { margin-bottom: .7rem; }
.su-dialog-actions { justify-content: flex-end; align-items: center; }
.su-dialog-actions .note { margin: 0 auto 0 0; }
.su-dialog-actions .key[hidden] { display: none; }
.su-steps { display: flex; gap: .35rem; list-style: none; margin: 0 0 1.1rem; padding: 0; }
.su-steps li { margin: 0; flex: 1; height: 3px; border-radius: 2px; background: var(--line-2); transition: background .3s var(--ease); }
.su-steps li.on { background: var(--accent); }
.pw-pane[hidden] { display: none; }
.su-choice { border: 0; margin: 1rem 0 0; padding: 0; display: grid; gap: .5rem; }
.su-choice legend { margin-bottom: .4rem; font-family: var(--mono); font-size: .78rem; color: var(--dim); }
.su-choice label { display: flex; align-items: flex-start; gap: .6rem; padding: .65rem .8rem; border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; }
.su-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.su-choice input { margin-top: .25rem; }
.err-text { color: var(--danger) !important; }
.ok-text { color: var(--accent-hi) !important; }
.me-photo { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.me-photo .key { margin: 0 .4rem .4rem 0; }
.me-photo .note { margin: .2rem 0 0; }
.me-games { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .6rem; padding-top: .8rem; border-top: 1px dashed var(--line-2); }
.me-games .note { margin: 0; }
.me-games[hidden] { display: none; }
#me-username-hint { margin: .4rem 0 0; }
.mg-list { max-height: min(52vh, 440px); overflow: auto; display: grid; gap: .8rem; padding-right: .3rem; }
.mg-cat { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: .4rem; }
.mg-cat legend { padding: 0; margin-bottom: .4rem; font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.mg-opt { display: flex; align-items: center; gap: .55rem; padding: .5rem .65rem; border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; font-size: .88rem; }
.mg-opt span:nth-of-type(1) { flex: 1; min-width: 0; }
.mg-opt .note { margin: 0; }
.mg-opt:hover { border-color: var(--accent-line); }
.mg-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.more-row td { text-align: center; padding: .6rem; }
@media (max-width: 640px) {
  .su-dialog { padding: 1.1rem; }
  .me-photo { align-items: flex-start; }
  .su-dialog-actions .key { flex: 1 1 auto; }
}
#mg-modal .su-dialog { width: min(660px, 100%); }
