:root {
  color-scheme: dark;
  --bg: #07150d;
  --bg-grid: #0d2114;
  --panel: #102b19;
  --panel-dark: #081b10;
  --panel-light: #1a4326;
  --border: #68bd5d;
  --border-light: #b8f06c;
  --text: #f3f1c6;
  --muted: #9fc49d;
  --accent: #f6d64a;
  --accent-dark: #9b6d1a;
  --danger: #ff6b5f;
  --ink: #020704;
  --pixel-shadow: 6px 6px 0 var(--ink);
  --pixel-font: "Geomini", system-ui, sans-serif;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--pixel-font);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(76, 137, 77, 0.11) 2px, transparent 2px),
    linear-gradient(90deg, rgba(76, 137, 77, 0.11) 2px, transparent 2px),
    linear-gradient(rgba(0, 0, 0, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.18) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px, 8px 8px, 8px 8px;
  image-rendering: pixelated;
}

body.intro-screen {
  overflow: hidden;
  background:
    linear-gradient(rgba(2, 10, 6, 0.18), rgba(2, 10, 6, 0.38)),
    url('./assets/intro-landscape-anime-optimized.jpg?v=20260720-1') center / cover no-repeat fixed,
    var(--bg);
}

body.intro-screen::before {
  background: linear-gradient(90deg, rgba(2, 9, 5, 0.2), transparent 28%, transparent 72%, rgba(2, 9, 5, 0.2));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(123, 224, 102, 0.08) 25%, transparent 25%) 0 0 / 64px 64px,
    linear-gradient(315deg, rgba(0, 0, 0, 0.2) 25%, transparent 25%) 32px 0 / 64px 64px;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell {
  width: min(1240px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  place-items: center;
}

body.intro-screen .intro-splash,
body.intro-screen .join-panel {
  grid-area: 1 / 1;
}

.intro-splash {
  width: min(760px, 94vw);
  display: grid;
  justify-items: center;
  padding: 0;
  border: 0;
  outline: 0;
  color: #fff2b0;
  background: transparent;
  font-family: var(--pixel-font);
  text-align: center;
  filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.48));
  transition: opacity 360ms ease, transform 480ms cubic-bezier(0.22, 1, 0.36, 1), filter 360ms ease;
}

.intro-splash:hover { filter: drop-shadow(0 20px 22px rgba(0, 0, 0, 0.55)) brightness(1.05); }
.intro-splash:focus-visible { outline: 3px solid #ffe477; outline-offset: 12px; }

.intro-splash.leaving {
  opacity: 0;
  transform: scale(1.045) translateY(-10px);
  pointer-events: none;
}

.splash-logo {
  position: relative;
  width: min(680px, 92vw);
  height: clamp(300px, 48vw, 500px);
  overflow: hidden;
}

.splash-logo img {
  position: absolute;
  top: 0;
  left: 50%;
  width: 100%;
  height: auto;
  transform: translate(-50%, -12.8%);
}

.splash-prompt {
  margin-top: -20px;
  padding: 12px 24px;
  color: #fff4bd;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #102b19, 0 0 12px rgba(255, 224, 95, 0.4);
  animation: splash-pulse 1.5s ease-in-out infinite;
}

.splash-hint {
  color: #c3d8c1;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-shadow: 2px 2px 0 #07150d;
}

@keyframes splash-pulse {
  0%, 100% { opacity: 0.62; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

body.intro-screen .join-panel.entry-pending {
  opacity: 0;
  transform: translateY(18px) scale(0.975);
}

body.intro-screen .join-panel.entry-ready {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.join-panel,
.topbar,
.panel-card,
.game-frame {
  border: 4px solid var(--ink);
  outline: 3px solid var(--border);
  box-shadow: var(--pixel-shadow);
}

.join-panel {
  position: relative;
  width: min(480px, 100%);
  padding: 38px;
  background:
    linear-gradient(90deg, transparent 50%, rgba(255,255,255,.025) 50%) 0 0 / 8px 8px,
    rgba(16, 43, 25, 0.94);
  text-align: center;
}

.join-panel::before,
.join-panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--border-light);
  box-shadow: 0 0 0 3px var(--ink);
}

.join-panel::before { top: 10px; left: 10px; }
.join-panel::after { right: 10px; bottom: 10px; }

.brand-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  outline: 3px solid var(--accent);
  background: #246d32;
  box-shadow: 6px 6px 0 var(--ink), inset -8px -8px 0 #16461f, inset 8px 8px 0 #56a949;
  font-size: 36px;
  transform: rotate(3deg);
}

.eyebrow {
  display: block;
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  line-height: 1.5;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #4b3510;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 14px;
  color: #fff6ae;
  font-size: clamp(2rem, 7vw, 3.3rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.08em;
  text-transform: uppercase;
  text-shadow: 4px 0 0 #2b7a35, 0 4px 0 #2b7a35, 4px 4px 0 var(--ink);
}

.game-logo {
  position: relative;
  width: min(390px, 100%);
  height: 270px;
  margin: -18px auto -4px;
  overflow: hidden;
  line-height: normal;
  text-shadow: none;
}

.game-logo img {
  position: absolute;
  inset: 0 auto auto 50%;
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 3px rgba(0, 0, 0, 0.48));
  transform: translate(-50%, -12.8%);
}

.subtitle {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.7;
}

.join-form {
  display: grid;
  gap: 22px;
  text-align: left;
}

.join-form .form-step {
  display: grid;
  gap: 12px;
}

.step-heading {
  display: flex;
  gap: 11px;
  align-items: center;
  color: #f5e9b6;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-transform: none;
}

.step-heading b {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border: 2px solid #d7bd57;
  color: #102917;
  background: #f0d36b;
  box-shadow: 2px 2px 0 #07170d;
  font-size: 0.78rem;
}

.step-heading small {
  display: block;
  margin-top: 4px;
  color: #91b69a;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0;
}

.room-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.room-picker legend {
  width: 100%;
  margin-bottom: 12px;
  padding: 0;
}

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

.join-form .room-card {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 2px solid #356844;
  outline: 0;
  color: #d7e8c3;
  background: rgba(3, 25, 14, 0.9);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.26), 3px 3px 0 #06120a;
  text-align: left;
  text-transform: none;
}

