
/* =========================================
   DON'T FALL — FULLSCREEN ARCADE GAME
   ========================================= */

:root {
  --bg: #11150f;
  --panel: #1b2218;
  --accent: #b5f747;
  --text: #f4f6ef;
  --muted: #a8b19e;
  --ink: #252821;
  --danger: #e05040;
  --coin: #e3ad42;

  --pad: clamp(12px, 2vw, 26px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

/* Fullscreen application */

.app {
  position: fixed;
  inset: 0;

  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
}

/* Remove the website-style framing */

.topbar,
.heading,
.app > footer {
  display: none !important;
}

/* The game itself occupies every pixel */

.game-card {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;

  margin: 0;
  padding: 0;
  overflow: hidden;

  border: 0;
  border-radius: 0;
  background: #1b2218;
  box-shadow: none;
}

.canvas-wrap {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;

  overflow: hidden;
  background: #f7f8f5;
}

#gameCanvas {
  display: block;

  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  margin: 0;
  border: 0;
  outline: 0;

  background: #f7f8f5;
  touch-action: none;
}

.orientation-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;

  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));

  background:
    radial-gradient(ellipse at 50% 40%, rgba(181, 247, 71, 0.1), transparent 52%),
    rgba(17, 21, 15, 0.98);
  color: var(--text);
  text-align: center;
}

.orientation-overlay[hidden] {
  display: none !important;
}

.orientation-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 360px);
}

.orientation-visual {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--accent);
}

.orientation-arrow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.orientation-phone {
  position: relative;
  display: block;
  width: 42px;
  height: 72px;
  border: 3px solid currentColor;
  border-radius: 9px;
  box-shadow: 0 0 28px rgba(181, 247, 71, 0.2);
  animation: orientation-phone-tilt 1.8s ease-in-out infinite;
  transform-origin: center;
}

.orientation-phone::after {
  position: absolute;
  right: 5px;
  bottom: 5px;
  left: 5px;
  height: 3px;
  border-radius: 999px;
  background: rgba(181, 247, 71, 0.7);
  content: "";
}

@keyframes orientation-phone-tilt {
  0%,
  20% {
    transform: rotate(0deg);
  }

  70%,
  100% {
    transform: rotate(90deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orientation-phone {
    animation: none;
    transform: rotate(90deg);
  }
}

.orientation-content h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 950;
  letter-spacing: 0.06em;
}

.orientation-content p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* =========================================
   FULLSCREEN TITLE / PAUSE / RESULTS MENU
   ========================================= */

#overlay.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;
  min-height: 0;

  padding: clamp(20px, 6vw, 84px);
  overflow: hidden;
  overscroll-behavior: none;

  color: var(--text);

  background:
    radial-gradient(
      ellipse at 78% 34%,
      rgba(113, 151, 62, 0.18),
      transparent 44%
    ),
    linear-gradient(
      120deg,
      rgba(16, 21, 15, 0.96),
      rgba(27, 35, 23, 0.94)
    );
}

#overlay.hidden {
  display: none !important;
}

html.is-resuming-game #overlay {
  visibility: hidden;
}

#overlay.has-scrollable-page {
  align-items: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

#overlay.has-scrollable-page .menu-shell {
  flex: 0 0 auto;
  min-height: 100%;
  margin-top: auto;
  margin-bottom: auto;
}

.menu-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.75fr);
  align-items: center;

  gap: clamp(36px, 8vw, 120px);

  width: 100%;
  max-width: 1060px;
  min-height: 0;

  margin: auto;
}

.menu-main {
  min-width: 0;
}

#overlay.is-main-menu .menu-shell {
  width: min(100%, 820px);
  max-width: calc(100% - 290px);
  margin-right: clamp(20px, 5vw, 72px);
  margin-left: auto;
  gap: clamp(24px, 5vw, 72px);
}

#overlay.is-main-menu .menu-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.menu-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;

  margin: 0 0 clamp(20px, 4vh, 38px);

  color: #bbc5b1;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.6;
  text-transform: uppercase;
}

