/* =========================================================
   OBJECTIF GPX — Styles & thèmes d'interface
   ========================================================= */
:root, [data-gpx="nuit"] {
  --bg: #0b1228; --bg2: #111b3a; --card: #16224a; --card2: #1d2b5c; --line: #2a3a72;
  --text: #eef2ff; --muted: #9aa8d6; --accent: #4f7cff; --accent2: #7aa2ff; --on-accent: #fff;
  --good: #22c27d; --bad: #ff4f6a; --gold: #f5c542; --shadow: 0 8px 24px rgba(0,0,0,.35);
  --hero: linear-gradient(135deg, #1d2f6e 0%, #16224a 60%);
  color-scheme: dark;
}
[data-gpx="jour"] {
  --bg: #eef2fa; --bg2: #ffffff; --card: #ffffff; --card2: #f2f5fc; --line: #d8dff0;
  --text: #16224a; --muted: #5c6a94; --accent: #2449c9; --accent2: #4f7cff; --on-accent: #fff;
  --good: #149e62; --bad: #d92d4a; --gold: #c48f0c; --shadow: 0 6px 18px rgba(22,34,74,.10);
  --hero: linear-gradient(135deg, #dfe8ff 0%, #ffffff 70%);
  color-scheme: light;
}
[data-gpx="gyro"] {
  --bg: #07091a; --bg2: #0e1230; --card: #131838; --card2: #1a2048; --line: #2c2f64;
  --text: #f2f3ff; --muted: #9ea3d8; --accent: #ff3b5c; --accent2: #3b7bff; --on-accent: #fff;
  --good: #2bd48b; --bad: #ff3b5c; --gold: #ffd166; --shadow: 0 0 24px rgba(59,123,255,.25);
  --hero: linear-gradient(120deg, rgba(255,59,92,.35), rgba(19,24,56,1) 40%, rgba(19,24,56,1) 60%, rgba(59,123,255,.35));
}
[data-gpx="tricolore"] {
  --bg: #f7f7fb; --bg2: #ffffff; --card: #ffffff; --card2: #f3f5fb; --line: #dfe3ee;
  --text: #0f1f5c; --muted: #5a6690; --accent: #1f3f9e; --accent2: #d9283a; --on-accent: #fff;
  --good: #1a9a5c; --bad: #d9283a; --gold: #c9a227; --shadow: 0 6px 18px rgba(15,31,92,.12);
  --hero: linear-gradient(90deg, rgba(31,63,158,.18) 0 33%, #fff 33% 66%, rgba(217,40,58,.15) 66%);
  color-scheme: light;
}
[data-gpx="neon"] {
  --bg: #050510; --bg2: #0b0b1e; --card: #10102a; --card2: #17173a; --line: #34206a;
  --text: #f4ecff; --muted: #a99ad8; --accent: #b14dff; --accent2: #00e5ff; --on-accent: #fff;
  --good: #00f5a0; --bad: #ff2e88; --gold: #ffe066; --shadow: 0 0 22px rgba(177,77,255,.35);
  --hero: linear-gradient(135deg, rgba(177,77,255,.35), rgba(0,229,255,.18));
}
[data-gpx="or"] {
  --bg: #0f0d08; --bg2: #18140b; --card: #1f1a0e; --card2: #2a2312; --line: #4a3c17;
  --text: #fff7e0; --muted: #c9b98a; --accent: #d4a52c; --accent2: #f9e08b; --on-accent: #1a1405;
  --good: #7fd88a; --bad: #ff6b5a; --gold: #f9e08b; --shadow: 0 0 24px rgba(212,165,44,.22);
  --hero: linear-gradient(135deg, rgba(249,224,139,.25), rgba(31,26,14,1) 60%);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Outfit', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  padding: 72px 0 84px; -webkit-tap-highlight-color: transparent;
}
body.in-game { padding-bottom: 24px; }
body.in-game #nav { display: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
textarea { resize: vertical; min-height: 64px; }
label { display: block; font-weight: 600; margin: 10px 0; font-size: 14px; }
label input, label select { margin-top: 6px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 10px; }
.mt { margin-top: 12px; }
.full { width: 100%; }

#main { max-width: 920px; margin: 0 auto; padding: 12px 16px; }

/* ---------- barre du haut ---------- */
#topbar {
  position: fixed; inset: 0 0 auto 0; height: 64px; z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg2) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
#topbar:empty { display: none; }
.top-av { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; border: 2px solid var(--accent); flex: none; padding: 0; }
.top-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top-info b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-info small { color: var(--muted); font-size: 12px; }
.top-stats { display: flex; gap: 8px; font-weight: 700; }
.top-stats span { background: var(--card); border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; font-size: 14px; white-space: nowrap; }
.xpbar { height: 6px; background: var(--card2); border-radius: 99px; overflow: hidden; margin-top: 4px; max-width: 220px; }
.xpbar.lg { height: 12px; max-width: none; margin: 10px 0 6px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: inherit; transition: width .6s; }

/* ---------- navigation ---------- */
#nav {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
#nav:empty { display: none; }
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: 14px; min-width: 60px; color: var(--muted); }
.nav-btn span { font-size: 22px; line-height: 1; transition: transform .2s; }
.nav-btn small { font-size: 11px; font-weight: 600; }
.nav-btn.on { color: var(--text); background: var(--card); }
.nav-btn.on span { transform: translateY(-2px) scale(1.1); }

/* ---------- cartes & boutons ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent2)));
  color: var(--on-accent); font-weight: 700; padding: 11px 18px; border-radius: 14px; transition: transform .1s, filter .2s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 11px; }
.btn.big { padding: 15px 22px; font-size: 17px; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.good { background: var(--good); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--card2); border: 1px solid var(--line); display: inline-grid; place-items: center; flex: none; }
.btn-link { color: var(--muted); font-weight: 600; padding: 6px 8px; border-radius: 8px; }
.btn-link.on { color: var(--accent2); }
.chip { display: inline-block; padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; background: var(--card2); border: 1px solid var(--line); }
.chip.xp { color: var(--accent2); }
.chip.coin { color: var(--gold); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.page-title { margin: 6px 0 14px; font-size: 24px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec { margin: 22px 0 10px; font-size: 17px; }
.proto-note { font-size: 13px; color: var(--muted); background: var(--card2); border: 1px dashed var(--line); padding: 8px 12px; border-radius: 12px; margin-bottom: 12px; }

.grid { display: grid; gap: 12px; }
.grid.games { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid.mods { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.shop { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.stats { grid-template-columns: repeat(3, 1fr); }
.grid.badges { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid .card { margin: 0; }

/* ---------- avatars ---------- */
.avatar-svg { width: 100%; height: 100%; display: block; }
.av-big { width: 140px; height: 140px; flex: none; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 4px var(--card2), 0 0 0 6px var(--accent); }
.mini-av { width: 42px; height: 42px; border-radius: 50%; overflow: visible; flex: none; position: relative; }
.mini-av svg { border-radius: 50%; }
.mini-av.xs { width: 30px; height: 30px; }
.mini-av .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--good); border: 2px solid var(--card); }
.stack { display: flex; margin-top: 6px; }
.stack .mini-av { margin-right: -8px; box-shadow: 0 0 0 2px var(--card); border-radius: 50%; }
.stack.pad { padding: 4px 4px 8px; }

