:root {
  --bg: #0b1524;
  --bg-accent: #13253c;
  --panel: #152a42;
  --panel-top: #1e3a58;
  --panel-edge: #061018;
  --panel-line: rgba(72, 210, 255, 0.28);
  --text: #e8f4ff;
  --text-muted: #8fb0c9;
  --primary: #f0b429;
  --primary-top: #ffd666;
  --primary-bottom: #c98a12;
  --primary-edge: #8a5a08;
  --secondary-top: #3d6f8f;
  --secondary-bottom: #234860;
  --secondary-edge: #102838;
  --cyan: #48d2ff;
  --cyan-dim: #1a8fb8;
  --icon-well: #1a2838;
  --icon-well-edge: #3d556c;
  --icon-well-deep: #121c28;
}

* {
  box-sizing: border-box;
}

button {
  font: inherit;
  color: inherit;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Rajdhani", "Trebuchet MS", sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(72, 210, 255, 0.18), transparent 52%),
    radial-gradient(ellipse at 100% 100%, rgba(240, 180, 41, 0.08), transparent 40%),
    linear-gradient(rgba(72, 210, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 210, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
  background-size:
    auto,
    auto,
    28px 28px,
    28px 28px,
    auto;
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0 2px,
    rgba(0, 0, 0, 0.08) 2px 3px
  );
  opacity: 0.45;
}

.menu {
  position: relative;
  z-index: 1;
}

.menu {
  text-align: center;
  padding: 44px 36px;
  border: 2px solid var(--panel-line);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(72, 210, 255, 0.08), transparent 22%),
    linear-gradient(180deg, var(--panel-top), var(--panel));
  box-shadow:
    inset 0 0 0 1px rgba(8, 20, 32, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 3px #0a1624,
    0 10px 0 var(--panel-edge),
    0 0 40px rgba(72, 210, 255, 0.08),
    0 22px 48px rgba(0, 0, 0, 0.45);
  min-width: 300px;
  color: var(--text);
  clip-path: polygon(
    0 12px,
    12px 0,
    calc(100% - 12px) 0,
    100% 12px,
    100% calc(100% - 12px),
    calc(100% - 12px) 100%,
    12px 100%,
    0 calc(100% - 12px)
  );
}

.menu::before,
.menu::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--cyan);
  opacity: 0.7;
  pointer-events: none;
}

.menu::before {
  top: 10px;
  left: 10px;
  border-right: 0;
  border-bottom: 0;
}

.menu::after {
  right: 10px;
  bottom: 10px;
  border-left: 0;
  border-top: 0;
}

.hidden {
  display: none;
}

.character-card.hidden,
.item-card.hidden {
  display: none !important;
}

.title {
  margin: 0 0 28px;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 2.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow:
    0 0 12px rgba(72, 210, 255, 0.35),
    0 2px 0 #061018;
}

.title::after {
  content: "";
  display: block;
  width: min(220px, 60%);
  height: 2px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 8px rgba(72, 210, 255, 0.55);
}

.menu-actions {
  display: grid;
  gap: 16px;
}

.menu-actions.hidden {
  display: none;
}

.menu-actions + .menu-actions {
  margin-top: 20px;
}

/* Keep Back rows separated from content/buttons above (Feed, Equipment, Home, etc.). */
.menu > .menu-actions:last-of-type {
  margin-top: 24px;
  padding-top: 4px;
}

.menu-button {
  appearance: none;
  border: 3px solid var(--primary-top);
  border-bottom-color: var(--primary-edge);
  border-right-color: var(--primary-edge);
  padding: 14px 24px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--primary-top) 0%, var(--primary) 46%, var(--primary-bottom) 100%);
  color: #2a1a00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 5px 0 var(--primary-edge);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

.menu-button.secondary {
  border-color: #7f96bc;
  border-bottom-color: var(--secondary-edge);
  border-right-color: var(--secondary-edge);
  background: linear-gradient(180deg, var(--secondary-top) 0%, #3b5278 46%, var(--secondary-bottom) 100%);
  color: var(--text);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 5px 0 var(--secondary-edge);
}

.menu-button:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 6px 0 var(--primary-edge);
}

.menu-button.secondary:hover:not(:disabled) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 6px 0 var(--secondary-edge);
}

.menu-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35) brightness(0.75);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 3px 0 #5a4510;
  transform: none;
}

