:root {
  color-scheme: dark;
  font-family: "Courier New", ui-monospace, monospace;
  background: #050505;
  color: #fff200;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #050505;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 0.8rem 1.25rem;
  color: #17130a;
  background: #ffd76b;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 #a46d25;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #a46d25;
}

#shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
}

#game-wrap {
  position: relative;
  width: min(100vw, 177.78vh);
  aspect-ratio: 16 / 9;
  max-height: 100vh;
  image-rendering: pixelated;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: 0 0 0 4px #000, 0 20px 70px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

#game,
#game canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  background: #000;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.speech-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  font-family: "Courier New", ui-monospace, monospace;
  image-rendering: auto;
}

.world-speech-bubble {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  min-height: var(--speech-min-height, 28px);
  width: var(--speech-width, 160px);
  padding: 7px 10px 8px;
  color: #f4f0dc;
  background: rgba(5, 5, 5, var(--speech-opacity, 0.9));
  border-radius: 5px;
  font-size: var(--speech-font-size, 13px);
  font-weight: 900;
  line-height: 1.16;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
  white-space: normal;
  transform: translate(-9999px, -9999px);
  will-change: transform, opacity;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.world-speech-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid rgba(5, 5, 5, var(--speech-opacity, 0.9));
}

.world-speech-bubble.is-hidden {
  display: none;
}

#hud {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  color: #f4dcb0;
  text-shadow: 2px 2px 0 #000;
}

#hud[hidden] {
  display: none;
}

.hud-cluster,
.hud-equipped,
.hud-score {
  position: absolute;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
}

.hud-top-left {
  top: 12px;
  left: 18px;
  gap: 12px;
}

.hud-top-right {
  top: 12px;
  right: 18px;
  gap: 12px;
}

.hud-equipped {
  left: 18px;
  bottom: 18px;
  gap: 12px;
}

.hud-equipped-icons {
  position: relative;
  flex: 0 0 clamp(82px, 13vw, 132px);
  width: clamp(82px, 13vw, 132px);
  height: clamp(82px, 13vw, 132px);
}

.hud-score {
  right: 18px;
  bottom: 18px;
  display: grid;
  justify-items: end;
}

.hud-quests {
  position: absolute;
  top: clamp(72px, 8.6vw, 104px);
  right: 24px;
  display: grid;
  justify-items: end;
  gap: 6px;
  max-width: min(430px, 42vw);
  padding: 2px 0;
  color: rgba(244, 220, 176, 0.92);
  font-size: clamp(0.62rem, 1.08vw, 0.86rem);
  font-weight: 900;
  line-height: 1.08;
  text-align: right;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000, 0 0 8px rgba(0, 0, 0, 0.72);
}

.hud-quests[hidden] {
  display: none;
}

.hud-quest {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.82;
}

.hud-quest.is-complete {
  color: rgba(213, 173, 115, 0.66);
  opacity: 0.72;
}

.boss-health {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 4vw, 44px);
  width: clamp(236px, 28vw, 336px);
  aspect-ratio: 336 / 58;
  transform: translateX(-50%);
  pointer-events: none;
}

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

