/* =====================================================================
   Toc-toc — feuille de style commune
   ===================================================================== */
:root {
  --bg: #0e0f1f;
  --bg2: #14152b;
  --surface: #1b1d3a;
  --surface2: #25284f;
  --line: #2f3366;
  --text: #f3f4ff;
  --muted: #a2a6d6;
  --accent: #ffcc33;
  --accent-ink: #1d1500;
  --pink: #ff5c8a;
  --green: #3ddc84;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font-title: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #2a1f5c 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #4a1840 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; }
button { font: inherit; }
img { max-width: 100%; }

.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }

/* ---------- en-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 15, 31, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--font-title); font-weight: 700; font-size: 26px; letter-spacing: .5px;
}
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  color: #1a0b1f; font-size: 20px; box-shadow: 0 4px 14px rgba(255, 92, 138, .4);
  transform: rotate(-6deg);
}
.logo b { color: var(--accent); }
.search {
  flex: 1; max-width: 420px; margin-left: auto; position: relative;
}
.search input {
  width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); padding: 0 16px 0 40px; font-size: 15px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.search::before {
  content: ''; position: absolute; left: 15px; top: 50%; width: 12px; height: 12px; margin-top: -8px;
  border: 2px solid var(--muted); border-radius: 50%;
}
.search::after {
  content: ''; position: absolute; left: 26px; top: 50%; width: 6px; height: 2px; margin-top: 4px;
  background: var(--muted); transform: rotate(45deg);
}
.nav { display: flex; gap: 6px; }
.nav a {
  text-decoration: none; color: var(--muted); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 15px;
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface); }
.nav a.hot { color: var(--accent-ink); background: var(--accent); }
.nav a.hot:hover { filter: brightness(1.05); }

/* ---------- publicité ---------- */
.ad {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  margin: 18px auto; overflow: hidden; color: #6f73a8;
  border: 1px dashed #3a3e78; border-radius: 10px; background: repeating-linear-gradient(45deg, #15172e 0 10px, #171a34 10px 20px);
}
.ad-top, .ad-bottom { width: min(728px, 100%); min-height: 90px; }
.ad-side, .ad-feed { width: 100%; max-width: 300px; min-height: 250px; }
.ad-feed { margin: 0; max-width: none; height: 100%; }
.ad-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; }
.ad-size { font-size: 13px; opacity: .7; }
.ad:has(ins) { border: 0; background: none; }

/* pub vidéo plein cadre */
.video-ad {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center;
  background: rgba(8, 9, 20, .96); border-radius: inherit; animation: fadein .2s ease;
}
.video-ad.out { opacity: 0; transition: opacity .25s; }
.video-ad-inner { width: min(560px, 92%); }
.video-ad-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.ad-pill { background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.video-ad-screen {
  aspect-ratio: 16 / 9; border-radius: 12px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(135deg, #2b2f6b, #5b1f57 60%, #8a3a1f);
}
.video-ad-brand { font-family: var(--font-title); font-size: clamp(24px, 5vw, 40px); font-weight: 700; }
.video-ad-sub { color: #d7d9ff; opacity: .8; font-size: 14px; }
.video-ad-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255, 255, 255, .15); }
.video-ad-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
.video-ad-skip { margin: 12px 0 0 auto; display: block; }

/* ---------- boutons ---------- */
.btn {
  border: 0; cursor: pointer; border-radius: 999px; padding: 10px 20px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); transition: transform .1s, filter .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; filter: none; transform: none; }