.menu-button:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.25),
    0 1px 0 var(--primary-edge);
}

.menu-button.secondary:active:not(:disabled) {
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 1px 0 var(--secondary-edge);
}

.select-screen {
  width: min(720px, 95vw);
  margin: 0 auto;
  display: grid;
  gap: 22px;
}

.select-header {
  text-align: center;
}

.select-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.select-header .title {
  margin-bottom: 8px;
}

.select-grid {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.arena-columns {
  display: grid;
  gap: 18px;
}

.arena-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}

#arena-player-list,
#arena-opponent-list {
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
}

#arena-player-list .character-card,
#arena-opponent-list .character-card {
  width: 100%;
  max-width: 320px;
  min-width: 0;
}

@media (min-width: 640px) {
  .select-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arena-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.character-card {
  appearance: none;
  border: 2px solid rgba(72, 210, 255, 0.35);
  border-radius: 4px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(72, 210, 255, 0.1), transparent 35%),
    linear-gradient(180deg, #1d3b57, #132a40);
  color: var(--text);
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(6, 16, 24, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 4px 0 #061018,
    0 0 16px rgba(72, 210, 255, 0.06);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease, border-color 0.12s ease;
  text-align: left;
  width: min(320px, 90vw);
  position: relative;
}

.character-card::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}

#feed-menu .dex-filters {
  justify-content: center;
  margin: 0 auto 6px;
  max-width: min(720px, 95vw);
}

#feed-item-list {
  max-height: min(42vh, 420px);
  overflow-y: auto;
  width: 100%;
}

.feed-visual {
  display: grid;
  place-items: center;
  gap: 10px;
  position: relative;
}

.feed-food {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  position: absolute;
  bottom: -2px;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.feed-food.active {
  opacity: 1;
}

.feed-food .food-sprite {
  width: 32px;
  height: 32px;
}

.food-sprite {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: auto;
  opacity: 1;
}

.item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.item-card.hidden {
  display: none !important;
}

.item-info {
  display: grid;
  gap: 4px;
}

/* Neutral wells for small transparent icons */
.item-icon,
.type-icon {
  background:
    linear-gradient(160deg, #243446 0%, var(--icon-well) 45%, var(--icon-well-deep) 100%);
  border: 2px solid var(--icon-well-edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(6, 16, 24, 0.55);
}

.item-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: contain;
  padding: 6px;
  border-radius: 6px;
}

.item-hover-desc {
  margin: -18px 0 16px;
  min-height: 2.4em;
  color: rgba(210, 230, 255, 0.86);
  font-size: 0.92rem;
  line-height: 1.35;
}

.item-hover-tooltip {
  position: fixed;
  z-index: 4000;
  max-width: min(280px, calc(100vw - 16px));
  padding: 8px 10px;
  border: 1px solid rgba(72, 210, 255, 0.45);
  border-radius: 4px;
  background: rgba(8, 20, 34, 0.96);
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.item-hover-tooltip.hidden {
  display: none;
}

#feed-item-list,
#equipment-item-list,
#key-items-list {
  overflow-x: hidden;
}

.character-card.has-tooltip::after,
.character-card.has-tooltip::before {
  content: none;
}

.character-card::before {
  content: "";
}

.food-sprite.chew {
  animation: chew 0.75s steps(2) infinite;
}

@keyframes chew {
  0%,
  100% {
    transform: scale(3);
  }
  50% {
    transform: scale(2.7) translateY(1px);
  }
}

.train-panel {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.train-visual {
  display: grid;
  grid-template-columns: auto auto;
  gap: 16px;
  align-items: end;
  position: relative;
}

.train-bag {
  width: 48px;
  height: 72px;
  display: grid;
  place-items: center;
  position: relative;
}

.bag-sprite {
  width: 16px;
  height: 24px;
  image-rendering: pixelated;
  transform: scale(2.5);
  transform-origin: bottom center;
}

.train-bag.hit .bag-sprite {
  animation: bag-hit 0.2s steps(2) infinite;
}

@keyframes bag-hit {
  0%,
  100% {
    transform: scale(2.5) translateX(0);
  }
  50% {
    transform: scale(2.5) translateX(2px);
  }
}

.train-bar {
  position: relative;
  width: min(420px, 90vw);
  height: 18px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.1);
  border: 1px solid rgba(226, 232, 240, 0.2);
  overflow: hidden;
}

.train-threshold {
  position: absolute;
  left: 80%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  z-index: 2;
  pointer-events: none;
}

.train-fill {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width 0.05s linear;
}

.character-card:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  border-color: rgba(72, 210, 255, 0.65);
  box-shadow:
    inset 0 0 0 1px rgba(6, 16, 24, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 5px 0 #061018,
    0 0 18px rgba(72, 210, 255, 0.18);
}

.character-card:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.28),
    0 1px 0 #061018;
}

