:root {
  color-scheme: dark;
  --app-vw: 100vw;
  --app-vh: 100dvh;
  --app-vv-left: 0px;
  --app-vv-top: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --hud-edge-gap: 8px;
  --rounded: "Arial Rounded MT Bold", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --system: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: Arial, Helvetica, sans-serif;
  background: #000;
  touch-action: none;
}

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

img,
canvas {
  -webkit-user-drag: none;
  user-drag: none;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
  color: #fff;
}

body {
  position: fixed;
  inset: 0;
}

button {
  font: inherit;
}

.game-stage button {
  outline: none;
}

.app-shell {
  position: fixed;
  inset: 0 auto auto 0;
  width: var(--app-vw);
  height: var(--app-vh);
  min-height: var(--app-vh);
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  padding: 0;
  place-items: center;
  background: #000;
  overflow: hidden;
  isolation: isolate;
  transform: translate3d(var(--app-vv-left), var(--app-vv-top), 0);
  transform-origin: top left;
}

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

.game-stage {
  position: relative;
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  container-type: size;
  background: #000;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  touch-action: none;
  image-rendering: pixelated;
}

.screen,
.modal-overlay,
.tutorial-overlay {
  position: absolute;
  inset: 0;
}

[hidden] {
  display: none !important;
}

.home-screen {
  left: 0;
  right: 0;
  width: min(100%, 150cqh);
  margin-inline: auto;
  background: transparent;
}

.title-logo {
  position: absolute;
  left: 12.2917%;
  top: 8.4375%;
  width: 78.125%;
  aspect-ratio: 375 / 80;
  pointer-events: none;
}

.title-text-raster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.title-cat-art {
  position: absolute;
  display: block;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  pointer-events: none;
}

.home-button-art {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  pointer-events: none;
}

.image-button,
.text-button,
.asset-button,
.pause-button,
.area-button,
.start-button {
  border: 0;
  color: #fff;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.65);
}

.debug-mode-button {
  position: absolute;
  left: 5cqh;
  bottom: 4.0625cqh;
  width: 37.5cqh;
  height: 12.5cqh;
  padding: 0 2.5cqh;
  border: 0.625cqh solid #ffca58;
  border-radius: 2.1875cqh;
  color: #fff3d2;
  background: rgba(106, 64, 0, 0.88);
  font: 700 4.0625cqh/1 "Arial Rounded MT Bold", Arial, sans-serif;
  cursor: pointer;
}

.debug-mode-button.is-on {
  border-color: #61ff94;
  color: #001b09;
  background: #61ff94;
}

.image-button {
  position: absolute;
}

.image-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.image-button:active,
.asset-button:active,
.area-button:active,
.start-button:active,
.text-button:active {
  filter: brightness(1.18);
}

.home-options {
  left: 7.2917%;
  top: 49.6875%;
  width: 18.75%;
  height: 18.75%;
}

.home-start {
  left: 35.8333%;
  top: 47.8125%;
  width: 27.0833%;
  height: 22.1875%;
}

.home-tutorial {
  left: 72.7083%;
  top: 50.9375%;
  width: 20.8333%;
  height: 15.9375%;
}

.home-credits {
  left: 38.9583%;
  top: 70.3125%;
  width: 20.8333%;
  height: 18.75%;
}

.pause-button {
  position: absolute;
  z-index: 12;
  left: -0.9375cqh;
  top: 0;
  width: 11.5625cqh;
  height: 11.5625cqh;
}

html.has-left-safe-area .pause-button {
  left: calc(var(--safe-left) + var(--hud-edge-gap));
}

.pause-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.debug-panel {
  position: absolute;
  z-index: 40;
  top: 10cqh;
  right: max(8px, 3.125cqh);
  width: min(244px, calc(100% - 16px));
  max-height: calc(90cqh - 8px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid rgba(123, 255, 166, 0.74);
  border-radius: 6px;
  color: #d9ffe5;
  background: rgba(0, 12, 5, 0.9);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.48);
  font: 10px/1.42 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: -0.01em;
  scrollbar-color: rgba(123, 255, 166, 0.74) rgba(0, 12, 5, 0.45);
  scrollbar-width: thin;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.debug-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #fff;
  letter-spacing: 0.08em;
}

.debug-panel__header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.debug-panel__header span {
  color: #61ff94;
  font-size: 9px;
}

.debug-panel__collapse {
  display: grid;
  width: 22px;
  height: 20px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(217, 255, 229, 0.7);
  border-radius: 4px;
  color: #d9ffe5;
  background: rgba(32, 75, 47, 0.9);
  font: 700 15px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
  pointer-events: auto;
}

.debug-panel.is-collapsed {
  width: auto;
  min-width: 112px;
  overflow: hidden;
}

