* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Courier New", Courier, monospace;
}

:root {
  --title-meadow: #3cb038;
  --title-meadow-deep: #1a6424;
  --title-meadow-lit: #7ad840;
  --title-sky: #8ad4f4;
  --title-sky-warm: #ffe898;
  --title-ink: #122010;
  --title-cream: #f6f0d4;
  --title-red: #e81820;
  --title-red-deep: #920c14;
  --title-blue: #1868e0;
  --title-blue-deep: #0c3898;
  --ui-gold: #e8d090;
  --ui-panel: #f4ecd0;
  /* Discdex chassis + type accents (dexui1 / dexentry1) */
  --dex-shell: #0e4a52;
  --dex-shell-lit: #1a7884;
  --dex-shell-deep: #062830;
  --dex-gold: #f0d070;
  --dex-gold-deep: #c89828;
  --dex-screen: #eef6f2;
  --dex-ink: #142820;
  --dex-fire: #f07028;
  --dex-water: #4890e0;
  --dex-flying: #78b0e8;
  --dex-rock: #b88848;
  --dex-grass: #48a840;
  --dex-electric: #e8c828;
  --dex-ice: #70c8e8;
  --dex-fighting: #c04038;
  --dex-poison: #984898;
  --dex-ground: #d0a848;
  --dex-psychic: #e85898;
  --dex-bug: #98b028;
  --dex-ghost: #685890;
  --dex-dragon: #5840d0;
  --dex-dark: #584838;
  --dex-steel: #9898b0;
  --dex-fairy: #e890b8;
  --dex-cosmic: #6050b8;
  --dex-light: #f0e878;
  --dex-normal: #a0a070;
  --dex-unknown: #6a7870;
}

body.boot {
  background: var(--title-meadow-deep);
  display: block;
}

body.playing {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 26% 16%, #2a5060 0%, transparent 50%),
    radial-gradient(ellipse at 74% 84%, #1e5034 0%, transparent 46%),
    linear-gradient(160deg, #081410 0%, #143038 42%, #0a1418 100%);
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  /* Avoid CSS filter on the play canvas — it causes compositor flicker in
     Electron/Cursor when the bitmap is cleared and redrawn every frame. */
  box-shadow:
    0 0 0 2px #1a2a22,
    0 0 0 5px #ecd898,
    0 0 0 9px #243828,
    0 0 64px rgba(100, 220, 150, 0.2),
    0 24px 72px rgba(0, 0, 0, 0.78);
}

#corner-menu-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  right: auto;
  z-index: 6;
  pointer-events: auto;
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: #fff4e8;
  background: linear-gradient(180deg, #e83038 0%, #b0141c 55%, #c01820 100%);
  border: 3px solid #6a0810;
  box-shadow: 3px 3px 0 #3a0408, inset 0 1px 0 rgba(255, 200, 180, 0.25);
  padding: 8px 10px 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  image-rendering: pixelated;
  text-shadow: 1px 1px 0 #6a0810;
}

#corner-menu-btn:hover {
  background: linear-gradient(180deg, #f04850 0%, #d02028 100%);
}

#corner-menu-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #3a0408;
}

.corner-menu-icon {
  font-size: 12px;
  line-height: 1;
}

#minimap-wrap {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 5;
  pointer-events: none;
  border: 3px solid #203018;
  box-shadow: 0 0 0 2px #c8b878, 4px 4px 0 #101808;
  background: linear-gradient(180deg, #101810 0%, #0c1410 100%);
  border-radius: 0;
}

#minimap-wrap.hidden {
  display: none !important;
}

#minimap {
  display: block;
  width: 168px;
  height: 168px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#minimap-label,
#minimap-you {
  display: none;
}

#hud {
  position: fixed;
  left: 12px;
  bottom: 12px;
  pointer-events: none;
  color: #f8f0d0;
  text-shadow: 1px 1px 0 #101808, 0 0 8px rgba(0, 0, 0, 0.45);
  max-width: min(520px, 90vw);
  font-family: VT323, "Courier New", monospace;
  padding: 9px 12px 7px;
  background:
    linear-gradient(180deg, rgba(22, 34, 24, 0.78) 0%, rgba(12, 18, 14, 0.52) 100%);
  border: 2px solid rgba(212, 192, 120, 0.55);
  box-shadow: 3px 3px 0 rgba(16, 24, 8, 0.5), inset 0 1px 0 rgba(232, 220, 176, 0.16);
}

