@font-face {
  font-family: "Munro";
  src: url("public/original/Fonts/munro.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Munro Small";
  src: url("public/original/Fonts/munro_small.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: #11131a;
  --panel-strong: #191c25;
  --line: #343948;
  --text: #f5f7fb;
  --muted: #a8adbc;
  --accent: #f24444;
  --accent-2: #36d4d8;
  --button: #1f1f1f;
  --button-active: #1f1f1f;
  --standard-button-bg: #1f1f1f;
  --pixel-button-bg: var(--standard-button-bg);
  --button-press-y: 3px;
  --shadow: rgba(0, 0, 0, 0.45);
  --retrocube-horizontal-safe-inset: max(var(--safe-left), var(--safe-right));
  --rounded: "Arial Rounded MT Bold", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --system: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root.is-installed-app {
  --bg: #050506;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
}

html,
body,
#app,
#app * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: transparent;
}

[hidden] {
  display: none !important;
}

.safe-area-probe {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  visibility: hidden;
  pointer-events: none;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Munro, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
  touch-action: pan-x pan-y;
}

#app {
  touch-action: pan-x pan-y;
}

button {
  position: relative;
  color: inherit;
  font: inherit;
  border: 1px solid var(--line);
  background: var(--button);
  min-height: 40px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:active:not(.is-release-cancelled) {
  background: var(--button-active);
  border-color: var(--accent-2);
}

button.active {
  background: var(--button-active);
  border-color: var(--accent-2);
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  gap: 10px;
}

.app-shell.is-title {
  position: fixed;
  inset: 0;
  width: var(--retrocube-safe-vw);
  height: var(--retrocube-safe-vh);
  min-height: var(--retrocube-safe-vh);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  padding: 0;
  gap: 0;
  place-items: center;
  background: #020203;
  overflow: hidden;
}

.app-shell.is-title .top-bar,
.app-shell.is-title .bottom-controls {
  display: none;
}

.app-shell.is-title .play-area {
  position: absolute;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  inset: 0;
  width: var(--retrocube-safe-vw);
  height: var(--retrocube-safe-vh);
  min-height: 0;
  place-items: center;
}

.app-shell.is-title .game-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(
    calc(var(--retrocube-safe-vh) * var(--retrocube-ratio)),
    calc(var(--retrocube-safe-vw) * var(--retrocube-frame-per-board-width))
  );
  height: min(
    var(--retrocube-safe-vh),
    calc(var(--retrocube-safe-vw) * var(--retrocube-frame-height-per-board-width))
  );
  max-width: none;
  aspect-ratio: auto;
  transform: translate(-50%, -50%);
  transform-origin: center;
}

.app-shell.is-landscape-layout.is-title,
.app-shell.is-landscape-layout.is-gameplay {
  position: fixed;
  inset: 0 auto auto 0;
  width: var(--retrocube-safe-vw);
  height: var(--retrocube-safe-vh);
  min-height: var(--retrocube-safe-vh);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  padding: 0;
  gap: 0;
  place-items: start center;
  background: #020203;
  overflow: hidden;
}

.app-shell.is-landscape-layout.is-title .top-bar,
.app-shell.is-landscape-layout.is-title .bottom-controls,
.app-shell.is-landscape-layout.is-gameplay .top-bar,
.app-shell.is-landscape-layout.is-gameplay .bottom-controls {
  display: none;
}

.app-shell.is-landscape-layout.is-title .play-area,
.app-shell.is-landscape-layout.is-gameplay .play-area {
  position: absolute;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  inset: 0;
  width: var(--retrocube-safe-vw);
  height: var(--retrocube-safe-vh);
  min-height: 0;
  display: grid;
  place-items: start center;
}

.app-shell.is-landscape-layout.is-title .game-frame,
.app-shell.is-landscape-layout.is-gameplay .game-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(
    calc(var(--retrocube-safe-vh) * var(--retrocube-ratio)),
    calc(var(--retrocube-safe-vw) * var(--retrocube-frame-per-board-width))
  );
  height: min(
    var(--retrocube-safe-vh),
    calc(var(--retrocube-safe-vw) * var(--retrocube-frame-height-per-board-width))
  );
  max-width: none;
  aspect-ratio: auto;
  transform: translate(-50%, -50%);
  transform-origin: center;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.brand-title {
  font-size: clamp(22px, 6vw, 40px);
  line-height: 1;
  white-space: nowrap;
}

.level-label {
  color: var(--muted);
  font-size: clamp(16px, 4vw, 24px);
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.tool-button,
.primary-button,
.tab-button {
  border-radius: 6px;
  padding: 8px 10px;
  line-height: 1;
  white-space: nowrap;
}

.play-area {
  min-height: 0;
  display: grid;
  place-items: center;
  touch-action: none;
}

.game-frame {
  position: relative;
  container-type: size;
  width: min(100%, calc((100dvh - 150px) * 1.7787));
  max-width: 1180px;
  aspect-ratio: 667 / 375;
  background: #050506;
  border: 0;
  box-shadow: none;
  overflow: hidden;
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #050506;
  touch-action: none;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

/*
 * Scale from the full available height while only optional margins are being
 * cropped. Once the 480-point board reaches a viewport edge, constrain by
 * width instead so gameplay can never leave the screen; surplus height then
 * becomes generated top/bottom backing rows.
 */
.app-shell.is-title .game-frame,
.app-shell.is-landscape-layout.is-gameplay .game-frame {
  --retrocube-viewport-gutter-x: calc((var(--retrocube-vw) - 100cqw) / 2);
  --retrocube-viewport-gutter-y: calc((var(--retrocube-vh) - 100cqh) / 2);
  overflow: visible;
}

.app-shell.is-title #gameCanvas,
.app-shell.is-landscape-layout.is-gameplay #gameCanvas,
.app-shell.is-landscape-layout.is-gameplay .duet-control-overlay {
  position: absolute;
  top: 50%;
  right: auto;
  left: 50%;
  width: var(--retrocube-vw);
  height: var(--retrocube-vh);
  transform: translate(-50%, -50%);
}

/* UI and transition layers are physical-viewport overlays. Keeping their
 * width exact avoids applying the game-frame crop/gutter a second time. */
.app-shell.is-title .message-overlay,
.app-shell.is-title .title-screen,
.app-shell.is-title .stage-complete-overlay,
.app-shell.is-title .pause-overlay,
.app-shell.is-landscape-layout.is-gameplay .message-overlay,
.app-shell.is-landscape-layout.is-gameplay .title-screen,
.app-shell.is-landscape-layout.is-gameplay .stage-complete-overlay,
.app-shell.is-landscape-layout.is-gameplay .pause-overlay {
  position: absolute;
  top: 50%;
  right: auto;
  left: 50%;
  width: var(--retrocube-vw);
  height: var(--retrocube-vh);
  transform: translate(-50%, -50%);
}

.game-timer {
  position: absolute;
  z-index: 1;
  top: calc(var(--safe-top) + 2.266667cqh - var(--retrocube-viewport-gutter-y, 0px));
  right: calc(var(--retrocube-horizontal-safe-inset) + 1.274363cqw - var(--retrocube-viewport-gutter-x, 0px));
  width: min(29.985cqw, calc(100% - 2.548726cqw));
  min-width: 0;
  padding: 0;
  color: #fff;
  background: none;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: 1.49925cqw;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
}

.game-timer-text {
  position: relative;
  z-index: 0;
  display: inline-block;
  padding: 0;
  background: transparent;
}

.game-timer-text::before,
.split-delta::before,
.snake-score-label::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -0.666667cqh;
  right: -0.374813cqw;
  bottom: -0.4cqh;
  left: -0.524738cqw;
  background: #000;
}

.split-delta {
  position: absolute;
  z-index: 2;
  top: calc(var(--safe-top) + 8.533333cqh - var(--retrocube-viewport-gutter-y, 0px));
  right: calc(var(--retrocube-horizontal-safe-inset) + 1.274363cqw - var(--retrocube-viewport-gutter-x, 0px));
  padding: 0;
  background: transparent;
  color: rgb(0, 153, 0);
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: 1.49925cqw;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
}

.split-delta.is-behind {
  color: rgb(204, 0, 0);
}

.level-progress-banner {
  position: absolute;
  z-index: 1;
  top: calc(var(--safe-top) + 8.8cqh - var(--retrocube-viewport-gutter-y, 0px));
  right: calc(var(--retrocube-horizontal-safe-inset) + 1.1994cqw - var(--retrocube-viewport-gutter-x, 0px));
  min-width: 0;
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: 2.9985cqw;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.level-progress-banner[hidden] {
  display: none;
}

#gameTimer[hidden] ~ .level-progress-banner {
  top: calc(var(--safe-top) + 2.4cqh - var(--retrocube-viewport-gutter-y, 0px));
}

.level-progress-banner.is-visible {
  animation: level-progress-fade 2.85s linear both;
}

.level-progress-text {
  position: relative;
  z-index: 0;
  display: inline-block;
  padding: 0;
  background: transparent;
  white-space: pre;
}

.level-progress-text::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -0.8cqh;
  right: -0.29985cqw;
  bottom: -0.933333cqh;
  left: -0.89955cqw;
  background: #000;
}

.snake-score-hud {
  position: absolute;
  z-index: 1;
  top: calc(var(--safe-top) + 2.266667cqh - var(--retrocube-viewport-gutter-y, 0px));
  right: calc(var(--retrocube-horizontal-safe-inset) + 1.274363cqw - var(--retrocube-viewport-gutter-x, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2.133333cqh;
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: 1.49925cqw;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
}

.snake-score-label {
  position: relative;
  z-index: 0;
  display: block;
  padding: 0;
  background: transparent;
}

#snakeCurrentScore {
  transform: translate(1px, -1px);
}

.level-progress-leading {
  position: relative;
  display: inline-block;
}

.level-progress-slash {
  position: absolute;
  top: -0.533333cqh;
  left: 100%;
  transform: translateX(-50%);
}

.snake-control-overlay {
  --snake-cell: 13.333cqh;
  --snake-gap: 1.333cqh;
  --snake-edge: 2.667cqh;
  position: absolute;
  z-index: 3;
  right: calc(var(--retrocube-horizontal-safe-inset) - var(--retrocube-viewport-gutter-x, 0px));
  bottom: calc(var(--safe-bottom) - var(--retrocube-viewport-gutter-y, 0px));
  width: 74.667cqh;
  height: 74.667cqh;
  min-width: 0;
  min-height: 0;
  opacity: 0;
  pointer-events: auto;
  touch-action: none;
}

.snake-control-overlay[hidden] {
  display: none;
}

.snake-control-overlay.is-visible {
  animation: snake-control-fade-in 840ms linear both;
}

.duet-control-overlay {
  --duet-left-hit-width: 22.488756%;
  --duet-right-hit-start: 77.511244%;
  --duet-hit-top: 60%;
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}

.duet-control-button,
.duet-control-button:active {
  position: absolute;
  top: var(--duet-hit-top);
  bottom: 0;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  pointer-events: auto;
  touch-action: none;
  cursor: default;
  appearance: none;
  -webkit-appearance: none;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

.duet-control-left {
  left: 0;
  width: var(--duet-left-hit-width);
}

.duet-control-right {
  right: 0;
  left: var(--duet-right-hit-start);
}

.snake-control-grid {
  position: absolute;
  right: var(--snake-edge);
  bottom: var(--snake-edge);
  display: grid;
  grid-template-columns: repeat(3, var(--snake-cell));
  grid-template-rows: repeat(3, var(--snake-cell));
  gap: var(--snake-gap);
  width: calc(var(--snake-cell) * 3 + var(--snake-gap) * 2);
  height: calc(var(--snake-cell) * 3 + var(--snake-gap) * 2);
}

.snake-control-cell {
  display: block;
  width: var(--snake-cell);
  height: var(--snake-cell);
  border: max(1px, 0.533cqh) solid #808080;
  background: rgba(0, 0, 0, 0.6);
}

.snake-control-up {
  grid-column: 2;
  grid-row: 1;
}

.snake-control-right {
  grid-column: 3;
  grid-row: 2;
}

.snake-control-down {
  grid-column: 2;
  grid-row: 3;
}

.snake-control-left {
  grid-column: 1;
  grid-row: 2;
}

@keyframes snake-control-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes level-progress-fade {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* These controls all derive from StandardButton in the original game. */
.in-game-pause-button,
.boss-skip-button,
.title-icon-button,
.title-back-button,
.title-option-close,
.title-stage-button,
.title-stage-play,
.stage-info-snake,
.stage-complete-button {
  --pixel-button-bg: var(--standard-button-bg);
}

.in-game-pause-button,
.boss-skip-button {
  --hud-control-unit: clamp(1px, 0.149925cqw, 2px);
  --hud-control-inset: calc(var(--hud-control-unit) * 5);
  --hud-control-size: calc(var(--hud-control-unit) * 30);
}

.in-game-pause-button {
  --pixel-button-bg: var(--standard-button-bg);
  --in-game-pause-size: var(--hud-control-size);
  position: absolute;
  z-index: 4;
  top: calc(var(--safe-top) + var(--hud-control-inset) - var(--retrocube-viewport-gutter-y, 0px));
  left: calc(var(--retrocube-horizontal-safe-inset) + var(--hud-control-inset) - var(--retrocube-viewport-gutter-x, 0px));
  display: grid;
  place-items: center;
  width: var(--in-game-pause-size);
  min-width: 0;
  height: var(--in-game-pause-size);
  min-height: 0;
  aspect-ratio: 1;
  flex: none;
  padding: 0;
  border: var(--hud-control-unit) solid #fff;
  border-radius: 0;
  background: var(--pixel-button-bg);
}

.in-game-pause-button[hidden] {
  display: none;
}

.in-game-pause-button svg {
  display: block;
  width: 100%;
  height: 100%;
}

.boss-skip-button {
  --skip-unit: var(--hud-control-unit);
  --button-press-y: calc(var(--skip-unit) * 3);
  position: absolute;
  z-index: 5;
  top: calc(var(--safe-top) + var(--hud-control-inset) - var(--retrocube-viewport-gutter-y, 0px));
  left: calc(var(--retrocube-horizontal-safe-inset) + var(--hud-control-inset) - var(--retrocube-viewport-gutter-x, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--skip-unit) * 3);
  width: auto;
  height: var(--hud-control-size);
  min-height: 0;
  padding: 0 calc(var(--skip-unit) * 5) 0 calc(var(--skip-unit) * 7);
  border: var(--skip-unit) solid #fff;
  border-radius: 0;
  background: var(--pixel-button-bg);
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: calc(var(--skip-unit) * 15);
  line-height: 1;
}

.boss-skip-button[hidden] {
  display: none;
}

.boss-skip-button i {
  display: block;
  flex: 0 0 auto;
  width: calc(var(--skip-unit) * 17);
  height: calc(var(--skip-unit) * 17);
  background: #fff;
  clip-path: polygon(100% 50%, 25% 6.7%, 25% 93.3%);
}

.app-shell.is-title .game-timer {
  display: none;
}

.message-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 22px;
  text-align: center;
  background: rgba(3, 4, 8, 0.78);
  pointer-events: auto;
}

.title-screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  --title-control-size: clamp(26px, 4.5cqw, 60px);
  --title-control-gap: clamp(4px, 0.75cqw, 10px);
  --title-button-border: max(1px, 0.15cqw);
  /* WorldSelect.m and StageInfo.m share one point scale. */
  --stage-info-unit: clamp(1px, max(0.149925cqw, 0.266667cqh), 2.25px);
  --title-stage-button-border: var(--title-button-border);
  --title-stage-divider-width: max(2px, 0.3cqw);
  --title-stage-name-size: clamp(12px, 2.25cqw, 30px);
  --title-stage-meta-size: clamp(8px, 1.5cqw, 20px);
  --title-drawer-height: calc(var(--stage-info-unit) * 155);
  --title-stage-button-height: calc(var(--stage-info-unit) * 55);
  --title-stage-grid-gap-x: calc(var(--stage-info-unit) * 15);
  --title-stage-grid-gap-y: calc(var(--stage-info-unit) * 15);
  --title-stage-star-size: calc(var(--stage-info-unit) * 16);
  --title-button-press-y: clamp(3px, 0.8cqh, 6px);
  --stage-info-title-size: calc(var(--stage-info-unit) * 20);
  --stage-info-label-size: calc(var(--stage-info-unit) * 10);
  --stage-info-star-size: calc(var(--stage-info-unit) * 16);
  --stage-info-play-size: calc(var(--stage-info-unit) * 15);
  --stage-info-base-height: calc(var(--stage-info-unit) * 165);
  --stage-info-extra-y: max(0px, calc((var(--retrocube-vh) - var(--title-drawer-height) - var(--stage-info-base-height)) / 4));
  --stage-info-title-center-y: calc(var(--stage-info-unit) * 21 + var(--stage-info-extra-y));
  --stage-info-record-center-y: calc(var(--stage-info-title-center-y) + var(--stage-info-unit) * 25);
  /* Match the lower detail-block placement visible in the original app. */
  --stage-info-detail-offset-y: calc(var(--stage-info-unit) * 6);
  --stage-info-rule-y: calc(var(--stage-info-record-center-y) + var(--stage-info-label-size) * 0.5 + var(--stage-info-unit) * 10 + var(--stage-info-extra-y) + var(--stage-info-detail-offset-y));
  --stage-info-panel-height: calc(var(--retrocube-vh) - var(--title-drawer-height));
  --stage-info-rule-bottom-y: calc(var(--stage-info-rule-y) + var(--stage-info-unit) * 2);
  /* SpecialStageInfo.m divides the space below its rule into five equal
     padding regions: above, between the four rows, and below. Use the label
     height (rather than the larger star box) just as the original does. */
  --stage-info-rows-padding-y: max(0px, calc((var(--stage-info-panel-height) - var(--stage-info-rule-bottom-y) - var(--stage-info-label-size) * 4) / 5));
  --stage-info-first-row-center-y: calc(var(--stage-info-rule-bottom-y) + var(--stage-info-rows-padding-y) + var(--stage-info-label-size) * 0.5);
  --stage-info-row-step: calc(var(--stage-info-label-size) + var(--stage-info-rows-padding-y));
  --stage-info-play-height: calc(var(--stage-info-unit) * 40);
  --stage-info-play-center-y: calc(var(--stage-info-first-row-center-y) + var(--stage-info-row-step) * 2.5);
  --stage-info-play-top: calc(var(--stage-info-play-center-y) - var(--stage-info-play-height) * 0.5);
  /* HomeScreen.m advances the selector, Back button, and logo over 20 60 Hz ticks. */
  --title-selector-duration: 333.333ms;
  --title-horizontal-drawer-duration: 680ms;
  --title-horizontal-drawer-open-easing: cubic-bezier(0.3, 0.05, 0.45, 0.35);
  --title-horizontal-drawer-close-easing: cubic-bezier(0.55, 0.65, 0.7, 0.95);
  padding: 0;
  background: rgba(0, 0, 0, 0.12);
  pointer-events: auto;
  overflow: hidden;
}

@media (hover: hover) and (pointer: fine) {
  .title-screen {
    /* StageInfo and WorldSelect occupy one physical-viewport composition.
       Scale from browser height rather than the cropped game-frame container,
       and do not cap tall desktop layouts while the top region keeps growing. */
    --stage-info-unit: max(0.9px, 0.3vh);
    --stage-info-label-size: max(10px, calc(var(--stage-info-unit) * 10));
    --title-stage-button-border: max(1px, var(--stage-info-unit));
    --title-stage-divider-width: max(2px, calc(var(--stage-info-unit) * 2));
    --title-stage-name-size: calc(var(--stage-info-unit) * 15);
    --title-stage-meta-size: calc(var(--stage-info-unit) * 10);
  }
}

.title-screen.is-stage-info-transitioning {
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) and (min-height: 600px) {
  .title-screen {
    /* Share the pause controls' uncapped 667-point game-frame scale. */
    --title-home-unit: 0.149925cqw;
    --title-control-size: calc(var(--title-home-unit) * 30);
    --title-control-gap: calc(var(--title-home-unit) * 5);
  }
}

.title-icon-row {
  position: absolute;
  z-index: 8;
  top: calc(var(--safe-top) + var(--title-control-gap));
  right: calc(var(--retrocube-horizontal-safe-inset) + var(--title-control-gap));
  display: flex;
  gap: var(--title-control-gap);
}

.title-icon-button,
.title-back-button,
.title-stage-play {
  min-height: 0;
  border: var(--title-button-border) solid #fff;
  border-radius: 0;
  color: #fff;
  background: var(--pixel-button-bg);
  font-family: "Pixel Block Party", Munro, monospace;
  line-height: 1;
}

.title-icon-button {
  width: var(--title-control-size);
  height: var(--title-control-size);
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.title-icon {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.title-icon-leaderboard {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cdefs%3E%3CradialGradient id='glow' gradientUnits='userSpaceOnUse' cx='15' cy='15' r='54'%3E%3Cstop offset='0' stop-color='%23fff'/%3E%3Cstop offset='1' stop-color='%23fff' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Cpath fill='url(%23glow)' d='M5,10h6v15H5zM12,5h6v20h-6zM19,15h6v10h-6z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.title-icon-options {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cdefs%3E%3CradialGradient id='glow' gradientUnits='userSpaceOnUse' cx='15' cy='15' r='54'%3E%3Cstop offset='0' stop-color='%23fff'/%3E%3Cstop offset='1' stop-color='%23fff' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Cpath fill='url(%23glow)' d='M6,5h3v10H6zM5,16h5v5H5zM6,22h3v3H6zM13,5h3v3h-3zM12,9h5v5h-5zM13,15h3v10h-3zM20,5h3v10h-3zM19,16h5v5h-5zM20,22h3v3h-3z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.title-icon-credits {
  width: 100%;
  height: 100%;
  background-color: #d90000;
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.title-icon-credits::before {
  content: none;
}

.title-icon-credits::after {
  content: none;
}

.title-back-button {
  position: absolute;
  z-index: 8;
  top: calc(var(--safe-top) + var(--title-control-gap));
  left: calc(var(--retrocube-horizontal-safe-inset) + var(--title-control-gap));
  width: clamp(70px, 11.7cqw, 156px);
  height: var(--title-control-size);
  padding: 0;
  opacity: 0;
  transition: opacity var(--title-selector-duration) linear;
  text-transform: uppercase;
  font-size: clamp(13px, 2.25cqw, 30px);
  text-align: right;
  padding-right: calc(var(--title-control-size) * 0.1);
}

.title-back-button::before {
  content: "";
  position: absolute;
  left: calc(var(--title-control-size) * 0.22);
  top: 50%;
  width: 0.92em;
  height: calc(0.92em + 2px);
  background: #fff;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
  transform: translateY(-50%);
}

.title-screen.is-selecting .title-back-button {
  opacity: 1;
}

.title-hero {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.title-screen.is-selecting .title-logo {
  top: calc((100% - var(--title-drawer-height)) / 2);
  transform: translate(-50%, -50%);
}

.title-logo {
  /* Logo geometry and typography live in index.html's critical boot styles. */
  transition:
    top var(--title-selector-duration) linear,
    transform var(--title-selector-duration) linear;
}

.title-logo::before {
  content: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) and (min-height: 600px) {
  .title-icon-button,
  .title-back-button {
    --title-button-press-y: calc(var(--title-home-unit) * 3);
    border-width: var(--title-home-unit);
  }

  .title-back-button {
    width: calc(var(--title-home-unit) * 78);
    font-size: calc(var(--title-home-unit) * 15);
  }

  .title-back-button::before {
    height: calc(0.92em + var(--title-home-unit) * 2);
  }
}

.title-start-button {
  position: absolute;
  left: 50%;
  top: 60%;
  min-width: 0;
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: #f5f7fb;
  transform: translate(-50%, -50%);
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: clamp(13px, 2.25cqw, 30px);
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 2px 0 #050506;
  animation: titleBlink 1s steps(1, end) infinite;
  pointer-events: auto;
}

.title-start-button.starts-hidden {
  /* Returning from the drawer starts with the blink's 500 ms hidden half. */
  animation-delay: -500ms;
}

.title-world-select {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--title-drawer-height);
  display: grid;
  align-items: center;
  justify-items: center;
  padding: var(--title-stage-grid-gap-y) 0;
  border-top: var(--title-stage-divider-width) solid transparent;
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(105%);
  transition: transform var(--title-selector-duration) linear;
}

.title-world-select::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--title-stage-divider-width));
  left: 0;
  right: 0;
  height: var(--title-stage-divider-width);
  background: #fff;
  pointer-events: none;
}

.title-screen[data-stage-drawer-cutout="left"].is-stage-drawer-past-safe-area .title-world-select::before {
  left: var(--title-drawer-cutout-inset, 0px);
}

.title-screen[data-stage-drawer-cutout="right"].is-stage-drawer-past-safe-area .title-world-select::before {
  right: var(--title-drawer-cutout-inset, 0px);
}

.title-screen.is-selecting .title-world-select {
  transform: translateY(0);
}

.title-stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, var(--title-stage-button-height));
  gap: var(--title-stage-grid-gap-y) var(--title-stage-grid-gap-x);
  width: min(calc(var(--stage-info-unit) * 405), calc(100% - 18px));
}

.title-stage-button {
  position: relative;
  min-height: 0;
  height: var(--title-stage-button-height);
  display: block;
  border: var(--title-stage-button-border) solid #fff;
  border-radius: 0;
  padding: 0;
  text-align: center;
  background: var(--pixel-button-bg);
  box-shadow: none;
  font-family: "Pixel Block Party", Munro, monospace;
}

@media (hover: hover) and (pointer: fine) {
  .title-stage-button {
    /* Desktop browsers otherwise retain a native button bevel under the
       source-style border, which peeks through as black vertical hairlines. */
    appearance: none;
    -webkit-appearance: none;
  }
}

.title-stage-button.is-selected {
  border-color: #fff;
  background: var(--pixel-button-bg);
  box-shadow: inset 0 0 0 calc(var(--stage-info-unit) * 3) #fff;
}

.title-stage-button.is-locked.is-selected {
  /* WorldSelectButton reuses its normal border image when highlighted. */
  box-shadow: none;
}

.title-stage-button.is-locked {
  color: #fff;
}

.title-stage-name {
  position: absolute;
  z-index: 1;
  left: 5%;
  right: 5%;
  top: 34.545%;
  transform: translateY(-50%);
  font-size: var(--title-stage-name-size);
  line-height: 1.25;
  white-space: nowrap;
}

.title-stage-button.is-name-only .title-stage-name {
  top: 50%;
}

.title-stage-meta,
.title-tier-meta {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 10.909%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--title-stage-star-size);
  gap: calc(var(--title-stage-star-size) * 0.4375);
  color: #ff00ff;
  font-size: var(--title-stage-meta-size);
  line-height: 1;
}