.debug-panel.is-collapsed .debug-panel__header {
  margin-bottom: 0;
}

.debug-panel.is-collapsed .debug-panel__header span,
.debug-panel.is-collapsed .debug-panel__controls,
.debug-panel.is-collapsed .debug-panel__metrics {
  display: none;
}

.debug-panel__controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  margin-bottom: 7px;
  pointer-events: auto;
}

.debug-panel__toggle,
.debug-panel__test {
  width: 100%;
  margin: 0;
  padding: 5px 7px;
  border: 1px solid #61ff94;
  border-radius: 4px;
  color: #001b09;
  background: #61ff94;
  font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
  pointer-events: auto;
}

.debug-panel__test {
  width: auto;
  border-color: rgba(217, 255, 229, 0.6);
  color: #d9ffe5;
  background: rgba(32, 75, 47, 0.9);
  font-weight: 600;
}

.debug-panel__mythical,
.debug-panel__score-rate {
  grid-column: 1 / -1;
}

.debug-panel__grant {
  grid-column: 1 / -1;
  width: 100%;
}

.debug-panel__toggle.is-off {
  border-color: #ffca58;
  color: #fff3d2;
  background: rgba(145, 87, 0, 0.78);
}

.debug-panel__metrics {
  margin: 0;
  color: inherit;
  font: inherit;
  white-space: pre;
}

.panel-screen {
  left: 50%;
  right: auto;
  width: min(100%, 150cqh);
  transform: translateX(-50%);
  background: #000;
  color: #fff;
}

.area-stats {
  position: absolute;
  left: 21.875cqh;
  top: 5.9375cqh;
  width: 121.875cqh;
  font-size: 5.3125cqh;
}

.area-stats > div {
  height: 6.5625cqh;
  line-height: 6.5625cqh;
}

.area-stats > div + div {
  margin-top: 2.1875cqh;
}

.area-grid {
  position: absolute;
  left: 21.875cqh;
  top: 25.9375cqh;
  width: 106.5625cqh;
  height: 35cqh;
}

.area-button {
  position: absolute;
  height: 15.3125cqh;
  display: grid;
  place-items: center;
  isolation: isolate;
  font: 700 9.0625cqh "Arial Rounded MT Bold", Arial, sans-serif;
}

.area-button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--button-bg);
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.area-button.locked {
  color: rgba(255, 255, 255, 0.3);
}

.area-button.locked::before {
  opacity: 0.3;
}

.area-button img {
  position: absolute;
  width: 9.375cqh;
  height: 10.3125cqh;
}

.area-button.selected::after {
  content: "";
  position: absolute;
  width: 2.5cqh;
  height: 3.4375cqh;
  left: calc(50% - 1.25cqh);
  top: -3.4375cqh;
  background-image: url("public/original/images/Cat Images/ChaiRight1.png");
  background-size: 100% 100%;
  image-rendering: pixelated;
}

.area-1 {
  left: 0;
  top: 0;
  width: 15.3125cqh;
}

.area-2 {
  left: 20cqh;
  top: 0;
  width: 23.125cqh;
}

.area-3 {
  left: 47.1875cqh;
  top: 0;
  width: 27.5cqh;
}

.area-4 {
  left: 79.0625cqh;
  top: 0;
  width: 27.5cqh;
}

.area-5 {
  left: 6.875cqh;
  top: 19.6875cqh;
  width: 27.5cqh;
}

.area-6 {
  left: 39.375cqh;
  top: 19.6875cqh;
  width: 27.5cqh;
}

.area-7 {
  left: 71.875cqh;
  top: 19.6875cqh;
  width: 27.5cqh;
}

.start-button {
  position: absolute;
  left: 49.0625cqh;
  top: 65.3125cqh;
  width: 47.5cqh;
  height: 28.4375cqh;
  background-image: url("public/original/images/Other/ButtonRect.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  font: 400 15.9375cqh "Avenir Next", Arial, sans-serif;
}

.back-button {
  position: absolute;
  display: grid;
  place-items: center;
  right: 0;
  bottom: 0;
  width: 26.875cqh;
  height: 19.0625cqh;
  font: 700 6.25cqh "Arial Rounded MT Bold", Arial, sans-serif;
}

.back-button-label {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  pointer-events: none;
}

.options-screen {
  padding: 0;
}

.option-row {
  display: contents;
}

.credits-screen {
  padding: 0;
  background: transparent;
  text-align: center;
}

.credits-byline,
.credits-developer,
.credits-edition {
  position: absolute;
  left: 0;
  width: 100%;
  margin: 0;
  color: #fff;
  line-height: 1;
}

.credits-byline {
  top: 25.625cqh;
  height: 6.25cqh;
}

.credits-developer {
  top: 33.75cqh;
  height: 11.25cqh;
}

.credits-edition {
  top: 47.5cqh;
  height: 5.625cqh;
}

.credits-raster-source {
  visibility: hidden;
}

.credits-text-raster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  pointer-events: none;
}