.boss-health-frame {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  aspect-ratio: 336 / 34;
  background-image: url("../public/assets/boss/colossus/healthbar_empty.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.75)) drop-shadow(0 0 9px rgba(0, 0, 0, 0.72));
  overflow: hidden;
}

.boss-health span {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("../public/assets/boss/colossus/healthbar_full.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  clip-path: inset(0 6.845% 0 0);
}

.boss-health strong {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 18px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #f4dcb0;
  font-size: clamp(11px, 1.25vw, 16px);
  line-height: 1;
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 0;
  pointer-events: none;
}

.bird-cooldown {
  --bird-cooldown-progress: 0;
  --bird-cooldown-hidden: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bird-cooldown[hidden] {
  display: none;
}

.bird-cooldown-icon {
  position: relative;
  width: clamp(24px, 2.55vw, 34px);
  height: clamp(24px, 2.55vw, 34px);
  display: block;
  flex: 0 0 auto;
}

.bird-cooldown-icon-empty,
.bird-cooldown-icon-full {
  position: absolute;
  inset: 0;
  display: block;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: contain;
  image-rendering: pixelated;
}

.bird-cooldown-icon-empty {
  background-image: url("../public/assets/environment/bird_cooldown_empty.png?v=20260606-bird-cooldown-assets");
  filter: drop-shadow(2px 2px 0 #000);
}

.bird-cooldown-icon-full {
  background-image: url("../public/assets/environment/bird_cooldown_full.png?v=20260606-bird-cooldown-assets");
  clip-path: inset(var(--bird-cooldown-hidden) 0 0 0);
  filter: drop-shadow(2px 2px 0 #000);
}

.bird-cooldown[data-variant="flower"] .bird-cooldown-icon-empty {
  background-image: url("../public/assets/environment/flower_cooldown_empty.png?v=20260627-admin-settings");
}

.bird-cooldown[data-variant="flower"] .bird-cooldown-icon-full {
  background-image: url("../public/assets/environment/flower_cooldown_full.png?v=20260627-admin-settings");
}

.hud-keycap {
  display: inline-grid;
  min-width: clamp(50px, 4.8vw, 66px);
  height: clamp(20px, 1.9vw, 26px);
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 4px;
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.24), 2px 2px 0 #000;
  font-size: clamp(0.48rem, 0.92vw, 0.66rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 1px 1px 0 #000;
}

.hud-keycap[hidden] {
  display: none;
}

.bird-cooldown-key {
  min-width: clamp(42px, 4vw, 54px);
}

.item-action-key {
  justify-self: start;
  margin-top: 5px;
}

.label {
  display: block;
  color: #d5ad73;
  font-size: clamp(0.62rem, 1.25vw, 0.9rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000;
}

#hud strong {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: #f4dcb0;
  font-size: clamp(0.86rem, 1.7vw, 1.25rem);
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000;
}

.hud-lives,
.hud-counter {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hud-lives {
  gap: 0;
}

.hud-lives img {
  width: clamp(38px, 6vw, 60px);
  height: clamp(38px, 6vw, 60px);
  object-fit: contain;
  image-rendering: pixelated;
}

.hud-lives img + img {
  margin-left: clamp(-17px, -1.8vw, -9px);
}

.hud-lives img.is-regenerated {
  animation: regeneratedHeartFade 520ms ease-out both;
}

.hud-counter img {
  width: clamp(44px, 6vw, 68px);
  height: clamp(44px, 6vw, 68px);
  object-fit: contain;
  image-rendering: pixelated;
}

.hud-equipped-icons img {
  position: absolute;
  left: 0;
  bottom: 0;
  width: clamp(76px, 12vw, 124px);
  height: clamp(76px, 12vw, 124px);
  object-fit: contain;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 0 #000);
}

.hud-equipped-icons img + img {
  left: auto;
  right: 0;
  bottom: 0;
  width: clamp(48px, 7vw, 76px);
  height: clamp(48px, 7vw, 76px);
}

.hud-divider {
  width: 2px;
  height: 30px;
  background: rgba(213, 173, 115, 0.35);
  box-shadow: 1px 0 0 #000;
}

.hud-timer {
  display: grid;
  min-width: 54px;
}

#time {
  color: #f4dcb0 !important;
}

.panel {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.42);
}

.panel[hidden] {
  display: none;
}

.panel h1 {
  margin: 0;
  color: #fff200;
  font-size: clamp(2.6rem, 9vw, 5.6rem);
  line-height: 0.9;
  text-shadow: 4px 4px 0 #ff2020, 8px 8px 0 #124cff;
}

.panel p {
  width: min(620px, 92vw);
  margin: 0 auto;
  color: #ffffff;
  font-size: clamp(0.95rem, 2.4vw, 1.18rem);
  line-height: 1.45;
}

.loading-panel {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: #000;
}

.loading-panel[hidden] {
  display: none;
}

.loading-runner {
  --loading-runner-frames: 2;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 152px;
}

.loading-speech {
  position: relative;
  min-width: 116px;
  padding: 9px 14px;
  color: #f4f0dc;
  background: rgba(5, 5, 5, 0.92);
  border-radius: 5px;
  font-size: clamp(0.8rem, 1.8vw, 1rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 2px 2px 0 #000;
}

.loading-speech::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 9px solid rgba(5, 5, 5, 0.92);
  transform: translateX(-50%);
}

.loading-sprite-frame {
  width: 238px;
  height: 238px;
  overflow: hidden;
  image-rendering: pixelated;
  transform: scale(0.46);
  transform-origin: center top;
  margin-bottom: -128px;
}

.loading-runner-sprite {
  width: 238px;
  height: 238px;
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: auto 714px;
  image-rendering: pixelated;
  animation: loading-runner-run 420ms steps(var(--loading-runner-frames)) infinite;
}

.loading-runner-gabi .loading-runner-sprite {
  background-size: auto 715px;
}

.loading-runner-cat .loading-sprite-frame {
  transform: scale(0.42);
  margin-bottom: -138px;
}

@keyframes loading-runner-run {
  from {
    transform: translateX(0);
  }

  to {
    background-position-x: calc(-238px * var(--loading-runner-frames));
  }
}

.loading-track {
  width: min(520px, 76vw);
  height: 18px;
  overflow: hidden;
  border: 3px solid #124cff;
  background: #050505;
  box-shadow: 0 0 0 3px #000;
}

.loading-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #30f048, #fff200);
  transition: width 120ms linear;
}

.loading-panel p {
  width: min(520px, 82vw);
  margin: 0 auto;
  color: #ffffff;
  font-size: clamp(0.9rem, 2.2vw, 1.05rem);
  line-height: 1.35;
}

.game-over-panel {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(22px, 4vw, 48px);
  text-align: center;
  background: rgba(0, 0, 0, 0.72);
}

.game-over-panel[hidden] {
  display: none;
}

.game-over-card {
  display: grid;
  justify-items: center;
  gap: clamp(14px, 2.4vw, 24px);
  width: min(680px, 94%);
  padding: clamp(22px, 4vw, 38px);
  background: rgba(0, 0, 0, 0.72);
  border: 3px solid rgba(244, 220, 176, 0.62);
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.48);
}

.game-over-card h1 {
  margin: 0;
  color: #fff200;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 0.9;
  text-shadow: 4px 4px 0 #ff2020, 8px 8px 0 #124cff;
}

.game-over-card p {
  width: min(520px, 100%);
  margin: 0;
  color: #f4dcb0;
  font-size: clamp(0.95rem, 2vw, 1.16rem);
  line-height: 1.35;
}

.game-over-score {
  display: grid;
  gap: 4px;
}

.game-over-score span {
  color: #d5ad73;
  font-size: clamp(0.85rem, 1.8vw, 1.08rem);
  font-weight: 900;
  text-transform: uppercase;
}

.game-over-score strong {
  color: #f4dcb0;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1;
  text-shadow: 3px 3px 0 #000;
}

.game-over-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.main-menu,
.menu-panel {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 42px);
  text-align: center;
  background: rgba(0, 0, 0, 0.28);
}

.main-menu-layout {
  position: relative;
  width: min(760px, 88%);
}

.game-version {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 1;
  padding: 4px 7px;
  left: auto;
  color: rgba(244, 220, 176, 0.9);
  font-size: clamp(0.72rem, 1.45vw, 0.95rem);
  font-weight: 900;
  text-shadow: 2px 2px 0 #000;
}

.main-menu[hidden],
.menu-panel[hidden] {
  display: none;
}

.main-menu-card,
.menu-panel-card {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(680px, 92%);
  padding: clamp(20px, 4vw, 34px);
  background: rgba(0, 0, 0, 0.72);
  border: 3px solid rgba(244, 220, 176, 0.58);
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.46);
}

