/* MiniArcade — thème « manette » : fond violet-encre, une couleur par jeu, boutons épais qui s'enfoncent. */
:root {
  --bg: #15122b;
  --bg-2: #1d1940;
  --surface: #262152;
  --surface-2: #302a63;
  --line: #433c80;
  --text: #f4f1ff;
  --muted: #b0aadb;
  --accent: #ffc247;
  --accent-ink: #2b1c00;
  --danger: #ff6b6b;
  --ok: #4fe3a1;
  --shadow: rgba(8, 6, 24, 0.55);
  --g-snake: #4fe3a1;
  --g-memory: #b58cff;
  --g-reflex: #ffc247;
  --g-quiz: #5ab8ff;
  --g-dodge: #ff7a6b;
  --g-morpion: #ff8fb8;
  --g-2048: #f5a65b;
  --g-devine: #6ee7e0;
  --g-default: #ff9ad5;
  --radius: 14px;
  --radius-lg: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito", "Quicksand", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --nav-h: 64px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f1eeff;
  --bg-2: #e6e1ff;
  --surface: #ffffff;
  --surface-2: #f0ecff;
  --line: #cfc7f5;
  --text: #1c1745;
  --muted: #5d5791;
  --accent: #ffb21f;
  --accent-ink: #2b1c00;
  --shadow: rgba(60, 40, 140, 0.25);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f1eeff; --bg-2: #e6e1ff; --surface: #ffffff; --surface-2: #f0ecff; --line: #cfc7f5;
    --text: #1c1745; --muted: #5d5791; --accent: #ffb21f; --shadow: rgba(60, 40, 140, 0.25);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 6.5vw, 3.2rem); font-weight: 900; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 800; }
p { margin: 0 0 1em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 10px; z-index: 100; font-weight: 800; }
.skip-link:focus { top: 8px; }

/* ---------- Structure ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 2px solid var(--line); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.25rem; text-decoration: none; letter-spacing: -0.02em; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 1.1rem; box-shadow: 0 3px 0 #b5801a; }
.spacer { flex: 1; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--bg-2); border-top: 2px solid var(--line); display: flex; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 0.72rem; font-weight: 800; min-width: 0; }
.tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] svg { transform: translateY(-2px); }
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 32px; outline: none; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.2rem); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section { margin-top: 30px; }
.section > h2 { margin-bottom: 12px; }

@media (min-width: 820px) {
  .topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
  body { padding-bottom: 0; }
  .tabbar { position: static; height: auto; padding: 0; border: 0; background: none; gap: 4px; flex: 1; }
  .tab { flex: 0 0 auto; flex-direction: row; gap: 8px; padding: 8px 14px; border-radius: 12px; font-size: 0.95rem; }
  .tab[aria-current="page"] { background: var(--surface); color: var(--accent); }
  .tab[aria-current="page"] svg { transform: none; }
  .tab svg { width: 20px; height: 20px; }
  .topbar-inner { padding: 12px 24px; }
  main { padding: 32px 24px 56px; }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
}
@media (min-width: 560px) { .grid-auto { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid-auto { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Boutons : la touche de manette ---------- */
.btn {
  --b: var(--accent); --b-ink: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px;
  border: 0; border-radius: var(--radius); background: var(--b); color: var(--b-ink); font-weight: 900; font-size: 1rem; text-decoration: none; cursor: pointer;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--b) 55%, #000), 0 8px 14px var(--shadow);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s; touch-action: manipulation; user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active, .btn.is-pressed { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 55%, #000), 0 2px 4px var(--shadow); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.4); transform: none; }
.btn-big { min-height: 58px; padding: 14px 30px; font-size: 1.15rem; border-radius: 18px; }
.btn-block { width: 100%; }
.btn-ghost { --b: var(--surface-2); --b-ink: var(--text); }
.btn-danger { --b: var(--danger); --b-ink: #2b0000; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; border-radius: 11px; box-shadow: 0 3px 0 color-mix(in srgb, var(--b) 55%, #000); }
.btn-sm:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 55%, #000); }
.btn-game { --b: var(--g, var(--accent)); --b-ink: #101010; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 800; cursor: pointer; text-decoration: underline; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-lg { border-radius: var(--radius-lg); padding: 20px; }
.tile {
  --g: var(--g-default); position: relative; display: flex; flex-direction: column; gap: 6px; text-decoration: none; padding: 16px; min-height: 176px; overflow: hidden;
  border-radius: var(--radius-lg); border: 2px solid var(--g);
  background: linear-gradient(160deg, color-mix(in srgb, var(--g) 26%, var(--surface)), var(--surface) 70%);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--g) 55%, #000), 0 12px 20px var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
}
.tile:hover { transform: translateY(-2px); }
.tile:active { transform: translateY(5px); box-shadow: 0 1px 0 color-mix(in srgb, var(--g) 55%, #000); }
.tile-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 4px; }
.tile h3 { margin: 0; font-size: 1.25rem; color: var(--g); filter: brightness(1.1); }
.tile p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.tile-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--bg-2); border: 2px solid var(--line); font-size: 0.8rem; font-weight: 800; white-space: nowrap; }
.chip-g { border-color: var(--g, var(--line)); }
.g-snake { --g: var(--g-snake); } .g-memory { --g: var(--g-memory); } .g-reflex { --g: var(--g-reflex); } .g-quiz { --g: var(--g-quiz); } .g-dodge { --g: var(--g-dodge); } .g-morpion { --g: var(--g-morpion); } .g-2048 { --g: var(--g-2048); } .g-devine { --g: var(--g-devine); }

/* ---------- Accueil ---------- */
.hero { padding: 8px 0 8px; }
.hero h1 { max-width: 14em; }
.hero p { font-size: 1.08rem; color: var(--muted); max-width: 34em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--bg-2); }
.notice.info { border-color: var(--g-quiz); } .notice.success { border-color: var(--ok); } .notice.warning { border-color: var(--accent); }
.notice strong { display: block; }
.notice p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.notice-icon { font-size: 1.3rem; line-height: 1.3; }

