/* Alpaca — Nordic quiet */

:root {
  color-scheme: light;
  --ink: #1d2a2e;
  --muted: #687477;
  --faint: #9aa19f;
  --paper: #f2f0e9;
  --shell: #eceae3;
  --surface: #fdfcf8;
  --surface-2: #e9e7df;
  --surface-hover: #dcdad2;
  --line: #d9d8d1;
  --line-soft: #e7e5df;
  --accent: #315f7d;
  --accent-dark: #244a64;
  --accent-soft: #e4ebee;
  --accent-soft-hover: #d5e1e7;
  --on-accent: #ffffff;
  --prompt-bg: #315f7d;
  --prompt-ink: #ffffff;
  --coral: #c86751;
  --yellow: #e6bc62;
  --mint: #4f806f;
  --mint-soft: #e2ebe7;
  --mint-ink: #356452;
  --warn-soft: #f4ead1;
  --warn-ink: #7d5a12;
  --danger-soft: #f3dfda;
  --danger-ink: #824637;
  --overlay: rgba(253, 252, 248, .95);
  --scrim: rgba(29, 42, 46, .3);
  --deco: #dce5e4;
  --canvas: #ffffff;
  --avatar-ink: #1d2a2e;
  --avatar-indigo: #b9ccd6;
  --avatar-coral: #e6b3a6;
  --avatar-mint: #b6d0c6;
  --avatar-yellow: #ead49d;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e4eae9;
    --muted: #9ba7a8;
    --faint: #6f7b7c;
    --paper: #141b1d;
    --shell: #11171a;
    --surface: #1b2427;
    --surface-2: #243034;
    --surface-hover: #2c3a3f;
    --line: #2e3b3f;
    --line-soft: #253135;
    --accent: #84b3d0;
    --accent-dark: #a6c9de;
    --accent-soft: #213540;
    --accent-soft-hover: #294250;
    --on-accent: #0f1a1f;
    --prompt-bg: #234a61;
    --prompt-ink: #ffffff;
    --coral: #e08a74;
    --mint: #7fb5a0;
    --mint-soft: #1d3430;
    --mint-ink: #a6d3c1;
    --warn-soft: #3a321d;
    --warn-ink: #e9cd84;
    --danger-soft: #3d2622;
    --danger-ink: #f0b3a3;
    --overlay: rgba(27, 36, 39, .95);
    --scrim: rgba(0, 0, 0, .5);
    --deco: #18292b;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4eae9;
  --muted: #9ba7a8;
  --faint: #6f7b7c;
  --paper: #141b1d;
  --shell: #11171a;
  --surface: #1b2427;
  --surface-2: #243034;
  --surface-hover: #2c3a3f;
  --line: #2e3b3f;
  --line-soft: #253135;
  --accent: #84b3d0;
  --accent-dark: #a6c9de;
  --accent-soft: #213540;
  --accent-soft-hover: #294250;
  --on-accent: #0f1a1f;
  --prompt-bg: #234a61;
  --prompt-ink: #ffffff;
  --coral: #e08a74;
  --mint: #7fb5a0;
  --mint-soft: #1d3430;
  --mint-ink: #a6d3c1;
  --warn-soft: #3a321d;
  --warn-ink: #e9cd84;
  --danger-soft: #3d2622;
  --danger-ink: #f0b3a3;
  --overlay: rgba(27, 36, 39, .95);
  --scrim: rgba(0, 0, 0, .5);
  --deco: #18292b;
}

/* ---------------------------------------------------------------- Base */

* { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
button { transition: background-color .16s ease, border-color .16s ease, color .16s ease, opacity .16s ease; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hidden { display: none !important; }

.screen { display: none; }
.screen.is-active { display: block; }
.screen::after {
  content: "";
  position: fixed;
  z-index: 0;
  right: -13vw;
  bottom: -18vw;
  width: min(34vw, 480px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--deco);
  pointer-events: none;
}
.game-screen::after { display: none; }

.eyebrow, .hero-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint-ink);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.connection-pill.offline { background: var(--danger-soft); color: var(--danger-ink); }
.connection-pill.offline i { background: var(--coral); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font: 600 27px/1 var(--font-serif);
  letter-spacing: -.6px;
  text-decoration: none;
}
.brand-mark { position: relative; z-index: 0; width: 34px; height: 34px; display: inline-grid; place-items: center; }
.brand-mark::before { content: ""; position: absolute; width: 30px; height: 30px; border-radius: 48% 48% 44% 44%; background: var(--yellow); }
.alpaca-mark::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -2px;
  width: 22px;
  height: 13px;
  border-left: 5px solid var(--ink);
  border-right: 5px solid var(--ink);
  border-radius: 5px 5px 0 0;
}
.brand-mark span { position: absolute; z-index: 1; width: 3px; height: 3px; border-radius: 50%; background: #1d2a2e; }
.brand-mark span:nth-child(1) { transform: translate(-7px, -3px); }
.brand-mark span:nth-child(2) { transform: translate(7px, -3px); }
.brand-mark span:nth-child(3) { width: 11px; height: 6px; background: transparent; border-bottom: 2px solid #1d2a2e; transform: translateY(5px); }

/* Buttons */
.primary-button, .secondary-button {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.primary-button:hover:not(:disabled) { border-color: var(--accent-dark); background: var(--accent-dark); }
.secondary-button { border: 1px solid var(--line); background: transparent; }
.secondary-button:hover { background: var(--surface-2); }
.primary-button:disabled, .secondary-button:disabled { border-color: var(--line); background: var(--surface-2); color: var(--faint); cursor: not-allowed; }
.quiet-button {
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.quiet-button:hover { background: var(--surface-2); color: var(--ink); }
.link-button { padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.link-button:hover { background: var(--accent-soft); }
.icon-button, .avatar-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-2); }
.icon-button.players-toggle { display: none; }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#soundButton .sound-off, #soundButton.muted .sound-on { display: none; }
#soundButton.muted .sound-off { display: block; }
#soundButton.muted { color: var(--muted); }

/* Avatars */
.mini-avatar, .avatar-choice, .profile-avatar-choice, .avatar-button {
  border: 0;
  border-radius: 50%;
  color: var(--avatar-ink);
  font-weight: 700;
}
.mini-avatar { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; font-size: 13px; }
.mini-avatar.large { width: 52px; height: 52px; font-size: 19px; }
.indigo { --avatar: var(--avatar-indigo); }
.coral { --avatar: var(--avatar-coral); }
.mint { --avatar: var(--avatar-mint); }
.yellow { --avatar: var(--avatar-yellow); }
.mini-avatar, .avatar-choice, .profile-avatar-choice, .avatar-button { background: var(--avatar, var(--avatar-indigo)); }

/* Forms */
.field-group label, .avatar-picker > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.field-group input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
}
.field-group input:hover { border-color: var(--faint); }
.field-group input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field-group input::placeholder { color: var(--faint); }
.code-input { letter-spacing: .2em; text-transform: uppercase; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 9px; background: var(--danger-soft); color: var(--danger-ink); font-size: 13px; font-weight: 600; }

/* ---------------------------------------------------------------- Home */

.marketing-screen, .lobby-screen { position: relative; min-height: 100%; overflow-x: hidden; }
.marketing-nav {
  position: relative;
  z-index: 2;
  max-width: 1160px;
  height: 82px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.home-main {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 56px));
  min-height: calc(100vh - 142px);
  margin: 0 auto;
  padding: 48px 0 100px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, .72fr);
  gap: clamp(56px, 9vw, 120px);
  align-items: center;
}
.hero-copy h1, .lobby-intro h1, .results-card h1 {
  margin: 20px 0 22px;
  font: 500 clamp(58px, 6.8vw, 94px)/.96 var(--font-serif);
  letter-spacing: -.055em;
}
.hero-copy h1 em { color: var(--accent); font-style: italic; white-space: nowrap; }
.hero-copy > p, .lobby-intro > p { max-width: 460px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.how-it-works { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 12px; }
.how-it-works li { display: flex; align-items: center; gap: 12px; color: var(--ink); font-size: 14px; font-weight: 500; }
.how-it-works b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
}