.join-form .room-card:hover {
  border-color: #78b77b;
  filter: brightness(1.12);
}

.join-form .room-card.selected {
  border-color: #f0d36b;
  outline: 2px solid #816d25;
  color: #fff4bd;
  background: linear-gradient(180deg, rgba(20, 78, 40, 0.98), rgba(9, 48, 25, 0.98));
  box-shadow: inset 0 0 0 2px rgba(255, 230, 128, 0.08), 3px 3px 0 #06120a, 0 0 15px rgba(224, 196, 93, 0.18);
}

.join-form .room-card.selected::after {
  content: "✓";
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: #102917;
  background: #f0d36b;
  font-size: 0.7rem;
  font-weight: 700;
}

.join-form .room-card.full {
  opacity: 0.58;
  cursor: not-allowed;
}

.room-card-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-right: 2px;
  font-size: 0.88rem;
}

.room-card-header > span {
  padding: 2px 6px;
  color: #f4d86e;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.72rem;
}

.room-card small {
  display: block;
  min-height: 2.6em;
  margin-top: 9px;
  padding-right: 22px;
  overflow: hidden;
  color: #9fc49d;
  font-size: 0.72rem;
  line-height: 1.3;
  text-overflow: ellipsis;
}

input {
  width: 100%;
  border: 3px solid #020704;
  border-radius: 0;
  outline: 2px solid #3d7043;
  padding: 13px 14px;
  color: var(--text);
  caret-color: var(--accent);
  background: var(--panel-dark);
  box-shadow: inset 4px 4px 0 rgba(0, 0, 0, 0.35);
  transition: outline-color 80ms steps(1), background-color 80ms steps(1);
}

input:focus {
  outline-color: var(--accent);
  background: #0c2414;
}

.join-submit,
.secondary-button {
  border: 3px solid var(--ink);
  border-radius: 0;
  padding: 13px 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 60ms steps(1), box-shadow 60ms steps(1), filter 60ms steps(1);
}

.join-submit {
  margin-top: 5px;
  color: #172007;
  background: var(--accent);
  box-shadow: 5px 5px 0 var(--accent-dark), 8px 8px 0 var(--ink);
}

.join-submit:hover,
.secondary-button:hover { filter: brightness(1.15); }

.join-submit:active,
.secondary-button:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--ink);
}

.join-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 58px;
  font-size: 0.96rem;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.join-error {
  min-height: 1.3em;
  margin: 18px 0 0;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 900;
  text-shadow: 2px 2px 0 #591b1b;
}

