@font-face {
  font-family: "Made Evolve Sans";
  src: url("./assets/fonts/made_evolve_sans_regular.otf") format("opentype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Made Evolve Sans";
  src: url("./assets/fonts/made_evolve_sans_medium.otf") format("opentype");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

@font-face {
  font-family: "Made Evolve Sans";
  src: url("./assets/fonts/made_evolve_sans_bold.otf") format("opentype");
  font-display: swap;
  font-style: normal;
  font-weight: 900;
}

:root {
  color-scheme: dark;
  --display-font: "Made Evolve Sans", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  --body-font: "Made Evolve Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #121018;
  --panel: #201a2a;
  --panel-2: #2b2237;
  --panel-3: #171322;
  --line: rgba(255, 255, 255, 0.12);
  --text: #fbf7ff;
  --muted: #b9aec8;
  --green: #70e8ff;
  --gold: #ffd166;
  --blue: #70e8ff;
  --pink: #b36cff;
  --danger: #ff5f7a;
  --accent: #b36cff;
  --accent-2: #70e8ff;
  --accent-rgb: 179, 108, 255;
  --accent-2-rgb: 112, 232, 255;
  --gold-rgb: 255, 209, 102;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 18% 12%, rgba(var(--accent-2-rgb), 0.14), transparent 24rem),
    radial-gradient(circle at 82% 18%, rgba(var(--accent-rgb), 0.16), transparent 22rem),
    linear-gradient(145deg, #111018 0%, #191226 48%, #16171f 100%);
  color: var(--text);
  font-family: var(--body-font);
}

body::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.1), transparent 34rem);
  background-size: 100% 4px, auto;
  content: "";
  inset: 0;
  opacity: 0.55;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

button {
  border: 1px solid rgba(var(--accent-rgb), 0.48);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.28), rgba(var(--accent-2-rgb), 0.08)),
    rgba(28, 22, 40, 0.92);
  color: var(--text);
  cursor: pointer;
  font-family: var(--display-font);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  min-height: 36px;
  padding: 8px 12px;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.34);
}

button:hover {
  border-color: var(--accent-2);
  background:
    linear-gradient(135deg, rgba(var(--accent-2-rgb), 0.32), rgba(var(--accent-rgb), 0.22)),
    rgba(32, 26, 42, 0.96);
  box-shadow: 0 0 18px rgba(var(--accent-2-rgb), 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.game-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  overflow: hidden;
  padding: 14px;
}

.topbar,
.shop-panel,
.inventory-panel,
.base-map {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(43, 34, 55, 0.78), rgba(24, 19, 35, 0.92)),
    rgba(32, 26, 42, 0.9);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.32),
    0 0 28px rgba(var(--accent-rgb), 0.08);
}

.topbar {
  align-items: center;
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 78px;
  overflow: hidden;
  padding: 12px 16px;
}

.topbar > div:first-child,
.layout > * {
  min-width: 0;
}

.title-group {
  align-items: center;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 16px;
  min-width: 0;
}

.nostalgix-logo {
  display: block;
  flex: 0 1 auto;
  height: clamp(34px, 4.8vw, 58px);
  max-width: min(34vw, 330px);
  object-fit: contain;
  filter:
    drop-shadow(0 0 10px rgba(var(--accent-rgb), 0.55))
    drop-shadow(0 0 18px rgba(var(--accent-2-rgb), 0.25));
}

.dex-open,
.menu-open {
  flex: 0 0 auto;
  min-height: 34px;
  white-space: nowrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--display-font);
  font-size: clamp(30px, 3.2vw, 50px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.94;
  text-transform: uppercase;
  text-shadow:
    0 0 16px rgba(var(--accent-rgb), 0.32),
    0 0 24px rgba(var(--accent-2-rgb), 0.18);
}

h2 {
  font-family: var(--display-font);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stats {
  display: grid;
  flex: 1;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  max-width: 760px;
  min-width: 0;
  width: auto;
}

.stats div {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-2-rgb), 0.04)),
    rgba(18, 16, 24, 0.78);
  padding: 8px;
}

.stats span,
small {
  color: var(--muted);
  display: block;
  font-family: var(--body-font);
  font-size: 12px;
}

.stats strong {
  display: block;
  font-family: var(--display-font);
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.95;
  margin-top: 2px;
}

.layout {
  display: grid;
  flex: 1;
  gap: 14px;
  grid-template-columns: 260px minmax(540px, 1fr) 280px;
  min-height: 0;
}

