:root {
  --ink: #f8f5da;
  --muted: #bfc2a2;
  --deep: #10142d;
  --panel: #20284c;
  --panel-dark: #111832;
  --line: #5d7192;
  --yellow: #ffd35a;
  --cyan: #7de6ff;
  --pink: #ff7aa8;
  --green: #8ff07c;
  --red: #ff6060;
  --shadow: rgba(0, 0, 0, 0.45);
  --font-pixel: "Courier New", "MS Gothic", "Yu Gothic", monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: #f7f7f3;
  color: #0b0b0b;
  font-family: var(--font-pixel);
  letter-spacing: 0;
  width: 100vw;
  height: var(--app-height, 100dvh);
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

button {
  font: inherit;
}

.app-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--app-height, 100dvh);
  display: grid;
  place-items: start center;
  overflow: hidden;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.gba {
  width: min(100vw, 540px);
  height: var(--app-height, 100dvh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  place-items: stretch center;
  align-content: start;
}

.browser-note {
  width: 100%;
  min-height: clamp(28px, 5.2dvh, 46px);
  margin: 0;
  display: grid;
  place-items: center;
  padding: 3px 8px;
  color: #111;
  background: #f7f7f3;
  font-family: "Yu Gothic", "MS Gothic", sans-serif;
  font-size: clamp(12px, 3.2vw, 20px);
  line-height: 1.2;
  text-align: center;
}

.game-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 0;
  max-height: min(45dvh, 360px);
  border: 3px solid #000;
  border-radius: 0;
  background: #0a0e25;
  box-shadow: none;
  overflow: hidden;
  image-rendering: pixelated;
  user-select: none;
  pointer-events: none;
}

.game-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 4px
    ),
    radial-gradient(circle at 50% 45%, transparent 48%, rgba(0, 0, 0, 0.22) 100%);
  mix-blend-mode: screen;
  z-index: 20;
}