.character-card.selected {
  border-color: var(--primary-top);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 4px 0 var(--primary-edge),
    0 0 16px rgba(240, 180, 41, 0.25);
}

.character-card.locked,
.character-card.locked:hover,
.character-card.locked:active {
  cursor: not-allowed;
  opacity: 0.72;
  filter: grayscale(0.35);
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 0 #152238;
}

.character-card.locked:disabled {
  color: inherit;
}

.hub-map {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  margin: 18px 0 8px;
}

.hub-image {
  width: 148px;
  height: 148px;
  object-fit: contain;
  image-rendering: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.hub-spot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(200px, 42vw);
  padding: 14px 12px 12px;
  border: 2px solid rgba(72, 210, 255, 0.35);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(72, 210, 255, 0.1), transparent 40%),
    linear-gradient(180deg, #1d3b57, #132a40);
  box-shadow:
    inset 0 0 0 1px rgba(6, 16, 24, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 5px 0 #061018,
    0 0 18px rgba(72, 210, 255, 0.08);
  cursor: pointer;
  color: inherit;
}

/* Zone difficulty tiers (1 easy → 7 hard). */
.zone-spot.zone-tier-1 {
  border-color: #7ecf7a;
  border-bottom-color: #1e4a1c;
  border-right-color: #1e4a1c;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #4a9a46, #2d6b2a);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 5px 0 #1e4a1c;
}

.zone-spot.zone-tier-1:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 #1e4a1c;
}

.zone-spot.zone-tier-2 {
  border-color: #6eb8e8;
  border-bottom-color: #1a3f5c;
  border-right-color: #1a3f5c;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #3a7fb0, #245878);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 5px 0 #1a3f5c;
}

.zone-spot.zone-tier-2:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 #1a3f5c;
}

.zone-spot.zone-tier-3 {
  border-color: #e8d06e;
  border-bottom-color: #5c4a14;
  border-right-color: #5c4a14;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #c4a832, #8a7420);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 5px 0 #5c4a14;
}

.zone-spot.zone-tier-3:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 #5c4a14;
}

.zone-spot.zone-tier-4 {
  border-color: #e8a05a;
  border-bottom-color: #5c3214;
  border-right-color: #5c3214;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #c46e2e, #8a4a1c);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 5px 0 #5c3214;
}

.zone-spot.zone-tier-4:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 #5c3214;
}

.zone-spot.zone-tier-5 {
  border-color: #e86a6a;
  border-bottom-color: #5c1a1a;
  border-right-color: #5c1a1a;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #b83a3a, #7a2424);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 5px 0 #5c1a1a;
}

.zone-spot.zone-tier-5:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 #5c1a1a;
}

.zone-spot.zone-tier-6 {
  border-color: #b88ae8;
  border-bottom-color: #3a1a5c;
  border-right-color: #3a1a5c;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #7a4ab0, #4a2878);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 5px 0 #3a1a5c;
}

.zone-spot.zone-tier-6:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 #3a1a5c;
}

.zone-spot.zone-tier-7 {
  border-color: #d45a8a;
  border-bottom-color: #1a0814;
  border-right-color: #1a0814;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
    linear-gradient(180deg, #6a1838, #1e0a18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 5px 0 #1a0814;
}

.zone-spot.zone-tier-7:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 2px 0 #1a0814;
}

.zone-spot.zone-tier-8 {
  border-color: #f0d878;
  border-bottom-color: #2a1808;
  border-right-color: #2a1808;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 38%),
    linear-gradient(180deg, #c9a02a, #5a2818 55%, #1a0c18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 5px 0 #2a1808;
}

.zone-spot.zone-tier-8:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 2px 0 #2a1808;
}

.hub-spot:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.hub-spot:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 #152238;
}

.hub-spot.locked,
.hub-spot.locked:hover,
.hub-spot.locked:active {
  filter: grayscale(0.85) brightness(0.72);
  transform: none;
  cursor: not-allowed;
  opacity: 0.72;
}