.credits-catalog {
  position: absolute;
  z-index: 3;
  top: 65.625cqh;
  left: 50%;
  display: flex;
  gap: 2.13cqh;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
}

.credits-app-link {
  display: block;
  flex: 0 0 auto;
  width: 8cqh;
  height: 8cqh;
  padding: 0;
  overflow: hidden;
  border: max(1px, 0.27cqh) solid #fff;
  border-radius: 0;
  outline: 0;
  background: #000;
  touch-action: none;
}

.credits-app-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
  pointer-events: none;
}

.credits-app-link:focus-visible {
  outline: max(2px, 0.8cqh) solid #fff36b;
  outline-offset: max(1px, 0.5cqh);
}

.credits-app-link:active {
  transform: translateY(0.8cqh);
  border-width: max(1px, 0.27cqh);
}

.option-copy {
  position: absolute;
  display: grid;
  grid-auto-rows: 6.5625cqh;
  gap: 5cqh;
  font-size: 4.375cqh;
  line-height: 6.5625cqh;
  white-space: nowrap;
}

.option-row:nth-of-type(1) .option-copy {
  left: 86.875cqh;
  top: 6.25cqh;
}

.option-row:nth-of-type(2) .option-copy {
  left: 61.25cqh;
  top: 33.4375cqh;
}

.option-row:nth-of-type(3) .option-copy {
  left: 74.6875cqh;
  top: 60.625cqh;
}

.asset-button {
  display: inline-grid;
  place-items: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  min-height: 0;
  font-weight: 700;
  line-height: 1.05;
}

.asset-256 {
  position: absolute;
  left: 6.25cqh;
  top: 6.25cqh;
  width: 73.75cqh;
  height: 18.125cqh;
  background-image: url("public/original/images/Other/ButtonRect256.png");
  font-size: 4.6875cqh;
}

.asset-218 {
  position: absolute;
  left: 6.25cqh;
  top: 60.625cqh;
  width: 61.875cqh;
  height: 18.125cqh;
  background-image: url("public/original/images/Other/ButtonRect218.png");
  font-size: 4.375cqh;
}

.asset-157 {
  position: absolute;
  left: 6.25cqh;
  top: 33.4375cqh;
  width: 49.0625cqh;
  height: 18.125cqh;
  background-image: url("public/original/images/Other/ButtonRect157.png");
  font-size: 4.375cqh;
}

.asset-98 {
  width: 30.625cqh;
  height: 13.4375cqh;
  background-image: url("public/original/images/Other/ButtonRect98.png");
  font-size: 5.625cqh;
}

.asset-67 {
  width: 20.9375cqh;
  height: 13.4375cqh;
  background-image: url("public/original/images/Other/ButtonRect67.png");
  font-size: 5.3125cqh;
}

.modal-overlay {
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.46);
}

.modal-panel {
  width: 84.375cqh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: #111;
  background: rgba(248, 248, 248, 0.96);
  border: 0;
  border-radius: 3.75cqh;
  box-shadow: 0 0.625cqh 4.375cqh rgba(0, 0, 0, 0.42);
}

/* The native pause alert animates while the world is already frozen. Both the
   pause button and interruptions reveal this same overlay exactly once. */
#pauseOverlay:not([hidden]) {
  animation: pause-backdrop-in 200ms ease-out both;
}

#pauseOverlay:not([hidden]) .pause-panel {
  animation: pause-alert-in 200ms ease-out both;
}

@keyframes pause-backdrop-in {
  from { background: rgba(0, 0, 0, 0); }
  to { background: rgba(0, 0, 0, 0.46); }
}

@keyframes pause-alert-in {
  from { opacity: 0; transform: scale(1.15); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #pauseOverlay:not([hidden]),
  #pauseOverlay:not([hidden]) .pause-panel {
    animation-duration: 1ms;
  }
}

.modal-title {
  display: grid;
  place-items: center;
  min-height: 21.875cqh;
  padding: 3.125cqh 5cqh;
  font: 700 5.3125cqh -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.2;
  text-align: center;
}

.modal-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: 100%;
  height: 13.75cqh;
  border-top: 1px solid rgba(60, 60, 67, 0.26);
}

.modal-actions button {
  border: 0;
  padding: 0;
  color: #007aff;
  background: transparent;
  font: 400 5.3125cqh -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
}

.modal-actions button + button {
  border-left: 1px solid rgba(60, 60, 67, 0.26);
}

.notice-panel {
  min-height: 36.875cqh;
}

