/* Écran joueur */
body { overscroll-behavior: none; }
#app { min-height: 100dvh; }
.screen { min-height: 100dvh; }

/* Rejoindre */
.join { display: grid; grid-template-rows: auto 1fr auto; padding: max(18px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom)); }
.join-top { display: flex; align-items: center; min-height: 44px; }
.join-card { align-self: center; justify-self: center; width: min(420px, 100%); display: grid; gap: 18px; }
.join-card h1 { font-size: clamp(2.2rem, 9vw, 3rem); font-variation-settings: 'wdth' 85; }
.pin-input {
  font-size: 2.4rem; font-weight: 700; letter-spacing: .08em; text-align: center;
  min-height: 78px; border-radius: var(--radius-m);
}
.pin-input::placeholder, .name-input::placeholder { color: #C4C7D4; }
.name-input { font-size: 1.5rem; font-weight: 600; min-height: 68px; border-radius: var(--radius-m); }
.join-card .btn { width: 100%; }
.game-title { color: var(--muted); font-weight: 550; }
.join-foot { display: flex; justify-content: center; gap: 18px; color: var(--muted); font-size: .85rem; }
.join-foot a { color: var(--muted); text-underline-offset: 3px; }
.join-foot a:hover { color: var(--ink); }

/* Barre du haut */
.play { display: grid; grid-template-rows: auto 1fr; }
.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 18px 12px; font-weight: 600;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-q { color: var(--muted); font-weight: 550; }
.bar-score { justify-self: end; color: var(--ink-2); }
.bar-score strong { color: var(--ink); }

/* Zone de jeu */
.stage { position: relative; display: flex; flex-direction: column; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); }
.center { margin: auto; text-align: center; display: grid; justify-items: center; gap: 12px; max-width: 460px; width: 100%; }
.hello { font-size: clamp(1.9rem, 8vw, 2.6rem); font-variation-settings: 'wdth' 88; overflow-wrap: anywhere; }
.sub { color: var(--ink-2); font-size: 1.08rem; }
.sub.muted { color: var(--muted); }
.leave { margin-top: 28px; color: var(--muted); }

.lobby-mark .logo { width: 72px; height: 72px; gap: 6px; animation: breathe 2.8s var(--ease) infinite; }
@keyframes breathe { 50% { transform: scale(.9) rotate(-6deg); } }

/* Préparation */
.intro-q { font-size: clamp(1.6rem, 7vw, 2.3rem); line-height: 1.15; font-variation-settings: 'wdth' 90; }
.intro-bar { width: 100%; max-width: 280px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; }
.intro-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; animation: drain linear forwards; }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Question */
.stage.question { gap: 14px; padding-top: 14px; }
.q-mini { color: var(--ink-2); font-weight: 550; line-height: 1.3; font-size: 1.02rem; }
.tiles { flex: 1; display: grid; gap: 12px; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; min-height: 300px; }
.tiles.n2, .tiles.n3 { grid-template-columns: 1fr; }
.tile {
  position: relative; border: 0; border-radius: var(--radius-m); background: var(--a); color: var(--a-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 14px;
  cursor: pointer; font-weight: 650; font-size: 1.05rem; line-height: 1.2; text-align: center;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .16);
  transition: transform .12s var(--ease), opacity .2s, filter .2s;
  touch-action: manipulation;
}
.tile:active { transform: scale(.96); }
.tile .shape { width: 46px; height: 46px; }
.tile .shape svg { width: 100%; height: 100%; fill: currentColor; }
.tiles.n2 .tile, .tiles.n3 .tile { flex-direction: row; justify-content: flex-start; gap: 16px; padding: 14px 20px; text-align: left; font-size: 1.2rem; }
.tiles.n2 .tile .shape, .tiles.n3 .tile .shape { width: 40px; height: 40px; flex: none; }
.tiles.tf .tile { flex-direction: column; justify-content: center; text-align: center; font-size: 1.6rem; }
.tile-text { overflow-wrap: anywhere; }
.stage[data-locked] .tile:not(.picked) { opacity: .25; filter: saturate(.4); }
.timer-line { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.timer-line i { display: block; height: 100%; background: var(--ink); transform-origin: left; }

/* Réponse envoyée */
.sent-shape { width: 112px; height: 112px; border-radius: 28px; background: var(--a); color: var(--a-ink); display: grid; place-items: center; margin-bottom: 8px; animation: pop .45s var(--ease); }
.sent-shape svg { width: 56px; height: 56px; fill: currentColor; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* Verdict */
body[data-phase="reveal"] .bar { background: transparent; border-color: transparent; }
.stage.reveal { color: #fff; }
.stage.reveal.late { color: var(--ink); }
body[data-phase="reveal"] .play { transition: background .3s; }
body[data-phase="reveal"]:has(.stage.good) .play { background: var(--good); color: #fff; }
body[data-phase="reveal"]:has(.stage.bad) .play { background: var(--bad); color: #fff; }
body[data-phase="reveal"]:has(.stage.late) .play { background: #DADCE6; }
body[data-phase="reveal"]:has(.stage.good) .bar *, body[data-phase="reveal"]:has(.stage.bad) .bar * { color: #fff; }
.stage.reveal .sub { color: inherit; opacity: .9; }
.verdict-icon { width: 92px; height: 92px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  padding: 18px; border-radius: 50%; background: rgba(255, 255, 255, .18); animation: pop .5s var(--ease); }
.late .verdict-icon { background: rgba(23, 24, 43, .07); }
.verdict { font-size: clamp(2.2rem, 10vw, 3.2rem); font-variation-settings: 'wdth' 85; }
.points { font-size: 1.6rem; font-weight: 700; background: rgba(0, 0, 0, .16); padding: 6px 20px; border-radius: 999px; animation: pop .5s .15s var(--ease) both; }
.streak { font-weight: 600; }
.rank-line { margin-top: 18px; }

/* Classement */
.big-rank { font-size: clamp(5.5rem, 34vw, 9rem); font-weight: 800; line-height: .95; letter-spacing: -0.05em; font-variation-settings: 'wdth' 75; }
.big-rank.podium-1 { color: var(--yellow); }
.big-rank.podium-2 { color: var(--blue); }
.big-rank.podium-3 { color: var(--red); }
.gap { color: var(--muted); }
.thanks { margin-top: 18px; font-weight: 650; font-size: 1.2rem; }
.again { margin-top: 10px; }
