@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=Inter:wght@400;600;700;800&display=swap');

:root {
  --bg: #062f33;
  --bg-deep: #041f23;
  --surface: #0b4f52;
  --surface-2: #0f6265;
  --surface-soft: #eaf7f4;
  --ink: #f8fffd;
  --ink-dark: #102a2b;
  --muted: #a8ceca;
  --line: rgba(220, 255, 249, 0.22);
  --aqua: #29d4cd;
  --aqua-dark: #0aa6a2;
  --pink: #f24f8f;
  --yellow: #ffd447;
  --danger: #ff6a6a;
  --success: #55d88a;
  --shadow: 0 14px 36px rgba(0, 14, 17, 0.28);
  --radius: 8px;
  --header-height: 72px;
}

* { box-sizing: border-box; }

html { background: var(--bg-deep); }

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 75% 0%, rgba(41, 212, 205, 0.14), transparent 36%),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-deep) 100%);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input { font: inherit; }

button { touch-action: manipulation; }

button, [role="button"] { cursor: pointer; }

button:focus-visible, input:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

button:disabled { cursor: not-allowed; opacity: 0.48; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 1000;
  padding: 10px 14px;
  color: var(--ink-dark);
  background: var(--yellow);
}

.skip-link:focus { top: 12px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(4, 31, 35, 0.93);
  backdrop-filter: blur(14px);
}

.brand {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: none;
  font: 800 24px/1 "Barlow Condensed", sans-serif;
  letter-spacing: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--aqua-dark);
  font-size: 30px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.connection-badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.connection-badge.online { color: #b9f8d1; border-color: rgba(85, 216, 138, 0.55); }

.control-button, .secondary-button {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease;
}

.control-button:hover, .secondary-button:hover { background: rgba(255, 255, 255, 0.11); border-color: rgba(255, 255, 255, 0.4); }

.music-button, .header-icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
}

.music-button svg, .header-icon-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen {
  width: min(1480px, 100%);
  min-height: calc(100dvh - var(--header-height));
  margin: 0 auto;
  padding: clamp(20px, 3vw, 44px);
}