.shop-panel,
.inventory-panel {
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
}

.shop-panel {
  padding-top: 14px;
}

.inventory-panel {
  overflow: auto;
}

.panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.icon-button {
  align-items: center;
  display: inline-flex;
  font-size: 20px;
  justify-content: center;
  min-height: 36px;
  padding: 0;
  width: 36px;
}

.shop-track {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: max-content;
  position: relative;
  will-change: transform;
  z-index: 1;
}

.shop-panel {
  overflow: hidden;
}

.shop-speed-control {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-2-rgb), 0.06)),
    rgba(18, 16, 24, 0.92);
  border: 1px solid rgba(var(--accent-2-rgb), 0.22);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-bottom: 10px;
  padding: 8px;
  position: relative;
  z-index: 3;
}

.shop-speed-control label,
.shop-speed-control span {
  color: var(--text);
  font-family: var(--display-font);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.shop-speed-control span {
  color: var(--accent-2);
  min-width: 38px;
  text-align: right;
}

.shop-speed-control input {
  accent-color: var(--accent-2);
  cursor: pointer;
  min-width: 0;
  width: 100%;
}

.base-map {
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1.1fr 1fr;
  grid-template-rows: 124px minmax(138px, 0.48fr) minmax(245px, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 14px;
  position: relative;
}

.base-map::before,
.shop-panel::before,
.inventory-panel::before {
  background:
    linear-gradient(90deg, transparent, rgba(var(--accent-2-rgb), 0.16), transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent);
  content: "";
  height: 1px;
  left: 10px;
  opacity: 0.7;
  pointer-events: none;
  position: absolute;
  right: 10px;
  top: 0;
}

.shop-panel,
.inventory-panel {
  position: relative;
}

.zone,
.workbench-zone,
.machine-zone {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.09), rgba(var(--accent-2-rgb), 0.03)),
    rgba(18, 16, 24, 0.74);
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.04);
}

.zone {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(150px, 1fr) minmax(78px, max-content);
  justify-content: center;
  text-align: left;
}

.zone-action {
  align-items: center;
  display: grid;
  gap: 5px 6px;
  grid-template-columns: 48px minmax(82px, max-content);
  grid-template-rows: auto 48px;
  min-width: 0;
}

.zone-label,
.zone-title {
  color: var(--muted);
  font-family: var(--display-font);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.zone-icon {
  align-items: center;
  border-radius: 50%;
  display: flex;
  font-family: var(--display-font);
  font-size: 36px;
  grid-column: 1;
  grid-row: 2;
  height: 48px;
  justify-content: center;
  line-height: 1;
  margin: 0;
  width: 48px;
}

.click-icon {
  border: 2px solid var(--accent-2);
  color: var(--accent-2);
  box-shadow: 0 0 18px rgba(var(--accent-2-rgb), 0.2);
}

.rebirth-icon {
  border: 2px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.24);
}

.gold-mine {
  grid-column: 1;
  grid-row: 1;
}

.click-upgrade {
  grid-column: 2;
  grid-row: 1;
}

.rebirth-pod {
  grid-column: 3;
  grid-row: 1;
}

.mine-core {
  align-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  display: flex;
  font-family: var(--display-font);
  font-size: 36px;
  font-weight: 900;
  grid-column: 1;
  grid-row: 2;
  height: 48px;
  justify-content: center;
  margin: 0;
  width: 48px;
  box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.22);
}

.zone-action .zone-label {
  grid-column: 1 / -1;
  grid-row: 1;
  margin-bottom: 0;
}

.zone-action button {
  grid-column: 2;
  grid-row: 2;
}

