/* =====================================================================
   BLOCK DOWN — système de design
   Direction : minimaliste premium, néon discret. La grille reste la priorité visuelle.
   ===================================================================== */
:root {
  /* Couleurs de base */
  --ink-0: #07081a;
  --ink-1: #0b0c1d;
  --ink-2: #13152e;
  --ink-3: #1b1e3d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f3ff;
  --muted: #9a9cc4;
  --accent: #7c6cff;
  --accent-2: #3ee6d1;
  --danger: #ff5a6e;
  --gold: #ffcc4d;

  /* Typographie : police arrondie du système (SF Pro Rounded sur iPhone), zéro téléchargement */
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Espacements, rayons, ombres */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);

  /* Combo (mis à jour par le JS) */
  --tier: #9a9cc4;
  --tier-glow: rgba(154, 156, 196, 0);
  --lvl: 0;

  /* Tailles calculées par le JS */
  --board: 320px;
  --tc: 20px; /* taille d'une case dans la réserve */

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
html { background: var(--ink-1); }
body {
  position: fixed; inset: 0; /* empêche le défilement élastique d'iOS */
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Fond statique (aucune animation coûteuse) */
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(124, 108, 255, 0.28), transparent 60%),
    radial-gradient(80% 50% at 100% 110%, rgba(62, 230, 209, 0.12), transparent 60%),
    linear-gradient(180deg, var(--ink-2), var(--ink-0));
}

.screen {
  position: fixed; inset: 0;
  display: flex; justify-content: center;
  padding: calc(var(--safe-t) + var(--s3)) calc(var(--safe-r) + var(--s3)) calc(var(--safe-b) + var(--s3)) calc(var(--safe-l) + var(--s3));
}