.scene {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  background: linear-gradient(#121a45 0%, #111631 55%, #080a18 100%);
}

.intro-view {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f8f8f8;
}

.avenue-logo {
  position: relative;
  z-index: 2;
  width: min(92%, 430px);
  padding: 6px 8px;
  text-align: center;
  background: transparent;
  transform: translateY(-230%);
  animation: logo-drop 1.28s steps(18, end) 0.06s forwards;
  will-change: transform;
}

.avenue-logo-jp,
.avenue-logo-en {
  display: block;
  color: #1f2a22;
  font-family: "MS Gothic", "Yu Gothic", monospace;
  font-weight: 900;
  text-shadow:
    2px 0 0 #1f2a22,
    0 2px 0 #1f2a22,
    2px 2px 0 #6a7663;
}

.avenue-logo-jp {
  font-size: clamp(15px, 4.2vw, 27px);
  line-height: 1.2;
}

.avenue-logo-en {
  margin-top: 7px;
  color: #2f3a31;
  font-size: clamp(11px, 3vw, 18px);
}

.sky {
  position: relative;
  overflow: hidden;
}

.sky::before,
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, #fff6a8 0 1px, transparent 1px),
    radial-gradient(circle, #7de6ff 0 1px, transparent 1px),
    radial-gradient(circle, #ff7aa8 0 1px, transparent 1px);
  background-position:
    10px 18px,
    56px 42px,
    96px 12px;
  background-size:
    88px 64px,
    132px 96px,
    152px 112px;
  opacity: 0.75;
}

.sky::after {
  transform: translateY(10px);
  opacity: 0.42;
  animation: star-drift 18s linear infinite;
}

.bg-orbit {
  background: linear-gradient(#141b4e 0%, #11163a 58%, #222041 59%, #080912 100%);
}

.bg-hangar {
  background:
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(125, 230, 255, 0.11) 38px 40px),
    linear-gradient(#191d3d 0%, #0e132d 54%, #222d3d 55%, #11151e 100%);
}

.bg-asteroid {
  background:
    radial-gradient(circle at 18% 66%, #596173 0 9%, transparent 10%),
    radial-gradient(circle at 74% 45%, #444a5d 0 8%, transparent 9%),
    linear-gradient(#101631 0%, #202646 58%, #080a17 100%);
}

.bg-ending {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 211, 90, 0.35), transparent 26%),
    linear-gradient(#112454 0%, #202f63 45%, #111322 100%);
}

.planet {
  position: absolute;
  width: 88px;
  height: 88px;
  left: -18px;
  top: 22px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 42%),
    repeating-linear-gradient(-18deg, #22b1ba 0 8px, #1d7ca5 8px 14px, #f0c462 14px 20px);
  box-shadow: inset -18px -14px 0 rgba(0, 0, 0, 0.28), 0 0 18px rgba(125, 230, 255, 0.2);
}

.planet.small {
  width: 34px;
  height: 34px;
  left: auto;
  right: 22px;
  top: 18px;
  background: repeating-linear-gradient(28deg, #ff7aa8 0 6px, #663b8d 6px 11px);
}

.deck {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.09), transparent 24% 76%, rgba(255, 255, 255, 0.06)),
    repeating-linear-gradient(90deg, #263044 0 34px, #1b2235 34px 38px);
  border-top: 3px solid #66708d;
}

.ship {
  position: absolute;
  left: 26%;
  bottom: 42%;
  width: 58px;
  height: 24px;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.3));
  animation: hover 1.9s ease-in-out infinite;
}

.ship::before {
  content: "";
  position: absolute;
  inset: 4px 7px 4px 0;
  background: var(--cyan);
  clip-path: polygon(0 50%, 20% 10%, 70% 10%, 100% 50%, 70% 90%, 20% 90%);
  box-shadow: inset -10px -5px 0 #2c80b2;
}

.ship::after {
  content: "";
  position: absolute;
  left: 42px;
  top: 9px;
  width: 18px;
  height: 7px;
  background: var(--yellow);
  box-shadow: 12px 0 0 rgba(255, 122, 168, 0.85);
}

.hero,
.enemy {
  position: absolute;
  bottom: 31%;
  width: 40px;
  height: 52px;
  filter: drop-shadow(0 7px 0 rgba(0, 0, 0, 0.28));
}

.hero {
  left: 18%;
}

.enemy {
  right: 18%;
  transform: scaleX(-1);
}

.hero::before,
.enemy::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 2px;
  width: 22px;
  height: 20px;
  background: var(--yellow);
  border: 3px solid #3b315a;
  border-radius: 45% 45% 35% 35%;
  box-shadow:
    0 18px 0 2px #4dc0e6,
    -8px 25px 0 -2px #2f7fc2,
    8px 25px 0 -2px #2f7fc2;
}

.hero::after,
.enemy::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 9px;
  width: 4px;
  height: 4px;
  background: #10142d;
  box-shadow: 10px 0 0 #10142d, 5px 16px 0 5px #ff7aa8;
}

.enemy::before {
  background: #b7ffef;
  box-shadow:
    0 18px 0 2px #ff7aa8,
    -8px 25px 0 -2px #a94f8a,
    8px 25px 0 -2px #a94f8a;
}

.bubble {
  position: absolute;
  right: 16%;
  bottom: 58%;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  animation: bubble 1.5s ease-in-out infinite;
}

.bubble:nth-child(2) {
  right: 24%;
  animation-delay: 0.25s;
}

.bubble:nth-child(3) {
  right: 12%;
  animation-delay: 0.5s;
}

.battle-field {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 5px
    ),
    linear-gradient(#8cc8e8 0%, #d5f2ff 34%, #8fbf7a 35%, #4f8b58 100%);
}

.battle-field::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 74% 37%, rgba(255, 255, 255, 0.36), transparent 0 26%, rgba(38, 73, 58, 0.1) 27% 33%, transparent 34%),
    radial-gradient(ellipse at 26% 72%, rgba(255, 255, 255, 0.34), transparent 0 27%, rgba(38, 73, 58, 0.12) 28% 35%, transparent 36%);
}

