/* LinguaRush — DARK color scheme */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* Theme palette */
  --color-1: #300030;
  --color-2: #480048;
  --color-3: #601848;
  --color-4: #C04848;
  --color-5: #F07241;

  /* Mapped to app UI */
  --bg: var(--color-1);
  --surface: var(--color-2);
  --card: var(--color-3);
  --accent: var(--color-4);
  --accent-2: #d85858;
  --accent2: var(--color-5);
  --gold: var(--color-5);
  --green: #6ecf8a;
  --red: var(--color-4);
  --text: #fce8f0;
  --muted: #c9a0b8;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(48, 0, 48, 0.55);
  --border: #7a2858;
  --border-soft: var(--color-2);
  --locked-bg: rgba(192, 72, 72, 0.22);
  --overlay-bg: rgba(48, 0, 48, 0.82);
}
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; transition: background .3s, color .3s; }
.screen { display: none; min-height: 100vh; padding: 24px; flex-direction: column; align-items: center; justify-content: center; }
.screen.active { display: flex; }
#lobby { gap: 20px; }
.logo { font-size: 2.8rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.tagline { color: var(--muted); font-size: 1rem; margin-top: -10px; }
.card { background: var(--card); border-radius: var(--radius); padding: 28px 32px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.2rem; margin-bottom: 18px; color: var(--accent2); }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 5px; margin-top: 14px; }
input, select { width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1rem; outline: none; transition: border .2s; }
input:focus, select:focus { border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: 8px; border: none; font-size: 1rem; font-weight: 600; cursor: pointer; transition: transform .15s, opacity .15s; }
.btn:hover { transform: translateY(-1px); opacity: .92; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; width: 100%; margin-top: 18px; }
.btn-join { background: var(--surface); color: var(--text); border: 1px solid var(--border); width: 100%; margin-top: 10px; }
.room-info { background: var(--surface); border-radius: 8px; padding: 10px 14px; font-size: .9rem; color: var(--muted); margin-top: 10px; word-break: break-all; }
.room-info span { color: var(--accent2); font-weight: 700; }
.player-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.slot { background: var(--surface); border-radius: 8px; padding: 10px 14px; font-size: .9rem; border: 1px dashed var(--border); color: var(--muted); }
.slot.filled { border-color: var(--green); color: var(--text); }
.slot .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }
#game { padding: 16px; gap: 0; justify-content: flex-start; }
.game-header { width: 100%; max-width: 900px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.round-badge { background: var(--accent); color: #fff; border-radius: 20px; padding: 4px 14px; font-size: .85rem; font-weight: 700; }
.lang-badge { background: var(--surface); border-radius: 20px; padding: 4px 14px; font-size: .85rem; color: var(--accent2); border: 1px solid var(--accent2); }
.difficulty-badge { background: var(--surface); border-radius: 20px; padding: 4px 14px; font-size: .85rem; color: var(--gold); border: 1px solid var(--gold); }
.timer-ring { position: relative; width: 64px; height: 64px; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 5; }
.timer-bg { stroke: var(--border); }
.timer-fg { stroke: var(--accent2); stroke-linecap: round; transition: stroke-dashoffset .9s linear, stroke .3s; }
.timer-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 800; }
.game-body { width: 100%; max-width: 900px; display: grid; grid-template-columns: 1fr 280px; gap: 16px; }
@media(max-width:680px){ .game-body { grid-template-columns: 1fr; } }
.main-col { display: flex; flex-direction: column; gap: 14px; }
.word-card { background: var(--card); border-radius: var(--radius); padding: 28px; text-align: center; box-shadow: var(--shadow); }
.language-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px; }
.foreign-word { font-size: 3rem; font-weight: 900; letter-spacing: 4px; background: linear-gradient(135deg, var(--color-5), var(--color-4)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.hint-text { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.blanks-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.blank-box { width: 36px; height: 44px; border-bottom: 3px solid var(--accent); display: flex; align-items: flex-end; justify-content: center; font-size: 1.4rem; font-weight: 700; color: var(--accent2); padding-bottom: 4px; transition: border-color .3s; }
.blank-box.revealed { border-color: var(--green); }
.guess-area { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.guess-area h3 { font-size: .95rem; color: var(--muted); margin-bottom: 12px; }
.guess-form { display: flex; gap: 8px; }
.guess-form input { flex: 1; }
.btn-guess { background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn-guess:disabled { opacity: .4; cursor: not-allowed; }
.wrong-counter { margin-top: 10px; display: flex; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); }
.x-mark { color: var(--red); font-weight: 900; font-size: 1rem; }
.locked-msg { margin-top: 10px; background: var(--locked-bg); border-radius: 8px; padding: 8px 12px; font-size: .85rem; color: var(--red); display: none; }
.feed { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); max-height: 180px; overflow-y: auto; }
.feed h3 { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.feed-item { font-size: .85rem; padding: 5px 0; border-bottom: 1px solid var(--border-soft); }
.feed-item:last-child { border: none; }
.feed-correct { color: var(--green); }
.feed-wrong { color: var(--red); }
.feed-system { color: var(--accent2); font-style: italic; }
.side-col { display: flex; flex-direction: column; gap: 14px; }
.scoreboard { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.scoreboard h3 { font-size: .9rem; color: var(--muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.player-row:last-child { border: none; }
.player-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; flex-shrink: 0; color: #fff; }
.player-name { flex: 1; font-size: .9rem; }
.player-pts { font-weight: 800; font-size: 1rem; color: var(--gold); }
.you-tag { font-size: .7rem; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
.phase-banner { background: var(--surface); border-radius: 8px; padding: 10px 14px; font-size: .85rem; color: var(--accent2); border-left: 3px solid var(--accent2); }
#result { gap: 20px; }
.result-card { background: var(--card); border-radius: var(--radius); padding: 32px; width: 100%; max-width: 500px; text-align: center; box-shadow: var(--shadow); }
.result-card h2 { font-size: 1.6rem; margin-bottom: 6px; }
.result-card .subtitle { color: var(--muted); font-size: .9rem; margin-bottom: 24px; }
.result-difficulty { color: var(--accent2); font-size: .88rem; margin: -12px 0 20px; }
.level-up-section { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; text-align: left; border: 1px solid var(--border); }
.level-up-section h3 { font-size: 1rem; margin-bottom: 6px; color: var(--accent2); }
.level-up-sub { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.level-up-buttons { display: flex; flex-direction: column; gap: 10px; }
.btn-level-up { width: 100%; text-align: left; padding: 12px 16px; background: var(--card); border: 1px solid var(--border); color: var(--text); border-radius: 10px; font-size: .95rem; font-weight: 600; cursor: pointer; transition: border-color .2s, transform .15s; }
.btn-level-up:hover { border-color: var(--accent2); transform: translateY(-1px); }
.level-up-pts { display: block; font-size: .78rem; color: var(--gold); font-weight: 700; margin-top: 4px; }
.podium { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.podium-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 8px; padding: 10px 16px; }
.rank-badge { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1rem; flex-shrink: 0; }
.rank-1 { background: var(--gold); color: #000; }
.rank-2 { background: var(--color-3); color: var(--text); }
.rank-3 { background: var(--color-4); color: #fff; }
.rank-other { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.podium-name { flex: 1; text-align: left; font-weight: 600; }
.podium-score { font-weight: 800; color: var(--gold); font-size: 1.1rem; }
.overlay { position: fixed; inset: 0; background: var(--overlay-bg); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .3s; }
.overlay.show { opacity: 1; pointer-events: all; }
.overlay-box { background: var(--card); border-radius: var(--radius); padding: 32px; text-align: center; max-width: 360px; width: 90%; box-shadow: var(--shadow); }
.overlay-box .big { font-size: 3rem; margin-bottom: 8px; }
.overlay-box h2 { font-size: 1.4rem; margin-bottom: 6px; }
.overlay-box p { color: var(--muted); font-size: .9rem; }
.pts-earned { font-size: 2rem; font-weight: 900; color: var(--gold); margin: 10px 0; }
.error-msg { color: var(--red); font-size: .85rem; margin-top: 8px; display: none; }
.hint-msg { color: var(--muted); font-size: .82rem; margin-top: 8px; line-height: 1.4; }
.theme-toggle { position: fixed; top: 14px; right: 14px; z-index: 200; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 20px; padding: 7px 14px; font-size: .85rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, opacity .15s; }
.theme-toggle:hover { transform: translateY(-1px); opacity: .9; }
.app-footer { width: 100%; padding: 22px 16px; text-align: center; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border-soft); }
.app-footer a { color: var(--accent2); text-decoration: none; font-weight: 600; }
.app-footer a:hover { text-decoration: underline; }

/* Auth (Google / Facebook) */
.auth-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.auth-divider { text-align: center; font-size: .82rem; color: var(--muted); margin-bottom: 12px; }
.auth-buttons { display: flex; flex-direction: column; gap: 10px; }
.btn-auth { width: 100%; margin-top: 0; font-size: .95rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn-auth:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-google { border-color: #4285f4; }
.btn-facebook { border-color: #1877f2; }
.auth-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 4px; font-weight: 800; font-size: .85rem; }
.btn-google .auth-icon { background: #fff; color: #4285f4; }
.btn-facebook .auth-icon { background: #1877f2; color: #fff; border-radius: 50%; }
.auth-status { margin-top: 12px; font-size: .82rem; color: var(--green); text-align: center; word-break: break-word; }
.btn-auth-signout { margin-top: 10px; width: 100%; padding: 8px 14px; font-size: .85rem; background: transparent; color: var(--muted); border: 1px dashed var(--border); border-radius: 8px; cursor: pointer; }
.btn-auth-signout:hover { color: var(--text); border-color: var(--accent); }

/* Legal / privacy page */
.legal-page { max-width: 720px; margin: 0 auto; padding: 80px 24px 40px; line-height: 1.65; }
.legal-back { display: inline-block; margin-bottom: 24px; color: var(--accent2); text-decoration: none; font-weight: 600; }
.legal-back:hover { text-decoration: underline; }
.legal-page h1 { font-size: 2rem; margin-bottom: 8px; color: var(--accent2); }
.legal-updated { color: var(--muted); font-size: .9rem; margin-bottom: 28px; }
.legal-page section { margin-bottom: 28px; }
.legal-page h2 { font-size: 1.15rem; margin-bottom: 10px; color: var(--text); }
.legal-page p, .legal-page li { color: var(--muted); margin-bottom: 10px; }
.legal-page ul { padding-left: 1.25rem; }
.legal-page a { color: var(--accent2); }

/* Getting started floating popup */
.getting-started-popup {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 160;
  width: min(360px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent2);
  border-radius: var(--radius);
  padding: 18px 44px 16px 18px;
  box-shadow: var(--shadow), 0 12px 40px rgba(48, 0, 48, 0.45);
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform .4s cubic-bezier(.22, 1, .36, 1), opacity .35s ease;
}
.getting-started-popup.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
  animation: gettingStartedIn .45s cubic-bezier(.22, 1, .36, 1);
}
@keyframes gettingStartedIn {
  from { transform: translateY(calc(100% + 24px)); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.getting-started-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.getting-started-close:hover { color: var(--text); background: var(--surface); }
.getting-started-body { font-size: .88rem; color: var(--muted); line-height: 1.5; }
.getting-started-title { font-size: 1.05rem; color: var(--accent2); margin-bottom: 10px; }
.getting-started-steps { margin: 0 0 14px 1.1rem; padding: 0; }
.getting-started-steps li { margin-bottom: 8px; }
.getting-started-steps li:last-child { margin-bottom: 0; }
.getting-started-steps strong { color: var(--text); }
.getting-started-got-it { width: 100%; margin-top: 0; padding: 10px 16px; font-size: .9rem; }
body.lobby-keyboard-open .getting-started-popup { display: none !important; }

/* ── Lobby countdown overlay ── */
.lobby-overlay { position: fixed; inset: 0; background: var(--overlay-bg); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 300; opacity: 0; pointer-events: none; transition: opacity .3s; }
.lobby-overlay.show { opacity: 1; pointer-events: all; }
.lobby-overlay-box { width: 80vw; height: 80vh; max-width: 760px; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px; text-align: center; border: 1px solid var(--border); animation: lobbyPop .4s ease; }
@keyframes lobbyPop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lobby-title { font-size: 1.5rem; color: var(--text); }
.lobby-room { font-size: .95rem; color: var(--muted); }
.lobby-room span { color: var(--accent2); font-weight: 800; letter-spacing: 1px; }
.countdown-ring { position: relative; width: min(46vh, 300px); height: min(46vh, 300px); }
.countdown-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown-ring circle { fill: none; stroke-width: 10; }
.cd-bg { stroke: var(--border); }
.cd-fg { stroke: var(--accent2); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s; filter: drop-shadow(0 0 6px var(--accent2)); }
.countdown-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(3rem, 12vh, 6rem); font-weight: 900; color: var(--text); animation: cdPulse 1s ease-in-out infinite; }
@keyframes cdPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.lobby-status { font-size: 1rem; font-weight: 700; color: var(--accent2); }
.lobby-sub { font-size: .85rem; color: var(--muted); max-width: 420px; }

/* ── Wall of Fame ── */
.wall-of-fame { max-width: 440px; }
.wall-of-fame-result { width: 100%; margin-bottom: 20px; text-align: left; }
.fame-entry { background: var(--surface); border-radius: 10px; padding: 14px 16px; margin-top: 12px; border-left: 3px solid var(--gold); }
.fame-entry + .fame-entry { border-left-color: var(--accent2); }
.fame-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.fame-name { font-size: 1.15rem; font-weight: 800; color: var(--text); }
.fame-stat { font-size: 1.4rem; font-weight: 900; color: var(--gold); margin-top: 2px; }
.fame-detail { font-size: .9rem; color: var(--accent2); margin-top: 4px; font-weight: 600; }
.fame-meta { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.fame-empty { font-size: .88rem; color: var(--muted); font-style: italic; }

/* ── Support banner ── */
.support-banner {
  position: fixed;
  left: 50%;
  z-index: 150;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 16px 44px 16px 20px;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%) translateY(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform .4s cubic-bezier(.22, 1, .36, 1), opacity .35s ease,
    bottom .3s ease, width .3s ease, max-width .3s ease, border-radius .3s ease, box-shadow .3s ease;
}
.support-banner.show {
  opacity: 1;
  pointer-events: all;
}
/* Lobby: docked bar at the bottom of the start screen */
.support-banner.support-banner--lobby {
  bottom: 0;
  width: 100%;
  max-width: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 32px rgba(48, 0, 48, 0.35);
  transform: translateX(-50%) translateY(0);
}
.support-banner.support-banner--lobby::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold);
  border-radius: var(--radius) 0 0 0;
}
/* Game over: floating card */
.support-banner.support-banner--float {
  bottom: 20px;
  width: calc(100% - 32px);
  max-width: 520px;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 12px 40px rgba(48, 0, 48, 0.45);
  transform: translateX(-50%) translateY(0);
  animation: supportBannerFloatIn .45s cubic-bezier(.22, 1, .36, 1);
}
@keyframes supportBannerFloatIn {
  from { transform: translateX(-50%) translateY(calc(100% + 24px)); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.support-banner p { margin-bottom: 8px; }
.support-banner p:last-of-type { margin-bottom: 12px; }
.support-banner a { color: var(--accent2); font-weight: 600; text-decoration: none; }
.support-banner a:hover { text-decoration: underline; }
.support-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.support-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .85rem;
  text-decoration: none;
  transition: transform .15s, opacity .15s;
}
.support-links a:hover { transform: translateY(-1px); opacity: .92; text-decoration: none; }
.support-banner-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.support-banner-close:hover { color: var(--text); background: var(--surface); }
#lobby.active { padding-bottom: 16px; }
#result.active { padding-bottom: 130px; }

/* ── Mobile game layout (keep guess input above keyboard) ── */
@media (max-width: 680px) {
  #game.active {
    min-height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    padding: 10px 12px 16px;
    padding-top: max(48px, env(safe-area-inset-top, 0px));
  }
  #game .game-header { margin-bottom: 8px; }
  #game .timer-ring { width: 48px; height: 48px; }
  #game .timer-ring svg { width: 48px; height: 48px; }
  #game .game-body { gap: 10px; }
  #game .main-col { gap: 10px; }
  #game .word-card { padding: 14px 16px; }
  #game .language-label { margin-bottom: 4px; font-size: .72rem; }
  #game .foreign-word {
    font-size: clamp(1.2rem, 5.5vw, 1.85rem);
    letter-spacing: 1px;
    line-height: 1.25;
    word-break: break-word;
  }
  #game .hint-text { margin-top: 4px; font-size: .78rem; }
  #game .blanks-row { margin-top: 8px; gap: 5px; }
  #game .blank-box { width: 26px; height: 30px; font-size: .95rem; }
  #game .guess-area {
    position: sticky;
    bottom: 0;
    z-index: 100;
    padding: 12px 14px;
    margin-top: 4px;
  }
  #game .guess-area h3 { font-size: .82rem; margin-bottom: 8px; }
  #game .guess-form input { font-size: 16px; }
  #game .feed { max-height: 100px; }
  #game .side-col { gap: 8px; }
  #game .scoreboard { padding: 12px; }
  #game .phase-banner { font-size: .78rem; padding: 8px 10px; }
}
body.game-keyboard-open #game .feed,
body.game-keyboard-open #game .side-col { display: none; }
body.game-keyboard-open #game .word-card { padding: 10px 12px; }
body.game-keyboard-open #game .foreign-word {
  font-size: clamp(1rem, 4.5vw, 1.35rem);
}
body.game-keyboard-open #game .blanks-row { display: none; }
body.game-keyboard-open #game .guess-area {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: var(--keyboard-inset, 0px);
  margin: 0;
  box-shadow: 0 -6px 28px rgba(48, 0, 48, 0.5);
}

/* ── Mobile lobby layout (keep all setup fields above keyboard) ── */
@media (max-width: 680px) {
  #lobby.active {
    min-height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    padding: 10px 12px 16px;
    padding-top: max(48px, env(safe-area-inset-top, 0px));
    gap: 12px;
  }
  #lobby .logo { font-size: 2rem; }
  #lobby .tagline { font-size: .9rem; margin-top: -6px; }
  #lobby .card { padding: 18px 20px; }
  #lobby #setup-card h2 { font-size: 1.05rem; margin-bottom: 12px; }
  #lobby label { margin-top: 12px; margin-bottom: 4px; font-size: .82rem; }
  #lobby input,
  #lobby select { font-size: 16px; padding: 9px 12px; }
  #lobby #setup-card .btn-primary { margin-top: 14px; }
}
body.lobby-keyboard-open .support-banner { display: none !important; }
body.lobby-keyboard-open #lobby .logo,
body.lobby-keyboard-open #lobby .tagline,
body.lobby-keyboard-open #lobby .wall-of-fame { display: none; }
body.lobby-keyboard-open #lobby.active {
  gap: 0;
  padding-bottom: calc(var(--keyboard-inset, 0px) + 12px);
}
body.lobby-keyboard-open #lobby #setup-card {
  width: 100%;
  max-width: none;
  padding: 10px 14px;
  scroll-margin-top: 52px;
}
body.lobby-keyboard-open #lobby #setup-card h2 {
  font-size: .88rem;
  margin-bottom: 4px;
}
body.lobby-keyboard-open #lobby #setup-card label {
  margin-top: 6px;
  margin-bottom: 2px;
  font-size: .78rem;
}
body.lobby-keyboard-open #lobby #setup-card input,
body.lobby-keyboard-open #lobby #setup-card select {
  padding: 7px 10px;
}
body.lobby-keyboard-open #lobby #setup-card .btn-primary {
  margin-top: 8px;
  padding: 9px 14px;
  font-size: .92rem;
}
body.lobby-keyboard-open #lobby #setup-card .error-msg {
  margin-top: 4px;
  font-size: .78rem;
}
