/* Recorded gameplay is decorative; controls remain above it. */
.homepage-background { position: fixed; inset: 0; pointer-events: none; background: var(--paper) url('./homepage-light.png') center / cover no-repeat; }
.homepage-background video { width: 100%; height: 100%; object-fit: cover; display: block; }
:root[data-theme="dark"] .homepage-background { background-image: url('./homepage-dark.png'); }

/* The lobby uses the game's existing paper, ink, type and artwork. */
.menu {
  --menu-width: 1240px;
  --menu-gutter: clamp(20px, 2.5vw, 40px);
  overflow: auto;
  background: linear-gradient(105deg, #ffffffbf 0%, #ffffff8c 32%, #ffffff26 65%, #ffffff0d 100%);
}

.menu::before { content: none; }
.menu .background-toggle { margin-left: auto; min-height: 44px; padding: 8px 0 8px 14px; background: none; border: 0; font: 17px/1.2 Hand, cursive; text-decoration: underline; text-underline-offset: 4px; }
@media (pointer: coarse) { .menu .background-toggle { margin-inline: auto; padding-inline: 8px; } }

.menu .masthead,
.menu .menu-footer {
  width: min(var(--menu-width), calc(100% - 80px));
  margin: 0 auto;
}

.menu .masthead { height: 76px; border-color: #24242424; }
.menu .wordmark { gap: 9px; }
.menu .brand-mark { width: 32px; height: 32px; }
.menu .brand-wordmark { width: 100px; }
.menu .build-label { font-size: 9px; letter-spacing: 1px; color: #656565; margin-right: 12px; }
.menu .build-label b { background: none; border: 1px solid #24242440; color: inherit; padding: 4px 6px; }

.menu .intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: end;
  gap: clamp(36px, 5vw, 72px);
  width: calc(100% - 2 * var(--menu-gutter));
  min-height: auto;
  max-height: none;
  flex: 1 0 auto;
  margin: 0 auto;
  padding: 24px 0;
}

.menu .intro-copy {
  display: block;
  align-self: end;
  justify-self: start;
  min-width: 0;
  width: 100%;
  max-width: 420px;
  padding: 0;
}
.menu .intro-card {
  padding: clamp(16px, 2vw, 20px);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 6px 6px 0 #242424;
}
.menu .duudle-title { width: min(390px, 90%); margin: 0 0 16px; transform: rotate(-2deg); }
.menu .duudle-title img { width: 100%; height: auto; }
.menu .tagline { font: 34px/1.15 Hand, cursive; margin: 0 0 12px; transform: none; }
.menu .intro-description { max-width: none; font: 12px/1.75 Mono, monospace; color: #636363; margin: 0 0 26px; }
.menu .intro-card .intro-description { margin-bottom: 0; }

.menu .home-actions { display: grid; gap: 14px; margin-top: 24px; }
.menu .home-actions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: 14px 22px;
  gap: 20px;
  font: 29px/1.1 Bangers, sans-serif;
  letter-spacing: .6px;
  text-align: left;
  text-transform: uppercase;
}
.menu .home-actions .outline-button { border: 1.5px solid var(--ink); border-radius: 2px; background: #ffffffd9; }
.menu .home-actions .outline-button:hover:not(:disabled) { background: #fff; box-shadow: 2px 2px 0 var(--ink); }
.menu .home-actions .outline-button:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
.menu .button-arrow { flex: 0 0 auto; font: 34px/1 Hand, cursive; }
.menu :is(button, a):focus-visible { outline: 3px solid #2364e8; outline-offset: 4px; }
.menu .load-status { max-width: none; margin: 12px 0 0; font-size: 11px; color: #555; }

.menu .hero-doodle {
  position: relative;
  inset: auto;
  display: flex;
  align-items: center;
  align-self: center;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.08;
  max-width: none;
  max-height: none;
  margin: 0;
  pointer-events: none;
}
.menu .stickman-art { width: 100%; height: auto; max-width: none; max-height: none; margin: 0; transform: none; }
.hero-idle-body { animation: hero-breathe 4.6s ease-in-out infinite; }
.hero-idle-head { transform-box: fill-box; transform-origin: 50% 100%; animation: hero-look 9.2s ease-in-out infinite; }
.hero-idle-weapon { transform-box: fill-box; transform-origin: 28% 15%; animation: hero-ready 4.6s ease-in-out infinite; }
/* Only three SVG transforms animate; feet, shadow and page layout stay still. */
@keyframes hero-breathe {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-4px); }
}
@keyframes hero-look {
  0%, 100% { transform: rotate(0); }
  35% { transform: rotate(1.3deg); }
  70% { transform: rotate(-.7deg); }
}
@keyframes hero-ready {
  0%, 100% { transform: rotate(.4deg); }
  45% { transform: rotate(-1.6deg); }
}
.menu[hidden] :is(.hero-idle-body, .hero-idle-head, .hero-idle-weapon),
.hero-doodle[hidden] :is(.hero-idle-body, .hero-idle-head, .hero-idle-weapon) { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .hero-idle-body, .hero-idle-head, .hero-idle-weapon { animation: none; }
}
.menu .doodle-note { display: block; font-size: 21px; color: #666; }
.menu .note-head { top: 0; right: 6%; transform: rotate(6deg); }
.menu .note-head svg { width: 80px; right: 92%; top: 16px; }
.menu .note-rocket { top: 55%; right: -2%; font-size: 19px; }
.menu .note-rocket svg { width: 64px; right: 94%; top: -20px; }
.menu .sticker { display: block; left: 1%; bottom: 4%; padding: 11px 12px 9px; transform: rotate(-10deg); }
.menu .sticker strong { font-size: 23px; }
.menu .sticker span { font-size: 6px; }
.menu .arena-stamp { display: flex; justify-content: center; bottom: -26px; right: 0; left: 0; font: 8px/1.5 Mono, monospace; letter-spacing: 1px; gap: 12px; }
.menu .arena-stamp span + span { padding-left: 12px; border-left: 1px solid #24242450; }

.menu .menu-footer { min-height: 66px; height: auto; padding: 14px 0; gap: 20px; border-color: #24242424; }
.menu .quick-controls { width: auto; gap: 22px; }
.menu .quick-controls > span { font-size: 9px; gap: 8px; letter-spacing: .5px; }
.menu .quick-controls kbd { font-size: 9px; background: #ffffffd9; }
.menu .footer-note { display: flex; font-size: 18px; gap: 8px; }

/* Scale the composition to laptop height instead of forcing a tall lobby. */
@media (min-width: 901px) and (max-height: 820px) {
  .menu .masthead { height: 64px; }
  .menu .intro { padding: 18px 0 24px; gap: 48px; }
  .menu .duudle-title { width: min(360px, 90%); margin-bottom: 14px; }
  .menu .tagline { font-size: 29px; margin-bottom: 8px; }
  .menu .intro-description { font-size: 11px; line-height: 1.6; margin-bottom: 18px; }
  .menu .hero-doodle { max-width: min(530px, 70vh); justify-self: center; }
  .menu .menu-footer { min-height: 56px; padding: 10px 0; }
}

@media (max-width: 1100px) and (min-width: 901px) {
  .menu .intro { grid-template-columns: minmax(430px, 1fr) minmax(0, .9fr); gap: 24px; }
  .menu .masthead, .menu .menu-footer { width: calc(100% - 56px); }
  .menu .note-rocket { display: none; }
  .menu .note-head { font-size: 18px; right: 0; }
  .menu .sticker { left: -1%; bottom: 0; }
  .menu .sticker strong { font-size: 19px; }
  .menu .footer-note { font-size: 16px; }
}

/* A separate, flowing composition keeps the character clear of phone controls. */
@media (max-width: 900px) {
  .menu .masthead, .menu .menu-footer { width: min(600px, calc(100% - 40px)); }
  .menu .masthead { height: 68px; }
  .menu .intro { grid-template-columns: minmax(0, 1fr) minmax(120px, .65fr); gap: 0 12px; padding: 24px 0; }
  .menu .intro-copy { grid-column: 1 / -1; }
  .menu .duudle-title { grid-column: 1; grid-row: 1; width: 100%; margin: 0 0 14px; }
  .menu .tagline { grid-column: 1; grid-row: 2; font-size: 29px; margin: 0 0 10px; align-self: start; }
  .menu .intro-description { grid-column: 1; grid-row: 3; font-size: 11px; margin: 0; align-self: start; }
  .menu .hero-doodle { grid-column: 2; grid-row: 1 / 4; aspect-ratio: auto; height: auto; }
  .menu .doodle-note, .menu .sticker, .menu .arena-stamp { display: none; }
  .menu .home-actions { grid-column: 1 / -1; margin-top: 24px; }
  .menu .load-status { grid-column: 1 / -1; }
  .menu .menu-footer { flex-wrap: wrap; justify-content: center; gap: 12px; padding: 18px 0; }
  .menu .quick-controls { justify-content: space-between; width: 100%; }
  .menu .footer-note { font-size: 17px; }
  .menu .build-label { display: none; }
}

@media (max-width: 480px) {
  .menu .intro { grid-template-columns: minmax(0, 1fr) 112px; gap: 0 8px; padding: 24px 0; }
  .menu .duudle-title { margin-bottom: 12px; }
  .menu .tagline { font-size: 25px; }
  .menu .intro-description { font-size: 10px; line-height: 1.7; }
  .menu .intro-description br { display: none; }
  .menu .quick-controls { gap: 10px; }
  .menu .quick-controls > span { font-size: 7px; gap: 5px; }
  .menu .quick-controls kbd { font-size: 8px; padding: 5px; }
}

@media (pointer: coarse) {
  .menu .quick-controls { display: none; }
}

/* With the character hidden, reclaim its column on smaller screens. */
@media (max-width: 900px) {
  .menu .intro:has(> .hero-doodle[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .menu .intro:has(> .hero-doodle[hidden]) .duudle-title { width: min(390px, 100%); }
}

/* Practice setup lives one step beyond the two homepage choices. */
.death-overlay .death-modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 26px 30px; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
.death-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.death-modal h2 { margin: 0; font-size: 40px; line-height: 1.1; }
.death-heading .eyebrow { font-size: 8px; white-space: nowrap; letter-spacing: 1px; }
.death-modal #death-description { margin: 12px 0 0; font: 19px/1.4 Hand, cursive; }
.death-modal .death-scores { min-height: 0; margin-top: 18px; padding-top: 0; display: flex; flex-direction: column; }
.death-modal .score-scroll { min-height: 0; max-height: min(440px, 48dvh); margin: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.death-scores th { padding: 12px 10px; font-size: 9px; z-index: 1; }
.death-scores td { padding: 10px; font-size: 11px; }
.death-scores td:first-child { font-size: 12px; }
.death-scores tr.is-player { background: #edb93033; box-shadow: inset 3px 0 var(--yellow, #edb930); }
.death-actions { display: flex; align-items: center; gap: 24px; padding-top: 20px; }
.death-actions .primary-button { flex: 1; min-height: 54px; margin: 0; padding: 12px 20px; font-size: 27px; }
.death-actions small { margin: 0; white-space: nowrap; font: 9px Mono, monospace; letter-spacing: 1px; }
.quad-status { position: absolute; left: 50%; top: 125px; transform: translateX(-50%); border: 2px solid #2457ff; background: #fff; color: #2457ff; padding: 7px 13px; font: 18px/1.2 Hand, cursive; box-shadow: 3px 3px #2457ff; }
@media (max-width: 540px) { .quad-status { top: 102px; font-size: 16px; } }
@media (max-width: 540px), (max-height: 550px) {
  .death-overlay .death-modal { padding: 18px; max-height: calc(100dvh - 24px); }
  .death-modal h2 { font-size: 32px; }
  .death-modal #death-description { margin-top: 8px; font-size: 17px; }
  .death-modal .death-scores { margin-top: 12px; }
  .death-scores td, .death-scores th { padding: 8px; }
  .death-actions { padding-top: 12px; gap: 16px; }
}

.server-actions { display: flex; align-items: center; gap: 22px; }
.server-actions #host-game-button { font-weight: 600; text-decoration: underline; text-underline-offset: 5px; }
.local-game-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0; }
.local-game-actions .outline-button { width: 100%; min-height: 56px; margin: 0; font-size: 24px; }
@media (max-width: 480px) { .local-game-actions { grid-template-columns: minmax(0, 1fr); } }
.host-modal h2 { font-size: 48px; }
.host-modal label { display: block; font: 10px/1.5 Mono, monospace; letter-spacing: .6px; }
.host-modal input, .host-modal select { width: 100%; min-height: 46px; margin-top: 7px; border: 1.5px solid var(--ink); border-radius: 2px; padding: 9px; background: white; color: var(--ink); font: 20px Hand, cursive; }
.host-options { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin-top: 20px; }
.host-rule-choice { grid-column: 1 / -1; }
.host-modal .host-bots { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; min-height: 44px; font: 20px/1.3 Hand, cursive; letter-spacing: 0; cursor: pointer; }
.host-modal .host-bots input { flex: 0 0 22px; width: 22px; height: 22px; min-height: 22px; margin: 3px 0 0; padding: 0; accent-color: var(--ink); cursor: pointer; }
.host-modal .host-bots small { display: block; margin-top: 3px; font: 15px/1.4 Hand, cursive; letter-spacing: 0; text-align: left; }
.host-rules { font: 16px/1.5 Hand, cursive; margin: 18px 0 8px; }
.host-note { font: 11px/1.65 Mono, monospace; color: #666; }
.host-modal .close-button { min-width: 44px; min-height: 44px; }
@media (max-width: 480px) { .server-actions { gap: 10px; } .server-actions .text-button { font-size: 17px; } }

.local-modal { width: min(600px, calc(100vw - 40px)); padding: 30px; }
.local-modal h2 { font-size: 46px; margin: 4px 0 14px; }
.local-modal #local-description { margin: 0 0 24px; font-size: 18px; }
.local-modal .match-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; max-width: none; margin: 0; }
.local-modal .match-options label { font: 10px/1.4 Mono, monospace; letter-spacing: 1px; color: #626262; }
.local-modal .match-options select { min-height: 46px; margin-top: 7px; padding: 8px; border: 1px solid #24242480; border-bottom: 2px solid var(--ink); border-radius: 2px; font: 19px/1.3 Hand, cursive; }
.local-modal .match-options select:hover:not(:disabled) { border-color: var(--ink); }
.local-modal .match-options select:disabled { opacity: .65; cursor: default; }
.local-modal :is(button, select):focus-visible { outline: 3px solid #2364e8; outline-offset: 4px; }
.local-modal .match-details { margin: 18px 0; }
.local-modal .match-description { min-height: 0; max-width: none; margin: 0; font: 16px/1.4 Hand, cursive; color: #4a4a4a; }
.local-modal :is(#difficulty-description, #rules-description) { margin: 6px 0 0; font: 14px/1.4 Hand, cursive; color: #6a6a6a; }
.local-modal #play-button { width: 100%; min-width: 0; margin: 0; min-height: 58px; padding: 13px 20px; gap: 12px; font-size: 29px; }
.local-modal .solo-note { display: block; margin: 14px 0 0; font: 10px/1.5 Mono, monospace; letter-spacing: .2px; text-align: center; color: #666; }
.local-modal .local-tools { display: flex; align-items: center; gap: 18px; margin-top: 22px; padding-top: 12px; border-top: 1px solid #24242430; }
.local-modal .local-tools .text-button { min-height: 44px; font-size: 18px; }
.local-modal .local-tools .text-button:first-child { margin-right: auto; }
.local-modal .icon-button { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.local-modal .close-button { min-width: 44px; min-height: 44px; }

@media (max-width: 480px) {
  .menu .home-actions button { min-height: 60px; font-size: 27px; }
  .local-modal { padding: 24px 20px; }
  .local-modal h2 { font-size: 38px; }
  .local-modal .match-options { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .local-modal .match-options select { font-size: 18px; }
  .local-modal .local-tools { gap: 10px; flex-wrap: wrap; }
  .local-modal .local-tools .text-button { font-size: 17px; }
  .local-modal #play-button { font-size: 26px; }
}


.warmup-banner { position: fixed; z-index: 7; pointer-events: none; top: 110px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 20px; width: max-content; max-width: min(620px, calc(100vw - 32px)); padding: 12px 16px; background: #fff; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.warmup-banner strong { display: block; font: 13px/1.4 Mono, monospace; letter-spacing: 1.5px; }
.warmup-banner p { margin: 4px 0 0; max-width: 340px; font: 18px/1.3 Hand, cursive; }
.warmup-banner button { pointer-events: auto; flex-shrink: 0; min-height: 44px; padding: 8px 14px; border: 2px solid var(--ink); border-radius: 2px; background: var(--yellow); color: var(--ink); font: 22px/1.2 Hand, cursive; cursor: pointer; }
.warmup-banner button:focus-visible { outline: 3px solid #2364e8; outline-offset: 4px; }
.warmup-banner button:disabled { opacity: .6; cursor: default; }
@media (max-width: 600px) {
  .warmup-banner { top: 90px; gap: 10px; padding: 9px 12px; }
  .warmup-banner p { font-size: 15px; max-width: 210px; }
  .warmup-banner button { padding: 8px; font-size: 18px; }
}

/* Handbook navigation stays separate from the two play choices. */
.menu .wiki-link { font: 20px/1.2 Hand, cursive; padding: 10px 4px; white-space: nowrap; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.menu .wiki-link:hover { text-decoration-thickness: 2px; }
.help-wiki a { text-decoration: underline; text-underline-offset: 4px; }