#dialog {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(520px, 92vw);
  z-index: 20;
  background: linear-gradient(180deg, #fffaf0 0%, #f4ecd0 55%, #ebe0c0 100%);
  color: #202018;
  font-family: VT323, "Courier New", monospace;
  border: 4px solid #203018;
  box-shadow: 5px 5px 0 #101808, inset 0 0 0 2px rgba(24, 88, 160, 0.2);
  padding: 12px 16px 10px;
  image-rendering: pixelated;
}

/* Battle arena — hide overworld chrome; combat HUD lives inside the canvas */
body.playing.arena-mode .play-ui {
  display: none !important;
}

/* Battle arena — sharper HUD contrast + combat7 Overdrive / Wall Bounce */
body.playing.arena-mode #hud {
  border-color: rgba(180, 140, 220, 0.55);
  background:
    linear-gradient(180deg, rgba(22, 16, 32, 0.9) 0%, rgba(8, 14, 12, 0.64) 100%);
  box-shadow: 3px 3px 0 rgba(16, 24, 8, 0.55), inset 0 1px 0 rgba(200, 170, 255, 0.18);
}

body.playing.arena-mode #game {
  box-shadow:
    0 0 0 2px #1a2a22,
    0 0 0 5px #ecd898,
    0 0 0 9px #243828,
    0 0 72px rgba(160, 120, 220, 0.22),
    0 28px 80px rgba(0, 0, 0, 0.8);
}

body.playing.arena-mode #hint {
  letter-spacing: 0.03em;
  color: #fff4d0;
}

body.playing.arena-mode #place {
  color: #fff8e8;
  text-shadow: 1px 1px 0 #101808, 0 0 10px rgba(240, 180, 60, 0.25);
}

#place {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 2px;
  letter-spacing: 0.06em;
  color: #fff8e0;
}

#coords,
#bag,
#hint {
  font-size: 15px;
  opacity: 0.92;
}

#bag {
  margin-top: 2px;
  color: #ffe048;
}

#dialog {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(520px, 92vw);
  z-index: 20;
  background: linear-gradient(180deg, #fff8e8 0%, #f4ecd0 55%, #ebe0c0 100%);
  color: #202018;
  font-family: VT323, "Courier New", monospace;
  border: 4px solid #203018;
  box-shadow: 5px 5px 0 #101808, inset 0 0 0 2px rgba(24, 88, 160, 0.22);
  padding: 12px 16px 10px;
  image-rendering: pixelated;
}

#dialog.hidden,
#dialog-shop.hidden {
  display: none;
}

#dialog-name {
  font-size: 13px;
  font-weight: bold;
  color: #1858a0;
  margin-bottom: 6px;
  letter-spacing: 0.06em;
  border-bottom: 2px solid rgba(32, 48, 24, 0.2);
  padding-bottom: 4px;
}

#dialog-text {
  font-size: 15px;
  line-height: 1.4;
  min-height: 2.7em;
}

#dialog-shop {
  margin-top: 8px;
  border-top: 2px solid #203018;
  padding-top: 6px;
  font-size: 12px;
}

#dialog-shop .shop-row {
  padding: 2px 4px;
}

#dialog-shop .shop-row.sel {
  background: #203018;
  color: #f8f0d8;
}

#dialog-hint {
  margin-top: 8px;
  text-align: right;
  font-size: 11px;
  opacity: 0.72;
}

#dialog-hint::after {
  content: " ▼";
  animation: dialog-caret 0.9s steps(2, end) infinite;
}

.dialog-map {
  margin: 8px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dialog-map.hidden {
  display: none;
}

.dialog-map canvas {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 2px solid #203018;
  background: #0a100c;
}

.dialog-map .ow-map-legend {
  margin: 0;
  font: 10px "Courier New", monospace;
  color: #5a6848;
  letter-spacing: 0.04em;
  text-align: center;
}

@keyframes dialog-caret {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.15;
  }
}

.play-ui.hidden,
#title-screen.hidden,
#pause-screen.hidden,
#game-shell.hidden,
#coords.hidden,
.menu-item.hidden {
  display: none !important;
}

#game-shell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Isolate canvas repaints from title/HUD compositor layers. */
  isolation: isolate;
  contain: layout paint;
}

#title-screen {
  --title-pad: clamp(20px, 4vw, 40px);
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--title-pad);
  overflow: hidden;
  background: var(--title-meadow-deep);
  pointer-events: auto;
  color: var(--title-ink);
}

