/* =====================================================================
   XOO-X — Système de design
   Mobile d'abord, léger (aucune police téléchargée), clair et sombre.
   ===================================================================== */

:root {
  --brand: #0BB39B;
  --brand-600: #089A85;
  --brand-700: #077A6A;
  --brand-50: #E7F8F5;
  --violet: #6C5CE7;
  --violet-50: #EFEDFD;
  --amber: #F5A524;
  --amber-50: #FEF5E6;
  --rose: #E5484D;
  --rose-50: #FDECEC;
  --sky: #0EA5E9;
  --sky-50: #E6F6FD;

  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --surface-2: #F0F2F7;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --ok: #12A150;
  --ok-50: #E6F6EC;
  --bad: #E5484D;
  --bad-50: #FDECEC;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --nav-h: 64px;
  --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1120;
    --surface: #131B2E;
    --surface-2: #1B2540;
    --ink: #E8EDF7;
    --ink-2: #C3CCDC;
    --muted: #8A97AE;
    --line: #26314C;
    --brand-50: #0E2E2B;
    --violet-50: #221F45;
    --amber-50: #33270F;
    --rose-50: #3A1A1D;
    --sky-50: #0D2A3A;
    --ok-50: #0F2E1C;
    --bad-50: #3A1A1D;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1120;
  --surface: #131B2E;
  --surface-2: #1B2540;
  --ink: #E8EDF7;
  --ink-2: #C3CCDC;
  --muted: #8A97AE;
  --line: #26314C;
  --brand-50: #0E2E2B;
  --violet-50: #221F45;
  --amber-50: #33270F;
  --rose-50: #3A1A1D;
  --sky-50: #0D2A3A;
  --ok-50: #0F2E1C;
  --bad-50: #3A1A1D;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
:where(svg) { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.hero-card .deco svg { width: 100%; height: 100%; }
a { color: var(--brand-600); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 800; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.bold { font-weight: 700; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ Mise en page */
.app { min-height: 100dvh; display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); }
.page { max-width: 1080px; margin: 0 auto; padding: 16px; }
.page.narrow { max-width: 640px; }
.page.wide { max-width: 1240px; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 28px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.start { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .logo { height: 22px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .7rem; font-weight: 600;
}
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--brand-600); }
.bottomnav a.fab span.fab-bubble {
  width: 52px; height: 52px; border-radius: 18px; margin-top: -22px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--violet));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 45%, transparent);
}
.bottomnav a.fab.active { color: var(--brand-600); }