.menu-indicator {
  display: inline-block;
  flex: 0 0 auto;

  width: 8px;
  height: 8px;
  border-radius: 50%;

  background: var(--accent);
  box-shadow: 0 0 16px rgba(181, 247, 71, 0.4);
}

.menu-divider {
  color: var(--accent);
}

.menu-title {
  max-width: 5.4ch;

  margin: 0 0 26px;

  color: #f6f8f2;
  font-size: clamp(56px, 9vw, 116px);
  font-weight: 950;
  letter-spacing: -0.095em;
  line-height: 0.82;
  text-transform: uppercase;
  overflow-wrap: normal;
}

.menu-accent {
  color: var(--accent);
}

.menu-copy {
  max-width: 390px;

  margin: 0 0 28px;

  color: #bac3b1;
  font-size: clamp(13px, 1.15vw, 15px);
  line-height: 1.8;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;

  width: min(100%, 320px);
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  min-height: 54px;
  padding: 0 20px;

  border: 1px solid var(--accent);
  border-radius: 7px;

  background: var(--accent);
  color: #192011;

  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;

  cursor: pointer;

  transition:
    background 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.primary-button span {
  font-size: 19px;
}

.primary-button:hover {
  background: #c8ff6c;
  box-shadow: 0 0 30px rgba(181, 247, 71, 0.13);
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(0);
}

.menu-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;

  width: fit-content;
  min-height: 42px;
  padding: 0 15px;

  border: 1px solid rgba(239, 246, 231, 0.22);
  border-radius: 6px;

  background: rgba(255, 255, 255, 0.025);
  color: #f0f4e9;

  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;

  cursor: pointer;
  transition: all 150ms ease;
}

.menu-secondary:hover {
  border-color: var(--accent);
  background: rgba(181, 247, 71, 0.07);
  color: var(--accent);
}

#vsAICampaignButton {
  width: 100%;
  justify-content: space-between;
}

.menu-home-button {
  border-color: rgba(181, 247, 71, 0.38);
  background: rgba(181, 247, 71, 0.07);
}

.menu-home-button img {
  filter: invert(82%) sepia(72%) saturate(579%) hue-rotate(31deg) brightness(106%) contrast(96%);
}

.menu-home-button:hover img {
  filter: invert(91%) sepia(92%) saturate(633%) hue-rotate(31deg) brightness(110%) contrast(102%);
}

.menu-footnote {
  margin: 27px 0 0;

  color: #7f8b74;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.7;
}

/* Stage preview */

.menu-side {
  min-width: 0;
  padding-left: clamp(22px, 3.5vw, 48px);

  border-left: 1px solid rgba(231, 240, 221, 0.16);
}

.menu-side .menu-kicker {
  margin-bottom: 24px;
  color: #aeb9a2;
}

.stage-preview-number {
  display: flex;
  align-items: baseline;
  gap: 10px;

  margin: 0 0 20px;

  color: #f3f5ee;
  font-size: clamp(42px, 6vw, 68px);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 1;
}

.stage-preview-total {
  color: #89947e;
  font-size: 16px;
  letter-spacing: 0;
}

.stage-preview-title {
  margin: 0 0 12px;

  color: #f0f4e9;
  font-size: 15px;
  font-weight: 850;
}

.stage-preview-description {
  max-width: 340px;

  margin: 0;

  color: #adb7a2;
  font-size: 13px;
  line-height: 1.8;
}