.btn.ghost { background: var(--surface2); color: var(--text); }
.btn.pink { background: var(--pink); color: #fff; }
.btn.small { padding: 6px 14px; font-size: 14px; }

/* ---------- héros Pixel Monde ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; margin: 8px 0 28px;
  min-height: 260px; display: flex; align-items: center;
  background: #10122a; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; opacity: .9; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14, 15, 31, .95) 0%, rgba(14, 15, 31, .75) 45%, rgba(14, 15, 31, .05) 100%); }
.hero-text { position: relative; z-index: 2; padding: 36px clamp(20px, 4vw, 48px); max-width: 620px; }
.hero-tag { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.hero h1 { font-family: var(--font-title); font-size: clamp(32px, 5vw, 52px); line-height: 1.05; margin: 0 0 12px; }
.hero p { color: #d6d8ff; margin: 0 0 20px; font-size: 17px; }
.hero .stats { margin-left: 14px; color: var(--muted); font-size: 14px; }

/* ---------- catalogue ---------- */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { font-family: var(--font-title); font-size: 28px; margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
  border-radius: 999px; padding: 7px 16px; font-weight: 600; font-size: 14px;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.card {
  position: relative; display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #4a4f99; }
.thumb {
  aspect-ratio: 4 / 3; display: grid; place-items: center; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--c1), var(--c2));
}
.thumb::before {
  content: ''; position: absolute; inset: 0; opacity: .18;
  background-image: radial-gradient(circle at 1px 1px, #fff 1.2px, transparent 1.4px); background-size: 16px 16px;
}
.thumb span { font-size: 64px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); transition: transform .2s; position: relative; }
.card:hover .thumb span { transform: scale(1.12) rotate(-5deg); }
.thumb .play {
  position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); display: grid; place-items: center; opacity: 0; transition: opacity .15s;
}
.thumb .play::after { content: ''; border-left: 13px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 4px; }
.card:hover .thumb .play { opacity: 1; }
.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 700; font-size: 17px; margin: 0; }
.card-cat { color: var(--muted); font-size: 13px; }
.badge {
  position: absolute; top: 10px; left: 10px; z-index: 2; font-size: 11px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; background: var(--accent); color: var(--accent-ink); padding: 3px 8px; border-radius: 6px;
}
.ad-card { border: 0; background: none; display: flex; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; grid-column: 1 / -1; }

/* ---------- page de jeu ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.game-title { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; }
.game-title .ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px; background: linear-gradient(135deg, var(--c1), var(--c2)); }
.game-title h1 { font-family: var(--font-title); font-size: 30px; margin: 0; line-height: 1.1; }
.game-title .cat { color: var(--muted); font-size: 14px; }
.stage-wrap {
  position: relative; background: #090a18; border: 1px solid var(--line); border-radius: 20px;
  padding: 14px; min-height: 480px; box-shadow: var(--shadow);
}
.hud { display: flex; gap: 18px; justify-content: center; font-weight: 700; margin-bottom: 10px; color: var(--muted); font-size: 15px; }
.hud b { color: var(--text); font-size: 18px; margin-left: 4px; }
.stage { display: flex; justify-content: center; align-items: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage canvas { display: block; border-radius: 10px; background: #000; touch-action: none; }
.overlay {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; text-align: center;
  background: rgba(9, 10, 24, .82); border-radius: inherit; animation: fadein .2s ease;
}
.overlay[hidden] { display: none; }
.overlay h2 { font-family: var(--font-title); font-size: 38px; margin: 0 0 6px; }
.overlay p { color: var(--muted); margin: 0 0 18px; font-size: 17px; }
.overlay .big { font-size: 22px; color: var(--text); }
.overlay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.side-box h3 { margin: 0 0 8px; font-size: 16px; }
.side-box p { margin: 0; color: var(--muted); font-size: 14px; }
.mini-list { display: grid; gap: 8px; }
.mini {
  display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 6px; border-radius: 10px;
}
.mini:hover { background: var(--surface2); }
.mini i { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-style: normal; font-size: 22px; background: linear-gradient(135deg, var(--c1), var(--c2)); flex: none; }
.mini span { font-weight: 600; font-size: 14px; }
.mini small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

/* ---------- pied de page ---------- */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; margin-right: 16px; }
.site-footer a:hover { color: var(--text); }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .game-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
  .ad-side { margin: 0 auto; }
}
@media (max-width: 640px) {
  .site-header .wrap { gap: 10px; }
  .logo { font-size: 21px; }
  .logo-mark { width: 32px; height: 32px; font-size: 17px; }
  .nav a:not(.hot) { display: none; }
  .nav a.hot { padding: 7px 12px; font-size: 13px; }
  .ad-top, .ad-bottom { min-height: 50px; width: min(320px, 100%); }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .thumb span { font-size: 46px; }
  .card-title { font-size: 15px; }
  .stage-wrap { padding: 8px; border-radius: 14px; }
  .hero { min-height: 300px; }
  .hero::after { background: linear-gradient(0deg, rgba(14, 15, 31, .95) 30%, rgba(14, 15, 31, .5) 100%); }
  .hero-text { align-self: flex-end; }
}