@media (min-width: 960px) {
  .bottomnav { display: none; }
  .main { padding-bottom: 32px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100dvh; width: 248px; flex: none;
    padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface);
  }
  .sidebar .brand { padding: 6px 10px 18px; }
  .sidebar .brand img { height: 26px; }
  .sidebar a.nav {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-weight: 600;
  }
  .sidebar a.nav svg { width: 22px; height: 22px; color: var(--muted); }
  .sidebar a.nav:hover { background: var(--surface-2); }
  .sidebar a.nav.active { background: var(--brand-50); color: var(--brand-700); }
  .sidebar a.nav.active svg { color: var(--brand-600); }
  .sidebar .sep { height: 1px; background: var(--line); margin: 12px 8px; }
  .sidebar .foot { margin-top: auto; }
  .topbar { padding: 0 24px; }
  .topbar .logo { display: none; }
  .page { padding: 24px; }
  .grid-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .desk-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
}
@media (min-width: 640px) {
  .grid-2-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ En-tête (logo à gauche, menus à droite) */
.hdr {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.hdr-in { max-width: 1180px; margin: 0 auto; height: 60px; padding: 0 12px 0 16px; display: flex; align-items: center; gap: 16px; }
.hdr-logo { display: flex; align-items: center; flex: none; }
.hdr-logo img { height: 24px; width: auto; }
.hdr-nav { display: none; gap: 4px; margin-left: 12px; }
.hdr-nav a { padding: 8px 14px; border-radius: 10px; font-weight: 700; color: var(--ink-2); font-size: .95rem; }
.hdr-nav a:hover { background: var(--surface-2); }
.hdr-nav a.active { color: var(--brand-700); background: var(--brand-50); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.hdr-me { border: 0; background: none; padding: 3px; border-radius: 14px; }
.hdr-me:hover { background: var(--surface-2); }
img.avatar { object-fit: cover; background: var(--surface-2); }
.main { min-height: calc(100dvh - 60px); }
@media (min-width: 960px) { .hdr-nav { display: flex; } .hdr-in { padding: 0 24px; } }

.subbar { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 6px; padding: 10px 12px 0; }
.subbar h1 { font-size: 1.15rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 960px) { .subbar { padding: 16px 16px 0; } }

.menu-pop {
  position: fixed; z-index: 95; width: 270px; max-width: calc(100vw - 16px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 8px; animation: fade .12s ease;
}
.menu-pop .menu-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 10px;
  border: 0; background: none; color: var(--ink); font-weight: 600; font-size: .95rem; text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-pop svg { color: var(--muted); }
.menu-pop .danger { color: var(--rose); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* Sections repliables */
details.fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.fold > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 12px; font-weight: 700; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold > .fold-body { padding: 0 16px 16px; }

.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.info-row b { text-align: right; overflow-wrap: anywhere; }

.block-title { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; }
.block-title h2 { font-size: 1.1rem; }
.block-title a { margin-left: auto; font-size: .9rem; font-weight: 700; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; }

/* Jeux */
.game-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; border-radius: var(--radius-lg); color: #fff; min-height: 150px; position: relative; overflow: hidden; }
.game-tile b { font-size: 1.1rem; }
.games-row .game-tile { width: 150px; min-height: 140px; }
.game-tile .emoji { font-size: 2.4rem; line-height: 1; }
.game-tile small { opacity: .9; }
.game-tile .best { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.22); padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.gboard { touch-action: none; user-select: none; -webkit-user-select: none; margin: 0 auto; }
.ghud { display: flex; justify-content: space-between; align-items: center; gap: 8px; max-width: 480px; margin: 0 auto 12px; }
.ghud .box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; text-align: center; min-width: 84px; }
.ghud .box small { display: block; font-size: .7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.ghud .box b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Composants */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card.flat { box-shadow: none; }
.card.pad-lg { padding: 20px; }
.card.link { display: block; color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
.card.link.row, .card.link.cat-tile { display: flex; }
.card.link.stack-sm, .card.link.pack-card, .card.link.partner-card { display: flex; flex-direction: column; }
.card.link.stack-sm > * + * { margin-top: 0; }
.card.link.stack-sm { gap: 8px; }
button.card { font: inherit; color: inherit; }
.card.link:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.card.link:active { transform: scale(.99); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 8px 2px 10px; }
.section-title a { font-size: .9rem; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; font-size: 1rem; line-height: 1;
  background: var(--brand); color: #fff;
  transition: background .15s, transform .1s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--brand-600); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: .9rem; border-radius: 12px; }
.btn.xs { min-height: 32px; padding: 0 10px; font-size: .82rem; border-radius: 10px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.violet { background: var(--violet); }
.btn.violet:hover { background: #5A4BD6; }
.btn.amber { background: var(--amber); color: #2A1A00; }
.btn.danger { background: var(--rose); }
.btn.danger.outline { background: transparent; color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, transparent); }
.btn.whatsapp { background: #25D366; color: #06311A; }
.icon-btn {
  width: 42px; height: 42px; flex: none; border-radius: 12px; border: 0; background: transparent;
  display: inline-grid; place-items: center; color: var(--ink-2); position: relative;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.dot { position: absolute; top: 8px; right: 8px; min-width: 9px; height: 9px; border-radius: 9px; background: var(--rose); border: 2px solid var(--bg); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  background: var(--surface-2); color: var(--ink-2);
}
.chip svg { width: 14px; height: 14px; }
.chip.brand { background: var(--brand-50); color: var(--brand-700); }
.chip.violet { background: var(--violet-50); color: var(--violet); }
.chip.amber { background: var(--amber-50); color: #A86200; }
.chip.rose { background: var(--rose-50); color: var(--rose); }
.chip.sky { background: var(--sky-50); color: #0369A1; }
.chip.ok { background: var(--ok-50); color: var(--ok); }
:root[data-theme="dark"] .chip.amber, :root:not([data-theme="light"]) .chip.amber { color: #F7B955; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .chip.amber { color: #A86200; } }

.pill-tabs { display: flex; gap: 6px; padding: 4px; background: var(--surface-2); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.pill-tabs::-webkit-scrollbar { display: none; }
.pill-tabs button, .pill-tabs a {
  flex: 1 0 auto; border: 0; background: transparent; padding: 8px 14px; border-radius: 10px;
  font-weight: 700; font-size: .9rem; color: var(--muted); white-space: nowrap; text-align: center;
}
.pill-tabs .active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.progress { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .4s ease; }
.progress.thin { height: 5px; }
.progress.violet > span { background: var(--violet); }
.progress.amber > span { background: var(--amber); }

.avatar {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--violet));
}
.avatar.lg { width: 72px; height: 72px; border-radius: 22px; font-size: 1.6rem; }
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: .85rem; }

.icon-tile {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c, var(--brand)) 14%, transparent);
  color: var(--c, var(--brand));
}
.icon-tile svg { width: 24px; height: 24px; }
.icon-tile.lg { width: 56px; height: 56px; border-radius: 18px; }
.icon-tile.lg svg { width: 30px; height: 30px; }

.stat { padding: 14px; }
.stat .v { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat .ic { width: 20px; height: 20px; margin-bottom: 6px; color: var(--c, var(--brand)); }

.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; }
.list > .item:last-child { border-bottom: 0; }
.list > a.item:hover { background: var(--surface-2); border-radius: 12px; }
.list .item .chev { color: var(--muted); width: 18px; height: 18px; flex: none; }

.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; font-size: .92rem; font-weight: 600;
  background: var(--amber-50); color: #8A5300;
}
.banner svg { width: 20px; height: 20px; flex: none; }
.banner:has(.btn) { flex-wrap: wrap; }
.banner > span { flex: 1 1 180px; }
.banner.info { background: var(--sky-50); color: #075985; }
.banner.ok { background: var(--ok-50); color: var(--ok); }
.banner.bad { background: var(--bad-50); color: var(--bad); }
:root[data-theme="dark"] .banner, :root[data-theme="dark"] .banner.info { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner { color: var(--ink); } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: .6; display: block; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 50%, var(--surface)) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 700; font-size: .88rem; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  font-size: 1rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.sm { min-height: 40px; padding: 8px 12px; border-radius: 11px; font-size: .92rem; }
.input-group { position: relative; }
.input-group .input { padding-left: 46px; }
.input-group > svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); margin-top: 2px; flex: none; }
.form-error { color: var(--bad); font-size: .88rem; font-weight: 600; }

/* ------------------------------------------------------------------ Cartes métier */
.hero-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg); padding: 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #6C5CE7 0%, transparent 55%), linear-gradient(135deg, #0BB39B 0%, #077A6A 100%);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--brand) 30%, transparent);
}
.hero-card h2 { font-size: 1.35rem; color: #fff; }
.hero-card p { opacity: .92; }
.hero-card .btn { background: #fff; color: #065F53; }
.hero-card .btn:hover { background: #F1FFFC; }
.hero-card .deco { position: absolute; right: -18px; bottom: -22px; width: 140px; height: 140px; opacity: .16; }
.hero-card .chip { background: rgba(255, 255, 255, .2); color: #fff; }
.hero-card.violet { background: radial-gradient(120% 140% at 100% 0%, #0BB39B 0%, transparent 50%), linear-gradient(135deg, #6C5CE7 0%, #4C3FC4 100%); box-shadow: 0 14px 30px rgba(108, 92, 231, .3); }
.hero-card.violet .btn { color: #3B2FB0; }
.hero-card.dark { background: radial-gradient(120% 140% at 100% 0%, #0BB39B55 0%, transparent 55%), linear-gradient(135deg, #0F172A 0%, #1E293B 100%); }

.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 16px 8px; margin: 0 -16px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: 0 0 auto; }
@media (min-width: 960px) { .hscroll { margin: 0; padding: 2px 0 8px; } }

.partner-card { width: 280px; display: flex; flex-direction: column; gap: 10px; }
.partner-card .media { height: 120px; border-radius: 12px; background: var(--surface-2) center/cover no-repeat; }
.partner-card .company { display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; color: var(--muted); }

.pack-card { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.pack-card .top { display: flex; align-items: flex-start; gap: 12px; }
.pack-card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pack-card .foot { margin-top: auto; }

.cat-tile { display: flex; align-items: center; gap: 12px; padding: 14px; }
.cat-tile .n { font-size: .8rem; color: var(--muted); font-weight: 600; }

.streak { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: #E8590C; }
.streak svg { width: 20px; height: 20px; }
.streak.off { color: var(--muted); }
.xp { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--violet); }
.xp svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ Lecteur de quiz */
.player { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; }
.player-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.player-top .progress { flex: 1; height: 10px; }
.player-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 16px 24px; width: 100%; max-width: 680px; margin: 0 auto; }
.player-foot { padding: 12px 16px calc(12px + var(--safe-b)); width: 100%; max-width: 680px; margin: 0 auto; }
.q-count { font-size: .85rem; font-weight: 700; color: var(--muted); }
.q-body { font-size: 1.25rem; font-weight: 750; line-height: 1.35; margin: 10px 0 18px; letter-spacing: -0.01em; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 58px; padding: 12px 14px; border-radius: 16px;
  background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px;
  font-size: 1rem; font-weight: 600; transition: transform .08s, border-color .15s, background .15s;
}
.choice:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.choice:active { transform: translateY(2px); border-bottom-width: 2px; margin-top: 2px; }
.choice .letter {
  width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: .9rem; background: var(--surface-2); color: var(--ink-2);
}
.choice.selected { border-color: var(--brand); background: var(--brand-50); }
.choice.selected .letter { background: var(--brand); color: #fff; }
.choice.correct { border-color: var(--ok); background: var(--ok-50); }
.choice.correct .letter { background: var(--ok); color: #fff; }
.choice.wrong { border-color: var(--bad); background: var(--bad-50); }
.choice.wrong .letter { background: var(--bad); color: #fff; }
.choice.dim { opacity: .55; }
.choice[disabled] { cursor: default; }
.timer { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.timer svg { width: 18px; height: 18px; }
.timer.low { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.feedback {
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + var(--safe-b));
  animation: slideUp .22s ease;
}
.feedback.ok { background: var(--ok-50); }
.feedback.bad { background: var(--bad-50); }
.feedback h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.feedback.ok h3 { color: var(--ok); }
.feedback.bad h3 { color: var(--bad); }
.feedback h3 svg { width: 24px; height: 24px; }
.feedback .btn { margin-top: 12px; }
.feedback.ok .btn { background: var(--ok); }
.feedback.bad .btn { background: var(--bad); }
@keyframes slideUp { from { transform: translateY(30%); opacity: 0; } }
.reading { font-size: 1.05rem; line-height: 1.7; white-space: pre-line; }

/* Résultat */
.score-ring { position: relative; width: 168px; height: 168px; margin: 8px auto; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.score-ring .lbl b { font-size: 2.4rem; font-weight: 900; letter-spacing: -0.03em; display: block; line-height: 1; }
.review-item { border-left: 4px solid var(--line); padding: 10px 12px; border-radius: 0 12px 12px 0; background: var(--surface); }
.review-item.ok { border-left-color: var(--ok); }
.review-item.bad { border-left-color: var(--bad); }
.burst { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ------------------------------------------------------------------ Classement */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; text-align: center; }
.podium .p { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium .base { width: 100%; border-radius: 14px 14px 6px 6px; display: grid; place-items: center; font-weight: 900; font-size: 1.4rem; color: #fff; }
.podium .p1 .base { height: 96px; background: linear-gradient(180deg, #F5A524, #D98B0A); }
.podium .p2 .base { height: 72px; background: linear-gradient(180deg, #94A3B8, #64748B); }
.podium .p3 .base { height: 56px; background: linear-gradient(180deg, #D08A5B, #A86438); }
.podium .name { font-weight: 700; font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; }
.rank-row .r { width: 28px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-row.me { background: var(--brand-50); }

/* ------------------------------------------------------------------ Graphiques */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.bars .b span { width: 100%; max-width: 28px; border-radius: 6px 6px 3px 3px; background: var(--brand); min-height: 3px; transition: height .4s ease; }
.bars .b span.zero { background: var(--surface-2); }
.bars .b em { font-style: normal; font-size: .68rem; color: var(--muted); font-weight: 600; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.hbar .progress { grid-column: 1 / -1; }

/* ------------------------------------------------------------------ Tableaux (admin) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }

/* ------------------------------------------------------------------ Fenêtres */
.overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(2, 6, 23, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 8px 18px calc(18px + var(--safe-b));
  animation: slideUp .22s ease;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 4px auto 12px; }
.sheet.wide { max-width: 760px; }
@media (min-width: 640px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 24px; padding: 20px 22px 22px; }
  .sheet .grab { display: none; }
}
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 960px) { .toast-host { bottom: 24px; } }
.toast {
  pointer-events: auto; max-width: 480px; width: fit-content;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px;
  font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

.net-pill {
  position: fixed; top: calc(env(safe-area-inset-top) + var(--top-h) + 6px); left: 50%; translate: -50% 0; z-index: 70; white-space: nowrap;
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: .8rem; font-weight: 700; box-shadow: var(--shadow);
}
.net-pill svg { width: 16px; height: 16px; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: spin .8s linear infinite; }
.spinner.lg { width: 44px; height: 44px; border-width: 4px; color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 5px; border-radius: 5px; background: var(--surface-2); }
.steps span.on { background: var(--brand); }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline .t { display: flex; gap: 12px; align-items: flex-start; position: relative; padding-bottom: 14px; }
.timeline .t::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.timeline .t:last-child::before { display: none; }
.timeline .t .d { width: 24px; height: 24px; border-radius: 50%; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.timeline .t .d svg { width: 14px; height: 14px; }
.timeline .t.done .d { background: var(--brand); color: #fff; }
.timeline .t.now .d { background: var(--amber); color: #fff; }

/* ------------------------------------------------------------------ Accueil invité */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; }
.welcome .wtop { padding: 20px; display: flex; align-items: center; justify-content: space-between; max-width: 1080px; width: 100%; margin: 0 auto; }
.welcome .wtop img { height: 26px; }
.welcome .whero { flex: 1; display: grid; gap: 28px; align-items: center; padding: 8px 20px 32px; max-width: 1080px; width: 100%; margin: 0 auto; }
@media (min-width: 900px) { .welcome .whero { grid-template-columns: 1.1fr 1fr; } }
.welcome h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 900; letter-spacing: -0.035em; }
.welcome h1 em { font-style: normal; background: linear-gradient(90deg, var(--brand), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mock {
  border-radius: 28px; padding: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  max-width: 380px; margin: 0 auto; width: 100%;
}
.feature { display: flex; gap: 12px; align-items: flex-start; }
.whero { display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .whero { grid-template-columns: 1.1fr 1fr; } }
em.grad { font-style: normal; background: linear-gradient(90deg, var(--brand), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.desk-only { display: none; }
@media (min-width: 900px) { .desk-only { display: block; } }

.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .bottomnav, .topbar, .no-print, .toast-host { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