.home-screen {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(400px, 1.18fr);
  align-items: center;
  gap: clamp(28px, 6vw, 88px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--yellow);
  font: 700 15px/1.2 "Barlow Condensed", sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1 {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin: 0;
  white-space: nowrap;
  font: 800 98px/0.9 "Barlow Condensed", sans-serif;
  letter-spacing: 0;
}

.hero-copy h1 .hero-name-prefix { color: var(--ink); }
.hero-copy h1 .hero-name-main { color: var(--pink); }

.hero-description {
  max-width: 580px;
  margin: 30px 0;
  color: #cae4e1;
  font-size: clamp(16px, 1.5vw, 20px);
}

.start-form { max-width: 590px; }
.start-form label, .dialog label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.start-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

input {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  color: var(--ink-dark);
  background: #f8fffd;
  font-size: 16px;
}

.primary-button {
  min-height: 50px;
  padding: 11px 20px;
  border: 0;
  border-radius: var(--radius);
  color: #092e31;
  background: var(--yellow);
  box-shadow: 4px 4px 0 #c68e00;
  font-weight: 800;
  transition: filter 160ms ease, transform 160ms ease;
}

.primary-button:hover { filter: brightness(1.07); }
.primary-button:active { transform: translateY(2px); box-shadow: 2px 2px 0 #c68e00; }
.full-button { width: 100%; }

.field-error { min-height: 22px; margin: 7px 0 0; color: #ffb1b1; font-size: 13px; }
.helper-text, .muted { color: var(--muted); }
.helper-text { margin: -3px 0 14px; font-size: 13px; }

.hero-board {
  position: relative;
  min-height: 560px;
  display: grid;
  place-items: center;
}

.hero-board::before {
  content: "";
  position: absolute;
  width: min(54vw, 680px);
  aspect-ratio: 1;
  border: 70px solid rgba(41, 212, 205, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(41, 212, 205, 0.05);
}

.hero-faces {
  position: relative;
  z-index: 1;
  width: min(48vw, 620px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  transform: rotate(-2deg);
}

.hero-faces img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 4px solid #d8f6f2;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-faces img:nth-child(even) { transform: translateY(18px); }

.hero-question {
  position: absolute;
  z-index: 2;
  width: 136px;
  height: 136px;
  display: grid;
  place-items: center;
  border: 6px solid var(--ink);
  color: var(--ink);
  background: var(--pink);
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.32);
  font: 800 104px/1 "Barlow Condensed", sans-serif;
  transform: rotate(4deg);
}

.section-heading, .lobby-toolbar, .room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 { margin: 0; font: 800 clamp(42px, 6vw, 72px)/1 "Barlow Condensed", sans-serif; }
.section-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }

.lobby-heading-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.play-ai-button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-color: rgba(104, 218, 205, 0.62);
}

.play-ai-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lobby-toolbar {
  margin-top: 30px;
  padding: 14px 16px;
  border-block: 1px solid var(--line);
}
.lobby-toolbar strong, .lobby-toolbar span { display: block; }

.room-search {
  width: min(380px, 100%);
  display: grid;
  gap: 6px;
  margin-top: 18px;
  font-size: 13px;
  font-weight: 700;
}

.room-search input { text-transform: uppercase; }

.room-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 18px;
}

.room-list-loading {
  grid-column: 1 / -1;
  min-height: 136px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.room-list-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(11, 79, 82, 0.72);
  box-shadow: var(--shadow);
}

.room-card h3 { margin: 0 0 4px; font-size: 17px; }
.room-id { display: block; margin-bottom: 3px; color: var(--yellow); font-size: 12px; font-weight: 800; }
.room-meta { color: var(--muted); font-size: 13px; }
.room-card button { min-width: 94px; }
.empty-state { grid-column: 1 / -1; padding: 52px 20px; text-align: center; border: 1px dashed var(--line); color: var(--muted); }

.dialog {
  width: min(440px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.dialog::backdrop { background: rgba(0, 17, 19, 0.72); backdrop-filter: blur(5px); }
.dialog form { padding: 22px; }
.dialog input { margin-bottom: 14px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dialog-heading h2 { margin: 0; font: 800 34px/1 "Barlow Condensed", sans-serif; }
.icon-close { width: 48px; height: 48px; border: 1px solid var(--line); color: var(--ink); background: transparent; font-size: 29px; line-height: 1; }

.prompt-dialog { width: min(480px, calc(100% - 28px)); }
.prompt-content { padding: 26px; }
.prompt-content h2 { margin: 0; font: 800 38px/1 "Barlow Condensed", sans-serif; }
.prompt-content > p:not(.eyebrow) { margin: 12px 0 22px; color: var(--muted); }
.prompt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.guide-dialog {
  width: min(820px, calc(100% - 28px));
  max-width: none;
  overflow: hidden;
  background: #f7faf9;
  color: var(--ink-dark);
}

.guide-dialog::backdrop, .result-dialog::backdrop { background: rgba(0, 17, 19, 0.82); backdrop-filter: blur(4px); }
.guide-shell { max-height: min(92dvh, 820px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.guide-heading { margin: 0; padding: 16px 18px; border-bottom: 1px solid #d5dfdd; }
.guide-heading h2 { color: var(--ink-dark); }
.guide-heading .icon-close { color: white; border: 0; border-radius: 50%; background: #cb6464; }
.guide-slide { min-height: 0; padding: 16px 20px; overflow-y: auto; touch-action: pan-y; }
.guide-slide-content { display: grid; justify-items: center; gap: 14px; animation: guide-slide-in 180ms ease-out; }
.guide-slide-content h3 { margin: 0; font: 800 30px/1 "Barlow Condensed", sans-serif; text-align: center; text-transform: uppercase; }
.guide-slide-content > p { max-width: 680px; margin: 0; color: #405758; font-size: 15px; line-height: 1.55; text-align: center; }
.guide-images { width: 100%; display: grid; place-items: center; gap: 12px; }
.guide-images.multiple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.guide-images img { width: auto; max-width: 100%; height: min(55dvh, 500px); display: block; border: 1px solid #cbd8d6; border-radius: 7px; object-fit: contain; background: var(--bg); }
.guide-images.multiple img { height: min(46dvh, 420px); }
.guide-intro-icon { width: 112px; height: 112px; display: grid; place-items: center; border-radius: 50%; color: #176d91; background: #deefed; }
.guide-intro-icon svg { width: 58px; height: 58px; }
.guide-navigation { min-height: 68px; display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 14px; padding: 10px 18px; border-top: 1px solid #d5dfdd; }
.guide-arrow { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--ink-dark); background: var(--yellow); }
.guide-arrow svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.guide-progress { display: flex; justify-content: center; gap: 7px; }
.guide-dot { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: #afbfbd; }
.guide-dot.active { background: var(--pink); transform: scale(1.25); }

@keyframes guide-slide-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.result-dialog { width: min(460px, calc(100% - 28px)); text-align: center; }
.result-dialog-content { position: relative; padding: 30px 24px 24px; }
.result-close { position: absolute; top: 12px; right: 12px; }
.result-dialog-icon { width: 82px; height: 82px; display: grid; place-items: center; margin: 8px auto 18px; border-radius: 50%; color: white; background: var(--danger); }
.result-dialog.won .result-dialog-icon { color: var(--ink-dark); background: var(--success); }
.result-dialog-icon svg { width: 48px; height: 48px; }
.result-dialog h2 { margin: 0; font: 800 48px/1 "Barlow Condensed", sans-serif; }
.result-dialog-content > p:not(.eyebrow) { margin: 12px 0 24px; color: var(--muted); }

.room-screen { padding-top: 18px; }
.room-header { min-height: 56px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.room-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.room-title h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 25px/1 "Barlow Condensed", sans-serif; }
.room-code { color: var(--yellow); font-weight: 800; }
.player-pills { display: flex; align-items: center; gap: 8px; }
.player-pill { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }
.player-pill.ready { color: #b9f8d1; border-color: rgba(85, 216, 138, 0.5); }

.waiting-view { min-height: 65dvh; display: grid; place-items: center; text-align: center; }
.waiting-box { max-width: 520px; }
.waiting-box h2 { margin: 0; font: 800 clamp(44px, 7vw, 74px)/0.95 "Barlow Condensed", sans-serif; }
.waiting-box p { color: var(--muted); }
.loader { width: 54px; height: 54px; margin: 26px auto; border: 5px solid rgba(255, 255, 255, 0.15); border-top-color: var(--yellow); border-radius: 50%; animation: spin 900ms linear infinite; }
.copy-room-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.copy-room-button svg { width: 20px; height: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

.selecting-view { padding-top: 22px; }
.selection-heading { max-width: 750px; margin: 0 auto 20px; text-align: center; }
.selection-heading h2 { margin: 0; font: 800 clamp(38px, 5vw, 58px)/1 "Barlow Condensed", sans-serif; }
.selection-heading p { margin: 8px 0 0; color: var(--muted); }

.game-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
  gap: 16px;
  padding-top: 16px;
}

.board-column { min-width: 0; }

.turn-banner {
  min-height: 64px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--yellow);
  background: rgba(11, 79, 82, 0.76);
}

.turn-banner strong { display: block; font-size: 15px; }
.turn-banner span { color: var(--muted); font-size: 13px; line-height: 1.25; }
.timer {
  min-width: 62px;
  color: var(--yellow);
  font: 800 32px/1 "Barlow Condensed", sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.character-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: clamp(7px, 1vw, 12px);
}

.character-card {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 2px solid rgba(232, 255, 252, 0.55);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18);
  transition: border-color 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.character-card img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: #0c5d60; }
.character-card span { display: block; min-height: 30px; padding: 5px 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 clamp(13px, 1.55vw, 20px)/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
.character-card.can-toggle:hover { border-color: var(--yellow); }
.character-card.selected { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 212, 71, 0.24); }
.character-card.eliminated { opacity: 0.26; filter: grayscale(1); }
.character-card.eliminated::after { content: ""; position: absolute; inset: 0; background: linear-gradient(45deg, transparent 46%, var(--danger) 47%, var(--danger) 53%, transparent 54%); }
.character-card.guessable { border-color: var(--yellow); }
.character-card:disabled { cursor: default; opacity: 1; }

.selecting-grid { width: min(100%, 1040px); margin: 0 auto; }
.selecting-grid .character-card span { font-size: clamp(15px, 2vw, 21px); }

.board-actions {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
}

.board-actions p { margin: 0; color: var(--muted); font-size: 14px; }
.action-buttons { display: flex; gap: 8px; }

.game-sidebar {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

.side-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(11, 79, 82, 0.82);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin: 0; font: 800 21px/1 "Barlow Condensed", sans-serif; }
.panel-body { padding: 12px; }

.question-categories {
  display: flex;
  max-width: 100%;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--yellow) rgba(255, 255, 255, 0.1);
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}
.question-categories::-webkit-scrollbar { height: 4px; }
.question-categories::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); }
.question-categories::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--yellow); }
.category-button { min-height: 38px; flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.category-button.active { color: var(--ink-dark); background: var(--yellow); border-color: var(--yellow); }
.question-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; max-height: 286px; overflow-y: auto; padding-right: 2px; }
.question-button { min-height: 48px; padding: 7px 8px; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 5px; color: var(--ink); background: rgba(3, 39, 42, 0.72); font-size: 12px; font-weight: 700; line-height: 1.25; text-align: left; }
.question-button:hover { border-color: var(--yellow); background: rgba(255, 212, 71, 0.1); }
.question-button.asked, .question-button.asked:hover { border-color: #36585a; color: #78918f; background: #17383a; opacity: 0.62; }

.answer-card { padding: 14px; border: 1px solid var(--line); background: rgba(3, 39, 42, 0.65); }
.answer-card p { margin: 0 0 12px; font-weight: 700; }
.answer-card.wrong-answer { border-color: #ff9292; animation: wrong-answer 360ms ease; }
.answer-card .answer-warning { padding: 8px 10px; border-left: 4px solid #ff9292; color: #ffd1d1; background: rgba(255, 92, 106, 0.12); font-size: 13px; line-height: 1.35; }
.answer-card .answer-value { color: var(--yellow); font: 800 32px/1 "Barlow Condensed", sans-serif; }
.answer-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.yes-button, .no-button { min-height: 52px; border: 0; border-radius: var(--radius); color: #05282a; font-weight: 800; }
.yes-button { background: var(--success); }
.no-button { background: #ff9292; }

@keyframes wrong-answer {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}

.chat-panel { min-height: 260px; }
.chat-messages { height: 184px; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; overflow-y: auto; }
.chat-empty { margin: auto; color: var(--muted); font-size: 13px; }
.chat-message { max-width: 88%; padding: 8px 10px; border-radius: 7px; background: rgba(3, 39, 42, 0.72); font-size: 13px; overflow-wrap: anywhere; }
.chat-message.mine { align-self: flex-end; color: var(--ink-dark); background: #bdeee8; }
.chat-message strong { display: block; margin-bottom: 2px; font-size: 11px; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { min-height: 44px; }
.chat-form button { min-width: 66px; min-height: 44px; padding: 8px; box-shadow: none; }

.profile-content { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 12px; }
.secret-image { width: 92px; aspect-ratio: 1; object-fit: cover; border: 3px solid var(--yellow); background: var(--surface-2); }
.profile-content p { margin: 0; color: var(--muted); font-size: 13px; }
.profile-content strong { display: block; color: var(--ink); font-size: 18px; }

.result-box { padding: 20px; text-align: center; }
.result-box h3 { margin: 0 0 7px; color: var(--yellow); font: 800 36px/1 "Barlow Condensed", sans-serif; }
.result-box p { margin: 0 0 14px; color: var(--muted); }

.mobile-nav { display: none; }
.toast { position: fixed; z-index: 1000; left: 50%; bottom: 26px; width: min(460px, calc(100% - 28px)); padding: 13px 16px; transform: translateX(-50%); border: 1px solid rgba(255, 255, 255, 0.35); border-left: 5px solid var(--yellow); border-radius: 5px; color: var(--ink); background: #183f42; box-shadow: var(--shadow); font-weight: 700; }

@media (max-width: 1050px) {
  .home-screen { grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr); }
  .hero-copy h1 { gap: 16px; font-size: 78px; }
  .hero-board { min-height: 480px; }
  .game-view { grid-template-columns: minmax(0, 1fr) 300px; }
  .character-board { grid-template-columns: repeat(6, minmax(62px, 1fr)); }
  .room-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  :root { --header-height: 62px; }
  .topbar { min-height: var(--header-height); padding: 7px 12px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 38px; height: 38px; font-size: 27px; box-shadow: 3px 3px 0 var(--aqua-dark); }
  .connection-badge { display: none; }
  .control-button { min-height: 46px; padding-inline: 10px; font-size: 13px; }
  .music-button, .header-icon-button { width: 46px; padding: 0; }
  .screen { padding: 18px 14px; }
  .home-screen { display: block; padding-top: 36px; }
  .hero-copy { position: relative; z-index: 2; }
  .hero-copy h1 { gap: 13px; font-size: 68px; }
  .hero-description { margin: 24px 0; }
  .start-row { grid-template-columns: 1fr; }
  .hero-board { min-height: auto; margin-top: 36px; padding-bottom: 22px; }
  .hero-board::before { width: 100vw; border-width: 40px; }
  .hero-faces { width: 100%; grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .hero-question { width: 94px; height: 94px; border-width: 4px; font-size: 72px; }
  .section-heading { align-items: flex-end; }
  .section-heading h2 { font-size: 46px; }
  .section-heading .primary-button { padding-inline: 14px; }
  .lobby-heading-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .lobby-heading-actions button { width: 124px; padding-inline: 10px; }
  .lobby-toolbar { margin-top: 18px; }
  .room-search { margin-top: 14px; }
  .room-list { grid-template-columns: 1fr; }
  .room-header { align-items: flex-start; }
  .player-pills { display: none; }
  .game-view { display: block; padding: 12px 0 calc(76px + env(safe-area-inset-bottom)); }
  .turn-banner { position: sticky; top: calc(var(--header-height) + 4px); z-index: 20; min-height: 58px; margin-inline: -4px; }
  .character-board { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .character-card span { min-height: 27px; font-size: clamp(13px, 4vw, 18px); }
  .board-actions { display: block; }
  .action-buttons { margin-top: 10px; }
  .action-buttons button { flex: 1; }
  .game-sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    display: block;
    max-height: min(70dvh, 640px);
    padding: 10px 12px;
    overflow-y: auto;
    border-top: 1px solid var(--line);
    background: rgba(4, 31, 35, 0.98);
    transform: translateY(0);
    transition: transform 220ms ease, opacity 180ms ease;
  }
  .game-view[data-mobile-panel="board"] .game-sidebar { pointer-events: none; opacity: 0; transform: translateY(110%); }
  .game-view[data-mobile-panel="question"] .side-panel:not(.question-panel),
  .game-view[data-mobile-panel="chat"] .side-panel:not(.chat-panel),
  .game-view[data-mobile-panel="profile"] .side-panel:not(.profile-panel) { display: none; }
  .side-panel { box-shadow: none; }
  .game-sidebar .side-panel { background: var(--surface); }
  .question-grid { max-height: 48dvh; }
  .chat-messages { height: 42dvh; }
  .mobile-nav {
    position: fixed;
    z-index: 60;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: calc(64px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: #041f23;
  }
  .mobile-nav-button { position: relative; min-height: 52px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
  .mobile-nav-button.active { color: var(--ink-dark); background: var(--yellow); }
  .nav-badge { position: absolute; top: 2px; right: 8px; min-width: 19px; height: 19px; padding: 1px 5px; border-radius: 999px; color: white; background: var(--pink); font-size: 11px; }
  .selecting-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 390px) {
  .brand > span:last-child { display: none; }
  .hero-copy h1 { gap: 10px; font-size: 58px; }
  .character-board { gap: 5px; }
  .character-card span { font-size: 13px; }
  .question-grid { grid-template-columns: 1fr; }
  .room-title h2 { max-width: 160px; }
}

@media (max-width: 780px) and (orientation: landscape) {
  .character-board { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .turn-banner { position: static; }
  .game-sidebar { max-height: 68dvh; }
}

/* Character-first game layout */
.game-view {
  display: block;
  padding-top: 8px;
}

.room-screen:has(#gameView:not([hidden])) { padding-top: 8px; }
.room-screen:has(#gameView:not([hidden])) .room-header { min-height: 44px; padding-bottom: 7px; }
.room-screen:has(#gameView:not([hidden])) .player-pills { display: none; }
.room-screen:has(#gameView:not([hidden])) .room-title h2 { display: none; }

.board-column {
  width: min(100%, 620px);
  margin: 0 auto;
}

.turn-banner {
  min-height: 56px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding-block: 7px;
  border-radius: var(--radius);
}

.turn-copy { min-width: 0; }
.turn-copy span { display: block; overflow-wrap: anywhere; }

.secret-peek {
  width: 44px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--yellow);
  border-radius: 6px;
  color: var(--ink-dark);
  background: var(--yellow);
  overflow: hidden;
}

.secret-peek img { width: 100%; height: 100%; display: block; object-fit: cover; }

.character-board {
  width: min(100%, 430px);
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-inline: auto;
}

.character-card {
  border: 0;
  border-radius: 8px;
  background: #f5f4f1;
  box-shadow: 0 4px 0 rgba(0, 17, 19, 0.42);
}

.character-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 130 / 164;
  object-fit: cover;
  background: #f5f4f1;
}

.character-card.selected { box-shadow: 0 0 0 4px var(--yellow), 0 5px 0 rgba(0, 17, 19, 0.42); }
.character-card.can-toggle:hover { box-shadow: 0 0 0 3px var(--yellow), 0 4px 0 rgba(0, 17, 19, 0.42); }
.character-card.eliminated,
.character-card.eliminated:disabled { opacity: 0.28; filter: grayscale(1); }

.selecting-grid { width: min(100%, 620px); grid-template-columns: repeat(5, minmax(0, 1fr)); }

.selection-confirm {
  position: sticky;
  z-index: 20;
  bottom: 12px;
  width: min(100%, 620px);
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px auto 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(4, 31, 35, 0.96);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.board-actions { min-height: 44px; }

.trait-dock {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
  margin-top: 14px;
}

.trait-dock-button {
  position: relative;
  min-width: 0;
  min-height: 68px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 7px 4px;
  border: 0;
  border-radius: 7px;
  color: #162b31;
  background: #f4f2ed;
  box-shadow: 0 4px 0 rgba(0, 17, 19, 0.28);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
}

.trait-dock-button svg { width: 28px; height: 28px; color: #176d91; }
.trait-dock-button:nth-child(4n + 2) svg { color: #cb6a39; }
.trait-dock-button:nth-child(4n + 3) svg { color: #524276; }
.trait-dock-button:nth-child(4n + 4) svg { color: #32976c; }
.trait-dock-button:disabled { opacity: 0.42; box-shadow: none; }
.chat-dock-button:not(:disabled) { background: var(--yellow); }

.game-sidebar {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  max-height: none;
  padding: 18px;
  overflow: visible;
  border: 0;
  background: transparent;
}

.game-view[data-mobile-panel="board"] .game-sidebar { display: none; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(2, 21, 24, 0.42);
  backdrop-filter: blur(1px);
}

.sheet-shell {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(72dvh, 650px);
  overflow-y: auto;
  border-radius: 12px 12px 8px 8px;
  background: #f8faf9;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: sheet-in 180ms ease-out;
}

@keyframes sheet-in {
  from { transform: translateY(24px); }
  to { transform: translateY(0); }
}

.side-panel {
  border: 0;
  border-radius: 0;
  color: var(--ink-dark);
  background: transparent;
  box-shadow: none;
}

.game-sidebar .side-panel { background: transparent; }

.sheet-heading {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px 18px;
  border-bottom: 1px solid #d8e0df;
}

.sheet-heading h3 { margin: 0; font: 800 31px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
.sheet-heading > div { display: flex; align-items: center; gap: 10px; }
.sheet-heading .timer { color: #bb7500; }

.sheet-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: white;
  background: #cd6767;
}

.sheet-close svg { width: 24px; height: 24px; }
.sheet-body { padding: 14px; }

.trait-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.trait-option {
  min-height: 132px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  color: #20262a;
  background: #e9eaea;
  box-shadow: 0 4px 0 #d3d5d5;
  font: 800 20px/1 "Barlow Condensed", sans-serif;
  text-transform: uppercase;
}

.trait-option:hover:not(:disabled) { box-shadow: 0 0 0 3px var(--aqua-dark), 0 4px 0 #d3d5d5; }
.trait-option.asked { color: #7c8384; filter: grayscale(1); box-shadow: none; }
.trait-option small { font: 700 11px/1 Inter, sans-serif; text-transform: none; }
.trait-visual { width: 72px; height: 64px; }
.trait-symbol { width: 70px; height: 64px; display: grid; place-items: center; color: #343b60; }
.trait-symbol svg { width: 58px; height: 58px; }

.answer-card {
  border: 0;
  border-radius: 8px;
  color: var(--ink-dark);
  background: #edf2f1;
}

.answer-prompt { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 14px; }
.answer-prompt img { width: 72px; height: auto; border-radius: 6px; }
.answer-prompt p { margin: 0; font-size: 18px; }
.answer-card .answer-warning { color: #8d2020; background: #ffe1e1; }
.answer-card .answer-value { color: #aa6800; }
.answer-card .helper-text { margin: 8px 0 0; color: #5c6a6a; }
.answer-review .primary-button { margin-top: 16px; }

.chat-panel { min-height: 0; }
.chat-messages { height: min(42dvh, 360px); color: var(--ink-dark); }
.chat-message { background: #e2e8e7; }
.chat-message.mine { background: #bdeee8; }
.chat-form { border-color: #d8e0df; }

.profile-content { color: var(--ink-dark); }
.profile-content p { color: #5c6a6a; }
.profile-content strong { color: var(--ink-dark); }

@media (max-width: 780px) {
  .room-screen { padding: 8px 8px 14px; }
  .room-screen:has(#gameView:not([hidden])) .room-header { display: none; }
  .room-screen:has(#gameView:not([hidden])) { min-height: calc(100dvh - var(--header-height)); padding-bottom: 6px; }
  .room-header { min-height: 46px; padding-bottom: 8px; }
  .room-title h2 { font-size: 20px; }
  .room-title .secondary-button { min-height: 38px; padding: 6px 9px; font-size: 12px; }
  .game-view { padding: 4px 0 6px; }
  .turn-banner { position: static; min-height: 50px; margin: 0 0 6px; padding: 5px 7px; }
  .secret-peek { width: 38px; height: 44px; }
  .turn-banner strong { font-size: 13px; }
  .turn-banner span { font-size: 11px; }
  .turn-banner .timer { min-width: 42px; font-size: 25px; }
  .character-board { width: min(100%, 300px); grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
  .character-card { border-radius: 5px; box-shadow: 0 2px 0 rgba(0, 17, 19, 0.42); }
  .board-actions { width: min(100%, 300px); min-height: 26px; margin-inline: auto; padding-top: 4px; }
  .board-actions p { font-size: 11px; }
  .action-buttons { margin-top: 6px; }
  .action-buttons button { min-height: 44px; padding: 8px 10px; font-size: 12px; }
  .trait-dock { width: min(100%, 340px); grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 5px auto 0; }
  .trait-dock-button { min-height: 46px; padding: 3px 2px; font-size: 8px; }
  .trait-dock-button svg { width: 20px; height: 20px; }
  .game-sidebar { display: grid; max-height: none; bottom: 0; padding: 8px; overflow: visible; transform: none; }
  .game-sidebar { align-content: end; }
  .game-view[data-mobile-panel="board"] .game-sidebar { display: none; opacity: 1; transform: none; }
  .sheet-shell { width: 100%; max-height: min(70dvh, 520px); border-radius: 12px 12px 6px 6px; }
  .sheet-heading { min-height: 54px; padding: 8px 10px 8px 14px; }
  .sheet-heading h3 { font-size: 26px; }
  .sheet-close { width: 42px; height: 42px; }
  .sheet-body { padding: 10px; }
  .trait-option-grid { gap: 8px; }
  .trait-option { min-height: 74px; padding: 5px; font-size: 15px; }
  .trait-visual { width: 48px; height: 40px; }
  .trait-symbol { width: 48px; height: 40px; }
  .trait-symbol svg { width: 38px; height: 38px; }
  .answer-prompt p { font-size: 16px; }
  .chat-messages { height: 28dvh; }
  .selecting-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .selection-confirm { bottom: 6px; min-height: 58px; margin-top: 12px; }
  .prompt-content { padding: 22px 18px; }
  .prompt-content h2 { font-size: 34px; }
  .guide-dialog { width: calc(100% - 16px); }
  .guide-shell { max-height: 92dvh; }
  .guide-heading { padding: 12px 12px 10px 14px; }
  .guide-heading h2 { font-size: 30px; }
  .guide-slide { padding: 12px 10px; }
  .guide-slide-content { gap: 10px; }
  .guide-slide-content h3 { font-size: 25px; }
  .guide-slide-content > p { font-size: 13px; line-height: 1.45; }
  .guide-images img { height: min(49dvh, 420px); }
  .guide-images.multiple { gap: 6px; }
  .guide-images.multiple img { height: min(35dvh, 300px); }
  .guide-navigation { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; padding: 8px 10px; }
  .guide-arrow { width: 44px; height: 44px; }
  .guide-progress { gap: 5px; }
  .guide-dot { width: 8px; height: 8px; }
  .result-dialog-content { padding: 26px 18px 20px; }
}

@media (max-width: 350px) {
  .character-board, .board-actions { width: min(100%, 280px); }
  .trait-dock { width: 100%; }
  .trait-dock-button { min-height: 54px; font-size: 7px; }
}

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