.summary-star,
.title-star {
  display: inline-block;
  width: var(--star-size, 16px);
  height: var(--star-size, 16px);
  background: transparent;
  flex: 0 0 auto;
  vertical-align: middle;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.pause-goal-row .summary-star {
  --star-size: 4.444444cqw;
}

.pause-goals.is-standard-stage .pause-goal-row .summary-star {
  position: relative;
  top: -0.555556cqw;
}

.stage-info-row .summary-star {
  --star-size: var(--stage-info-star-size);
}

.title-stage-meta .title-star,
.title-tier-meta .title-star {
  --star-size: var(--title-stage-star-size);
}

.title-tier-meta.has-four-stars {
  gap: calc(var(--title-stage-star-size) * 0.125);
}

.title-tier-meta.has-four-stars > span {
  margin-inline: calc(var(--title-stage-star-size) * 0.3125);
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) and (min-height: 600px) {
  .title-tier-meta > span {
    transform: translateY(calc(-1 * var(--stage-info-unit)));
  }
}

.title-stage-lock {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: auto;
  height: auto;
  border: 0;
  opacity: 1;
  background: transparent;
  pointer-events: none;
  --lock-border: max(1px, 0.15cqw);
  --lock-center-size: calc(var(--title-stage-button-height) * 0.32727);
  --lock-center-border: max(1px, calc(var(--lock-center-size) * 0.09));
  /* WorldSelectButton.m overlaps each belt side by its 1 px stroke, then paints the center border above it. */
  --lock-belt-side-width: calc(50% - (var(--lock-center-size) * 0.5) + var(--lock-border));
  --lock-keyhole-top-size: calc(var(--title-stage-button-height) * 0.10909);
  --lock-keyhole-stem-width: calc(var(--title-stage-button-height) * 0.03636);
  --lock-keyhole-stem-height: calc(var(--title-stage-button-height) * 0.07273);
  --lock-side-height: 18.182%;
  --lock-side-top: 64.545%;
  --lock-center-top: 55.455%;
}

.title-stage-lock::before,
.title-stage-lock::after {
  content: "";
  position: absolute;
}

.title-stage-lock::before {
  left: 0;
  right: 0;
  top: var(--lock-side-top);
  height: var(--lock-side-height);
  background:
    linear-gradient(#fff 0 0) left top / var(--lock-belt-side-width) var(--lock-border) no-repeat,
    linear-gradient(#fff 0 0) left bottom / var(--lock-belt-side-width) var(--lock-border) no-repeat,
    linear-gradient(rgba(0, 0, 0, 0.6) 0 0) left top / var(--lock-belt-side-width) 100% no-repeat,
    linear-gradient(#fff 0 0) right top / var(--lock-belt-side-width) var(--lock-border) no-repeat,
    linear-gradient(#fff 0 0) right bottom / var(--lock-belt-side-width) var(--lock-border) no-repeat,
    linear-gradient(rgba(0, 0, 0, 0.6) 0 0) right top / var(--lock-belt-side-width) 100% no-repeat;
}

.title-stage-lock::after {
  left: 50%;
  top: var(--lock-center-top);
  width: var(--lock-center-size);
  height: var(--lock-center-size);
  border: var(--lock-center-border) solid #fff;
  background:
    linear-gradient(#fff 0 0) center 34% / var(--lock-keyhole-top-size) var(--lock-keyhole-top-size) no-repeat,
    linear-gradient(#fff 0 0) center 72% / var(--lock-keyhole-stem-width) var(--lock-keyhole-stem-height) no-repeat,
    rgba(0, 0, 0, 0.6);
  transform: translateX(-50%);
}

.desktop-notice {
  --desktop-notice-scale: clamp(16px, min(2.5vw, 3.6dvh), 30px);
  width: fit-content;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: min(0.9em, 4dvh) 1.1em;
  border: 2px solid #fff;
  border-radius: 0;
  background: #000;
  color: #fff;
  font-size: var(--desktop-notice-scale);
  text-align: center;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.4);
}

.desktop-notice[open] {
  display: grid;
  justify-items: center;
  gap: min(0.9em, 4dvh);
}

.desktop-notice::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

.desktop-notice-icon {
  width: min(2.85em, 18dvh);
  height: auto;
  border-radius: 22.5%;
}

.desktop-notice-message {
  max-width: 14.5em;
  margin: 0;
  font-family: Munro, monospace;
  font-size: inherit;
  line-height: 1.3;
  text-wrap: balance;
}

.desktop-notice-continue {
  min-width: max(128px, calc(var(--desktop-notice-scale) * 6.4));
  min-height: max(40px, calc(var(--desktop-notice-scale) * 1.8));
  padding: calc(var(--desktop-notice-scale) * 0.45) calc(var(--desktop-notice-scale) * 0.8);
  border: 2px solid #fff;
  border-radius: 0;
  background: var(--standard-button-bg);
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: max(12px, calc(var(--desktop-notice-scale) * 0.58));
  line-height: 1;
}

.desktop-notice-continue:focus-visible {
  outline: 2px solid #f24444;
  outline-offset: 5px;
}

.desktop-notice-continue:active:not(.is-release-cancelled),
.desktop-notice-continue.is-pressed {
  border-color: #fff;
  background: var(--standard-button-bg);
  box-shadow: inset 0 0 0 2px #fff;
  transform: translateY(2px);
}

.title-modal {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.8);
  pointer-events: auto;
}

.title-modal.is-open {
  animation: titleModalFadeIn 160ms linear both;
}

.title-options-menu {
  --title-options-animation-duration: 383.333ms;
  --title-options-backdrop-opacity: 0.69;
  background: rgba(0, 0, 0, 0);
}

.title-options-menu.is-open {
  animation: titleOptionsFadeIn var(--title-options-animation-duration) linear both;
}

.title-options-menu.is-closing {
  animation: titleOptionsFadeOut var(--title-options-animation-duration) linear both;
}

.title-options-panel {
  --title-player-block-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15'%3E%3Cdefs%3E%3CradialGradient id='glow' cx='50%25' cy='50%25' r='180%25'%3E%3Cstop offset='0' stop-color='red'/%3E%3Cstop offset='1' stop-color='red' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect width='15' height='15' fill='black'/%3E%3Crect x='1' y='1' width='13' height='13' fill='url(%23glow)'/%3E%3C/svg%3E");
  --title-options-width: min(max(280px, 42cqw), calc(100cqw - 24px));
  --title-options-height: min(max(175px, 46.667cqh), calc(100cqh - 22px));
  position: relative;
  width: 0;
  height: 0;
  padding: 0;
  border: var(--title-button-border) solid #fff;
  background: #000;
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  overflow: hidden;
  will-change: width, height;
}

.title-options-content {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--title-options-width);
  height: var(--title-options-height);
  background: #000;
  transform: translate(-50%, -50%);
}

.title-options-menu.is-open .title-options-panel {
  animation: titleOptionsPanelExpand var(--title-options-animation-duration) cubic-bezier(0.42, 0, 1, 1) both;
}

.title-options-menu.is-closing .title-options-panel {
  animation: titleOptionsPanelRetract var(--title-options-animation-duration) cubic-bezier(0.42, 0, 1, 1) both;
}

.title-options-title {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 24%;
  display: grid;
  place-items: center;
  font-family: "Munro Small", Munro, monospace;
  font-size: clamp(30px, 10.667cqh, 80px);
  line-height: 1;
  text-align: center;
}

.title-option-row {
  position: absolute;
  left: 5.3571%;
  width: 89.2857%;
  height: 17.1429%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 0;
}

.title-option-row-music {
  top: 22.8571%;
}

.title-option-row-sfx {
  top: 37.1429%;
}

.title-option-row-timer {
  top: 51.4286%;
}

.title-option-label {
  min-width: 0;
  font-size: clamp(9px, 2.667cqh, 20px);
  line-height: 1;
  white-space: nowrap;
}

.title-option-slider {
  --title-option-track-size: clamp(4px, 1.333cqh, 10px);
  --title-option-thumb-size: clamp(15px, 4cqh, 30px);
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  align-items: center;
}

.title-option-track {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: 0;
  left: 0;
  height: var(--title-option-track-size);
  overflow: hidden;
  background: #fff;
  pointer-events: none;
  transform: translateY(-50%);
}

.title-option-track::before {
  position: absolute;
  inset: -1px auto -1px 0;
  width: var(--title-option-value, 100%);
  content: "";
  background: #f00;
}

.title-option-range {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.title-option-range::-webkit-slider-runnable-track {
  height: var(--title-option-track-size);
  background: transparent;
}

.title-option-range::-moz-range-track {
  height: var(--title-option-track-size);
  background: transparent;
}

.title-option-range::-moz-range-progress {
  height: var(--title-option-track-size);
  background: transparent;
}

.title-option-range::-webkit-slider-thumb {
  width: var(--title-option-thumb-size);
  height: var(--title-option-thumb-size);
  margin-top: calc((var(--title-option-track-size) - var(--title-option-thumb-size)) / 2);
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  background: var(--title-player-block-image) center / 100% 100% no-repeat;
}

.title-option-range::-moz-range-thumb {
  width: var(--title-option-thumb-size);
  height: var(--title-option-thumb-size);
  border: 0;
  border-radius: 0;
  background: var(--title-player-block-image) center / 100% 100% no-repeat;
}

.title-option-toggle {
  justify-self: start;
  width: 28%;
  min-height: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(#f00 0 0) left center / 0 16.6667% no-repeat,
    linear-gradient(#fff 0 0) left center / 100% 16.6667% no-repeat;
}

.title-option-toggle span {
  position: absolute;
  top: 50%;
  left: 0;
  width: clamp(15px, 4cqh, 30px);
  height: clamp(15px, 4cqh, 30px);
  background: var(--title-player-block-image) center / 100% 100% no-repeat;
  transform: translate(0, -50%);
}

.title-option-toggle.is-on {
  background:
    linear-gradient(#f00 0 0) left center / 100% 16.6667% no-repeat,
    linear-gradient(#fff 0 0) left center / 100% 16.6667% no-repeat;
}

.title-option-toggle.is-on span {
  left: 100%;
  transform: translate(-100%, -50%);
}

.title-option-toggle:active {
  border-color: transparent;
  background:
    linear-gradient(#f00 0 0) left center / 0 16.6667% no-repeat,
    linear-gradient(#fff 0 0) left center / 100% 16.6667% no-repeat;
  box-shadow: none;
}

.title-option-toggle.is-on:active {
  background:
    linear-gradient(#f00 0 0) left center / 100% 16.6667% no-repeat,
    linear-gradient(#fff 0 0) left center / 100% 16.6667% no-repeat;
}

.title-option-toggle:focus {
  outline: none;
}

.title-option-toggle:focus-visible {
  outline: var(--title-button-border) solid #fff;
  outline-offset: max(2px, 0.3cqw);
}

.title-option-close {
  position: absolute;
  left: 3.5714%;
  bottom: 6.2857%;
  width: 92.8571%;
  height: 22.8571%;
  min-height: 0;
  border: var(--title-button-border) solid #fff;
  border-radius: 0;
  background: var(--pixel-button-bg);
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: clamp(12px, 4cqh, 30px);
  line-height: 1;
}

.title-option-close:active:not(.is-release-cancelled) {
  border-color: #fff;
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) and (min-height: 600px) {
  /* OptionsMenu.m uses 40/10/15 pt text and CustomSlider.m uses a 15 pt
     knob over a 5 pt track. Preserve that scale with the shorter panel. */
  .title-options-title {
    font-size: 10.666667cqh;
  }

  .title-option-label {
    font-size: 2.666667cqh;
  }

  .title-option-slider {
    --title-option-track-size: 1.333333cqh;
    --title-option-thumb-size: 4cqh;
  }

  .title-option-toggle span {
    width: 4cqh;
    height: 4cqh;
  }

  .title-option-close {
    font-size: 4cqh;
  }
}

.title-credits-menu,
.title-stats-menu {
  place-items: stretch;
  background: transparent;
}

.title-credits-menu.is-open,
.title-credits-menu.is-closing,
.title-stats-menu.is-open,
.title-stats-menu.is-closing {
  animation: none;
}

.title-credits-menu::before,
.title-credits-menu::after,
.title-stats-menu::before,
.title-stats-menu::after {
  content: "";
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.title-credits-menu::before,
.title-stats-menu::before {
  left: calc(50% - 1px);
}

.title-credits-menu::after,
.title-stats-menu::after {
  right: calc(50% - 1px);
}

.title-credits-panel,
.title-stats-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  clip-path: inset(0 calc(50% - 1px) 0 calc(50% - 1px));
}

.title-credits-menu.is-open .title-credits-panel,
.title-stats-menu.is-open .title-stats-panel {
  animation: titleCreditsDrawerReveal var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-open-easing) both;
}

.title-credits-menu.is-open::before,
.title-stats-menu.is-open::before {
  animation:
    titleCreditsLeftEdge var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-open-easing) both,
    titlePanelEdgeFinalize var(--title-horizontal-drawer-duration) step-end both;
}

.title-credits-menu.is-open::after,
.title-stats-menu.is-open::after {
  animation:
    titleCreditsRightEdge var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-open-easing) both,
    titlePanelEdgeFinalize var(--title-horizontal-drawer-duration) step-end both;
}

.title-credits-menu.is-closing .title-credits-panel,
.title-stats-menu.is-closing .title-stats-panel {
  animation: titleCreditsDrawerRetract var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-close-easing) both;
  pointer-events: none;
}

.title-credits-menu.is-closing::before,
.title-stats-menu.is-closing::before {
  opacity: 1;
  animation: titleCreditsLeftEdgeRetract var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-close-easing) both;
}

.title-credits-menu.is-closing::after,
.title-stats-menu.is-closing::after {
  opacity: 1;
  animation: titleCreditsRightEdgeRetract var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-close-easing) both;
}

.title-modal-back-button {
  opacity: 1;
  transform: none;
}

.title-stats-scroll {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding:
    calc(var(--safe-top) + var(--title-control-size) + var(--title-control-gap) * 1.75)
    calc(var(--retrocube-horizontal-safe-inset) + clamp(14px, 3cqw, 40px))
    calc(var(--safe-bottom) + clamp(22px, 5cqh, 40px));
  text-align: center;
}

.title-stats-scroll::-webkit-scrollbar {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .title-stats-scroll {
    /* This full-screen drawer already sits inside the mobile safe viewport.
       Keep only a small content tail so the final card can settle lower. */
    padding-bottom: clamp(14px, 3cqh, 24px);
  }

  .title-stats-summary-card {
    --title-stats-summary-content-shift-y: clamp(1px, 0.3cqh, 2px);
  }
}

.title-stats-header {
  display: grid;
  justify-items: center;
  gap: clamp(2px, 0.6cqh, 5px);
}

.title-stats-title,
.title-stats-mode-card h4 {
  margin: 0;
  font-family: "Pixel Block Party", Munro, monospace;
}

.title-stats-title {
  color: #fff;
  font-size: clamp(34px, 8cqh, 60px);
  line-height: 0.9;
}

.title-stats-summary {
  width: min(1060px, 100%);
  margin: clamp(14px, 3.2cqh, 24px) auto 0;
  display: grid;
  grid-template-columns:
    minmax(0, 0.9fr)
    minmax(0, 0.9fr)
    minmax(0, 1.25fr)
    minmax(0, 1fr);
  gap: clamp(6px, 1.2cqw, 14px);
}

.title-stats-summary-card {
  min-width: 0;
  min-height: clamp(64px, 14cqh, 104px);
  display: grid;
  align-content: center;
  justify-items: center;
  padding: clamp(8px, 1.8cqh, 14px) clamp(5px, 1cqw, 12px);
  border: var(--title-button-border) solid #fff;
  background: var(--standard-button-bg);
  box-shadow: inset 0 calc(-1 * clamp(3px, 0.7cqh, 5px)) 0 rgba(0, 0, 0, 0.28);
}

.title-stats-summary-card strong,
.title-stats-summary-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-stats-summary-card strong {
  color: #fff;
  font-size: clamp(20px, 4.8cqh, 36px);
  line-height: 1;
  transform: translate(
    calc(var(--title-stats-value-optical-shift, 0px) + var(--title-stats-value-layout-shift-x, 0px)),
    var(--title-stats-summary-content-shift-y, 0px)
  );
}

.title-stats-summary-card.is-time strong {
  font-size: clamp(20px, min(4.8cqh, 3cqw), 36px);
}

.title-stats-summary-card span {
  margin-top: clamp(4px, 0.8cqh, 7px);
  color: #aaa;
  font-family: "Munro Small", Munro, monospace;
  font-size: clamp(9px, 1.8cqh, 14px);
  line-height: 1;
  transform: translateY(var(--title-stats-summary-content-shift-y, 0px));
}

.title-stats-summary-card.is-yellow strong {
  color: #ffff00;
}

@media (hover: hover) and (pointer: fine) {
  .title-stats-summary-card {
    --title-stats-summary-content-shift-y: clamp(3px, 0.55cqh, 5px);
  }

  .title-stats-summary-card.is-yellow {
    --title-stats-value-layout-shift-x: clamp(-6px, -0.4cqw, -4px);
  }
}

.title-stats-star-value {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 0.65cqw, 8px);
}

.title-stats-star {
  width: clamp(12px, 2.6cqh, 19px);
  height: clamp(12px, 2.6cqh, 19px);
  flex: 0 0 auto;
  image-rendering: pixelated;
}

.title-stats-star.is-summary {
  width: clamp(24px, 5.3cqh, 39px);
  height: clamp(24px, 5.3cqh, 39px);
  transform: translateY(clamp(2px, 0.45cqh, 3px));
}

.title-stats-star.is-table {
  width: clamp(15px, 3.2cqh, 23px);
  height: clamp(15px, 3.2cqh, 23px);
  transform: translateY(clamp(1px, 0.25cqh, 2px));
}

.title-stats-star.is-fact {
  transform: translateY(clamp(1px, 0.25cqh, 2px));
}

.title-stats-section {
  width: min(1060px, 100%);
  margin: clamp(20px, 4.5cqh, 34px) auto 0;
}

.title-stats-stage-table {
  border-top: var(--title-button-border) solid #fff;
  border-right: var(--title-button-border) solid #fff;
  border-bottom: var(--title-button-border) solid #fff;
  border-left: var(--title-button-border) solid #fff;
}

.title-stats-stage-row {
  min-height: clamp(34px, 7cqh, 52px);
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  align-items: center;
  border-top: max(1px, 0.08cqw) solid #4b4b4b;
  font-size: clamp(12px, 2.8cqh, 21px);
  line-height: 1;
}

.title-stats-stage-row:first-child {
  border-top: 0;
}

.title-stats-stage-row > span {
  min-width: 0;
  padding: 0 clamp(5px, 1.2cqw, 14px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-stats-stage-row > span + span {
  border-left: max(1px, 0.08cqw) solid #4b4b4b;
}

.title-stats-stage-row > span:nth-child(2) {
  color: #00ffff;
}

.title-stats-stage-row > span:nth-child(3) {
  color: #ffff00;
}

.title-stats-stage-row.is-heading {
  min-height: clamp(24px, 4.5cqh, 34px);
  background: #222;
  color: #999;
  font-family: "Munro Small", Munro, monospace;
  font-size: clamp(9px, 1.8cqh, 14px);
}

.title-stats-stage-row.is-heading > span:nth-child(2),
.title-stats-stage-row.is-heading > span:nth-child(3) {
  color: #999;
}

.title-stats-stage-row.is-locked {
  background: rgba(255, 255, 255, 0.025);
}

.title-stats-stage-lock-notice {
  grid-column: 2 / -1;
  align-self: stretch;
  border-left: max(1px, 0.08cqw) solid #4b4b4b;
}

.title-stats-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.5cqw, 18px);
}

.title-stats-mode-card {
  min-width: 0;
  padding: clamp(10px, 2.2cqh, 16px);
  border: var(--title-button-border) solid #fff;
  background: var(--standard-button-bg);
}

.title-stats-mode-card h4 {
  color: #ff00ff;
  font-size: clamp(18px, 4cqh, 30px);
  line-height: 1;
}

.title-stats-mode-card.is-hardcore h4 {
  color: #ff3c24;
}

.title-stats-lock-notice {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 1cqw, 12px);
  padding: clamp(6px, 1.2cqh, 10px);
  color: #aaa;
  font-family: "Munro Small", Munro, monospace;
  font-size: clamp(9px, 1.9cqh, 14px);
  line-height: 1;
  text-align: center;
}

.title-stats-lock-notice > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-stats-lock-icon {
  --title-stats-lock-size: clamp(13px, 2.7cqh, 20px);
  --title-stats-lock-border: max(1px, 0.18cqh);
  position: relative;
  width: var(--title-stats-lock-size);
  height: var(--title-stats-lock-size);
  flex: 0 0 auto;
  margin-top: clamp(3px, 0.7cqh, 5px);
  border: var(--title-stats-lock-border) solid #aaa;
  background:
    linear-gradient(#aaa 0 0) center 34% / 33.333% 33.333% no-repeat,
    linear-gradient(#aaa 0 0) center 72% / 11.111% 22.222% no-repeat,
    #222;
}

.title-stats-lock-icon::before {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 55%;
  height: 50%;
  content: "";
  border: var(--title-stats-lock-border) solid #aaa;
  border-bottom: 0;
  transform: translateX(-50%);
}

.title-stats-lock-icon::after {
  content: none;
}

.title-stats-mode-lock-notice {
  min-height: clamp(116px, 24cqh, 180px);
  margin-top: clamp(9px, 1.8cqh, 14px);
  border: max(1px, 0.08cqw) solid #555;
}

.title-stats-mode-facts {
  margin-top: clamp(9px, 1.8cqh, 14px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(5px, 0.8cqw, 9px);
}

.title-stats-mode-card.is-speedrun .title-stats-mode-facts > .is-tier strong {
  color: #ff00ff;
}

.title-stats-mode-card.is-hardcore .title-stats-mode-facts > .is-tier strong {
  color: #ff3c24;
}

.title-stats-mode-facts > div {
  min-width: 0;
  padding: clamp(5px, 1cqh, 8px) 3px;
  border: max(1px, 0.08cqw) solid #555;
}

.title-stats-mode-facts span,
.title-stats-mode-facts strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateY(clamp(-2px, -0.3cqh, -1px));
}

.title-stats-mode-facts span {
  color: #999;
  font-family: "Munro Small", Munro, monospace;
  font-size: clamp(8px, 1.5cqh, 11px);
}

.title-stats-mode-facts strong {
  margin-top: 4px;
  color: #fff;
  font-size: clamp(10px, 2.2cqh, 16px);
  line-height: 1;
}

.title-stats-split-title {
  margin-top: clamp(12px, 2.3cqh, 18px);
  padding-bottom: clamp(5px, 0.9cqh, 7px);
  border-bottom: max(1px, 0.08cqw) solid #777;
  color: #aaa;
  font-family: "Munro Small", Munro, monospace;
  font-size: clamp(9px, 1.8cqh, 13px);
  text-align: left;
}

.title-stats-splits > div {
  min-height: clamp(27px, 5.4cqh, 40px);
  display: grid;
  grid-template-columns: minmax(56px, 0.72fr) repeat(2, minmax(0, 1.14fr));
  align-items: center;
  gap: clamp(4px, 0.7cqw, 9px);
  border-bottom: max(1px, 0.08cqw) solid #444;
  font-size: clamp(10px, 2.2cqh, 16px);
}

.title-stats-splits span,
.title-stats-splits strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-stats-splits > div:not(.is-heading) span {
  color: #aaa;
  text-align: left;
}

.title-stats-splits strong {
  color: #00ffff;
  font-weight: normal;
  text-align: right;
}

.title-stats-splits strong:nth-child(2) {
  color: #ffff00;
}

.title-stats-splits > .is-heading {
  min-height: clamp(22px, 4.2cqh, 31px);
  color: #888;
  font-family: "Munro Small", Munro, monospace;
  font-size: clamp(8px, 1.5cqh, 11px);
}

.title-stats-splits > .is-heading span:first-child {
  text-align: left;
}

.title-stats-splits > .is-heading span:not(:first-child) {
  text-align: right;
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) and (min-height: 600px) {
  /* Keep the existing stats composition proportional to the game frame.
     Remove desktop caps from the cards and their contents together. */
  .title-stats-scroll {
    padding:
      calc(var(--safe-top) + var(--title-control-size) + var(--title-control-gap) * 1.75)
      calc(var(--retrocube-horizontal-safe-inset) + 3cqw)
      calc(var(--safe-bottom) + 5cqh);
  }

  .title-stats-header { gap: 0.6cqh; }
  .title-stats-title { font-size: 8cqh; }

  .title-stats-summary {
    width: 100%;
    margin-top: 3.2cqh;
    gap: 1.2cqw;
  }

  .title-stats-summary-card {
    --title-stats-summary-content-shift-y: 0.55cqh;
    min-height: 14cqh;
    padding: 1.8cqh 1cqw;
    box-shadow: inset 0 -0.7cqh 0 rgba(0, 0, 0, 0.28);
  }

  .title-stats-summary-card strong { font-size: 4.8cqh; }
  .title-stats-summary-card.is-time strong { font-size: min(4.8cqh, 3cqw); }
  .title-stats-summary-card span { margin-top: 0.8cqh; font-size: 1.8cqh; }
  .title-stats-summary-card.is-yellow { --title-stats-value-layout-shift-x: -0.4cqw; }
  .title-stats-star-value { gap: 0.65cqw; }
  .title-stats-star { width: 2.6cqh; height: 2.6cqh; }

  .title-stats-star.is-summary {
    width: 5.3cqh;
    height: 5.3cqh;
    transform: translateY(0.45cqh);
  }

  .title-stats-star.is-table {
    width: 3.2cqh;
    height: 3.2cqh;
    transform: translateY(0.25cqh);
  }

  .title-stats-star.is-fact { transform: translateY(0.25cqh); }
  .title-stats-section { width: 100%; margin-top: 4.5cqh; }
  .title-stats-stage-row { min-height: 7cqh; font-size: 2.8cqh; }
  .title-stats-stage-row > span { padding: 0 1.2cqw; }
  .title-stats-stage-row.is-heading { min-height: 4.5cqh; font-size: 1.8cqh; }
  .title-stats-mode-grid { gap: 1.5cqw; }
  .title-stats-mode-card { padding: 2.2cqh; }
  .title-stats-mode-card h4 { font-size: 4cqh; }
  .title-stats-lock-notice { gap: 1cqw; padding: 1.2cqh; font-size: 1.9cqh; }

  .title-stats-lock-icon {
    --title-stats-lock-size: 2.7cqh;
    margin-top: 0.7cqh;
  }

  .title-stats-mode-lock-notice { min-height: 24cqh; margin-top: 1.8cqh; }
  .title-stats-mode-facts { margin-top: 1.8cqh; gap: 0.8cqw; }
  .title-stats-mode-facts > div { padding: 1cqh calc(var(--title-home-unit) * 1.5); }

  .title-stats-mode-facts span,
  .title-stats-mode-facts strong { transform: translateY(-0.3cqh); }

  .title-stats-mode-facts span { font-size: 1.5cqh; }
  .title-stats-mode-facts strong { margin-top: calc(var(--title-home-unit) * 2); font-size: 2.2cqh; }
  .title-stats-split-title { margin-top: 2.3cqh; padding-bottom: 0.9cqh; font-size: 1.8cqh; }

  .title-stats-splits > div {
    min-height: 5.4cqh;
    grid-template-columns: minmax(calc(var(--title-home-unit) * 28), 0.72fr) repeat(2, minmax(0, 1.14fr));
    gap: 0.7cqw;
    font-size: 2.2cqh;
  }

  .title-stats-splits > .is-heading { min-height: 4.2cqh; font-size: 1.5cqh; }
}

.title-credits-scroll {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior-y: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 max(16px, 6cqw) clamp(26px, 7cqh, 52px);
  text-align: center;
}

.title-credits-scroll::-webkit-scrollbar {
  display: none;
}

.title-credits-scroll:focus {
  outline: none;
}

.title-credits-logo {
  position: absolute;
  top: calc((100% - var(--title-drawer-height)) / 2);
  left: calc(50% + 0.45cqw);
  display: flex;
  flex: 0 0 auto;
  margin: 0;
  font-size: clamp(34px, 9cqw, 120px);
  line-height: 0.88;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.title-credit-version,
.title-credit-small,
.title-credit-name,
.title-credit-heading,
.title-credit-line,
.title-credit-pair,
.title-credit-tap {
  line-height: 1.15;
}

.title-credit-version {
  position: absolute;
  top: calc((100% - var(--title-drawer-height)) / 2 + clamp(60px, 8.8cqw, 110px));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 1.85em;
  margin: 0;
  font-size: clamp(13px, 3cqw, 29px);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.title-credit-developer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100cqh;
  margin: 0;
  pointer-events: none;
}

.title-credit-developer .title-credit-small,
.title-credit-developer .title-credit-name {
  position: absolute;
  left: 50%;
  margin: 0;
  white-space: nowrap;
}

.title-credit-developer .title-credit-small {
  top: calc(70cqh - clamp(6px, 1.8cqh, 14px));
  transform: translate(-50%, -100%);
}

.title-credit-developer .title-credit-name {
  top: 70cqh;
  transform: translateX(-50%);
}

.title-credit-small,
.title-credit-line,
.title-credit-pair,
.title-credit-tap {
  font-size: clamp(10px, 2.25cqw, 18px);
}

.title-credit-name,
.title-credit-heading {
  font-size: clamp(15px, 3.75cqw, 34px);
}

.title-credit-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-credit-section-fonts {
  margin-top: 100cqh;
}

.title-credit-section-apps {
  /* Keep this below the developer credit while letting it enter sooner. */
  margin-top: calc(80cqh + clamp(72px, 11.35cqw, 150px));
}

.title-credit-heading + .title-credit-line,
.title-credit-heading + .title-credit-pair {
  margin-top: clamp(10px, 1.5cqw, 20px);
}

.title-credit-section-apps .title-credit-pair + .title-credit-pair {
  margin-top: clamp(13px, 2.1cqw, 28px);
}

.title-credit-section-fonts .title-credit-pair > :last-child {
  font-family: Munro, monospace;
  font-size: 1.45em;
}

.title-credit-pair {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: max-content auto max-content;
  align-items: center;
  justify-items: center;
  justify-content: center;
  gap: clamp(14px, 4cqw, 28px);
  white-space: nowrap;
}

.title-credit-app-icons {
  display: inline-flex;
  gap: clamp(4px, 1.2cqw, 8px);
}

.title-credit-app-icons a {
  display: block;
  cursor: pointer;
}

.title-credit-app-icons a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.title-credit-app-icons img {
  width: clamp(24px, 5.4cqw, 38px);
  height: clamp(24px, 5.4cqw, 38px);
  display: block;
  border: var(--title-button-border) solid #fff;
  image-rendering: auto;
}

.title-credit-tap {
  position: absolute;
  z-index: 1;
  top: 90cqh;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) and (min-height: 600px) {
  .title-credit-small,
  .title-credit-line,
  .title-credit-pair,
  .title-credit-tap {
    font-size: calc(var(--title-home-unit) * 15);
  }

  .title-credit-name,
  .title-credit-heading {
    font-size: calc(var(--title-home-unit) * 25);
  }

  .title-credit-developer .title-credit-small {
    top: calc(70cqh - 1.8cqh);
  }

  .title-credit-section-apps {
    margin-top: calc(80cqh + var(--title-home-unit) * 90);
  }

  .title-credit-heading + .title-credit-line,
  .title-credit-heading + .title-credit-pair {
    margin-top: calc(var(--title-home-unit) * 15);
  }

  .title-credit-section-apps .title-credit-pair + .title-credit-pair {
    margin-top: calc(var(--title-home-unit) * 28);
  }

  .title-credit-pair {
    width: 100%;
    gap: calc(var(--title-home-unit) * 16);
  }

  .title-credit-app-icons {
    gap: calc(var(--title-home-unit) * 8);
  }

  .title-credit-app-icons img {
    width: calc(var(--title-home-unit) * 30);
    height: calc(var(--title-home-unit) * 30);
  }

  .title-start-button {
    font-size: calc(var(--title-home-unit) * 15);
    text-shadow: 0 calc(var(--title-home-unit) * 2) 0 #050506;
  }

  .title-credits-logo {
    font-size: calc(var(--title-home-unit) * 60);
  }

  .title-credit-version {
    top: calc((100% - var(--title-drawer-height)) / 2 + 8.8cqw);
    font-size: calc(var(--title-home-unit) * 20);
  }

  .title-credit-tap {
    font-size: calc(var(--title-home-unit) * 10);
  }

  .title-credits-scroll {
    padding-bottom: 7cqh;
  }
}

.title-credits-effects {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: auto;
}

.title-stage-info {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--title-drawer-height);
  width: auto;
  overflow: hidden;
  clip-path: inset(0 calc(50% - 1px) 0 calc(50% - 1px));
  opacity: 1;
  transition: clip-path var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-close-easing);
  background: rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.title-stage-info::before,
.title-stage-info::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  opacity: 1;
  pointer-events: none;
}

.title-stage-info::before {
  left: calc(50% - 1px);
  transition: left var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-close-easing);
}

.title-stage-info::after {
  right: calc(50% - 1px);
  transition: right var(--title-horizontal-drawer-duration) var(--title-horizontal-drawer-close-easing);
}

.title-stage-info.is-open {
  clip-path: inset(0 0 0 0);
  transition-timing-function: var(--title-horizontal-drawer-open-easing);
  pointer-events: auto;
}

.title-stage-info.is-open::before {
  left: 0;
  transition-timing-function: var(--title-horizontal-drawer-open-easing);
}

.title-stage-info.is-open::after {
  right: 0;
  transition-timing-function: var(--title-horizontal-drawer-open-easing);
}

.title-screen:not(.is-stage-info-transitioning) .title-stage-info.is-open::before,
.title-screen:not(.is-stage-info-transitioning) .title-stage-info.is-open::after {
  /* StageInfo.finalizeExpand removes both side views. Keying this directly to
     the completed drawer state prevents a resize from reviving either seam. */
  animation: none;
  opacity: 0;
}

.stage-info-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  transform: none;
  display: block;
  padding: 0;
  font-family: "Pixel Block Party", Munro, monospace;
}

.stage-info-title {
  position: absolute;
  left: calc(50% + var(--stage-info-unit));
  top: var(--stage-info-title-center-y);
  transform: translate(-50%, -50%);
  font-size: var(--stage-info-title-size);
  color: #fff;
  line-height: 1;
  white-space: nowrap;
}

.stage-info-record {
  position: absolute;
  left: 50%;
  top: var(--stage-info-record-center-y);
  transform: translate(-50%, -50%);
  color: #ff00ff;
  font-size: var(--stage-info-label-size);
  line-height: 1;
  white-space: nowrap;
}

.stage-info-record.has-star-record {
  display: flex;
  align-items: center;
  gap: calc(var(--stage-info-unit) * 4);
}

.stage-info-record .summary-star {
  --star-size: var(--stage-info-star-size);
}

.stage-info-rule {
  position: absolute;
  left: 50%;
  top: var(--stage-info-rule-y);
  width: min(calc(100cqw - var(--stage-info-unit) * 40), calc(var(--stage-info-unit) * 440));
  height: calc(var(--stage-info-unit) * 2);
  transform: translateX(-50%);
  background: #fff;
}

.stage-info-rows {
  position: absolute;
  left: calc(50% - var(--stage-info-unit) * 198);
  top: calc(var(--stage-info-first-row-center-y) - var(--stage-info-star-size) * 0.5);
  display: grid;
  align-content: start;
  row-gap: max(0px, calc(var(--stage-info-row-step) - var(--stage-info-star-size)));
  min-width: 0;
  width: max-content;
}

.stage-info-content.is-special-mode .stage-info-rows {
  left: calc(50% - var(--stage-info-unit) * 190);
}

.stage-info-row {
  display: grid;
  grid-template-columns: var(--stage-info-star-size) max-content;
  align-items: center;
  gap: calc(var(--stage-info-unit) * 9);
  min-height: var(--stage-info-star-size);
}

.stage-info-row.is-tier-requirement {
  grid-template-columns: calc(var(--stage-info-unit) * 55) max-content max-content;
  gap: 0;
}

.stage-info-tier,
.stage-info-time,
.stage-info-star-requirement,
.stage-info-row-text {
  color: #ff00ff;
  font-size: var(--stage-info-label-size);
  line-height: 1;
  white-space: nowrap;
}

.stage-info-star-requirement {
  display: grid;
  grid-template-columns: max-content var(--stage-info-star-size) max-content;
  align-items: center;
  column-gap: calc(var(--stage-info-unit) * 4);
  margin-left: calc(var(--stage-info-unit) * 12);
}

.title-stage-play {
  position: absolute;
  left: calc(50% + var(--stage-info-unit) * 70);
  top: var(--stage-info-play-top);
  width: calc(var(--stage-info-unit) * 120);
  height: var(--stage-info-play-height);
  padding: 0;
  font-size: var(--stage-info-play-size);
}

.stage-info-snake {
  position: absolute;
  top: calc(var(--safe-top) + var(--title-control-gap));
  right: calc(var(--retrocube-horizontal-safe-inset) + var(--title-control-size) * 3 + var(--title-control-gap) * 4);
  width: var(--title-control-size);
  height: var(--title-control-size);
  min-height: 0;
  padding: 0;
  border: var(--title-button-border) solid #fff;
  background: var(--pixel-button-bg);
  overflow: hidden;
}

.stage-info-snake::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("public/assets/snake-button.svg") center / 100% 100% no-repeat;
  image-rendering: pixelated;
}

.stage-complete-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 2.6667cqh;
  background: transparent;
  pointer-events: auto;
}

.stage-complete-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.stage-complete-overlay.is-exiting::after {
  animation: stage-complete-exit 2084ms linear both;
  pointer-events: auto;
}

.stage-complete-panel {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: max-content;
  min-width: 66.6667cqh;
  max-width: calc(100cqw - 5.3334cqh);
  display: flex;
  flex-direction: column;
  padding: 0 2.6667cqh 2.9333cqh;
  border: max(1px, 0.2667cqh) solid #fff;
  background: #000;
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  text-align: center;
}

.stage-complete-panel.is-special-mode {
  min-width: 80cqh;
}

.stage-complete-title {
  height: 10.6667cqh;
  color: #fff;
  font-family: "Munro Small", Munro, monospace;
  font-size: 10.6667cqh;
  font-weight: 400;
  line-height: 10.6667cqh;
  white-space: nowrap;
  transform: translateX(0.5333cqh);
}

.stage-complete-subtitle,
.stage-complete-line,
.stage-complete-tier {
  color: #ff00ff;
  min-height: 2.6667cqh;
  font-size: 2.6667cqh;
  line-height: 2.6667cqh;
  white-space: nowrap;
}

.stage-complete-subtitle {
  margin-top: 0.8cqh;
}

.stage-complete-time-lines {
  width: max-content;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stage-complete-time-lines.has-matching-time-widths {
  align-items: flex-end;
}

.stage-complete-time-lines .stage-complete-line {
  width: max-content;
  text-align: right;
  white-space: pre;
}

.stage-complete-time-row,
.stage-complete-next-tier {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Match the ten-point visual break from each trailing tilde to its star so
     the separator has equal breathing room on both sides. */
  gap: 2.6667cqh;
}

.stage-complete-star-group {
  display: inline-flex;
  align-items: center;
  gap: 0.8cqh;
}

.stage-complete-star-group .summary-star {
  --star-size: 4.2667cqh;
  /* SpecialStageInfo.addStars positions the star ten points after the tilde;
     retain the existing three-point flex gap and supply the missing seven. */
  margin-left: 1.8667cqh;
}

.stage-complete-tier + .stage-complete-next-tier {
  margin-top: 1.6cqh;
}

.stage-complete-rule {
  flex: none;
  height: max(1px, 0.2667cqh);
  margin: 2.9333cqh 8cqh 0;
  background: #fff;
}

.stage-complete-title + .stage-complete-rule {
  margin-top: 1.0667cqh;
}

.stage-complete-rule + .stage-complete-time-lines,
.stage-complete-rule + .stage-complete-line,
.stage-complete-rule + .stage-complete-tier {
  margin-top: 2.9333cqh;
}

.stage-complete-line + .stage-complete-line {
  margin-top: 1.6cqh;
}

.stage-complete-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.1333cqh;
  margin-top: 2.6667cqh;
}

.stage-complete-button {
  --button-press-y: 0.8cqh;
  height: 11.2cqh;
  min-height: 0;
  padding: 0;
  border: max(1px, 0.2667cqh) solid #fff;
  border-radius: 0;
  background: var(--pixel-button-bg);
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: 4cqh;
  line-height: 1;
  text-indent: 0.5333cqh;
}

.stage-complete-button:disabled {
  opacity: 1;
}

.app-shell.is-stage-complete .game-timer,
.app-shell.is-stage-complete .level-progress-banner,
.app-shell.is-stage-complete .in-game-pause-button,
.app-shell.is-stage-complete .boss-skip-button {
  display: none !important;
}

@keyframes stage-complete-exit {
  0% {
    opacity: 0;
  }
  66.667%,
  100% {
    opacity: 1;
  }
}

.pause-overlay {
  --pause-backdrop-opacity: 0.8;
  /* StandardButton.m composites 88% black over its white view backing. */
  --pause-standard-button-bg: var(--standard-button-bg);
  --pause-levels-button-bg: #202431;
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3cqw, 18px);
  background: rgba(0, 0, 0, 0);
  pointer-events: auto;
}

.app-shell.is-paused .in-game-pause-button {
  pointer-events: none;
}

.in-game-pause-button:disabled {
  cursor: default;
  opacity: 1;
}

.pause-levels-button {
  --pixel-button-bg: var(--pause-levels-button-bg);
  position: absolute;
  z-index: 4;
  top: calc(var(--safe-top) + 6px);
  right: calc(var(--retrocube-horizontal-safe-inset) + 6px);
  width: clamp(58px, 11cqw, 78px);
  height: clamp(28px, 7.8cqh, 36px);
  min-height: 0;
  padding: 0 6px;
  border: 1px solid #fff;
  border-radius: 0;
  background: var(--pixel-button-bg);
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: clamp(8px, 1.8cqw, 12px);
  line-height: 1;
}

.pause-overlay::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: var(--pause-panel-width, min(430px, 72%));
  height: var(--pause-panel-height, 238px);
  border: 1px solid #fff;
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  will-change: width, height, opacity;
}