/* ---------- Joueurs, avatars, niveaux ---------- */
.avatar { --av: #ff9ad5; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--av); font-size: 1.3rem; flex: none; box-shadow: 0 3px 0 color-mix(in srgb, var(--av) 55%, #000); }
.avatar-lg { width: 84px; height: 84px; border-radius: 26px; font-size: 2.8rem; box-shadow: 0 5px 0 color-mix(in srgb, var(--av) 55%, #000); }
.avatar-sm { width: 32px; height: 32px; border-radius: 11px; font-size: 1.05rem; box-shadow: 0 2px 0 color-mix(in srgb, var(--av) 55%, #000); }
.av0 { --av: #ff9ad5; } .av1 { --av: #4fe3a1; } .av2 { --av: #b58cff; } .av3 { --av: #ffc247; } .av4 { --av: #5ab8ff; } .av5 { --av: #ff7a6b; } .av6 { --av: #7be0ff; } .av7 { --av: #c6f56a; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 14px; background: var(--surface); border: 2px solid var(--line); text-decoration: none; font-weight: 800; font-size: 0.9rem; max-width: 180px; }
.user-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level-badge { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 0.85rem; }
.bar { height: 14px; border-radius: 99px; background: var(--bg-2); border: 2px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.5s; width: 0; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); }
.stat b { display: block; font-size: 1.5rem; font-weight: 900; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach { padding: 12px; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); text-align: center; }
.ach .ico { font-size: 1.8rem; }
.ach b { display: block; font-size: 0.92rem; }
.ach small { color: var(--muted); display: block; line-height: 1.3; }
.ach.locked { opacity: 0.45; filter: grayscale(0.8); }

/* ---------- Classements ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.pill { flex: none; padding: 7px 14px; border-radius: 99px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: 0.9rem; cursor: pointer; color: var(--text); }
.pill[aria-pressed="true"], .pill[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); text-decoration: none; }
.rank-row.me { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.rank-no { font-weight: 900; font-size: 1.15rem; text-align: center; }
.rank-row:nth-child(1) .rank-no { color: #ffd45e; } .rank-row:nth-child(2) .rank-no { color: #d6dbe8; } .rank-row:nth-child(3) .rank-no { color: #e8a26b; }
.rank-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 800; }
.rank-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-weight: 900; font-variant-numeric: tabular-nums; }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 14px; max-width: 460px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 800; font-size: 0.92rem; }
.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--bg-2); outline: none; }
.input:focus { border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { min-height: 84px; resize: vertical; }
.field-error { color: var(--danger); font-size: 0.86rem; font-weight: 700; min-height: 1.2em; }
.hint { color: var(--muted); font-size: 0.82rem; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 2px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch input { appearance: none; width: 52px; height: 30px; border-radius: 99px; background: var(--bg-2); border: 2px solid var(--line); position: relative; cursor: pointer; flex: none; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.switch input:checked { background: color-mix(in srgb, var(--accent) 35%, var(--bg-2)); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(22px); background: var(--accent); }
.avatar-picker { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.avatar-picker button { aspect-ratio: 1; border-radius: 12px; border: 2px solid var(--line); background: var(--bg-2); font-size: 1.3rem; cursor: pointer; }
.avatar-picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-2); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 11px; border: 3px solid transparent; cursor: pointer; background: var(--av); }
.swatches button[aria-pressed="true"] { border-color: var(--text); }

/* ---------- Dialogue, toasts, chargement ---------- */
dialog { border: 2px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); padding: 22px; width: min(92vw, 440px); box-shadow: 0 20px 60px var(--shadow); }
dialog::backdrop { background: rgba(8, 6, 24, 0.7); }
dialog h2 { margin-bottom: 8px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; z-index: 60; pointer-events: none; padding: 0 12px; }
@media (min-width: 820px) { .toasts { bottom: 20px; } }
.toast { pointer-events: auto; max-width: 460px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface-2); border: 2px solid var(--line); font-weight: 700; box-shadow: 0 8px 24px var(--shadow); animation: pop 0.2s ease-out; }
.toast.ok { border-color: var(--ok); } .toast.error { border-color: var(--danger); }
@keyframes pop { from { transform: translateY(10px) scale(0.97); opacity: 0; } }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius-lg); }
.empty b { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 4px; }
.error-box { padding: 14px; border: 2px solid var(--danger); border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }

/* ---------- Page de jeu ---------- */
.game-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.game-head .ico { font-size: 2.2rem; }
.game-head h1 { margin: 0; font-size: 1.7rem; }
.hud { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.hud .chip b { font-variant-numeric: tabular-nums; font-size: 1rem; }
.stage { position: relative; border-radius: var(--radius-lg); border: 3px solid var(--g, var(--line)); background: var(--bg-2); overflow: hidden; box-shadow: 0 6px 0 color-mix(in srgb, var(--g, var(--line)) 55%, #000); }
.stage canvas { display: block; width: 100%; touch-action: none; }
.overlay { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; padding: 20px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(3px); z-index: 5; }
.overlay .big { font-size: 3.2rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.start-card { max-width: 560px; margin: 0 auto; }
.rules { padding: 12px 14px; border-radius: var(--radius); background: var(--bg-2); border: 2px solid var(--line); color: var(--muted); }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.result-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--bg-2); font-weight: 800; }
.dpad { display: none; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 64px); gap: 8px; justify-content: center; margin-top: 16px; }
.dpad .btn { min-height: 0; padding: 0; font-size: 1.5rem; }
.dpad .up { grid-column: 2; grid-row: 1; } .dpad .left { grid-column: 1; grid-row: 2; } .dpad .down { grid-column: 2; grid-row: 2; } .dpad .right { grid-column: 3; grid-row: 2; }
@media (pointer: coarse) { .dpad { display: grid; } }

.memory-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.mem-card { aspect-ratio: 1; perspective: 600px; border: 0; padding: 0; background: none; cursor: pointer; touch-action: manipulation; }
.mem-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.35s; }
.mem-card.flipped .mem-in, .mem-card.matched .mem-in { transform: rotateY(180deg); }
.mem-face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 14px; backface-visibility: hidden; font-size: clamp(1.6rem, 9vw, 2.6rem); }
.mem-back { background: var(--g-memory); color: #1b0c3b; box-shadow: 0 4px 0 color-mix(in srgb, var(--g-memory) 55%, #000); font-weight: 900; }
.mem-front { background: var(--surface-2); border: 2px solid var(--g-memory); transform: rotateY(180deg); }
.mem-card.matched .mem-front { background: color-mix(in srgb, var(--ok) 28%, var(--surface)); border-color: var(--ok); }
.reflex-pad { display: grid; place-content: center; text-align: center; min-height: 340px; width: 100%; border: 0; cursor: pointer; user-select: none; touch-action: manipulation; font-weight: 900; font-size: 1.6rem; color: #101010; padding: 20px; transition: background 0.1s; }
.reflex-pad small { display: block; font-size: 1rem; font-weight: 700; opacity: 0.8; }
.reflex-wait { background: #ff6b6b; } .reflex-go { background: #4fe3a1; } .reflex-idle { background: var(--g-reflex); } .reflex-early { background: #b58cff; }
.quiz-box { padding: 16px; display: grid; gap: 12px; }
.quiz-q { font-size: 1.2rem; font-weight: 800; margin: 0; }
.choice { text-align: left; padding: 12px 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface-2); font-weight: 700; cursor: pointer; min-height: 52px; }
.choice:hover:not([disabled]) { border-color: var(--g-quiz); }
.choice.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 22%, var(--surface)); }
.choice.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 22%, var(--surface)); }

