/* =========================================================
   THÈME TERMINAL — 12 couleurs (bouton ◐ : matrix, cyan, ambre, lime, menthe, bleu, violet, rose, rouge, orange, or, blanc)
   ========================================================= */
:root, [data-theme="matrix"] {
  --accent: #39ff88;
  --accent-dim: #1f8f4e;
  --glow: rgba(57, 255, 136, .35);
}
[data-theme="cyan"] {
  --accent: #22d3ee;
  --accent-dim: #127c8c;
  --glow: rgba(34, 211, 238, .35);
}
[data-theme="ambre"] {
  --accent: #ffb000;
  --accent-dim: #8f6300;
  --glow: rgba(255, 176, 0, .35);
}
[data-theme="lime"]   { --accent: #a3e635; --accent-dim: #4d7c0f; --glow: rgba(163, 230, 53, .35); }
[data-theme="menthe"] { --accent: #5eead4; --accent-dim: #0f766e; --glow: rgba(94, 234, 212, .35); }
[data-theme="bleu"]   { --accent: #60a5fa; --accent-dim: #1d4ed8; --glow: rgba(96, 165, 250, .35); }
[data-theme="violet"] { --accent: #a78bfa; --accent-dim: #6d28d9; --glow: rgba(167, 139, 250, .35); }
[data-theme="rose"]   { --accent: #f472b6; --accent-dim: #be185d; --glow: rgba(244, 114, 182, .35); }
[data-theme="rouge"]  { --accent: #f87171; --accent-dim: #b91c1c; --glow: rgba(248, 113, 113, .35); }
[data-theme="orange"] { --accent: #fb923c; --accent-dim: #c2410c; --glow: rgba(251, 146, 60, .35); }
[data-theme="or"]     { --accent: #facc15; --accent-dim: #a16207; --glow: rgba(250, 204, 21, .35); }
[data-theme="blanc"]  { --accent: #e5e7eb; --accent-dim: #6b7280; --glow: rgba(229, 231, 235, .28); }
:root {
  --bg: #06090d;
  --panel: #0c121a;
  --panel-2: #111a24;
  --text: #c9d4df;
  --muted: #6b7a89;
  --border: #1d2a37;
  --sec: #ff4d6d;
  --ok: #39ff88;
  --bad: #ff4d6d;
  --xp: #ffd447;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html { scrollbar-color: var(--accent-dim) var(--bg); }
body {
  margin: 0;
  font-family: var(--mono);
  font-size: 14.5px;
  background: var(--bg)
    radial-gradient(ellipse at top, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}
::selection { background: var(--accent); color: var(--bg); }

/* Effet écran cathodique */
.scanlines {
  pointer-events: none; position: fixed; inset: 0; z-index: 100;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
  opacity: .35;
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.brand { cursor: pointer; font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.prompt { color: var(--accent); text-shadow: 0 0 8px var(--glow); }
.dim { color: var(--muted); }
.cursor { color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.player {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}
.player:hover { border-color: var(--accent); }
.lvl-badge {
  font-weight: 800; color: var(--bg); background: var(--xp);
  padding: 2px 8px; border-radius: 4px; font-size: .8rem; box-shadow: 0 0 10px rgba(255,212,71,.4);
}
.player-title { font-size: .78rem; color: var(--xp); }
.xpbar { width: 160px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.xpbar > div { height: 100%; background: var(--xp); width: 0; transition: width .6s; box-shadow: 0 0 8px var(--xp); }
.xp-text { font-size: .7rem; color: var(--muted); }

.topbar-right { display: flex; gap: 8px; }
#search {
  font-family: var(--mono); padding: 7px 10px; width: 200px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--accent);
}
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--glow); }

button {
  font-family: var(--mono); font-size: .88rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 6px; padding: 7px 14px; transition: .15s;
}
button:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px var(--glow); }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { color: var(--bg); }

/* ---------- Mise en page ---------- */
.layout { display: grid; grid-template-columns: 300px 1fr; }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 14px; overflow-y: auto; height: calc(100vh - 59px); position: sticky; top: 59px;
}
.content { padding: 32px 40px; max-width: 960px; width: 100%; }

/* ---------- Sidebar ---------- */
/* Parcours repliables */
.track { margin-top: 14px; }
.track-title {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 6px; padding: 8px 4px 6px;
  background: none; border: none; border-bottom: 1px dashed var(--border); border-radius: 4px 4px 0 0;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; text-align: left;
  color: var(--accent); cursor: pointer;
}
.track-title:hover { background: var(--panel-2); color: var(--accent); box-shadow: none; }
.track-title.sec, .track-title.sec:hover { color: var(--sec); }
.track-title .tt { flex: 1; min-width: 0; line-height: 1.5; }
.track-title .tprog { font-size: .68rem; color: var(--muted); letter-spacing: 0; flex-shrink: 0; }
.track-title .chev { color: inherit; }
.track.open > .track-title .chev { transform: rotate(90deg); }
.track:not(.open) > .track-items { display: none; }
.track:not(.open) > .track-title { opacity: .85; }
.lesson-link {
  display: flex; justify-content: space-between; gap: 6px; padding: 4px 10px 4px 18px;
  border-left: 2px solid transparent; font-size: .8rem; text-decoration: none; color: var(--muted);
}
.lesson-link:hover { color: var(--accent); border-left-color: var(--accent-dim); }
.lesson-link.active { color: var(--accent); border-left-color: var(--accent); background: var(--panel-2); }
.lesson-link .check { color: var(--ok); }
.lesson-link .tag { color: var(--xp); }

/* ---------- Accueil ---------- */
.boot { color: var(--muted); font-size: .85rem; margin-bottom: 18px; }
.boot .ok { color: var(--ok); }
.hero h1 { margin: 0 0 6px; font-size: 1.9rem; color: var(--accent); text-shadow: 0 0 12px var(--glow); }
.hero p { color: var(--muted); margin: 0 0 24px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.4rem; color: var(--accent); }
.stat span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 18px 20px; cursor: pointer; transition: .2s;
}
.card::before {
  content: attr(data-label); position: absolute; top: -9px; left: 14px; padding: 0 6px;
  background: var(--bg); font-size: .7rem; color: var(--accent);
}
.card.sec::before { color: var(--sec); }
.card:hover { border-color: var(--accent); box-shadow: 0 0 18px var(--glow); transform: translateY(-2px); }
.card.sec:hover { border-color: var(--sec); box-shadow: 0 0 18px rgba(255,77,109,.3); }
.card h2 { margin: 4px 0 6px; font-size: 1.1rem; }
.card p { color: var(--muted); margin: 0 0 12px; font-size: .83rem; }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .4s; }
.card.sec .progress > div { background: var(--sec); }
.progress-label { font-size: .75rem; color: var(--muted); margin-top: 6px; }

/* ---------- Leçons ---------- */
.breadcrumb { color: var(--muted); font-size: .78rem; margin-bottom: 6px; }
.breadcrumb::before { content: "~/"; color: var(--accent); }
.lesson h1 { margin: 0 0 20px; font-size: 1.6rem; color: var(--accent); text-shadow: 0 0 10px var(--glow); }
.lesson h1::before { content: "# "; color: var(--muted); }
.lesson h2 { margin-top: 30px; font-size: 1.05rem; color: var(--text); }
.lesson h2::before { content: ">> "; color: var(--accent); }
.lesson b { color: #fff; }
.lesson a { color: var(--accent); }
.lesson pre {
  position: relative; background: #000; color: #d6ffe6; padding: 30px 16px 14px;
  border: 1px solid var(--border); border-radius: 6px; overflow-x: auto; font-size: .84rem;
}
.lesson pre::before {
  content: "● ● ●"; position: absolute; top: 6px; left: 12px; font-size: .6rem;
  color: var(--muted); letter-spacing: 2px;
}
.lesson code { font-family: var(--mono); }
.lesson p code, .lesson li code { overflow-wrap: anywhere; }
.lesson p code, .lesson li code, .lesson td code {
  color: var(--accent); background: var(--panel-2); border: 1px solid var(--border); padding: 0 5px; border-radius: 3px;
}
.lesson table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: .85rem; }
.lesson th, .lesson td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.lesson th { background: var(--panel-2); color: var(--accent); }
.tip { border: 1px solid var(--accent-dim); border-left: 4px solid var(--accent); background: var(--panel); padding: 10px 14px; border-radius: 6px; margin: 16px 0; }
.warn { border-color: rgba(255,77,109,.4); border-left-color: var(--sec); }
.lesson-nav { display: flex; justify-content: space-between; margin-top: 32px; gap: 8px; flex-wrap: wrap; }
.xp-gain { color: var(--xp); font-size: .8rem; }

/* ---------- Quiz & exercices ---------- */
.box { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; margin-top: 20px; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.box-head h3 { margin: 0; font-size: 1rem; color: var(--text); }
.diff { font-size: .72rem; padding: 2px 8px; border-radius: 3px; border: 1px solid; }
.diff.d1 { color: var(--ok); border-color: var(--ok); }
.diff.d2 { color: var(--xp); border-color: var(--xp); }
.diff.d3 { color: var(--sec); border-color: var(--sec); }
.q { margin-bottom: 20px; }
.q-title { font-weight: 600; margin-bottom: 8px; color: #fff; }
.opt { display: block; width: 100%; text-align: left; margin: 4px 0; }
.opt.correct { border-color: var(--ok); color: var(--ok); background: rgba(57,255,136,.08); }
.opt.wrong { border-color: var(--bad); color: var(--bad); background: rgba(255,77,109,.08); }
.explain { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.score { font-weight: 700; margin-top: 10px; color: var(--accent); }
textarea {
  width: 100%; min-height: 90px; margin: 10px 0; padding: 10px; resize: vertical;
  font-family: var(--mono); font-size: .84rem; background: #000; color: var(--accent);
  border: 1px solid var(--border); border-radius: 6px;
}
textarea:focus { outline: none; border-color: var(--accent); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint, .solution { display: none; margin-top: 12px; padding: 12px 14px; border-radius: 6px; }
.hint { border: 1px dashed var(--xp); color: var(--xp); font-size: .85rem; }
.solution { border: 1px solid var(--accent-dim); background: var(--bg); }
.solution::before { content: attr(data-label); display: block; color: var(--accent); font-size: .75rem; margin-bottom: 6px; }
.show { display: block; }
.solved { color: var(--ok); font-size: .8rem; }

/* ---------- Profil / niveaux ---------- */
.ladder { list-style: none; padding: 0; margin: 0; }
.ladder li {
  display: grid; grid-template-columns: 96px 1fr 90px; gap: 10px; align-items: center;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px; color: var(--muted);
}
.ladder li.reached { color: var(--text); border-color: var(--accent-dim); }
.ladder li.current { border-color: var(--xp); color: var(--xp); box-shadow: 0 0 12px rgba(255,212,71,.25); }
.ladder .l { font-weight: 800; white-space: nowrap; }
.ladder .x { text-align: right; font-size: .8rem; }
.xp-table td:last-child { color: var(--xp); }

/* ---------- Notifications ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  background: var(--panel); border: 1px solid var(--xp); color: var(--xp);
  padding: 10px 16px; border-radius: 6px; font-weight: 700;
  transform: translateY(120px); opacity: 0; transition: .35s;
}
.toast.on { transform: none; opacity: 1; }
.levelup {
  position: fixed; inset: 0; z-index: 60; display: none; place-items: center;
  background: rgba(0,0,0,.75);
}
.levelup.on { display: grid; animation: fade .3s; }
.levelup-box {
  text-align: center; padding: 30px 46px; border: 2px solid var(--xp); border-radius: 10px;
  background: var(--panel); box-shadow: 0 0 40px rgba(255,212,71,.4); animation: pop .5s;
}
.levelup-box .big { font-size: 2.6rem; font-weight: 800; color: var(--xp); text-shadow: 0 0 16px var(--xp); }
.levelup-box .t { font-size: 1.1rem; margin: 6px 0 18px; color: #fff; }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Catégories Débutant / Intermédiaire / Avancé ---------- */
:root { --c1: #39ff88; --c2: #ffb000; --c3: #ff4d6d; }
.cat-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.cat-tab { font-size: .75rem; padding: 5px 6px; }
.cat-tab.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.cat-tab.c1.on { background: var(--c1); border-color: var(--c1); }
.cat-tab.c2.on { background: var(--c2); border-color: var(--c2); }
.cat-tab.c3.on { background: var(--c3); border-color: var(--c3); }
/* Modules repliables */
.module { margin: 2px 0; border-radius: 6px; }
.module.open { background: color-mix(in srgb, var(--panel-2) 60%, transparent); padding-bottom: 4px; }
.module-name {
  display: flex; align-items: center; gap: 6px; width: 100%; margin: 0; padding: 7px 6px;
  background: none; border: none; border-radius: 6px; text-align: left; cursor: pointer;
  font-weight: 600; font-size: .84rem; color: var(--text);
}
.module-name:hover { color: var(--accent); background: var(--panel-2); box-shadow: none; }
.module.current > .module-name { color: var(--accent); }
.chev { color: var(--muted); font-size: .7rem; transition: transform .15s; flex-shrink: 0; }
.module.open .chev { transform: rotate(90deg); color: var(--accent); }
.mod-title { flex: 1; min-width: 0; }
.mod-prog { font-size: .7rem; color: var(--muted); flex-shrink: 0; }
.mod-prog.full { color: var(--ok); }
.module-items { display: none; }
.module.open .module-items { display: block; animation: fade .15s; }
.fold-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 2px 0 6px; }
.fold-tools button { font-size: .7rem; padding: 4px 6px; color: var(--muted); }
.cat-dot { font-size: .62rem; font-weight: 800; padding: 0 5px; border-radius: 3px; border: 1px solid; flex-shrink: 0; }
.cat-dot.c1, .cat.c1 { color: var(--c1); border-color: var(--c1); }
.cat-dot.c2, .cat.c2 { color: var(--c2); border-color: var(--c2); }
.cat-dot.c3, .cat.c3 { color: var(--c3); border-color: var(--c3); }
.cat { font-size: .68rem; padding: 1px 7px; border: 1px solid; border-radius: 3px; margin-left: 6px; }
.section { font-size: 1rem; color: var(--accent); margin: 28px 0 14px; }
.cat-card.c1::before { color: var(--c1); }
.cat-card.c2::before { color: var(--c2); }
.cat-card.c3::before { color: var(--c3); }
.cat-card.c1 .progress > div { background: var(--c1); }
.cat-card.c2 .progress > div { background: var(--c2); }
.cat-card.c3 .progress > div { background: var(--c3); }
.cat-card.c2:hover { border-color: var(--c2); box-shadow: 0 0 18px rgba(255,176,0,.25); }
.cat-card.c3:hover { border-color: var(--c3); box-shadow: 0 0 18px rgba(255,77,109,.25); }
.cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ---------- Schémas SVG ---------- */
.fig { margin: 22px 0; padding: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.fig-scroll { overflow-x: auto; }
.fig svg { display: block; width: 100%; height: auto; font-family: var(--mono); }
.fig figcaption { margin-top: 10px; font-size: .75rem; color: var(--muted); text-align: center; }
.fig figcaption::before { content: "fig. "; color: var(--accent); }
.fig rect, .fig ellipse, .fig circle, .fig path, .fig polygon { stroke-width: 1.5; }
.fig .b  { fill: var(--panel-2); stroke: var(--border); }
.fig .a  { fill: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); stroke: var(--accent); }
.fig .cy { fill: color-mix(in srgb, #22d3ee 14%, var(--panel-2)); stroke: #22d3ee; }
.fig .gr { fill: color-mix(in srgb, #39ff88 14%, var(--panel-2)); stroke: #39ff88; }
.fig .am { fill: color-mix(in srgb, #ffb000 14%, var(--panel-2)); stroke: #ffb000; }
.fig .rd { fill: color-mix(in srgb, #ff4d6d 14%, var(--panel-2)); stroke: #ff4d6d; }
.fig .vi { fill: color-mix(in srgb, #a78bfa 14%, var(--panel-2)); stroke: #a78bfa; }
.fig .zone { fill: none; stroke: var(--border); stroke-dasharray: 6 5; }
.fig text { fill: var(--text); font-size: 13px; }
.fig .tb { font-weight: 700; }
.fig .tm, .fig .tl { fill: var(--muted); font-size: 11px; }
.fig .ta, .fig .tla { fill: var(--accent); }
.fig .tcy, .fig .tlcy { fill: #22d3ee; } .fig .tgr, .fig .tlgr { fill: #39ff88; }
.fig .tam, .fig .tlam { fill: #ffb000; } .fig .trd, .fig .tlrd { fill: #ff4d6d; }
.fig .tvi, .fig .tlvi { fill: #a78bfa; }
.fig .tl.ta, .fig .tl.tcy, .fig .tl.tgr, .fig .tl.tam, .fig .tl.trd { font-size: 11px; }
.fig .ln { stroke: var(--muted); stroke-width: 1.6; fill: none; }
.fig .ln.a { stroke: var(--accent); } .fig .ln.cy { stroke: #22d3ee; } .fig .ln.gr { stroke: #39ff88; }
.fig .ln.am { stroke: #ffb000; } .fig .ln.rd { stroke: #ff4d6d; } .fig .ln.vi { stroke: #a78bfa; }
.fig .ln.d { stroke-dasharray: 5 4; }
.fig .ln.x { stroke-width: 3; }
.fig .ln.thick { stroke-width: 4; }
.fig .ah.m { fill: var(--muted); } .fig .ah.a { fill: var(--accent); } .fig .ah.cy { fill: #22d3ee; }
.fig .ah.gr { fill: #39ff88; } .fig .ah.am { fill: #ffb000; } .fig .ah.rd { fill: #ff4d6d; } .fig .ah.vi { fill: #a78bfa; }

/* ---------- Exemples concrets ---------- */
.example {
  margin: 28px 0 8px; padding: 14px 18px; border-radius: 8px;
  background: color-mix(in srgb, var(--xp) 5%, var(--panel)); border: 1px solid color-mix(in srgb, var(--xp) 45%, var(--border));
  border-left: 4px solid var(--xp);
}
.example-head { color: var(--xp); font-weight: 700; font-size: .82rem; margin-bottom: 8px; }
.example p:first-of-type { margin-top: 0; }

/* ---------- Avatars ---------- */
.avatar { display: block; flex-shrink: 0; }
.av-locked { filter: grayscale(1) brightness(.45); opacity: .7; }
.player-av { margin: -4px -2px; }
.hero { display: flex; align-items: center; gap: 22px; margin-bottom: 22px; }
.hero-av {
  display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 6px 10px 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; transition: .2s;
}
.hero-av:hover { border-color: var(--xp); box-shadow: 0 0 16px rgba(255,212,71,.25); }
.hero-av span { font-size: .72rem; color: var(--xp); margin-top: 2px; }
.av-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.av-panel h3 { font-size: .9rem; margin: 18px 0 8px; color: var(--text); }
.av-main { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.av-stage { font-size: 1.1rem; font-weight: 800; color: var(--xp); }
.evo-track { display: flex; gap: 8px; flex-wrap: wrap; }
.evo { display: flex; flex-direction: column; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px; min-width: 86px; }
.evo span { font-size: .7rem; } .evo small { font-size: .65rem; color: var(--muted); }
.evo.now { border-color: var(--xp); box-shadow: 0 0 12px rgba(255,212,71,.25); }
.av-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.av-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; font-size: .72rem; }
.av-opt.on { border-color: var(--accent); box-shadow: 0 0 10px var(--glow); color: var(--accent); }
.av-colors { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 3px solid var(--panel); outline: 2px solid var(--border); }
.swatch.on { outline: 3px solid var(--text); }
.rank-name { display: flex; align-items: center; gap: 8px; }
.lu-avatar { display: flex; justify-content: center; margin: 4px 0; }
.evo-msg { color: var(--xp); font-weight: 700; margin-bottom: 4px; }
.lu-avatar { position: relative; min-height: 150px; align-items: center; }
.picker-box { max-width: 680px; width: calc(100% - 32px); max-height: 92vh; overflow-y: auto; text-align: left; padding: 22px; }
.picker-box .big, .picker-box > p { text-align: center; }
.picker-box .btn-primary { display: block; margin: 16px auto 0; padding: 10px 26px; }
.pick-preview { display: flex; align-items: flex-end; justify-content: center; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
@media (max-width: 900px) {
  .hero { gap: 14px; }
  .hero-av .avatar { width: 84px; height: 84px; }
  .player-av .avatar { width: 34px; height: 34px; }
}

/* ---------- Sélecteur de langue ---------- */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.lang-switch button { border: none; border-radius: 0; padding: 7px 9px; font-size: .75rem; background: var(--panel-2); color: var(--muted); }
.lang-switch button.on { background: var(--accent); color: var(--bg); font-weight: 700; }
.lang-switch button:hover { box-shadow: none; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
body.logged-out #langSlot { display: none; }

/* ---------- Comptes ---------- */
body.logged-out .layout,
body.logged-out .player,
body.logged-out #search,
body.logged-out #logoutBtn { display: none; }
.auth-screen:empty { display: none; }
.auth-screen { min-height: calc(100vh - 59px); min-height: calc(100dvh - 59px); display: grid; place-items: center; padding: 24px 16px; }
.auth-box {
  width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 28px; box-shadow: 0 0 40px var(--glow);
}
.auth-logo { font-size: 1.8rem; font-weight: 800; color: var(--accent); text-shadow: 0 0 12px var(--glow); }
.small { font-size: .75rem; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 20px 0 16px; }
.auth-tabs .on { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form label { font-size: .78rem; color: var(--accent); }
.auth-form input {
  font-family: var(--mono); padding: 10px 12px; background: #000; color: var(--accent);
  border: 1px solid var(--border); border-radius: 6px;
}
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--glow); }
.auth-form button { margin-top: 8px; }
.form-msg { font-size: .8rem; min-height: 1.2em; color: var(--muted); }
.form-msg.err { color: var(--bad); }
.form-msg.ok { color: var(--ok); }
.box h3 { margin: 0 0 10px; font-size: .95rem; }
.box.danger { border-color: rgba(255,77,109,.4); }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: var(--bg); }
.file-btn {
  font-size: .88rem; cursor: pointer; border: 1px solid var(--border); background: var(--panel-2);
  border-radius: 6px; padding: 7px 14px;
}
.file-btn:hover { border-color: var(--accent); color: var(--accent); }

.empty { color: var(--muted); }

/* ---------- Mobile : mise en page ---------- */
.menu-btn { display: none; font-size: 1.1rem; padding: 4px 10px; }

@media (max-width: 900px) {
  .menu-btn { display: block; }
  body.logged-out .menu-btn { display: none; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand .dim, .brand .cursor { display: none; }
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .brand { font-size: .82rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .player { order: 3; width: 100%; justify-content: flex-start; padding: 3px 10px; }
  .xpbar { flex: 1; width: auto; }
  .player-info { flex: 1; display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: center; }
  .player-title { grid-column: 1 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .player-info { min-width: 0; }
  .topbar-right { order: 2; gap: 6px; }
  .topbar-right button { padding: 6px 9px; }
  #logoutBtn .lbl { display: none; }

  .layout { grid-template-columns: 1fr; }
  .content { min-width: 0; overflow-x: hidden; }
  .lesson h1, .lesson h2 { overflow-wrap: anywhere; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40; width: 82%; max-width: 320px; height: 100%;
    transform: translateX(-100%); transition: transform .25s; border-right: 1px solid var(--accent-dim);
    padding-top: calc(12px + env(safe-area-inset-top)); overscroll-behavior: contain;
  }
  body.menu-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.8); }
  .content { padding: 18px 14px 40px; }
  .lesson h1 { font-size: 1.3rem; }
  .lesson pre { font-size: .76rem; }
  .lesson table { display: block; overflow-x: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .lesson-nav button { flex: 1; }
  .toast { left: 16px; right: 16px; bottom: 16px; text-align: center; }
}


/* ---------- Boss (RPG) ---------- */
.boss-link { align-items: center; margin: 6px 0 10px; padding: 8px 10px !important; border: 1px dashed var(--sec);
  border-left: 2px solid var(--sec) !important; border-radius: 6px; color: var(--text) !important; background: color-mix(in srgb, var(--sec) 7%, transparent); }
.boss-link .bl-ico { font-size: 1.1rem; }
.boss-link .bl-txt { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.boss-link small { font-size: .65rem; color: var(--sec); text-transform: uppercase; letter-spacing: .06em; }
.boss-link.won { border-color: var(--xp); border-left-color: var(--xp) !important; background: color-mix(in srgb, var(--xp) 7%, transparent); }
.boss-link.won small { color: var(--xp); }
.boss-link.active { box-shadow: 0 0 12px rgba(255,77,109,.35); }

.arena {
  position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px;
  padding: 18px 16px 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: radial-gradient(ellipse at 75% 30%, rgba(255,77,109,.12), transparent 60%),
              linear-gradient(180deg, var(--panel) 0%, var(--bg) 70%, color-mix(in srgb, var(--accent) 8%, var(--bg)) 100%);
}
.arena::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30%;
  background: repeating-linear-gradient(90deg, transparent 0 38px, color-mix(in srgb, var(--accent) 12%, transparent) 38px 39px); pointer-events: none; }
.fighter { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 1; }
.sprite { position: relative; display: flex; justify-content: center; }
.fname { font-size: .8rem; font-weight: 700; text-align: center; }
.foe .fname { color: var(--sec); }
.vs { align-self: center; font-size: 1.6rem; font-weight: 800; color: var(--xp); text-shadow: 0 0 12px rgba(255,212,71,.5); }
.hearts span { font-size: 1.2rem; margin: 0 1px; transition: .3s; }
.hearts .on { color: #ff4d6d; text-shadow: 0 0 8px rgba(255,77,109,.6); }
.hearts .off { color: var(--border); }
.hpbar { position: relative; width: 100%; max-width: 200px; height: 16px; background: var(--border); border-radius: 8px; overflow: hidden; border: 1px solid #000; }
.hpbar > div { height: 100%; background: linear-gradient(90deg, #39ff88, #22c55e); transition: width .5s; }
.hpbar > div.mid { background: linear-gradient(90deg, #ffb000, #f59e0b); }
.hpbar > div.low { background: linear-gradient(90deg, #ff4d6d, #e11d48); }
.hpbar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .65rem; font-weight: 800; color: #000; }
.battle-log { margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--sec); background: var(--panel); border-radius: 4px; font-size: .88rem; font-style: italic; }
.battle-log.good { border-left-color: var(--ok); color: var(--ok); font-style: normal; }
.battle-log.bad { border-left-color: var(--bad); color: var(--bad); font-style: normal; }
.battle-box h3 { margin-top: 0; }
.big-btn { display: block; width: 100%; padding: 14px; font-size: 1rem; margin-top: 10px; }
.q-count { font-size: .75rem; color: var(--muted); margin-bottom: 6px; }
.next-wrap { margin-top: 12px; display: flex; justify-content: flex-end; }
.won-note { color: var(--xp); font-weight: 700; }
.result { text-align: center; }
.result .big { font-size: 2.2rem; font-weight: 800; }
.result.win .big { color: var(--xp); text-shadow: 0 0 16px rgba(255,212,71,.6); }
.result.lose .big { color: var(--bad); text-shadow: 0 0 16px rgba(255,77,109,.5); }
.result .actions { justify-content: center; }
.dmg { position: absolute; top: 20%; left: 50%; transform: translateX(-50%); font-weight: 800; font-size: 1.4rem; pointer-events: none;
  animation: dmg 1.1s ease-out forwards; text-shadow: 0 2px 0 #000; z-index: 3; }
.dmg.hit { color: #ffd447; } .dmg.miss { color: #ff4d6d; }
@keyframes dmg { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -6px) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -50px) scale(1); } }
.sprite.attack { animation: atk .45s ease-out; } .sprite.lunge { animation: lunge .45s ease-out; }
.sprite.hurt { animation: hurt .5s ease-out; }
@keyframes atk { 40% { transform: translateX(40px) scale(1.08); } }
@keyframes lunge { 40% { transform: translateX(-40px) scale(1.08); } }
@keyframes hurt { 0%, 100% { transform: none; filter: none; } 20% { transform: translateX(-8px); filter: brightness(2) saturate(0) sepia(1) hue-rotate(-50deg); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
.sprite.dead { animation: die 1s ease-in forwards; }
@keyframes die { to { transform: translateY(20px) rotate(-12deg) scale(.85); filter: grayscale(1) brightness(.5); opacity: .55; } }
.sprite.ko { filter: grayscale(1) brightness(.5); transform: rotate(-80deg) translateX(-20px); transition: .6s; }
.trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.trophy { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; text-align: center; text-decoration: none;
  color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.trophy b { font-size: .8rem; } .trophy small { font-size: .68rem; color: var(--muted); } .trophy small.ok { color: var(--xp); }
.trophy.won { border-color: var(--xp); box-shadow: 0 0 12px rgba(255,212,71,.2); }
@media (max-width: 900px) {
  .arena { padding: 14px 8px 10px; gap: 4px; }
  .arena .avatar { width: 88px; height: 88px; }
  .arena .boss-svg { width: 110px; height: 110px; }
  .vs { font-size: 1.1rem; }
  .hpbar { height: 14px; }
  .hearts span { font-size: 1rem; }
  @keyframes atk { 40% { transform: translateX(20px) scale(1.08); } }
  @keyframes lunge { 40% { transform: translateX(-20px) scale(1.08); } }
  .trophies { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Sauvegarde ---------- */
.backup-box { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); scroll-margin-top: 80px; }
.backup-box .small { color: var(--xp); margin: 6px 0 10px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 12px; font-size: .85rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.import-panel { margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--xp); border-radius: 8px; background: var(--bg); }
.import-panel p { margin: 0 0 10px; }
.restore-link { display: block; text-align: center; margin: 14px 0 4px; font-size: .8rem; color: var(--muted); }

/* =========================================================
   MOBILE — ERGONOMIE TACTILE (placé en dernier pour primer)
   ========================================================= */
.drawer-head, .backdrop { display: none; }

@media (max-width: 900px) {
  /* Barre du haut : encoches iPhone, nom du site lisible */
  .topbar { padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .brand { font-size: .9rem; }
  .topbar-right { gap: 6px; }
  .topbar-right button, .lang-switch button { min-width: 40px; min-height: 40px; padding: 6px 10px; }
  .menu-btn { min-width: 44px; min-height: 40px; }

  /* Tiroir du menu : recherche + bouton fermer, fond assombri, page bloquée */
  .drawer-head { display: flex; gap: 8px; align-items: center; position: sticky; top: -12px; z-index: 2;
    margin: -4px 0 10px; padding: 4px 0 10px; background: var(--panel); border-bottom: 1px solid var(--border); }
  .drawer-head #searchSlot { flex: 1; display: flex; }
  .drawer-head #search { flex: 1; width: 100%; min-height: 42px; }
  #drawerClose { min-width: 42px; min-height: 42px; font-size: 1rem; }
  .backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .6); }
  body.menu-open .backdrop { display: block; animation: fade .2s; }
  body.menu-open { overflow: hidden; }

  /* Cibles tactiles d'au moins ~40 px */
  button, .file-btn { min-height: 40px; }
  .file-btn { display: inline-flex; align-items: center; }
  .lesson-link { padding: 10px 10px 10px 18px; font-size: .88rem; }
  .module-name { padding: 11px 6px; font-size: .88rem; }
  .cat-tab, .fold-tools button { min-height: 40px; }
  .opt { padding: 12px 14px; line-height: 1.4; }
  .actions button { flex: 1 1 auto; }

  /* Champs à 16 px : évite le zoom automatique d'iOS au toucher */
  input, textarea, select { font-size: 16px !important; }
  .auth-form input { min-height: 46px; }

  /* Accueil */
  .hero { gap: 14px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: .86rem; margin-bottom: 0; }
  .boot { font-size: .76rem; }
  .stats { gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat b { font-size: 1.15rem; }
  .cards { grid-template-columns: 1fr; }

  /* Leçons */
  .lesson h2 { font-size: 1rem; margin-top: 24px; }
  .breadcrumb { overflow-wrap: anywhere; }
  .fig { padding: 10px; margin: 18px -4px; }
  .fig figcaption::after { content: "  ⟷"; color: var(--accent); }
  .example { padding: 12px 14px; }
  .box { padding: 14px; }

  /* Connexion */
  .auth-box { padding: 20px 16px; }
  .auth-logo { font-size: 1.4rem; }

  /* Fenêtres (niveau, choix d'avatar) */
  .levelup-box { width: calc(100% - 28px); padding: 22px 16px; }
  .levelup-box .big { font-size: 2rem; }
  .picker-box { padding: 18px 14px; }
  .av-types { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .av-opt .avatar { width: 78px; height: 78px; }
  .evo { min-width: 0; flex: 1 1 56px; }
  .evo .avatar { width: 52px; height: 52px; }
  .av-main .avatar { width: 130px; height: 130px; }

  /* Profil */
  .ladder li { grid-template-columns: 74px 1fr auto; gap: 8px; font-size: .74rem; padding: 8px 10px; }
  .lesson table { font-size: .8rem; }
}

/* Très petits écrans (iPhone SE, 320-400 px) */
@media (max-width: 400px) {
  .brand { font-size: .8rem; }
  .topbar-right { gap: 4px; }
  .topbar .lang-switch button.on { display: none; }   /* un seul bouton : la langue vers laquelle basculer */
  .topbar-right button, .topbar .lang-switch button { min-width: 38px; padding: 6px 8px; }
  .menu-btn { min-width: 40px; padding: 4px 8px; }
  .hero h1 { font-size: 1.25rem; }
  .hero-av .avatar { width: 70px; height: 70px; }
  .auth-logo { font-size: 1.05rem; white-space: nowrap; }
  .auth-top { gap: 8px; }
  .content { padding-left: 12px; padding-right: 12px; }
  .stat span { font-size: .65rem; }
}

/* Téléphone en paysage : la barre du haut ne reste pas collée pour garder de la hauteur */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { position: static; }
  .sidebar { padding-top: 10px; }
}

/* Écrans tactiles : pas d'effet de survol « collant » après un toucher */
@media (hover: none) {
  button:hover:not(.btn-primary):not(.on):not(.correct):not(.wrong) { border-color: var(--border); color: var(--text); box-shadow: none; }
  .btn-primary:hover { color: var(--bg); box-shadow: none; }
  .card:hover, .hero-av:hover { transform: none; box-shadow: none; border-color: var(--border); }
  .lesson-link:hover:not(.active) { color: var(--muted); border-left-color: transparent; }
  .module-name:hover { background: none; color: var(--text); }
  button:active { transform: scale(.98); }
}
@media (hover: none) { .track-title:hover { background: none; } }

/* =========================================================
   AVATARS ANIMÉS (stades) + CINÉMATIQUE D'ÉVOLUTION
   ========================================================= */
.avatar { overflow: visible; }
.avatar .av-anim { transform-box: fill-box; transform-origin: center; }
.av-bob { animation: avBob 2.6s ease-in-out infinite; }
.st5 .av-bob { animation-duration: 2.2s; }
.av-spin { transform-box: view-box !important; transform-origin: 60px 62px !important; animation: avSpin 26s linear infinite; }
.av-pulse { animation: avPulse 2.4s ease-in-out infinite; }
.av-dash { animation: avDash 6s linear infinite; }
.av-flap { transform-origin: 100% 75% !important; animation: avFlap 2.2s ease-in-out infinite; }
.av-cape { transform-origin: 50% 0 !important; animation: avCape 3s ease-in-out infinite; }
.av-float { animation: avFloat 3s ease-in-out infinite; opacity: 0; }
.av-twinkle { animation: avTwinkle 2.6s ease-in-out infinite; opacity: 0; }
.av-glow { animation: avGlow 1.8s ease-in-out infinite; }
.av-blink { animation: avBlink 1s steps(1) infinite; }
.av-flame { transform-origin: 50% 100% !important; animation: avFlame .9s ease-in-out infinite alternate; }
.av-flame.f2 { animation-duration: .7s; animation-delay: -.3s; } .av-flame.f3 { animation-duration: .55s; animation-delay: -.2s; }
.av-zap { animation: avZap 1.8s steps(1) infinite; opacity: 0; }
@keyframes avFlame { from { transform: scale(1, .96); } to { transform: scale(1.03, 1.05); } }
@keyframes avZap { 0% { opacity: 1; } 12% { opacity: 0; } 18% { opacity: 1; } 26%,100% { opacity: 0; } }
@keyframes avBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes avSpin { to { transform: rotate(360deg); } }
@keyframes avPulse { 0%,100% { opacity: .65; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes avDash { to { stroke-dashoffset: -64; } }
@keyframes avFlap { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes avCape { 0%,100% { transform: skewX(0); } 50% { transform: skewX(3deg); } }
@keyframes avFloat { 0% { opacity: 0; transform: translateY(6px); } 30%,70% { opacity: .9; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes avTwinkle { 0%,100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
@keyframes avGlow { 0%,100% { opacity: .85; } 50% { opacity: 1; filter: drop-shadow(0 0 3px #fff6); } }
@keyframes avBlink { 50% { opacity: 0; } }
.av-locked .av-anim { animation: none !important; }
.av-locked .av-float, .av-locked .av-twinkle { opacity: .5; }


/* Portraits réalistes : clignement des yeux, respiration, LEDs */
.av-lid { transform-origin: 50% 0 !important; animation: avLid 5s infinite; transform: scaleY(0); }
.av-breathe { transform-origin: 50% 100% !important; animation: avBreathe 4s ease-in-out infinite; }
.av-led { animation: avLed 1.3s steps(1) infinite; }
.av-glint { animation: avTwinkle 3s ease-in-out infinite; opacity: 0; }
@keyframes avLid { 0%, 93%, 100% { transform: scaleY(0); } 95.5% { transform: scaleY(1); } }
@keyframes avBreathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.012, 1.018); } }
@keyframes avLed { 50% { opacity: .2; } }
/* Halo selon le stade (profil, accueil) */
.av-main .avatar.st4, .hero-av .avatar.st4 { filter: drop-shadow(0 0 10px rgba(167,139,250,.45)); }
.av-main .avatar.st5, .hero-av .avatar.st5 { filter: drop-shadow(0 0 14px rgba(255,212,71,.55)); }
.evo.now .avatar { filter: drop-shadow(0 0 8px var(--glow)); }

/* Cinématique : ancien stade → éclair blanc → nouveau stade */
.evo-stage { position: relative; width: 170px; height: 170px; margin: 0 auto; display: grid; place-items: center; }
.evo-stage > * { grid-area: 1 / 1; }
.evo-old { animation: evoOld 1.6s ease-in forwards; }
.evo-new { animation: evoNew 2.6s cubic-bezier(.2,.9,.3,1.2) forwards; }
.evo-burst { width: 170px; height: 170px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #fff 0 12%, var(--tier, #ffd447) 30%, transparent 68%); animation: evoBurst 2.6s ease-out forwards; }
.evo-ring { width: 60px; height: 60px; border-radius: 50%; border: 3px solid var(--tier, #ffd447); opacity: 0; pointer-events: none; animation: evoRing 2.6s ease-out forwards; }
.evo-ring.r2 { animation-delay: .18s; }
.evo-rays { width: 230px; height: 230px; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, var(--tier, #ffd447) 0 6deg, transparent 6deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%);
  animation: evoRays 3.2s ease-out forwards; }
.evo-title { margin: 10px 0 4px; position: relative; z-index: 1; font-size: 1.5rem; font-weight: 800; letter-spacing: .12em; color: var(--tier, var(--xp)); text-shadow: 0 0 14px var(--tier, var(--xp)); opacity: 0; animation: evoTitle .6s 1.5s ease-out forwards; }
.evolving .evo-msg, .evolving .big, .evolving .t, .evolving #luClose { opacity: 0; animation: fadeIn .4s 1.9s forwards; }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes evoOld { 0% { filter: none; transform: scale(1); } 15%,35%,55% { transform: translateX(-3px) scale(1.02); } 25%,45%,65% { transform: translateX(3px) scale(1.02); }
  80% { filter: brightness(0) invert(1) drop-shadow(0 0 10px #fff); transform: scale(1.1); opacity: 1; } 100% { filter: brightness(0) invert(1); transform: scale(1.35); opacity: 0; } }
@keyframes evoNew { 0%,58% { opacity: 0; transform: scale(.3); filter: brightness(0) invert(1); } 72% { opacity: 1; transform: scale(1.18); filter: brightness(0) invert(1) drop-shadow(0 0 14px #fff); }
  100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 12px var(--tier, #ffd447)); } }
@keyframes evoBurst { 0%,55% { opacity: 0; transform: scale(.2); } 64% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes evoRing { 0%,58% { opacity: 0; transform: scale(.5); } 62% { opacity: 1; } 100% { opacity: 0; transform: scale(3.6); } }
@keyframes evoRays { 0%,58% { opacity: 0; transform: rotate(0) scale(.6); } 70% { opacity: .55; } 100% { opacity: .25; transform: rotate(80deg) scale(1); } }
@keyframes evoTitle { from { opacity: 0; transform: scale(2.2); } to { opacity: 1; transform: scale(1); } }
@media (max-width: 600px) { .evo-stage { width: 140px; height: 140px; } .evo-stage .avatar { width: 130px; height: 130px; } .evo-rays { width: 190px; height: 190px; } }
@media (prefers-reduced-motion: reduce) {
  .avatar .av-anim, .evo-stage * , .evo-title, .evolving * { animation: none !important; }
  .evo-old, .evo-burst, .evo-ring, .evo-rays { display: none; } .evo-title, .av-float, .av-twinkle, .evolving * { opacity: 1 !important; }
}

/* Bouton retour */
.back-btn { font-size: 1.1rem; font-weight: 800; padding: 4px 11px; margin-right: 8px; line-height: 1; }
.back-btn.hide { visibility: hidden; width: 0; padding: 0; margin: 0; border: 0; }
body.logged-out .back-btn { display: none; }
@media (max-width: 900px) { .back-btn { min-width: 40px; min-height: 40px; margin-right: 4px; } }
@media (max-width: 400px) { .back-btn { min-width: 32px; padding: 2px 4px; margin-right: 2px; font-size: 1rem; } .topbar { gap: 4px; } .brand .dim, .brand .cursor { display: none; } .topbar-right button, .topbar .lang-switch button, .menu-btn { min-width: 34px; padding: 6px 5px; } }

/* Explications détaillées des leçons */
.d-head { font-weight: 800; font-size: .85rem; letter-spacing: .03em; margin-bottom: 6px; }
.d-clair { border: 1px solid var(--accent); border-left-width: 4px; background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 8px; padding: 12px 16px; margin: 0 0 18px; }
.d-clair .d-head { color: var(--accent); }
.d-clair p { margin: 0; line-height: 1.65; }
.d-box { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; margin: 14px 0; padding: 0 16px; }
.d-box > summary { cursor: pointer; font-weight: 700; padding: 12px 0; list-style: none; color: var(--text); }
.d-box > summary::-webkit-details-marker { display: none; }
.d-box > summary::after { content: "▸"; float: right; color: var(--muted); }
.d-box[open] > summary::after { content: "▾"; }
.d-box[open] > summary { border-bottom: 1px dashed var(--border); margin-bottom: 10px; }
.d-steps ol { padding-left: 22px; margin: 0 0 12px; }
.d-steps li { margin-bottom: 12px; }
.d-steps li b { color: var(--accent); }
.d-steps li p { margin: 4px 0 0; line-height: 1.6; }
.d-vocab dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 14px; margin: 0 0 14px; }
.d-vocab dt { font-weight: 700; color: var(--xp); }
.d-vocab dd { margin: 0; }
.d-traps ul { margin: 0 0 12px; padding-left: 20px; }
.d-traps li { margin-bottom: 6px; }
.d-traps li::marker { color: #ff4d6d; }
.d-keep { border: 1px solid var(--xp); border-left-width: 4px; background: rgba(255,212,71,.06); border-radius: 8px; padding: 12px 16px; margin: 18px 0 6px; }
.d-keep .d-head { color: var(--xp); }
.d-keep ul { margin: 0; padding-left: 20px; } .d-keep li { margin-bottom: 4px; }
@media (max-width: 600px) {
  .d-vocab dl { grid-template-columns: 1fr; gap: 2px; } .d-vocab dd { margin-bottom: 8px; }
  .d-box { padding: 0 12px; } .d-clair, .d-keep { padding: 10px 12px; }
}

/* =========================================================
   SUCCÈS ET BADGES
   ========================================================= */
.stat-link { text-decoration: none; color: inherit; cursor: pointer; }
.stat-link:hover { border-color: var(--xp); }
.achv-summary { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 8px; }
.achv-summary b { color: var(--xp); }
.achv-summary .progress { margin: 10px 0; }
.tier-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tier-chip { font-size: .72rem; padding: 3px 9px; border-radius: 999px; border: 1px solid; font-weight: 700; }
.tier-chip.tier-bronze { color: #f0b27a; border-color: #a0522d; }
.tier-chip.tier-argent { color: #e2e8f0; border-color: #8b97a8; }
.tier-chip.tier-or { color: #ffd447; border-color: #d4a017; }
.tier-chip.tier-platine { color: #a5f3fc; border-color: #5eb8d6; }
.achv-group { font-size: .85rem; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.achv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.achv { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 10px 8px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; color: var(--muted); }
.achv b { color: var(--text); font-size: .82rem; margin-top: 4px; }
.achv small { font-size: .68rem; line-height: 1.35; }
.achv small.ok { color: var(--ok); }
.achv.on { border-color: var(--accent-dim); }
.achv:not(.on) b { color: var(--muted); }
.achv-bar { width: 80%; height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.achv-bar div { height: 100%; background: var(--accent); }
.badge-svg { display: block; overflow: visible; }
.badge-locked { filter: grayscale(1) brightness(.55); opacity: .8; }
.badge-svg.tier-or { filter: drop-shadow(0 0 6px rgba(255,212,71,.45)); }
.badge-svg.tier-platine { filter: drop-shadow(0 0 8px rgba(94,184,214,.7)); animation: badgeGlow 2.4s ease-in-out infinite; }
.badge-shine { animation: badgeShine 3.2s ease-in-out infinite; }
@keyframes badgeGlow { 50% { filter: drop-shadow(0 0 14px rgba(167,139,250,.9)); } }
@keyframes badgeShine { 0%, 70%, 100% { opacity: .15; } 80% { opacity: .8; } }

/* Notification de succès */
#achvStack { position: fixed; left: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: calc(100% - 32px); }
.achv-pop { display: flex; align-items: center; gap: 12px; width: 330px; max-width: 100%; padding: 10px 14px; text-decoration: none; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--xp); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.6), 0 0 18px rgba(255,212,71,.25);
  animation: achvIn .55s cubic-bezier(.2,.9,.3,1.3); }
.achv-pop.tier-platine { border-color: #5eb8d6; box-shadow: 0 8px 30px rgba(0,0,0,.6), 0 0 22px rgba(94,184,214,.5); }
.achv-pop div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.achv-pop small { color: var(--xp); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.achv-pop b { font-size: .95rem; }
.achv-pop span { font-size: .75rem; color: var(--muted); }
.achv-pop .badge-svg { flex-shrink: 0; animation: achvSpin .9s ease-out; }
.achv-pop.out { animation: achvOut .5s forwards; }
.achv-more { flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #0b0f14; background: linear-gradient(135deg, #fff3b0, #d4a017); }
@keyframes achvIn { from { opacity: 0; transform: translateX(-40px) scale(.9); } }
@keyframes achvOut { to { opacity: 0; transform: translateX(-40px); } }
@keyframes achvSpin { from { transform: rotateY(360deg) scale(.4); } }
@media (max-width: 600px) {
  .achv-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  #achvStack { left: 10px; right: 10px; bottom: 10px; }
  .achv-pop { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .achv-pop, .achv-pop .badge-svg, .badge-shine, .badge-svg.tier-platine { animation: none !important; } }

/* =========================================================
   SCHÉMAS ANIMÉS
   ========================================================= */
.fig.anim svg > :not(defs) { opacity: 0; transform: translateY(8px); transform-box: fill-box; transform-origin: center;
  transition: opacity .5s ease, transform .5s ease; transition-delay: calc(var(--i, 0) * 45ms); }
.fig.anim.play svg > :not(defs) { opacity: 1; transform: none; }
.fig.anim line.ln[pathLength] { stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .8s ease, opacity .4s; transition-delay: calc(var(--i, 0) * 45ms + 150ms); }
.fig.anim.play line.ln[pathLength] { stroke-dashoffset: 0; }
.fig.anim.play .ln.d { animation: figMarch 1.2s linear infinite; }
@keyframes figMarch { to { stroke-dashoffset: -20; } }
.fig .pkt { stroke: none !important; filter: drop-shadow(0 0 4px currentColor); }
.fig.anim svg > .pkt { transition-delay: 1.1s; }
.pk-m { fill: #94a3b8; color: #94a3b8; } .pk-a { fill: var(--accent); color: var(--accent); } .pk-cy { fill: #22d3ee; color: #22d3ee; }
.pk-gr { fill: #39ff88; color: #39ff88; } .pk-am { fill: #ffb000; color: #ffb000; } .pk-rd { fill: #ff4d6d; color: #ff4d6d; } .pk-vi { fill: #a78bfa; color: #a78bfa; }
.fig figcaption { position: relative; }
.fig-replay { position: absolute; right: 0; top: 50%; transform: translateY(-50%); padding: 2px 9px; font-size: .9rem; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .fig .pkt { display: none; } }

/* =========================================================
   HORLOGE (à côté du profil)
   ========================================================= */
.clock { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding-left: 12px; margin-left: 2px;
  border-left: 1px solid var(--border); font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; }
.clock b { color: var(--accent); font-size: 1.05rem; text-shadow: 0 0 8px var(--glow); letter-spacing: .02em; }
.clock .sec { font-size: .7em; color: var(--muted); text-shadow: none; }
.clock small { color: var(--muted); font-size: .66rem; text-transform: capitalize; }
@media (max-width: 900px) { .clock { padding-left: 10px; } .clock b { font-size: .95rem; } }
@media (max-width: 400px) { .clock small { display: none; } .clock .sec { display: none; } .clock { padding-left: 8px; } }

/* =========================================================
   COMBAT DE BOSS : EFFETS
   ========================================================= */
.arena-sky { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.arena-sky i { position: absolute; bottom: -10px; left: var(--x); width: 3px; height: 3px; border-radius: 50%; background: var(--accent);
  opacity: .5; box-shadow: 0 0 6px var(--accent); animation: skyRise var(--s) linear var(--d) infinite; }
@keyframes skyRise { from { transform: translateY(0); opacity: 0; } 15% { opacity: .6; } to { transform: translateY(-260px); opacity: 0; } }
:where(.fighter.hero) .sprite { animation: idleHero 2.6s ease-in-out infinite; }
:where(.fighter.foe) .sprite { animation: idleBoss 3s ease-in-out infinite; }
@keyframes idleHero { 50% { transform: translateY(-4px); } }
@keyframes idleBoss { 50% { transform: translateY(-7px) scale(1.02); } }
.sprite.enter { animation: bossEnter .6s cubic-bezier(.2,.9,.3,1.4) !important; }
@keyframes bossEnter { from { transform: translateY(-60px) scale(.6); opacity: 0; } 70% { transform: translateY(6px) scale(1.06); } }
.sprite.enraged .boss-svg { animation: enrage .7s ease-in-out infinite; }
@keyframes enrage { 50% { filter: drop-shadow(0 0 14px #ff4d6d) saturate(1.6) brightness(1.15); } }
.proj { position: absolute; left: 0; top: 0; margin: -16px 0 0 -16px; width: 32px; height: 32px; border-radius: 50%; z-index: 5; pointer-events: none;
  display: grid; place-items: center; font-weight: 800; font-size: .7rem; }
.proj.good { background: radial-gradient(circle, #fffbe6 0 25%, #ffd447 45%, rgba(255,212,71,0) 70%); color: #3b2f00; box-shadow: 0 0 22px #ffd447; }
.proj.crit { width: 44px; height: 44px; margin: -22px 0 0 -22px; font-size: 1.2rem; background: radial-gradient(circle, #fff 0 25%, #a5f3fc 45%, rgba(34,211,238,0) 72%); box-shadow: 0 0 30px #22d3ee; }
.proj.bad { background: radial-gradient(circle, #ffe4e6 0 22%, #ff4d6d 45%, rgba(255,77,109,0) 70%); color: #4c0519; box-shadow: 0 0 22px #ff4d6d; }
.spark { position: absolute; left: 0; top: 0; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; z-index: 4; pointer-events: none; box-shadow: 0 0 8px currentColor; }
.dmg.crit { color: #a5f3fc; font-size: 1.7rem; text-shadow: 0 0 12px #22d3ee; white-space: nowrap; }
.dmg.combo { top: 2%; color: var(--accent); font-size: 1rem; white-space: nowrap; }
.arena.shake { animation: arenaShake .3s; } .arena.shake-big { animation: arenaShake .5s 2; }
@keyframes arenaShake { 25% { transform: translate(-4px, 2px); } 50% { transform: translate(4px, -2px); } 75% { transform: translate(-2px, -1px); } }
.arena.flash-red { animation: flashRed .5s; }
@keyframes flashRed { 30% { box-shadow: inset 0 0 70px rgba(255,77,109,.7); border-color: #ff4d6d; } }
.arena.defeat { filter: saturate(.4) brightness(.75); transition: filter 1s; }
.hearts span.break { animation: heartBreak .6s ease-out; }
@keyframes heartBreak { 0% { transform: scale(1.6); color: #ff4d6d; } 40% { transform: scale(.7) rotate(-20deg); } 100% { transform: none; } }
.arena-banner { position: absolute; left: 50%; top: 42%; z-index: 6; pointer-events: none; font-weight: 900; font-size: 2rem; letter-spacing: .1em; white-space: nowrap;
  color: #fff; text-shadow: 0 0 18px var(--accent), 0 0 4px #000; animation: bannerIn 1.6s ease-out forwards; }
.arena-banner.win { color: #ffd447; text-shadow: 0 0 20px #ffd447, 0 0 4px #000; }
.arena-banner.lose { color: #ff4d6d; text-shadow: 0 0 20px #ff4d6d, 0 0 4px #000; }
@keyframes bannerIn { 0% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  75% { opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }
.confetti { position: absolute; top: -12px; width: 7px; height: 12px; z-index: 5; pointer-events: none; animation: confettiFall 2s linear forwards; }
@keyframes confettiFall { to { transform: translateY(330px) rotate(720deg); opacity: .2; } }
@media (max-width: 600px) { .arena-banner { font-size: 1.4rem; } }
@media (prefers-reduced-motion: reduce) { .arena-sky, .confetti { display: none; } :where(.fighter) .sprite { animation: none; } }

/* =========================================================
   PLAN DE CARRIÈRE (tronc commun + 2 spécialités)
   ========================================================= */
.fork { text-align: center; margin: 14px 0 10px; color: var(--xp); font-weight: 800; font-size: .85rem; letter-spacing: .05em; }
.fork-act { margin-top: 8px; font-weight: 400; letter-spacing: 0; }
.fork-act small { color: var(--muted); }
.branches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.branch { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: color-mix(in srgb, var(--panel) 70%, transparent); min-width: 0; }
.branch h3 { margin: 0 0 8px; font-size: .85rem; text-align: center; }
.branch h3 small { font-size: .68rem; font-weight: 400; display: block; margin-top: 2px; }
.branch.infra h3 { color: #22d3ee; } .branch.cyber h3 { color: #ff4d6d; }
.branch.infra.mine { border-color: #22d3ee; box-shadow: 0 0 14px rgba(34,211,238,.18); }
.branch.cyber.mine { border-color: #ff4d6d; box-shadow: 0 0 14px rgba(255,77,109,.18); }
.branch.other { opacity: .55; }
.branch .ladder li { grid-template-columns: 74px 1fr; font-size: .76rem; padding: 7px 9px; }
.branch .ladder .x { display: none; }
.ladder li.dim-row { color: var(--muted); }
.spec-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.spec-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 14px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; transition: transform .15s, border-color .15s; }
.spec-card:hover { transform: translateY(-3px); }
.spec-card .ico { font-size: 1.8rem; }
.spec-card b { font-size: 1rem; }
.spec-card.infra b { color: #22d3ee; } .spec-card.cyber b { color: #ff4d6d; }
.spec-card.infra:hover, .spec-card.infra.advised { border-color: #22d3ee; box-shadow: 0 0 16px rgba(34,211,238,.25); }
.spec-card.cyber:hover, .spec-card.cyber.advised { border-color: #ff4d6d; box-shadow: 0 0 16px rgba(255,77,109,.25); }
.spec-card ul { margin: 0; padding-left: 16px; font-size: .74rem; color: var(--muted); }
.spec-card li { margin-bottom: 3px; }
.spec-card .reco { font-size: .7rem; color: var(--xp); font-weight: 700; }
.spec-card .reco.cur { color: var(--ok); }
.spec-box #specCancel { display: block; margin: 8px auto 0; }
@media (max-width: 600px) {
  .branches, .spec-cards { grid-template-columns: 1fr; }
  .branch .ladder li { grid-template-columns: 70px 1fr; }
}

/* Barre du haut : titres longs sur une ligne */
.player-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 290px; }
.player-info { min-width: 0; }
.lvl-badge, #logoutBtn, .topbar-right button { white-space: nowrap; }
@media (max-width: 900px) { .player-title { max-width: none; } }

/* =========================================================
   ARGENT, SALAIRES ET BOUTIQUE
   ========================================================= */
.wallet { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding-left: 12px; margin-left: 2px;
  border-left: 1px solid var(--border); cursor: pointer; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; border-radius: 4px; }
.wallet b { color: #86efac; font-size: .9rem; }
.wallet small { color: var(--muted); font-size: .64rem; }
.wallet .short { display: none; }
.wallet:hover b { color: #bbf7d0; text-shadow: 0 0 8px rgba(134,239,172,.6); }
.wallet.paid b { animation: walletPaid 1.2s ease-out; }
@keyframes walletPaid { 0% { transform: scale(1.5); color: #ffd447; text-shadow: 0 0 14px #ffd447; } 100% { transform: none; } }
@media (max-width: 1100px) { .wallet .full { display: none; } .wallet .short { display: inline; } }
@media (max-width: 400px) { .wallet small { display: none; } .wallet { padding-left: 8px; } }
.lu-sal { margin: -8px 0 16px; color: #86efac; font-size: .85rem; }
.lu-sal small { display: block; color: var(--muted); font-size: .7rem; margin-top: 3px; }
.ladder small.sal { display: block; color: #86efac; font-size: .68rem; opacity: .85; margin-top: 2px; font-weight: 400; }
.ladder li.dim-row small.sal { color: var(--muted); }
.shop-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; }
.shop-info { flex: 1; min-width: 220px; }
.shop-info p { margin: 6px 0; }
.shop-bal { font-size: 1.6rem; font-weight: 800; color: #86efac; text-shadow: 0 0 12px rgba(134,239,172,.4); }
.pay-bar { position: relative; height: 14px; background: var(--border); border-radius: 8px; overflow: hidden; margin: 8px 0; }
.pay-bar > div { height: 100%; background: linear-gradient(90deg, #15803d, #86efac); transition: width 1s linear; }
.pay-bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .66rem; font-weight: 700; color: #052e16; mix-blend-mode: screen; color: #fff; }
.shop-tabs { margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.shop-tabs button.on { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 12px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.shop-item.on { border-color: var(--accent); box-shadow: 0 0 12px var(--glow); }
.shop-item b { font-size: .82rem; }
.shop-item small { color: var(--muted); font-size: .72rem; }
.shop-item.owned small { color: var(--ok); }
.shop-item button { width: 100%; font-size: .74rem; }
.shop-prev { height: 100px; display: grid; place-items: center; }
.bg-swatch { width: 130px; height: 90px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); position: relative; overflow: hidden; }
@media (max-width: 600px) { .shop-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } .bg-swatch { width: 110px; height: 80px; } .shop-prev .avatar { width: 84px; height: 84px; } }

/* Animations des objets d'avatar */
.av-rain { animation: avRain 2.4s linear infinite; }
@keyframes avRain { from { transform: translateY(-20px); opacity: 0; } 20% { opacity: .8; } to { transform: translateY(90px); opacity: 0; } }
.av-rgb { animation: avRgb 3s linear infinite; }
@keyframes avRgb { 0% { stroke: #22d3ee; } 33% { stroke: #f472b6; } 66% { stroke: #a3e635; } 100% { stroke: #22d3ee; } }
.av-halo { animation: avHalo 2.4s ease-in-out infinite; filter: drop-shadow(0 0 3px #fde68a); }
@keyframes avHalo { 50% { transform: translateY(-1.5px); opacity: .75; } }
.av-steam { animation: avSteam 2s ease-in-out infinite; }
@keyframes avSteam { 0% { transform: translateY(2px); opacity: 0; } 50% { opacity: .8; } 100% { transform: translateY(-3px); opacity: 0; } }

/* Fonds du site (achetés en boutique) : même dessin pour la page et l'aperçu */
body[data-sitebg]::before, .bg-swatch::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bg-swatch::before { position: absolute; z-index: 0; }
.bg-swatch[data-sitebg=""]::before { background: radial-gradient(ellipse at top, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); }
[data-sitebg="circuit"]::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='none' stroke='%2339ff88' stroke-opacity='.18' stroke-width='1.4'%3E%3Cpath d='M0 30h40l10 10h30M60 0v20l10 10v40M120 80H90l-10 10v30M20 120V90l10-10h20'/%3E%3C/g%3E%3Cg fill='%2339ff88' fill-opacity='.3'%3E%3Ccircle cx='80' cy='40' r='3'/%3E%3Ccircle cx='70' cy='70' r='3'/%3E%3Ccircle cx='50' cy='80' r='3'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(ellipse at 30% 20%, rgba(57,255,136,.08), transparent 60%); }
[data-sitebg="matrix"]::before {
  background:
    repeating-linear-gradient(180deg, rgba(57,255,136,.16) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(0,0,0,.85) 22px 34px);
  background-size: 100% 280px, 100% 100%; animation: bgMatrix 6s linear infinite; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); }
@keyframes bgMatrix { to { background-position: 0 280px, 0 0; } }
[data-sitebg="stars"]::before {
  background-image: radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 90px 70px, #cbd5e1, transparent),
    radial-gradient(1.5px 1.5px at 150px 120px, #e0f2fe, transparent), radial-gradient(1px 1px at 210px 40px, #fff, transparent),
    radial-gradient(1px 1px at 60px 160px, #a5b4fc, transparent), radial-gradient(ellipse at 70% 20%, rgba(99,102,241,.18), transparent 60%);
  background-size: 240px 200px, 240px 200px, 240px 200px, 240px 200px, 240px 200px, 100% 100%; animation: bgStars 60s linear infinite; }
@keyframes bgStars { to { background-position: -240px 200px, -240px 200px, -240px 200px, -240px 200px, -240px 200px, 0 0; } }
[data-sitebg="city"]::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='200' preserveAspectRatio='none'%3E%3Cpath d='M0 200V120h40V80h30v60h40V60h50v90h30V100h40v50h50V70h60v80h40V110h50v40h40V90h60v110z' fill='%230b0420'/%3E%3C/svg%3E") bottom/100% 32% no-repeat,
    linear-gradient(180deg, #06090d 30%, #2a0d3e 75%, #5b1650 100%); opacity: .8; }
[data-sitebg="aurora"]::before {
  background: linear-gradient(120deg, rgba(34,211,238,.18), rgba(57,255,136,.15) 30%, rgba(167,139,250,.18) 60%, rgba(244,114,182,.12));
  background-size: 300% 300%; animation: bgAurora 18s ease-in-out infinite alternate; }
@keyframes bgAurora { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
[data-sitebg="dc"]::before {
  background:
    repeating-linear-gradient(90deg, rgba(17,24,39,.9) 0 70px, rgba(55,65,81,.6) 70px 72px, transparent 72px 90px),
    repeating-linear-gradient(180deg, transparent 0 16px, rgba(34,211,238,.18) 16px 18px),
    linear-gradient(180deg, #050a10, #0b1424);
  animation: bgDc 3s steps(2) infinite; }
@keyframes bgDc { 50% { filter: brightness(1.15); } }
[data-sitebg="synth"]::before {
  background:
    linear-gradient(180deg, transparent 55%, rgba(244,114,182,.35) 55.3%, transparent 56%),
    radial-gradient(circle at 50% 55%, #f97316 0 9%, #db2777 13%, transparent 14%),
    repeating-linear-gradient(90deg, rgba(244,114,182,.35) 0 1px, transparent 1px 60px),
    repeating-linear-gradient(180deg, rgba(244,114,182,.35) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #12002a, #2a0a3e 55%, #12002a 56%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 34px, 100% 100%; animation: bgSynth 2s linear infinite; }
@keyframes bgSynth { to { background-position: 0 0, 0 0, 0 0, 0 34px, 0 0; } }
body[data-sitebg] .content { background: color-mix(in srgb, var(--bg) 78%, transparent); }
@media (prefers-reduced-motion: reduce) { body[data-sitebg]::before, .bg-swatch::before { animation: none !important; } }

@media (max-width: 1400px) and (min-width: 901px) {
  #search { width: 150px; } .player-title { max-width: 200px; } .xpbar { width: 120px; } .topbar { gap: 10px; padding: 10px 14px; }
}
/* Mobile : heure et argent empilés à droite du profil pour laisser la place au titre */
@media (max-width: 900px) {
  .player { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 8px; row-gap: 0; align-items: center; }
  .player-av { grid-row: 1 / 3; } .lvl-badge { grid-row: 1 / 3; } .player-info { grid-row: 1 / 3; }
  .clock { grid-column: 4; grid-row: 1; border-left: 1px solid var(--border); padding-left: 8px; align-items: flex-end; }
  .wallet { grid-column: 4; grid-row: 2; border-left: 1px solid var(--border); padding-left: 8px; margin-left: 2px; }
  .clock small, .clock .sec, .wallet small { display: none; }
  .clock b { font-size: .85rem; } .wallet b { font-size: .78rem; }
}

/* =========================================================
   POSTE DE TRAVAIL (PC)
   ========================================================= */
.pc-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pc-svg { border-radius: 10px; border: 1px solid var(--border); flex-shrink: 1; }
.pc-specs { flex: 1; min-width: 220px; }
.pc-specs ul { list-style: none; padding: 0; margin: 10px 0 0; font-size: .82rem; }
.pc-specs li { margin-bottom: 5px; }
.pc-specs .up { color: var(--ok); font-weight: 700; } .pc-specs .down { color: var(--bad); font-weight: 700; }
.pc-label { color: var(--xp); font-size: 1.05rem; }
.pc-try { font-size: .75rem; color: #22d3ee; margin-bottom: 6px; }
.pc-power { position: relative; height: 16px; background: var(--border); border-radius: 8px; overflow: hidden; margin-top: 8px; }
.pc-power > div { height: 100%; background: linear-gradient(90deg, #22d3ee, #a78bfa, #f472b6); transition: width .5s; }
.pc-power span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .68rem; font-weight: 700; color: #fff; text-shadow: 0 0 4px #000; }
.pc-power span .up { color: #bbf7d0; } .pc-power span .down { color: #fecaca; }
.pc-stage, .pc-home { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.pc-home .btn-primary { margin-top: 12px; }
.pc-slot { font-size: .9rem; margin: 16px 0 8px; }
.pc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pc-item { cursor: pointer; }
.pc-item:hover { border-color: #22d3ee; }
.pc-tier { color: #22d3ee; letter-spacing: 2px; font-size: .9rem; } .pc-tier span { color: var(--border); }
.pc-fan { animation: pcFan 1.1s linear infinite; }
@keyframes pcFan { to { transform: rotate(360deg); } }
.pc-rgb { animation: avRgbFill 3s linear infinite; }
@keyframes avRgbFill { 0% { fill: #f472b6; stroke: #22d3ee; } 33% { fill: #22d3ee; stroke: #a3e635; } 66% { fill: #a3e635; stroke: #f472b6; } 100% { fill: #f472b6; stroke: #22d3ee; } }
.pc-blink { animation: blink 1s steps(1) infinite; }
.pc-flow { animation: pcFlow 1s linear infinite; }
@keyframes pcFlow { to { stroke-dashoffset: -14; } }
@media (max-width: 600px) { .pc-grid { grid-template-columns: repeat(2, 1fr); } .pc-svg { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .pc-fan, .pc-rgb, .pc-flow { animation: none; } }
.pc-item-bonus { color: #86efac !important; font-weight: 700; }
.ladder .pay15 { display: block; color: var(--xp); font-size: .7rem; font-weight: 700; margin-top: 1px; }
.ladder li.dim-row .pay15 { color: var(--muted); }
.pay-howto { font-size: .78rem; color: var(--muted); background: var(--panel); border: 1px dashed var(--border); border-radius: 8px; padding: 8px 12px; }

/* =========================================================
   PROFIL À ONGLETS
   ========================================================= */
.prof-head { display: flex; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin: 10px 0 14px; }
.prof-head h1 { margin: 0 0 4px; }
.prof-head .avatar { flex-shrink: 0; }
.prof-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--xp); font-size: .85rem; }
.prof-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: .8rem; color: var(--text); }
.prof-head p { margin: 4px 0 0; }
.prof-tabs { position: sticky; top: 64px; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 10px; margin-bottom: 8px;
  background: linear-gradient(var(--bg) 80%, transparent); scrollbar-width: thin; }
.prof-tabs a { display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); text-decoration: none; font-size: .82rem; }
.prof-tabs a:hover { border-color: var(--accent); }
.prof-tabs a.on { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
.prof-tabs small { font-size: .66rem; padding: 1px 6px; border-radius: 999px; background: rgba(0,0,0,.25); }
.ptab { display: none; animation: fade .25s; }
.ptab.on { display: block; }
@media (max-width: 900px) { .prof-tabs { top: 112px; } }
@media (max-width: 600px) {
  .prof-head { gap: 10px; padding: 10px 12px; } .prof-head .avatar { width: 64px; height: 64px; }
  .prof-tabs a span { display: none; } .prof-tabs a { padding: 8px 10px; font-size: .95rem; }
  .prof-tabs a.on span { display: inline; font-size: .8rem; }
}
@media (min-width: 601px) { .prof-tabs { flex-wrap: wrap; overflow: visible; } }

/* Bouton boutique (caddie) à côté de l'argent */
.shop-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; margin-left: 4px; flex-shrink: 0;
  border: 1px solid #86efac; border-radius: 8px; background: color-mix(in srgb, #86efac 12%, var(--bg)); color: #86efac; cursor: pointer; }
.shop-btn:hover { background: #86efac; color: var(--bg); box-shadow: 0 0 12px rgba(134,239,172,.5); }
body.route-shop .shop-btn { background: #86efac; color: var(--bg); }
@media (max-width: 900px) { .shop-btn { grid-column: 5; grid-row: 1 / 3; width: 36px; height: 36px; margin-left: 2px; } .player { grid-template-columns: auto auto minmax(0, 1fr) auto auto; } }
@media (max-width: 400px) { .shop-btn { width: 32px; height: 32px; } .shop-btn svg { width: 18px; height: 18px; } }
@media (max-width: 1180px) and (min-width: 901px) {
  .clock small, .clock .sec, .wallet small, .brand .cursor, #logoutBtn .lbl { display: none; }
  #search { width: 120px; } .player-title { max-width: 150px; } .xpbar { width: 90px; } .topbar { gap: 8px; }
}
@media (max-width: 400px) { .xp-text { white-space: nowrap; font-size: .62rem; } .player-info { column-gap: 4px; } }
@media (max-width: 1100px) and (min-width: 901px) {
  .brand .dim { display: none; } .topbar .lang-switch button.on { display: none; }
  .player-title { max-width: 110px; } .player { gap: 8px; padding: 4px 8px; } #search { width: 105px; }
}

/* =========================================================
   TUTORIEL (visite guidée)
   ========================================================= */
.tour { position: fixed; inset: 0; z-index: 400; }
.tour.centered { background: rgba(2,6,12,.72); }
.tour-spot { position: fixed; border-radius: 10px; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(2,6,12,.72), 0 0 22px var(--glow);
  transition: left .35s, top .35s, width .35s, height .35s; pointer-events: none; animation: tourPulse 1.6s ease-in-out infinite; }
@keyframes tourPulse { 50% { box-shadow: 0 0 0 9999px rgba(2,6,12,.72), 0 0 34px var(--accent); } }
.tour-card { position: fixed; background: var(--panel-2); border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6); animation: fade .3s; max-height: calc(100vh - 20px); overflow-y: auto; }
.tour-top { display: flex; align-items: center; gap: 8px; }
.tour-ico { font-size: 1.5rem; }
.tour-count { font-size: .7rem; color: var(--muted); margin-left: auto; }
.tour-x { background: none; border: none; color: var(--muted); font-size: 1rem; padding: 2px 6px; cursor: pointer; }
.tour-x:hover { color: var(--text); }
.tour-card h3 { margin: 6px 0 6px; color: var(--accent); font-size: 1rem; }
.tour-card p { margin: 0 0 10px; font-size: .84rem; line-height: 1.55; }
.tour-dots { display: flex; gap: 5px; justify-content: center; margin-bottom: 10px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.tour-dots i.done { background: var(--accent-dim); } .tour-dots i.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.tour-off { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); margin-bottom: 10px; cursor: pointer; }
.tour-btns { display: flex; justify-content: space-between; gap: 8px; }
.tour-btns button { flex: 1; }
@media (prefers-reduced-motion: reduce) { .tour-spot { animation: none; transition: none; } }

/* =========================================================
   RESSOURCES (liens affiliés)
   ========================================================= */
.res-link { display: flex; flex-direction: column; margin: 14px 0 4px; padding: 10px 12px; border: 1px dashed var(--accent-dim); border-radius: 8px; color: var(--accent); text-decoration: none; font-weight: 700; font-size: .85rem; }
.res-link small { color: var(--muted); font-weight: 400; font-size: .7rem; }
.res-link:hover, .res-link.active { border-style: solid; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.res-banner { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); text-decoration: none; }
.res-banner > span:first-child { font-size: 1.6rem; }
.res-banner div { flex: 1; display: flex; flex-direction: column; }
.res-banner b { color: var(--accent); } .res-banner small { color: var(--muted); font-size: .76rem; }
.res-banner:hover { border-color: var(--accent); } .res-go { color: var(--accent); font-weight: 800; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.res-card { position: relative; display: flex; flex-direction: column; gap: 5px; padding: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; transition: transform .15s, border-color .15s; }
.res-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.res-card.free:hover { border-color: #22d3ee; }
.res-ico { font-size: 1.6rem; }
.res-card b { font-size: .88rem; } .res-card small { color: var(--muted); font-size: .74rem; line-height: 1.45; flex: 1; }
.res-cta { color: var(--accent); font-size: .76rem; font-weight: 700; margin-top: 4px; }
.res-card.free .res-cta { color: #22d3ee; }
.res-aff { position: absolute; top: 10px; right: 10px; font-size: .6rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.res-disclaimer { margin-top: 24px; font-size: .74rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 12px; }
.res-box { margin: 18px 0 6px; padding: 12px 16px; border: 1px dashed var(--border); border-radius: 8px; }
.res-box .d-head { color: var(--muted); }
.res-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 8px; }
.res-mini-item { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 8px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; font-size: .8rem; }
.res-mini-item span { grid-row: 1 / 3; font-size: 1.2rem; } .res-mini-item small { color: var(--muted); font-size: .64rem; }
.res-mini-item:hover { border-color: var(--accent); }
@media (max-width: 600px) { .res-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .res-card { padding: 10px; } .res-mini { grid-template-columns: 1fr; } .res-aff { position: static; align-self: flex-start; } }

/* ---------- Parcours Technicien (TSSR) : couleur ambre ---------- */
:root { --tech: #ffb000; }
.track-title.tech, .track-title.tech:hover { color: var(--tech); }
.card.tech::before { color: var(--tech); }
.card.tech:hover { border-color: var(--tech); box-shadow: 0 0 18px rgba(255,176,0,.3); }
.card.tech .progress > div { background: var(--tech); }

/* ---------- Soutenir le projet (dons) ---------- */
.banners { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 12px; }
.don-link { border-color: #ff6fae; color: #ff8cc0; }
.don-link:hover, .don-link.active { background: rgba(255,111,174,.08); }
.don-banner b { color: #ff8cc0; } .don-banner:hover { border-color: #ff6fae; } .don-banner .res-go { color: #ff8cc0; }
.don-why { padding-left: 0; list-style: none; } .don-why li { margin: 6px 0; }
.don-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.don-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-top: 3px solid var(--don); border-radius: 10px; color: var(--text); text-decoration: none; transition: transform .15s, border-color .15s; }
.don-card:hover { transform: translateY(-2px); border-color: var(--don); }
.don-ico { font-size: 1.7rem; } .don-card b { font-size: 1.05rem; } .don-card small { color: var(--muted); font-size: .78rem; flex: 1; }
.don-cta { align-self: flex-start; margin-top: 4px; padding: 5px 12px; border-radius: 6px; background: var(--don); color: #0b0f14; font-weight: 800; font-size: .8rem; }
.don-soon { padding: 14px 16px; border: 1px dashed #ff6fae; border-radius: 10px; color: #ff8cc0; background: rgba(255,111,174,.06); }

/* ---------- Sauvegarde en ligne ---------- */
.cloud-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: .82rem; color: var(--muted); }
.cloud-pill.ok { border-color: var(--accent); color: var(--accent); }
.cloud-pill.warn { border-color: #ffb000; color: #ffb000; }

/* ---------- Mot de passe oublié / e-mail ---------- */
.cloud-only { display: none !important; }
body.cloud-on .cloud-only { display: revert !important; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; font-size: .82rem; align-self: flex-start; }
.link-btn:hover { color: var(--text); }
.auth-form small { font-size: .72rem; }
.warn-txt { color: #ffb000; }

/* ---------- Nouveaux fonds unis et dégradés ---------- */
[data-sitebg="navy"]::before { background: radial-gradient(ellipse at 50% 0%, #1e3a8a 0%, #0b1736 45%, #050a18 100%); }
[data-sitebg="graphite"]::before { background: radial-gradient(ellipse at 50% 0%, #374151 0%, #1f2937 40%, #0b0f14 100%); }
[data-sitebg="forest"]::before { background: radial-gradient(ellipse at 50% 0%, #166534 0%, #0b3a1f 45%, #04140b 100%); }
[data-sitebg="purple"]::before { background: radial-gradient(ellipse at 50% 0%, #6d28d9 0%, #2e1065 45%, #0f0520 100%); }
[data-sitebg="crimson"]::before { background: radial-gradient(ellipse at 50% 0%, #991b1b 0%, #450a0a 45%, #140404 100%); }
[data-sitebg="ocean"]::before { background: linear-gradient(180deg, #0e7490 0%, #0c4a6e 35%, #082f49 70%, #020617 100%); }
[data-sitebg="sunset"]::before { background: linear-gradient(180deg, #7c2d12 0%, #9d174d 35%, #4c1d95 70%, #0f0520 100%); }
[data-sitebg="cyberpink"]::before { background: linear-gradient(135deg, rgba(236,72,153,.45), rgba(15,5,32,.95) 45%, rgba(34,211,238,.4)), #0b0f14; background-size: 200% 200%; animation: bgAurora 14s ease-in-out infinite alternate; }
.av-glasses { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Palette des couleurs du terminal (bouton ◐) ---------- */
.theme-menu { position: fixed; z-index: 400; width: 220px; padding: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5); display: grid; grid-template-columns: 1fr; gap: 2px; animation: themeIn .12s ease-out; }
.theme-head { font-size: .72rem; color: var(--muted); padding: 2px 6px 6px; }
.theme-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--text); font: inherit; font-size: .8rem; text-align: left; cursor: pointer; }
.theme-menu button:hover { background: var(--panel-2); }
.theme-menu button.on { border-color: var(--accent); color: var(--accent); }
.theme-menu i { width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
@keyframes themeIn { from { opacity: 0; transform: translateY(-4px); } }

/* =========================================================
   ÉCRAN DE CONNEXION ANIMÉ (voir authfx.js)
   ========================================================= */
#authRain { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5; }
/* Ambiance plus douce sur l'écran de connexion : bleu nuit dégradé plutôt que noir */
body.logged-out { background:
  radial-gradient(ellipse at 20% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
  radial-gradient(ellipse at 85% 90%, rgba(99, 102, 241, .22), transparent 55%),
  linear-gradient(160deg, #0f1b2d 0%, #111a33 45%, #0b1222 100%); background-attachment: fixed; }
body.logged-out .topbar { background: rgba(15, 27, 45, .6); backdrop-filter: blur(8px); }
body:not(.logged-out) #authRain { display: none; }
body.logged-out .topbar { position: relative; z-index: 2; }
.auth-screen { position: relative; z-index: 1; }
.auth-stage { width: 100%; max-width: 1120px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 440px); gap: 48px; align-items: center; }
.auth-stage > .auth-box { justify-self: end; animation: authBoxIn .7s cubic-bezier(.2,.8,.2,1) .15s both; backdrop-filter: blur(10px);
  background: rgba(20, 32, 54, .78); border-color: rgba(148, 163, 184, .18); box-shadow: 0 20px 50px rgba(2, 6, 23, .45); position: relative; overflow: hidden; }
.auth-stage > .auth-box::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--ang, 0deg), transparent 0 70%, var(--accent) 85%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: authBorder 6s linear infinite; }
.auth-stage > .auth-box.swap { animation: authSwap .35s ease-out both; }
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes authBorder { to { --ang: 360deg; } }
@keyframes authBoxIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes authSwap { from { opacity: .3; transform: translateX(10px); } }

.auth-hero { color: var(--text); }
.auth-hero > * { animation: heroUp .7s cubic-bezier(.2,.8,.2,1) both; }
.auth-hero > :nth-child(2) { animation-delay: .08s; } .auth-hero > :nth-child(3) { animation-delay: .16s; }
.auth-hero > :nth-child(4) { animation-delay: .24s; } .auth-hero > :nth-child(5) { animation-delay: .32s; }
.auth-hero > :nth-child(6) { animation-delay: .4s; } .auth-hero > :nth-child(7) { animation-delay: .48s; }
@keyframes heroUp { from { opacity: 0; transform: translateY(18px); } }
.hero-badge { display: inline-block; padding: 4px 12px; border: 1px solid var(--accent-dim); border-radius: 999px; font-size: .72rem; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); }
.hero-title { position: relative; margin: 14px 0 6px; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; color: var(--accent);
  text-shadow: 0 0 14px var(--glow), 0 0 32px var(--glow); letter-spacing: -.02em; }
.hero-title::before, .hero-title::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; }
.hero-title::before, .hero-title::after { display: none; }
.hero-title { animation: heroUp .7s cubic-bezier(.2,.8,.2,1) .08s both, heroGlow 4s ease-in-out 1s infinite; }
@keyframes heroGlow { 50% { text-shadow: 0 0 8px var(--glow), 0 0 22px var(--glow); } }
@keyframes glitchA { 0%, 91%, 100% { opacity: 0; transform: none; clip-path: none; }
  92% { opacity: .8; transform: translate(-3px, 1px); clip-path: inset(10% 0 55% 0); } 94% { opacity: .8; transform: translate(3px, -1px); clip-path: inset(60% 0 8% 0); } 96% { opacity: 0; } }
@keyframes glitchB { 0%, 92%, 100% { opacity: 0; transform: none; clip-path: none; }
  93% { opacity: .8; transform: translate(3px, -1px); clip-path: inset(40% 0 30% 0); } 95% { opacity: .8; transform: translate(-2px, 2px); clip-path: inset(5% 0 75% 0); } 97% { opacity: 0; } }
.hero-type { font-size: clamp(.85rem, 1.6vw, 1.05rem); min-height: 1.6em; color: var(--text); }
.hero-prompt { color: var(--accent); font-weight: 700; }
.hero-cursor { color: var(--accent); animation: heroBlink 1s steps(1) infinite; margin-left: 1px; }
@keyframes heroBlink { 50% { opacity: 0; } }
.hero-pitch { color: #a8b5c6; line-height: 1.6; max-width: 560px; margin: 14px 0 20px; }
.hero-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; max-width: 560px; }
.hero-stat { padding: 10px 6px; text-align: center; border: 1px solid rgba(148, 163, 184, .18); border-radius: 12px; background: rgba(20, 32, 54, .6);
  animation: heroUp .6s cubic-bezier(.2,.8,.2,1) var(--d) both; }
.hero-stat b { display: block; font-size: 1.4rem; color: var(--accent); text-shadow: 0 0 10px var(--glow); }
.hero-stat span { font-size: .68rem; color: var(--muted); }
.hero-evo { display: flex; align-items: center; gap: 4px; margin: 22px 0 18px; flex-wrap: nowrap; overflow: hidden; }
.hero-evo-item { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; width: 84px; text-align: center;
  animation: heroPop .55s cubic-bezier(.3,1.6,.5,1) var(--d) both; }
.hero-evo-item small { font-size: .6rem; color: var(--muted); line-height: 1.2; min-height: 2.4em; }
.hero-evo-item .avatar { filter: drop-shadow(0 0 10px var(--glow)); transition: transform .2s; }
.hero-evo-item:hover .avatar { transform: translateY(-4px) scale(1.06); }
.hero-evo-arrow { color: var(--accent); font-size: 1.3rem; opacity: .7; margin-bottom: 18px; animation: heroPulse 1.6s ease-in-out infinite; }
@keyframes heroPop { from { opacity: 0; transform: scale(.4) translateY(10px); } }
@keyframes heroPulse { 50% { opacity: .25; transform: translateX(3px); } }
.hero-feats { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.hero-feats li { display: flex; gap: 10px; align-items: center; font-size: .85rem; animation: heroSlide .6s cubic-bezier(.2,.8,.2,1) var(--d) both; }
.hero-feats li span { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 8%, transparent); }
@keyframes heroSlide { from { opacity: 0; transform: translateX(-16px); } }

@media (max-width: 980px) {
  .auth-stage { grid-template-columns: 1fr; gap: 24px; max-width: 560px; }
  .auth-stage > .auth-box { justify-self: stretch; max-width: none; }
  .auth-hero { text-align: center; }
  .hero-pitch, .hero-stats { margin-left: auto; margin-right: auto; }
  .hero-evo { justify-content: center; }
  .hero-feats { display: none; }
}
@media (max-width: 560px) {
  .hero-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .hero-stat { padding: 8px 2px; } .hero-stat b { font-size: 1.05rem; } .hero-stat span { font-size: .56rem; }
  .hero-evo-item { width: 54px; } .hero-evo-item .avatar { width: 48px; height: 48px; } .hero-evo-item small { display: none; }
  .hero-evo-arrow { margin-bottom: 0; font-size: 1rem; }
  .hero-pitch { display: none; }
  .hero-type { margin-bottom: 12px; }
  #authRain { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-hero *, .auth-hero, .auth-stage > .auth-box, .auth-stage > .auth-box::before, .hero-title::before, .hero-title::after { animation: none !important; }
  #authRain { display: none; }
}
body.logged-out .auth-form input { background: rgba(10, 18, 34, .75); border-color: rgba(148, 163, 184, .25); }
body.logged-out .auth-tabs button:not(.on), body.logged-out .restore-link { background: rgba(15, 25, 45, .6); }
