/* ==========================================================================
   Compétences — Attrapez-les toutes !  ·  Système de design « Ligue CDA » v1
   Fondations → tokens sémantiques → composants → vues. Clair / sombre, mouvement réduit.
   Polices libres : Luckiest Guy (Apache 2.0), Nunito, Press Start 2P, JetBrains Mono (OFL).
   ========================================================================== */

@font-face { font-family: "Luckiest Guy"; src: url("/fonts/luckiest-guy.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-italic.woff2") format("woff2"); font-weight: 200 1000; font-style: italic; font-display: swap; }
@font-face { font-family: "Press Start 2P"; src: url("/fonts/press-start-2p.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

/* ---------- Fondations ---------- */
:root {
  --yellow: #FFCB05; --yellow-deep: #F2A900; --yellow-soft: #FFF4C2;
  --blue: #2A75BB; --blue-deep: #1D4E8C; --blue-ink: #173B6C; --blue-soft: #E3EEFB;
  --navy: #0F1D3D; --red: #E3350D; --red-soft: #FDE4DD; --green: #22A45D; --green-soft: #DDF5E7;
  --t-acier: #7F92AB; --t-fee: #E77FC6; --t-combat: #C8413A; --t-vol: #6F97EA; --t-psy: #EE5D86; --t-roche: #B19A4E;
  --t-sol: #D0914C; --t-eau: #3F86DA; --t-insecte: #86A92A; --t-feu: #EE7B2A; --t-electrik: #E9B707;

  --radius-s: 8px; --radius: 14px; --radius-l: 22px; --radius-xl: 32px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Luckiest Guy", "Nunito", system-ui, sans-serif;
  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Tokens sémantiques — thème clair */
  --bg: #F3F6FC; --bg-grad-1: #EAF2FF; --bg-grad-2: #FFF8DC;
  --surface: #FFFFFF; --surface-2: #F7F9FE; --surface-3: #EEF3FC;
  --ink: #13213F; --ink-2: #33456B; --muted: #5E6C8C; --line: #D9E1F0; --line-2: #C3CEE4;
  --accent: var(--blue); --accent-ink: #FFFFFF; --focus: #FFB400;
  --yes: var(--green); --yes-bg: var(--green-soft); --no: var(--red); --no-bg: var(--red-soft);
  --unknown: #A3AFC8; --unknown-bg: #EEF1F7;
  --shadow-1: 0 1px 2px rgba(19, 33, 63, .06), 0 2px 8px rgba(19, 33, 63, .06);
  --shadow-2: 0 6px 24px rgba(19, 33, 63, .10), 0 2px 6px rgba(19, 33, 63, .06);
  --shadow-3: 0 18px 50px rgba(19, 33, 63, .18);
  --dialog-bg: #FFFFFF; --dialog-line: #1F2A48;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1230; --bg-grad-1: #0E1B45; --bg-grad-2: #1A1640;
    --surface: #121D45; --surface-2: #17244F; --surface-3: #1D2C5C;
    --ink: #EEF2FF; --ink-2: #C9D3F0; --muted: #98A6CB; --line: #26366A; --line-2: #33477F;
    --accent: #4C95E0; --yes-bg: rgba(34, 164, 93, .18); --no-bg: rgba(227, 53, 13, .18);
    --unknown: #6E7DA6; --unknown-bg: rgba(110, 125, 166, .16); --blue-soft: rgba(76, 149, 224, .16); --yellow-soft: rgba(255, 203, 5, .14);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 8px 28px rgba(0, 0, 0, .35); --shadow-3: 0 18px 50px rgba(0, 0, 0, .5);
    --dialog-bg: #0F1838; --dialog-line: #C9D3F0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1230; --bg-grad-1: #0E1B45; --bg-grad-2: #1A1640;
  --surface: #121D45; --surface-2: #17244F; --surface-3: #1D2C5C;
  --ink: #EEF2FF; --ink-2: #C9D3F0; --muted: #98A6CB; --line: #26366A; --line-2: #33477F;
  --accent: #4C95E0; --yes-bg: rgba(34, 164, 93, .18); --no-bg: rgba(227, 53, 13, .18);
  --unknown: #6E7DA6; --unknown-bg: rgba(110, 125, 166, .16); --blue-soft: rgba(76, 149, 224, .16); --yellow-soft: rgba(255, 203, 5, .14);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 8px 28px rgba(0, 0, 0, .35); --shadow-3: 0 18px 50px rgba(0, 0, 0, .5);
  --dialog-bg: #0F1838; --dialog-line: #C9D3F0;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.55; color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% -10%, var(--bg-grad-1), transparent 55%),
    radial-gradient(circle at 110% 10%, var(--bg-grad-2), transparent 45%),
    radial-gradient(var(--line) 1px, transparent 1.2px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed;
  min-height: 100vh;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--space-3); letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 900; }
h2 { font-size: 1.35rem; font-weight: 900; }
h3 { font-size: 1.08rem; font-weight: 800; }
p { margin: 0 0 var(--space-3); }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.pixel { font-family: var(--font-pixel); font-size: .62rem; letter-spacing: .02em; line-height: 1.6; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ---------- Titre signature (hommage stylistique, police libre) ---------- */
.brand-title {
  font-family: var(--font-display); font-weight: 400; color: var(--yellow);
  font-size: clamp(3rem, 9vw, 6.2rem); line-height: .95; letter-spacing: .02em; margin: 0;
  -webkit-text-stroke: .12em var(--blue); paint-order: stroke fill;
  text-shadow: 0 .06em 0 var(--blue-deep), 0 .12em 0 var(--navy), 0 .2em .25em rgba(15, 29, 61, .35);
  transform: rotate(-2deg); display: inline-block;
}
.brand-title .arc { display: inline-block; }
.brand-sub {
  font-family: var(--font-display); color: var(--blue); font-size: clamp(1.15rem, 3.2vw, 2rem); letter-spacing: .03em;
  -webkit-text-stroke: .07em var(--surface); paint-order: stroke fill; margin-top: .35em; transform: rotate(-2deg);
  display: inline-block; text-shadow: 0 .08em 0 rgba(15, 29, 61, .25);
}
.brand-mini { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mini .word {
  font-family: var(--font-display); color: var(--yellow); font-size: 1.45rem; letter-spacing: .03em;
  -webkit-text-stroke: .14em var(--blue); paint-order: stroke fill; text-shadow: 0 2px 0 var(--navy); line-height: 1;
}
.brand-mini .tag { font-family: var(--font-pixel); font-size: .5rem; color: var(--muted); line-height: 1.5; white-space: nowrap; }
main:focus, main:focus-visible { outline: none; }

/* Emblème original : capsule de code (pas une balle de marque) */
.capsule { width: 38px; height: 38px; flex: none; }

/* ---------- Mise en page ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--space-4);
  padding: 10px clamp(12px, 3vw, 28px); background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.navlink {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border-radius: 999px; color: var(--ink-2);
  text-decoration: none; font-weight: 800; font-size: .9rem; transition: background .15s, color .15s; white-space: nowrap;
}
.navlink:hover { background: var(--surface-3); color: var(--ink); }
.navlink[aria-current="page"] { background: var(--blue); color: #fff; box-shadow: inset 0 -3px 0 var(--blue-deep); }
.navlink .ico { font-size: 1.05em; }
.user-chip { display: flex; align-items: center; gap: 8px; margin-left: 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep)); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); font-size: .85rem;
}
main { max-width: 1240px; margin: 0 auto; padding: clamp(16px, 3vw, 32px) clamp(16px, 3vw, 28px) 110px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head .eyebrow { font-family: var(--font-pixel); font-size: .6rem; color: var(--blue); text-transform: uppercase; margin-bottom: 8px; display: block; }
.grid { display: grid; gap: var(--space-4); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: var(--space-4); }
.spacer { flex: 1; }
.bottombar { display: none; }

/* ---------- Composants de base ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-5);
  box-shadow: var(--shadow-1);
}
.card.pad-s { padding: var(--space-4); }
.card.flat { box-shadow: none; }
.card h2, .card h3 { display: flex; align-items: center; gap: 8px; }
.card-link { text-decoration: none; color: inherit; display: block; transition: transform .18s var(--ease), box-shadow .18s; }
.card-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }

.btn {
  --b: var(--blue); --b2: var(--blue-deep); --c: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  font: inherit; font-weight: 900; font-size: .95rem; padding: 11px 18px 12px; border-radius: 999px; color: var(--c);
  background: var(--b); box-shadow: inset 0 -4px 0 var(--b2), 0 2px 6px rgba(15, 29, 61, .15);
  transition: transform .1s var(--ease), filter .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--b2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: grayscale(.3); }
.btn.yellow { --b: var(--yellow); --b2: var(--yellow-deep); --c: var(--navy); }
.btn.red { --b: var(--red); --b2: #A92608; }
.btn.green { --b: var(--green); --b2: #16784A; }
.btn.ghost { --b: transparent; --b2: transparent; --c: var(--ink); box-shadow: inset 0 0 0 2px var(--line-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.small { padding: 7px 12px 8px; font-size: .85rem; }
.btn.icon { padding: 9px; width: 40px; height: 40px; border-radius: 50%; }
.btn .ico { font-size: 1.1em; line-height: 1; }

label.field { display: block; font-weight: 800; font-size: .9rem; margin-bottom: var(--space-3); }
label.field > span.hint { display: block; font-weight: 600; color: var(--muted); font-size: .82rem; margin-top: 2px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="month"], input[type="number"], select, textarea {
  width: 100%; margin-top: 6px; font: inherit; font-weight: 600; color: var(--ink); background: var(--surface-2);
  border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: .92rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue); flex: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-weight: 800;
  font-size: .78rem; background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.chip.yes { background: var(--yes-bg); color: var(--yes); border-color: transparent; }
.chip.no { background: var(--no-bg); color: var(--no); border-color: transparent; }
.chip.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.chip.yellow { background: var(--yellow-soft); color: #8A6400; border-color: transparent; }
:root[data-theme="dark"] .chip.yellow { color: var(--yellow); }
.type-badge {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-pixel); font-size: .5rem; text-transform: uppercase;
  color: #fff; padding: 5px 8px 4px; border-radius: 6px; background: var(--tc, var(--t-acier)); letter-spacing: .04em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}

.alert { border-radius: var(--radius); padding: 12px 16px; font-weight: 700; border: 2px solid; }
.alert.info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 40%, transparent); }
.alert.warn { background: var(--yellow-soft); border-color: color-mix(in srgb, var(--yellow-deep) 60%, transparent); }
.alert.err { background: var(--no-bg); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.alert.ok { background: var(--yes-bg); border-color: color-mix(in srgb, var(--green) 50%, transparent); }

/* Boîte de dialogue façon jeu de rôle rétro (style générique) */
.dialogbox {
  position: relative; background: var(--dialog-bg); border: 4px solid var(--dialog-line); border-radius: 14px; padding: 18px 20px;
  box-shadow: inset 0 0 0 4px var(--dialog-bg), inset 0 0 0 6px color-mix(in srgb, var(--dialog-line) 45%, transparent), var(--shadow-2);
}
.dialogbox .speaker { font-family: var(--font-pixel); font-size: .62rem; color: var(--blue); margin-bottom: 10px; display: block; }
.dialogbox p:last-child { margin-bottom: 0; }
.dialogbox .caret { position: absolute; right: 14px; bottom: 10px; font-size: .8rem; animation: blink 1s steps(2) infinite; color: var(--red); }
@keyframes blink { 50% { opacity: 0; } }

/* Tri-état Oui / Non */
.tri { display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: 3px; gap: 2px; border: 1px solid var(--line); }
.tri button {
  font: inherit; font-weight: 900; font-size: .8rem; border: 0; background: transparent; color: var(--muted); padding: 6px 12px;
  border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: background .15s, color .15s;
}
.tri button:hover { color: var(--ink); }
.tri button[aria-pressed="true"].y { background: var(--yes); color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2); }
.tri button[aria-pressed="true"].n { background: var(--no); color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2); }
.tri-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; padding: 10px 0; border-top: 1px dashed var(--line); }
.tri-row:first-of-type { border-top: 0; }
.tri-row .q { font-weight: 800; font-size: .95rem; }
.tri-row .q small { display: block; color: var(--muted); font-weight: 600; }

/* Pastilles E / P / A */
.pips { display: inline-flex; gap: 4px; }
.pip {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-size: .72rem;
  color: #fff; background: var(--unknown); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
}
.pip.y { background: var(--yes); } .pip.n { background: var(--no); }
.pip.small { width: 18px; height: 18px; border-radius: 5px; font-size: .56rem; }

/* Barre d'EXP */
.exp { display: flex; align-items: center; gap: 10px; }
.exp .lbl { font-family: var(--font-pixel); font-size: .55rem; color: var(--muted); min-width: 34px; }
.exp .bar { flex: 1; height: 12px; border-radius: 999px; background: var(--surface-3); border: 2px solid var(--line-2); overflow: hidden; }
.exp .bar > i { display: block; height: 100%; width: var(--v, 0%); background: linear-gradient(90deg, #58B7FF, var(--blue)); border-radius: 999px; transition: width .6s var(--ease); }
.exp.hp .bar > i { background: linear-gradient(90deg, var(--green), #6BD68F); }
.exp .val { font-weight: 900; font-size: .85rem; min-width: 42px; text-align: right; }

/* Anneau de progression */
.ring { position: relative; width: 150px; height: 150px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .big { font-family: var(--font-display); font-size: 2.4rem; color: var(--yellow); -webkit-text-stroke: .1em var(--blue); paint-order: stroke fill; line-height: 1; }
.ring .cap { font-family: var(--font-pixel); font-size: .5rem; color: var(--muted); margin-top: 4px; }

/* Héros */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-xl); padding: clamp(24px, 5vw, 56px);
  background: radial-gradient(circle at 20% 0%, #7CC4FF 0%, #3D8BDA 38%, #1D4E8C 100%); color: #fff; box-shadow: var(--shadow-3);
  isolation: isolate;
}
.hero::before {
  content: ""; position: absolute; inset: -50%; z-index: -1;
  background: repeating-conic-gradient(from 0deg at 72% 38%, rgba(255, 255, 255, .09) 0deg 9deg, transparent 9deg 18deg);
  animation: spin 80s linear infinite;
}
.hero::after {
  content: ""; position: absolute; right: -60px; bottom: -80px; width: 340px; height: 340px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255, 203, 5, .55), transparent 65%);
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero .brand-sub { color: #fff; -webkit-text-stroke: .07em var(--blue-deep); }
.hero p.lead { max-width: 640px; font-size: 1.1rem; font-weight: 700; color: #EAF3FF; margin-top: var(--space-5); }
.hero .shapes { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero .shapes span { position: absolute; border-radius: 12px; border: 3px solid rgba(255, 255, 255, .28); animation: float 9s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-14px) rotate(8deg); } }

/* Carte Compétodex */
.dex-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.dex-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden;
  box-shadow: var(--shadow-1); text-decoration: none; color: inherit; display: flex; flex-direction: column;
  transition: transform .18s var(--ease), box-shadow .18s;
}
.dex-card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: var(--shadow-2); }
.dex-card .band { height: 84px; position: relative; background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 55%, #0F1D3D)); }
.dex-card .band::after {
  content: ""; position: absolute; inset: 0; opacity: .25;
  background: radial-gradient(circle at 20% 30%, #fff 0 2px, transparent 3px) 0 0 / 22px 22px;
}
.dex-card .num { position: absolute; left: 14px; top: 12px; font-family: var(--font-pixel); font-size: .6rem; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); z-index: 1; }
.dex-card .creature {
  position: absolute; right: 16px; bottom: -30px; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center;
  font-size: 2.3rem; background: var(--surface); border: 4px solid var(--surface); box-shadow: var(--shadow-2), inset 0 0 0 3px var(--tc); z-index: 1;
}
.dex-card .creature img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dex-card .body { padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.dex-card h3 { margin: 0; padding-right: 76px; font-size: 1.02rem; }
.dex-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.stamp {
  position: absolute; top: 44px; left: 14px; z-index: 2; font-family: var(--font-display); font-size: 1rem; color: var(--yellow);
  -webkit-text-stroke: .12em var(--navy); paint-order: stroke fill; transform: rotate(-8deg); letter-spacing: .04em; pointer-events: none;
}
/* Lien étiré : toute la carte mène à la fiche, le bouton « Rejouer la capture » reste cliquable au-dessus */
.dex-card .dex-link { color: inherit; text-decoration: none; }
.dex-card .dex-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.dex-card .dex-link:focus-visible { outline: none; }
.dex-card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.dex-card .replay { position: relative; z-index: 2; align-self: flex-start; }
.dex-card.is-captured { border-color: color-mix(in srgb, var(--yellow-deep) 70%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--yellow) 55%, transparent), var(--shadow-1); }
.detail-creature { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 260px; }
.detail-creature img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.replay-box .small { display: block; max-width: 220px; }

/* Mini-jeu de capture */
.modal.capture-modal { width: min(720px, 100%); }
.capture { display: flex; flex-direction: column; gap: 10px; }
.capture-intro { margin: 0; font-weight: 700; }
.capture-hud { gap: 8px; }
.capture-stage { border-radius: 18px; overflow: hidden; border: 3px solid var(--dialog-line); box-shadow: inset 0 0 0 3px var(--dialog-bg), var(--shadow-2); background: var(--navy); }
.capture-canvas { display: block; width: 100%; height: auto; aspect-ratio: 640 / 440; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.capture-canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: -4px; border-radius: 14px; }
.capture-status { margin: 0; font-weight: 900; min-height: 1.6em; }
.capture-actions { justify-content: flex-end; }

/* Mon entreprise */
.exp-list { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.exp-card { border-left: 6px solid var(--line-2); display: flex; flex-direction: column; gap: var(--space-3); }
.exp-card.current { border-left-color: var(--green); }
.exp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin: 0; }
.exp-facts dt { font-size: .74rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.exp-facts dd { margin: 2px 0 0; font-weight: 800; }
.exp-mission { background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; }
.exp-form { grid-column: 1 / -1; border: 2px dashed color-mix(in srgb, var(--blue) 45%, transparent); }
.exp-add { width: 100%; padding: 16px; border-radius: var(--radius-l); box-shadow: inset 0 0 0 2px var(--line-2); }
.exp-add:hover { box-shadow: inset 0 0 0 2px var(--blue); }

/* Badges d'activité type (formes originales) */
.badges { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.badge { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); min-width: 220px; flex: 1; }
.badge svg { width: 54px; height: 54px; flex: none; filter: drop-shadow(0 3px 0 rgba(15, 29, 61, .2)); }
.badge.off svg { filter: grayscale(1) opacity(.45); }
.badge b { display: block; font-weight: 900; }
.badge small { color: var(--muted); font-weight: 700; }

/* Tableaux */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { position: sticky; top: 0; background: var(--surface-2); font-weight: 900; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); z-index: 1; }
tr:last-child td { border-bottom: 0; }
td.sticky, th.sticky { position: sticky; left: 0; background: var(--surface); z-index: 2; }
th.sticky { z-index: 3; background: var(--surface-2); }
.matrix td { text-align: center; padding: 6px; }
.matrix td.sticky { text-align: left; font-weight: 800; white-space: nowrap; }

/* Onglets */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.tab { font: inherit; font-weight: 900; border: 2px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* Section repliable */
details.fold { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.fold + details.fold { margin-top: 10px; }
details.fold > summary { cursor: pointer; padding: 14px 16px; font-weight: 900; list-style: none; display: flex; align-items: center; gap: 10px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "▸"; margin-left: auto; transition: transform .2s; color: var(--muted); }
details.fold[open] > summary::after { transform: rotate(90deg); }
details.fold > .inner { padding: 0 16px 16px; }
ul.clean { margin: 0; padding-left: 1.2em; }
ul.clean li { margin: 4px 0; }
li.re { list-style: none; margin-left: -1.2em; padding-left: 1.2em; position: relative; }
li.re::before { content: "★"; position: absolute; left: 0; color: var(--yellow-deep); }

/* Toasts et modales */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow-3); animation: pop .25s var(--ease); border-left: 6px solid var(--yellow); }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes pop { from { transform: translateY(12px) scale(.96); opacity: 0; } }
.modal-back { position: fixed; inset: 0; background: rgba(8, 14, 36, .55); z-index: 150; display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--radius-l); padding: var(--space-5); width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-3); animation: pop .25s var(--ease); }
.modal.wide { width: min(980px, 100%); }
.modal > .row:first-child { flex-wrap: nowrap; align-items: flex-start; }
.modal > .row:first-child h2 { min-width: 0; }
.modal > .row:first-child > button { flex: none; }

/* Statut des Profs */
.status-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: var(--unknown); box-shadow: 0 0 0 3px var(--unknown-bg); flex: none; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--yes-bg); animation: pulse 2s infinite; }
.status-dot.off { background: var(--red); box-shadow: 0 0 0 3px var(--no-bg); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }

/* Centre des Profs (chat) */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; gap: var(--space-4); min-height: 70vh; }
.chat-side { display: flex; flex-direction: column; gap: var(--space-3); }
.prof-card { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.prof-card[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.prof-card .face { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; background: var(--pc, var(--blue)); color: #fff; flex: none; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.prof-card b { display: block; }
.prof-card small { color: var(--muted); font-weight: 700; display: block; line-height: 1.3; }
.prof-card small.row { display: flex; }
.conv-list { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; }
.conv-item { text-align: left; font: inherit; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--ink-2); font-weight: 700; font-size: .88rem; }
.conv-item:hover { background: var(--surface-3); }
.conv-item[aria-current="true"] { background: var(--blue-soft); color: var(--blue); }
.chat-main { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; min-height: 70vh; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.chat-log { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); max-height: 62vh; }
.bubble { max-width: min(720px, 92%); padding: 12px 16px; border-radius: 18px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 6px; }
.bubble.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.err { align-self: center; background: var(--no-bg); color: var(--no); font-weight: 800; font-size: .88rem; }
.bubble .meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: .75rem; opacity: .8; font-weight: 700; }
.bubble.bot .meta button { font: inherit; border: 0; background: var(--surface-3); color: var(--ink-2); border-radius: 999px; padding: 3px 9px; cursor: pointer; font-weight: 800; }
.typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 30% { transform: translateY(-6px); opacity: .6; } }
.composer { border-top: 1px solid var(--line); padding: 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: end; background: var(--surface); }
.composer textarea { margin: 0; min-height: 52px; max-height: 200px; }
.mic { width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.5rem; color: #fff; background: var(--red); box-shadow: inset 0 -4px 0 #A92608; display: grid; place-items: center; }
.mic[aria-pressed="true"] { animation: rec 1.2s infinite; background: #FF4F1F; }
@keyframes rec { 50% { box-shadow: inset 0 -4px 0 #A92608, 0 0 0 10px rgba(227, 53, 13, .2); } }
.mic:disabled { background: var(--unknown); box-shadow: none; cursor: not-allowed; }
.voice-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .85rem; font-weight: 800; color: var(--muted); padding: 0 12px 10px; background: var(--surface); }
.privacy-note { font-size: .8rem; color: var(--muted); font-weight: 700; }

/* Liste d'étapes (La Ligue) */
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 4px; border-radius: 4px; background: linear-gradient(var(--yellow), var(--blue)); }
.step { position: relative; margin-bottom: var(--space-4); }
.step::before { content: attr(data-n); position: absolute; left: -34px; top: 2px; width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 900; display: grid; place-items: center; box-shadow: 0 0 0 4px var(--surface); font-size: .85rem; }

/* Divers */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-family: var(--font-display); font-size: 2.1rem; color: var(--blue); line-height: 1; letter-spacing: .02em; }
.kpi .l { font-weight: 800; color: var(--muted); font-size: .85rem; }
.empty { text-align: center; padding: var(--space-6) var(--space-4); color: var(--muted); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain > li { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.list-plain > li:last-child { border-bottom: 0; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { font: inherit; font-weight: 800; font-size: .8rem; border: 0; background: var(--surface); color: var(--muted); padding: 6px 12px; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.seg.status button[aria-pressed="true"][data-v="redige"], .seg.status button[aria-pressed="true"][data-v="termine"], .seg.status button[aria-pressed="true"][data-v="relu"], .seg.status button[aria-pressed="true"][data-v="valide"] { background: var(--green); }
.seg.status button[aria-pressed="true"][data-v="en_cours"], .seg.status button[aria-pressed="true"][data-v="brouillon"] { background: var(--yellow); color: var(--navy); }
.seg.status button[aria-pressed="true"][data-v="a_faire"], .seg.status button[aria-pressed="true"][data-v="a_ecrire"] { background: var(--unknown); }
.cp-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-picker label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 999px; border: 2px solid var(--line); cursor: pointer; font-weight: 800; font-size: .8rem; background: var(--surface); }
.cp-picker input { accent-color: var(--blue); }
.cp-picker label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.theme-toggle { font: inherit; border: 0; background: transparent; cursor: pointer; font-size: 1.15rem; padding: 6px; border-radius: 50%; color: var(--ink-2); }
.theme-toggle:hover { background: var(--surface-3); }
.footer { text-align: center; color: var(--muted); font-size: .8rem; font-weight: 700; padding: 24px 16px 40px; }
.print-only { display: none; }
.center-narrow { max-width: 520px; margin: 0 auto; }

/* Responsive */
@media (max-width: 1440px) and (min-width: 1201px) {
  .topbar nav .navlink .ico { display: none; }
}
/* Écrans moyens : icônes seules (libellé de la page courante visible, libellés lus par les lecteurs d'écran) */
@media (max-width: 1200px) and (min-width: 921px) {
  .topbar { gap: 10px; }
  .navlink { padding: 8px 10px; }
  .navlink .ico { font-size: 1.2em; }
  .navlink .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .navlink[aria-current="page"] .lbl { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}
@media (max-width: 920px) {
  .topbar nav { display: none; }
  .brand-mini { margin-right: auto; }
  .brand-mini .tag { display: none; }
  .user-chip .btn { display: none; } /* « Se déconnecter » est dans le menu « Plus » */
  .bottombar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(15, 29, 61, .1);
  }
  .bottombar > a, .more-btn {
    display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; font-size: .66rem; font-weight: 900; color: var(--muted);
    text-decoration: none; padding: 4px 6px; border-radius: 10px; min-width: 56px; border: 0; background: transparent; cursor: pointer;
  }
  .bottombar > a .ico, .more-btn .ico { font-size: 1.3rem; line-height: 1.2; }
  .bottombar > a[aria-current="page"], .more-btn[aria-current="page"], .more-btn[aria-expanded="true"] { color: var(--blue); background: var(--blue-soft); }
  .more-sheet {
    position: absolute; right: 8px; bottom: calc(100% + 8px); min-width: 230px; display: flex; flex-direction: column; gap: 2px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-3); animation: pop .18s var(--ease);
  }
  .more-sheet a { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 12px; color: var(--ink); font-weight: 800; text-decoration: none; }
  .more-sheet a:hover, .more-sheet a[aria-current="page"] { background: var(--blue-soft); color: var(--blue); }
  .more-logout { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 12px; border: 0; border-top: 1px dashed var(--line); background: transparent; color: var(--ink-2); font: inherit; font-weight: 800; cursor: pointer; text-align: left; }
  .more-logout:hover { background: var(--no-bg); color: var(--no); }
}
@media (max-width: 440px) {
  .topbar { gap: 8px; }
  .brand-mini .word { font-size: 1.25rem; }
  .user-chip { margin-left: 0; }
}
@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-log { max-height: 55vh; }
  .chat-side > .card:first-child { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .chat-side > .card:first-child > h3 { grid-column: 1 / -1; }
  .chat-side .prof-card { flex-direction: column; align-items: flex-start; }
  .chat-side .prof-card small:not(.row) { display: none; }
  .conv-list { max-height: 160px; }
}
@media (max-width: 760px) {
  .card { padding: var(--space-4); }
  .exp-list { grid-template-columns: 1fr; }
  .ring { width: 120px; height: 120px; }
  .composer { grid-template-columns: auto 1fr; }
  .composer .send { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media print {
  .topbar, .bottombar, .no-print, #toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #999; break-inside: avoid; }
  .print-only { display: block; }
  main { padding: 0; max-width: none; }
}