.hub-spot.locked .hub-label::after {
  content: " (Locked)";
  font-size: 0.85em;
  opacity: 0.85;
}

.hub-spot.unavailable .hub-label::after {
  content: " (Unavailable)";
  font-size: 0.85em;
  opacity: 0.85;
}

.hub-spot.zone-spot.locked,
.hub-spot.zone-spot.locked:hover,
.hub-spot.zone-spot.locked:active,
.hub-spot.zone-spot.unavailable,
.hub-spot.zone-spot.unavailable:hover,
.hub-spot.zone-spot.unavailable:active {
  filter: grayscale(1) brightness(0.4);
  opacity: 0.48;
  transform: none;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.5),
    0 4px 0 #0a1018;
}

.zone-spot-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.zone-info-button {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid #8ea8d4;
  border-radius: 999px;
  background: linear-gradient(180deg, #4a6388, #2a3d5c);
  color: #e8f0ff;
  font-size: 0.95rem;
  font-weight: 800;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 0 #152238;
}

.zone-info-button:hover {
  filter: brightness(1.1);
}

.zone-info-button:active {
  transform: translateY(1px);
}

.zone-info-button.locked,
.zone-info-button.unavailable,
.zone-info-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.hub-label {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.character-name {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--text);
}

.character-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.character-sprite-frame {
  --scale: 3;
  width: calc(16px * var(--scale));
  height: calc(16px * var(--scale));
  margin-bottom: 10px;
}

.battle-sprite-frame {
  margin-bottom: 0;
}

.battle-sprite-frame.mirrored {
  transform: scaleX(-1);
}

.battle-sprite-frame.flip {
  transform: scaleX(-1);
}

.battle-sprite-frame.mirrored.flip {
  transform: scaleX(1);
}

.face-right {
  transform: scaleX(-1);
}

.character-sprite {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  transform: scale(var(--scale));
  transform-origin: top left;
}

.feed-visual .character-sprite-frame {
  position: relative;
  z-index: 2;
}

.battle-layout {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  flex: 0 0 auto;
}

.zone-level-label {
  margin: -8px 0 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
}

.fast-combat-button {
  display: block;
  width: min(260px, 100%);
  margin: 0 auto 12px;
  flex: 0 0 auto;
  padding: 10px 18px 12px;
  font-size: 0.92rem;
}

.fast-combat-button.is-pressed,
.fast-combat-button[aria-pressed="true"] {
  transform: translateY(4px);
  border-color: var(--primary-top);
  border-bottom-color: var(--primary-edge);
  border-right-color: var(--primary-edge);
  background: linear-gradient(180deg, var(--primary-top) 0%, var(--primary) 46%, var(--primary-bottom) 100%);
  color: #2a1a00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.28),
    0 1px 0 var(--primary-edge);
}

.fast-combat-button.is-pressed:hover:not(:disabled),
.fast-combat-button[aria-pressed="true"]:hover:not(:disabled),
.fast-combat-button.is-pressed:active:not(:disabled),
.fast-combat-button[aria-pressed="true"]:active:not(:disabled) {
  filter: none;
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.28),
    0 1px 0 var(--primary-edge);
}

#battle-screen.fast-combat .battle-sprite-frame.hit {
  animation-duration: 0.08s;
}

.tod-icon {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

#battle-screen.menu,
#event-screen.menu {
  box-sizing: border-box;
  width: min(740px, 95vw);
  min-width: min(740px, 95vw);
  max-width: min(740px, 95vw);
  height: min(820px, 94vh);
  min-height: min(820px, 94vh);
  max-height: min(820px, 94vh);
  padding: 28px 28px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#battle-screen.menu.hidden,
#event-screen.menu.hidden {
  display: none;
}

#battle-screen.menu > .title,
#event-screen.menu > .title {
  margin-bottom: 12px;
  flex: 0 0 auto;
}

#battle-screen.menu > .menu-actions:last-of-type,
#event-screen.menu > .menu-actions:last-of-type {
  margin-top: 12px;
}

