:root {
  --bg: #0d0b1e;
  --bg-2: #1a1638;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #f4f1ff;
  --muted: #a9a3c9;
  --accent: #ffcf3f;
  --accent-2: #ff4f8b;
  --accent-3: #4fd1ff;
  --good: #3ee08f;
  --bad: #ff5b5b;
  --radius: 18px;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--body);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 79, 139, 0.25), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(79, 209, 255, 0.18), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: 0.35; cursor: not-allowed; }
h1, h2 { margin: 0; }

#confetti[hidden] { display: none; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; width: 100%; height: 100%; }

/* ---------- écrans ---------- */
.screen { display: none; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.screen.active { display: flex; flex-direction: column; align-items: center; animation: screenIn 0.45s ease both; }
@keyframes screenIn { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
#screen-home.active, #screen-end.active { justify-content: center; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.kicker { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.75rem; color: var(--muted); margin: 0 0 8px; font-weight: 600; }

/* ---------- accueil ---------- */
.home-card, .end-card {
  width: 100%; max-width: 560px; text-align: center;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 28px; padding: 36px 28px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.logo {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(3rem, 12vw, 5rem); line-height: 0.95; letter-spacing: -0.03em;
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 60%, var(--accent-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo span { font-weight: 500; }
.pitch { color: var(--muted); line-height: 1.5; margin: 16px auto 28px; max-width: 40ch; }

.option-group { margin-bottom: 22px; }
.option-group h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
  border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.04);
  transition: all 0.18s ease;
}
.chip:hover { border-color: var(--accent); }
.chip.selected { background: var(--accent); color: #1a1208; border-color: var(--accent); }

.btn-primary {
  background: linear-gradient(180deg, #ffe07a, var(--accent));
  color: #1a1208; font-weight: 800; font-family: var(--display);
  padding: 14px 26px; border-radius: 14px; font-size: 1.05rem;
  box-shadow: 0 6px 0 #c98f00, 0 14px 30px rgba(255, 207, 63, 0.25);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #c98f00, 0 6px 14px rgba(255, 207, 63, 0.2); }
.btn-primary.big { font-size: 1.35rem; padding: 16px 48px; margin-top: 8px; }

.btn-ghost {
  padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 0.92rem;
  border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); }
.btn-ghost small { color: var(--accent-2); font-weight: 700; margin-left: 2px; }

.best { color: var(--accent); font-family: var(--mono); margin: 18px 0 0; min-height: 1.2em; }

.link-btn { margin-top: 18px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.link-btn:hover { color: var(--text); }

/* barre du haut en jeu */
.topbar { width: 100%; max-width: 720px; display: flex; justify-content: space-between; margin-bottom: 14px; }
.btn-ghost.small { padding: 7px 12px; font-size: 0.85rem; }

/* fenêtres (règles, quitter) */
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  padding: 28px 26px; border-radius: 24px; color: var(--text);
  background: #1b1736; border: 1px solid var(--card-border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal.small { width: min(420px, calc(100vw - 32px)); }
.modal[open] { animation: fadeUp 0.25s ease both; }
.modal::backdrop { background: rgba(5, 4, 15, 0.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal h2 { font-family: var(--display); font-weight: 800; font-size: 1.6rem; margin-bottom: 8px; }
.modal h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent); margin: 18px 0 6px; }
.modal ul { padding-left: 20px; margin: 0; line-height: 1.65; color: var(--muted); }
.modal b { color: var(--text); }
.modal p { color: var(--muted); line-height: 1.5; }
.modal-note { font-size: 0.85rem; font-style: italic; margin: 16px 0 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
.btn-primary.danger { background: linear-gradient(180deg, #ff8080, var(--bad)); color: #2b0606; box-shadow: 0 6px 0 #b32d2d; }

/* ---------- jeu ---------- */
.hud {
  width: 100%; max-width: 720px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
}
.hud-item { display: flex; flex-direction: column; }
.hud-item.score { align-items: flex-end; }
.hud-item.streak { align-items: center; padding: 4px 14px; border-radius: 999px; transition: all 0.3s ease; }
.hud-item.streak.hot { background: rgba(255, 79, 139, 0.18); box-shadow: 0 0 24px rgba(255, 79, 139, 0.4); }
.hud-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 600; }
.hud-value { font-family: var(--mono); font-size: 1.5rem; }
.score .hud-value { color: var(--accent); }
.hud-value.bump { animation: bump 0.4s ease; }
@keyframes bump { 40% { transform: scale(1.3); } }

.progress { width: 100%; max-width: 720px; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); margin: 14px 0 22px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.5s ease; }

.stage { width: 100%; max-width: 720px; display: flex; flex-direction: column; align-items: center; gap: 18px; }

.photo-wrap {
  position: relative; width: min(340px, 78vw); aspect-ratio: 1;
  border-radius: 26px; overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 0 8px rgba(255, 255, 255, 0.03);
  background: var(--bg-2);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.photo-wrap img:not([src]) { visibility: hidden; }
.photo-wrap img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; display: block; user-select: none; animation: reveal 0.6s ease both; }
@keyframes reveal { from { filter: blur(18px) saturate(0); transform: scale(1.08); } to { filter: none; transform: none; } }
.photo-wrap.good { border-color: var(--good); box-shadow: 0 0 0 6px rgba(62, 224, 143, 0.25), 0 25px 60px rgba(0, 0, 0, 0.55); }
.photo-wrap.bad { border-color: var(--bad); }
.photo-wrap.shake { animation: shake 0.4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }

.badge, .timer {
  position: absolute; top: 12px; padding: 5px 12px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.badge { left: 12px; background: rgba(13, 11, 30, 0.7); border: 1px solid rgba(255, 255, 255, 0.2); }
.timer { right: 12px; background: rgba(79, 209, 255, 0.85); color: #04202b; font-family: var(--mono); }
.timer.zero { background: rgba(255, 255, 255, 0.25); color: var(--text); }

.gain {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 3.2rem; color: #fff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.8); opacity: 0; pointer-events: none;
}
.gain { align-content: center; text-align: center; }
.gain small { display: block; font-family: var(--body); font-size: 1rem; font-weight: 600; color: var(--accent); }
.gain.show { animation: gainPop 1.4s ease forwards; }
@keyframes gainPop { 0% { opacity: 0; transform: scale(0.5); } 20% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: translateY(-30px); } }

.hint { margin: 0; color: var(--accent); font-style: italic; text-align: center; max-width: 46ch; line-height: 1.45; animation: fadeUp 0.3s ease; }

/* traits du pendu */
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; max-width: 100%; }
.word { display: flex; gap: 5px; }
.slot {
  width: clamp(20px, 5.2vw, 32px); height: clamp(30px, 7.5vw, 42px);
  display: grid; place-items: end center;
  font-family: var(--mono); font-size: clamp(1.05rem, 4.6vw, 1.55rem); text-transform: uppercase;
  border-bottom: 3px solid rgba(255, 255, 255, 0.55); padding-bottom: 2px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.slot.typed { border-color: var(--accent-3); }
.slot.revealed { color: var(--accent-2); border-color: var(--accent-2); }
.slot.revealed.typed { color: var(--text); }
.slot.punct { border-color: transparent; width: auto; min-width: 10px; color: var(--muted); }
.slot.flip { animation: flip 0.5s ease both; }
.slot.win { color: var(--good); border-color: var(--good); }
.slot.lose { color: var(--bad); border-color: var(--bad); }
@keyframes flip { 0% { transform: rotateX(90deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

.answer { display: flex; gap: 10px; width: 100%; max-width: 480px; }
.answer input {
  flex: 1; min-width: 0; padding: 14px 18px; border-radius: 14px; font-size: 1.05rem; font-family: var(--body);
  color: var(--text); background: rgba(255, 255, 255, 0.07); border: 2px solid var(--card-border); outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.answer input:focus { border-color: var(--accent-3); background: rgba(255, 255, 255, 0.1); }
.answer input::placeholder { color: var(--muted); }

/* quiz date de naissance */
.birth-quiz { width: 100%; max-width: 520px; text-align: center; animation: fadeUp 0.35s ease; }
.bq-title { margin: 0 0 12px; font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.bq-title small { color: var(--accent); font-family: var(--mono); font-size: 0.9rem; margin-left: 4px; }
.bq-options { display: grid; gap: 10px; }
.bq-option {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 16px; border-radius: 14px; font-weight: 600; font-size: 1.02rem;
  background: rgba(255, 255, 255, 0.06); border: 2px solid var(--card-border);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.bq-option:hover:not(:disabled), .bq-option:focus-visible { border-color: var(--accent-3); background: rgba(79, 209, 255, 0.1); outline: none; }
.bq-option:active:not(:disabled) { transform: scale(0.98); }
.bq-option:disabled { cursor: default; opacity: 0.55; }
.bq-option.right { opacity: 1; border-color: var(--good); background: rgba(62, 224, 143, 0.15); }
.bq-option.wrong { opacity: 1; border-color: var(--bad); background: rgba(255, 91, 91, 0.15); animation: shake 0.4s ease; }
.bq-key {
  flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.8rem; background: rgba(255, 255, 255, 0.1); color: var(--muted);
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.next { animation: fadeUp 0.3s ease; }
.credit { font-size: 0.72rem; color: var(--muted); text-decoration: none; opacity: 0.7; }
.credit:hover { text-decoration: underline; }

/* ---------- fin ---------- */
.final-score { font-family: var(--display); font-weight: 800; font-size: clamp(4rem, 18vw, 6.5rem); line-height: 1; color: var(--accent); }
.final-score small { font-size: 1.4rem; color: var(--muted); margin-left: 6px; }
.end-stats { color: var(--muted); margin: 10px 0 0; }
.new-record { color: var(--accent-2); font-weight: 800; font-size: 1.15rem; margin: 10px 0 0; animation: bump 0.6s ease 2; }
.end-buttons { display: flex; gap: 12px; justify-content: center; align-items: center; margin: 24px 0 8px; flex-wrap: wrap; }
.recap-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 24px 0 12px; }
.recap { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; text-align: left; }
.recap li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--good); }
.recap li.missed { border-left-color: var(--bad); }
.recap img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; object-position: 50% 22%; flex: none; }
.recap .r-name { font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.recap .r-pts { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }

@media (max-width: 520px) {
  .home-card, .end-card { padding: 28px 18px; border-radius: 22px; }
  .hud-value { font-size: 1.2rem; }
  .answer .btn-primary { padding: 14px 16px; }
  .btn-ghost { padding: 9px 12px; font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =========================================================
   AVATARS & ROUTE DES STARS
   ========================================================= */
#screen-avatar.active { justify-content: center; }
.btn-primary.full { width: 100%; margin-top: 4px; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.name-tag {
  font-family: var(--mono); font-weight: 700; font-size: 10px; line-height: 1;
  color: #1a1208; background: var(--accent); padding: 3px 7px; border-radius: 999px; white-space: nowrap;
  position: relative;
}
.name-tag.big { font-size: 14px; padding: 5px 12px; }
.name-tag.big::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 7px solid var(--accent);
}

/* écran avatar */
.avatar-card {
  width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 18px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 28px; padding: 22px 20px 24px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.avatar-top { display: flex; justify-content: space-between; align-items: center; }
.avatar-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.avatar-head .kicker { margin-bottom: 6px; }
.avatar-title { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: -0.02em; }

.avatar-stage {
  position: relative; height: 236px; border-radius: 24px; overflow: hidden; border: 1px solid var(--card-border);
  background: radial-gradient(160px 140px at 50% 105%, rgba(255, 207, 63, 0.35), transparent 70%), rgba(255, 255, 255, 0.05);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 18px; box-sizing: border-box;
}
.avatar-spot {
  position: absolute; top: 0; left: 50%; width: 220px; height: 100%; transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 207, 63, 0.16), transparent 85%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
}
.avatar-preview { position: relative; display: flex; flex-direction: column; align-items: center; }
.avatar-preview img { width: 132px; height: 132px; margin-top: 10px; animation: avatarPop 0.35s ease; }
.avatar-label { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
@keyframes avatarPop { from { transform: scale(0.85); opacity: 0.4; } to { transform: none; opacity: 1; } }

.avatar-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.avatar-choice {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 6px; min-height: 44px;
  border-radius: 16px; border: 2px solid rgba(255, 255, 255, 0.10); background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.avatar-choice img { width: 46px; height: 46px; }
.avatar-choice span { font-size: 11px; font-weight: 700; color: var(--muted); }
.avatar-choice:hover { border-color: rgba(255, 207, 63, 0.5); }
.avatar-choice[aria-pressed="true"] { border-color: var(--accent); background: rgba(255, 207, 63, 0.14); }
.avatar-choice[aria-pressed="true"] span { color: var(--accent); }

.pseudo-form { display: flex; flex-direction: column; gap: 8px; }
.pseudo-row { display: flex; justify-content: space-between; align-items: baseline; }
.pseudo-row label { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.pseudo-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
#pseudo {
  font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--text); height: 54px; padding: 0 16px;
  border-radius: 14px; border: 2px solid var(--card-border); background: rgba(255, 255, 255, 0.06); outline: none;
  box-sizing: border-box; width: 100%;
}
#pseudo:focus, #pseudo.filled { border-color: rgba(255, 207, 63, 0.6); }
#pseudo::placeholder { color: #8a84ad; }
.pseudo-help { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--muted); }

/* bandeau route (en partie et en fin) */
.road-card {
  width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 10px; padding: 10px;
  border-radius: 20px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.05);
  margin: 12px 0 20px; box-sizing: border-box;
}
.road { position: relative; width: 100%; aspect-ratio: 720 / 200; border-radius: 12px; overflow: hidden; }
#screen-game .road-card { max-width: 560px; }
.road-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.road-mark {
  position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.55); background: var(--bg); transition: all 0.4s ease;
}
.road-mark.on { border-color: var(--accent); background: var(--accent); }
.road-avatar {
  position: absolute; left: 5.56%; top: 80%; transform: translate(-50%, -100%);
  display: flex; flex-direction: column; align-items: center;
  transition: left 0.8s cubic-bezier(.3, 1.3, .5, 1), top 0.8s cubic-bezier(.3, 1.3, .5, 1);
}
.road-avatar img { width: clamp(30px, 7vw, 46px); height: clamp(30px, 7vw, 46px); margin-top: 1px; }
.road-avatar.hop img { animation: hop 0.5s ease; }
@keyframes hop { 40% { transform: translateY(-8px); } }

.rank-row { display: flex; align-items: center; gap: 10px; }
.rank-pill {
  font-family: var(--display); font-weight: 800; font-size: 15px; color: #1a1208; background: var(--accent);
  padding: 4px 10px; border-radius: 8px; white-space: nowrap;
}
.rank-progress { flex-grow: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rank-next { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.rank-bar-fill { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.6s ease; }

/* fin de partie */
.end-road { margin: 22px 0 4px; }
.end-rank { margin: 4px 0 0; font-family: var(--display); font-weight: 800; font-size: 22px; }
.end-rank b { color: var(--accent); }
.end-rank-sub { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
#btn-change-avatar { margin-top: 4px; }

/* règles : paliers */
.rules-p { color: var(--muted); line-height: 1.5; margin: 0 0 6px; }
.rules-p.small { font-size: 0.82rem; font-style: italic; margin-top: 6px; }
.tiers-list { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.tiers-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.tiers-list li span:last-child { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); }

/* fenêtre palier franchi */
.tier-modal { text-align: center; overflow-x: hidden; }
.tier-modal .modal-actions { justify-content: stretch; }
.tier-kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--good) !important; }
.tier-hero { position: relative; width: 190px; height: 170px; margin: 8px auto 4px; display: flex; align-items: center; justify-content: center; }
.tier-rays {
  position: absolute; inset: -20px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 207, 63, 0.22) 0deg 10deg, transparent 10deg 30deg);
  -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 70%); mask-image: radial-gradient(circle, #000 30%, transparent 70%);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tier-avatar { position: relative; display: flex; flex-direction: column; align-items: center; }
.tier-avatar img { width: 128px; height: 128px; margin-top: 10px; animation: avatarPop 0.5s ease; }
.tier-name-wrap { display: flex; flex-direction: column; gap: 2px; }
.tier-becomes { font-size: 16px; color: var(--muted); }
.modal h2.tier-name {
  margin: 0; font-size: 54px; line-height: 1; letter-spacing: -0.03em;
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 70%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tier-text { margin: 12px auto 0; max-width: 30ch; font-size: 15px; }
.tier-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 14px; }
.tier-step { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.tier-step i { width: 100%; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.14); }
.tier-step.on i { background: var(--accent); }
.tier-step.here i { box-shadow: 0 0 12px rgba(255, 207, 63, 0.8); }
.tier-step span { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tier-step.here span { color: var(--accent); font-weight: 700; }
.tier-next { margin: 12px 0 0; font-family: var(--mono); font-size: 13px; }

@media (max-width: 520px) {
  .road-card { margin: 10px 0 14px; padding: 8px; }
  .avatar-title { font-size: 30px; }
  .avatar-stage { height: 210px; }
  .avatar-preview img { width: 112px; height: 112px; }
  .modal h2.tier-name { font-size: 44px; }
}

/* =========================================================
   MISE EN PAGE : tout l'écran visible sans défiler
   ========================================================= */
/* mobile / par défaut : la colonne de jeu se fond dans la pile, la route passe au-dessus de la photo */
.play-col, .side-col, .center-col { display: contents; }
.side-col .road-card { margin: 0; }

/* nom du site */
.logo { text-transform: uppercase; letter-spacing: 0.01em; white-space: nowrap; font-size: clamp(1.6rem, 7.2vw, 3.1rem); }
.topbar { align-items: center; gap: 10px; }
.game-logo {
  margin: 0; min-width: 0; text-align: center;
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(1.05rem, 4.6vw, 2.1rem); letter-spacing: 0.1em; line-height: 1;
  background: linear-gradient(100deg, var(--accent) 5%, var(--accent-2) 55%, var(--accent-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 14px rgba(255, 79, 139, 0.35));
}
.avatar-body, .avatar-side { display: flex; flex-direction: column; gap: 18px; }

@media (min-width: 960px) {
  /* --- écran de jeu : progression | photo (centrée) | commandes --- */
  #screen-game { height: 100vh; height: 100dvh; min-height: 0; padding: 14px 28px 18px; box-sizing: border-box; }
  #screen-game .topbar {
    position: static; width: 100%; max-width: none; margin: 0;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  }
  #screen-game .topbar #btn-quit { justify-self: start; }
  #screen-game .topbar [data-open-rules] { justify-self: end; }
  .game-logo { font-size: clamp(1.6rem, 2.6vw, 2.5rem); letter-spacing: 0.14em; }
  #screen-game .stage {
    flex: 1; min-height: 0; width: 100%; max-width: 1500px; margin-top: 10px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center; gap: clamp(20px, 2.8vw, 44px);
  }
  /* colonne centrale : photo + traits du nom juste en dessous */
  .center-col { display: flex; flex-direction: column; align-items: center; gap: 16px; }
  #screen-game .photo-wrap { width: min(calc(100vh - 230px), calc(100dvh - 230px), 600px, 40vw); }
  .center-col .slots { width: 100%; max-width: 100%; gap: 8px 16px; min-height: 40px; }
  .center-col .word { gap: 4px; }
  .center-col .slot { width: clamp(18px, 1.7vw, 28px); height: 38px; font-size: clamp(1rem, 1.5vw, 1.45rem); }
  .center-col .slot.punct { width: auto; }

  /* colonne gauche : progression, volontairement discrète */
  .side-col { display: flex; flex-direction: column; gap: 12px; justify-self: end; width: min(280px, 100%); }
  .side-col .hud {
    max-width: none; padding: 10px 14px; border-radius: 16px;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border);
  }
  .side-col .hud-value { font-size: 1.2rem; }
  .side-col .road-card { max-width: none; padding: 8px; gap: 8px; border-radius: 16px; }
  .side-col .rank-pill { font-size: 13px; padding: 3px 8px; }
  .side-col .rank-next { font-size: 11px; }

  /* colonne droite : saisie et actions */
  .play-col {
    display: flex; flex-direction: column; align-items: stretch; gap: 12px;
    justify-self: start; width: min(400px, 100%); max-height: 100%;
  }
  .play-col .hint { text-align: left; margin: 0; }
  .play-col .answer, .play-col .birth-quiz { max-width: none; }
  .play-col .birth-quiz { text-align: left; }
  .play-col .actions { justify-content: flex-start; }
  .play-col .next { align-self: flex-start; }
  .play-col .credit { align-self: flex-start; }

  /* --- écran avatar : aperçu à gauche, choix à droite --- */
  .avatar-card { max-width: 880px; padding: 22px 26px 26px; }
  .avatar-body { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: stretch; }
  .avatar-stage { height: auto; min-height: 300px; }
  .avatar-preview img { width: 150px; height: 150px; }

  /* --- fin de partie : résumé à gauche, récapitulatif défilant à droite --- */
  #screen-end.active { height: 100vh; height: 100dvh; min-height: 0; box-sizing: border-box; padding: 18px 28px; }
  .end-card {
    max-width: 1100px; max-height: 100%; box-sizing: border-box; padding: 26px 30px;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: stretch;
  }
  .end-main { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
  .end-main .end-road { margin: 14px 0 0; }
  .end-main .end-buttons { margin: 18px 0 4px; }
  .end-side { display: flex; flex-direction: column; min-height: 0; text-align: left; }
  .end-side .recap-title { margin: 0 0 12px; text-align: center; }
  .end-side .recap { overflow-y: auto; min-height: 0; padding-right: 4px; align-content: start; }
}

/* fenêtres basses (portables) : on resserre verticalement */
@media (min-width: 960px) and (max-height: 820px) {
  #screen-game .stage { margin-top: 8px; }
  .play-col { gap: 10px; }
  .center-col .slot { height: 32px; }
  .play-col .answer input { padding: 11px 16px; }
  .play-col .answer .btn-primary { padding: 11px 20px; }
  .play-col .btn-ghost { padding: 8px 13px; }
  .play-col .bq-title { margin-bottom: 8px; font-size: 1.05rem; }
  .play-col .bq-options { gap: 8px; }
  .play-col .bq-option { padding: 9px 14px; }
  .play-col .next { padding: 11px 22px; }

  .home-card { padding: 24px 28px; }
  .logo { font-size: clamp(1.8rem, 6.4vh, 3.1rem); }
  .home-card .link-btn { margin-top: 10px; }
  .home-card .credits { margin-top: 6px; }
  .pitch { margin: 10px auto 18px; }
  .option-group { margin-bottom: 14px; }
  .btn-primary.big { padding: 13px 44px; }

  .final-score { font-size: clamp(3.4rem, 12vh, 5.5rem); }
  .avatar-head .avatar-title { font-size: 30px; }
  .avatar-stage { min-height: 260px; }
}

/* tiret / apostrophe centrés par rapport aux traits */
.slot.punct { place-items: center; padding-bottom: 0; }

/* mobile / tablette : le titre TROMBINOSCOPE passe sur sa propre ligne, au-dessus des boutons */
@media (max-width: 959px) {
  #screen-game .topbar { flex-wrap: wrap; row-gap: 10px; }
  #screen-game .game-logo { order: -1; width: 100%; font-size: clamp(1.4rem, 7vw, 2.2rem); letter-spacing: 0.08em; }
}

/* crédits */
.credits { margin: 14px 0 0; font-size: 0.75rem; letter-spacing: 0.04em; color: var(--muted); opacity: 0.8; text-align: center; }
.modal .credits { margin-top: 18px; }

/* =========================================================
   CLASSEMENT EN LIGNE
   ========================================================= */
.home-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 22px; }
.home-links .link-btn { margin-top: 18px; }
.board-sub { margin: 0 0 14px; }
.board-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.board-list { list-style: none; padding: 0 !important; margin: 0; display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.board-list li {
  display: grid; grid-template-columns: 34px 36px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05);
}
.board-list li.me { background: rgba(255, 207, 63, 0.14); outline: 1px solid rgba(255, 207, 63, 0.5); }
.board-rank { font-family: var(--mono); font-size: 0.95rem; color: var(--muted); text-align: center; }
.board-list li:nth-child(1) .board-rank { color: var(--accent); font-size: 1.15rem; }
.board-list li:nth-child(2) .board-rank, .board-list li:nth-child(3) .board-rank { color: var(--text); }
.board-list img { width: 36px; height: 36px; }
.board-name { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-family: var(--mono); color: var(--accent); }
.board-status { margin: 10px 0 0; font-size: 0.9rem; }
.board-note { margin: 12px 0 0; font-size: 0.78rem; font-style: italic; }
.end-board { margin: 12px 0 0; text-align: center; }
.end-board-text { margin: 0; font-weight: 600; color: var(--text); }
.end-board-text b { color: var(--accent); }
.end-board .link-btn { margin-top: 4px; }

/* =========================================================
   ENTRE AMIS : rooms privées
   ========================================================= */
#screen-friends.active, #screen-lobby.active, #screen-podium.active { justify-content: center; }
.play-buttons { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.friends-btn { font-size: 1rem; padding: 12px 22px; }

.friends-card {
  width: 100%; max-width: 760px; display: flex; flex-direction: column; gap: 18px; box-sizing: border-box;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 28px; padding: 22px 22px 26px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.friends-card .kicker { margin-bottom: 6px; }
.friends-pitch { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.me-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; min-height: 44px; border-radius: 999px;
  border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.05); font-weight: 700;
}
.me-chip img { width: 34px; height: 34px; }
.me-chip:hover { border-color: var(--accent); }

.friends-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .friends-grid { grid-template-columns: 1fr 1fr; } }
.friends-box {
  display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border);
}
.friends-box h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 600; }
.friends-box .chips { justify-content: flex-start; }
.friends-box .btn-primary.full { margin-top: auto; }
.friends-help { margin: 0; font-size: 0.88rem; color: var(--muted); }
.friends-error { margin: 0; min-height: 1.2em; color: var(--bad); font-weight: 600; text-align: center; }
.code-input {
  font-family: var(--mono); font-size: 1.8rem; letter-spacing: 0.4em; text-transform: uppercase; text-align: center;
  height: 58px; border-radius: 14px; border: 2px solid var(--card-border); background: rgba(255, 255, 255, 0.06);
  color: var(--text); outline: none; padding: 0 0 0 0.4em; box-sizing: border-box; width: 100%;
}
.code-input:focus { border-color: var(--accent-3); }

/* salle d'attente */
.lobby-code-wrap { text-align: center; }
.lobby-code {
  font-family: var(--mono); font-weight: 700; font-size: clamp(2.6rem, 11vw, 4.2rem); letter-spacing: 0.25em;
  padding-left: 0.25em; color: var(--accent); text-shadow: 0 0 30px rgba(255, 207, 63, 0.35);
}
.lobby-sub { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 600; }
.lobby-players { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.lobby-players li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05); font-weight: 700; animation: avatarPop 0.35s ease;
}
.lobby-players li.me { outline: 1px solid rgba(255, 207, 63, 0.6); background: rgba(255, 207, 63, 0.1); }
.lobby-players img { width: 36px; height: 36px; flex: none; }
.lobby-players span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-players small { color: var(--accent); font-weight: 600; margin-left: auto; font-size: 0.7rem; }

/* classement de la room pendant la partie */
.room-board {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border);
}
.room-board-title { margin: 0 0 8px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 600; }
.room-board-title b { color: var(--accent); font-family: var(--mono); letter-spacing: 0.1em; }
.room-board-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; max-height: 46vh; overflow-y: auto; }
.room-board-list li {
  display: grid; grid-template-columns: 18px 28px minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 10px; font-size: 0.9rem;
}
.room-board-list li.me { background: rgba(255, 207, 63, 0.12); }
.room-board-list img { width: 28px; height: 28px; }
.rb-rank { font-family: var(--mono); color: var(--muted); font-size: 0.8rem; text-align: center; }
.rb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-mark { font-size: 0.8rem; min-width: 1.4em; text-align: center; }
.rb-mark.found { color: var(--good); }
.rb-mark.miss { color: var(--bad); }
.rb-score { font-family: var(--mono); color: var(--accent); font-size: 0.85rem; }
.room-status {
  margin: 0; padding: 10px 14px; border-radius: 12px; font-weight: 600; text-align: center;
  background: rgba(79, 209, 255, 0.12); border: 1px solid rgba(79, 209, 255, 0.35);
}
.room-status.countdown { font-family: var(--display); font-size: 1.4rem; background: rgba(255, 207, 63, 0.14); border-color: rgba(255, 207, 63, 0.5); }
#screen-game.room-mode .road-card { display: none; }

/* podium */
.podium-card { max-width: 560px; text-align: center; }
.podium-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.podium-list li {
  display: grid; grid-template-columns: 40px 44px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.05);
}
.podium-list li:first-child { background: linear-gradient(90deg, rgba(255, 207, 63, 0.25), rgba(255, 207, 63, 0.05)); outline: 1px solid rgba(255, 207, 63, 0.6); }
.podium-list li.me { outline: 2px solid var(--accent-3); }
.podium-list .pd-rank { font-size: 1.5rem; text-align: center; font-family: var(--mono); color: var(--muted); }
.podium-list img { width: 44px; height: 44px; }
.podium-list .pd-name { font-weight: 800; font-family: var(--display); font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-list .pd-score { font-family: var(--mono); color: var(--accent); }
.podium-list .pd-sub { display: block; font-family: var(--body); font-weight: 400; font-size: 0.8rem; color: var(--muted); }

@media (min-width: 960px) {
  #screen-friends.active, #screen-lobby.active, #screen-podium.active { min-height: 0; height: 100vh; height: 100dvh; box-sizing: border-box; }
  .friends-card { max-height: 100%; overflow-y: auto; }
}

/* podium : détail des points */
.podium-list li { display: block; padding: 0; }
.pd-details > summary { list-style: none; cursor: pointer; }
.pd-details > summary::-webkit-details-marker { display: none; }
.pd-row { display: grid; grid-template-columns: 40px 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; }
.pd-details[open] .pd-sub { color: var(--accent-3); }
.pd-body { padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 12px; }
.pd-sum { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; margin: 0; font-size: 0.92rem; }
.pd-sum dt { color: var(--text); font-weight: 600; }
.pd-sum dt small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.pd-sum dd { margin: 0; font-family: var(--mono); color: var(--accent); text-align: right; align-self: center; }
.pd-sum .total { border-top: 1px solid var(--card-border); padding-top: 6px; font-size: 1.02rem; }
.pd-rounds { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; font-size: 0.8rem; max-height: 220px; overflow-y: auto; }
.pd-rounds li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; padding: 3px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.03); }
.pd-rounds .pr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pd-rounds .pr-info { color: var(--muted); white-space: nowrap; }
.pd-rounds .pr-pts { font-family: var(--mono); min-width: 3.2em; text-align: right; }
.pd-rounds li.ok .pr-pts { color: var(--good); }
.pd-rounds li.ko .pr-pts { color: var(--bad); }
@media (max-width: 520px) {
  .pd-rounds li { grid-template-columns: minmax(0, 1fr) auto; }
  .pd-rounds .pr-info { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
}

/* =========================================================
   CHAT DE LA ROOM
   ========================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.chat-toggle {
  display: flex; align-items: center; gap: 6px; padding: 10px 16px; min-height: 44px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--card-border); font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.chat-toggle:hover { border-color: var(--accent-3); }
.chat-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-2); color: #fff; font-size: 0.75rem; display: grid; place-items: center; }
.chat-panel {
  width: min(340px, calc(100vw - 32px)); height: min(440px, calc(100dvh - 110px));
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: #1b1736; border: 1px solid var(--card-border); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: fadeUp 0.2s ease both;
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 10px 16px; font-weight: 700; border-bottom: 1px solid var(--card-border); }
.chat-close { width: 32px; height: 32px; border-radius: 8px; color: var(--muted); }
.chat-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.chat-list { list-style: none; margin: 0; padding: 10px 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-list li { display: flex; gap: 8px; align-items: flex-start; }
.chat-list li img { width: 28px; height: 28px; flex: none; }
.chat-list li > div { min-width: 0; background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 6px 10px; }
.chat-list li.me { flex-direction: row-reverse; }
.chat-list li.me > div { background: rgba(255, 207, 63, 0.14); }
.chat-meta { display: flex; gap: 8px; align-items: baseline; font-size: 0.75rem; }
.chat-meta b { color: var(--accent); }
.chat-meta time { color: var(--muted); }
.chat-list p { margin: 2px 0 0; font-size: 0.9rem; line-height: 1.35; overflow-wrap: anywhere; }
.chat-empty { color: var(--muted); font-size: 0.85rem; justify-content: center; padding-top: 20px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--card-border); }
.chat-form input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; font: inherit; font-size: 0.95rem; color: var(--text);
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--card-border); outline: none;
}
.chat-form input:focus { border-color: var(--accent-3); }
.chat-form .btn-primary { padding: 10px 14px; font-size: 0.9rem; box-shadow: 0 4px 0 #c98f00; }

/* niveaux */
.level-desc { margin: 8px auto 0; max-width: 42ch; font-size: 0.85rem; color: var(--muted); min-height: 2.4em; }
.small-chip { padding: 6px 12px; font-size: 0.8rem; }
#room-level { justify-content: flex-start; }

/* séries en direct */
.streak-chip {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; padding: 6px 12px; border-radius: 999px;
  font-weight: 800; font-size: 0.9rem; color: #fff; background: rgba(255, 79, 139, 0.85);
  box-shadow: 0 6px 20px rgba(255, 79, 139, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.streak-chip.hot { background: linear-gradient(90deg, #ff4f8b, #ff8a3d); box-shadow: 0 0 24px rgba(255, 120, 60, 0.6); }
.streak-chip.pop { animation: streakPop 0.5s ease; }
@keyframes streakPop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: none; } }
.rb-streak { font-size: 0.8rem; color: #ff8a3d; font-weight: 800; }
.rb-streak.hot { text-shadow: 0 0 10px rgba(255, 138, 61, 0.7); }

/* options : interrupteurs */
.toggles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.friends-box .toggles { justify-content: flex-start; }
.toggle { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.04); font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.toggle input { appearance: none; -webkit-appearance: none; width: 32px; height: 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); position: relative; cursor: pointer; transition: background 0.2s ease; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.2s ease; }
.toggle input:checked { background: var(--good); }
.toggle input:checked::after { transform: translateX(14px); }
.toggle input:focus-visible { outline: 2px solid var(--accent-3); outline-offset: 2px; }

/* réglages du mode solo */
.home-main, .home-options { display: flex; flex-direction: column; }
.home-options .option-group:last-child { margin-bottom: 0; }
.solo-card .home-options { text-align: left; }
.solo-card .home-options .chips, .solo-card .home-options .toggles { justify-content: flex-start; }
.solo-card .home-options .level-desc { margin-left: 0; }
.solo-card .solo-card #btn-start { position: sticky; bottom: 0; box-shadow: 0 -10px 30px rgba(13, 11, 30, 0.6), 0 5px 0 #c99a12; }
@media (min-width: 960px) {
  .solo-card { max-width: 760px; }
  .solo-card .home-options { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
  .solo-card .home-options .option-group:last-child { grid-column: 1 / -1; }
}

/* défis du jour */
#screen-daily.active { justify-content: center; }
.daily-group { display: flex; flex-direction: column; gap: 14px; }
.daily-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.daily-head .kicker { margin: 0 0 4px; }
.daily-code { font-family: var(--mono); font-weight: 700; font-size: clamp(1.8rem, 7vw, 2.6rem); letter-spacing: 0.2em; color: var(--accent); }
.daily-today {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 18px; background: rgba(255, 207, 63, 0.08); border: 1px solid rgba(255, 207, 63, 0.35);
}
.daily-today .btn-primary.big { margin: 0; }
.daily-date { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.15rem; text-transform: capitalize; }
.daily-status { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; max-width: 42ch; }
.daily-sub { font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.daily-leave { align-self: center; margin: 0; font-size: 0.85rem; }
#daily-board { max-height: 34vh; overflow-y: auto; }
@media (min-width: 960px) {
  #screen-daily.active { min-height: 0; height: 100vh; height: 100dvh; box-sizing: border-box; }
}

/* logo */
.brand-logo { width: clamp(56px, 9vw, 84px); height: auto; margin: 0 auto 10px; filter: drop-shadow(0 8px 24px rgba(255, 79, 139, 0.35)); animation: logoFloat 4s ease-in-out infinite; }
@keyframes logoFloat { 50% { transform: translateY(-4px) rotate(-2deg); } }
.game-logo { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.game-logo img { width: 1.25em; height: 1.25em; flex: none; filter: none; }
.game-logo span { background: inherit; -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (min-width: 960px) and (max-height: 820px) { .brand-logo { width: 56px; margin-bottom: 6px; } }

/* signaler un bug */
.bug-form { display: flex; flex-direction: column; gap: 6px; }
.bug-form label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.bug-form select, .bug-form textarea, .bug-form input {
  font: inherit; font-size: 0.95rem; color: var(--text); background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border); border-radius: 12px; padding: 10px 12px; outline: none; width: 100%; box-sizing: border-box;
}
.bug-form select option { background: #1b1736; }
.bug-form textarea { resize: vertical; min-height: 90px; }
.bug-form select:focus, .bug-form textarea:focus, .bug-form input:focus { border-color: var(--accent-3); }
.bug-context { margin: 6px 0 0; font-size: 0.78rem; font-style: italic; }
.bug-thanks p { font-size: 1.05rem; color: var(--text); }

/* sous-catégories */
.subcats { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.subcat-row { padding-left: 10px; border-left: 2px solid rgba(255, 207, 63, 0.35); }
.subcat-row + .subcat-row { margin-left: 12px; border-left-color: rgba(79, 209, 255, 0.4); }
.pool-count { margin: 8px 0 0; font-size: 0.8rem; color: var(--muted); }
.pool-count.warn { color: var(--accent); }
.subcat-row { max-height: 168px; overflow-y: auto; padding-right: 4px; }
.chip-count { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.chip.selected .chip-count { background: rgba(0, 0, 0, 0.18); }
.chip.empty { opacity: 0.45; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 0.82rem; }
.crumb { padding: 3px 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.14); background: transparent; color: var(--accent-3); font: inherit; cursor: pointer; }
.crumb:hover, .crumb:focus-visible { background: rgba(79, 209, 255, 0.12); }
.crumb.current { border-color: var(--accent); color: var(--accent); font-weight: 700; cursor: default; }
.crumb-sep { color: var(--muted); }

/* ---------- réglages de la room (salle d'attente, hôte) ---------- */
.lobby-summary { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--card-border); font-size: 0.92rem; line-height: 1.45; }
.lobby-settings { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--card-border); transition: opacity 0.2s; }
.lobby-settings.busy { opacity: 0.55; pointer-events: none; }
.lobby-group { display: flex; flex-direction: column; gap: 8px; }
.lobby-group h3 { margin: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.lobby-group .chips, .lobby-group .toggles { justify-content: flex-start; }
.lobby-count { text-align: center; }

/* Boutons de l’accueil en majuscules */
.play-buttons button { text-transform: uppercase; letter-spacing: 0.04em; }

/* choix du mode : les modes à plusieurs en avant, le solo en dessous (entraînement) */
.modes-card { max-width: 760px; }
.modes-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .modes-grid { grid-template-columns: repeat(2, 1fr); } }
.mode-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  padding: 22px 20px; border-radius: 22px; border: 0; cursor: pointer; color: #1a1208;
  font: inherit; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mode-tile:hover, .mode-tile:focus-visible { transform: translateY(-3px); box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45); }
.mode-tile:active { transform: translateY(1px); }
.mode-friends { background: linear-gradient(150deg, #ffe27a, #ffb347); }
.mode-defi { background: linear-gradient(150deg, #ff9bb3, #ff5f8f); }
.mode-season { background: linear-gradient(150deg, #a9d8ff, #8f9bff); }
.mode-solo-tile { background: linear-gradient(150deg, #a8f0c6, #3ee08f); }
.mode-emoji { font-size: 2rem; line-height: 1; }
.mode-name { display: block; font-family: var(--display); font-weight: 800; font-size: 1.35rem; text-transform: uppercase; letter-spacing: 0.02em; }
.mode-desc { display: block; font-size: 0.92rem; line-height: 1.4; opacity: 0.85; }
.mode-solo {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer; font: inherit;
  padding: 14px 18px; border-radius: 16px; color: var(--text); background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.2);
}
.mode-solo:hover, .mode-solo:focus-visible { background: rgba(255, 255, 255, 0.08); }
.mode-solo .mode-name { font-size: 1rem; }
.mode-solo .mode-desc { color: var(--muted); opacity: 1; font-size: 0.85rem; }
.mode-solo .mode-emoji { font-size: 1.4rem; }
.mode-arrow { margin-left: auto; color: var(--muted); font-size: 1.2rem; }

/* saison entre amis : résultats détaillés */
.season-day { font-family: var(--mono, monospace); font-size: 0.8rem; color: var(--muted); }
.res-cells { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
.res-cell { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 0.7rem; font-weight: 700;
  background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.res-cell.ok { background: rgba(80, 220, 140, 0.22); color: #7cf0b0; }
.res-cell.ko { background: rgba(255, 95, 120, 0.18); color: #ff8fa3; }
.board-list li.res-row { align-items: flex-start; }
.res-photos { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; }
.res-photos figure { margin: 0; flex: 0 0 64px; text-align: center; font-size: 0.65rem; color: var(--muted); }
.res-photos img { width: 64px; height: 64px; object-fit: cover; object-position: 50% 22%; border-radius: 10px; display: block; margin-bottom: 3px; }
.streak-badge { font-size: 0.8rem; margin-left: 6px; }

/* attente avant la première photo d'une room */
.room-intro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 18px; text-align: center; background: radial-gradient(circle at 50% 35%, rgba(255, 213, 74, 0.16), rgba(13, 11, 30, 0.92) 70%);
  border-radius: inherit; z-index: 3; }
.room-intro[hidden] { display: none; }
.room-intro .ri-count { font-family: var(--display); font-weight: 800; font-size: clamp(3.5rem, 14vw, 6rem); line-height: 1; color: var(--accent); }
.room-intro .ri-title { font-weight: 700; font-size: 1.05rem; }
.room-intro .ri-rules { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.room-intro .ri-players { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.room-intro .ri-players img { width: 34px; height: 34px; animation: riBounce 1.2s ease-in-out infinite; }
.room-intro .ri-players img:nth-child(2n) { animation-delay: 0.2s; }
.room-intro .ri-players img:nth-child(3n) { animation-delay: 0.4s; }
@keyframes riBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* réglages en 3 étapes (solo, salle d'attente, saison) */
.settings-v2 { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.settings-v2 .set-step { background: rgba(255, 255, 255, 0.035); border: 1px solid var(--card-border); border-radius: 18px; padding: 14px 14px 16px; margin: 0; }
.settings-v2 .set-step > h2, .settings-v2 .set-step > h3 {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 0.95rem; font-weight: 700;
  text-transform: none; letter-spacing: 0; color: var(--text);
}
.step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #1a1208; font-size: 0.8rem; font-weight: 800; }
.step-help { margin: -4px 0 10px; font-size: 0.82rem; color: var(--muted); }
.settings-v2 .chips { justify-content: flex-start; }
.settings-v2 .chips.seg + .level-desc { margin: 8px 0 12px; max-width: none; min-height: 0; }
.settings-v2 .level-desc + .chips.seg { margin-top: 0; }
.amb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.chip.amb { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 14px; font-size: 0.8rem; line-height: 1.15; text-align: center; }
.chip.amb .amb-ico { font-size: 1.5rem; line-height: 1; }
.theme-box { margin-top: 12px; padding: 12px; border-radius: 14px; background: rgba(79, 209, 255, 0.06); border: 1px dashed rgba(79, 209, 255, 0.35); display: flex; flex-direction: column; gap: 8px; }
.theme-box[hidden] { display: none; }
.theme-title { font-size: 0.8rem; font-weight: 700; color: var(--accent-3); text-transform: uppercase; letter-spacing: 0.08em; }
.theme-box .subcat-row { padding-left: 0; border-left: 0; max-height: 190px; }
.theme-box .step-help { margin: 0; }
.set-more { border: 1px solid var(--card-border); border-radius: 14px; padding: 10px 14px; background: rgba(255, 255, 255, 0.02); }
.set-more > summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; list-style: none; }
.set-more > summary::-webkit-details-marker { display: none; }
.set-more > summary::after { content: "▾"; float: right; color: var(--muted); }
.set-more[open] > summary::after { content: "▴"; }
.set-more .toggles { margin-top: 10px; justify-content: flex-start; }
.set-more .step-help { margin: 8px 0 0; }
.set-summary { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 0 4px;
  background: linear-gradient(to top, var(--bg-2, #0d0b1e) 70%, transparent); }
.set-summary .pool-count { margin: 0; font-size: 0.85rem; color: var(--text); text-align: center; }
.solo-card #btn-start { position: static; box-shadow: 0 5px 0 #c99a12; }
@media (min-width: 960px) {
  .solo-card .home-options.settings-v2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .solo-card .settings-v2 .set-step:first-child { grid-column: 1 / -1; }
  .solo-card .settings-v2 .set-more { grid-column: 1 / -1; }
}
.lobby-settings.settings-v2 .lobby-sub { margin-bottom: 0; }

/* notifications de la saison et écran d'accueil (iPhone) */
.notif-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-radius: 16px;
  background: rgba(255, 213, 74, 0.08); border: 1px solid rgba(255, 213, 74, 0.3); }
.notif-card[hidden] { display: none; }
.notif-card p { margin: 0; flex: 1 1 220px; font-size: 0.9rem; line-height: 1.4; }
.install-hint { margin: 16px auto 0; display: flex; align-items: center; gap: 12px; width: 100%; max-width: 400px; padding: 10px 14px; text-align: left;
  border-radius: 16px; border: 1px solid rgba(255, 213, 74, 0.45); background: linear-gradient(135deg, rgba(255, 213, 74, 0.14), rgba(255, 79, 139, 0.10));
  color: var(--text); font: inherit; cursor: pointer; }
.install-hint img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.install-hint span { display: flex; flex-direction: column; min-width: 0; }
.install-hint b { font-size: 0.95rem; }
.install-hint small { color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.install-go { margin-left: auto; font-size: 1.6rem; color: var(--accent); }
.install-hint[hidden] { display: none; }
.install-steps { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.install-steps li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.install-n { flex: 0 0 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #1a1208; font-weight: 800; font-size: 0.8rem; }
.install-ico { font-size: 1.05rem; }

/* écran des modes : deux groupes */
.modes-group { margin: 6px 0 -4px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
.mode-party { background: linear-gradient(150deg, #ffb3f0, #c86bff); }
.mode-qcm { background: linear-gradient(150deg, #fff3a6, #ffc94a); }
.mode-chrono { background: linear-gradient(150deg, #ffc9a8, #ff8a5c); }
.mode-survie { background: linear-gradient(150deg, #ffb0b0, #ff5f6d); }

/* QCM : 4 grands boutons */
.qcm-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.qcm-choices[hidden] { display: none; }
.qcm-btn { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 14px; border-radius: 16px; text-align: left; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.98rem; color: var(--text); background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(255, 255, 255, 0.16);
  transition: transform 0.12s ease, background 0.15s ease; }
.qcm-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); transform: translateY(-2px); }
.qcm-btn:active:not(:disabled) { transform: translateY(1px); }
.qcm-letter { flex: 0 0 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-family: var(--display); font-weight: 800; color: #1a1208; background: var(--accent); }
.qcm-btn:nth-child(2) .qcm-letter { background: #ff7aa8; }
.qcm-btn:nth-child(3) .qcm-letter { background: #6fdcff; }
.qcm-btn:nth-child(4) .qcm-letter { background: #7cf0b0; }
.qcm-btn.right { border-color: var(--good); background: rgba(62, 224, 143, 0.2); }
.qcm-btn.wrong { border-color: var(--bad); background: rgba(255, 95, 120, 0.18); }
.qcm-btn.picked { border-color: var(--accent); background: rgba(255, 213, 74, 0.16); }
.qcm-btn:disabled { cursor: default; }
@media (max-width: 420px) { .qcm-choices { grid-template-columns: 1fr; } .qcm-btn { min-height: 50px; } }

/* mode soirée : l'écran commun (grande photo + 4 noms) et les téléphones (4 gros boutons) */
.party-screen .answer, .party-screen .actions, .party-screen .road-card, .party-screen .hud .score, .party-screen .hud .streak,
.party-screen #btn-next, .party-screen .credit, .party-screen:not(.party-text) .slots { display: none !important; }
.party-screen .qcm-btn { min-height: 76px; font-size: 1.35rem; }
.party-screen .qcm-letter { flex-basis: 42px; height: 42px; font-size: 1.3rem; }
.party-screen .room-status { font-size: 1.1rem; }
@media (min-width: 900px) { #screen-game.party-screen .photo-wrap { width: min(calc(100vh - 200px), calc(100dvh - 200px), 640px, 44vw); } }
.party-phone .photo-wrap, .party-phone .road-card, .party-phone #btn-next, .party-phone .credit,
.party-phone:not(.party-text) .slots, .party-phone:not(.party-text) .answer, .party-phone:not(.party-text) .actions { display: none !important; }
.party-phone .qcm-choices { grid-template-columns: 1fr; gap: 12px; }
.party-phone .qcm-btn { min-height: 74px; font-size: 1.2rem; }
.party-phone .qcm-letter { flex-basis: 40px; height: 40px; font-size: 1.2rem; }
.party-phone .room-status { font-size: 1.05rem; font-weight: 700; }
.party-screen .qcm-btn:disabled, .qcm-btn.right:disabled, .qcm-btn.wrong:disabled, .qcm-btn.picked:disabled { opacity: 1; }

/* =========================================================
   TÉLÉPHONE : la partie tient sur un seul écran, sans défiler
   (photo aussi grande que la place restante, route réduite à une jauge)
   ========================================================= */
@media (max-width: 700px) {
  #screen-game.active {
    height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; box-sizing: border-box;
    padding: max(8px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom));
    --reserve: 296px; /* hauteur de tout ce qui n’est pas la photo */
  }
  #screen-game .topbar { flex-wrap: nowrap; margin: 0 0 6px; gap: 8px; }
  #screen-game .game-logo { order: 0; width: auto; font-size: 0.95rem; letter-spacing: 0.06em; }
  #screen-game .game-logo img { width: 22px; height: 22px; }
  #screen-game .topbar .btn-ghost.small { padding: 5px 10px; font-size: 0.78rem; }
  #screen-game .stage { flex: 1; min-height: 0; gap: 7px; justify-content: flex-start; }

  /* score, série, manche : une ligne serrée */
  #screen-game .hud { gap: 6px; }
  #screen-game .hud-label { font-size: 0.58rem; letter-spacing: 0.1em; }
  #screen-game .hud-value { font-size: 1.1rem; }
  #screen-game .hud-item.streak { padding: 2px 10px; }

  /* route des babas : seulement le rang et la jauge */
  #screen-game .road-card { margin: 0; padding: 5px 10px; border-radius: 12px; gap: 0; max-width: none; }
  #screen-game .road-card .road { display: none; }
  #screen-game .rank-row { gap: 8px; }
  #screen-game .rank-pill { font-size: 0.7rem; padding: 2px 8px; }
  #screen-game .rank-next { font-size: 0.68rem; }

  /* la photo prend toute la hauteur restante */
  #screen-game .photo-wrap { width: min(calc(100vw - 24px), calc(100dvh - var(--reserve)), 440px); min-width: 120px; flex: none; border-radius: 20px; }
  #screen-game .badge, #screen-game .timer { top: 8px; font-size: 0.72rem; padding: 4px 10px; }
  #screen-game .badge { left: 8px; }
  #screen-game .timer { right: 8px; }
  #screen-game .gain { font-size: 2.6rem; }

  /* traits du nom, indice, réponse, aides : compacts */
  #screen-game .slots { gap: 6px 14px; }
  #screen-game .word { gap: 3px; }
  #screen-game .slot { width: clamp(13px, 4.1vw, 22px); height: 26px; font-size: 1rem; border-bottom-width: 2px; }
  #screen-game .hint { font-size: 0.82rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #screen-game .answer { gap: 8px; }
  #screen-game .answer input { padding: 11px 14px; font-size: 16px; } /* 16 px : pas de zoom automatique sur iPhone */
  #screen-game .answer .btn-primary { padding: 11px 16px; }
  #screen-game .actions { flex-wrap: nowrap; gap: 6px; width: 100%; }
  #screen-game .actions .btn-ghost { flex: 1; padding: 8px 6px; font-size: 0.8rem; white-space: nowrap; }
  #screen-game .actions small { font-size: 0.68rem; }
  #screen-game .next { padding: 11px 22px; }
  #screen-game .credit { font-size: 0.6rem; line-height: 1; }

  /* quiz date de naissance et QCM */
  #screen-game .bq-title { font-size: 0.95rem; margin-bottom: 6px; }
  #screen-game .bq-options { gap: 6px; }
  #screen-game .bq-option { padding: 8px 12px; font-size: 0.92rem; }
  #screen-game .qcm-choices { grid-template-columns: 1fr 1fr; gap: 7px; }
  #screen-game .qcm-btn { min-height: 46px; padding: 6px 9px; font-size: 0.86rem; gap: 7px; }
  #screen-game .qcm-letter { flex-basis: 24px; height: 24px; font-size: 0.85rem; border-radius: 7px; }

  /* room : classement en bandeau horizontal, statut sur une ligne */
  #screen-game.room-mode { --reserve: 350px; }
  #screen-game.active.tall-slots { --reserve: 330px; }
  #screen-game.room-mode.tall-slots { --reserve: 384px; }
  #screen-game .room-board { padding: 5px 8px; border-radius: 12px; }
  #screen-game .room-board-title { display: none; }
  #screen-game .room-board-list { flex-direction: row; overflow-x: auto; max-height: none; gap: 6px; scrollbar-width: none; }
  #screen-game .room-board-list li { display: flex; gap: 5px; padding: 3px 8px 3px 4px; flex: none; font-size: 0.8rem; background: rgba(255, 255, 255, 0.05); }
  #screen-game .room-board-list li.me { background: rgba(255, 207, 63, 0.16); }
  #screen-game .room-board-list img { width: 22px; height: 22px; }
  #screen-game .rb-rank { display: none; }
  #screen-game .rb-name { max-width: 70px; }
  #screen-game .room-status { padding: 6px 10px; font-size: 0.82rem; }
  #screen-game .room-status.countdown { font-size: 1.05rem; }

  /* soirée sur téléphone : pas de photo, 4 gros boutons */
  #screen-game.party-phone .qcm-choices { grid-template-columns: 1fr; gap: 10px; }
  #screen-game.party-phone .qcm-btn { min-height: 64px; font-size: 1.1rem; }
  #screen-game.party-phone .qcm-letter { flex-basis: 34px; height: 34px; font-size: 1.1rem; }
}
/* petits écrans (iPhone SE…) : encore un peu plus serré */
@media (max-width: 700px) and (max-height: 620px) {
  #screen-game.active { --reserve: 280px; }
  #screen-game.room-mode { --reserve: 322px; }
  #screen-game .road-card { display: none; }
}
/* téléphone, en partie : le bouton du chat devient une bulle au bout du bandeau des joueurs (il ne cache plus les boutons) */
@media (max-width: 700px) {
  #screen-game.active.room-mode .room-board { padding-right: 52px; }
  #screen-game.active.room-mode ~ #chat { top: calc(max(8px, env(safe-area-inset-top)) + 84px); right: 14px; bottom: auto; }
  #screen-game.active.room-mode ~ #chat .chat-toggle { position: relative; width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 50%; justify-content: center; font-size: 1rem; }
  #screen-game.active.room-mode ~ #chat .chat-toggle > span { display: none; }
  #screen-game.active.room-mode ~ #chat .chat-badge { position: absolute; top: -4px; right: -4px; }
  #screen-game.active.room-mode ~ #chat .chat-panel { position: fixed; top: 130px; right: 12px; left: 12px; bottom: auto; height: 55dvh; width: auto; }
}

/* soirée sur la télé : QR code pour rejoindre, petit QR pendant la partie, fenêtre « sur la télé » */
.party-join { display: flex; align-items: center; gap: 18px; padding: 14px; border-radius: 20px; text-align: left;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--card-border); }
.party-join[hidden] { display: none; }
.party-qr { flex: 0 0 168px; width: 168px; height: 168px; padding: 8px; border-radius: 14px; background: #fff; box-sizing: border-box; }
.party-qr svg, .party-mini-qr svg { width: 100%; height: 100%; display: block; }
.party-join-title { margin: 0 0 6px; font-family: var(--display); font-weight: 800; font-size: 1.4rem; }
.party-join-url { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }
.party-join-url b { color: var(--accent); font-family: var(--mono); letter-spacing: 0.04em; }
.party-cast { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) { .party-join { flex-direction: column; text-align: center; } .party-cast { justify-content: center; } }
.party-mini { position: fixed; left: 16px; bottom: 16px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px;
  border-radius: 16px; background: rgba(13, 11, 30, 0.85); border: 1px solid var(--card-border); font-size: 0.8rem; color: var(--muted); line-height: 1.2; }
.party-mini[hidden] { display: none; }
.party-mini-qr { width: 84px; height: 84px; padding: 4px; border-radius: 10px; background: #fff; box-sizing: border-box; }
.party-mini b { color: var(--accent); font-family: var(--mono); font-size: 1rem; letter-spacing: 0.06em; }
.cast-options { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.cast-opt { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border); }
.cast-opt h3 { margin: 0 0 6px; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1rem; }
.cast-opt p { margin: 4px 0; font-size: 0.9rem; }
.cast-opt p.small { font-size: 0.8rem; font-style: italic; }
.cast-opt .btn-primary { margin: 6px 0; }
.cast-opt .btn-primary[hidden] { display: none; }

/* grand écran (télé) : tout en plus grand, lisible depuis le canapé */
@media (min-width: 1280px) {
  #screen-lobby .party-join { gap: 32px; padding: 24px; }
  #screen-lobby .party-qr { flex-basis: 260px; width: 260px; height: 260px; }
  #screen-lobby .party-join-title { font-size: 2.2rem; }
  #screen-lobby .party-join-url { font-size: 1.3rem; }
  #screen-game.party-screen .qcm-btn { min-height: 92px; font-size: 1.7rem; }
  #screen-game.party-screen .qcm-letter { flex-basis: 52px; height: 52px; font-size: 1.6rem; }
  #screen-game.party-screen .room-board-list li { font-size: 1.15rem; }
  #screen-game.party-screen .room-board-list img { width: 38px; height: 38px; }
  #screen-game.party-screen .room-status { font-size: 1.4rem; }
  .party-mini-qr { width: 120px; height: 120px; }
}

/* soirée « écrire le nom » : traits en grand sur la télé ; sur le téléphone, la réponse en haut de l'écran (clavier) */
@media (min-width: 900px) {
  #screen-game.party-screen.party-text .slot { width: 40px; height: 54px; font-size: 2rem; border-bottom-width: 4px; }
  #screen-game.party-screen.party-text .slots { gap: 14px 34px; }
  #screen-game.party-screen.party-text .word { gap: 8px; }
  #screen-game.party-screen.party-text .hint { font-size: 1.4rem; }
}
#screen-game.party-phone.party-text .stage { justify-content: flex-start; }
#screen-game.party-phone.party-text .slots { margin-top: 6px; }

.legal-link { font-size: inherit; padding: 0; text-decoration: underline; }
.credit { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; text-align: center; }

/* partage façon Wordle */
.share-btn[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; margin: 0; padding: 10px 16px; border-radius: 999px;
  background: #15121f; border: 1px solid rgba(255, 213, 74, 0.5); color: var(--text); font-weight: 600; font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: fadeUp 0.25s ease; max-width: calc(100vw - 32px); text-align: center; }
.toast[hidden] { display: none; }

/* mes amis */
.amis-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px;
  background: var(--accent-2); color: #fff; font-size: 0.7rem; vertical-align: middle; }
.amis-badge[hidden] { display: none; }
.amis-top { display: grid; gap: 14px; }
@media (min-width: 640px) { .amis-top { grid-template-columns: 1fr 1fr; } }
.amis-code-box .daily-code { margin: 4px 0 10px; }
.amis-notif { margin-top: 8px; font-size: 0.85rem; }
.amis-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ami-row { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; text-align: left; cursor: pointer;
  font: inherit; color: var(--text); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--card-border); }
.ami-row:hover { background: rgba(255, 255, 255, 0.09); }
.ami-row img { width: 40px; height: 40px; flex: none; }
.ami-row span { display: flex; flex-direction: column; min-width: 0; }
.ami-row small { color: var(--muted); font-size: 0.78rem; }
.ami-row .ami-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ami-row.unread { border-color: rgba(255, 79, 139, 0.6); }
.ami-dot { position: absolute; right: 14px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--accent-2); }
.ami-panel { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border); }
.ami-panel[hidden] { display: none; }
.ami-head { display: flex; align-items: center; gap: 12px; }
.ami-head img { width: 48px; height: 48px; }
.ami-head div { flex: 1; display: flex; flex-direction: column; }
.ami-head small { color: var(--muted); }
.ami-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ami-stats div { padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; }
.ami-stats b { font-family: var(--mono); color: var(--accent); font-size: 1.1rem; }
.ami-stats span { font-size: 0.75rem; color: var(--muted); }
.ami-actions { align-items: center; }
.ami-msgs { max-height: 320px; overflow-y: auto; }
.ami-invite { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; padding: 8px 10px; border-radius: 12px;
  background: rgba(255, 213, 74, 0.12); border: 1px solid rgba(255, 213, 74, 0.4); font-weight: 600; }

.lobby-share { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; }

/* téléphone : la photo ne change jamais de taille quand le clavier s'ouvre (voir applyPhotoFit dans game.js) ;
   dans les modes où l'on écrit, elle est assez petite pour tenir avec les traits et le champ au-dessus du clavier */
@media (max-width: 700px) {
  #screen-game.active:not(.no-typing) .photo-wrap { width: min(calc(100vw - 24px), calc(100dvh - var(--reserve)), var(--kbfit, 9999px), 440px); }
  #screen-game.active:not(.no-typing) .stage { justify-content: center; } /* l'espace libéré se répartit autour */
}

/* =========================================================
   TÉLÉPHONE : écrans hors partie plus compacts et mieux emboîtés
   ========================================================= */
.avatar-top { gap: 10px; }
.avatar-top .btn-ghost.small { flex: none; white-space: nowrap; }
.avatar-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
@media (max-width: 700px) {
  .screen { padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom)); }
  .avatar-card, .friends-card, .end-card { padding: 16px 14px 18px; border-radius: 22px; gap: 14px; }
  .home-card { padding: 22px 16px; border-radius: 22px; }
  .avatar-title { font-size: 26px; }
  .friends-pitch { font-size: 0.9rem; line-height: 1.45; margin-top: 6px; }
  .avatar-meta { font-size: 11px; }
  .btn-ghost.small { padding: 6px 11px; font-size: 0.8rem; }

  /* choix de l'avatar : tout tient à l'écran, bouton « C'est parti » visible sans défiler */
  #screen-avatar .avatar-card { gap: 10px; }
  #screen-avatar .avatar-head .kicker { margin-bottom: 2px; }
  #screen-avatar .avatar-stage { height: 150px; padding-bottom: 10px; border-radius: 18px; }
  #screen-avatar .avatar-preview img { width: 80px; height: 80px; margin-top: 4px; }
  #screen-avatar .name-tag.big { font-size: 0.85rem; padding: 3px 10px; }
  #screen-avatar .avatar-label { margin-top: 2px; font-size: 12px; }
  #screen-avatar .avatar-body, #screen-avatar .avatar-side { gap: 10px; }
  #screen-avatar .avatar-grid { gap: 6px; }
  #screen-avatar .avatar-choice { padding: 5px 0 4px; border-radius: 12px; gap: 2px; }
  #screen-avatar .avatar-choice img { width: 34px; height: 34px; }
  #screen-avatar .avatar-choice span { font-size: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  #screen-avatar .pseudo-form { gap: 6px; }
  #screen-avatar #pseudo { height: 46px; font-size: 18px; }
  #screen-avatar .pseudo-help { display: none; }
  #screen-avatar #btn-avatar-go { padding: 13px 20px; }

  /* écrans à cartes (modes, amis, saison, défi, salle d'attente) */
  .modes-grid { gap: 10px; }
  .mode-tile { padding: 14px 14px; border-radius: 18px; gap: 4px; }
  .mode-emoji { font-size: 1.5rem; }
  .mode-name { font-size: 1.05rem; }
  .mode-desc { font-size: 0.82rem; }
  .modes-group { margin: 2px 0 -6px; }
  .friends-box { padding: 14px; }
  .lobby-code { font-size: clamp(2.4rem, 13vw, 3.4rem); }
}
@media (max-width: 380px) { .modes-grid { grid-template-columns: 1fr 1fr; } .mode-desc { display: none; } }

/* guide « écran d'accueil » illustré */
.install-modal { padding: 22px 20px; }
.install-hero { display: flex; gap: 14px; align-items: center; }
.install-hero h2 { margin: 0 0 4px; font-size: 1.35rem; }
.install-hero p { margin: 0; font-size: 0.88rem; }
.install-app-icon { width: 64px; height: 64px; border-radius: 15px; flex: none; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
.install-flow { list-style: none; padding: 0; margin: 18px 0 10px; display: flex; flex-direction: column; gap: 14px; }
.install-step { display: flex; flex-direction: column; gap: 8px; }
.install-text { display: flex; gap: 10px; align-items: flex-start; }
.install-text b { display: block; font-size: 0.98rem; color: var(--text); }
.install-text small { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.35; margin-top: 2px; }
.install-n { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #1a1208; font-weight: 800; font-size: 0.85rem; }
/* maquettes façon iPhone (fond clair, comme Safari) */
.install-visual { border-radius: 14px; background: #f2f2f7; color: #1c1c1e; padding: 10px 12px; font: 600 0.85rem/1.2 -apple-system, system-ui, sans-serif; }
.vis-bar { display: flex; justify-content: space-around; align-items: center; color: #0a84ff; font-size: 1.3rem; }
.vis-bar span { display: grid; place-items: center; width: 40px; height: 36px; border-radius: 10px; }
.vis-bar .hl { background: rgba(10, 132, 255, 0.14); box-shadow: 0 0 0 3px #ffd54a; animation: installPulse 1.4s ease-in-out infinite; }
.ico-share, .ico-plus { width: 22px; height: 22px; }
.vis-sheet { display: flex; flex-direction: column; gap: 0; padding: 4px 0; background: #fff; }
.vis-sheet .row { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; border-bottom: 1px solid #e5e5ea; }
.vis-sheet .row:last-child { border-bottom: 0; }
.vis-sheet .row i { font-style: normal; color: #3a3a3c; display: grid; place-items: center; }
.vis-sheet .hl { background: rgba(255, 213, 74, 0.35); border-radius: 10px; margin: 2px 6px; box-shadow: 0 0 0 2px #ffb400; animation: installPulse 1.4s ease-in-out infinite; }
.vis-home { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; justify-items: center; padding: 14px 10px; background: linear-gradient(160deg, #4b3a8c, #c45b8a); }
.vis-home .app { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vis-home .app i { width: 44px; height: 44px; border-radius: 11px; background: rgba(255, 255, 255, 0.35); }
.vis-home .mine img { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 0 0 3px #ffd54a; animation: installPulse 1.4s ease-in-out infinite; }
.vis-home .mine small { color: #fff; font-size: 0.62rem; font-weight: 600; }
@keyframes installPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .vis-bar .hl, .vis-sheet .hl, .vis-home .mine img { animation: none; } }
.install-note { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); text-align: center; }
.install-step .install-text { order: -1; }

/* ---------- Mon profil : compte et progression ---------- */
.acc-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
.acc-tab {
  border: 0; border-radius: 10px; padding: 10px 6px; background: transparent; color: var(--muted);
  font: 600 0.9rem var(--body); cursor: pointer;
}
.acc-tab.selected { background: var(--accent); color: #1a1408; }
.acc-form { display: flex; flex-direction: column; gap: 8px; }
.acc-label { font-size: 0.85rem; font-weight: 600; margin-top: 4px; }
.acc-label small { font-weight: 400; color: var(--muted); }
.acc-input {
  height: 48px; border-radius: 12px; border: 2px solid var(--card-border); background: rgba(255, 255, 255, 0.06);
  color: var(--text); font: 1rem var(--body); padding: 0 14px; outline: none; width: 100%;
}
.acc-input:focus { border-color: var(--accent-3); }
.acc-warn { margin: 4px 0; font-size: 0.82rem; color: var(--accent); }
.acc-or { text-align: center; font-size: 0.8rem; margin-top: 6px; }
.acc-code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.acc-code-row .code-input { font-size: 1.3rem; height: 48px; letter-spacing: 0.3em; }
.acc-status { margin: 0; }
.acc-status b { color: var(--accent); font-family: var(--mono); }
.acc-link { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.acc-link .party-qr { flex-basis: 150px; width: 150px; height: 150px; }
.acc-link > div:last-child { flex: 1 1 180px; }
.acc-banner {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255, 207, 63, 0.4);
  background: rgba(255, 207, 63, 0.1); color: var(--text); font: 0.92rem var(--body);
}
.acc-banner span { flex: 1; }
.prog-chart { padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border); }
.prog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.prog-head small { color: var(--muted); }
.prog-bars { display: flex; gap: 4px; height: 150px; padding-top: 16px; }
.prog-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.prog-track { position: relative; flex: 1 1 auto; width: 100%; }
.prog-col i {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 30px;
  border-radius: 6px 6px 2px 2px; background: rgba(79, 209, 255, 0.55);
}
.prog-col.best i { background: var(--accent); }
.prog-col.last i { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2); }
.prog-val { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); font: 0.62rem var(--mono); color: var(--muted); white-space: nowrap; }
.prog-lab { font-size: 0.6rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 420px) { .prog-val { display: none; } .prog-col.best .prog-val, .prog-col.last .prog-val { display: block; } }
.ami-stats > p { grid-column: 1 / -1; }

.install-transfer { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 207, 63, 0.1); border: 1px solid rgba(255, 207, 63, 0.35); }
.install-transfer small { color: var(--muted); font-size: 0.82rem; }
.install-transfer .daily-code { font-size: 1.6rem; text-align: center; }
.app-welcome > span:first-child { font-size: 1.6rem; width: 40px; text-align: center; }