.main-menu-card {
  grid-template-columns: minmax(230px, 0.78fr) minmax(220px, 0.72fr);
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-height: min(620px, 88vh);
  padding: 0;
  overflow: hidden;
}

.main-menu-promo-wrap {
  position: relative;
  min-height: 420px;
  background: #050505;
  border-right: 3px solid rgba(244, 220, 176, 0.58);
}

.main-menu-promo {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: contain;
  background: #050505;
}

.main-menu-actions,
.menu-panel-content {
  display: grid;
  gap: 12px;
  width: min(340px, 100%);
}

.main-menu-actions {
  align-content: center;
  justify-self: stretch;
  width: auto;
  padding: clamp(22px, 4vw, 42px);
}

.main-menu-best-score {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-bottom: 4px;
  color: #f4dcb0;
  text-shadow: 2px 2px 0 #000;
}

.main-menu-best-score span {
  color: #d5ad73;
  font-size: clamp(0.8rem, 1.8vw, 1rem);
  font-weight: 900;
  text-transform: uppercase;
}

.main-menu-best-score strong {
  color: #fff200;
  font-size: clamp(1.25rem, 3.4vw, 2.1rem);
  line-height: 1;
}

.main-menu-difficulty {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: #f4dcb0;
  text-shadow: 2px 2px 0 #000;
}

.main-menu-difficulty > span {
  color: #d5ad73;
  font-size: clamp(0.76rem, 1.6vw, 0.95rem);
  font-weight: 900;
  text-transform: uppercase;
}

.difficulty-toggle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  width: min(300px, 100%);
}

.difficulty-toggle button {
  padding: 0.56rem 0.58rem;
  color: #f4dcb0;
  background: rgba(244, 220, 176, 0.08);
  border: 2px solid rgba(244, 220, 176, 0.52);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.65);
  text-shadow: 2px 2px 0 #000;
}

.difficulty-toggle button.is-active {
  color: #17130a;
  text-shadow: none;
  box-shadow: 0 5px 0 #a46d25;
}

#difficulty-easy.is-active {
  background: #56d46d;
  border-color: #56d46d;
  box-shadow: 0 5px 0 #237a32;
}

#difficulty-normal.is-active {
  background: #f4dcb0;
  border-color: #fff4d2;
  box-shadow: 0 5px 0 #8d754e;
}

#difficulty-hard.is-active {
  background: #f04a3f;
  border-color: #f04a3f;
  box-shadow: 0 5px 0 #8b1f18;
}

.main-menu-subtitle {
  margin: 6px 0 0;
  color: #f4dcb0;
  font-size: clamp(0.72rem, 1.5vw, 0.92rem);
  line-height: 1.45;
  text-align: center;
  text-shadow: 2px 2px 0 #000;
}

@media (max-width: 680px) {
  .main-menu-layout {
    width: min(390px, 90%);
  }

  .main-menu-card {
    grid-template-columns: 1fr;
  }

  .main-menu-promo {
    max-height: 54vh;
    min-height: 0;
  }

  .main-menu-promo-wrap {
    min-height: 0;
    border-right: 0;
    border-bottom: 3px solid rgba(244, 220, 176, 0.58);
  }
}

.credits-list {
  display: grid;
  gap: 16px;
  width: min(540px, 100%);
  text-align: left;
}