/* ---------- onboarding ---------- */
.onboard { max-width: 640px; margin: -50px auto 0; }
.hero { text-align: center; padding: 30px 10px 20px; }
.hero .logo { font-size: 56px; animation: bob 2.4s ease-in-out infinite; }
.hero h1 { font-size: 40px; font-weight: 800; letter-spacing: -.5px; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 17px; }
.editor { display: flex; gap: 20px; align-items: flex-start; }
.editor .av-big { width: 170px; height: 170px; }
.editor > div:last-child { flex: 1; min-width: 0; }
.editor.wide .av-big.sticky { position: sticky; top: 80px; }
.ed-group { margin-bottom: 12px; }
.ed-group > span { display: block; font-weight: 700; font-size: 13px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.sw.on { border-color: var(--card); box-shadow: 0 0 0 3px var(--accent); }
.opt { padding: 7px 12px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.opt.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.opt.more { border-style: dashed; color: var(--muted); }
.sticky-bottom { position: sticky; bottom: 90px; }

/* ---------- accueil ---------- */
.home-hero { display: flex; gap: 20px; align-items: center; background: var(--hero), var(--card); }
.daily { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-left: 4px solid var(--gold); }
.daily p { margin: 0; }
.game-tile { text-align: left; display: flex; flex-direction: column; gap: 4px; transition: transform .15s, border-color .2s; }
.game-tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.gt-ic { font-size: 34px; margin-bottom: 4px; }
.game-tile small { color: var(--muted); }
.online { display: flex; gap: 16px; overflow-x: auto; }
.online-u { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mastery { display: grid; grid-template-columns: minmax(140px, 1.3fr) 2fr 48px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.bar { height: 8px; background: var(--card2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); transition: width .6s; }
.mod-card { text-align: left; display: flex; flex-direction: column; gap: 6px; border-top: 4px solid var(--c); }
.mod-card small { color: var(--muted); }
.mc-ic { font-size: 28px; }
.mod-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.mod-btn { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent)); }
.mod-btn b { flex: 1; }
.mod-btn small { color: var(--muted); }

/* ---------- jeux ---------- */
.game { max-width: 720px; margin: 0 auto; }
.game-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.game-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.game-title small { color: var(--muted); }
.game-hud { display: flex; gap: 8px; font-weight: 700; }
.game-hud span { background: var(--card); border: 1px solid var(--line); padding: 5px 10px; border-radius: 99px; }
.progress { height: 6px; background: var(--card2); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.qcard h3 { font-size: 20px; margin: 12px 0 16px; }
.qmeta { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.timer { flex: 0 0 120px; height: 8px; background: var(--card2); border-radius: 99px; overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: var(--good); transition: width .1s linear; }
.timer i.hot { background: var(--bad); }
.answers { display: flex; flex-direction: column; gap: 10px; }
.ans { text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--card2); border: 2px solid var(--line); font-weight: 600; display: flex; align-items: center; gap: 12px; transition: transform .1s, border-color .2s; }
.ans:hover:not(:disabled) { border-color: var(--accent); transform: translateX(3px); }
.ans .key { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--card); font-size: 13px; color: var(--muted); }
.ans.good { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--card2)); }
.ans.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, var(--card2)); animation: shake .35s; }
.ans:disabled { cursor: default; }
.feedback { margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-weight: 700; }
.feedback p { font-weight: 400; margin: 6px 0 10px; }
.feedback.ok { background: color-mix(in srgb, var(--good) 15%, transparent); border: 1px solid var(--good); }
.feedback.ko { background: color-mix(in srgb, var(--bad) 13%, transparent); border: 1px solid var(--bad); }