.event-panel {
  display: grid;
  gap: 16px;
  justify-items: center;
  align-content: start;
  margin: 8px 0 16px;
  padding: 24px 20px 20px;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  border-radius: 16px;
  border: 2px solid rgba(226, 232, 240, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 0 #152238;
  box-sizing: border-box;
}

.event-speaker {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.event-speaker-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.event-text {
  margin: 0;
  width: 100%;
  max-width: none;
  justify-self: stretch;
  box-sizing: border-box;
  min-height: 4.4em;
  overflow-y: auto;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  font-size: 1rem;
  line-height: 1.45;
  text-align: center;
}

#event-choices,
#event-post-actions {
  justify-content: center;
  flex: 0 0 auto;
  min-height: 168px;
  align-content: start;
}

#event-choices:empty {
  display: none;
  min-height: 0;
}

#event-choices .menu-button {
  min-width: min(240px, 100%);
}

.zone-adventure-items {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-bottom: 4px;
}

.zone-adventure-items.hidden {
  display: none;
}

.zone-item-button {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
}

.zone-item-button .zone-item-meta {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.zone-item-button img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.battle-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: start;
}

.battle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: end;
  justify-items: center;
  position: relative;
  padding: 16px 20px 14px;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  border-radius: 16px;
  border: 2px solid rgba(226, 232, 240, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 0 #152238;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

#battle-screen .menu-actions {
  flex: 0 0 auto;
  min-height: 56px;
}

.battle-fighter {
  display: grid;
  justify-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.battle-sprite-slot {
  display: grid;
  place-items: center;
  min-height: 72px;
}

.status-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 18px;
  justify-content: center;
  max-width: 180px;
}

.status-icon {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  display: none;
}

.battle-info {
  display: grid;
  gap: 4px;
  text-align: center;
}

.battle-name {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.battle-hp {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.stat-base {
  color: var(--text);
}

.stat-gear {
  color: #4ade80;
}

.stat-temp {
  color: #c084fc;
}

.stat-train {
  color: #fbbf24;
}

.battle-vs {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding-top: 4px;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(72, 210, 255, 0.35);
}

.battle-log {
  text-align: left;
  background:
    linear-gradient(180deg, rgba(72, 210, 255, 0.06), transparent 30%),
    rgba(8, 20, 34, 0.72);
  border: 1px solid rgba(72, 210, 255, 0.28);
  border-radius: 4px;
  padding: 12px;
  flex: 1 1 0;
  min-height: 120px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-dim) rgba(6, 16, 24, 0.92);
  font-size: 0.9rem;
  margin-bottom: 10px;
  box-shadow: inset 0 0 0 1px rgba(6, 16, 24, 0.8);
}

.battle-log::-webkit-scrollbar {
  width: 8px;
}

.battle-log::-webkit-scrollbar-track {
  background: rgba(6, 16, 24, 0.92);
  border-left: 1px solid rgba(72, 210, 255, 0.16);
  border-radius: 0 3px 3px 0;
}

.battle-log::-webkit-scrollbar-thumb {
  background:
    linear-gradient(180deg, rgba(122, 228, 255, 0.95) 0%, var(--cyan-dim) 100%);
  border-radius: 8px;
  border: 2px solid rgba(6, 16, 24, 0.85);
  box-shadow: 0 0 8px rgba(72, 210, 255, 0.28);
}

.battle-log::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #9aeeff 0%, var(--cyan) 100%);
}

.battle-log::-webkit-scrollbar-corner {
  background: transparent;
}

.battle-log p {
  margin: 0 0 6px;
}

.caretaker-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.home-room {
  position: relative;
  width: min(280px, 72vw);
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid rgba(72, 210, 255, 0.35);
  box-shadow:
    inset 0 0 0 1px rgba(6, 16, 24, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 0 #061018,
    0 0 18px rgba(72, 210, 255, 0.1);
  background: #2a1f16;
}

.home-room-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
}

.home-room-sprite {
  position: absolute;
  left: 50%;
  bottom: 18%;
  margin: 0;
  --scale: 4;
  width: calc(16px * var(--scale));
  height: calc(16px * var(--scale));
  transform: translateX(-50%);
  z-index: 2;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

.caretaker-info {
  display: grid;
  gap: 4px;
}

.lives-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 auto 12px;
  padding: 8px 10px;
  width: fit-content;
  border: 1px solid rgba(72, 210, 255, 0.28);
  border-radius: 4px;
  background: rgba(8, 20, 34, 0.45);
  box-shadow: inset 0 0 12px rgba(72, 210, 255, 0.06);
}