#title-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.title-sky {
  position: absolute;
  inset: 0 0 42% 0;
  background:
    radial-gradient(ellipse 55% 70% at 78% 18%, var(--title-sky-warm) 0%, transparent 52%),
    radial-gradient(ellipse 40% 50% at 18% 30%, rgba(255, 255, 255, 0.22) 0%, transparent 55%),
    linear-gradient(180deg, #62bcec 0%, var(--title-sky) 46%, #b4ec78 100%);
}

.title-hills {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 28%;
  height: 34%;
  background:
    radial-gradient(ellipse 42% 100% at 18% 100%, #2a8830 0% 68%, transparent 69%),
    radial-gradient(ellipse 48% 110% at 52% 100%, #308828 0% 70%, transparent 71%),
    radial-gradient(ellipse 44% 100% at 86% 100%, #247022 0% 68%, transparent 69%);
  filter: saturate(1.08);
}

.title-grass {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  background:
    repeating-linear-gradient(
      -12deg,
      transparent 0 10px,
      rgba(16, 72, 20, 0.14) 10px 12px
    ),
    repeating-linear-gradient(
      18deg,
      transparent 0 14px,
      rgba(255, 240, 120, 0.06) 14px 15px
    ),
    linear-gradient(180deg, var(--title-meadow-lit) 0%, var(--title-meadow) 36%, var(--title-meadow-deep) 100%);
  animation: grass-shimmer 7s ease-in-out infinite alternate;
}

.title-disc {
  position: absolute;
  border-radius: 50%;
  border: 6px solid rgba(244, 239, 212, 0.92);
  box-shadow:
    inset 0 0 0 10px rgba(224, 24, 32, 0.88),
    inset 0 0 0 18px rgba(244, 239, 212, 0.95),
    0 10px 0 rgba(16, 40, 16, 0.22);
  background:
    radial-gradient(circle at 50% 50%, #f4efd4 0 28%, transparent 29%),
    radial-gradient(circle at 50% 50%, #e01820 0 100%);
  opacity: 0.9;
}

.title-disc-a {
  width: min(160px, 28vw);
  height: min(160px, 28vw);
  top: 12%;
  left: 8%;
  animation: disc-float 6.5s ease-in-out infinite;
}

.title-disc-b {
  width: min(110px, 20vw);
  height: min(110px, 20vw);
  top: 22%;
  right: 10%;
  animation: disc-float 5.2s ease-in-out infinite reverse;
  animation-delay: -1.4s;
}

.title-disc-c {
  width: min(72px, 14vw);
  height: min(72px, 14vw);
  bottom: 18%;
  left: 16%;
  opacity: 0.55;
  animation: disc-float 7.4s ease-in-out infinite;
  animation-delay: -2.6s;
}

.title-sparkles {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 22%, rgba(255, 255, 220, 0.5) 0 2px, transparent 3px),
    radial-gradient(circle at 58% 48%, rgba(255, 255, 255, 0.4) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 84% 60%, rgba(255, 255, 220, 0.45) 0 2px, transparent 3px);
  animation: sparkle-twinkle 3.2s ease-in-out infinite alternate;
}

.title-stage {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  animation: title-rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#title-discmon {
  margin: 0;
  padding: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(36px, 9vw, 72px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: var(--title-red);
  text-shadow:
    4px 4px 0 var(--title-ink),
    -2px 0 0 var(--title-cream),
    0 -2px 0 var(--title-cream);
}

.title-mark-tail {
  color: #fff048;
  text-shadow:
    4px 4px 0 var(--title-ink),
    -2px 0 0 var(--title-red-deep),
    0 -2px 0 var(--title-red-deep);
}

#title-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: min(340px, 100%);
  margin-top: 8px;
}

.title-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(11px, 2.2vw, 14px);
  letter-spacing: 0.04em;
  cursor: pointer;
  min-height: 54px;
  padding: 14px 20px 14px 28px;
  text-align: center;
  border-radius: 0;
  border: 4px solid var(--title-ink);
  box-shadow: 5px 5px 0 var(--title-ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.title-btn-cursor {
  position: absolute;
  left: 12px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  font-size: 0.85em;
}

.title-btn-new {
  background: var(--title-red);
  color: #ffffff;
}

.title-btn-load {
  background: var(--title-blue);
  color: #ffffff;
  box-sizing: border-box;
}

.title-btn-boy {
  background: var(--title-blue);
  color: #ffffff;
}

.title-btn-girl {
  background: #e04890;
  color: #ffffff;
}

.gender-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: min(420px, 100%);
  margin-top: 4px;
  animation: title-rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.gender-select[hidden] {
  display: none !important;
}

.gender-prompt {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(11px, 2.4vw, 15px);
  line-height: 1.55;
  color: var(--title-ink);
  text-shadow: 0 1px 0 rgba(244, 239, 212, 0.55);
  max-width: 18ch;
}

.gender-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: min(280px, 100%);
}

.name-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: min(300px, 100%);
}

.name-input {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(12px, 2.4vw, 16px);
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  color: var(--title-ink);
  background: var(--title-cream);
  border: 4px solid var(--title-ink);
  box-shadow: 5px 5px 0 var(--title-ink);
  min-height: 54px;
  padding: 12px 14px;
  outline: none;
  width: 100%;
}

.name-input:focus {
  box-shadow: 7px 7px 0 var(--title-ink);
  transform: translate(-2px, -2px);
}

.name-input::placeholder {
  color: rgba(20, 32, 16, 0.35);
  text-transform: uppercase;
}

.name-confirm {
  width: 100%;
}

.title-btn-slot {
  background: #2a6a38;
  color: #f4efd4;
  font-size: clamp(8px, 1.6vw, 11px);
  line-height: 1.45;
  min-height: 64px;
  padding: 12px 16px 12px 34px;
  text-align: left;
  justify-content: flex-start;
}

.title-btn-slot .slot-label {
  display: block;
  width: 100%;
  white-space: normal;
  word-break: break-word;
}

.slot-menu {
  width: min(420px, 100%);
}

.title-btn.sel {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--title-ink);
  outline: none;
  animation: btn-pulse 1.1s ease-in-out infinite;
}

.title-btn.sel .title-btn-cursor {
  opacity: 1;
  transform: translateX(0);
}

.title-btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.title-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--title-ink);
  animation: none;
}