.zone-stat {
  align-self: center;
  color: var(--text);
  display: grid;
  font-family: var(--display-font);
  gap: 2px;
  justify-self: end;
  min-width: 78px;
  overflow: hidden;
  text-align: left;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

.zone-stat strong {
  display: block;
  font-size: clamp(22px, 1.55vw, 28px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.92;
  overflow-wrap: anywhere;
  white-space: normal;
}

.zone-stat small {
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.zone-stat .stat-unit,
.zone-stat .stat-extra {
  display: block;
  font-size: 0.62em;
  line-height: 1;
  margin-top: 2px;
}

.zone-stat .stat-extra {
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.zone-action button {
  font-size: 15px;
  justify-self: start;
  min-height: 29px;
  padding: 4px 7px;
}

.workbench-zone {
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: 0;
  overflow: hidden;
  padding: 10px 12px;
}

.machine-zone {
  grid-column: 1 / -1;
  grid-row: 3;
  min-height: 0;
  overflow: auto;
}

.workbenches,
.machine-slots {
  display: grid;
  gap: 8px;
}

.workbenches {
  grid-template-columns: repeat(6, minmax(105px, 1fr));
}

.machine-slots {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.bench,
.slot {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  min-height: 122px;
  padding: 9px;
  position: relative;
}

.slot:has(.machine-unit) {
  display: flex;
}

.bench button {
  font-size: 16px;
  min-height: 30px;
  padding: 5px 10px;
  white-space: nowrap;
}

.bench {
  min-height: 82px;
}

.bench.locked,
.slot.locked {
  filter: grayscale(1);
  opacity: 0.45;
}

.bench.ready {
  border-color: var(--accent-2);
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-2-rgb), 0.35),
    0 0 16px rgba(var(--accent-2-rgb), 0.14);
}

.bench[class*="rarity-"] {
  background:
    linear-gradient(135deg, rgba(var(--rarity-rgb), 0.88), rgba(var(--rarity-rgb), 0.28)),
    var(--panel-2);
  border-color: var(--rarity);
  color: var(--card-text);
  text-shadow: var(--card-shadow);
}

.bench[class*="rarity-"] small {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.68);
}

.rarity-rainbow.bench {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.12)),
    linear-gradient(125deg, #ff4242 0%, #ffd84a 20%, #58e870 39%, #40d9ff 58%, #7557ff 78%, #ff58d2 100%);
}

.progress {
  background: rgba(4, 4, 8, 0.74);
  border-radius: 999px;
  height: 8px;
  margin: 8px 0;
  overflow: hidden;
}

.progress span {
  background: linear-gradient(90deg, var(--accent-2), var(--gold));
  display: block;
  height: 100%;
  width: 0%;
}

.card,
.machine-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 10px;
  position: relative;
}

.card,
.machine-card,
.machine-unit {
  background:
    linear-gradient(135deg, rgba(var(--rarity-rgb), 0.92), rgba(var(--rarity-rgb), 0.35)),
    var(--panel-2);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.15),
    0 8px 22px rgba(0, 0, 0, 0.16);
  color: var(--card-text);
  overflow: hidden;
  text-shadow: var(--card-shadow);
}

.rarity-rainbow.card,
.rarity-rainbow.machine-card,
.rarity-rainbow.machine-unit,
.rarity-unique.card,
.rarity-unique.machine-card,
.rarity-unique.machine-unit {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.12)),
    linear-gradient(125deg, #ff4242 0%, #ffd84a 20%, #58e870 39%, #40d9ff 58%, #7557ff 78%, #ff58d2 100%);
}

.card {
  display: grid;
  gap: 6px 10px;
  grid-template-columns: minmax(92px, 0.72fr) minmax(110px, 1fr);
  grid-template-rows: auto 1fr auto;
  min-height: 142px;
  text-align: left;
}

.machine-card {
  display: grid;
  gap: 4px 10px;
  grid-template-columns: 1fr 76px;
  min-height: 92px;
  text-align: left;
}

.card:hover,
.machine-card:hover,
.machine-unit:hover {
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.64), rgba(0, 0, 0, 0.36)),
    linear-gradient(135deg, rgba(var(--rarity-rgb), 0.92), rgba(var(--rarity-rgb), 0.42));
  border-color: rgba(255, 255, 255, 0.82);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.78);
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 18px rgba(var(--accent-2-rgb), 0.16),
    0 12px 26px rgba(0, 0, 0, 0.22);
}

.rarity-rainbow.card:hover,
.rarity-rainbow.machine-card:hover,
.rarity-rainbow.machine-unit:hover,
.rarity-unique.card:hover,
.rarity-unique.machine-card:hover,
.rarity-unique.machine-unit:hover {
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0.28)),
    linear-gradient(125deg, #ff4242 0%, #ffd84a 20%, #58e870 39%, #40d9ff 58%, #7557ff 78%, #ff58d2 100%);
}

.card:hover .card-price,
.card:hover .card-name {
  color: #fff;
}

.rarity-default {
  --rarity: #d9c6ff;
  --rarity-rgb: 217, 198, 255;
  --card-text: #14111f;
  --card-shadow: none;
}