.life-heart {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.type-icon {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  object-fit: contain;
  padding: 4px;
  border-radius: 6px;
}

.battle-sprite-frame.hit {
  animation: hit-flash 0.3s ease;
}


.projectile {
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.9);
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.12s ease;
}

.projectile.from-left {
  transform: translate(-50%, -50%) scaleX(-1);
}

.projectile.element {
  background: transparent;
  box-shadow: none;
  width: 20px;
  height: 20px;
}

.projectile.visible {
  opacity: 1;
}

.projectile.fly {
  opacity: 1;
  transition:
    left var(--projectile-flight, 300ms) linear,
    top var(--projectile-flight, 300ms) linear,
    opacity 0.12s ease;
}

.projectile.fireball {
  width: 24px;
  height: 24px;
  background: transparent;
  box-shadow: none;
}

.fireball-sprite {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  transform: scale(1.8);
  transform-origin: center;
}

.element-projectile {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  transform: scale(1.35);
  transform-origin: center;
}

.projectile-crit-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transform-origin: center;
}

.projectile-crit-stack .projectile-crit-piece {
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  display: block;
  image-rendering: pixelated;
  transform: none;
}

.projectile-stage-baby_i {
  transform: scale(0.9);
}

.projectile-stage-baby_ii {
  transform: scale(1.0);
}

.projectile-stage-child {
  transform: scale(1.2);
}

.projectile-stage-adult {
  transform: scale(1.4);
}

.projectile-stage-perfect {
  transform: scale(1.6);
}

.projectile-stage-ultimate {
  transform: scale(1.8);
}

.projectile-crit-stack.projectile-stage-ultimate {
  transform: scale(1.8);
}

.train-projectile {
  position: absolute;
  top: 10px;
  left: 34px;
  z-index: 4;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
  opacity: 0;
}

.train-projectile.fly {
  opacity: 1;
  transform: translateX(70px);
  transition: transform 0.4s ease, opacity 0.2s ease;
}

.evolution-panel {
  display: grid;
  grid-template-columns: auto auto;
  gap: 24px;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}

.end-panel {
  display: grid;
  justify-content: center;
  align-items: center;
  margin: 24px 0;
}

#evolution-old.fade-out {
  animation: evo-fade 2s ease forwards;
}

#evolution-new.reveal {
  animation: evo-reveal 1.2s ease forwards;
}

@keyframes evo-fade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes evo-reveal {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.zone-scene-fade {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
}

.zone-scene-fade.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(440px, 92vw);
  border-radius: 6px;
  border: 2px solid rgba(72, 210, 255, 0.35);
  background:
    linear-gradient(180deg, rgba(72, 210, 255, 0.08), transparent 28%),
    linear-gradient(150deg, rgba(18, 36, 56, 0.98), rgba(10, 20, 34, 0.96));
  box-shadow:
    inset 0 0 0 1px rgba(6, 16, 24, 0.9),
    0 0 0 3px #0a1624,
    0 24px 70px rgba(4, 8, 16, 0.7),
    0 0 28px rgba(72, 210, 255, 0.12);
  padding: 24px 22px;
  text-align: left;
  clip-path: polygon(
    0 10px,
    10px 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% calc(100% - 10px),
    calc(100% - 10px) 100%,
    10px 100%,
    0 calc(100% - 10px)
  );
}

.final-challenge-popup {
  animation: popup-enter 0.18s ease-out;
}

.modal-eyebrow {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #fca5a5;
}

.modal-title {
  margin: 10px 0 10px;
  font-size: 1.5rem;
  color: #ffe4e6;
}

.modal-message {
  margin: 0 0 20px;
  line-height: 1.45;
  color: rgba(244, 244, 255, 0.9);
}