.menu-panel.credits-panel {
  align-items: stretch;
  justify-items: stretch;
  padding: clamp(22px, 4vw, 48px);
  background: rgba(0, 0, 0, 0.52);
}

.menu-panel.credits-panel .menu-panel-card {
  width: 100%;
  height: 100%;
  align-content: start;
  justify-items: center;
  gap: clamp(16px, 2.4vw, 28px);
  padding: clamp(18px, 3vw, 34px);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.34);
  border: 0;
  box-shadow: none;
}

.menu-panel.credits-panel .menu-panel-card h2 {
  font-size: clamp(2.6rem, 7.5vw, 5.2rem);
}

.menu-panel.credits-panel .menu-panel-card > p {
  display: none;
}

.menu-panel.credits-panel .menu-panel-content {
  width: min(1040px, 94%);
}

.menu-panel.credits-panel .credits-list {
  align-items: start;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 34px) clamp(22px, 4vw, 54px);
  width: 100%;
  text-align: center;
}

.credits-section {
  display: grid;
  align-content: start;
  gap: 8px;
}

.credits-section h3 {
  margin: 0;
  color: #fff200;
  font-size: clamp(0.95rem, 2.2vw, 1.25rem);
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 2px 2px 0 #000;
}

.credits-names {
  display: grid;
  gap: 2px;
  padding-left: 16px;
}

.menu-panel.credits-panel .credits-names {
  padding-left: 0;
}

.credits-names p {
  width: auto;
  margin: 0;
  color: #f4dcb0;
  font-size: clamp(0.84rem, 1.8vw, 1.05rem);
  font-weight: 400;
  line-height: 1.18;
  text-align: left;
}

.menu-panel.credits-panel .credits-names p {
  text-align: center;
}

@media (max-width: 760px) {
  .menu-panel.credits-panel .credits-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.menu-panel-card h2 {
  margin: 0;
  color: #fff200;
  font-size: clamp(1.6rem, 4.6vw, 2.6rem);
  text-shadow: 3px 3px 0 #ff2020, 6px 6px 0 #124cff;
}

.menu-panel-card p {
  margin: 0;
  color: #f4dcb0;
  font-size: clamp(0.88rem, 2vw, 1.08rem);
  line-height: 1.35;
}

.music-track {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.settings-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 10px 0;
  border-bottom: 1px solid rgba(244, 220, 176, 0.24);
  text-align: left;
}

.settings-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(16px, 3vw, 28px);
  width: min(760px, 100%);
}

.settings-toggle-row:last-child {
  border-bottom: 0;
}

.settings-toggle-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.settings-toggle-copy strong {
  color: #fff200;
  font-size: clamp(0.9rem, 2vw, 1.08rem);
  line-height: 1;
  text-shadow: 2px 2px 0 #000;
}

.settings-toggle-copy span {
  color: rgba(244, 220, 176, 0.86);
  font-size: clamp(0.7rem, 1.55vw, 0.88rem);
  line-height: 1.25;
  text-shadow: 1px 1px 0 #000;
}

.settings-toggle {
  min-width: 76px;
  padding: 0.55rem 0.7rem;
  color: #f4dcb0;
  background: rgba(244, 220, 176, 0.08);
  border: 2px solid rgba(244, 220, 176, 0.52);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.65);
  text-shadow: 2px 2px 0 #000;
}

.settings-toggle.is-active {
  color: #17130a;
  background: #56d46d;
  border-color: #56d46d;
  box-shadow: 0 5px 0 #237a32;
  text-shadow: none;
}

.story-intro {
  position: absolute;
  z-index: 4;
  inset: 0;
  overflow: hidden;
}

.story-intro[hidden] {
  display: none;
}

.story-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(7px) brightness(0.78);
}

.story-panels {
  position: absolute;
  inset: 7% 8% 13%;
  display: grid;
  max-height: 80%;
  gap: 20px;
}