.battle-platform {
  position: absolute;
  height: 18px;
  border-radius: 50%;
  background: repeating-linear-gradient(90deg, #d8efae 0 8px, #b8da86 8px 16px);
  border: 3px solid #57743d;
  box-shadow: 0 6px 0 rgba(42, 67, 43, 0.28);
}

.battle-platform.enemy-platform {
  width: 108px;
  right: 35px;
  top: 76px;
}

.battle-platform.player-platform {
  width: 132px;
  left: 28px;
  bottom: 34px;
}

.trainer-back,
.wild-foe {
  position: absolute;
  z-index: 2;
  image-rendering: pixelated;
  filter: drop-shadow(0 7px 0 rgba(0, 0, 0, 0.22));
}

.trainer-back {
  left: 62px;
  bottom: 47px;
  width: 42px;
  height: 56px;
}

.trainer-back::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 0;
  width: 24px;
  height: 20px;
  background: #ffd35a;
  border: 3px solid #3b315a;
  border-radius: 40% 40% 30% 30%;
  box-shadow:
    0 18px 0 3px #4dc0e6,
    -7px 28px 0 -1px #2f7fc2,
    7px 28px 0 -1px #2f7fc2,
    0 44px 0 -5px #111832;
}

.wild-foe {
  right: 71px;
  top: 43px;
  width: 50px;
  height: 52px;
}

.wild-foe::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 7px;
  width: 34px;
  height: 32px;
  background:
    radial-gradient(circle at 35% 40%, #10142d 0 2px, transparent 3px),
    radial-gradient(circle at 64% 40%, #10142d 0 2px, transparent 3px),
    #b7ffef;
  border: 3px solid #3b315a;
  border-radius: 46% 46% 38% 38%;
  box-shadow:
    0 15px 0 0 #ff7aa8,
    -11px 18px 0 -3px #a94f8a,
    11px 18px 0 -3px #a94f8a;
}

.battle-field .bubble {
  border-color: rgba(7, 49, 78, 0.55);
}

.area-view {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 6px;
  padding: 8px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 5px
    ),
    linear-gradient(#172156, #1f315f 50%, #15203f);
}

.area-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  padding: 4px 7px;
  color: var(--ink);
  background: rgba(8, 10, 24, 0.78);
  border: 2px solid var(--line);
  box-shadow: 3px 3px 0 #050713;
  font-size: clamp(10px, 2.5vw, 13px);
}

.area-map-wrap {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}

.tile-map {
  display: grid;
  width: auto;
  height: 100%;
  max-width: min(100%, 420px);
  max-height: 100%;
  aspect-ratio: 10 / 7;
  border: 3px solid #0a0d22;
  box-shadow:
    4px 4px 0 #050713,
    inset 0 0 0 2px rgba(255, 255, 255, 0.2);
  background: #0a0d22;
}

.tile {
  position: relative;
  min-height: 0;
  min-width: 0;
  image-rendering: pixelated;
}

.tile-floor {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 36%),
    repeating-linear-gradient(90deg, #6c8b86 0 8px, #607c7b 8px 16px);
}