.modal-actions {
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .modal-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@keyframes popup-enter {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.drop-popup .modal-eyebrow {
  color: #fde68a;
}

.drop-popup .modal-title {
  color: #e8fbff;
}

.drop-modal-list {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.drop-modal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(72, 210, 255, 0.28);
  border-radius: 4px;
  background: rgba(8, 20, 34, 0.55);
}

.drop-modal-item img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

.drop-modal-item strong {
  color: #e8fbff;
}

.drop-popup .modal-actions {
  grid-template-columns: 1fr;
}

.zone-info-section {
  width: min(920px, 100%);
  margin: 10px auto 18px;
  text-align: left;
}

.zone-info-heading {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: #dbe7ff;
}

.zone-info-grid {
  margin: 0;
  justify-content: flex-start;
}

.zone-info-card {
  cursor: default;
  pointer-events: none;
  min-height: 190px;
  align-items: flex-start;
}

.zone-info-detail {
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(210, 222, 255, 0.88);
}

.zone-info-card .character-sprite-frame,
.zone-info-unknown {
  width: 72px;
  height: 72px;
}

.zone-info-unknown {
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  border-radius: 12px;
  border: 2px dashed rgba(180, 200, 240, 0.35);
  background: rgba(10, 16, 28, 0.55);
  color: #9eb0d0;
  font-size: 1.6rem;
  font-weight: 700;
}

.zone-info-empty {
  margin: 0;
  color: rgba(220, 228, 255, 0.7);
  font-size: 0.92rem;
}

/* DEBUG Dex */
#dex-menu {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
}

#dex-menu.hidden {
  display: none;
}

.dex-screen {
  width: 100%;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dex-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dex-filter {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid rgba(72, 210, 255, 0.32);
  color: rgba(210, 230, 255, 0.88);
  background: rgba(8, 24, 40, 0.75);
}

.dex-filter:hover {
  border-color: rgba(72, 210, 255, 0.6);
}

.dex-filter.is-active {
  color: #e8fbff;
  border-color: rgba(72, 210, 255, 0.85);
  background: rgba(32, 78, 112, 0.85);
}

.dex-filter-unused.is-active {
  border-color: rgba(140, 150, 170, 0.7);
  color: #d5dce8;
}

.dex-filter-wild.is-active {
  border-color: rgba(90, 220, 140, 0.7);
  color: #c4f8d6;
}

.dex-filter-event.is-active {
  border-color: rgba(170, 140, 255, 0.7);
  color: #e2d8ff;
}

.dex-filter-boss.is-active {
  border-color: rgba(255, 120, 90, 0.75);
  color: #ffd0c2;
}

.dex-filter-playable.is-active {
  border-color: rgba(72, 210, 255, 0.85);
  color: #c5f3ff;
}

.dex-filter-heal.is-active {
  border-color: rgba(90, 220, 140, 0.7);
  color: #c4f8d6;
}

.dex-filter-debuff.is-active {
  border-color: rgba(255, 120, 90, 0.75);
  color: #ffd0c2;
}

.dex-filter-statDebuff.is-active {
  border-color: rgba(255, 160, 70, 0.75);
  color: #ffd9b0;
}

.dex-filter-buff.is-active {
  border-color: rgba(170, 140, 255, 0.7);
  color: #e2d8ff;
}

.dex-filter-statBuff.is-active {
  border-color: rgba(120, 200, 255, 0.75);
  color: #c5eeff;
}

.dex-filter-other.is-active,
.dex-filter-usable.is-active {
  border-color: rgba(72, 210, 255, 0.85);
  color: #c5f3ff;
}

.dex-filter-equipment.is-active {
  border-color: rgba(255, 196, 90, 0.75);
  color: #ffe4b3;
}

.dex-filter-key.is-active {
  border-color: rgba(255, 214, 120, 0.75);
  color: #fff0c2;
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  overflow-y: auto;
  max-height: min(68vh, 720px);
  padding: 8px;
  border: 1px solid rgba(72, 210, 255, 0.28);
  border-radius: 4px;
  background: rgba(8, 20, 34, 0.45);
  box-shadow: inset 0 0 0 1px rgba(6, 16, 24, 0.8);
}

.dex-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 6px 8px;
  border: 1px solid rgba(72, 210, 255, 0.22);
  border-radius: 4px;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(72, 210, 255, 0.08), transparent 40%),
    rgba(16, 34, 52, 0.9);
}

.dex-sprite-frame {
  position: relative;
  --scale: 3;
  width: calc(16px * var(--scale));
  height: calc(16px * var(--scale));
  margin: 0 auto;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
}

.dex-entry-number {
  position: absolute;
  top: 2px;
  left: 3px;
  z-index: 2;
  padding: 0.05rem 0.3rem;
  border-radius: 0.25rem;
  background: rgba(2, 6, 23, 0.82);
  color: #e2e8f0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  pointer-events: none;
}