.title-btn.disabled {
  opacity: 0.5;
  cursor: default;
  filter: none;
  background: #4a6a9a;
  color: rgba(255, 255, 255, 0.75);
  box-shadow: 3px 3px 0 rgba(20, 32, 16, 0.45);
}

.title-meta-blank {
  margin: 0;
  min-height: 1.2em;
  font-family: VT323, "Courier New", monospace;
  font-size: 22px;
  color: var(--title-ink);
}

.title-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.title-loading[hidden] {
  display: none !important;
}

.title-loading-disc {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid var(--title-cream);
  background:
    radial-gradient(circle at 50% 50%, var(--title-cream) 0 30%, transparent 31%),
    radial-gradient(circle at 50% 50%, var(--title-red) 0 100%);
  box-shadow: inset 0 0 0 7px var(--title-red);
  animation: disc-spin 0.9s linear infinite;
}

.title-loading-text {
  margin: 0;
  font-family: VT323, "Courier New", monospace;
  font-size: 24px;
  color: var(--title-ink);
  letter-spacing: 0.04em;
}

.title-hint-boot {
  margin: 6px 0 0;
  font-family: VT323, "Courier New", monospace;
  font-size: 18px;
  letter-spacing: 0.06em;
  color: rgba(20, 32, 16, 0.72);
}

#title-screen.is-loading .title-hint-boot,
#title-screen.is-loading #title-menu,
#title-screen.is-loading #gender-select,
#title-screen.is-loading #name-select,
#title-screen.is-loading #slot-select {
  opacity: 0.35;
  pointer-events: none;
}

#title-screen.is-gender #title-discmon,
#title-screen.is-name #title-discmon,
#title-screen.is-slots #title-discmon {
  font-size: clamp(28px, 7vw, 48px);
}

@keyframes title-rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes disc-float {
  0%,
  100% {
    transform: translateY(0) rotate(-6deg);
  }
  50% {
    transform: translateY(-14px) rotate(4deg);
  }
}

@keyframes disc-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes grass-shimmer {
  from {
    filter: saturate(1) brightness(1);
  }
  to {
    filter: saturate(1.08) brightness(1.04);
  }
}

@keyframes sparkle-twinkle {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 0.85;
  }
}

@keyframes btn-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.08);
  }
}