.results { text-align: center; max-width: 520px; margin: 20px auto; }
.results .big { font-size: 32px; font-weight: 800; margin: 6px 0; }
.results .big small { font-size: 18px; color: var(--muted); }
.stars { font-size: 46px; letter-spacing: 6px; color: var(--card2); }
.stars .on { color: var(--gold); text-shadow: 0 0 16px color-mix(in srgb, var(--gold) 60%, transparent); }
.gains { display: flex; justify-content: center; gap: 10px; margin: 14px 0; }
.results .row { justify-content: center; }
.review { text-align: left; margin: 12px 0 16px; background: var(--card2); border-radius: 12px; padding: 10px 14px; }
.review summary { cursor: pointer; font-weight: 700; }
.rev-item { border-top: 1px solid var(--line); padding: 10px 0; }
.rev-item p { margin: 4px 0; }
.good { color: var(--good); }
.podium { text-align: left; display: inline-block; }

.tf-wrap { max-width: 560px; margin: 0 auto; }
.tf-clock { font-size: 54px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.tf-clock.hot { color: var(--bad); animation: pulse 1s infinite; }
.tf-card { font-size: 21px; font-weight: 600; min-height: 150px; display: grid; place-items: center; text-align: center; padding: 26px; transition: background .2s; }
.tf-card.flash-ok { background: color-mix(in srgb, var(--good) 25%, var(--card)); }
.tf-card.flash-ko { background: color-mix(in srgb, var(--bad) 25%, var(--card)); animation: shake .35s; }
.tf-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }

.case-pick { text-align: left; display: flex; flex-direction: column; gap: 4px; transition: transform .15s, border-color .2s; }
.case-pick:hover { transform: translateY(-2px); border-color: var(--accent); }
.case-pick small { color: var(--muted); }
.case-num { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--accent2); }
.dossier { position: relative; background: repeating-linear-gradient(0deg, transparent 0 27px, color-mix(in srgb, var(--line) 50%, transparent) 27px 28px), var(--card); overflow: hidden; }
.dossier p { font-size: 17px; }
.stamp { position: absolute; right: -8px; top: 14px; transform: rotate(12deg); border: 3px solid var(--bad); color: var(--bad); font-weight: 800; padding: 2px 10px; border-radius: 6px; opacity: .55; font-size: 13px; letter-spacing: 2px; }

.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mcard { aspect-ratio: 1 / 1; position: relative; perspective: 600px; }
.mcard .front, .mcard .back { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; border-radius: 14px; padding: 6px; backface-visibility: hidden; transition: transform .4s; font-weight: 700; font-size: 14px; border: 2px solid var(--line); }
.mcard .back { background: linear-gradient(135deg, var(--accent), var(--accent2)); font-size: 28px; }
.mcard .front { background: var(--card); transform: rotateY(180deg); }
.mcard.flip .front { transform: rotateY(0); }
.mcard.flip .back { transform: rotateY(-180deg); }
.mcard.found .front { border-color: var(--good); background: color-mix(in srgb, var(--good) 15%, var(--card)); }