/* =====================================================================
   Comptes joueurs : en-tête, fenêtres, annonces, avatars
   ===================================================================== */
.acct { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.me-chip { color: var(--text); cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); max-width: 190px; }
.me-chip b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-chip:hover { border-color: var(--accent); }
.me-chip.bad { border-color: #f87171; }
.me-av { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #2b2f6b, #3d2a6b); flex-shrink: 0; }
canvas.av { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.av-box { display: grid; place-items: center; border-radius: 22%; background: linear-gradient(135deg, #2b2f6b, #3d2a6b); flex-shrink: 0; }

.tt-modal { position: fixed; inset: 0; z-index: 200; background: rgba(5, 6, 20, .72); display: grid; place-items: center; padding: 16px; animation: fadein .15s; }
.tt-box { position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.tt-box.wide { width: min(620px, 100%); }
.tt-box h3 { margin: 0 0 10px; font-family: var(--font-title); font-size: 24px; }
.tt-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.tt-tabs { display: flex; gap: 4px; background: var(--surface); border-radius: 999px; padding: 4px; margin: 0 28px 14px 0; }
.tt-tabs button { flex: 1; border: 0; background: none; color: var(--muted); font-weight: 700; padding: 8px; border-radius: 999px; cursor: pointer; }
.tt-tabs button.on { background: var(--accent); color: var(--accent-ink); }
.tt-form { display: grid; gap: 12px; }
.tt-form label { display: grid; gap: 5px; font-size: 14px; font-weight: 600; }
.tt-form label small { color: var(--muted); font-weight: 400; }
.tt-form input:not([type=checkbox]), .tt-form textarea, .tt-form select { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.tt-form input:focus, .tt-form textarea:focus { outline: none; border-color: var(--accent); }
.tt-check { display: flex !important; grid-template-columns: none; gap: 10px !important; align-items: flex-start; font-weight: 400 !important; }
.tt-check input { margin-top: 3px; flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--accent); }
.tt-err { color: #fca5a5; min-height: 1em; margin: 0; font-size: 14px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0; font: inherit; }
.decision { padding-left: 18px; display: grid; gap: 6px; color: #dfe1ff; }
.tt-announce { background: linear-gradient(90deg, #3b2a00, #4a1d3a); color: #ffe9a8; text-align: center; padding: 8px 16px; font-size: 14px; font-weight: 600; }
.tt-sanction { background: #4c0d17; color: #fecaca; text-align: center; padding: 9px 16px; font-size: 14px; }
.tt-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; transition: .25s; z-index: 300; background: #f4f5ff; color: #121334; font-weight: 700; padding: 12px 20px; border-radius: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; pointer-events: none; }
.tt-toast.show { opacity: 1; transform: translate(-50%, 0); }
.tt-toast.err { background: #fecaca; color: #4c0d17; }

/* éditeur d'avatar */
.av-editor { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.av-grid { width: 256px; height: 256px; image-rendering: pixelated; border-radius: 12px; border: 1px solid var(--line); touch-action: none; cursor: crosshair; }
.av-side { display: grid; gap: 10px; }
.av-pal { display: grid; grid-template-columns: repeat(8, 28px); gap: 5px; }
.av-pal button { width: 28px; height: 28px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; padding: 0; color: var(--muted); background: var(--surface); }
.av-pal button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--bg2) inset; }
.av-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.av-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.av-presets button { padding: 3px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
@media (max-width: 560px) { .av-editor { grid-template-columns: 1fr; justify-items: center; } .av-grid { width: min(256px, 80vw); height: min(256px, 80vw); } }

/* classement sur la page de jeu */
.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.top-list li { display: grid; grid-template-columns: 24px 28px 1fr auto; gap: 8px; align-items: center; font-size: 14px; padding: 4px 6px; border-radius: 9px; }
.top-list li.me { background: rgba(255, 204, 51, .12); }
.top-list .rk { color: var(--muted); font-weight: 700; text-align: right; }
.top-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-list .sc { font-weight: 800; }
.save-hint { font-size: 13px; color: var(--muted); margin-left: auto; }
.save-hint button { font-size: 13px; }

@media (max-width: 640px) {
  .acct [data-a=register] { display: none; }
  .me-chip { padding: 3px; }
  .me-chip b { display: none; }
  .search { min-width: 0; }
}
@media (max-width: 640px) {
  .site-header .wrap { height: auto; flex-wrap: wrap; padding: 8px 0; row-gap: 8px; }
  .site-header .nav { margin-left: auto; }
  .site-header .search { order: 5; flex: 1 1 100%; max-width: none; margin-left: 0; }
}
@media (max-width: 400px) {
  .logo { font-size: 19px; gap: 8px; }
  .site-header .nav a.hot, .acct .btn.small { padding: 6px 10px; font-size: 13px; }
}
@media (max-width: 360px) { .site-header .logo > span:last-child { display: none; } }

/* solde de TOCS à côté du pseudo */
.tocs-pill { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; padding: 4px 12px 4px 4px; border-radius: 999px; background: linear-gradient(135deg, rgba(255, 204, 51, .18), rgba(255, 92, 138, .18)); border: 1px solid rgba(255, 204, 51, .45); font-size: 14px; white-space: nowrap; }
.tocs-pill i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 900; font-size: 12px; color: #1d1500; background: radial-gradient(circle at 35% 30%, #fff3b0, #ffcc33 55%, #d99a00); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); }
.tocs-pill b { font-variant-numeric: tabular-nums; }
button.tocs-pill { color: var(--text); cursor: pointer; font-family: inherit; }
.tocs-pill:hover { border-color: var(--accent); }
@media (max-width: 640px) { .tocs-pill { padding: 3px 8px 3px 3px; font-size: 13px; } }

/* menus des jeux (mode de jeu, salons en ligne) */
.choose { display: grid; justify-items: center; gap: 6px; padding: 10px; max-width: 420px; }
.choose-list { display: grid; gap: 10px; width: min(320px, 80vw); }
.choose-list .btn { justify-content: center; flex-direction: column; gap: 0; padding: 12px 18px; }
.choose-list .btn small { font-weight: 500; font-size: 12px; opacity: .8; }
.room-code { font-family: ui-monospace, Consolas, monospace; font-size: 46px; font-weight: 800; letter-spacing: 10px; color: var(--accent); background: var(--bg2); border: 2px dashed var(--accent); border-radius: 16px; padding: 8px 20px; user-select: all; }
.wait { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .4; } }
.code-form { display: flex; gap: 8px; }
.code-form input { width: 150px; text-align: center; font-size: 26px; letter-spacing: 6px; text-transform: uppercase; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font-family: ui-monospace, Consolas, monospace; }
.card-pl { display: inline-block; margin-left: 8px; font-size: 12px; color: var(--muted); background: var(--surface2); padding: 1px 7px; border-radius: 999px; }
.card-pl.on { color: #a7f3d0; }
.tag-new { position: absolute; top: 8px; left: 8px; background: var(--pink); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: .3px; }