@media (max-width: 560px) {
  .title-disc-a,
  .title-disc-b {
    opacity: 0.35;
  }

  .title-disc-c {
    display: none;
  }

  #title-discmon {
    font-size: clamp(28px, 11vw, 44px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-stage,
  .title-grass,
  .title-disc,
  .title-sparkles,
  .title-btn.sel,
  .title-loading-disc {
    animation: none !important;
  }
}

#pause-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(8, 18, 14, 0.55) 0%, rgba(8, 18, 14, 0.82) 100%);
  pointer-events: auto;
}

.title-panel {
  width: min(360px, 92vw);
  background: #f8f0d8;
  color: #202018;
  border: 4px solid #203018;
  box-shadow: 6px 6px 0 #101808;
  padding: 22px 24px 16px;
  text-align: left;
}

.pause-panel {
  width: min(300px, 90vw);
}

.menu-panel {
  width: min(420px, 94vw);
  max-height: min(92vh, 640px);
  display: flex;
  flex-direction: column;
}

.menu-panel.dex-wide {
  width: min(500px, 96vw);
  background:
    linear-gradient(165deg, #d8f0ec 0%, #f2ecd4 42%, #e8e0c4 100%);
  border-color: var(--dex-shell-deep);
  box-shadow:
    6px 6px 0 var(--dex-shell-deep),
    inset 0 0 0 3px var(--dex-shell-lit),
    inset 0 0 0 6px var(--dex-gold);
}

.menu-panel.dex-wide .title-eyebrow {
  color: var(--dex-shell);
  letter-spacing: 0.22em;
  text-shadow: 1px 1px 0 rgba(240, 208, 112, 0.65);
}

.menu-panel.dex-wide .title-meta {
  color: var(--dex-shell-lit);
  border-top-color: var(--dex-shell);
  background: linear-gradient(90deg, rgba(26, 120, 132, 0.12), transparent 70%);
  padding-left: 4px;
}

.menu-panel.dex-wide .title-hint {
  color: var(--dex-shell);
  opacity: 0.75;
}

.menu-panel.map-wide {
  width: min(560px, 96vw);
}

.menu-panel.map-wide .menu-body {
  max-height: min(72vh, 520px);
  overflow: auto;
  background: #0c1410;
  border-color: #2a3a28;
}

.ow-map-wrap {
  padding: 8px 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ow-map-wrap canvas {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 2px solid #2a3a28;
  background: #0a100c;
}

.ow-map-legend {
  margin: 0;
  font: 10px "Courier New", monospace;
  color: #a8b888;
  letter-spacing: 0.04em;
}

.menu-body {
  flex: 1;
  min-height: 0;
  max-height: min(58vh, 420px);
  overflow-y: auto;
  border: 2px solid #203018;
  background: #f3ebd0;
  margin-bottom: 12px;
}

.menu-panel.dex-wide .menu-body {
  border-color: var(--dex-shell);
  background:
    linear-gradient(180deg, rgba(14, 74, 82, 0.06) 0%, transparent 28px),
    repeating-linear-gradient(
      180deg,
      #f4faf6 0px,
      #f4faf6 30px,
      #eaf2ec 30px,
      #eaf2ec 60px
    );
  box-shadow: inset 0 0 0 2px rgba(240, 208, 112, 0.35);
}

.menu-body .menu-item {
  border-bottom: 1px solid #c8c0a0;
  user-select: none;
}

.menu-panel.dex-wide .menu-body .menu-item {
  border-bottom-color: rgba(14, 74, 82, 0.18);
}

.menu-body .menu-item:last-child {
  border-bottom: none;
}

.menu-item.dim {
  opacity: 0.55;
}

.menu-item.dex-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 0;
  position: relative;
  color: var(--dex-ink);
  border-left: 5px solid var(--dex-accent, var(--dex-unknown));
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--dex-accent, var(--dex-unknown)) 16%, transparent) 0%,
    transparent 55%
  );
}

.menu-item.dex-row.unseen {
  border-left-style: dashed;
  background: linear-gradient(90deg, rgba(106, 120, 112, 0.14) 0%, transparent 50%);
}

.menu-item.dex-row.caught .dex-num {
  box-shadow:
    2px 2px 0 rgba(16, 24, 8, 0.35),
    0 0 0 2px var(--dex-gold);
}

.menu-item.dex-row.sel {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--dex-accent, var(--dex-shell)) 38%, #203018) 0%,
    #203018 100%
  );
  color: #f8f0d8;
}