.radio-log { background: #050a14; color: #b6ffcf; font-family: ui-monospace, Consolas, monospace; font-size: 14px; border-radius: 14px; padding: 12px; max-height: 260px; overflow-y: auto; margin-bottom: 12px; border: 1px solid #1d3a2a; }
.radio { padding: 6px 0; border-bottom: 1px dashed #163024; line-height: 1.45; }
.radio b { color: #6dffa6; }
.radio.me b { color: #8fb8ff; }
.radio.ko b { color: #ff8a8a; }
.scene { font-size: 17px; font-weight: 600; }

.duel-bar { display: flex; gap: 10px; margin-bottom: 12px; overflow-x: auto; }
.duelist { flex: 1; min-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; position: relative; }
.duelist.me { border-color: var(--accent); }
.duelist .pts { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.duelist .st { position: absolute; top: 6px; right: 10px; font-style: normal; font-weight: 800; }
.count { font-size: 80px; font-weight: 800; color: var(--accent2); }

/* ---------- social ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.tab { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.tab.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.badge-n { background: var(--bad); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; margin-left: 2px; }
.composer { display: flex; gap: 10px; align-items: flex-start; }
.composer textarea { flex: 1; }
.post header { display: flex; gap: 10px; align-items: center; }
.post header small { display: block; color: var(--muted); font-size: 12px; }
.lvl { font-size: 12px; color: var(--accent2); font-weight: 600; }
.post p { margin: 10px 0; white-space: pre-wrap; }
.post footer { display: flex; gap: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.comments { display: none; margin-top: 8px; }
.post.open .comments, .post .comments:has(.comment) { display: block; }
.comment { background: var(--card2); padding: 8px 10px; border-radius: 10px; margin-bottom: 6px; font-size: 14px; }
.cform { display: flex; gap: 8px; margin-top: 6px; }
.post:not(.open) .cform { display: none; }
.user-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; }
.user-row small { display: block; color: var(--muted); font-size: 12px; }
.user-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.is-on { color: var(--good); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 24px; font-weight: 800; letter-spacing: 3px; color: var(--accent2); margin: 4px 0; }
.chat { display: flex; flex-direction: column; height: calc(100vh - 260px); min-height: 380px; padding: 0; overflow: hidden; }
.chat header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: var(--card2); align-self: flex-start; line-height: 1.4; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-radius: 16px 16px 4px 16px; }
.typing { color: var(--muted); font-size: 13px; font-style: italic; }
.chat .cform { padding: 10px; border-top: 1px solid var(--line); margin: 0; }
.room { display: flex; gap: 12px; align-items: center; }
.room-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; flex: none; }
.room small { display: block; color: var(--muted); }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--line); }
.rank-row.me { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 10px; }
.rank-row .pos { width: 28px; text-align: center; font-weight: 800; }
.rank-row .muted { font-size: 12px; }

/* ---------- boutique ---------- */
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.si-prev { width: 110px; height: 110px; border-radius: 18px; overflow: hidden; position: relative; }
.shop-item.locked .si-prev svg, .shop-item.locked .theme-prev { filter: grayscale(1) brightness(.6); }
.lock { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; color: #fff; text-shadow: 0 1px 4px #000; }
.theme-prev { width: 100%; height: 100%; display: grid; grid-template-rows: 1fr 1fr 1fr; gap: 6px; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 18px; }
.theme-prev i { border-radius: 8px; background: var(--card); }
.theme-prev i:nth-child(2) { background: var(--accent); }
.theme-prev i:nth-child(3) { background: var(--accent2); width: 60%; }

/* ---------- profil ---------- */
.profile-head { display: flex; gap: 20px; align-items: center; background: var(--hero), var(--card); }
.profile-head p { margin: 4px 0; }
.stat { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 24px; }
.stat b { font-size: 22px; }
.stat small { color: var(--muted); font-size: 12px; }
.badge { text-align: center; display: flex; flex-direction: column; gap: 4px; opacity: .45; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; border-color: var(--gold); }
.badge span { font-size: 34px; }
.badge small { color: var(--muted); font-size: 12px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; }
.switch-row input { width: auto; transform: scale(1.3); }

/* ---------- modales & toasts ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { width: 100%; max-width: 460px; position: relative; max-height: 90vh; overflow-y: auto; }
.modal .close { position: absolute; right: 12px; top: 12px; }
.modal h3 { padding-right: 40px; }
.pick { margin-bottom: 8px; }
.levelup .burst { font-size: 70px; animation: spin 1.2s ease-out; }
.levelup .btn { margin-top: 14px; }
.unlocks { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#toasts { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--card); border: 1px solid var(--accent); color: var(--text); padding: 11px 16px; border-radius: 14px; box-shadow: var(--shadow); animation: drop .3s; transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(-10px); }

/* ---------- animations ---------- */
.pop { animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.slide-in { animation: slide .3s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }
@keyframes spin { from { transform: rotate(-180deg) scale(.2); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .editor, .home-hero, .profile-head { flex-direction: column; align-items: center; text-align: center; }
  .home-hero .row { justify-content: center; }
  .editor.wide .av-big.sticky { position: static; }
  .grid.games { grid-template-columns: 1fr 1fr; }
  .grid.stats { grid-template-columns: repeat(3, 1fr); }
  .stat b { font-size: 18px; }
  .memory { gap: 6px; }
  .mcard .front { font-size: 11.5px; }
  .mastery { grid-template-columns: 1fr 1fr 40px; font-size: 13px; }
  .top-stats span { padding: 5px 8px; font-size: 13px; }
  .xpbar:not(.lg) { max-width: 120px; }
  .qcard h3 { font-size: 18px; }
  .tf-card { font-size: 18px; }
  .user-row { flex-wrap: wrap; }
  .user-row .acts { width: 100%; justify-content: flex-start; padding-left: 54px; }
  .chat-row { flex-wrap: nowrap; }
}