.tile-path {
  background:
    repeating-linear-gradient(0deg, #b8a46b 0 7px, #a89158 7px 14px),
    #a89158;
}

.tile-foam {
  background:
    radial-gradient(circle at 22% 28%, rgba(255, 255, 255, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 64%, rgba(255, 255, 255, 0.7) 0 2px, transparent 3px),
    repeating-linear-gradient(45deg, #4ca4a5 0 8px, #34818e 8px 16px);
}

.tile-wall,
.tile-crate {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 40%),
    repeating-linear-gradient(90deg, #34415b 0 9px, #28334c 9px 18px);
}

.tile-crate::before {
  content: "";
  position: absolute;
  inset: 18%;
  background:
    linear-gradient(45deg, transparent 44%, #6d4a29 45% 55%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, #6d4a29 45% 55%, transparent 56%),
    #b67a39;
  border: 2px solid #4d321f;
}

.tile-console {
  background: #5e6478;
}

.tile-console::before {
  content: "";
  position: absolute;
  inset: 20% 16%;
  background:
    radial-gradient(circle at 24% 70%, var(--red) 0 2px, transparent 3px),
    radial-gradient(circle at 52% 70%, var(--yellow) 0 2px, transparent 3px),
    linear-gradient(#8ff07c 0 38%, #162447 39%);
  border: 2px solid #161a2f;
}

.tile-launch {
  background:
    linear-gradient(45deg, transparent 0 35%, rgba(255, 211, 90, 0.95) 36% 42%, transparent 43%),
    linear-gradient(-45deg, transparent 0 35%, rgba(255, 211, 90, 0.95) 36% 42%, transparent 43%),
    #3b4774;
}

.npc-token,
.player-token {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 10%;
  width: 52%;
  height: 72%;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.28));
}

.npc-token::before,
.player-token::before {
  content: "";
  position: absolute;
  left: 24%;
  top: 0;
  width: 52%;
  height: 36%;
  background: #ffd35a;
  border: 2px solid #392b4e;
  border-radius: 42% 42% 30% 30%;
  box-shadow:
    0 40% 0 8% #4dc0e6,
    -18% 62% 0 -3px #28336b,
    18% 62% 0 -3px #28336b;
}

.player-token.face-left {
  transform: translateX(-50%) scaleX(-1);
}

.player-token.face-up::before {
  background: #f2b447;
}

.player-token.face-right::after,
.player-token.face-left::after,
.player-token.face-down::after {
  content: "";
  position: absolute;
  left: 36%;
  top: 18%;
  width: 3px;
  height: 3px;
  background: #10142d;
  box-shadow: 10px 0 0 #10142d;
}

.npc-token::before {
  background: #b7ffef;
  box-shadow:
    0 40% 0 8% #ff7aa8,
    -18% 62% 0 -3px #8f3a75,
    18% 62% 0 -3px #8f3a75;
}

.area-message {
  min-height: 58px;
  padding: 8px 9px;
  color: var(--ink);
  background: rgba(9, 13, 31, 0.94);
  border: 3px solid var(--ink);
  box-shadow:
    4px 4px 0 #050713,
    inset 0 0 0 2px #27305d;
  font-size: clamp(11px, 2.8vw, 15px);
  line-height: 1.45;
  text-shadow: 2px 2px 0 #000;
}

.hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  z-index: 4;
}

.hud-card {
  min-width: 112px;
  padding: 5px 6px;
  background: rgba(8, 10, 24, 0.78);
  border: 2px solid var(--line);
  box-shadow: 3px 3px 0 #050713;
}

.hud-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: clamp(10px, 2.3vw, 13px);
  line-height: 1.1;
}

.bar {
  height: 6px;
  margin-top: 4px;
  background: #111;
  border: 1px solid #7d8195;
}

.bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow));
}

.bar-fill.enemy-hp {
  background: linear-gradient(90deg, var(--pink), var(--red));
}

.text-box {
  position: relative;
  z-index: 6;
  margin: 0 8px 8px;
  min-height: 35%;
  padding: 9px 10px 10px;
  background: rgba(9, 13, 31, 0.94);
  border: 3px solid var(--ink);
  box-shadow:
    4px 4px 0 #050713,
    inset 0 0 0 2px #27305d;
}

.speaker {
  display: inline-block;
  margin-bottom: 5px;
  padding: 2px 7px;
  color: #10142d;
  background: var(--yellow);
  box-shadow: 2px 2px 0 #5e3a20;
  font-size: clamp(11px, 2.6vw, 14px);
  line-height: 1.15;
}

.dialogue-text,
.prompt-text {
  margin: 0;
  color: var(--ink);
  font-size: clamp(12px, 3vw, 16px);
  line-height: 1.55;
  text-shadow: 2px 2px 0 #000;
}

.next-mark {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: var(--yellow);
  animation: blink 0.8s steps(2, end) infinite;
}

.choices,
.battle-menu,
.title-menu,
.ending-menu {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.choice-button,
.menu-button {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--ink);
  text-align: left;
  background: #25305b;
  border: 2px solid #8292c4;
  box-shadow: 3px 3px 0 #050713;
  cursor: default;
}

