/* ── Lobby ── */
.lobby-section { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.lobby-title { font-size: 13px; font-weight: 800; margin-bottom: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.lobby-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 12px; }

.howto-inline-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink); padding: 7px 0; }
.howto-inline-emoji { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }

.rounds-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.rounds-row select {
  flex: 1; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  font-family: inherit; font-size: 14px; font-weight: 700; background: var(--bg);
  transition: border-color .15s ease, background .15s ease;
}
.rounds-row select.unpicked {
  border: 1.5px dashed #c4b5fd; background: #faf5ff; color: #7c3aed;
}
.lobby-btn {
  width: 100%; padding: 13px; border: none; border-radius: 12px;
  font-family: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
  margin-bottom: 8px;
}
.lobby-btn.primary { background: linear-gradient(120deg, #7c3aed, #a855f7); color: #fff; }
.lobby-btn.secondary { background: var(--bg); color: var(--ink); border: 1.5px solid var(--line); }
.lobby-btn.ghost { background: transparent; color: var(--muted); border: 1.5px dashed var(--line); }
.lobby-btn.danger { background: #fef2f2; color: var(--danger); border: 1.5px solid #fecaca; transition: background .12s ease; }
.lobby-btn.danger:active { background: #fee2e2; }

/* Chunky "jelly" button: a rounded gummy-candy dome -- an inset highlight
   near the top and inset shadow near the bottom give it roundness even
   though it's a flat CSS shape, a solid color "step" underneath (not just a
   blur) reads as real 3D thickness, and it idles with a tiny breathing
   squish so it visibly invites a tap instead of sitting there inert. */
.lobby-btn.jelly {
  position: relative; border-radius: 24px; overflow: hidden;
  background: linear-gradient(160deg, #c084fc 0%, #9333ea 55%, #7c3aed 100%);
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.5),
    inset 0 -8px 12px rgba(76,29,149,.55),
    0 7px 0 #5b21b6,
    0 14px 18px rgba(124,58,237,.45);
  transform-origin: center bottom;
  animation: jellyIdle 2.4s ease-in-out infinite;
  transition: transform .15s cubic-bezier(.34,1.56,.64,1), box-shadow .15s ease, filter .15s ease;
}
@keyframes jellyIdle {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.02, .97); }
}
.lobby-btn.jelly:not(:disabled):hover {
  transform: translateY(-2px) scale(1.03, 1.03);
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.55), inset 0 -8px 12px rgba(76,29,149,.55),
    0 9px 0 #5b21b6, 0 18px 24px rgba(124,58,237,.5);
}
.lobby-btn.jelly:not(:disabled):active {
  animation: none;
  transform: translateY(5px) scale(1.04, .88);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.4), inset 0 -3px 6px rgba(76,29,149,.5),
    0 2px 0 #5b21b6, 0 4px 8px rgba(124,58,237,.35);
}
.lobby-btn.jelly:disabled {
  animation: none; cursor: not-allowed; filter: grayscale(.5) opacity(.55);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3), 0 4px 0 #94a3b8, 0 6px 10px rgba(100,116,139,.2);
}

#createControls.hidden { display: none; }
.picker-hint {
  display: none; align-items: center; justify-content: center; gap: 4px;
  text-align: center; font-size: 13px; font-weight: 800; color: #7c3aed;
  margin-bottom: 8px;
}
.picker-hint.show { display: flex; }
.picker-hint-emoji { display: inline-block; font-size: 16px; animation: hintPoint 1.1s ease-in-out infinite; }
@keyframes hintPoint {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(3px) rotate(8deg); }
}