/* ---------- Boutons ---------- */
.btn {
  appearance: none;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 700; font-size: 16px; letter-spacing: .01em;
  cursor: pointer;
  transition: transform .12s ease, background-color .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #8b7bff, #5a62ff);
  box-shadow: 0 8px 24px rgba(108, 96, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn.big { min-height: 58px; font-size: 19px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255, 90, 110, 0.5); color: #ffb3bd; background: rgba(255, 90, 110, 0.1); }
.btn:disabled { opacity: .45; }
.icon-btn {
  appearance: none; flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn:active { transform: scale(.94); }
@media (hover: hover) {
  .btn:hover, .icon-btn:hover { background-color: rgba(255, 255, 255, 0.12); }
  .btn.primary:hover { filter: brightness(1.08); }
}
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- Menu ---------- */
.menu {
  width: min(100%, 420px);
  display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  gap: var(--s5);
}
.brand { text-align: center; }
.brand-mark {
  width: 64px; height: 64px; margin: 0 auto var(--s3);
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px;
}
.brand-mark i { border-radius: 8px; box-shadow: inset 0 2px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.2); }
.brand-mark .m1 { background: linear-gradient(145deg, #a99dff, #6f62ff); }
.brand-mark .m2 { background: linear-gradient(145deg, #7af2e1, #22bfa9); }
.brand-mark .m3 { background: linear-gradient(145deg, #ffd27a, #f5a524); }
.brand-mark .m4 { background: linear-gradient(145deg, #ff8fa0, #f2445c); }
.logo {
  margin: 0; font-size: 44px; font-weight: 900; letter-spacing: .02em; line-height: 1;
  text-shadow: 0 0 24px rgba(124, 108, 255, 0.55);
}
.logo span { color: var(--accent-2); margin-left: .22em; text-shadow: 0 0 22px rgba(62, 230, 209, 0.5); }
.byline { margin: var(--s2) 0 0; color: var(--muted); font-size: 13px; letter-spacing: .08em; }
.menu-best {
  align-self: center; text-align: center;
  padding: var(--s2) var(--s5); border-radius: 99px;
  border: 1px solid var(--line); background: rgba(255,255,255,.04);
}
.menu-best strong { font-size: 26px; font-variant-numeric: tabular-nums; color: var(--gold); }
.menu-actions { display: flex; flex-direction: column; gap: var(--s3); }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.menu-grid .btn { padding: 10px 4px; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.install-hint {
  appearance: none; border: 1px dashed rgba(62, 230, 209, 0.5); background: rgba(62, 230, 209, 0.08);
  color: #b9fff5; border-radius: var(--r-md); padding: 12px; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ---------- Écran de jeu ---------- */
.app {
  width: min(100%, 480px);
  display: flex; flex-direction: column; gap: var(--s2);
  min-height: 0;
}
.hud { display: flex; align-items: center; gap: var(--s3); }
.score-box { flex: 1; text-align: center; }
.score { display: block; font-size: 34px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.best-box { width: 88px; text-align: right; }
.best { display: block; font-size: 18px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.bump { animation: bump .28s ease-out; }
@keyframes bump { 40% { transform: scale(1.14); } }

.combo-row { display: flex; align-items: center; gap: var(--s2); min-height: 24px; }
.mult {
  min-width: 48px; font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums;
  color: var(--tier); text-shadow: 0 0 12px var(--tier-glow); transition: color .3s;
}
.meter { position: relative; flex: 1; height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.meter-fill {
  position: absolute; inset: 0 auto 0 0; width: 100%;
  transform-origin: left; transform: scaleX(0);
  border-radius: 99px; background: var(--tier); box-shadow: 0 0 10px var(--tier-glow);
  transition: transform .45s cubic-bezier(.2, 1.2, .4, 1), background-color .3s;
}
.tick { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(0,0,0,.45); }
.combo-label { min-width: 104px; text-align: right; white-space: nowrap; font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--tier); }
.app[data-tier="0"] .combo-label { font-weight: 600; color: var(--muted); }
.meter.pulse { animation: pulse .4s ease-out; }
@keyframes pulse { 0% { transform: scaleY(2); } }

.board-area { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; }
.board-wrap { position: relative; width: var(--board); height: var(--board); }
.board-wrap.shake { animation: shake .4s; }
@keyframes shake {
  20%, 80% { transform: translateX(2px); }
  40%, 60% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
}
#board {
  width: 100%; height: 100%;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  gap: 3px; padding: 6px;
  border-radius: var(--r-lg);
  background: rgba(5, 6, 20, 0.72);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 1px var(--tier), 0 0 calc(var(--lvl) * 6px) var(--tier-glow), var(--shadow);
  transition: box-shadow .4s;
}
.app[data-tier="0"] #board { box-shadow: 0 0 0 1px rgba(255,255,255,.04), var(--shadow); }

/* Cases (grille, réserve et pièce déplacée partagent ce style) */
.cell { border-radius: 22%; background: rgba(255, 255, 255, 0.045); min-width: 0; min-height: 0; }
.cell.filled, .cell.preview {
  background: linear-gradient(150deg, var(--a), var(--b));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.22);
}
.cell.preview { opacity: .5; }
.cell.will-clear { filter: brightness(1.35); box-shadow: inset 0 0 0 2px rgba(255,255,255,.9), 0 0 10px var(--a, #fff); }
.cell.pop { animation: pop .38s ease-out; }
.cell.land { animation: land .24s ease-out; }
@keyframes pop { 0% { background: #fff; transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes land { 0% { transform: scale(1.15); filter: brightness(1.5); } }
.hole { visibility: hidden; }
.cell.hit { box-shadow: inset 0 0 0 2px rgba(255,140,90,.95), 0 0 10px rgba(255,140,90,.7); background-color: rgba(255,140,90,.22); }
.cell.hit.filled { filter: brightness(1.4); }

/* Palette des blocs : 7 teintes, distinctes aussi en luminosité */
.c0 { --a: #ff8c9b; --b: #ef3f58; }
.c1 { --a: #ffc178; --b: #f2861c; }
.c2 { --a: #ffe68a; --b: #e7b416; }
.c3 { --a: #74f0c4; --b: #17b07f; }
.c4 { --a: #8ee2ff; --b: #1fa2dd; }
.c5 { --a: #a3adff; --b: #4f5ff0; }
.c6 { --a: #dba8ff; --b: #9645e6; }

/* Bonus */
.bonus-row { display: flex; justify-content: space-between; gap: var(--s2); }
.bonus {
  appearance: none; flex: 1; max-width: 170px;
  display: flex; align-items: center; gap: var(--s2);
  min-height: 46px; padding: 6px 12px;
  border-radius: var(--r-md); border: 1px solid var(--bc-line);
  background: rgba(255,255,255,.05);
  cursor: grab; touch-action: none; text-align: left;
  transition: opacity .2s, filter .2s, transform .12s;
}
.bonus.hammer { --bc: rgba(255, 204, 77, .45); --bc-line: rgba(255, 204, 77, .5); }
.bonus.rocket { --bc: rgba(255, 90, 110, .45); --bc-line: rgba(255, 90, 110, .5); }
.bonus-icon { font-size: 22px; line-height: 1; }
.bonus-text { display: flex; flex-direction: column; line-height: 1.1; }
.bonus-text b { font-size: 14px; }
.bonus-text small { font-size: 11px; color: var(--muted); }
.bonus.dragging { opacity: .35; }
.bonus.used { opacity: .3; filter: grayscale(1); pointer-events: none; }
.bonus.urgent { animation: urgent .9s ease-in-out infinite; }
@keyframes urgent { 50% { box-shadow: 0 0 22px var(--bc); transform: scale(1.03); } }

/* Réserve */
#tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.slot {
  height: calc(var(--tc) * 5 + 20px);
  display: grid; place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  touch-action: none; cursor: grab;
}
.slot:empty { border-style: dashed; opacity: .4; }
.piece { display: grid; gap: 2px; pointer-events: none; }
.piece .cell { width: var(--tc); height: var(--tc); }
.piece.dragging { opacity: .2; }
.piece.stuck { opacity: .35; filter: grayscale(.7); }

.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 50;
  display: grid; pointer-events: none; will-change: transform;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.5));
}
.drag-ghost.invalid { opacity: .55; }
.bonus-ghost { display: grid; place-items: center; }

/* Popups, bannières, effets de bonus */
#popups { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.popup {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 28px; font-weight: 900; white-space: nowrap;
  text-shadow: 0 2px 10px rgba(0,0,0,.75), 0 0 14px var(--accent);
  animation: floatUp 1s ease-out forwards;
}
.popup.combo { color: var(--gold); font-size: 20px; }
.popup.lost { color: #ff9aa7; font-size: 16px; }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -46px); }
}
.banner {
  position: absolute; left: 50%; top: 12%; transform: translateX(-50%);
  text-align: center; white-space: nowrap; color: var(--bc);
  text-shadow: 0 0 20px var(--bglow), 0 3px 0 rgba(0,0,0,.5);
  animation: banner 1.1s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
.banner b { display: block; font-size: 32px; font-weight: 900; letter-spacing: .03em; }
.banner span { display: block; font-size: 24px; font-weight: 800; }
@keyframes banner {
  0% { opacity: 0; transform: translateX(-50%) scale(.5); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.12); }
  35% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-22px); }
}
.beam, .blast { position: absolute; pointer-events: none; opacity: 0; }
.beam { border-radius: 99px; background: linear-gradient(90deg, transparent, #fff, #ffb36b, transparent); box-shadow: 0 0 16px #ff8a5c; animation: beamH .55s ease-out forwards; }
.beam.v { background: linear-gradient(180deg, transparent, #fff, #ffb36b, transparent); animation-name: beamV; }
@keyframes beamH { 0% { opacity: 0; transform: scaleX(.2); } 20% { opacity: 1; } 100% { opacity: 0; transform: scaleX(1); } }
@keyframes beamV { 0% { opacity: 0; transform: scaleY(.2); } 20% { opacity: 1; } 100% { opacity: 0; transform: scaleY(1); } }
.blast { border-radius: 50%; border: 3px solid #ffd36b; box-shadow: 0 0 26px #ffb84d; animation: blast .5s ease-out forwards; }
@keyframes blast { 0% { opacity: 1; transform: scale(.2); } 100% { opacity: 0; transform: scale(1.1); } }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* ---------- Fenêtres (feuilles) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 16px);
  background: rgba(4, 5, 16, 0.72);
}
.sheet {
  position: relative; width: min(100%, 400px); max-height: 100%; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
  padding: var(--s5); border-radius: var(--r-xl);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(124,108,255,.12);
  animation: sheetIn .28s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.sheet.center { text-align: center; }
.sheet h2 { margin: 0 0 var(--s4); font-size: 24px; font-weight: 900; }
.close {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px;
  border: 0; background: none; font-size: 28px; color: var(--muted); cursor: pointer;
}
.stack { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s4); }
.row { display: flex; gap: var(--s2); margin-top: var(--s4); }
.row .btn { flex: 1; }
.note { color: var(--muted); font-size: 14px; line-height: 1.45; }
.final {
  font-size: 56px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, var(--gold), #ff7a8c); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.record { margin: var(--s1) 0 0; font-weight: 800; color: var(--muted); }
.record.new { color: var(--gold); font-size: 18px; animation: bump .5s ease-out; }
.mini-stats, .stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin: var(--s4) 0 0; }
.stats-grid { grid-template-columns: repeat(2, 1fr); }
.mini-stats div, .stats-grid div { padding: 10px 6px; border-radius: var(--r-sm); background: rgba(255,255,255,.05); text-align: center; }
.mini-stats dt, .stats-grid dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.mini-stats dd, .stats-grid dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.help { margin: 0 0 var(--s4); padding-left: 1.1em; line-height: 1.5; font-size: 15px; display: flex; flex-direction: column; gap: 8px; }
.settings { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s4); }
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  min-height: 52px; padding: 0 2px; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 600;
}
.toggle span { display: flex; flex-direction: column; }
.toggle small { font-size: 12px; color: var(--muted); font-weight: 500; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { position: relative; flex: 0 0 auto; width: 50px; height: 30px; border-radius: 99px; background: rgba(255,255,255,.15); transition: background-color .2s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.toggle input:checked + i { background: var(--accent-2); }
.toggle input:checked + i::after { transform: translateX(20px); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.toggle input:disabled + i { opacity: .4; }
.version { text-align: center; margin: var(--s4) 0 0; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 16px); transform: translateX(-50%); z-index: 200;
  display: flex; align-items: center; gap: var(--s3); padding: 10px 10px 10px 16px;
  border-radius: 99px; background: var(--ink-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.noscript { padding: 24px; text-align: center; }

/* Petits écrans (iPhone SE) */
@media (max-height: 700px) {
  .score { font-size: 28px; }
  .bonus { min-height: 40px; padding: 4px 10px; }
  .logo { font-size: 38px; }
  .menu { gap: var(--s4); }
}

/* Animations réduites : préférence système OU réglage du jeu */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

/* =====================================================================
   Profil, avatar, espace social (v1.1)
   ===================================================================== */
.avatar-img { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; }
.avatar-img.sm { width: 28px; height: 28px; }
.avatar-img.large { width: 84px; height: 84px; }
.avatar-img.big { width: 150px; height: 150px; box-shadow: 0 0 0 3px rgba(255,255,255,.08), 0 16px 40px rgba(0,0,0,.45); }
@media (max-height: 700px) { .avatar-img.big { width: 112px; height: 112px; } }

.player-chip {
  position: absolute; top: calc(var(--safe-t) + 10px); right: calc(var(--safe-r) + 12px); z-index: 5;
  appearance: none; display: flex; align-items: center; gap: 8px; max-width: 60vw;
  padding: 4px 14px 4px 4px; min-height: 44px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: rgba(255,255,255,.06); cursor: pointer;
  font-weight: 700; font-size: 15px;
}
.player-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-chip:active { transform: scale(.97); }

.menu-grid.four { grid-template-columns: repeat(2, 1fr); }
.menu-grid.four .btn { flex-direction: row; justify-content: center; gap: 8px; font-size: 15px; padding: 12px 6px; position: relative; }
.badge { position: absolute; top: 6px; right: 8px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--danger); font-size: 12px; line-height: 20px; }
.linklike { appearance: none; background: none; border: 0; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 40px; }

/* Premier lancement */
#screenWelcome { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.welcome { width: min(100%, 440px); display: flex; flex-direction: column; gap: var(--s3); padding-bottom: var(--s5); margin: auto 0; }
.welcome-title { margin: var(--s2) 0 0; text-align: center; font-size: 30px; font-weight: 900; }
.center { text-align: center; margin: 0; }
.avatar-stage { display: grid; place-items: center; padding: var(--s2) 0; }

/* Éditeur d'avatar */
.avatar-editor { display: flex; flex-direction: column; gap: var(--s2); }
.ed-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.ed-cats::-webkit-scrollbar { display: none; }
.ed-cat { appearance: none; flex: 0 0 auto; min-height: 36px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: transparent; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; }
.ed-cat[aria-selected="true"] { color: var(--text); background: rgba(124,108,255,.22); border-color: rgba(124,108,255,.6); }
.ed-opts { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; align-content: flex-start; }
.ed-sub { width: 100%; font-size: 12px; color: var(--muted); margin: 4px 0 -2px; }
.ed-chip { appearance: none; min-height: 44px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: rgba(255,255,255,.05); font-weight: 600; font-size: 14px; cursor: pointer; }
.ed-chip[aria-pressed="true"] { border-color: var(--accent-2); background: rgba(62,230,209,.14); }
.ed-swatch { appearance: none; width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.ed-swatch[aria-pressed="true"] { border-color: #fff; }
.ed-random { align-self: flex-start; }

.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: rgba(0,0,0,.3); color: var(--text);
  font: inherit; font-size: 17px; /* ≥ 16 px : pas de zoom automatique sur iPhone */
  -webkit-user-select: text; user-select: text;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.input.code { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.name-form { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s2); }
.field-msg { min-height: 18px; margin: 0; font-size: 13px; color: #ffb3bd; }
.field-msg.ok { color: #9ff5e6; }

/* Profil */
.sheet.tall { width: min(100%, 440px); }
.profile-head { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s3); padding-right: 36px; }
.profile-head h2 { margin: 0; font-size: 22px; word-break: break-word; }
.profile-head small { color: var(--muted); font-weight: 600; font-size: 14px; }
.profile-head .note { margin: 4px 0 0; }
.row.tight { margin-top: 0; }
.section-title { margin: var(--s5) 0 var(--s2); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.stats-grid { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
.stats-grid dd { font-size: 17px; }
.spark { height: 72px; border-radius: var(--r-sm); background: rgba(255,255,255,.04); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.spark svg { width: 100%; height: 100%; }
.game-list, .people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.game-list li { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(255,255,255,.04); font-variant-numeric: tabular-nums; }
.game-list li span { color: var(--muted); font-size: 13px; }
.game-list li b.best { color: var(--gold); }

/* Social */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: var(--r-md); background: rgba(255,255,255,.05); margin-bottom: var(--s4); }
.tab { appearance: none; min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--ink-1); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.social-body { display: flex; flex-direction: column; gap: var(--s3); min-height: 200px; }
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: rgba(255,255,255,.04); min-height: 52px; }
.people li.me { outline: 1px solid rgba(124,108,255,.6); }
.people .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.people .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .who small { color: var(--muted); font-size: 12px; }
.people .rank { width: 26px; text-align: center; font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.people .rank.r1 { color: var(--gold); }
.people .score { font-weight: 800; font-variant-numeric: tabular-nums; }
.people .acts { display: flex; gap: 6px; }
.icon-mini { appearance: none; min-width: 40px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.05); font-size: 15px; cursor: pointer; }
.code-box { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); border: 1px dashed rgba(62,230,209,.5); background: rgba(62,230,209,.06); }
.code-box code { flex: 1; font-size: 20px; font-weight: 800; letter-spacing: .14em; color: #b9fff5; background: none; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; min-width: 0; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: var(--s4) 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.group-card { padding: 12px; border-radius: var(--r-md); background: rgba(255,255,255,.04); display: flex; flex-direction: column; gap: 10px; }
.group-card header { display: flex; align-items: center; gap: 10px; }
.group-card header b { flex: 1; font-size: 17px; }
.group-icon { font-size: 26px; }
.status-line { padding: 10px 12px; border-radius: var(--r-sm); background: rgba(62,230,209,.12); font-size: 14px; }
.status-line.error { background: rgba(255,90,110,.15); }