/* Intro card: emerald-and-gold arena styling that matches the anime landscape. */
body.intro-screen .join-panel {
  width: min(570px, 100%);
  height: min(820px, calc(100svh - 24px));
  min-height: 0;
  padding: clamp(44px, 7vh, 70px) 58px clamp(38px, 6vh, 58px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 0;
  outline: 0;
  background: url('./assets/intro-panel-frame.png?v=20260714-1') center / 100% 100% no-repeat;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.62),
    0 0 30px rgba(48, 174, 82, 0.18);
  backdrop-filter: none;
}

body.intro-screen .join-panel::before,
body.intro-screen .join-panel::after {
  display: none;
}

body.intro-screen .join-panel::before { top: 13px; left: -5px; }
body.intro-screen .join-panel::after { right: -5px; bottom: 13px; }

body.intro-screen .brand-mark {
  display: none;
}

body.intro-screen .eyebrow {
  color: #efd56d;
  text-shadow: 2px 2px 0 rgba(74, 49, 8, 0.9);
}

body.intro-screen h1 {
  color: #fff4bd;
  text-shadow: 3px 0 0 #347b49, 0 3px 0 #347b49, 4px 5px 0 #06150c;
}

body.intro-screen .game-logo { text-shadow: none; }

body.intro-screen .subtitle {
  position: relative;
  margin-bottom: 16px;
  padding-bottom: 14px;
  color: #c7d8bc;
}

body.intro-screen .subtitle::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #d8b94f 25%, #65bd72 50%, #d8b94f 75%, transparent);
}

body.intro-screen .join-form {
  width: 100%;
  gap: 10px;
  padding: 16px 20px 18px;
  border: 2px solid rgba(93, 173, 104, 0.46);
  background: rgba(2, 19, 11, 0.55);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.22), 4px 4px 0 rgba(2, 10, 6, 0.55);
}

body.intro-screen .game-logo {
  width: min(340px, 90%);
  height: clamp(150px, 22vh, 200px);
  margin: -16px auto -8px;
}

.quiz-progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quiz-progress span {
  padding: 7px 9px;
  border-bottom: 3px solid #294e34;
  color: #78977f;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

.quiz-progress span.active {
  border-color: #efd36b;
  color: #fff0ad;
}

.quiz-stage {
  position: relative;
  height: 285px;
  overflow: hidden;
}

.quiz-step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 14px 2px 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(42px);
  transition:
    opacity 260ms ease,
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 340ms;
  pointer-events: none;
}

.quiz-step.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition-delay: 0s;
  pointer-events: auto;
}

.join-form.show-step-2 .quiz-step[data-step="1"] {
  transform: translateX(-42px);
}

.quiz-step .join-submit { margin-top: auto; }

.quiz-actions {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  margin-top: auto;
}

.quiz-actions .join-submit { margin: 0; }

.back-button {
  border: 2px solid #416c4a;
  color: #c1d5c3;
  background: rgba(6, 27, 15, 0.9);
  font: 700 0.78rem var(--pixel-font);
  cursor: pointer;
}