.invite-box { display: none; margin-top: 10px; }
.invite-box.show { display: block; }
.invite-link-row { display: flex; gap: 6px; margin-bottom: 6px; }
.invite-link-row.hidden { display: none; }
.invite-link-row input {
  flex: 1; padding: 9px 10px; border-radius: 8px; border: 1.5px solid var(--line);
  font-family: inherit; font-size: 12px; background: var(--bg); color: var(--muted);
}
.invite-link-row button {
  padding: 9px 12px; border-radius: 8px; border: none; background: var(--accent);
  color: #fff; font-weight: 800; cursor: pointer; font-size: 12px;
}
#inviteStatus { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 8px; }
.queue-broadcast-hint {
  margin-top: 6px; font-size: 11.5px; font-weight: 700; color: #be123c;
  background: #fff1f2; border: 1px solid #fecdd3; border-radius: 10px; padding: 8px 10px;
}
.switch-random-btn.hidden { display: none; }
.cancel-invite-btn { margin-bottom: 0; }
.cancel-invite-btn.hidden { display: none; }

.queue-searchers {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; margin: 0 0 10px; border-radius: 16px;
  background: linear-gradient(135deg, #e11d48, #be123c);
  box-shadow: 0 8px 20px -6px rgba(225,29,72,.55), 0 0 0 2px rgba(255,255,255,.15) inset;
  cursor: pointer; animation: queueSearchPulse 1.6s ease-in-out infinite;
}
.queue-searchers:empty { display: none; animation: none; }
.qs-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center;
  font-size: 19px; animation: qsIconBounce 1.6s ease-in-out infinite;
}
.qs-body { flex: 1; min-width: 0; }
.qs-title { font-size: 14px; font-weight: 800; color: #fff; line-height: 1.3; }
.qs-title b { text-decoration: underline; }
.qs-cta { font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.85); margin-top: 2px; }
@keyframes queueSearchPulse {
  0%, 100% { box-shadow: 0 8px 20px -6px rgba(225,29,72,.55), 0 0 0 2px rgba(255,255,255,.15) inset; }
  50%      { box-shadow: 0 10px 28px -6px rgba(225,29,72,.8), 0 0 0 2px rgba(255,255,255,.3) inset; }
}
@keyframes qsIconBounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.15) rotate(-8deg); }
}
@media (prefers-reduced-motion: reduce) { .queue-searchers, .qs-icon { animation: none; } }