.menu-item.dex-row.sel .dex-num {
  background: var(--dex-gold);
  color: var(--dex-shell-deep);
  border-color: #fff4c8;
}

.menu-item.dex-row:hover:not(.sel) {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--dex-accent, var(--dex-unknown)) 28%, #e8f0ea) 0%,
    #e8f0ea 100%
  );
}

.menu-item.dex-back.sel {
  background: linear-gradient(90deg, var(--dex-shell) 0%, #203018 100%);
}

.dex-num {
  flex-shrink: 0;
  min-width: 3.4em;
  margin-left: 8px;
  padding: 3px 5px 2px;
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 8px;
  letter-spacing: 0.04em;
  text-align: center;
  color: #fff8e8;
  background: var(--dex-accent, var(--dex-shell));
  border: 2px solid var(--dex-shell-deep);
  box-shadow: 2px 2px 0 rgba(16, 24, 8, 0.35);
}

.dex-thumb {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 35% 30%, #fff8e0 0%, transparent 42%),
    linear-gradient(145deg, #d8ece8 0%, #c0d0c8 100%);
  border: 2px solid var(--dex-shell-deep);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dex-accent, var(--dex-shell)) 55%, #fff);
}

.dex-thumb-empty {
  display: inline-block;
  background: repeating-linear-gradient(
    -45deg,
    #b0bcb4 0 4px,
    #9aa89e 4px 8px
  );
}

.dex-row-label {
  flex: 1;
  min-width: 0;
  font-family: VT323, "Courier New", monospace;
  font-size: 18px;
  letter-spacing: 0.03em;
}

.dex-type-chip {
  flex-shrink: 0;
  padding: 2px 7px 1px;
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fffaf0;
  background: var(--dex-accent, var(--dex-unknown));
  border: 2px solid color-mix(in srgb, var(--dex-accent, var(--dex-unknown)) 55%, #101808);
  box-shadow: 1px 1px 0 rgba(16, 24, 8, 0.35);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
}

.menu-item.dex-row.sel .dex-type-chip {
  border-color: #fff4c8;
}

.dex-entry {
  padding: 0;
  border-bottom: 2px solid var(--dex-shell);
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--dex-accent, var(--dex-shell)) 22%, transparent) 0%, transparent 58%),
    linear-gradient(180deg, #f7fcf8 0%, #e8f0ea 100%);
}

.dex-entry-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 6px;
  background:
    linear-gradient(180deg, var(--dex-shell-lit) 0%, var(--dex-shell) 100%);
  border-bottom: 3px solid var(--dex-gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.dex-num-badge {
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--dex-shell-deep);
  background: var(--dex-gold);
  border: 2px solid #fff4c8;
  padding: 4px 8px 3px;
  box-shadow: 2px 2px 0 var(--dex-shell-deep);
}