.menu-coin-hud {
  position: absolute;
  z-index: 11;
  top: clamp(14px, 2.5vh, 26px);
  right: clamp(14px, 2.5vw, 26px);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(260px, calc(100vw - 28px));
  margin: 0;
  padding: 11px 13px;
  border: 1px solid rgba(246, 211, 111, 0.22);
  border-radius: 9px;
  background:
    linear-gradient(115deg, rgba(246, 211, 111, 0.09), transparent 55%),
    rgba(17, 22, 16, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.menu-coin-hud small {
  color: #a2ae96;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.menu-coin-hud strong {
  color: #ffda69;
  font-size: 20px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.menu-wallet-icon {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.menu-coin-lifetime {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.menu-coin-lifetime strong {
  font-size: 20px;
}



.stage-preview-divider {
  height: 1px;
  margin: 26px 0;

  background: rgba(231, 240, 221, 0.14);
}

.stage-preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;

  margin-top: 14px;
}

.stage-preview-meta span {
  color: #88947d;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.stage-preview-meta strong {
  color: #e8eee0;
  font-size: 10px;
  font-weight: 850;
  text-align: right;
}

/* =========================================
   GAMEPLAY HUD
   ========================================= */

.hud {
  position: absolute;
  z-index: 5;
  top: 20px;
  left: 20px;

  display: grid;
  grid-template-columns: repeat(4, minmax(48px, 1fr)) auto;
  align-items: center;
  gap: 18px;

  width: min(590px, calc(100% - 40px));
  min-height: 62px;

  padding: 10px 14px;

  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;

  background: rgba(17, 22, 16, 0.78);
  color: #f3f5ef;

  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* =========================================
   COIN HUD
   ========================================= */

.hud-coin-stat {
  gap: 5px;
}

.coin-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  line-height: 1;
}

.coin-icon {
  display: block;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  object-fit: contain;
}

.coin-counter #coinValue {
  color: #ffda69;
  font-size: 15px;
}

.coin-total {
  color: #a2ae96;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.coin-lifetime {
  color: #a2ae96;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.coin-lifetime strong {
  color: #ffda69;
  font-size: 9px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.hud small,
.hud-stat small {
  color: #a2ae96;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.12em;
  line-height: 1.2;
}

.hud strong,
.hud-stat strong {
  overflow: hidden;

  color: #f5f7f1;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pause-button {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 38px;
  height: 38px;

  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;

  background: rgba(255, 255, 255, 0.06);
  color: #f4f6ef;

  font-size: 16px;
  font-weight: 900;

  cursor: pointer;
}

.pause-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================================
   CAMPAIGN PROGRESS
   ========================================= */

.campaign-progress {
  position: absolute;
  z-index: 5;
  right: 24px;
  bottom: 22px;

  display: grid;
  gap: 9px;

  width: min(360px, calc(100% - 48px));
  padding: 12px 14px;

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;

  background: rgba(17, 22, 16, 0.78);
  color: #f4f6ef;

  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.campaign-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  color: #acb7a0;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.campaign-progress-meta strong {
  color: var(--accent);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.campaign-progress-track {
  display: block;

  width: 100%;
  height: 5px;
  overflow: hidden;

  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.campaign-progress-fill {
  display: block;

  width: 0%;
  height: 100%;

  border-radius: inherit;
  background: var(--accent);

  transition: width 150ms linear;
}

/* =========================================
   CONTROL HINTS AND TOUCH BUTTONS
   ========================================= */

.controls {
  position: absolute;
  z-index: 6;
  left: 24px;
  bottom: 24px;

  display: flex;
  align-items: center;
  gap: 12px;

  pointer-events: none;
}

.keyboard-controls {
  padding: 9px 12px;

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;

  background: rgba(17, 22, 16, 0.72);
}

.keyboard-controls .eyebrow {
  display: none;
}

.keyboard-controls p {
  margin: 0;

  color: #dce3d5;
  font-size: 10px;
  line-height: 1.8;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 23px;
  min-height: 22px;
  padding: 2px 5px;
  margin-right: 3px;

  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;

  background: rgba(255, 255, 255, 0.08);
  color: #f4f6ef;

  font-family: inherit;
  font-size: 9px;
  font-weight: 800;
}

.touch-controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;

  pointer-events: auto;
}

.touch-controls.is-practice-mode {
  display: flex;
}

.touch-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 54px;
  min-height: 48px;
  padding: 0 15px;

  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;

  background: rgba(17, 22, 16, 0.84);
  color: #f5f7ef;

  font-size: 18px;
  font-weight: 900;

  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-controls img {
  width: 24px;
  height: 24px;
}

.touch-controls button:active {
  border-color: var(--accent);
  background: #303c27;
}

.touch-controls button.jump {
  min-width: 106px;

  border-color: var(--accent);
  background: var(--accent);
  color: #1b2215;

  font-size: 11px;
  letter-spacing: 0.12em;
}

.touch-controls button.jump img {
  filter: brightness(0);
}

/* Toast messages */

.toast {
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: 90px;

  max-width: calc(100% - 30px);
  padding: 11px 17px;

  border: 1px solid rgba(181, 247, 71, 0.3);
  border-radius: 999px;

  background: rgba(20, 28, 17, 0.96);
  color: var(--accent);

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  white-space: nowrap;

  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Menu and gameplay are separate states.
   Keep HUD and controls out of the title screen. */

body:has(#overlay:not(.hidden)) .hud,
body:has(#overlay:not(.hidden)) .campaign-progress,
body:has(#overlay:not(.hidden)) .controls {
  display: none !important;
}

/* Short desktop windows */


/* ==========================================
   DON'T FALL — MENU NAVIGATION
   Add to the END of main.css
   ========================================== */

.menu-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}

.menu-nav-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  appearance: none;
  border: 1px solid rgba(239, 246, 231, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #f0f4e9;
  padding: 9px 11px;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.menu-nav-icon {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  filter: invert(1);
}

.menu-nav-button:hover {
  border-color: var(--accent);
  background: rgba(181, 247, 71, 0.1);
  color: var(--accent);
  transform: translateY(-1px);
}

.menu-nav-button.is-active {
  color: #192011;
  background: var(--accent);
  border-color: var(--accent);
}

.menu-nav-button.is-active .menu-nav-icon {
  filter: none;
}

.menu-navigation[hidden],
.menu-extra:empty {
  display: none;
}

.menu-sidebar {
  position: absolute;
  z-index: 20;
  top: clamp(14px, 2.5vh, 26px);
  left: 0;

  display: flex;
  align-items: flex-start;
  width: 120px;
  max-height: calc(100% - 32px);
  overflow: hidden;

  transition: width 220ms ease;
}

.menu-sidebar:hover,
.menu-sidebar:focus-within,
.menu-sidebar.is-open {
  width: min(370px, calc(100% - 18px));
  overflow: visible;
}

#overlay:not(.is-main-menu) .menu-sidebar {
  top: 72px;
}

#overlay.has-scrollable-page .menu-sidebar {
  position: fixed;
  max-height: calc(100dvh - 88px);
}

.menu-sidebar:hover,
.menu-sidebar:focus-within {
  width: min(370px, calc(100% - 18px));
  overflow: visible;
}

.menu-sidebar-toggle {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;

  display: flex;
  flex: 0 0 120px;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 120px;
  height: 48px;
  padding: 0 14px;

  border: 1px solid rgba(181, 247, 71, 0.36);
  border-left: 0;
  border-radius: 0 9px 9px 0;
  background: rgba(27, 34, 24, 0.96);
  color: var(--accent);

  cursor: pointer;
}

.menu-sidebar-icon {
  position: relative;
  flex: 0 0 20px;
  width: 20px;
  height: 2px;
  background: var(--accent);
  transition: background 180ms ease;
}

.menu-sidebar-label {
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.menu-sidebar-icon::before,
.menu-sidebar-icon::after {
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--accent);
  content: "";
  transition: transform 180ms ease;
}

.menu-sidebar-icon::before {
  transform: translateY(-6px);
}

.menu-sidebar-icon::after {
  transform: translateY(6px);
}

.menu-sidebar:hover .menu-sidebar-icon,
.menu-sidebar:focus-within .menu-sidebar-icon,
.menu-sidebar.is-open .menu-sidebar-icon {
  background: transparent;
}

.menu-sidebar:hover .menu-sidebar-icon::before,
.menu-sidebar:focus-within .menu-sidebar-icon::before,
.menu-sidebar.is-open .menu-sidebar-icon::before {
  transform: rotate(45deg);
}

.menu-sidebar:hover .menu-sidebar-icon::after,
.menu-sidebar:focus-within .menu-sidebar-icon::after,
.menu-sidebar.is-open .menu-sidebar-icon::after {
  transform: rotate(-45deg);
}

.menu-sidebar-content {
  display: flex;
  flex: 0 0 calc(100% - 120px);
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin-left: 120px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  visibility: hidden;
  padding: 18px 16px;

  border: 1px solid rgba(181, 247, 71, 0.24);
  border-radius: 0 10px 10px 0;
  background: rgba(17, 21, 15, 0.97);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: visibility 0s linear 220ms;
}

.menu-sidebar:hover .menu-sidebar-content,
.menu-sidebar:focus-within .menu-sidebar-content,
.menu-sidebar.is-open .menu-sidebar-content {
  visibility: visible;
  transition-delay: 0s;
}

.menu-sidebar .menu-actions {
  width: 100%;
}

.menu-sidebar .menu-navigation {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 0;
}

.menu-sidebar .menu-nav-button,
.menu-sidebar .menu-home-button {
  width: 100%;
  min-height: 42px;
  justify-content: space-between;
}

.menu-sidebar .menu-nav-button {
  justify-content: flex-start;
}

.menu-home-button {
  position: fixed;
  z-index: 21;
  top: clamp(14px, 2.5vh, 26px);
  left: clamp(14px, 2.5vw, 26px);
}

.menu-sidebar .menu-navigation[hidden] {
  display: none !important;
}

.menu-extra {
  margin-top: 15px;
  width: 100%;
  min-width: 0;
}

.character-selection {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  gap: 12px;
}

.character-wallet {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid rgba(181, 247, 71, 0.45);
  border-left: 4px solid var(--accent);
  border-radius: 5px;
  color: #f4f6ef;
  background: #20271d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.character-wallet span,
.character-wallet strong {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow-wrap: normal;
}

.character-wallet strong {
  color: var(--accent);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.menu-option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 140px;
  align-content: start;
  align-items: stretch;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.menu-option-grid > .menu-option {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.menu-option {
  display: flex;
  position: relative;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border-radius: 6px;
  text-align: left;
  color: #252821;
  background: #f3f4ed;
  border: 1px solid rgba(37, 40, 33, 0.22);
  font: inherit;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.menu-option canvas.character-preview {
  display: block;
  width: 40px;
  height: 48px;
  image-rendering: pixelated;
}

.menu-option:hover {
  border-color: #72bd85;
  transform: translateY(-1px);
}

.menu-option.is-selected {
  border-color: #5d912d;
  background: #e7f2d9;
  box-shadow: inset 0 0 0 1px #5d912d;
}

.menu-option.is-locked {
  color: #3f453b;
  background: #e5e6df;
}

.menu-option.is-locked canvas.character-preview {
  filter: grayscale(0.75) brightness(0.88);
}

.menu-option.is-affordable {
  border-color: rgba(93, 145, 45, 0.65);
}

.character-swatch {
  position: relative;
  display: block;
  width: 29px;
  height: 34px;
  border-radius: 6px;
  background: var(--character-color);
  border: 1px solid rgba(37, 40, 33, 0.3);
}

.character-eye {
  position: absolute;
  top: 8px;
  right: 5px;
  width: 4px;
  height: 4px;
  background: #f7f8f5;
}

.character-stripe {
  position: absolute;
  top: 7px;
  right: 2px;
  width: 3px;
  height: 9px;
  background: #72bd85;
}

.menu-option-name {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.menu-option-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 7px;
  border-radius: 3px;
  color: #f4f6ef;
  background: #4b5147;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.5;
  letter-spacing: 0.05em;
}

.menu-option-status.is-locked {
  color: #fff;
  background: #754a3f;
}

.menu-option.is-selected .menu-option-status {
  color: #192011;
  background: var(--accent);
}

.menu-option-price {
  display: inline-flex;
  align-items: center;
  margin-top: auto;
  color: #69443c;
  font-size: 9px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.menu-option-price.is-affordable {
  color: #3f6e1f;
}

.stage-option-number {
  font-size: 25px;
  font-weight: 850;
  letter-spacing: -0.06em;
}

.menu-note {
  margin: 12px 0 0;
  max-width: 42ch;
  color: #a8b19e;
  font-size: 10px;
  line-height: 1.6;
}

.menu-record-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.menu-records {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.menu-records .character-screen-header {
  flex: 0 0 auto;
  padding: clamp(8px, 1.5vh, 16px) clamp(10px, 2vw, 24px);
}

.menu-records .menu-record-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 clamp(10px, 2vw, 24px) 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.menu-record-list .menu-record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.menu-record-list .menu-record-row span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.menu-record-list .menu-record-row strong {
  flex: 0 0 auto;
  max-width: 45%;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.menu-record-row {
  display: grid;
  gap: 9px;
  min-width: 0;
  min-height: 68px;
  padding: 12px 13px;
  border: 1px solid rgba(239, 246, 231, 0.13);
  border-radius: 7px;
  background:
    linear-gradient(120deg, rgba(181, 247, 71, 0.07), transparent 70%),
    rgba(255, 255, 255, 0.035);
}

.menu-record-row > span {
  color: #a8b19e;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.09em;
  line-height: 1.5;
}

.menu-record-row > strong {
  overflow: hidden;
  color: #f4f6ef;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px;
  border: 1px solid rgba(239, 246, 231, 0.14);
  border-radius: 7px;
  background:
    linear-gradient(120deg, rgba(181, 247, 71, 0.07), transparent 70%),
    rgba(255, 255, 255, 0.035);
}

.menu-setting-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.menu-setting-copy > strong {
  color: #f0f4e9;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.menu-setting-copy > span {
  color: #a8b19e;
  font-size: 10px;
  line-height: 1.5;
}

.menu-setting-toggle {
  flex: 0 0 auto;
  min-width: 54px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(239, 246, 231, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #f0f4e9;
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.menu-setting-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.menu-setting-toggle.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #192011;
}

.menu-setting-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.touch-controls.menu-touch-hidden {
  display: none !important;
}

/* =========================================
   DON'T FALL — HOW TO PLAY UI
   ========================================= */

.menu-page-container {
  width: 100%;
  min-width: 0;
  margin-top: 14px;
}

.how-to-play-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.how-to-play-screen .character-screen-header {
  flex: 0 0 auto;
  padding: clamp(8px, 1.5vh, 16px) clamp(10px, 2vw, 24px);
}

.how-to-play {
  display: grid;
  flex: 1 1 auto;
  gap: 16px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0 clamp(10px, 2vw, 24px) 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  color: #f6f8f2;
}

.how-to-play-intro {
  display: grid;
  gap: 7px;
}

.how-to-play-label {
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.how-to-play-intro-text {
  margin: 0;
  color: #bac3b1;
  font-size: 12px;
  line-height: 1.6;
}

.how-to-play-section {
  display: grid;
  gap: 9px;
}

.how-to-play-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px;
}

.how-to-play-section-title {
  margin: 0;
  color: #f6f8f2;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.how-to-play-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.how-to-play-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(239, 246, 231, 0.13);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
}

.how-to-play-control-label {
  color: #f6f8f2;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.how-to-play-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.how-to-play-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  min-height: 22px;
  padding: 3px 5px;
  border: 1px solid rgba(239, 246, 231, 0.2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 900;
}

.how-to-play-control-description {
  grid-column: 1 / -1;
  margin: 0;
  color: #aab4a0;
  font-size: 10px;
  line-height: 1.5;
}

.how-to-play-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.how-to-play-rule {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(239, 246, 231, 0.12);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.035);
}

.how-to-play-rule-number {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 900;
}

.how-to-play-rule-title {
  margin: 0 0 5px;
  color: #f6f8f2;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.how-to-play-rule-description {
  margin: 0;
  color: #aab4a0;
  font-size: 10px;
  line-height: 1.55;
}

.how-to-play-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.how-to-play-start {
  width: min(100%, 320px);
}

/* =========================================
   WORLDS AND STAGE SELECT
   ========================================= */

.worlds-screen {
  display: grid;
  gap: 14px;
  width: 100%;
  color: #f3f7ee;
}

.worlds-heading {
  display: grid;
  gap: 6px;
}

.worlds-label {
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.worlds-title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.worlds-description {
  margin: 0;
  color: #aeb8a5;
  font-size: 11px;
  line-height: 1.6;
}

.worlds-grid,
.world-stages-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.world-card,
.world-stage-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(240, 246, 233, 0.13);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: inherit;
  text-align: left;
  font: inherit;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.world-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.world-card:not(:disabled),
.world-stage-card:not(:disabled) {
  cursor: pointer;
}

.world-card:not(:disabled):hover,
.world-stage-card:not(:disabled):hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-2px);
}

.world-card:focus-visible,
.world-stage-card:focus-visible,
.worlds-back-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.world-card.is-current-world,
.world-stage-card.is-selected {
  border-color: var(--accent);
  background: rgba(128, 190, 102, 0.09);
}

.world-card:disabled,
.world-stage-card:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.world-card-top,
.world-stage-top,
.world-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.world-card-identity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.world-card-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.world-number,
.world-status,
.world-card-difficulty,
.world-stage-number,
.world-stage-status,
.world-stage-feature,
.world-stage-difficulty {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.05em;
}

.world-number,
.world-stage-number {
  color: var(--accent);
}

.world-status.is-unlocked {
  color: #a8d99a;
}

.world-status.is-locked,
.world-stage-status {
  color: #aab3a2;
}

.world-card-title,
.world-stage-title {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.4;
}

.world-card-description,
.world-stage-description {
  margin: 0;
  color: #abb5a2;
  font-size: 10px;
  line-height: 1.6;
}

.world-card-progress {
  color: #d9e2d1;
  font-size: 9px;
  font-weight: 750;
}

.world-card-difficulty {
  align-self: flex-start;
  padding: 4px 6px;
  border: 1px solid rgba(240, 246, 233, 0.13);
  border-radius: 3px;
  color: #c4ceb9;
}

.world-stage-feature {
  align-self: flex-start;
  padding: 4px 6px;
  border-radius: 3px;
  background: rgba(128, 190, 102, 0.09);
  color: var(--accent);
}

.world-card-footer {
  margin-top: auto;
  padding-top: 5px;
}

.world-stage-count {
  color: #aab4a1;
  font-size: 9px;
  font-weight: 800;
}

.world-card-arrow {
  color: var(--accent);
  font-size: 15px;
}

.worlds-back-button {
  justify-self: start;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.world-stages-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.world-stage-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
}

.world-stage-card.is-completed .world-stage-status {
  color: #a8d99a;
}

.world-stage-card.is-locked {
  opacity: 0.4;
}

.worlds-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(240, 246, 233, 0.12);
}

.worlds-selected-stage {
  display: grid;
  gap: 5px;
}

.worlds-selected-title {
  color: #f2f6ed;
  font-size: 11px;
}

.worlds-play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.worlds-play-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ai-campaign-button {
  width: 100%;
  justify-content: center;
  border-color: rgba(183, 255, 114, 0.48);
  color: #d9ffb0;
  background: rgba(183, 255, 114, 0.055);
}

.ai-campaign-button:hover {
  border-color: var(--accent);
  background: rgba(183, 255, 114, 0.12);
  color: var(--accent);
}

/* About Game and creator acknowledgements */
.about-game-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #f6f8f2;
  box-sizing: border-box;
}

.about-game-screen .character-screen-header {
  flex: 0 0 auto;
  padding: clamp(8px, 1.5vh, 16px) clamp(10px, 2vw, 24px);
}

.about-game-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0 clamp(10px, 2vw, 24px) 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: rgba(183, 255, 114, 0.35) rgba(255, 255, 255, 0.04);
  box-sizing: border-box;
}

.about-game-intro,
.about-game-card {
  position: relative;
  min-width: 0;
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid rgba(239, 246, 231, 0.12);
  border-radius: 7px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.02)),
    rgba(19, 25, 18, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 12px 28px rgba(0, 0, 0, 0.12);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.about-game-intro {
  grid-column: 1 / -1;
  overflow: hidden;
  border-color: rgba(181, 247, 71, 0.28);
  background: linear-gradient(
    112deg,
    rgba(181, 247, 71, 0.12),
    rgba(255, 255, 255, 0.045) 56%,
    rgba(255, 255, 255, 0.02)
  );
}

.about-game-intro::after {
  position: absolute;
  right: -36px;
  bottom: -94px;
  width: 210px;
  height: 150px;
  border: 1px solid rgba(181, 247, 71, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 18px rgba(181, 247, 71, 0.025),
    0 0 0 38px rgba(181, 247, 71, 0.02);
  content: "";
  pointer-events: none;
}

.about-game-card {
  border-left: 2px solid rgba(181, 247, 71, 0.45);
}

.about-game-card:hover {
  transform: translateY(-2px);
  border-color: rgba(181, 247, 71, 0.38);
  background:
    linear-gradient(145deg, rgba(181, 247, 71, 0.075), rgba(255, 255, 255, 0.025)),
    rgba(19, 25, 18, 0.82);
}

.about-game-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
  line-height: 1.5;
}

.about-game-heading {
  margin: 0 0 9px;
  color: #f6f8f2;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.1;
  text-wrap: balance;
}

.about-game-card-title {
  margin: 0 0 7px;
  color: #f6f8f2;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.35;
  text-wrap: balance;
}

.about-game-copy {
  margin: 0;
  color: #b9c3b1;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.about-game-people {
  display: grid;
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.about-game-person {
  position: relative;
  padding: 8px 10px 8px 29px;
  border: 1px solid rgba(181, 247, 71, 0.16);
  border-radius: 5px;
  background: rgba(181, 247, 71, 0.055);
  color: #eef5e7;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.about-game-person::before {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: rgba(181, 247, 71, 0.18);
  content: "";
  transform: translateY(-50%);
}

#overlay.has-scrollable-page:has(.about-game-screen) {
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  scrollbar-gutter: auto;
  background:
    radial-gradient(
      ellipse at 78% 34%,
      rgba(113, 151, 62, 0.12),
      transparent 44%
    ),
    linear-gradient(120deg, #10150f, #1b2317);
}

#overlay.has-scrollable-page:has(.about-game-screen) .menu-shell {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
}

#overlay.has-scrollable-page:has(.about-game-screen) .menu-main {
  width: 100%;
  height: 100%;
  min-height: 0;
}

#overlay.has-scrollable-page:has(.about-game-screen) .menu-kicker,
#overlay.has-scrollable-page:has(.about-game-screen) .menu-title,
#overlay.has-scrollable-page:has(.about-game-screen) .menu-copy,
#overlay.has-scrollable-page:has(.about-game-screen) .menu-home-button {
  display: none !important;
}

#overlay.has-scrollable-page:has(.about-game-screen) .menu-page-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
}

@media (max-width: 760px) {
  #overlay.has-scrollable-page .menu-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    width: min(100%, 560px);
    max-width: calc(100% - 32px);
  }

}

@media (max-width: 520px) {
  .about-game-content {
    grid-template-columns: minmax(0, 1fr);
  }
}