.story-panels.tall {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.story-panels.wide {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.story-frame {
  display: block;
  max-width: 100%;
  object-fit: contain;
  border: 4px solid #080808;
  background: #080808;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.58);
  image-rendering: pixelated;
  opacity: 0;
  filter: saturate(0.9) contrast(1.05);
  vertical-align: top;
}

.story-panels.tall .story-frame {
  width: auto;
  height: min(70vh, 100%);
  max-height: 100%;
}

.story-panels.tall .frame-1 {
  align-self: flex-start;
}

.story-panels.tall .frame-2 {
  align-self: flex-end;
}

.story-panels.wide .story-frame {
  width: auto;
  height: auto;
  max-width: 86%;
  max-height: min(34vh, 100%);
}

.story-panels.wide .frame-1 {
  align-self: flex-start;
}

.story-panels.wide .frame-2 {
  align-self: flex-end;
}

.story-panels.manga-page-v2 {
  inset: auto;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  width: min(92vw, calc(80vh * 1.53));
  max-width: 92vw;
  max-height: 80vh;
  aspect-ratio: 1.53;
  display: grid;
  grid-template-columns: 37.8% minmax(0, 62.2%);
  grid-template-rows: 41.5% 23.5% minmax(0, 35%);
  gap: 18px;
  padding: 0;
  background: transparent;
  transform: translate(-50%, -53%);
  overflow: visible;
}

.story-panels.manga-page-v2 .story-frame {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  border: 3px solid #050505;
  box-shadow: none;
}

.story-panels.manga-page-v2 .frame-1 {
  grid-column: 1 / 3;
  grid-row: 1;
}

.story-panels.manga-page-v2 .frame-2 {
  grid-column: 1;
  grid-row: 2 / 4;
}

.story-panels.manga-page-v2 .frame-3 {
  grid-column: 2;
  grid-row: 2;
}

.story-panels.manga-page-v2 .frame-4 {
  grid-column: 2;
  grid-row: 3;
}

.story-frame.from-top {
  animation: storyFromTop 720ms cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

.story-frame.from-bottom {
  animation: storyFromBottom 720ms cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

.story-frame.from-left {
  animation: storyFromLeft 720ms cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

.story-frame.from-right {
  animation: storyFromRight 720ms cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

.story-frame.delay {
  animation-delay: 920ms;
}

.story-frame.delay-1 {
  animation-delay: 340ms;
}

.story-frame.delay-2 {
  animation-delay: 700ms;
}

.story-frame.delay-3 {
  animation-delay: 1060ms;
}

.story-intro.leaving .story-frame.from-top {
  animation: storyExitTop 760ms cubic-bezier(0.55, 0, 0.85, 0.18) both;
}

.story-intro.leaving .story-frame.from-bottom {
  animation: storyExitBottom 760ms cubic-bezier(0.55, 0, 0.85, 0.18) both;
}

.story-intro.leaving .story-frame.from-left {
  animation: storyExitLeft 760ms cubic-bezier(0.55, 0, 0.85, 0.18) both;
}

.story-intro.leaving .story-frame.from-right {
  animation: storyExitRight 760ms cubic-bezier(0.55, 0, 0.85, 0.18) both;
}

.story-intro.leaving .story-panels.opposed .story-frame.from-left {
  animation: storyExitLeftOpposed 760ms cubic-bezier(0.55, 0, 0.85, 0.18) both;
}

.story-intro.leaving .story-panels.manga-page-v2 .story-frame.from-left {
  animation: storyExitLeftOpposed 760ms cubic-bezier(0.55, 0, 0.85, 0.18) both;
}

.story-intro.leaving .story-frame.delay {
  animation-delay: 0ms;
}

.story-intro.leaving .story-frame.delay-1,
.story-intro.leaving .story-frame.delay-2,
.story-intro.leaving .story-frame.delay-3 {
  animation-delay: 0ms;
}

.story-start {
  position: absolute;
  left: 50%;
  bottom: 7%;
  min-width: 180px;
  transform: translateX(-50%);
}

.story-start[hidden] {
  display: none;
}

.item-pickup {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.38);
}

.item-pickup[hidden] {
  display: none;
}

.item-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: min(360px, 72vw);
  padding: 22px 30px 20px;
  border: 3px solid #1b1b1b;
  background: rgba(0, 0, 0, 0.9);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.62);
  animation: itemPickupIn 420ms cubic-bezier(0.2, 0.86, 0.25, 1) both;
}

.item-card img {
  display: block;
  width: min(240px, 42vw);
  height: min(240px, 42vw);
  object-fit: contain;
  image-rendering: pixelated;
}

.item-card h2,
.item-card p {
  margin: 0;
  text-align: center;
}

.item-card h2 {
  color: #fff200;
  font-size: clamp(1.15rem, 3vw, 1.75rem);
  line-height: 1;
  text-shadow: 2px 2px 0 #6c3000;
}

.item-card p {
  color: #f4f0dc;
  font-size: clamp(0.9rem, 2.4vw, 1.18rem);
  line-height: 1.25;
}

#item-pickup-ok {
  min-width: 112px;
  margin-top: 2px;
  padding: 0.68rem 1.35rem;
}

.cheat-panel {
  z-index: 4;
  background: rgba(0, 0, 0, 0.74);
}

.cheat-panel h1 {
  font-size: clamp(2.1rem, 7vw, 4.6rem);
}

.cheat-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  gap: clamp(18px, 3.2vw, 36px);
  align-items: start;
  width: min(980px, 94vw);
}

.cheat-column {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.cheat-column h2 {
  margin: 0;
  color: #fff200;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  line-height: 1;
  text-shadow: 2px 2px 0 #000;
}

.cheat-levels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.cheat-levels .level-select-episodes {
  width: 100%;
}

.cheat-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 190px));
  gap: 12px;
  justify-content: center;
  width: min(420px, 100%);
  margin-inline: auto;
}

.cheat-levels button,
.cheat-actions button,
#cheat-close {
  min-width: 0;
  padding-inline: 1rem;
  width: 100%;
}

.cheat-settings {
  width: 100%;
  margin: 0;
}

.cheat-settings h2 {
  margin: 0;
  color: #fff200;
  font-size: clamp(1rem, 3vw, 1.35rem);
  line-height: 1;
  text-shadow: 2px 2px 0 #000;
}