.live-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 12px; background: var(--surface); margin-bottom: 8px; cursor: pointer;
  border: 1.5px solid #fecdd3; box-shadow: 0 4px 14px -8px rgba(225,29,72,.4);
  transition: transform .1s, box-shadow .2s ease, border-color .2s ease;
  animation: liveRowGlow 2s ease-in-out infinite;
}
.live-row:active { transform: scale(.98); }
@keyframes liveRowGlow {
  0%, 100% { box-shadow: 0 4px 14px -8px rgba(225,29,72,.4); border-color: #fecdd3; }
  50%      { box-shadow: 0 6px 20px -6px rgba(225,29,72,.6); border-color: #fda4af; }
}
.live-badge {
  flex-shrink: 0; display: flex; align-items: center; gap: 4px;
  background: #e11d48; color: #fff; font-size: 9px; font-weight: 800;
  letter-spacing: .03em; padding: 3px 7px; border-radius: 999px;
}
.live-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: liveDotPulse 1s ease-in-out infinite; }
@keyframes liveDotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.live-avatars { display: flex; flex-shrink: 0; }
.live-avatars > * { margin-left: -8px; border: 2px solid var(--surface); border-radius: 50%; }
.live-avatars > *:first-child { margin-left: 0; }
.live-names { flex: 1; font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-watch { font-size: 11.5px; font-weight: 800; color: #e11d48; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { .live-row, .live-badge-dot { animation: none; } }
.empty-hint { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 0; }

/* ── Ranking ── */
.ranking-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.top-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 10px; background: var(--bg); margin-bottom: 6px;
}
.top-row-name { flex: 1; font-size: 13px; font-weight: 700; }
.top-row b { font-size: 12px; color: var(--accent); }
.rivalry-row {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 10px; background: var(--bg); margin-bottom: 6px;
}
.rivalry-text { flex: 1; text-align: center; font-size: 12px; }

/* ── Match header (dynamic 2-4 player chips, turn/round info) ── */
.round-label { text-align: center; font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding-top: 4px; }
.round-pairs { text-align: center; font-size: 10px; color: var(--muted); margin-top: 2px; }

.players-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 8px 4px; flex-shrink: 0; }
.player-chip {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px;
  border-radius: 999px; background: var(--bg); transition: background .2s, box-shadow .2s, opacity .2s;
}
.player-chip.active-turn { background: rgba(124,58,237,.1); box-shadow: 0 0 0 1.5px rgba(124,58,237,.35); }
.player-chip.disconnected { opacity: .55; box-shadow: 0 0 0 1.5px rgba(220,38,38,.4); }
.player-chip.eliminated { opacity: .35; filter: grayscale(1); }
.chip-name { font-size: 12px; font-weight: 700; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-score { font-size: 12px; font-weight: 800; color: var(--accent); }

.turn-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding-bottom: 4px; flex-shrink: 0; }
.turn-label { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.turn-label.my-turn { color: var(--success); }
.turn-countdown { font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.turn-countdown.urgent { color: var(--danger); animation: countdownPulse .6s ease infinite; }
@keyframes countdownPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.spectator-count { font-size: 11px; color: var(--muted); }

.disconnect-banner {
  display: none; text-align: center; font-size: 12px; font-weight: 700; color: #b45309;
  background: #fffbeb; border: 1.5px solid #fde68a; border-radius: 10px;
  padding: 6px 10px; margin: 0 4px 6px; flex-shrink: 0;
}
.disconnect-banner.show { display: block; }

.resume-banner {
  display: none; text-align: center; font-size: 13px; font-weight: 800; color: #fff;
  background: linear-gradient(120deg, #7c3aed, #a855f7); border-radius: 12px;
  padding: 12px; margin-bottom: 10px; cursor: pointer;
}
.resume-banner.show { display: block; }

.join-toast .fr-name { padding: 2px 4px; }

/* ── Reactions ──
   16 emoji wrapped into a centered flex row used to take 3 lines -- on a
   short phone screen, the board's flex:1 grabbed space first and squeezed
   this down until it was cut off entirely (not just cramped -- genuinely
   not on screen). Fixed height, single row, scrolls sideways instead of
   wrapping, so it can never be squeezed below its own one-row height. */
.reaction-bar {
  display: flex; flex-wrap: nowrap; flex-shrink: 0;
  gap: 4px; padding: 6px 4px; margin: 0 -4px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.reaction-bar::-webkit-scrollbar { display: none; }
.reaction-btn {
  border: none; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 18px; padding: 4px 8px; cursor: pointer;
  transition: transform .1s; flex-shrink: 0;
}
.reaction-btn:active { transform: scale(.85); }

/* Full-viewport (not a fixed "bottom: 90px" guess at the bottom-nav's height,
   which varies slightly by device and could push this off-screen on a short
   phone) -- the floating reaction's own `bottom` offset below decides where
   it starts, decoupled from whatever else is on screen. */
.reaction-layer {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 998; overflow: hidden;
}
.floating-reaction {
  position: absolute; bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.95); border-radius: 999px; padding: 4px 10px 4px 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  animation: floatUp 3.2s ease-out forwards;
  white-space: nowrap;
}
.fr-name { font-size: 11px; font-weight: 700; color: var(--ink); }
.fr-emoji { font-size: 16px; }
@keyframes floatUp {
  0% { transform: translateX(-50%) translateY(0) scale(.8); opacity: 0; }
  10% { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1); }
  85% { opacity: 1; }
  100% { transform: translateX(-50%) translateY(-300px) scale(.9); opacity: 0; }
}

/* ── Confetti ── */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 260; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -10px; width: 8px; height: 14px; opacity: .9;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall { to { transform: translateY(110vh) rotate(540deg); opacity: 0; } }

/* ── Match end overlay ── */
.matchend-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(15,23,42,.6); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 20px;
}
.matchend-overlay.show { display: flex; }
.matchend-card { background: var(--surface); border-radius: 20px; padding: 26px 22px; max-width: 320px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.matchend-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.matchend-score { font-size: 30px; font-weight: 800; margin-bottom: 18px; color: var(--accent); }