.entry-card, .lobby-card, .results-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.entry-card { width: 100%; padding: 8px; }
.entry-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.entry-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.entry-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.entry-form { display: grid; gap: 18px; padding: 24px 18px 18px; }
.avatar-picker { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.avatar-picker > span { margin: 0; }
.avatar-picker > div, .profile-looks { display: flex; gap: 10px; }
.avatar-choice, .profile-avatar-choice { width: 36px; height: 36px; font-size: 13px; cursor: pointer; }
.profile-avatar-choice { width: 44px; height: 44px; font-size: 15px; }
.avatar-choice.active, .profile-avatar-choice.active { outline: 2px solid var(--accent); outline-offset: 3px; }
.marketing-footer {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 22px;
  width: min(1100px, calc(100% - 56px));
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
}

/* ---------------------------------------------------------------- Lobby */

.compact-nav { height: 78px; }
.nav-actions { display: flex; align-items: center; gap: 4px; }
.lobby-main {
  position: relative;
  z-index: 1;
  width: min(1000px, calc(100% - 56px));
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  padding: 50px 0 90px;
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: clamp(54px, 9vw, 110px);
  align-items: center;
}
.lobby-intro h1 { margin: 17px 0 20px; font-size: clamp(54px, 6vw, 76px); line-height: .95; }
.share-box {
  margin-top: 30px;
  padding: 14px 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.share-box > span { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.share-box strong { grid-column: 1; font-size: 22px; font-weight: 600; letter-spacing: .14em; }
.share-box button {
  grid-column: 2;
  grid-row: 1 / 3;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.share-box button:hover { background: var(--accent-soft-hover); }
.lobby-card { padding: 20px; }
.lobby-card-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 17px; }
.lobby-card-head h2 { margin: 4px 0 0; font-size: 22px; font-weight: 600; }
.lobby-players { display: grid; border-top: 1px solid var(--line); }
.lobby-player { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); }
.lobby-player > div strong { display: block; font-size: 14px; font-weight: 600; }
.lobby-player > div small { color: var(--muted); font-size: 12px; }
.lobby-player > b { padding: 4px 9px; border-radius: 999px; background: var(--mint-soft); color: var(--mint-ink); font-size: 11px; font-weight: 600; }
.lobby-player.offline { opacity: .55; }
.lobby-player.offline > b { background: var(--surface-2); color: var(--muted); }
.game-settings { margin: 16px 0; padding: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border-radius: 12px; background: var(--surface-2); }
.game-settings label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.game-settings select {
  width: 100%;
  margin-top: 6px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.game-settings select:disabled { opacity: .7; cursor: not-allowed; }
.start-button { width: 100%; }
.demo-note { display: block; margin-top: 11px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.5; }

/* ---------------------------------------------------------------- Results */

.results-screen { position: relative; min-height: 100%; padding: 40px 20px; place-items: center; }
.results-screen.is-active { display: grid; }
.results-card { z-index: 2; width: min(480px, 100%); padding: 30px 28px 24px; text-align: center; }
.results-card h1 { margin: 10px 0 18px; font-size: 44px; line-height: 1.02; letter-spacing: -.04em; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 0 0 20px; }
.podium-step { width: 110px; display: grid; justify-items: center; gap: 4px; }
.podium-step strong { max-width: 100%; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.podium-step > span:not(.mini-avatar) { color: var(--muted); font-size: 12px; font-weight: 600; }
.podium-step b {
  width: 100%;
  margin-top: 6px;
  display: grid;
  place-items: center;
  border-radius: 10px 10px 0 0;
  background: var(--surface-2);
  color: var(--muted);
  font: 500 24px var(--font-serif);
}
.podium-step.place-1 b { height: 74px; background: var(--yellow); color: #1d2a2e; }
.podium-step.place-2 b { height: 52px; }
.podium-step.place-3 b { height: 36px; }
.podium-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); text-align: left; }
.podium-list li { display: grid; grid-template-columns: 24px 38px 1fr auto; gap: 9px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.podium-list li.result-you { background: var(--mint-soft); }
.podium-list li > b { color: var(--muted); font-size: 13px; }
.podium-list li > span:nth-child(3) { font-size: 14px; font-weight: 600; }
.podium-list small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.podium-list strong { font-size: 14px; }
.result-actions { display: grid; grid-template-columns: 1.3fr .7fr; gap: 8px; margin-top: 18px; }
.confetti i { position: absolute; z-index: 1; width: 7px; height: 18px; border-radius: 4px; opacity: .6; animation: float 6s ease-in-out infinite; }
.confetti i:nth-child(1) { left: 15%; top: 20%; background: var(--yellow); }
.confetti i:nth-child(2) { left: 25%; bottom: 20%; background: var(--mint); animation-delay: -1s; }
.confetti i:nth-child(3) { right: 18%; top: 18%; background: var(--accent); animation-delay: -2s; }
.confetti i:nth-child(4) { right: 26%; bottom: 16%; background: var(--yellow); animation-delay: -3s; }
.confetti i:nth-child(5) { left: 8%; top: 55%; background: var(--coral); animation-delay: -4s; }
.confetti i:nth-child(6) { right: 8%; top: 55%; background: var(--mint); animation-delay: -5s; }
.confetti i:nth-child(7) { left: 50%; top: 8%; background: var(--coral); animation-delay: -2.5s; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(20deg); } 50% { transform: translateY(-14px) rotate(-25deg); } }

/* ---------------------------------------------------------------- Game shell */

.app-shell { height: 100vh; height: 100dvh; padding: 14px 18px 18px; background: var(--shell); overflow: hidden; }
.app-shell.is-active { display: flex; flex-direction: column; }
.app-shell, .app-shell *:not(input):not(textarea) { -webkit-user-select: none; user-select: none; }
.app-shell input, .messages, .messages * { -webkit-user-select: text; user-select: text; }

.topbar {
  width: 100%;
  max-width: 1640px;
  height: 58px;
  flex: 0 0 auto;
  margin: 0 auto 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.topbar .brand { font-size: 23px; }
.round-summary { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.round-summary > span { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.round-summary strong { font-weight: 600; white-space: nowrap; }
.round-dots { display: flex; gap: 5px; }
.round-dots i { width: 24px; height: 4px; border-radius: 4px; background: var(--line); }
.round-dots i.done { background: var(--mint); }
.round-dots i.active { background: var(--accent); }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.avatar-button { border-radius: 50%; font-size: 14px; }

.game-grid {
  width: 100%;
  max-width: 1640px;
  min-height: 0;
  flex: 1;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 290px;
  gap: 10px;
}

.panel, .prompt-card, .canvas-card, .guess-composer form, .quick-reactions, .drawing-votes, .draw-toolbar {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
}
.panel { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel-heading { min-height: 66px; display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 3px 0 0; font-size: 18px; font-weight: 600; }
.panel-heading h2 b, .message-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  margin-left: 5px;
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
}

/* Players */
.players-list { list-style: none; margin: 0; padding: 6px 9px; display: grid; align-content: start; overflow-y: auto; flex: 1; }
.player {
  position: relative;
  display: grid;
  grid-template-columns: 18px 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line-soft);
}
.player:last-child { border-bottom: 0; }
.player.is-drawing { margin: 0 -4px; padding-inline: 10px; border-radius: 10px; background: var(--accent-soft); }
.player.guessed .player-name small { color: var(--mint-ink); }
.player.offline { opacity: .5; }
.rank { color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; }
.player-name { min-width: 0; overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.player-name small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
.player-name em, .host-mark {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: 2px;
}
.host-mark { background: var(--surface-2); color: var(--muted); }
.player > strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.pencil-badge, .correct-badge { position: absolute; left: 50px; bottom: 5px; border: 2px solid var(--surface); width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; }
.player.is-drawing .pencil-badge { left: 54px; border-color: var(--accent-soft); }
.pencil-badge { background: var(--accent); color: var(--on-accent); }
.correct-badge { background: var(--mint); color: #fff; }
.room-code { margin: 10px 11px 11px; padding: 12px; border-radius: 11px; background: var(--surface-2); }
.room-code > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.room-code button { width: 100%; padding: 0; display: flex; justify-content: space-between; align-items: center; border: 0; background: transparent; cursor: pointer; }
.room-code button b { font-size: 15px; letter-spacing: .12em; }
.room-code button span { color: var(--accent); font-size: 12px; font-weight: 600; }

/* Stage */
.stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.prompt-card {
  height: 72px;
  flex: 0 0 auto;
  padding: 7px 12px;
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  border-color: var(--prompt-bg);
  background: var(--prompt-bg);
  color: var(--prompt-ink);
}
.timer { position: relative; width: 48px; height: 48px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 4; }
.timer-track { stroke: rgba(255, 255, 255, .22); }
.timer-progress { stroke: var(--yellow); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset .9s linear, stroke .3s; }
.timer strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.timer.urgent .timer-progress { stroke: #f08a72; }
.timer.urgent strong { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }
.prompt-copy { min-width: 0; text-align: center; }
.prompt-copy > span { display: block; color: rgba(255, 255, 255, .78); font-size: 12px; font-weight: 600; }
.prompt-copy small { display: block; min-height: 13px; margin-top: 4px; color: rgba(255, 255, 255, .7); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.word { min-height: 22px; margin-top: 3px; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 5px; }
.word i { width: 15px; height: 20px; border-bottom: 2px solid rgba(255, 255, 255, .9); font-style: normal; }
.word i.gap { width: 10px; border-bottom: 0; }
.word i.revealed { width: auto; min-width: 15px; border-bottom-color: transparent; font-size: 17px; font-weight: 700; line-height: 20px; text-align: center; }
.hint-button {
  justify-self: end;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, .13);
  color: inherit;
  cursor: pointer;
}
.hint-button:hover { background: rgba(255, 255, 255, .22); }
.hint-button.idle { opacity: .65; }
.hint-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hint-button span { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Canvas */
.stage-body { position: relative; min-height: 0; flex: 1; display: flex; flex-direction: column; }
.stage-body > .overlay { border-radius: 17px; }
.inline-feed { display: none; }
.canvas-card { position: relative; min-height: 0; flex: 1 1 auto; display: grid; place-items: center; padding: 10px; overflow: hidden; background: var(--surface-2); }
.canvas-frame { position: relative; overflow: hidden; border-radius: 10px; background: var(--canvas); box-shadow: 0 1px 3px rgba(29, 42, 46, .12); }
#drawingCanvas { display: block; touch-action: none; cursor: default; -webkit-touch-callout: none; -webkit-user-drag: none; }
#drawingCanvas.can-draw { cursor: crosshair; }
.ink-preview { position: absolute; inset: 0; pointer-events: none; }
.canvas-watermark { position: absolute; z-index: 1; top: 14px; left: 16px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; pointer-events: none; }
.reaction-layer { position: absolute; inset: 0; z-index: 6; overflow: hidden; pointer-events: none; }
.reaction-bubble { position: absolute; bottom: 12px; font-size: 32px; animation: rise 1.8s ease-out forwards; }
@keyframes rise {
  0% { opacity: 0; transform: translate(0, 10px) scale(.5); }
  15% { opacity: 1; transform: translate(0, 0) scale(1.15); }
  100% { opacity: 0; transform: translate(var(--drift), -180px) scale(.9); }
}
.toast, .global-toast {
  padding: 10px 15px;
  border-radius: 999px;
  background: #1d2a2e;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity .18s ease, transform .18s ease;
}
.toast { position: absolute; z-index: 9; left: 50%; bottom: 18px; transform: translate(-50%, 12px); }
.global-toast { position: fixed; z-index: 100; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 10px); }
.toast.show, .global-toast.show { opacity: 1; transform: translate(-50%, 0); }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.overlay h2 { margin: 8px 0 4px; font: 500 34px/1.05 var(--font-serif); }

.turn-summary { background: var(--overlay); }
.turn-word { margin: 2px 0 14px; color: var(--accent); font: italic 500 40px/1.05 var(--font-serif); }
.turn-scores { list-style: none; width: min(280px, 100%); margin: 0; padding: 0; display: grid; gap: 4px; text-align: left; }
.turn-scores li { display: grid; grid-template-columns: 30px 1fr auto; gap: 9px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.turn-scores li .mini-avatar { width: 28px; height: 28px; font-size: 11px; }
.turn-scores li small { color: var(--muted); font-weight: 500; }
.turn-scores li b { color: var(--mint-ink); }
.turn-scores li.empty { display: block; background: transparent; color: var(--muted); text-align: center; font-weight: 500; }
#turnVotes { margin-top: 12px; color: var(--muted); font-size: 12px; }

.word-picker { background: rgba(29, 42, 46, .9); color: #fff; backdrop-filter: blur(5px); }
.word-picker .eyebrow { color: #dbe6e8; }
.word-picker h2 { margin-bottom: 22px; }
#wordChoices { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.word-choice {
  min-width: 140px;
  padding: 14px 18px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 12px;
  background: #fdfcf8;
  color: #1d2a2e;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.word-choice:hover { border-color: #fff; background: var(--yellow); }
.word-choice small { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.word-choice.easy small { color: #4f806f; }
.word-choice.medium small { color: #9a6e12; }
.word-choice.hard small { color: #b0503b; }
#pickerCountdown { margin-top: 18px; color: rgba(255, 255, 255, .7); font-size: 12px; }

.waiting-card { background: var(--overlay); }
.waiting-card p { margin: 14px 0 0; color: var(--muted); font-size: 15px; font-weight: 600; max-width: 320px; line-height: 1.45; }
#pausedLobbyButton { min-height: 42px; margin-top: 16px; }
.waiting-dots { display: flex; gap: 6px; }
.waiting-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s ease-in-out infinite; }
.waiting-dots i:nth-child(2) { animation-delay: .15s; }
.waiting-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-8px); opacity: 1; } }

.guess-success {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 50%;
  width: min(230px, calc(100% - 34px));
  padding: 22px 18px;
  border: 1px solid var(--mint);
  border-radius: 18px;
  background: var(--mint-soft);
  color: var(--mint-ink);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -46%) scale(.94);
  text-align: center;
  transition: opacity .17s ease, transform .2s ease;
}
.guess-success.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.guess-success span { width: 40px; height: 40px; margin: 0 auto 9px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: #fff; font-size: 20px; }
.guess-success strong { display: block; font: 500 29px/1 var(--font-serif); }
.guess-success small { display: block; margin-top: 6px; font-size: 13px; font-weight: 600; }

/* Composer */
.guess-composer { flex: 0 0 auto; display: flex; gap: 8px; }
.guess-composer form { min-width: 0; flex: 1; padding: 6px 6px 6px 15px; display: flex; gap: 10px; align-items: center; }
.guess-composer label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.guess-row { min-width: 0; flex: 1; display: flex; align-items: center; gap: 6px; }
.guess-row input { min-width: 0; width: 100%; padding: 10px 4px; border: 0; background: transparent; color: var(--ink); font-size: 16px; outline: none; }
.guess-row input::placeholder { color: var(--faint); }
.guess-row input:disabled { cursor: not-allowed; }
.send-button { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.send-button:hover { background: var(--accent-dark); }
.send-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.quick-reactions, .drawing-votes { padding: 6px; display: flex; align-items: center; gap: 2px; }
.quick-reactions button { width: 38px; height: 42px; border: 0; border-radius: 9px; background: transparent; font-size: 18px; cursor: pointer; }
.quick-reactions button:hover { background: var(--surface-2); }
.drawing-votes button { min-width: 50px; height: 42px; padding: 0 9px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 600; cursor: pointer; }
.drawing-votes button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-dark); }
.drawing-votes button:disabled { opacity: .4; cursor: default; }
.drawing-votes span { font-size: 12px; font-variant-numeric: tabular-nums; }

/* Toolbar */
.draw-toolbar { display: none; flex: 0 0 auto; min-height: 58px; padding: 8px; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.draw-toolbar::-webkit-scrollbar { display: none; }
.draw-toolbar.artist-mode { display: flex; }
.colors { display: flex; gap: 5px; }
.color { flex: 0 0 auto; width: 28px; height: 28px; border: 2px solid var(--surface); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px rgba(128, 138, 140, .55); cursor: pointer; }
.color.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.color[data-color="#1d2a2e"] { --swatch: #1d2a2e; }
.color[data-color="#8a9396"] { --swatch: #8a9396; }
.color[data-color="#d64545"] { --swatch: #d64545; }
.color[data-color="#f08a3c"] { --swatch: #f08a3c; }
.color[data-color="#f2c84b"] { --swatch: #f2c84b; }
.color[data-color="#4f9a5e"] { --swatch: #4f9a5e; }
.color[data-color="#3a86c8"] { --swatch: #3a86c8; }
.color[data-color="#7a5bc4"] { --swatch: #7a5bc4; }
.color[data-color="#e57fae"] { --swatch: #e57fae; }
.color[data-color="#8a5a3b"] { --swatch: #8a5a3b; }
.tool-divider { flex: 0 0 auto; width: 1px; height: 28px; margin: 0 3px; background: var(--line); }
.tool { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; cursor: pointer; }
.tool:hover, .tool.active { background: var(--accent-soft); color: var(--accent-dark); }
.tool svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.size-control { flex: 0 0 auto; width: 120px; display: flex; align-items: center; gap: 8px; }
.size-control input { width: 100%; accent-color: var(--accent); }
.size-preview { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; }

/* Inline chat feed (phones) */
.feed-item { display: block; max-width: 100%; padding: 3px 8px; color: var(--ink); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.feed-item b { margin-right: 5px; font-weight: 700; }
.feed-item.system { color: var(--muted); font-size: 12px; font-weight: 600; }
.feed-item.correct { color: var(--mint-ink); }
.feed-item.reveal { color: var(--warn-ink); }
.feed-item.close { border-radius: 8px; background: var(--warn-soft); }
.feed-item.close small { margin-left: 6px; color: var(--warn-ink); font-size: 11px; font-weight: 700; }
.feed-item.divider { color: var(--faint); font-size: 11px; font-weight: 600; text-align: center; }

/* Chat */
.messages { min-height: 0; flex: 1; padding: 10px 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.message { display: flex; align-items: flex-start; gap: 9px; padding: 9px 2px; border-bottom: 1px solid var(--line-soft); }
.message .mini-avatar { width: 30px; height: 30px; font-size: 11px; }
.message > div { min-width: 0; flex: 1; }
.message strong { display: block; font-size: 12px; font-weight: 700; }
.message p { margin: 2px 0 0; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.message time { flex: 0 0 auto; color: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.message.close-guess > div { margin: -3px 0; padding: 6px 9px; border-radius: 9px; background: var(--warn-soft); }
.message.close-guess small { display: block; margin-top: 3px; color: var(--warn-ink); font-size: 11px; font-weight: 700; }
.system-message { margin: 6px 0 8px; padding: 9px 11px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 600; }
.system-message.hint, .system-message.join, .system-message.leave { background: var(--surface-2); color: var(--muted); }
.system-message.correct { background: var(--mint-soft); color: var(--mint-ink); }
.system-message.reveal { background: var(--warn-soft); color: var(--warn-ink); }
.turn-divider { display: flex; align-items: center; gap: 8px; padding: 12px 2px 6px; color: var(--muted); }
.turn-divider span { height: 1px; flex: 1; background: var(--line); }
.turn-divider b { flex: 0 1 auto; font-size: 11px; font-weight: 600; text-align: center; }
.empty-chat { min-height: 120px; display: grid; place-items: center; padding: 20px; color: var(--muted); text-align: center; font-size: 13px; }
.chat-tip { margin: 8px 12px 12px; padding: 9px 10px; border-radius: 9px; background: var(--surface-2); color: var(--muted); text-align: center; font-size: 11px; }

.mobile-nav, .scrim { display: none; }

/* Voice */
.voice-slot { display: flex; align-items: center; gap: 6px; }
.voice-slot:empty { display: none; }
.voice-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.voice-button svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.quiet-button.voice-button { min-height: 36px; }
.voice-button.mic.live { border-color: var(--mint); background: var(--mint-soft); color: var(--mint-ink); }
.voice-button.mic.muted { color: var(--coral); }
.voice-button.mic.speaking { box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 45%, transparent); }
.voice-button.failed { color: var(--danger-ink); }
.voice-button.attention { border-color: var(--yellow); background: var(--warn-soft); color: var(--warn-ink); }
.voice-button.busy { cursor: progress; opacity: .8; }
.voice-spinner { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.results-voice { justify-content: center; margin-top: 12px; }
.results-voice .quiet-button { background: var(--surface-2); }

.voice-badge {
  width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--mint-soft);
  color: var(--mint-ink);
  vertical-align: -4px;
  cursor: pointer;
}
.voice-badge svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.voice-badge.muted-local { background: var(--danger-soft); color: var(--danger-ink); }
.mini-avatar { transition: box-shadow .15s ease; }
.mini-avatar.speaking { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--mint); animation: speaking 1.2s ease-in-out infinite; }
@keyframes speaking { 50% { box-shadow: 0 0 0 3px var(--surface), 0 0 0 7px color-mix(in srgb, var(--mint) 55%, transparent); } }

.voice-popover {
  position: fixed;
  z-index: 60;
  width: 230px;
  padding: 14px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
}
.voice-popover strong { font-size: 14px; }
.voice-popover label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.voice-popover input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.voice-popover-volume { justify-content: space-between; }
.voice-popover-volume input { width: 130px; accent-color: var(--accent); }
.voice-popover small { color: var(--muted); font-size: 11px; }

/* Profile dialog */
.profile-dialog {
  width: min(420px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
}
.profile-dialog::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.profile-dialog form { display: grid; gap: 20px; padding: 24px; }
.profile-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.profile-dialog-head h2 { margin: 6px 0 0; font: 500 27px/1.05 var(--font-serif); letter-spacing: -.03em; }
.dialog-close { flex: 0 0 auto; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 21px; cursor: pointer; }
.dialog-close:hover { background: var(--surface-hover); color: var(--ink); }

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 1100px) {
  .game-grid { grid-template-columns: 210px minmax(0, 1fr) 250px; }
  .quick-reactions button { width: 32px; }
  .drawing-votes button { min-width: 42px; padding-inline: 6px; }
  .guess-composer label { display: none; }
}

@media (max-width: 820px) {
  .screen::after { width: 65vw; right: -34vw; bottom: -24vw; }
  .marketing-nav { height: 66px; padding: 0 18px; }
  .brand { font-size: 23px; }
  .home-main { width: min(100% - 36px, 540px); min-height: auto; display: block; padding: 32px 0 92px; }
  .hero-copy h1 { margin: 16px 0; font-size: clamp(50px, 14vw, 72px); line-height: .94; }
  .hero-copy > p { font-size: 15px; }
  .how-it-works { margin-top: 22px; gap: 8px; }
  .entry-card { margin-top: 30px; border-radius: 19px; }
  .entry-form { padding: 21px 12px 12px; }
  .marketing-footer { width: calc(100% - 36px); font-size: 11px; }

  .lobby-main { width: min(100% - 36px, 560px); min-height: auto; display: block; padding: 28px 0 60px; }
  .lobby-intro h1 { margin: 14px 0; font-size: 52px; }
  .lobby-intro > p { font-size: 14px; }
  .share-box { margin: 22px 0 26px; }
  .lobby-card { padding: 16px; }

  .results-screen { padding: 30px 14px; }
  .results-card { padding: 26px 16px 16px; }
  .results-card h1 { font-size: 36px; }
  .result-actions { grid-template-columns: 1fr; }

  .app-shell {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--app-height, 100dvh);
    padding: max(8px, env(safe-area-inset-top)) 8px calc(72px + env(safe-area-inset-bottom));
    transform: translateY(var(--app-offset, 0px));
  }
  .topbar { height: 46px; margin-bottom: 8px; grid-template-columns: auto 1fr auto; gap: 10px; }
  .topbar .brand { font-size: 20px; gap: 8px; }
  .topbar .brand > span:last-child { display: none; }
  .topbar .brand-mark { width: 30px; height: 30px; }
  .topbar .brand-mark::before { width: 26px; height: 26px; }
  .round-summary { justify-content: center; gap: 8px; }
  .round-summary > span { display: none; }
  .round-dots i { width: 14px; }
  .topbar .voice-slot { gap: 4px; }
  .connection-pill:not(.offline) { display: none; }
  .icon-button, .avatar-button { width: 34px; height: 34px; }
  .top-actions { gap: 6px; }
  .game-grid { display: block; }
  .stage { height: 100%; gap: 8px; }
  .prompt-card { height: auto; min-height: 62px; padding: 6px 9px; grid-template-columns: 44px 1fr 44px; border-radius: 14px; }
  .timer { width: 42px; height: 42px; }
  .hint-button { width: 40px; height: 40px; border-radius: 9px; }
  .word { gap: 4px; }
  .word i { width: 12px; }
  .word i.revealed { min-width: 12px; }
  .word i.gap { width: 8px; }
  .canvas-card { flex: 0 1 auto; min-height: 150px; aspect-ratio: 4 / 3; padding: 6px; border-radius: 14px; }
  .stage-body { gap: 4px; }
  .stage-body > .overlay { border-radius: 14px; }
  .inline-feed {
    min-height: 64px;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 2px;
    padding: 4px 2px 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 40px);
    mask-image: linear-gradient(to bottom, transparent 0, #000 40px);
  }

  /* Keyboard open: give the canvas the room and float the latest messages over it. */
  .keyboard-open .app-shell { padding-bottom: 8px; }
  .keyboard-open .topbar, .keyboard-open .mobile-nav, .keyboard-open .prompt-copy small { display: none; }
  .keyboard-open .prompt-card { min-height: 52px; }
  .keyboard-open .canvas-card { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; }
  .keyboard-open .inline-feed {
    position: absolute;
    z-index: 4;
    left: 8px;
    right: 8px;
    bottom: 8px;
    min-height: 0;
    max-height: 55%;
    align-items: flex-start;
    gap: 4px;
    pointer-events: none;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .keyboard-open .feed-item { width: fit-content; border-radius: 10px; background: var(--overlay); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
  .keyboard-open .feed-item.divider { display: none; }
  .keyboard-open .feed-item:nth-last-child(n + 5) { display: none; }
  .canvas-watermark { top: 10px; left: 12px; }
  .overlay h2 { font-size: 28px; }
  .turn-word { font-size: 32px; }
  .word-picker h2 { margin-bottom: 16px; }
  #wordChoices { display: grid; width: min(260px, 100%); }
  .word-choice { width: 100%; min-width: 0; padding: 11px 14px; }
  .guess-composer { gap: 6px; }
  .guess-composer form { min-height: 54px; padding-left: 12px; border-radius: 14px; }
  .quick-reactions { padding: 5px; border-radius: 14px; }
  .quick-reactions button { width: 32px; }
  .drawing-votes { padding: 5px; border-radius: 14px; }
  .drawing-votes button { min-width: 40px; padding-inline: 5px; }
  .draw-toolbar { border-radius: 14px; }

  .panel {
    position: fixed;
    z-index: 20;
    left: 8px;
    right: 8px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    height: min(66vh, 560px);
    border-radius: 18px;
    transform: translateY(calc(100% + 100px));
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  .panel.open { transform: translateY(0); }
  .scrim { position: fixed; z-index: 19; inset: 0; display: block; background: var(--scrim); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .mobile-nav {
    position: fixed;
    z-index: 30;
    left: 8px;
    right: 8px;
    bottom: max(6px, env(safe-area-inset-bottom));
    height: 58px;
    padding: 4px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
  }
  .mobile-nav button { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; }
  .mobile-nav button.active { background: var(--accent-soft); color: var(--accent-dark); }
  .mobile-nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-nav span { font-size: 11px; font-weight: 600; }
  .mobile-nav b { position: absolute; top: 4px; left: calc(50% + 9px); min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border-radius: 999px; background: var(--coral); color: #fff; font-size: 10px; }
  .mobile-nav button[data-panel="playersPanel"] b { background: var(--surface-2); color: var(--muted); }
}

@media (max-width: 430px) {
  .hero-copy h1 { font-size: 50px; }
  .avatar-picker { flex-direction: column; align-items: flex-start; gap: 8px; }
  .lobby-intro h1 { font-size: 46px; }
  .game-settings { grid-template-columns: 1fr 1fr; }
  .game-settings label:last-child { grid-column: 1 / -1; }
  .nav-actions { gap: 0; }
  .quiet-button { padding-inline: 8px; }
  .quick-reactions { display: none; }
  .prompt-copy > span { font-size: 11px; }
  .podium-step { width: 92px; }
  .size-control { width: 84px; }
  .round-dots { display: none; }
  .nav-actions .voice-button span { display: none; }
  .nav-actions .quiet-button.voice-button { width: 36px; padding: 0; }
  .color { width: 26px; height: 26px; }
  .tool { width: 36px; height: 36px; }
}

@media (max-height: 690px) and (max-width: 820px) {
  .prompt-card { min-height: 56px; }
  .timer, .hint-button { width: 38px; height: 38px; }
  .prompt-copy small { display: none; }
  .guess-composer form { min-height: 50px; }
}

/* Aspect ratio, not orientation: a portrait phone with the keyboard up can be
   wider than tall, and must keep the portrait layout. */
@media (min-aspect-ratio: 3/2) and (max-height: 500px) {
  .app-shell {
    position: fixed;
    inset: 0;
    width: auto;
    height: var(--app-height, 100dvh);
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
    transform: none;
  }
  .topbar { height: 40px; margin-bottom: 6px; grid-template-columns: auto 1fr auto; gap: 10px; }
  .topbar .brand > span:last-child, .round-summary > span, .connection-pill:not(.offline) { display: none; }
  .icon-button.players-toggle { display: grid; }
  .icon-button, .avatar-button { width: 34px; height: 34px; }
  .game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 8px; }
  .stage { height: auto; gap: 6px; }
  .prompt-card { height: auto; min-height: 50px; padding: 4px 8px; grid-template-columns: 40px 1fr 40px; }
  .timer, .hint-button { width: 38px; height: 38px; }
  .prompt-copy small { display: none; }
  .canvas-card { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; padding: 6px; }
  .inline-feed { display: none !important; }
  .panel-heading { min-height: 48px; padding: 8px 12px; }
  .chat-panel { position: static; height: auto; transform: none; border-radius: 17px; }
  .chat-tip { display: none; }
  .players-panel {
    position: fixed;
    z-index: 20;
    top: 8px;
    bottom: 8px;
    left: 8px;
    right: auto;
    width: 260px;
    height: auto;
    border-radius: 17px;
    transform: translateX(calc(-100% - 24px));
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  .players-panel.open { transform: none; }
  .mobile-nav { display: none; }
  .scrim { position: fixed; z-index: 19; inset: 0; display: block; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .guess-composer form { min-height: 46px; }
  .quick-reactions { display: none; }
  .draw-toolbar { min-height: 48px; padding: 4px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