.rarity-gold {
  --rarity: var(--gold);
  --rarity-rgb: 243, 200, 80;
  --card-text: #1f1702;
  --card-shadow: none;
}

.rarity-diamond {
  --rarity: var(--accent-2);
  --rarity-rgb: var(--accent-2-rgb);
  --card-text: #061521;
  --card-shadow: none;
}

.rarity-rainbow {
  --rarity: #ffffff;
  --rarity-rgb: 255, 121, 204;
  --card-text: #fff9ff;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

.rarity-level1 {
  --rarity: #d9c6ff;
  --rarity-rgb: 217, 198, 255;
  --card-text: #14111f;
  --card-shadow: none;
}

.rarity-level2 {
  --rarity: #f3c850;
  --rarity-rgb: 243, 200, 80;
  --card-text: #1f1702;
  --card-shadow: none;
}

.rarity-level3 {
  --rarity: var(--accent-2);
  --rarity-rgb: var(--accent-2-rgb);
  --card-text: #061521;
  --card-shadow: none;
}

.rarity-unique {
  --rarity: #ffffff;
  --rarity-rgb: 255, 121, 204;
  --card-text: #fff9ff;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

.card,
.machine-card,
.machine-unit {
  border-color: var(--rarity);
}

.card-name,
.machine-name {
  font-family: var(--display-font);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.12;
  padding-right: 18px;
}

.card .card-name {
  grid-column: 1 / -1;
  grid-row: 1;
  padding-right: 0;
  width: 90%;
}

.branded-name {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.brand-chip {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(var(--accent-2-rgb), 0.2), rgba(var(--accent-rgb), 0.22)),
    rgba(20, 15, 33, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 3px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 17px;
  justify-content: center;
  overflow: hidden;
  padding: 2px;
  transform: translateY(-3px);
  width: 17px;
}

.brand-chip img {
  display: block;
  height: 100%;
  object-fit: contain;
  object-position: center;
  width: 100%;
}

.card-price {
  display: block;
  font-family: var(--display-font);
  font-size: 34px;
  font-weight: 900;
  grid-column: 1;
  grid-row: 3;
  letter-spacing: 0.02em;
  line-height: 0.95;
  margin-top: 6px;
}

.machine-art {
  align-items: center;
  display: flex;
  height: 54px;
  justify-content: center;
  margin: 8px 0;
  width: 100%;
}

.card .machine-art {
  grid-column: 2;
  grid-row: 2 / span 2;
  height: 100%;
  margin: 0;
  min-height: 82px;
  position: relative;
}

.machine-art img {
  display: block;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.28));
  image-rendering: pixelated;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.machine-card .machine-art {
  align-self: center;
  grid-column: 2;
  grid-row: 1 / span 3;
  height: 58px;
  margin: 0;
  position: relative;
}

.machine-unit .machine-art {
  flex: 1;
  height: auto;
  margin: 2px 0 18px;
  min-height: 70px;
  position: relative;
}

.machine-unit .machine-art img {
  max-height: 96px;
}

.machine-card .card-name,
.machine-card small {
  grid-column: 1;
}

.machine-card small,
.machine-unit small {
  color: rgba(0, 0, 0, 0.72);
  font-weight: 800;
}

.rarity-rainbow.machine-card small,
.rarity-rainbow.machine-unit small,
.rarity-unique.machine-card small,
.rarity-unique.machine-unit small,
.machine-card:hover small,
.machine-unit:hover small {
  color: rgba(255, 255, 255, 0.86);
}

.inventory {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  overflow-wrap: anywhere;
}

.machine-vault {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-top: 12px;
  overflow: visible;
  padding-top: 12px;
}

.machine-unit {
  border: 2px solid var(--rarity);
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  min-height: 72px;
  padding: 9px 9px 24px;
  position: relative;
  text-align: left;
  width: 100%;
}

.placed {
  height: 100%;
}

.income-badge {
  align-self: flex-end;
  bottom: 8px;
  color: rgba(0, 0, 0, 0.78);
  font-size: 12px;
  font-weight: 900;
  margin-top: auto;
  position: absolute;
  right: 9px;
}

.rarity-rainbow .income-badge,
.rarity-unique .income-badge,
.machine-unit:hover .income-badge {
  color: rgba(255, 255, 255, 0.9);
}

.muted {
  color: var(--muted);
}

.toast {
  background:
    linear-gradient(135deg, rgba(var(--accent-2-rgb), 0.96), rgba(var(--accent-rgb), 0.9));
  border-radius: 999px;
  bottom: 18px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  color: #0f0d16;
  font-weight: 900;
  left: 50%;
  opacity: 0;
  padding: 10px 18px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal {
  border: 1px solid rgba(var(--accent-2-rgb), 0.34);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.13), rgba(var(--accent-2-rgb), 0.05)),
    var(--panel);
  color: var(--text);
  max-width: 520px;
  box-shadow:
    0 24px 90px rgba(0, 0, 0, 0.48),
    0 0 32px rgba(var(--accent-rgb), 0.16);
  width: min(92vw, 520px);
}

.modal h2 {
  text-shadow: 0 0 14px rgba(var(--accent-rgb), 0.26);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.modal form {
  display: grid;
  gap: 14px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-button {
  background:
    linear-gradient(135deg, rgba(255, 95, 122, 0.26), rgba(255, 95, 122, 0.08)),
    #2b1621;
  border-color: var(--danger);
  color: #fff3f1;
}

.danger-button:hover {
  background:
    linear-gradient(135deg, rgba(255, 95, 122, 0.42), rgba(255, 95, 122, 0.14)),
    #3a1827;
  border-color: #ffaaa3;
}

.requirement {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.08), rgba(var(--accent-2-rgb), 0.03)),
    rgba(18, 16, 24, 0.66);
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  padding: 9px;
}

.ok {
  color: var(--accent-2);
}

.bad {
  color: var(--danger);
}

.dex-modal {
  max-width: 1060px;
  width: min(94vw, 1060px);
}

.dex-modal form {
  max-height: min(82vh, 780px);
}

.dex-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.dex-tabs {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dex-tab {
  background:
    linear-gradient(135deg, rgba(var(--rarity-rgb), 0.72), rgba(var(--rarity-rgb), 0.24)),
    var(--panel-2);
  border-color: var(--rarity);
  color: var(--card-text);
  min-width: 0;
}

.dex-tab.active {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.72) inset,
    0 0 18px rgba(var(--accent-2-rgb), 0.2);
}

.dex-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  overflow: auto;
  padding-right: 4px;
}