.choice-button.is-selected,
.menu-button.is-selected {
  color: #10142d;
  background: var(--yellow);
  border-color: var(--ink);
  box-shadow:
    3px 3px 0 #050713,
    inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.choice-button.is-selected::before,
.menu-button.is-selected::before {
  content: "▶ ";
}

.choice-button:active,
.choice-button:focus-visible,
.menu-button:active,
.menu-button:focus-visible,
.control-pad:active,
.control-pad:focus-visible {
  outline: 0;
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #050713;
  border-color: var(--yellow);
}

.choice-button[disabled],
.menu-button[disabled] {
  color: #8b8d9d;
  background: #1a1d2f;
  border-color: #454a64;
  cursor: default;
}

.title-view,
.ending-view {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(circle at 50% 30%, rgba(125, 230, 255, 0.18), transparent 33%),
    linear-gradient(180deg, #0b1234, #141044 54%, #060714);
}

.title-card,
.ending-card {
  width: min(92%, 440px);
  max-height: calc(100% - 18px);
  padding: 18px 15px;
  text-align: center;
  background: rgba(8, 10, 24, 0.88);
  border: 3px solid var(--ink);
  box-shadow:
    6px 6px 0 #03040c,
    inset 0 0 0 3px #283369;
}

.kicker {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: clamp(12px, 3vw, 15px);
}

.title {
  margin: 0;
  color: var(--yellow);
  font-size: clamp(24px, 7vw, 44px);
  line-height: 0.95;
  text-shadow:
    3px 3px 0 #812c56,
    6px 6px 0 #03040c;
}

.subtitle {
  margin: 9px 0 0;
  color: var(--ink);
  font-size: clamp(12px, 3vw, 16px);
  line-height: 1.5;
}

.status-line,
.battle-log {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(10px, 2.4vw, 13px);
  line-height: 1.45;
}

.battle-panel {
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr minmax(112px, 42%);
  gap: 8px;
  margin: 0 8px 8px;
  padding: 8px;
  background: rgba(9, 13, 31, 0.94);
  border: 3px solid var(--ink);
  box-shadow:
    4px 4px 0 #050713,
    inset 0 0 0 2px #27305d;
}

.battle-log {
  margin: 0;
}

.battle-menu {
  margin: 0;
  grid-template-columns: 1fr 1fr;
}

.battle-menu .menu-button {
  min-height: 32px;
  padding: 6px 7px;
  text-align: center;
}

.controls {
  position: relative;
  width: 100%;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 42% 16% 42%;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-items: start;
  gap: clamp(8px, 1.8dvh, 16px) 0;
  padding: clamp(8px, 1.5dvh, 14px) clamp(8px, 2vw, 16px) 0;
  background: #f7f7f3;
  touch-action: none;
}

.control-pad {
  color: #000;
  background: #f4ddce;
  border: 3px solid #000;
  border-radius: 18%;
  box-shadow: none;
  font-size: clamp(42px, 17vw, 74px);
  line-height: 1;
}

.control-pad.primary {
  background: #c6f0ff;
  border-color: #000;
}

.d-pad {
  position: relative;
  grid-column: 1;
  grid-row: 3;
  width: min(92%, clamp(132px, 43vw, 190px));
  aspect-ratio: 1;
  justify-self: start;
  align-self: start;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  margin-top: clamp(12px, 3dvh, 28px);
}

.d-button {
  color: #fff;
  background: #3f3f3f;
  border: 0;
  box-shadow: none;
}

.d-button {
  min-width: 0;
  min-height: 0;
  padding: 0;
  font-size: 0;
  cursor: pointer;
}

.d-button::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: #3f3f3f;
}

.d-button:active,
.d-button:focus-visible,
.shoulder-button:active,
.shoulder-button:focus-visible,
.menu-main-button:active,
.menu-main-button:focus-visible,
.start-main-button:active,
.start-main-button:focus-visible {
  outline: 0;
  transform: scale(0.98);
}

.d-up {
  grid-column: 2;
  grid-row: 1;
  clip-path: polygon(0 0, 100% 0, 100% 74%, 50% 100%, 0 74%);
}

.d-left {
  grid-column: 1;
  grid-row: 2;
  clip-path: polygon(0 0, 74% 0, 100% 50%, 74% 100%, 0 100%);
}

.d-right {
  grid-column: 3;
  grid-row: 2;
  clip-path: polygon(26% 0, 100% 0, 100% 100%, 26% 100%, 0 50%);
}

.d-down {
  grid-column: 2;
  grid-row: 3;
  clip-path: polygon(0 26%, 50% 0, 100% 26%, 100% 100%, 0 100%);
}

.shoulder-row {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  display: grid;
  grid-template-columns: 30% 1fr 30%;
  gap: clamp(12px, 7vw, 38px);
  align-items: center;
}

.shoulder-button,
.menu-main-button,
.start-main-button {
  min-height: clamp(40px, 7dvh, 56px);
  color: #000;
  background: #dff5d7;
  border: 3px solid #000;
  border-radius: 10px;
  box-shadow: none;
  font-size: clamp(34px, 11vw, 58px);
  line-height: 1;
  cursor: pointer;
}

.menu-main-button,
.start-main-button {
  background: #ffc20e;
}

.menu-main-button {
  font-size: clamp(24px, 8vw, 42px);
}

.start-main-button {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  min-width: clamp(110px, 34vw, 160px);
  min-height: clamp(36px, 6.5dvh, 50px);
  font-size: clamp(26px, 9vw, 46px);
}

.action-cluster {
  grid-column: 3;
  grid-row: 3;
  justify-self: end;
  width: min(92%, clamp(128px, 38vw, 190px));
  min-height: min(100%, 270px);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: clamp(28px, 6dvh, 60px);
  align-items: start;
  margin-top: clamp(4px, 1dvh, 12px);
}

.action-cluster .primary {
  justify-self: end;
  width: clamp(86px, 28vw, 126px);
  aspect-ratio: 1;
}

.action-cluster #btn-skip {
  justify-self: start;
  width: clamp(86px, 28vw, 126px);
  aspect-ratio: 1;
}