.pause-panel {
  position: relative;
  z-index: 1;
  container-type: size;
  display: block;
  width: min(560px, 54cqw);
  height: min(370px, 63.5cqh);
  max-width: calc(100% - 18px);
  max-height: calc(100% - 16px);
  padding: 0;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  overflow: hidden;
  opacity: 0;
  clip-path: inset(50% 50% 50% 50%);
  will-change: clip-path, opacity;
}

.pause-panel.is-minigame {
  width: min(500px, 37.481259cqw);
  height: min(258px, 34.4cqh);
  background: #000;
}

.pause-overlay.is-open {
  animation: pauseFadeIn 480ms linear both;
}

.pause-overlay.is-open::before {
  animation: pauseFrameReveal 480ms cubic-bezier(0.36, 0, 0.95, 0.52) both;
}

.pause-overlay.is-open .pause-panel {
  animation: pausePanelReveal 480ms cubic-bezier(0.36, 0, 0.95, 0.52) both;
}

.pause-overlay.is-open.is-instant {
  animation: none;
  background: rgba(0, 0, 0, var(--pause-backdrop-opacity));
}

.pause-overlay.is-open.is-instant::before {
  animation: none;
  opacity: 1;
}

.pause-overlay.is-open.is-instant .pause-panel {
  animation: none;
  opacity: 1;
  clip-path: inset(0 0 0 0);
}

.pause-overlay.is-closing {
  animation: pauseFadeOut 480ms linear both;
}

.pause-overlay.is-closing::before {
  animation: pauseFrameRetract 480ms cubic-bezier(0.32, 0, 1, 0.68) both;
}

.pause-overlay.is-closing .pause-panel {
  animation: pausePanelRetract 480ms cubic-bezier(0.32, 0, 1, 0.68) both;
}

.pause-overlay.is-closing.is-minigame::before {
  animation-name: pauseFrameRetractMinigame;
}

.pause-overlay.is-closing.is-minigame .pause-panel {
  animation-name: pausePanelRetractMinigame;
}

.pause-progress {
  position: absolute;
  top: 1.95cqw;
  left: 1.95cqw;
  font-size: 2.78cqw;
  line-height: 1;
}

.pause-mode-stars {
  position: absolute;
  /* Preserve the native star/count pairing while closing roughly 46% of the
     vertical gap beneath the special-mode level label. */
  top: 6cqw;
  left: 1.4cqw;
  display: flex;
  align-items: flex-start;
  gap: 1.111111cqw;
  color: #ff00ff;
  font-size: 2.78cqw;
  line-height: 4.444444cqw;
}

.pause-mode-stars .summary-star {
  --star-size: 4.444444cqw;
}

.pause-title {
  position: absolute;
  top: 2.15cqh;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Munro Small", Munro, monospace;
  font-size: 11.1cqw;
  line-height: 0.9;
  font-weight: 400;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.pause-time {
  position: absolute;
  top: 18.7cqh;
  left: 50%;
  transform: translateX(-50%);
  color: #ff00ff;
  font-size: 2.78cqw;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.pause-rule {
  position: absolute;
  left: 11.1cqw;
  right: 11.1cqw;
  top: 28.15cqh;
  height: 1px;
  margin: 0;
  background: #fff;
}

.pause-goals + .pause-rule {
  top: 72.27cqh;
}

.pause-goals {
  position: absolute;
  left: 15cqw;
  top: 33.6cqh;
  display: grid;
  gap: 2.5cqh;
  width: 70cqw;
}

.pause-goal-row {
  display: grid;
  /* PauseView.m aligns the 16pt star and 10pt label by their top edges. */
  grid-template-columns: 5.555556cqw minmax(0, 1fr);
  align-items: start;
  gap: 1.388889cqw;
  min-height: 6.75cqh;
}

.pause-goals.is-speedrun-stage {
  left: 18.611111cqw;
  width: calc(100cqw - 18.611111cqw);
}

.pause-goals.is-hardcore-stage {
  left: 0;
  width: 100cqw;
}

.pause-goal-row.is-tier-requirement {
  grid-template-columns: 15.277778cqw max-content max-content;
  align-items: center;
  gap: 0;
}

.pause-goals.is-hardcore-stage .pause-goal-row.is-tier-requirement {
  grid-template-columns: 15.277778cqw max-content;
  justify-content: center;
}

.pause-goal-tier,
.pause-goal-time,
.pause-goal-star-requirement {
  color: #ff00ff;
  font-size: 2.78cqw;
  line-height: 1;
  white-space: nowrap;
}

.pause-goal-star-requirement {
  display: grid;
  grid-template-columns: max-content 4.444444cqw max-content;
  align-items: center;
  column-gap: 1.111111cqw;
  margin-left: 3.333333cqw;
}

.pause-goal-text {
  color: #ff00ff;
  font-size: 2.78cqw;
  line-height: 1.1;
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.pause-actions {
  position: absolute;
  /* PauseView.m: x=10/360, right=11/360, with 9pt between 107pt buttons. */
  left: 2.777778cqw;
  right: 3.055556cqw;
  bottom: 4.2cqh;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5cqw;
}

.pause-action-button {
  --pixel-button-bg: var(--pause-standard-button-bg);
  /* StandardButton.m moves 3 pt on touch-down with no interpolation. */
  --button-press-y: 0.833333cqw;
  height: 17.65cqh;
  min-height: 0;
  padding: 0 6px;
  border: 1px solid #fff;
  border-radius: 0;
  background: var(--pixel-button-bg);
  color: #fff;
  font-family: "Pixel Block Party", Munro, monospace;
  font-size: 4.17cqw;
  line-height: 1;
}

.pause-panel.is-minigame .pause-title {
  font-size: 16cqw;
}

.pause-panel.is-minigame .pause-time {
  top: 34.108527cqh;
  font-size: 4cqw;
}

.pause-panel.is-minigame .pause-time + .pause-rule {
  top: 51.937984cqh;
  left: 12cqw;
  right: 12cqw;
}

.pause-panel.is-minigame .pause-goals + .pause-rule {
  display: none;
}

.pause-panel.is-minigame .pause-actions {
  left: 4.4cqw;
  right: 4.4cqw;
  bottom: 8.527132cqh;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4cqw;
}

.pause-panel.is-minigame .pause-action-button {
  /* MinigamePauseView uses the same 3 pt shift on its 250 pt-wide panel. */
  --button-press-y: 1.2cqw;
  height: 31.007752cqh;
  font-size: 6cqw;
}

.pause-restart-confirm {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.pause-restart-message {
  position: absolute;
  top: 28.55cqh;
  left: 0;
  right: 0;
  display: grid;
  place-items: center;
  height: 43.25cqh;
  background: #000;
  color: #fff;
  font-size: 4.17cqw;
  line-height: 1.35;
  text-align: center;
  white-space: pre-line;
}

.pause-restart-actions {
  position: absolute;
  /* PauseView.m: two 162pt buttons inside the same 339pt-wide button mask. */
  left: 2.777778cqw;
  right: 3.055556cqw;
  bottom: 4.2cqh;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4.166667cqw;
  background: #000;
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) and (min-height: 600px) {
  /* Scale with the 667-point game frame, without the phone/tablet size caps.
     PauseView.m is 360 × 238 pt; MinigamePauseView.m is 250 × 129 pt.
     One shared unit preserves those proportions as the desktop game grows. */
  .in-game-pause-button {
    --hud-control-unit: 0.149925cqw;
  }

  .pause-overlay {
    --pause-ui-unit: 0.149925cqw;
  }

  .pause-panel {
    width: calc(var(--pause-ui-unit) * 360);
    height: calc(var(--pause-ui-unit) * 238);
    border-width: var(--pause-ui-unit);
  }

  .pause-panel.is-minigame {
    width: calc(var(--pause-ui-unit) * 250);
    height: calc(var(--pause-ui-unit) * 129);
  }

  .pause-overlay::before {
    border-width: var(--pause-ui-unit);
  }

  .pause-panel .pause-action-button {
    border-width: 0.277778cqw;
  }

  .pause-panel .pause-rule {
    height: 0.277778cqw;
  }

  .pause-panel.is-minigame .pause-action-button {
    border-width: 0.4cqw;
  }

  .pause-panel.is-minigame .pause-rule {
    height: 0.4cqw;
  }

  .pause-levels-button {
    top: calc(var(--safe-top) + var(--pause-ui-unit) * 6);
    right: calc(var(--retrocube-horizontal-safe-inset) + var(--pause-ui-unit) * 6);
    width: calc(var(--pause-ui-unit) * 78);
    height: calc(var(--pause-ui-unit) * 36);
    border-width: var(--pause-ui-unit);
    font-size: calc(var(--pause-ui-unit) * 12);
  }
}

@keyframes pauseFadeIn {
  from {
    background: rgba(0, 0, 0, 0);
  }

  to {
    background: rgba(0, 0, 0, var(--pause-backdrop-opacity));
  }
}

@keyframes pauseFadeOut {
  from {
    background: rgba(0, 0, 0, var(--pause-backdrop-opacity));
  }

  to {
    background: rgba(0, 0, 0, 0);
  }
}

@keyframes pauseFrameReveal {
  from {
    width: 0;
    height: 0;
    opacity: 1;
  }

  to {
    width: var(--pause-panel-width, min(430px, 72%));
    height: var(--pause-panel-height, 238px);
    opacity: 1;
  }
}

@keyframes pauseFrameRetract {
  from {
    width: var(--pause-panel-width, min(430px, 72%));
    height: var(--pause-panel-height, 238px);
    opacity: 1;
    visibility: visible;
  }

  96.154%,
  99.999% {
    width: var(--pause-terminal-width, 10px);
    height: var(--pause-terminal-height, 7px);
    opacity: 1;
    visibility: visible;
  }

  to {
    width: 0;
    height: 0;
    opacity: 1;
    visibility: hidden;
  }
}

@keyframes pauseFrameRetractMinigame {
  from {
    width: var(--pause-panel-width, min(430px, 72%));
    height: var(--pause-panel-height, 238px);
    opacity: 1;
    visibility: visible;
  }

  95.238%,
  99.999% {
    width: var(--pause-terminal-width, 20px);
    height: var(--pause-terminal-height, 10px);
    opacity: 1;
    visibility: visible;
  }

  to {
    width: 0;
    height: 0;
    opacity: 1;
    visibility: hidden;
  }
}

@keyframes pausePanelReveal {
  from {
    opacity: 0;
    clip-path: inset(50% 50% 50% 50%);
  }

  22% {
    opacity: 1;
  }

  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}

@keyframes pausePanelRetract {
  from {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    visibility: visible;
  }

  96.154%,
  99.999% {
    opacity: 1;
    clip-path: inset(48.611111% 48.611111% 48.611111% 48.611111%);
    visibility: visible;
  }

  to {
    opacity: 1;
    clip-path: inset(50% 50% 50% 50%);
    visibility: hidden;
  }
}

@keyframes pausePanelRetractMinigame {
  from {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    visibility: visible;
  }

  95.238%,
  99.999% {
    opacity: 1;
    clip-path: inset(46% 46% 46% 46%);
    visibility: visible;
  }

  to {
    opacity: 1;
    clip-path: inset(50% 50% 50% 50%);
    visibility: hidden;
  }
}

@keyframes titleBlink {
  0%,
  49.999% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@keyframes titleModalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes titleOptionsFadeIn {
  from {
    background: rgba(0, 0, 0, 0);
  }

  to {
    background: rgba(0, 0, 0, var(--title-options-backdrop-opacity));
  }
}

@keyframes titleOptionsFadeOut {
  from {
    background: rgba(0, 0, 0, var(--title-options-backdrop-opacity));
  }

  to {
    background: rgba(0, 0, 0, 0);
  }
}

@keyframes titleOptionsPanelExpand {
  from {
    width: 0;
    height: 0;
  }

  to {
    width: var(--title-options-width);
    height: var(--title-options-height);
  }
}

@keyframes titleOptionsPanelRetract {
  from {
    width: var(--title-options-width);
    height: var(--title-options-height);
  }

  to {
    width: 0;
    height: 0;
  }
}

@keyframes titleCreditsDrawerReveal {
  from {
    clip-path: inset(0 calc(50% - 1px) 0 calc(50% - 1px));
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes titleCreditsDrawerRetract {
  from {
    clip-path: inset(0 0 0 0);
  }

  to {
    clip-path: inset(0 calc(50% - 1px) 0 calc(50% - 1px));
  }
}

@keyframes titleCreditsLeftEdge {
  from {
    left: calc(50% - 1px);
  }

  to {
    left: 0;
  }
}

@keyframes titleCreditsLeftEdgeRetract {
  from {
    left: 0;
  }

  to {
    left: calc(50% - 1px);
  }
}

@keyframes titleCreditsRightEdge {
  from {
    right: calc(50% - 1px);
  }

  to {
    right: 0;
  }
}

@keyframes titleCreditsRightEdgeRetract {
  from {
    right: 0;
  }

  to {
    right: calc(50% - 1px);
  }
}

@keyframes titlePanelEdgeFinalize {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.message-title {
  font-size: clamp(28px, 9vw, 58px);
  line-height: 0.95;
}

.message-text {
  max-width: 520px;
  color: var(--muted);
  font-size: clamp(16px, 4vw, 24px);
  line-height: 1.2;
}

.primary-button {
  min-width: 120px;
  color: #111318;
  background: var(--accent-2);
  border-color: #98f3f5;
}

.bottom-controls {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.dpad {
  width: 148px;
  height: 104px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
}

.dir-button {
  border-radius: 6px;
  padding: 0;
  font-size: 13px;
}

.action-button {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  color: #111318;
  background: var(--accent-2);
  border-color: #98f3f5;
  font-size: 14px;
}

.action-button.is-hidden {
  display: none;
}

.action-button.is-hidden + .status-line {
  grid-column: 2 / -1;
}

.dir-button.up {
  grid-column: 2;
  grid-row: 1;
}

.dir-button.left {
  grid-column: 1;
  grid-row: 2;
}

.dir-button.right {
  grid-column: 3;
  grid-row: 2;
}

.dir-button.down {
  grid-column: 2;
  grid-row: 2;
}

.status-line {
  min-width: 0;
  color: var(--muted);
  font-size: clamp(14px, 3.5vw, 20px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.level-menu {
  position: fixed;
  inset: 0 auto auto 0;
  width: var(--retrocube-safe-vw);
  height: var(--retrocube-safe-vh);
  z-index: 10;
  display: grid;
  place-items: stretch;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  transition: opacity 260ms linear, background-color 260ms linear;
}

.menu-panel {
  width: min(960px, 100%);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  justify-self: center;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 44px var(--shadow);
  overflow: hidden;
  opacity: 0.88;
  transform: translateY(10px);
  transition: opacity 260ms linear, transform 260ms linear;
}

.level-menu.is-open {
  opacity: 1;
  background: rgba(0, 0, 0, 0.72);
}

.level-menu.is-open .menu-panel {
  opacity: 1;
  transform: translateY(0);
}

.level-menu.is-closing {
  opacity: 0;
  background: rgba(0, 0, 0, 0);
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.menu-title {
  font-size: 28px;
  line-height: 1;
}

.menu-subtitle {
  color: var(--muted);
  font-size: 16px;
}

.menu-tabs {
  display: flex;
  gap: 6px;
}

.level-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 0 2px 36px 0;
  -webkit-overflow-scrolling: touch;
}

.world-group {
  display: grid;
  gap: 6px;
}

.world-title {
  color: var(--muted);
  font-size: 16px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 6px;
}

.level-button {
  min-height: 42px;
  border-radius: 6px;
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: manipulation;
}

.level-button.current {
  border-color: var(--accent);
  color: #fff;
}

.tool-button,
.primary-button,
.tab-button,
.in-game-pause-button,
.boss-skip-button,
.title-icon-button,
.title-back-button,
.title-option-close,
.title-stage-button,
.title-stage-play,
.stage-info-snake,
.stage-complete-button,
.pause-levels-button,
.pause-action-button,
.dir-button,
.action-button,
.level-button,
.debug-button {
  /* StandardButton swaps complete border bitmaps on touch-down/up, so its
     thick white highlight must never interpolate through partial widths. */
  transition:
    transform 80ms linear,
    background-color 80ms linear,
    border-color 80ms linear,
    color 80ms linear,
    opacity 320ms linear;
}

.title-back-button {
  transition:
    opacity var(--title-selector-duration) linear,
    background-color 80ms linear,
    border-color 80ms linear;
}

.title-stage-button {
  transition: none;
}

.stage-complete-button {
  /* StageComplete's StandardButtons swap frames immediately on touch changes. */
  transition: none;
}

.pause-levels-button,
.pause-action-button {
  /* StandardButton.buttonDown/buttonUp assign their frames synchronously. */
  transition: none;
}

.tool-button:active:not(:disabled):not(.is-release-cancelled),
.primary-button:active:not(:disabled):not(.is-release-cancelled),
.tab-button:active:not(:disabled):not(.is-release-cancelled),
.in-game-pause-button:active:not(:disabled):not(.is-release-cancelled),
.boss-skip-button:active:not(:disabled):not(.is-release-cancelled),
.title-icon-button:active:not(:disabled):not(.is-release-cancelled),
.title-back-button:active:not(:disabled):not(.is-release-cancelled),
.title-option-close:active:not(:disabled):not(.is-release-cancelled),
.title-stage-button:active:not(:disabled):not(.is-release-cancelled),
.title-stage-play:active:not(:disabled):not(.is-release-cancelled),
.stage-info-snake:active:not(:disabled):not(.is-release-cancelled),
.stage-complete-button:active:not(:disabled):not(.is-release-cancelled),
.pause-levels-button:active:not(:disabled):not(.is-release-cancelled),
.pause-action-button:active:not(:disabled):not(.is-release-cancelled),
.pause-action-button.is-pressed:not(:disabled),
.dir-button:active:not(:disabled):not(.is-release-cancelled),
.action-button:active:not(:disabled):not(.is-release-cancelled),
.level-button:active:not(:disabled):not(.is-release-cancelled),
.debug-button:active:not(:disabled):not(.is-release-cancelled) {
  transform: translateY(var(--button-press-y));
}

.pause-action-button:active:not(:disabled):not(.is-release-cancelled),
.pause-action-button.is-pressed:not(:disabled),
.stage-complete-button:active:not(:disabled):not(.is-release-cancelled),
.title-stage-button:active:not(:disabled):not(.is-release-cancelled),
.title-option-close:active:not(:disabled):not(.is-release-cancelled),
.level-button:active:not(:disabled):not(.is-release-cancelled),
.tab-button:active:not(:disabled):not(.is-release-cancelled),
.tool-button:active:not(:disabled):not(.is-release-cancelled),
.debug-button:active:not(:disabled):not(.is-release-cancelled) {
  border-color: #fff;
  background: var(--pixel-button-bg);
  box-shadow: inset 0 0 0 3px #fff;
}

.title-stage-button:active:not(:disabled):not(.is-release-cancelled) {
  /* StandardButton's 1 pt -> 4 pt image swap doubles on iPad. */
  box-shadow: inset 0 0 0 calc(var(--stage-info-unit) * 3) #fff;
}

.stage-complete-button:active:not(:disabled):not(.is-release-cancelled) {
  box-shadow: none;
}

.title-stage-play:active:not(:disabled):not(.is-release-cancelled),
.title-stage-play.is-pressed:not(:disabled) {
  /* WorldSelectButton explicitly reuses Play's normal 1 px border image. */
  box-shadow: none;
}

.title-stage-button.is-locked:active:not(:disabled):not(.is-release-cancelled) {
  background: var(--pixel-button-bg);
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .title-stage-button.is-selected:not(.is-locked),
  .title-stage-button.is-selected:not(.is-locked):active:not(:disabled):not(.is-release-cancelled),
  .title-stage-button.is-selected:not(.is-locked).is-pressed:not(:disabled) {
    /* A solid white backing prevents fractional desktop rasterization from
       exposing the dark button surface between the thin and thick borders. */
    background: #fff;
    box-shadow: none;
  }

  .title-stage-button.is-selected:not(.is-locked)::before {
    position: absolute;
    z-index: 0;
    inset: calc(var(--stage-info-unit) * 3);
    content: "";
    background: var(--pixel-button-bg);
    pointer-events: none;
  }
}

.primary-button:active:not(:disabled):not(.is-release-cancelled),
.dir-button:active:not(:disabled):not(.is-release-cancelled),
.action-button:active:not(:disabled):not(.is-release-cancelled) {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85);
}

.in-game-pause-button:active:not(:disabled):not(.is-release-cancelled),
.boss-skip-button:active:not(:disabled):not(.is-release-cancelled),
.title-icon-button:active:not(:disabled):not(.is-release-cancelled),
.title-back-button:active:not(:disabled):not(.is-release-cancelled),
.stage-info-snake:active:not(:disabled):not(.is-release-cancelled) {
  border-color: #fff;
  background: var(--pixel-button-bg);
  box-shadow: none;
}

/* Mirror StandardButton's explicit touch-down/touch-up frame movement. */
.title-icon-button {
  position: relative;
  top: var(--title-press-offset, 0px);
}

.title-stage-button {
  top: var(--title-press-offset, 0px);
}

.title-stage-play {
  position: absolute;
  top: calc(var(--stage-info-play-top) + var(--title-press-offset, 0px));
}

.title-back-button {
  top: calc(var(--safe-top) + var(--title-control-gap) + var(--title-press-offset, 0px));
}

.stage-info-snake {
  top: calc(var(--safe-top) + var(--title-control-gap) + var(--title-press-offset, 0px));
}

.title-option-close {
  bottom: calc(5.7895% - var(--title-press-offset, 0px));
}

.title-icon-button:active:not(:disabled):not(.is-release-cancelled),
.title-icon-button.is-pressed:not(:disabled),
.title-back-button:active:not(:disabled):not(.is-release-cancelled),
.title-back-button.is-pressed:not(:disabled),
.title-stage-button:active:not(:disabled):not(.is-release-cancelled),
.title-stage-button.is-pressed:not(:disabled),
.title-stage-play:active:not(:disabled):not(.is-release-cancelled),
.title-stage-play.is-pressed:not(:disabled),
.stage-info-snake:active:not(:disabled):not(.is-release-cancelled),
.stage-info-snake.is-pressed:not(:disabled),
.title-option-close:active:not(:disabled):not(.is-release-cancelled),
.title-option-close.is-pressed:not(:disabled) {
  --title-press-offset: var(--title-button-press-y);
}

.title-icon-button:active:not(:disabled):not(.is-release-cancelled),
.title-stage-button:active:not(:disabled):not(.is-release-cancelled),
.title-stage-play:active:not(:disabled):not(.is-release-cancelled),
.stage-info-snake:active:not(:disabled):not(.is-release-cancelled),
.title-option-close:active:not(:disabled):not(.is-release-cancelled),
.title-screen.is-selecting .title-back-button:active:not(:disabled):not(.is-release-cancelled) {
  transform: none;
}

@media (max-width: 620px) {
  .app-shell {
    grid-template-rows: auto auto auto;
    align-content: start;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .tool-button {
    flex: 1;
    padding-inline: 6px;
  }

  .bottom-controls {
    grid-template-columns: auto auto;
    justify-items: center;
    gap: 8px;
  }

  .status-line {
    grid-column: 1 / -1;
  }

  .play-area {
    min-height: auto;
    align-items: start;
  }

  .status-line {
    text-align: center;
  }

  .app-shell.is-title {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    align-content: center;
  }

  .app-shell.is-title .play-area {
    align-items: center;
  }

  .title-screen {
    padding: 0;
  }

  .title-stage-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--title-stage-grid-gap-y) var(--title-stage-grid-gap-x);
  }

  .stage-info-content {
    padding: 0;
  }
}

@media (hover: none), (pointer: coarse), (max-width: 760px), (max-height: 520px) and (max-width: 1024px) {
  .app-shell.is-gameplay {
    position: fixed;
    inset: 0;
    width: var(--retrocube-safe-vw);
    height: var(--retrocube-safe-vh);
    min-height: var(--retrocube-safe-vh);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    padding: 0;
    gap: 0;
    place-items: center;
    background: #020203;
    overflow: hidden;
  }

  .app-shell.is-gameplay .top-bar,
  .app-shell.is-gameplay .bottom-controls {
    display: none;
  }

  .app-shell.is-gameplay .play-area {
    position: absolute;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    inset: 0;
    width: var(--retrocube-safe-vw);
    height: var(--retrocube-safe-vh);
    min-height: 0;
    display: grid;
    place-items: center;
  }

  .app-shell.is-gameplay .game-frame {
    width: min(
      calc(var(--retrocube-safe-vh) * var(--retrocube-ratio)),
      calc(var(--retrocube-safe-vw) * var(--retrocube-frame-per-board-width))
    );
    height: min(
      var(--retrocube-safe-vh),
      calc(var(--retrocube-safe-vw) * var(--retrocube-frame-height-per-board-width))
    );
    max-width: none;
    aspect-ratio: auto;
    transform-origin: center;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .top-bar {
    grid-column: 1 / -1;
  }

  .bottom-controls {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    grid-template-columns: 1fr;
    width: 156px;
  }

  .action-button {
    justify-self: center;
  }

  .play-area {
    grid-column: 1;
    grid-row: 2;
  }

  .game-frame {
    width: min(100%, calc((100dvh - 76px) * 1.5));
  }
}

.debug-overlay {
  position: fixed;
  z-index: 2147483647;
  bottom: max(6px, env(safe-area-inset-bottom));
  left: max(6px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(680px, calc(100vw - 12px));
  max-height: min(88vh, 720px);
  border: 1px solid #fff;
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: auto;
}

.debug-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(32, 36, 49, 0.9);
}

.debug-title {
  flex: 1;
  font-weight: 700;
}

.debug-button {
  min-height: 0;
  height: 26px;
  padding: 0 7px;
  border: 1px solid #fff;
  border-radius: 0;
  background: var(--pixel-button-bg);
  color: #fff;
  font: inherit;
}

.debug-boss-complete-button {
  border-color: #ff7b7b;
  background: #5a2020;
  font-weight: 700;
  white-space: nowrap;
}

.debug-boss-complete-button[hidden] {
  display: none;
}

.debug-button:disabled,
.debug-select:disabled,
.debug-check-label:has(input:disabled) {
  cursor: default;
  opacity: 0.42;
}

.debug-controls {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(9, 11, 17, 0.96);
}

.debug-access-row,
.debug-action-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.debug-access-row {
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.76);
}

.debug-cheat-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 14px;
}

.debug-check-label {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
  color: #fff;
  cursor: pointer;
}

.debug-check-label input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #36d4d8;
}

.debug-selection-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(90px, 0.6fr) minmax(180px, 1.3fr);
  gap: 7px;
}

.debug-field {
  display: grid;
  gap: 4px;
  color: rgba(255, 255, 255, 0.75);
}

.debug-select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 24px 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 0;
  background: #171a24;
  color: #fff;
  font: inherit;
}

.debug-action-row .debug-action-button {
  flex: 1 1 0;
  height: 30px;
  white-space: nowrap;
}

.debug-navigation-row .debug-action-button:nth-child(2) {
  border-color: #36d4d8;
  background: #17474e;
  font-weight: 700;
}

.debug-status {
  min-height: 15px;
  color: #71e6e9;
}

.debug-status.is-error {
  color: #ff7070;
}

.debug-output {
  min-height: 0;
  margin: 0;
  padding: 7px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.debug-overlay.is-collapsed {
  width: auto;
  max-height: none;
  grid-template-rows: auto;
}

.debug-overlay.is-collapsed .debug-header {
  padding: 0;
  border-bottom: 0;
}

.debug-overlay.is-collapsed .debug-title,
.debug-overlay.is-collapsed .debug-copy-button,
.debug-overlay.is-collapsed .debug-controls {
  display: none;
}

.debug-overlay.is-collapsed .debug-toggle-button {
  width: 42px;
  height: 30px;
  padding: 0;
}

.debug-overlay.is-collapsed .debug-boss-complete-button {
  height: 30px;
  padding-inline: 9px;
}

.debug-overlay.is-collapsed .debug-output {
  display: none;
}

@media (orientation: landscape) and (max-height: 520px) {
  .debug-overlay {
    width: min(720px, calc(100vw - 12px));
    max-height: calc(100vh - 12px);
    font-size: 11px;
  }

  .debug-controls {
    gap: 5px;
    padding: 5px;
  }

  .debug-field {
    gap: 2px;
  }

  .debug-select,
  .debug-action-row .debug-action-button {
    height: 26px;
  }

  .debug-output {
    max-height: min(24vh, 120px);
  }
}

@media (max-width: 560px) {
  .debug-selection-grid {
    grid-template-columns: 1fr 0.65fr;
  }

  .debug-level-field {
    grid-column: 1 / -1;
  }

  .debug-access-row {
    align-items: flex-start;
  }

  .debug-access-hint {
    max-width: 55%;
  }
}

/*
 * Installed iOS owns the outer viewport. The root fills every DOM viewport
 * edge; title/gameplay content consumes the safe area once, on play-area.
 */
html.is-installed-app,
html.is-installed-app body {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
}

html.is-installed-app .app-shell {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  min-height: 0;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: #050506;
}

html.is-installed-app .app-shell.is-title,
html.is-installed-app .app-shell.is-gameplay {
  inset: 0;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
}

html.is-installed-app .app-shell.is-title .play-area,
html.is-installed-app .app-shell.is-gameplay .play-area {
  inset: 0;
  width: 100%;
  height: 100%;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

html.is-installed-app .level-menu {
  inset: 0;
  width: auto;
  height: auto;
}

/* Portrait phones and unusually shaped desktop tabs are gated sitewide. */
.rotate-overlay,
.resize-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: none;
  padding: max(24px, var(--safe-top)) max(24px, var(--safe-right)) max(24px, var(--safe-bottom)) max(24px, var(--safe-left));
  place-content: center;
  place-items: center;
  gap: 13px;
  color: #fff;
  background:
    radial-gradient(circle at 50% 28%, rgba(153, 28, 39, 0.5), transparent 42%),
    #050506;
  font-family: var(--rounded);
  text-align: center;
}

.resize-overlay {
  z-index: 2147483647;
  touch-action: none;
  overscroll-behavior: none;
}

.rotate-overlay > img,
.resize-overlay > img {
  width: min(24vw, 96px);
  height: auto;
  border-radius: 22%;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
}

.rotate-overlay strong,
.resize-overlay strong {
  margin-top: 2px;
  font-size: clamp(22px, 8vw, 38px);
}

.rotate-overlay > span {
  color: #d3d3d8;
  font-family: var(--system);
  font-size: clamp(14px, 4.6vw, 19px);
  line-height: 1.4;
}

.browser-resize {
  display: none;
  grid-template: 50px 54px 50px / 48px 82px 48px;
  width: 178px;
  height: 154px;
  place-items: center;
  color: #ff8b94;
}

.browser-resize i {
  position: relative;
  grid-area: 2 / 2;
  display: block;
  width: 74px;
  height: 48px;
  border: 3px solid #fff;
  border-radius: 6px;
  box-shadow: inset 0 8px 0 -5px #fff;
}

.browser-resize i::before {
  position: absolute;
  top: 4px;
  left: 5px;
  width: 3px;
  height: 3px;
  content: "";
  background: #ff8b94;
  border-radius: 50%;
  box-shadow: 6px 0 #ff8b94, 12px 0 #ff8b94;
}

.resize-arrow {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  animation: resize-arrow-left 1.55s ease-in-out infinite;
}

.resize-arrow svg {
  display: block;
  width: 40px;
  height: 40px;
  overflow: visible;
}

.resize-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.resize-arrow-point-left svg {
  transform: rotate(180deg);
}

.resize-arrow-point-up svg {
  transform: rotate(-90deg);
}

.resize-arrow-point-down svg {
  transform: rotate(90deg);
}

.resize-arrow-left {
  grid-area: 2 / 1;
  animation-name: resize-arrow-right;
}

.resize-arrow-top {
  grid-area: 1 / 2;
  animation-name: resize-arrow-down;
}

.resize-arrow-right {
  grid-area: 2 / 3;
  animation-name: resize-arrow-left;
}

.resize-arrow-bottom {
  grid-area: 3 / 2;
  animation-name: resize-arrow-up;
}

.resize-copy {
  display: none;
  max-width: min(92vw, 760px);
  place-items: center;
}

.resize-copy > strong {
  display: block;
  text-wrap: balance;
}

/* Keep the browser-shape guard fully visible when a desktop window is made
   exceptionally short or narrow. The regular artwork retains its native
   dimensions; below this breakpoint every part follows the limiting viewport
   edge so the centered composition cannot be clipped. */
@media (max-height: 360px), (max-width: 360px) {
  .resize-overlay {
    padding:
      max(clamp(8px, 4vmin, 24px), var(--safe-top))
      max(clamp(8px, 4vmin, 24px), var(--safe-right))
      max(clamp(8px, 4vmin, 24px), var(--safe-bottom))
      max(clamp(8px, 4vmin, 24px), var(--safe-left));
    gap: clamp(5px, 3vmin, 13px);
  }

  .resize-overlay > img {
    width: min(24vw, 24vmin, 96px);
  }

  .resize-overlay strong {
    font-size: clamp(16px, 8vmin, 38px);
    line-height: 1.1;
  }

  .browser-resize {
    grid-template:
      min(12vmin, 50px) min(13vmin, 54px) min(12vmin, 50px) /
      min(11.5vmin, 48px) min(19.7vmin, 82px) min(11.5vmin, 48px);
    width: min(42.7vmin, 178px);
    height: min(37vmin, 154px);
  }

  .browser-resize i {
    width: min(17.8vmin, 74px);
    height: min(11.5vmin, 48px);
    border-width: min(0.72vmin, 3px);
    border-radius: min(1.45vmin, 6px);
    box-shadow: inset 0 min(1.92vmin, 8px) 0 max(-5px, -1.2vmin) #fff;
  }

  .browser-resize i::before {
    top: min(0.96vmin, 4px);
    left: min(1.2vmin, 5px);
    width: min(0.72vmin, 3px);
    height: min(0.72vmin, 3px);
    box-shadow:
      min(1.45vmin, 6px) 0 #ff8b94,
      min(2.9vmin, 12px) 0 #ff8b94;
  }

  .resize-arrow {
    width: min(11.5vmin, 48px);
    height: min(11.5vmin, 48px);
  }

  .resize-arrow svg {
    width: min(9.6vmin, 40px);
    height: min(9.6vmin, 40px);
  }
}

@keyframes resize-arrow-left {
  0%,
  100% {
    transform: translateX(5px);
  }

  50% {
    transform: translateX(-5px);
  }
}

@keyframes resize-arrow-right {
  0%,
  100% {
    transform: translateX(-5px);
  }

  50% {
    transform: translateX(5px);
  }
}

@keyframes resize-arrow-up {
  0%,
  100% {
    transform: translateY(5px);
  }

  50% {
    transform: translateY(-5px);
  }
}

@keyframes resize-arrow-down {
  0%,
  100% {
    transform: translateY(-5px);
  }

  50% {
    transform: translateY(5px);
  }
}

.install-hint {
  max-width: min(90vw, 360px);
  margin: 3px 0 0;
  color: #aeb0b8;
  font-family: var(--system);
  font-size: clamp(12px, 3.45vw, 14px);
  line-height: 1.4;
}

.install-lead {
  display: block;
  text-wrap: balance;
}

.install-hint > span[aria-label="More"] {
  color: #fff;
  letter-spacing: 0.04em;
}

.phone-rotate {
  position: relative;
  width: 66px;
  height: 52px;
}

.phone-rotate span {
  position: absolute;
  inset: 0;
  display: block;
  width: 28px;
  height: 43px;
  margin: auto;
  border: 3px solid #fff;
  border-radius: 6px;
  animation: turn-phone 1.8s ease-in-out infinite;
}

.phone-rotate::after {
  position: absolute;
  inset: 0;
  width: 52px;
  height: 52px;
  margin: auto;
  content: "";
  border-top: 3px solid #ff8b94;
  border-right: 3px solid #ff8b94;
  border-radius: 50%;
  transform: rotate(28deg);
}

@keyframes turn-phone {
  0%,
  28% {
    transform: rotate(0deg);
  }

  60%,
  100% {
    transform: rotate(90deg);
  }
}

@media (orientation: portrait) and (max-aspect-ratio: 1 / 1) {
  .rotate-overlay {
    display: grid;
  }

  .app-shell > :not(.rotate-overlay) {
    visibility: hidden;
    pointer-events: none;
  }

  .debug-overlay {
    visibility: hidden;
    pointer-events: none;
  }
}

html[data-browser-window-fit="too-wide"] .resize-overlay,
html[data-browser-window-fit="too-wide"] .browser-resize-narrower,
html[data-browser-window-fit="too-tall"] .resize-overlay,
html[data-browser-window-fit="too-tall"] .browser-resize-wider,
html[data-browser-window-fit] .resize-copy {
  display: grid;
}

html[data-browser-window-fit] .rotate-overlay {
  display: none;
}

html[data-browser-window-fit] .app-shell,
html[data-browser-window-fit] .debug-overlay {
  pointer-events: none;
}

html[data-browser-window-fit] .debug-overlay {
  visibility: hidden;
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  :root {
    --retrocube-vh: 100vh;
    --retrocube-safe-vw: max(0px, calc(var(--retrocube-vw) - var(--safe-left) - var(--safe-right)));
    --retrocube-safe-vh: max(0px, calc(var(--retrocube-vh) - var(--safe-top) - var(--safe-bottom)));
  }

  .install-hint {
    display: none;
  }
}

.is-installed-app .install-hint {
  display: none;
}