@keyframes storyFromTop {
  from {
    opacity: 0;
    transform: translateY(-115%);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes storyFromBottom {
  from {
    opacity: 0;
    transform: translateY(115%);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes storyFromLeft {
  from {
    opacity: 0;
    transform: translateX(-115%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes storyFromRight {
  from {
    opacity: 0;
    transform: translateX(115%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes storyExitTop {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-115%);
  }
}

@keyframes storyExitBottom {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(115%);
  }
}

@keyframes storyExitLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(115%);
  }
}

@keyframes storyExitLeftOpposed {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(-115%);
  }
}

@keyframes storyExitRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(115%);
  }
}

@keyframes itemPickupIn {
  from {
    opacity: 0;
    transform: translateY(72%) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 680px) {
  #shell {
    padding: 8px;
  }

  #game-wrap {
    width: min(100vw, 177.78vh);
    max-height: 100vh;
  }

  .hud-top-left,
  .hud-equipped {
    left: 8px;
  }

  .hud-top-right,
  .hud-score {
    right: 8px;
  }

  .hud-quests {
    top: 64px;
    right: 12px;
    max-width: min(330px, 56vw);
    gap: 4px;
  }

  .hud-top-left,
  .hud-top-right {
    top: 8px;
  }

  .hud-equipped,
  .hud-score {
    bottom: 8px;
  }

  .hud-cluster,
  .hud-equipped,
  .hud-score {
    padding: 6px 7px;
    gap: 7px;
  }

  .cheat-levels {
    grid-template-columns: minmax(0, 220px);
  }

  .cheat-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    width: min(520px, 94vw);
  }

  .cheat-settings .settings-toggle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
  }

  .story-panels {
    inset: 5% 5% 18%;
    gap: 10px;
  }

  .story-panels.tall .story-frame {
    height: min(68vh, 100%);
  }

  .story-panels.manga-page-v2 {
    width: min(94vw, calc(78vh * 1.53));
    max-height: 78vh;
    gap: 14px;
    padding: 0;
  }
}

@media (hover: none) and (pointer: coarse), (max-width: 680px) {
  button {
    border-radius: 5px;
    padding: 0.48rem 0.78rem;
    font-size: clamp(0.72rem, 2.8vmin, 0.95rem);
    line-height: 1.1;
    box-shadow: 0 3px 0 #a46d25;
  }

  button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #a46d25;
  }

  .main-menu,
  .menu-panel,
  .panel,
  .loading-panel,
  .game-over-panel,
  .story-intro,
  .item-pickup {
    position: fixed;
    inset: 0;
    padding: max(7px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
  }

  .main-menu-card,
  .menu-panel-card,
  .game-over-card,
  .item-card {
    max-height: calc(100% - 10px);
    overflow: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .main-menu-card {
    width: min(720px, 96%);
    grid-template-columns: minmax(120px, 0.72fr) minmax(160px, 1fr);
    max-height: calc(100% - 10px);
  }

  .main-menu-promo {
    min-height: 0;
    object-fit: cover;
  }

  .main-menu-actions {
    gap: clamp(5px, 1.4vmin, 9px);
    padding: clamp(9px, 2.8vmin, 18px);
  }

  .main-menu-best-score {
    gap: 1px;
    margin-bottom: 0;
  }

  .main-menu-difficulty {
    gap: 4px;
    margin-bottom: 0;
  }

  .main-menu-difficulty > span {
    font-size: clamp(0.62rem, 2.3vmin, 0.86rem);
  }

  .difficulty-toggle {
    gap: 5px;
  }

  .difficulty-toggle button {
    padding: 0.42rem 0.56rem;
  }

  .main-menu-best-score span,
  .menu-panel-card p,
  .panel p,
  .loading-panel p,
  .game-over-card p,
  .item-card p,
  .main-menu-subtitle {
    font-size: clamp(0.64rem, 2.4vmin, 0.9rem);
    line-height: 1.22;
  }

  .main-menu-best-score strong {
    font-size: clamp(1rem, 4.2vmin, 1.55rem);
  }

  .menu-panel-card {
    width: min(520px, 94%);
    gap: clamp(7px, 1.9vmin, 12px);
    padding: clamp(10px, 2.8vmin, 18px);
  }

  .menu-panel-content,
  .main-menu-actions {
    width: min(270px, 100%);
  }

  .menu-panel-card h2,
  .item-card h2 {
    font-size: clamp(1.05rem, 5vmin, 1.8rem);
  }

  .panel {
    gap: clamp(7px, 2vmin, 12px);
  }

  .panel h1,
  .game-over-card h1,
  .cheat-panel h1 {
    font-size: clamp(1.45rem, 7vmin, 2.8rem);
    text-shadow: 3px 3px 0 #ff2020, 5px 5px 0 #124cff;
  }

  .loading-panel {
    gap: clamp(7px, 2vmin, 12px);
  }

  .loading-track {
    width: min(360px, 78vw);
    height: 12px;
    border-width: 2px;
  }

  .game-over-card {
    width: min(520px, 94%);
    gap: clamp(8px, 2vmin, 14px);
    padding: clamp(11px, 3vmin, 20px);
  }

  .game-over-score strong {
    font-size: clamp(1.15rem, 5.8vmin, 2rem);
  }

  .game-over-actions {
    gap: 8px;
  }

  .story-panels {
    inset: 4% 5% 12%;
    gap: 8px;
    max-height: 78%;
  }

  .story-panels.tall .story-frame {
    height: min(58vh, 100%);
  }

  .story-panels.wide .story-frame {
    width: auto;
    max-width: 90%;
    max-height: min(30vh, 100%);
  }

  .story-panels.manga-page-v2 {
    width: min(96vw, calc(76vh * 1.53));
    max-height: 76vh;
    gap: 8px;
    padding: 0;
  }

  .story-panels.manga-page-v2 .story-frame {
    border-width: 2px;
  }

  .item-card {
    min-width: min(280px, 92%);
    gap: 7px;
    padding: clamp(10px, 3vmin, 16px) clamp(12px, 3.5vmin, 20px);
  }

  .item-card img {
    width: min(128px, 24vmin);
    height: min(128px, 24vmin);
  }

  #item-pickup-ok {
    min-width: 84px;
    padding: 0.46rem 0.9rem;
  }

  .cheat-levels {
    grid-template-columns: repeat(2, minmax(0, 130px));
    gap: 7px;
  }

  .menu-panel.credits-panel {
    padding: 8px;
  }

  .menu-panel.credits-panel .menu-panel-card {
    gap: 10px;
    padding: 10px;
  }

  .menu-panel.credits-panel .menu-panel-card h2 {
    font-size: clamp(1.45rem, 7vmin, 2.8rem);
  }

  .menu-panel.credits-panel .credits-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: portrait), (max-width: 680px) and (orientation: portrait) {
  .main-menu-layout {
    width: min(390px, 94%);
  }

  .main-menu-card {
    grid-template-columns: 1fr;
  }

  .main-menu-promo,
  .main-menu-promo-wrap {
    height: min(26dvh, 34vw, 150px);
  }

  .main-menu-promo-wrap {
    border-right: 0;
    border-bottom: 3px solid rgba(244, 220, 176, 0.58);
  }

  .main-menu-actions {
    justify-self: center;
    width: min(280px, 100%);
    padding: clamp(8px, 2.6vmin, 14px);
  }

  .menu-panel.credits-panel .credits-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 520px), (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .main-menu-layout {
    width: min(690px, 96%);
  }

  .main-menu-promo {
    max-height: calc(100vh - 24px);
  }

  .main-menu-subtitle {
    margin-top: 2px;
  }

  .menu-panel-card,
  .game-over-card,
  .item-card {
    max-height: calc(100vh - 16px);
  }
}

.main-menu {
  place-items: stretch;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: #050505;
}

.main-menu::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.08) 42%, rgba(0, 0, 0, 0.46) 72%, rgba(0, 0, 0, 0.74) 100%),
    radial-gradient(circle at 28% 78%, rgba(255, 229, 176, 0.14), transparent 28%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.52), transparent 34%);
}

.main-menu-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.main-menu.is-panel-backdrop .main-menu-layout {
  visibility: hidden;
  pointer-events: none;
}

.menu-panel {
  place-items: center end;
  padding: clamp(24px, 6vw, 74px);
  overflow: hidden;
  background: transparent;
}

.menu-panel::before,
.menu-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.menu-panel::before {
  display: none;
}

.menu-panel::after {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0.22) 45%, rgba(0, 0, 0, 0.68) 78%, rgba(0, 0, 0, 0.86) 100%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.5), transparent 42%);
}

.menu-panel-card {
  position: relative;
  z-index: 2;
  width: min(420px, 36vw);
  max-height: min(82vh, 620px);
  justify-items: stretch;
  gap: 14px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: center;
  overflow: hidden;
  scrollbar-width: none;
}

.menu-panel-card::-webkit-scrollbar {
  display: none;
}

.menu-panel-card h2,
.menu-panel-card p {
  text-align: center;
}

.menu-panel-card .menu-panel-content {
  width: 100%;
}

.menu-panel[data-panel="settings"] .menu-panel-card {
  width: min(820px, 88vw);
  max-height: min(640px, 90vh);
  gap: 10px;
  padding: clamp(16px, 3vw, 28px);
}

.menu-panel[data-panel="settings"] .menu-panel-content {
  min-height: 0;
}

.menu-panel[data-panel="settings"] .settings-toggle-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(12px, 2vw, 22px);
  width: 100%;
}

.menu-panel[data-panel="settings"] .settings-toggle-row {
  padding: 7px 0;
}

.menu-panel[data-panel="settings"] .menu-panel-card h2 {
  font-size: clamp(1.4rem, 3.2vw, 2.25rem);
}

.menu-panel[data-panel="settings"] .menu-panel-card p {
  font-size: clamp(0.78rem, 1.55vw, 0.98rem);
  line-height: 1.25;
}

.level-select-episodes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2.6vw, 22px);
  width: 100%;
}

.level-select-episode {
  display: grid;
  gap: 8px;
  align-content: start;
}

.level-select-episode h3 {
  margin: 4px 0 0;
  color: #fff200;
  font-size: clamp(0.9rem, 1.7vw, 1.1rem);
  line-height: 1;
  text-align: center;
  text-shadow: 2px 2px 0 #000;
}

.level-select-buttons {
  display: grid;
  gap: 9px;
}

.main-menu-layout {
  position: absolute;
  top: 50%;
  right: clamp(30px, 6vw, 88px);
  z-index: 3;
  width: min(310px, 31vw);
  transform: translateY(-50%);
}

.main-menu-actions {
  width: 100%;
  padding: 0;
  gap: 12px;
  align-content: center;
  justify-self: stretch;
}

.main-menu-actions > button {
  width: 100%;
}

#menu-panel-close {
  justify-self: center;
  min-width: 132px;
  color: #f4dcb0;
  background: rgba(244, 220, 176, 0.08);
  border: 2px solid rgba(244, 220, 176, 0.52);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.65);
  text-shadow: 2px 2px 0 #000;
}

#menu-panel-close:active {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.65);
}

.main-menu-best-score,
.main-menu-difficulty {
  padding: 10px 12px;
  border: 2px solid rgba(244, 220, 176, 0.24);
  border-radius: 6px;
  background: rgba(6, 5, 4, 0.44);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.main-menu-petals {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.main-menu-petals span {
  position: absolute;
  left: var(--petal-start);
  top: var(--petal-top);
  width: 193px;
  height: 193px;
  background-image: url("../public/assets/environment/flower_petal.png");
  background-repeat: no-repeat;
  background-size: 300% 100%;
  background-position: calc(var(--petal-frame) * -193px) 0;
  image-rendering: pixelated;
  opacity: 0;
  transform: translate3d(-20vw, 0, 0) scaleX(var(--petal-flip)) scale(var(--petal-scale)) rotate(0deg);
  animation: main-menu-petal-float var(--petal-duration) linear var(--petal-delay) infinite;
}

@keyframes main-menu-petal-float {
  0% {
    opacity: 0;
    transform: translate3d(-22vw, -4vh, 0) scaleX(var(--petal-flip)) scale(var(--petal-scale)) rotate(0deg);
  }
  12% {
    opacity: 0.72;
  }
  56% {
    opacity: 0.56;
    transform: translate3d(calc(42vw + var(--petal-drift)), 13vh, 0) scaleX(var(--petal-flip)) scale(var(--petal-scale)) rotate(calc(var(--petal-spin) * 0.58));
  }
  92% {
    opacity: 0.62;
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(118vw + var(--petal-drift)), 30vh, 0) scaleX(var(--petal-flip)) scale(var(--petal-scale)) rotate(var(--petal-spin));
  }
}

@keyframes regeneratedHeartFade {
  from {
    opacity: 0;
    transform: scale(0.55);
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  }

  45% {
    opacity: 0.78;
    transform: scale(1.24);
    filter: drop-shadow(0 0 12px rgba(255, 245, 220, 0.92));
  }

  to {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 3px 0 #000);
  }
}

.game-version {
  right: clamp(12px, 2vw, 22px);
  bottom: clamp(10px, 1.8vw, 18px);
  z-index: 4;
  padding: 0;
  color: rgba(244, 220, 176, 0.82);
  font-size: clamp(0.66rem, 1.1vw, 0.84rem);
  background: transparent;
}

@media (max-width: 760px) {
  .main-menu-layout {
    right: clamp(14px, 4vw, 28px);
    width: min(270px, 40vw);
  }

  .main-menu-actions {
    gap: 8px;
  }

  .main-menu-best-score,
  .main-menu-difficulty {
    padding: 7px 8px;
  }

  .menu-panel {
    padding: clamp(14px, 4vw, 26px);
  }

  .menu-panel-card {
    width: min(320px, 44vw);
  }

  .cheat-body {
    grid-template-columns: minmax(0, 1fr);
    width: min(520px, 92vw);
  }

  .cheat-settings .settings-toggle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) and (orientation: portrait), (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .main-menu-layout {
    top: auto;
    right: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(300px, 84vw);
    transform: translateX(50%);
  }

  .main-menu::after {
    background:
      linear-gradient(0deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.44) 46%, rgba(0, 0, 0, 0.12) 100%),
      radial-gradient(circle at 46% 40%, rgba(255, 229, 176, 0.12), transparent 34%);
  }

  .game-version {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(7px, env(safe-area-inset-bottom));
  }

  .menu-panel {
    place-items: end center;
  }

  .menu-panel-card {
    width: min(330px, 88vw);
    max-height: 62vh;
  }

  .menu-panel[data-panel="settings"] .menu-panel-card {
    width: min(330px, 88vw);
    max-height: 66vh;
  }

  .menu-panel[data-panel="settings"] .settings-toggle-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cheat-body,
  .cheat-settings .settings-toggle-grid,
  .cheat-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}