.shake {
  animation: shake 0.24s steps(2, end);
}

.flash {
  animation: flash 0.38s steps(2, end);
}

@media (max-width: 520px) {
  .app-shell {
    padding-top: 0;
  }

  .game-screen {
    width: 100%;
    min-height: 0;
    border-width: 3px;
    border-radius: 0;
  }

  .text-box {
    min-height: 39%;
    padding: 8px;
  }

  .battle-panel {
    grid-template-columns: 1fr;
  }

  .battle-menu {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
  }

  .battle-menu .menu-button {
    min-height: 30px;
    padding: 5px 3px;
    font-size: 11px;
  }

  .title-view,
  .ending-view {
    padding: 10px;
  }

  .title-card,
  .ending-card {
    width: min(94%, 440px);
    padding: 12px 10px;
  }

  .title {
    font-size: clamp(22px, 6vw, 32px);
  }

  .subtitle {
    margin-top: 7px;
    font-size: clamp(11px, 2.7vw, 14px);
    line-height: 1.4;
  }

  .title-menu,
  .ending-menu {
    gap: 5px;
    margin-top: 7px;
  }

  .title-menu .menu-button,
  .ending-menu .menu-button {
    min-height: 29px;
    padding: 4px 8px;
  }

  .ending-card .title {
    font-size: clamp(20px, 5.4vw, 28px);
  }

  .ending-card .subtitle {
    font-size: 11px;
    line-height: 1.3;
  }

  .status-line {
    display: none;
  }

  .hud-card {
    min-width: 98px;
  }

  .controls {
    gap: clamp(7px, 1.5dvh, 13px) 0;
  }
}

@media (max-height: 480px) {
  .gba {
    width: min(100vw, 760px);
  }

  .game-screen {
    max-height: 42dvh;
  }
}

@media (max-height: 680px) and (orientation: portrait) {
  .game-screen {
    max-height: 39dvh;
  }

  .controls {
    padding-top: 6px;
    gap: 6px 0;
  }
}

@keyframes star-drift {
  from {
    background-position:
      10px 18px,
      56px 42px,
      96px 12px;
  }
  to {
    background-position:
      10px 82px,
      56px 138px,
      96px 124px;
  }
}

@keyframes hover {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes bubble {
  0% {
    transform: translateY(12px) scale(0.7);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(-18px) scale(1.2);
    opacity: 0;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes logo-drop {
  0% {
    transform: translateY(-230%);
  }
  84% {
    transform: translateY(3%);
  }
  92% {
    transform: translateY(-1%);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes flash {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.8);
  }
}

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