/* ---------- Mouvement réduit ---------- */
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

.maintenance { min-height: 70dvh; display: grid; place-content: center; text-align: center; gap: 8px; }
.maintenance .big { font-size: 4rem; }

[hidden] { display: none !important; }

/* ---------- Jeux de la communauté et création ---------- */
.center-box { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 28px 8px; }
.center-box .big { font-size: 4rem; }
.big-emoji { font-size: 2.4rem; line-height: 1; }
.tile-pick { display: grid; gap: 6px; justify-items: start; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.tile-pick .big { font-size: 2.2rem; }
.tile-pick:hover, .tile-pick:focus-visible { border-color: var(--accent); }
.chip.ok { border-color: var(--ok); } .chip.bad { border-color: var(--danger); } .chip.warn { border-color: var(--accent); }
.choice { text-align: left; justify-content: flex-start; }
.choice.is-ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 22%, transparent); }
.choice.is-bad { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 22%, transparent); }
.cg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cg-card { aspect-ratio: 1; font-size: clamp(1.1rem, 6vw, 2rem); border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; font-family: inherit; overflow: hidden; padding: 2px; }
.cg-card.up { background: var(--bg-2); border-color: var(--accent); }
.cg-card.found { border-color: var(--ok); opacity: 0.7; }

/* ---- Morpion ---- */
.ttt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ttt-cell { aspect-ratio: 1; border: 3px solid var(--g); border-radius: 16px; background: var(--surface); color: var(--text); font: inherit; font-size: clamp(2.4rem, 16vw, 4rem); font-weight: 900; cursor: pointer; touch-action: manipulation; box-shadow: 0 5px 0 color-mix(in srgb, var(--g) 50%, #000); }
.ttt-cell:disabled { cursor: default; }
.ttt-cell:not(:disabled):active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--g) 50%, #000); }
.ttt-X { color: var(--g); } .ttt-O { color: var(--g-reflex); }
.ttt-win { background: color-mix(in srgb, var(--g) 28%, var(--surface)); }
.ttt-msg { min-height: 2.4em; text-align: center; font-size: 1.05rem; }

/* ---- 2048 ---- */
.b2048 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; border-radius: var(--radius-lg); border: 3px solid var(--g); background: var(--bg-2); touch-action: none; user-select: none; outline: none; }
.b2048 > div { aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px; font-weight: 900; font-size: clamp(1.1rem, 7vw, 1.9rem); background: var(--surface); color: #2b1c00; font-variant-numeric: tabular-nums; }
.b2048 .t2 { background: #fff1d6; } .b2048 .t4 { background: #ffe0a8; } .b2048 .t8 { background: #ffc16b; } .b2048 .t16 { background: #ffa34a; }
.b2048 .t32 { background: #ff8a3d; } .b2048 .t64 { background: #ff6b3d; color: #fff; } .b2048 .t128 { background: #f5d44a; font-size: clamp(1rem, 6vw, 1.6rem); }
.b2048 .t256 { background: #e8c42c; font-size: clamp(1rem, 6vw, 1.6rem); } .b2048 .t512 { background: #d9b11a; font-size: clamp(1rem, 6vw, 1.6rem); }
.b2048 .t1024 { background: #6fd3a0; font-size: clamp(0.85rem, 5vw, 1.3rem); } .b2048 .t2048 { background: #4fe3a1; font-size: clamp(0.85rem, 5vw, 1.3rem); box-shadow: 0 0 18px #4fe3a1; }
.b2048 .tbig { background: #b58cff; color: #fff; font-size: clamp(0.7rem, 4vw, 1.1rem); }
.b2048 .t0 { background: color-mix(in srgb, var(--surface) 60%, transparent); }

/* ---- Devine le nombre ---- */
.guess-bot { font-size: 3rem; }
.guess-form { display: flex; gap: 10px; justify-content: center; }
.guess-input { width: 8rem; text-align: center; font-size: 1.6rem; font-weight: 800; }
.guess-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.guess-history li { padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }
