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

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

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

.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-counter img {
  width: clamp(44px, 6vw, 68px);
  height: clamp(44px, 6vw, 68px);
  object-fit: contain;
  image-rendering: pixelated;
}

.hud-equipped img {
  width: clamp(76px, 12vw, 124px);
  height: clamp(76px, 12vw, 124px);
  object-fit: contain;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.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[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: min(760px, 88%);
  max-height: min(620px, 88vh);
  padding: 0;
  overflow: hidden;
}

.main-menu-promo {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: contain;
  background: #050505;
  border-right: 3px solid rgba(244, 220, 176, 0.58);
}

.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(2, minmax(0, 1fr));
  gap: 8px;
  width: min(260px, 100%);
}

.difficulty-toggle button {
  padding: 0.58rem 0.78rem;
  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-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-card {
    grid-template-columns: 1fr;
    width: min(390px, 90%);
  }

  .main-menu-promo {
    max-height: 54vh;
    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;
}

.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-levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 190px));
  gap: 12px;
  justify-content: center;
}

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

@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);
  }

  .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-y: auto;
    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-card {
    grid-template-columns: 1fr;
    width: min(390px, 94%);
  }

  .main-menu-promo {
    height: min(26dvh, 34vw, 150px);
    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-card {
    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);
  }
}