.notice-message {
  min-height: 0;
  margin: -2.5cqh 5cqh 4.375cqh;
  font-size: 4.0625cqh;
  line-height: 1.35;
  text-align: center;
}

.locked-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
}

.requirements-panel {
  position: absolute;
  left: 50%;
  top: 12.5cqh;
  width: 101.875cqh;
  height: 56.5625cqh;
  transform: translateX(-50%);
}

.requirements-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.requirements-heading {
  position: absolute;
  left: 41.5625cqh;
  top: 5cqh;
  width: 24.0625cqh;
  height: 6.5625cqh;
  font-size: 5.3125cqh;
  line-height: 6.5625cqh;
}

.requirements-list {
  position: absolute;
  inset: 0;
  font-size: 5.3125cqh;
}

.requirement-row {
  position: absolute;
  left: 6.25cqh;
  width: 95.625cqh;
  height: 6.5625cqh;
  display: grid;
  grid-template-columns: 78.75cqh 16.875cqh;
  line-height: 6.5625cqh;
}

.requirement-row:nth-child(1) {
  top: 25.625cqh;
}

.requirement-row:nth-child(2) {
  top: 34.6875cqh;
}

.requirement-row:nth-child(3) {
  top: 43.75cqh;
}

.requirements-close {
  position: absolute;
  left: 85.3125cqh;
  top: 0;
  width: 16.5625cqh;
  height: 18.4375cqh;
  border: 0;
  padding: 0;
  color: #f00;
  background: transparent;
  font-size: 12.5cqh;
  line-height: 18.4375cqh;
  cursor: pointer;
}

.screen-dimmed {
  opacity: 0.2;
  pointer-events: none;
}

.tutorial-overlay {
  z-index: 11;
  pointer-events: none;
}


.game-over-overlay {
  display: block;
  background: transparent;
}

.game-over-panel {
  position: absolute;
  left: 50%;
  top: 3.125cqh;
  width: min(100%, 150cqh);
  height: 82.8125cqh;
  transform: translateX(-50%);
  color: #fff;
  background: #000;
}

.game-over-score {
  position: absolute;
  left: 19.1667%;
  top: 7.5472%;
  width: 61.875%;
  font: 15.625cqh "Academy Engraved LET", "Times New Roman", serif;
  line-height: 1;
  text-align: center;
}

.game-over-best {
  position: absolute;
  left: 26.0417%;
  top: 41.1321%;
  width: 48.125%;
  font: 8.75cqh "Academy Engraved LET", "Times New Roman", serif;
  line-height: 1;
  text-align: center;
}

.revive-button {
  position: absolute;
  left: 75.4167%;
  top: 12.0755%;
  width: 20.4167%;
  font-size: 5.9375cqh;
}

.revive-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.revive-label {
  position: absolute;
  left: 70.8333%;
  top: 31.3208%;
  width: 29.1667%;
  text-align: center;
}

.revive-count {
  font-size: 4.6875cqh;
  line-height: 1;
}

.revive-reward-hint {
  margin-top: 1.875cqh;
  font-size: 3.125cqh;
  line-height: 1.2;
}

.game-over-actions {
  display: contents;
}

#replayButton,
#exitButton {
  position: absolute;
  top: 76.2264%;
  font-size: 5.9375cqh;
}

#replayButton {
  left: 30.3125%;
  width: 20.4167%;
}

#exitButton {
  left: 55.7292%;
  width: 13.9583%;
}

/* Portrait phones and unusually shaped desktop browser windows are gated:
   gameplay and its original control spacing need a landscape-sized surface. */
.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: 1001;
}

.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);
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.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;
}

/* Preserve the native guard artwork at ordinary sizes, but let every part of
   the composition follow the limiting viewport edge in exceptionally short
   or narrow desktop windows. */
@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;
  }

  .game-stage {
    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] .game-stage {
  pointer-events: none;
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  :root {
    --app-vh: 100vh;
    --app-vv-left: 0px;
    --app-vv-top: 0px;
  }

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

  .app-shell {
    inset: 0;
    width: auto;
    height: auto;
    min-height: 0;
    transform: none;
  }

  .install-hint {
    display: none;
  }
}

html.is-installed-app {
  /* Keep 100vh authoritative for the full installed-app lifetime. JavaScript
     only records the fluctuating iOS DOM measurements for recovery/debugging. */
  --app-vh: 100vh;
  --app-vv-left: 0px;
  --app-vv-top: 0px;
}

html.is-installed-app,
html.is-installed-app body {
  height: 100vh;
  min-height: 100vh;
}

html.is-installed-app .app-shell {
  inset: 0;
  width: auto;
  height: auto;
  min-height: 0;
  transform: none;
}

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

@media (max-aspect-ratio: 3 / 2) {
  .game-stage {
    width: 100%;
    max-height: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
  }
}

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