.dex-entry-index {
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

/* Size via width/height so the full sprite stays centered (no scale-transform crop) */
.dex-sprite-frame .character-sprite {
  width: 100%;
  height: 100%;
  transform: none;
  object-fit: contain;
  object-position: center;
  image-rendering: pixelated;
}

.dex-entry-label {
  display: grid;
  gap: 2px;
  text-align: center;
  width: 100%;
  min-height: 2.4em;
}

.dex-entry-label strong {
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dex-entry-label span {
  font-size: 0.65rem;
  color: var(--cyan);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dex-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  margin-top: 2px;
}

.dex-tag {
  font-style: normal;
  font-size: 0.58rem;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 4px;
  border-radius: 2px;
  border: 1px solid rgba(72, 210, 255, 0.35);
  color: rgba(210, 230, 255, 0.9);
  background: rgba(8, 24, 40, 0.75);
}

.dex-tag-boss {
  border-color: rgba(255, 120, 90, 0.55);
  color: #ffb39a;
}

.dex-tag-playable {
  border-color: rgba(72, 210, 255, 0.6);
  color: #9ce8ff;
}

.dex-tag-wild {
  border-color: rgba(90, 220, 140, 0.55);
  color: #a8f0c0;
}

.dex-tag-event {
  border-color: rgba(170, 140, 255, 0.55);
  color: #d2c4ff;
}

.dex-tag-unused {
  border-color: rgba(140, 150, 170, 0.4);
  color: rgba(180, 190, 210, 0.7);
}

.dex-special {
  display: grid;
  gap: 2px;
  justify-items: center;
  width: 100%;
  margin-top: 2px;
}

.dex-special-name,
.dex-special-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  font-size: 0.58rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dex-special-name {
  color: #fde68a;
}

.dex-special-type {
  color: #fda4af;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dex-special-proj,
.dex-special-type img {
  width: 14px;
  height: 14px;
  object-fit: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

#stats-menu {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
}

#stats-menu.hidden {
  display: none;
}

.stats-grid {
  display: block;
  padding: 0;
  overflow: auto;
}

.debug-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.debug-stats-table th,
.debug-stats-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(72, 210, 255, 0.16);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.debug-stats-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  cursor: pointer;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(210, 230, 255, 0.78);
  background: rgba(8, 24, 40, 0.96);
}

.debug-stats-table thead th:hover,
.debug-stats-table thead th.is-sorted {
  color: #e8fbff;
}

.debug-stats-table tbody tr:hover {
  background: rgba(72, 210, 255, 0.08);
}

.debug-stats-sprite {
  width: 56px;
}

.debug-stats-sprite-frame {
  --scale: 2.4;
}

.debug-stats-name {
  font-weight: 700;
  color: #e8fbff;
}

.debug-stats-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.debug-stats-table th:nth-child(n + 6):nth-child(-n + 10),
.debug-stats-table td.debug-stats-num {
  text-align: right;
}

.debug-stats-special .dex-special {
  justify-items: start;
}

.debug-stats-special .dex-special-name,
.debug-stats-special .dex-special-type {
  justify-content: flex-start;
}

#items-menu {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
}

#items-menu.hidden {
  display: none;
}

.items-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.debug-item-entry {
  min-height: 150px;
}

.debug-item-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto;
}

.debug-item-desc {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 0.62rem;
  line-height: 1.25;
  color: rgba(200, 214, 235, 0.85);
  text-transform: none;
  letter-spacing: 0;
}

#events-menu {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
}

#events-menu.hidden {
  display: none;
}

.events-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.debug-event-entry {
  min-height: 180px;
  cursor: pointer;
  text-align: left;
}

.debug-event-entry .dex-entry-label {
  text-align: left;
}

.debug-event-blurb {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.debug-event-details {
  display: none;
  width: 100%;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(72, 210, 255, 0.2);
  text-align: left;
}

.debug-event-entry.is-open {
  grid-column: 1 / -1;
}

.debug-event-entry.is-open .debug-event-details {
  display: block;
}

.debug-event-entry.is-open .debug-event-blurb {
  display: none;
}

.debug-event-meta,
.debug-event-node,
.debug-event-choice {
  margin: 0 0 4px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(210, 224, 240, 0.92);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.debug-event-node {
  color: var(--cyan);
  margin-top: 8px;
}

.debug-event-choice {
  padding-left: 8px;
  color: rgba(200, 214, 235, 0.88);
}
  letter-spacing: 0;
}