.dex-status-pill {
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 7px;
  letter-spacing: 0.08em;
  color: #fff8e8;
  background: color-mix(in srgb, var(--dex-accent, var(--dex-shell-lit)) 70%, #102018);
  border: 2px solid rgba(255, 244, 200, 0.55);
  padding: 4px 8px 3px;
}

.dex-entry.caught .dex-status-pill {
  background: linear-gradient(180deg, #38a050 0%, #1e6830 100%);
}

.dex-entry.seen:not(.caught) .dex-status-pill {
  background: linear-gradient(180deg, #4890c8 0%, #286090 100%);
}

.dex-entry.unseen .dex-status-pill {
  background: linear-gradient(180deg, #707870 0%, #485048 100%);
}

.dex-combat {
  margin: 0 10px 8px;
  padding: 8px 10px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--dex-accent, var(--dex-shell)) 12%, #fff8e8) 0%,
      #f4ecd0 100%
    );
  border: 2px solid var(--dex-shell);
  border-top: 4px solid var(--dex-accent, var(--dex-shell-lit));
  box-shadow: 3px 3px 0 rgba(14, 74, 82, 0.25);
  font-size: 12px;
  line-height: 1.35;
  color: var(--dex-ink);
}

.dex-k {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dex-shell);
  font-weight: bold;
  margin-bottom: 2px;
}

.dex-ability {
  margin-bottom: 6px;
}

.dex-ability .dex-k {
  display: inline;
  margin-right: 4px;
}

.dex-moves {
  margin: 2px 0 0;
  padding-left: 0;
  list-style: none;
}

.dex-moves li {
  margin: 3px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
}

.dex-move-type {
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fffaf0;
  background: var(--dex-accent, var(--dex-unknown));
  border: 1px solid color-mix(in srgb, var(--dex-accent, var(--dex-unknown)) 50%, #101808);
  padding: 2px 4px 1px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

.dex-move-fx {
  opacity: 0.78;
  font-weight: normal;
}

.catch-combat {
  margin: 0 0 6px;
  padding: 6px 8px;
  background: rgba(32, 48, 24, 0.06);
  border: 1px solid #c8c0a0;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  color: #203018;
}

.starter-pick-grid {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 2px;
}

.starter-pick-card {
  flex: 1;
  min-width: 0;
  padding: 6px 4px 4px;
  border: 2px solid #c8c0a0;
  background: rgba(248, 240, 216, 0.55);
  text-align: center;
  transition: border-color 0.1s, background 0.1s;
}

.starter-pick-card.sel {
  border-color: #203018;
  background: #f8f0d8;
  box-shadow: inset 0 0 0 1px #203018;
}

.starter-pick-sprite {
  display: block;
  margin: 0 auto 4px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.starter-pick-name {
  font-size: 11px;
  font-weight: bold;
  color: #1858a0;
  letter-spacing: 0.04em;
}

.starter-pick-type {
  font-size: 10px;
  margin-top: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.starter-pick-type.type-grass {
  color: #3a8c28;
}

.starter-pick-type.type-fire {
  color: #c83820;
}

.starter-pick-type.type-water {
  color: #2878c8;
}

.starter-pick-confirm {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 2px solid #203018;
  font-size: 12px;
  text-align: center;
  color: #203018;
}

.dex-hero-wrap {
  display: flex;
  justify-content: center;
  margin: 12px 0 8px;
}

.dex-hero-ring {
  padding: 6px;
  background:
    conic-gradient(
      from 210deg,
      var(--dex-gold) 0deg,
      var(--dex-accent, var(--dex-shell-lit)) 90deg,
      var(--dex-gold-deep) 180deg,
      var(--dex-shell) 270deg,
      var(--dex-gold) 360deg
    );
  box-shadow: 4px 4px 0 rgba(6, 40, 48, 0.45);
}

.dex-hero {
  display: block;
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
  background:
    radial-gradient(circle at 40% 32%, #fffef6 0%, transparent 45%),
    linear-gradient(160deg, #e8f4f0 0%, #d0e0d8 100%);
  border: 3px solid var(--dex-shell-deep);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--dex-accent, var(--dex-shell)) 40%, #fff);
}

.dex-hero-empty {
  display: block;
  background: repeating-linear-gradient(
    -45deg,
    #b8c4bc 0 6px,
    #a0aea6 6px 12px
  );
}

.dex-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 0 10px 8px;
}

.dex-flavor {
  margin: 0 10px 8px;
  padding: 10px 12px;
  font-family: VT323, monospace;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--dex-ink, #1a2e28);
  background:
    linear-gradient(180deg, rgba(255, 252, 240, 0.96) 0%, rgba(236, 244, 238, 0.92) 100%);
  border: 2px solid rgba(14, 74, 82, 0.4);
  border-left: 5px solid var(--dex-accent, var(--dex-shell));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  min-height: 2.7em;
}

.dex-flavor.unseen {
  color: rgba(26, 46, 40, 0.45);
  letter-spacing: 0.18em;
  text-align: center;
  font-size: 18px;
}

.dex-flavor.seen:not(.caught) {
  opacity: 0.92;
}

.dex-flavor.caught {
  border-left-color: var(--dex-gold-deep, #b8860b);
}

.dex-meta.menu-detail {
  margin: 0 10px 8px;
  padding: 8px 10px;
  background: rgba(255, 252, 240, 0.85);
  border: 2px solid rgba(14, 74, 82, 0.35);
  border-left: 4px solid var(--dex-accent, var(--dex-shell));
}

.dex-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 8px 10px 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(14, 74, 82, 0.08) 100%);
}

.dex-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-family: VT323, monospace;
  opacity: 0.4;
  color: var(--dex-ink);
}

.dex-stage.seen {
  opacity: 0.88;
}

.dex-stage.caught {
  opacity: 1;
}

.dex-stage img {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
  background: #e0ece8;
  border: 2px solid var(--dex-shell-deep);
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--dex-accent, var(--dex-shell)) 45%, transparent);
}

.dex-stage.caught img {
  border-color: var(--dex-gold-deep);
  box-shadow: 2px 2px 0 var(--dex-gold);
}

/* Type accent tokens */
.dex-t-fire { --dex-accent: var(--dex-fire); }
.dex-t-water { --dex-accent: var(--dex-water); }
.dex-t-flying { --dex-accent: var(--dex-flying); }
.dex-t-rock { --dex-accent: var(--dex-rock); }
.dex-t-grass { --dex-accent: var(--dex-grass); }
.dex-t-electric { --dex-accent: var(--dex-electric); }
.dex-t-ice { --dex-accent: var(--dex-ice); }
.dex-t-fighting { --dex-accent: var(--dex-fighting); }
.dex-t-poison { --dex-accent: var(--dex-poison); }
.dex-t-ground { --dex-accent: var(--dex-ground); }
.dex-t-psychic { --dex-accent: var(--dex-psychic); }
.dex-t-bug { --dex-accent: var(--dex-bug); }
.dex-t-ghost { --dex-accent: var(--dex-ghost); }
.dex-t-dragon { --dex-accent: var(--dex-dragon); }
.dex-t-dark { --dex-accent: var(--dex-dark); }
.dex-t-steel { --dex-accent: var(--dex-steel); }
.dex-t-fairy { --dex-accent: var(--dex-fairy); }
.dex-t-cosmic { --dex-accent: var(--dex-cosmic); }
.dex-t-light { --dex-accent: var(--dex-light); }
.dex-t-normal { --dex-accent: var(--dex-normal); }
.dex-t-unknown { --dex-accent: var(--dex-unknown); }

.dex-type-chip.dex-t-light,
.dex-move-type.dex-t-light,
.dex-type-chip.dex-t-electric,
.dex-move-type.dex-t-electric {
  color: #203018;
  text-shadow: none;
}

.menu-item .menu-sub {
  display: block;
  font-size: 11px;
  font-weight: normal;
  opacity: 0.8;
  margin-top: 2px;
  white-space: pre-wrap;
}

.menu-detail {
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  border-bottom: none;
  white-space: pre-wrap;
  color: #203018;
}

/* Equip Gear detail panel (equipui1) */
.menu-body.equip-view {
  display: flex;
  flex-direction: column;
}

.menu-body.equip-view .equip-detail {
  flex-shrink: 0;
  margin: 0;
  border-bottom: 2px solid #203018;
  background: linear-gradient(180deg, #faf6e8 0%, #f3ebd0 100%);
}

.equip-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  margin-bottom: 4px;
}

.equip-tier-chip {
  font-family: VT323, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 6px 0;
  border: 1px solid rgba(32, 48, 24, 0.35);
  border-radius: 2px;
}

.equip-tier-common { background: #d8dcc8; color: #203018; }
.equip-tier-uncommon { background: #b8d4a8; color: #142810; }
.equip-tier-rare { background: #9ec4e8; color: #102840; }
.equip-tier-epic { background: #c8a8e8; color: #281040; }
.equip-tier-legendary { background: #e8c868; color: #402808; }

.equip-blurb {
  font-size: 12px;
  opacity: 0.88;
  margin-bottom: 6px;
}

.equip-effect {
  font-size: 12px;
  line-height: 1.4;
  margin-top: 4px;
}

.equip-effect .dex-k {
  display: inline;
  margin-right: 4px;
}

.menu-section-label {
  padding: 6px 10px 4px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #1858a0;
  font-weight: bold;
  border-bottom: 1px solid #c8c0a0;
  background: #efe6c4;
}

.title-eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: #1858a0;
  font-weight: bold;
  margin-bottom: 4px;
}

.title-meta {
  font-size: 11px;
  color: #1858a0;
  min-height: 1.3em;
  margin-bottom: 12px;
  border-top: 2px solid #203018;
  padding-top: 8px;
}

.menu-list {
  list-style: none;
  margin: 0 0 12px;
  border: 2px solid #203018;
}

.menu-item {
  padding: 8px 10px;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-bottom: 1px solid #c8c0a0;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item.sel {
  background: #203018;
  color: #f8f0d8;
}

.menu-item:hover:not(.sel) {
  background: #e8e0c0;
}

.menu-item.disabled {
  opacity: 0.4;
  cursor: default;
}

.title-hint {
  font-size: 10px;
  text-align: right;
  opacity: 0.65;
}