.dex-entry {
  border: 1px solid var(--rarity);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(var(--rarity-rgb), 0.7), rgba(var(--rarity-rgb), 0.22)),
    var(--panel-2);
  min-height: 164px;
  overflow: hidden;
  padding: 9px;
}

.rarity-rainbow.dex-entry,
.rarity-rainbow.dex-tab,
.rarity-unique.dex-entry,
.rarity-unique.dex-tab {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.12)),
    linear-gradient(125deg, #ff4242 0%, #ffd84a 20%, #58e870 39%, #40d9ff 58%, #7557ff 78%, #ff58d2 100%);
}

.dex-entry.locked {
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.08), rgba(0, 0, 0, 0.12)),
    #111018;
  border-color: rgba(255, 255, 255, 0.1);
}

.dex-image {
  align-items: center;
  display: flex;
  height: 92px;
  justify-content: center;
}

.dex-image img {
  display: block;
  image-rendering: pixelated;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.dex-entry.locked .dex-image img {
  filter: grayscale(1) brightness(0.24) contrast(1.12);
  opacity: 0.74;
}

.dex-entry h3 {
  font-family: var(--display-font);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  margin: 8px 0 2px;
}

.dex-entry small {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.menu-modal {
  max-width: 720px;
  width: min(92vw, 720px);
}

.menu-head {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.menu-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.menu-stats div {
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-2-rgb), 0.04)),
    rgba(18, 16, 24, 0.78);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 72px;
  padding: 10px;
}

.menu-stats span {
  color: var(--muted);
  display: block;
  font-family: var(--body-font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.menu-stats strong {
  display: block;
  font-family: var(--display-font);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.95;
  margin-top: 8px;
}

.menu-actions {
  justify-content: space-between;
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .game-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar,
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }

  .layout {
    display: flex;
    flex-direction: column;
  }

  .shop-panel {
    max-height: 340px;
  }

  .base-map {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .gold-mine,
  .click-upgrade,
  .rebirth-pod,
  .workbench-zone,
  .machine-zone {
    grid-column: 1;
    grid-row: auto;
  }

  .workbenches,
  .machine-slots {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}