.back-button:hover { border-color: #dfc55f; color: #fff0ad; }

body.intro-screen input {
  min-height: 54px;
  outline-color: #315e3c;
  background: rgba(3, 25, 14, 0.9);
  font-size: 1rem;
}

body.intro-screen input:focus {
  outline-color: #e0c45d;
  box-shadow: inset 4px 4px 0 rgba(0, 0, 0, 0.32), 0 0 12px rgba(224, 196, 93, 0.17);
}

body.intro-screen .join-submit {
  color: #182307;
  background: linear-gradient(180deg, #ffe477, #e6bd45);
  box-shadow: 5px 5px 0 #8b631a, 8px 8px 0 #020704;
}

/* Warm wood-and-copper shell used outside the arena. */
body:not(.intro-screen) {
  --bg: #180806;
  --panel: #4b1e14;
  --panel-dark: #24100c;
  --panel-light: #71301f;
  --border: #c66532;
  --border-light: #f0a85f;
  --text: #ffe0a6;
  --muted: #d29a75;
  --accent: #f1b75e;
  --accent-dark: #7a3518;
  --ink: #190805;
  background-color: #180806;
  background-image:
    linear-gradient(rgba(17, 5, 3, 0.2), rgba(9, 3, 2, 0.5)),
    var(--game-backdrop, none);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body:not(.intro-screen)::before {
  background:
    radial-gradient(circle at center, transparent 38%, rgba(8, 2, 1, 0.42) 100%),
    linear-gradient(90deg, rgba(255, 168, 80, 0.04), transparent 24%, transparent 76%, rgba(255, 168, 80, 0.04));
}

.game-panel { width: 100%; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 14px 18px;
  background: var(--panel);
}

.topbar strong {
  color: #fff6ae;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.round-pill {
  padding: 9px 14px;
  border: 3px solid var(--ink);
  color: #172007;
  background: var(--accent);
  box-shadow: 3px 3px 0 var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.secondary-button {
  color: var(--text);
  background: #285f34;
  box-shadow: 4px 4px 0 #12371c, 6px 6px 0 var(--ink);
  font-size: 0.75rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 22px;
  align-items: start;
}

.game-frame {
  position: relative;
  overflow: hidden;
  background: #07160c;
  outline-color: var(--accent);
}

.chat-composer {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 5;
  width: min(440px, calc(100% - 36px));
  padding: 10px;
  border: 3px solid var(--ink);
  outline: 2px solid var(--accent);
  background: rgba(25, 8, 5, 0.94);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.65);
  transform: translateX(-50%);
}

.chat-composer label {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.chat-composer input { padding: 9px 10px; }

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #0b742f;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.ping-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  min-width: 66px;
  padding: 6px 8px;
  border: 2px solid rgba(3, 12, 7, 0.86);
  color: #d8e5d5;
  background: rgba(2, 12, 7, 0.66);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.48);
  font-size: 0.67rem;
  font-weight: 900;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
  opacity: 0.76;
  pointer-events: none;
}

.ping-indicator.good { color: #9df596; }
.ping-indicator.medium { color: #ffe274; }
.ping-indicator.bad { color: #ff7770; }

.message-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  color: #fff7b5;
  background: rgba(2, 7, 4, 0.64);
  text-align: center;
  font-size: clamp(1.4rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  text-shadow: 4px 0 #1c6e2c, 0 4px #1c6e2c, 4px 4px var(--ink);
  pointer-events: none;
}

.sidebar { display: grid; gap: 18px; }

.panel-card {
  position: relative;
  padding: 17px;
  background: var(--panel);
}

.panel-card::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 6px;
  height: 6px;
  background: var(--border-light);
}

.panel-card h2 {
  margin: -17px -17px 16px;
  padding: 9px 12px;
  border-bottom: 3px solid var(--ink);
  color: #172007;
  background: var(--border);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body:not(.intro-screen) .topbar,
body:not(.intro-screen) .panel-card,
body:not(.intro-screen) .game-frame {
  border-color: #230c08;
  outline-color: #c66532;
  box-shadow:
    0 0 0 2px #6d2a1a,
    7px 7px 0 rgba(15, 4, 3, 0.88),
    inset 0 0 0 2px rgba(244, 159, 83, 0.16);
}

body:not(.intro-screen) .topbar {
  position: relative;
  background:
    linear-gradient(90deg, transparent 48%, rgba(255, 207, 133, 0.035) 50%, transparent 52%) 0 0 / 18px 100%,
    linear-gradient(180deg, #a54d2c 0 10%, #73301e 10% 82%, #3a160f 82% 100%);
  box-shadow:
    0 0 0 2px #6d2a1a,
    7px 7px 0 rgba(15, 4, 3, 0.88),
    inset 0 3px 0 #d77a3d,
    inset 0 -4px 0 #35120c;
}

body:not(.intro-screen) .topbar strong { color: #ffe1a2; }

body:not(.intro-screen) .round-pill {
  color: #32130c;
  background: linear-gradient(180deg, #ffd489, #d9833f);
  box-shadow: 3px 3px 0 #6c2d17;
}

body:not(.intro-screen) .secondary-button {
  color: #ffe6b0;
  background: linear-gradient(180deg, #9d4628, #642617);
  box-shadow: 4px 4px 0 #35120c, 6px 6px 0 var(--ink);
}

body:not(.intro-screen) .game-frame {
  outline-color: #e08a45;
  background: #160705;
}

body:not(.intro-screen) .panel-card {
  background:
    linear-gradient(90deg, transparent 48%, rgba(255, 198, 116, 0.025) 50%, transparent 52%) 0 0 / 14px 100%,
    linear-gradient(180deg, #592217, #35130e);
}

body:not(.intro-screen) .panel-card::before,
body:not(.intro-screen) .panel-card::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: #f0a85f;
  box-shadow: 0 0 0 2px #35120c;
}

body:not(.intro-screen) .panel-card::before { top: 7px; left: 7px; }
body:not(.intro-screen) .panel-card::after { right: 7px; bottom: 7px; }

body:not(.intro-screen) .panel-card h2 {
  color: #ffe2a7;
  background: linear-gradient(180deg, #b3542f, #7a2f1d);
  box-shadow: inset 0 3px 0 rgba(255, 183, 95, 0.35), inset 0 -3px 0 #45170f;
  text-shadow: 2px 2px 0 #38120b;
}

body:not(.intro-screen) .player-card {
  border-color: #2a0d08;
  background: #71301f;
  box-shadow: 3px 3px 0 #260c08;
}

body:not(.intro-screen) .player-name { color: #ffe5b0; }
body:not(.intro-screen) .player-status,
body:not(.intro-screen) .control-row,
body:not(.intro-screen) .stats-card > div { color: #d9a17b; }

body:not(.intro-screen) .stats-card > div { border-bottom-color: #8c452b; }

body:not(.intro-screen) kbd {
  color: #35130c;
  background: #f2c57d;
  box-shadow: 0 4px 0 #9c6033, 0 6px 0 #230c08;
}

body:not(.intro-screen) .message-overlay {
  background: rgba(23, 7, 4, 0.7);
  text-shadow: 4px 0 #8f3821, 0 4px #8f3821, 4px 4px var(--ink);
}

.player-list { display: grid; gap: 10px; }

.player-card {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 2px solid #07150d;
  background: var(--panel-light);
  box-shadow: 3px 3px 0 #07150d;
}

.player-dot {
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(255, 255, 255, 0.2);
}

.player-name {
  overflow: hidden;
  color: #f7f0c2;
  font-size: 0.78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-status {
  color: #ffe17a;
  font-size: 0.62rem;
  font-weight: 900;
  text-align: right;
  text-shadow: 1px 1px 0 #4b3510;
  white-space: nowrap;
}
.player-card.dead { opacity: 0.48; filter: grayscale(1); }

.controls-card { display: grid; gap: 12px; }

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 0.72rem;
}

kbd {
  min-width: 70px;
  padding: 6px 7px;
  border: 2px solid var(--ink);
  border-radius: 0;
  color: #172007;
  background: #d9e9bb;
  box-shadow: 0 4px 0 #718064, 0 6px 0 var(--ink);
  text-align: center;
  font: 900 0.67rem var(--pixel-font);
}

.stats-card { display: grid; gap: 11px; }

.stats-card > div {
  display: flex;
  justify-content: space-between;
  padding-bottom: 7px;
  border-bottom: 2px dotted #3b6841;
  color: var(--muted);
  font-size: 0.75rem;
}

.stats-card strong {
  min-width: 24px;
  color: var(--accent);
  text-align: right;
  text-shadow: 2px 2px 0 #4b3510;
}

@media (max-width: 920px) {
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
  body.intro-screen { background-position: center top; }
  .app-shell { width: min(100% - 22px, 1240px); padding: 16px 0 28px; }
  .join-panel { padding: 30px 20px; }
  body.intro-screen .join-panel { height: calc(100svh - 20px); min-height: 0; padding: 48px 42px 38px; }
  body.intro-screen .join-form { padding: 16px; }
  .topbar { flex-wrap: wrap; }
  .content-grid { gap: 16px; }
  .sidebar { grid-template-columns: 1fr; }
  .round-pill { order: 3; width: 100%; text-align: center; }
}

@media (max-width: 480px) {
  body.intro-screen .join-panel { padding: 42px 30px 34px; }
  body.intro-screen h1 { font-size: clamp(1.8rem, 12vw, 2.7rem); }
  .game-logo { width: min(290px, 100%); height: 190px; margin-top: -12px; }
  body.intro-screen .subtitle { margin-bottom: 20px; }
  .room-grid { grid-template-columns: 1fr; }
  .room-card small { min-height: auto; }
  .step-heading { font-size: 0.84rem; }
}

@media (max-width: 600px) {
  .splash-logo { width: min(430px, 96vw); height: clamp(230px, 76vw, 330px); }
  .splash-prompt { margin-top: -8px; padding-inline: 12px; }
}

@media (max-height: 720px) {
  body.intro-screen .join-panel { padding-top: 34px; padding-bottom: 28px; }
  body.intro-screen .eyebrow { margin-bottom: 0; }
  body.intro-screen .game-logo { width: min(270px, 75%); height: 150px; margin-top: -8px; }
  body.intro-screen .subtitle { margin-bottom: 9px; padding-bottom: 9px; font-size: 0.78rem; }
  .quiz-stage { height: 270px; }
  .quiz-step { padding-top: 10px; gap: 12px; }
  body.intro-screen input { min-height: 48px; }
  .join-submit { min-height: 50px; }
  .splash-logo { width: min(500px, 78vw); height: 300px; }
}

/* Emerald forest lobby palette. */
body.intro-screen {
  background:
    radial-gradient(circle at center, rgba(2, 18, 12, 0.16) 20%, rgba(1, 12, 8, 0.34) 100%),
    url('./assets/intro-landscape-anime-optimized.jpg?v=20260720-1') center / cover no-repeat fixed,
    #032a1f;
}

body.intro-screen::before {
  display: none;
}

body.intro-screen .join-panel {
  overflow: hidden;
  width: min(620px, calc(100vw - 28px));
  height: min(760px, calc(100svh - 24px));
  padding: clamp(22px, 4vh, 36px) clamp(28px, 5vw, 52px);
  border: 0;
  border-radius: 28px;
  outline: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(35, 138, 74, 0.18), rgba(3, 42, 31, 0.44) 72%),
    url('./assets/uibg-optimized.jpg?v=20260720-1') center / cover no-repeat;
  box-shadow:
    0 0 34px rgba(123, 217, 106, 0.2),
    0 30px 60px rgba(0, 16, 11, 0.62);
}

body.intro-screen .join-panel::before {
  content: "";
  position: absolute;
  inset: 10px 18px auto;
  display: block;
  height: 34%;
  border-radius: 20px 20px 50% 50%;
  background: linear-gradient(180deg, rgba(123, 217, 106, 0.18), rgba(123, 217, 106, 0));
  box-shadow: none;
  pointer-events: none;
}

body.intro-screen .join-panel::after { display: none; }

body.intro-screen .eyebrow {
  position: relative;
  z-index: 1;
  color: #e8ff72;
  text-shadow: 0 2px 4px rgba(0, 19, 12, 0.85);
}

body.intro-screen .game-logo {
  z-index: 1;
  width: min(440px, 94%);
  height: auto;
  aspect-ratio: 1.38 / 1;
  margin: -18px auto -8px;
}

body.intro-screen .game-logo img {
  width: 100%;
  height: auto;
  transform: translate(-50%, -12.5%);
}

body.intro-screen .subtitle {
  z-index: 1;
  margin-bottom: 10px;
  padding-bottom: 10px;
  color: #e1f3e7;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 19, 12, 0.9);
}

body.intro-screen .subtitle::after {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #7bd96a 22%, #e8ff72 50%, #7bd96a 78%, transparent);
}

body.intro-screen .join-form {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 22px;
  padding: 18px 22px 20px;
  background: rgba(245, 255, 242, 0.94);
  backdrop-filter: blur(5px);
  box-shadow:
    0 10px 24px rgba(3, 42, 31, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.82);
}

body.intro-screen .quiz-stage { height: 260px; }

.quiz-progress {
  gap: 10px;
  padding: 4px;
  border-radius: 999px;
  background: #dcefdc;
  box-shadow: inset 0 2px 5px rgba(10, 74, 51, 0.18);
}

.quiz-progress span {
  padding: 9px 10px;
  border: 0;
  border-radius: 999px;
  color: #547563;
  font-size: 0.78rem;
  transition: color 220ms ease, background-color 220ms ease, box-shadow 220ms ease;
}

.quiz-progress span.active {
  color: #fff;
  background: linear-gradient(180deg, #238a4a, #146b3d);
  box-shadow: 0 3px 0 #0a4a33, 0 5px 10px rgba(10, 74, 51, 0.28), inset 0 1px 0 rgba(232,255,114,.55);
}

.step-heading {
  color: #0a4a33;
  font-size: 1.05rem;
}

.step-heading small {
  color: #527660;
  font-size: 0.76rem;
}

body.intro-screen input {
  border: 2px solid #7bb98a;
  border-radius: 14px;
  outline: 0;
  color: #0a4a33;
  caret-color: #238a4a;
  background: #fff;
  box-shadow: inset 0 2px 5px rgba(26, 86, 113, 0.12), 0 2px 0 #fff;
}

body.intro-screen input:focus {
  border-color: #238a4a;
  outline: 4px solid rgba(123, 217, 106, 0.24);
  background: #fff;
  box-shadow: inset 0 2px 5px rgba(10, 74, 51, 0.1), 0 4px 12px rgba(35, 138, 74, 0.22);
}

body.intro-screen .join-submit {
  border: 2px solid #0a4a33;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #7bd96a 0%, #238a4a 48%, #146b3d 100%);
  box-shadow: 0 5px 0 #0a4a33, 0 8px 14px rgba(10, 74, 51, 0.3), inset 0 2px 0 rgba(232,255,114,.65);
  text-shadow: 0 2px 0 rgba(3, 42, 31, 0.7);
}

body.intro-screen .join-submit:hover {
  filter: brightness(1.08) saturate(1.06);
  transform: translateY(-1px);
}

body.intro-screen .join-submit:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #0a4a33, inset 0 2px 5px rgba(3, 42, 31, 0.3);
}

.join-form .room-card {
  border: 2px solid #8bbc93;
  border-radius: 18px;
  outline: 0;
  color: #164e34;
  background: linear-gradient(180deg, #fff, #e7f4e8);
  box-shadow: 0 4px 0 #78a985, 0 7px 12px rgba(10, 74, 51, 0.16), inset 0 1px 0 #fff;
}

.join-form .room-card:hover {
  border-color: #238a4a;
  filter: none;
  transform: translateY(-2px);
}

.join-form .room-card.selected {
  border-color: #238a4a;
  outline: 4px solid rgba(123, 217, 106, 0.25);
  color: #0a4a33;
  background: linear-gradient(180deg, #f2ffed, #c9ecc5);
  box-shadow: 0 4px 0 #146b3d, 0 8px 16px rgba(10, 74, 51, 0.24), inset 0 2px 0 #fff;
}

.join-form .room-card.selected::after {
  border-radius: 50%;
  color: #fff;
  background: #238a4a;
  box-shadow: 0 2px 0 #0a4a33;
}

.room-card-header > span {
  border-radius: 999px;
  color: #fff;
  background: #146b3d;
}

.room-card small { color: #527660; }

.back-button {
  border: 2px solid #8bae91;
  border-radius: 999px;
  color: #315f46;
  background: linear-gradient(180deg, #fff, #e1eee3);
  box-shadow: 0 4px 0 #76967d, inset 0 1px 0 #fff;
}

.back-button:hover {
  border-color: #238a4a;
  color: #0a4a33;
}

body.intro-screen .join-error {
  position: relative;
  z-index: 1;
  color: #c83846;
  text-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 560px) {
  body.intro-screen .join-panel {
    width: calc(100vw - 18px);
    height: calc(100svh - 18px);
    padding: 18px 18px 22px;
  }

  body.intro-screen .game-logo {
    width: min(400px, 96%);
    height: auto;
    aspect-ratio: 1.38 / 1;
    margin-bottom: -6px;
  }

  body.intro-screen .join-form { padding: 15px 16px 17px; }
  body.intro-screen .quiz-stage { height: 250px; }
}

/* Flat, high-contrast arena interface. */
body:not(.intro-screen) {
  --bg: #032a1f;
  --panel: rgba(3, 42, 31, 0.94);
  --panel-dark: #032a1f;
  --panel-light: rgba(10, 74, 51, 0.88);
  --border: #238a4a;
  --border-light: #7bd96a;
  --text: #f1f8ee;
  --muted: #b8ceb9;
  --accent: #e8ff72;
  --accent-dark: #146b3d;
  --ink: #021b14;
  color: var(--text);
  font-family: "Geomini", system-ui, sans-serif;
  background:
    linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.58)),
    url('./assets/insidebackground-optimized.jpg?v=20260720-1') center / cover no-repeat fixed,
    #032a1f;
}

body:not(.intro-screen)::before { display: none; }

body:not(.intro-screen) .app-shell { padding-block: 18px 28px; }

body:not(.intro-screen) .topbar,
body:not(.intro-screen) .panel-card,
body:not(.intro-screen) .game-frame {
  border: 1px solid rgba(20, 107, 61, 0.9);
  outline: 0;
  border-radius: 12px;
  box-shadow: none;
}

body:not(.intro-screen) .topbar {
  margin-bottom: 14px;
  padding: 12px 16px;
  background:
    linear-gradient(rgba(3, 42, 31, 0.78), rgba(3, 42, 31, 0.9)),
    url('./assets/uibgusable-optimized.jpg?v=20260720-1') center / cover no-repeat;
}

body:not(.intro-screen) .topbar .eyebrow {
  margin-bottom: 3px;
  color: #b8ceb9;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-shadow: none;
}

body:not(.intro-screen) .topbar strong {
  color: #f1f8ee;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.06em;
}

body:not(.intro-screen) .round-pill {
  padding: 9px 14px;
  border: 1px solid #238a4a;
  border-radius: 8px;
  color: #e8ff72;
  background: #0a4a33;
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 750;
}

body:not(.intro-screen) .secondary-button {
  padding: 10px 14px;
  border: 1px solid #238a4a;
  border-radius: 8px;
  color: #f1f8ee;
  background: #146b3d;
  box-shadow: none;
  font-size: 0.76rem;
  font-weight: 700;
}

body:not(.intro-screen) .secondary-button:hover {
  border-color: #7bd96a;
  background: #238a4a;
  filter: none;
}

body:not(.intro-screen) .content-grid {
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
}

body:not(.intro-screen) .game-frame { background: #032a1f; }

body:not(.intro-screen) .sidebar { gap: 12px; }

body:not(.intro-screen) .panel-card {
  padding: 15px;
  background:
    linear-gradient(rgba(3, 42, 31, 0.8), rgba(3, 42, 31, 0.92)),
    url('./assets/uibgusable-optimized.jpg?v=20260720-1') center / cover no-repeat;
}

body:not(.intro-screen) .panel-card::before,
body:not(.intro-screen) .panel-card::after { display: none; }

body:not(.intro-screen) .panel-card h2 {
  margin: -15px -15px 14px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid #146b3d;
  color: #e8ff72;
  background: #021b14;
  box-shadow: none;
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-shadow: none;
}

body:not(.intro-screen) .player-list { gap: 7px; }

body:not(.intro-screen) .player-card {
  padding: 9px 10px;
  border: 1px solid rgba(20, 107, 61, 0.72);
  border-radius: 7px;
  background: #0a4a33;
  box-shadow: none;
}

body:not(.intro-screen) .player-dot {
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  box-shadow: none;
}

body:not(.intro-screen) .player-name {
  color: #f1f8ee;
  font-size: 0.8rem;
  font-weight: 700;
}

body:not(.intro-screen) .player-status {
  color: #e8ff72;
  font-size: 0.64rem;
  font-weight: 650;
  text-shadow: none;
}

body:not(.intro-screen) .control-row,
body:not(.intro-screen) .stats-card > div {
  color: #b8ceb9;
  font-size: 0.74rem;
}

body:not(.intro-screen) kbd {
  min-width: 76px;
  padding: 6px 8px;
  border: 1px solid #238a4a;
  border-radius: 6px;
  color: #f1f8ee;
  background: #0a4a33;
  box-shadow: none;
  font: 700 0.68rem "Geomini", system-ui, sans-serif;
}

body:not(.intro-screen) .stats-card > div {
  border-bottom: 1px solid rgba(123, 217, 106, 0.22);
}

body:not(.intro-screen) .stats-card > div > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.powerup-icon {
  display: inline-block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  background-image: url('./assets/powerups-user-16x16.png?v=20260717-1');
  background-repeat: no-repeat;
  background-size: 100px 40px;
  image-rendering: pixelated;
}

.powerup-heart { background-position: 0 0; }
.powerup-speed { background-position: -40px 0; }
.powerup-shield { background-position: -80px 0; }
.powerup-kick { background-position: 0 -20px; }
.powerup-flame { background-position: -20px -20px; }
.powerup-bomb { background-position: -40px -20px; }
.powerup-punch { background-position: -60px -20px; }

body:not(.intro-screen) .stats-card strong {
  color: #e8ff72;
  font-weight: 750;
  text-shadow: none;
}

body:not(.intro-screen) .ping-indicator {
  border: 1px solid rgba(20, 107, 61, 0.78);
  border-radius: 6px;
  color: #f1f8ee;
  background: rgba(3, 42, 31, 0.9);
  box-shadow: none;
  text-shadow: none;
}

body:not(.intro-screen) .chat-composer {
  padding: 11px;
  border: 1px solid #146b3d;
  border-radius: 10px;
  outline: 0;
  background:
    linear-gradient(rgba(3, 42, 31, 0.88), rgba(3, 42, 31, 0.96)),
    url('./assets/uibgusable-optimized.jpg?v=20260720-1') center / cover no-repeat;
  box-shadow: none;
}

body:not(.intro-screen) .chat-composer label { color: #e8ff72; }

body:not(.intro-screen) .chat-composer input {
  border: 1px solid #238a4a;
  border-radius: 7px;
  color: #f1f8ee;
  background: #021b14;
  box-shadow: none;
}

body:not(.intro-screen) .message-overlay {
  color: #f1f8ee;
  background: rgba(3, 42, 31, 0.78);
  text-shadow: none;
}

@media (max-width: 920px) {
  body:not(.intro-screen) .content-grid { grid-template-columns: 1fr; }
  body:not(.intro-screen) .sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  body:not(.intro-screen) .topbar { align-items: stretch; }
  body:not(.intro-screen) .content-grid { gap: 10px; }
  body:not(.intro-screen) .sidebar { grid-template-columns: 1fr; }
}
