:root {
  --bg-main: #1e1916;
  --bg-panel: #29221e;
  --bg-module: #221c18;
  --bg-header: #251f1b;
  --bg-well: #1a1512;
  --bg-track: #171310;
  --bg-btn: #382e28;
  --border-panel: #42362f;
  --border-module: #3e332c;
  --border-btn: #5c4b41;
  --text-main: #f4ece1;
  --text-heading: #f7d9b4;
  --text-sub: #b59f8d;
  --accent: #e89f48;
  --accent-contrast: #1e1916;
  --funds-bg: #1f2922;
  --funds-border: #4fa86e;
  --funds-label: #8ce3a8;
  --funds-val: #b8f5cb;
  --rp-bg: #1d2a29;
  --rp-border: #4fa89b;
  --rp-text: #8ce3d5;
}

/* Starter Computer Green Theme */
body.theme-computer-green {
  --bg-main: #040a04;
  --bg-panel: #081408;
  --bg-module: #061006;
  --bg-header: #071207;
  --bg-well: #020602;
  --bg-track: #020502;
  --bg-btn: #0d210d;
  --border-panel: #1c5c18;
  --border-module: #154712;
  --border-btn: #39ff14;
  --text-main: #7bff66;
  --text-heading: #39ff14;
  --text-sub: #43b534;
  --accent: #39ff14;
  --accent-contrast: #040a04;
  --funds-bg: #071a09;
  --funds-border: #39ff14;
  --funds-label: #7bff66;
  --funds-val: #b8ffad;
  --rp-bg: #071a14;
  --rp-border: #38e89e;
  --rp-text: #7bffc9;
}

/* Starter Light Mode Theme (White) */
body.theme-light-mode {
  --bg-main: #ffffff;
  --bg-panel: #f7f8fa;
  --bg-module: #ffffff;
  --bg-header: #f2f4f7;
  --bg-well: #eef0f4;
  --bg-track: #e6e9ef;
  --bg-btn: #e8ecf2;
  --border-panel: #d0d5dd;
  --border-module: #dce0e8;
  --border-btn: #b8c0cc;
  --text-main: #181c22;
  --text-heading: #101318;
  --text-sub: #525b68;
  --accent: #b86814;
  --accent-contrast: #ffffff;
  --funds-bg: #edf7f0;
  --funds-border: #2e8b52;
  --funds-label: #1e6b3c;
  --funds-val: #15522d;
  --rp-bg: #edf6f6;
  --rp-border: #2b7a78;
  --rp-text: #1f5f5d;
}

/* Solid Gold UI (Unlocked upon conquering final Earth territory) */
body.theme-gold-solid {
  --bg-main: #241905;
  --bg-panel: #362507;
  --bg-module: #2c1e06;
  --bg-header: #332307;
  --bg-well: #1a1203;
  --bg-track: #140e02;
  --bg-btn: #4a3309;
  --border-panel: #d4a024;
  --border-module: #b3841b;
  --border-btn: #ffd166;
  --text-main: #fff7dc;
  --text-heading: #ffe58f;
  --text-sub: #e6c473;
  --accent: #ffd166;
  --accent-contrast: #1f1402;
  --funds-bg: #2b2209;
  --funds-border: #ffd166;
  --funds-label: #ffe58f;
  --funds-val: #fff7dc;
  --rp-bg: #2e2008;
  --rp-border: #ffbe3b;
  --rp-text: #ffe08a;
}

body.theme-terminal {
  --bg-main: #0d1314;
  --bg-panel: #131c1e;
  --bg-module: #101719;
  --bg-header: #11191b;
  --bg-well: #090e0f;
  --bg-track: #080c0d;
  --bg-btn: #1a272a;
  --border-panel: #24383c;
  --border-module: #1e2f33;
  --border-btn: #2f4a50;
  --text-main: #e2f1f2;
  --text-heading: #8ef0e4;
  --text-sub: #7fa3a7;
  --accent: #38d9c5;
  --accent-contrast: #081213;
  --funds-bg: #10241b;
  --funds-border: #38c97a;
  --funds-label: #7be8ab;
  --funds-val: #b9fad5;
  --rp-bg: #12212b;
  --rp-border: #4aa3df;
  --rp-text: #8ccbf5;
}

body.theme-copper {
  --bg-main: #1b1514;
  --bg-panel: #271e1c;
  --bg-module: #201817;
  --bg-header: #241b19;
  --bg-well: #161110;
  --bg-track: #130e0d;
  --bg-btn: #362724;
  --border-panel: #4a3530;
  --border-module: #402d29;
  --border-btn: #63453e;
  --text-main: #f5ebe8;
  --text-heading: #f7c7b4;
  --text-sub: #b89890;
  --accent: #e07a5f;
  --accent-contrast: #1b1514;
  --funds-bg: #1e2820;
  --funds-border: #55a66c;
  --funds-label: #90e0a7;
  --funds-val: #c0f5cf;
  --rp-bg: #261e29;
  --rp-border: #9b6bb5;
  --rp-text: #d5aee8;
}

/* Continent-Unlocked Themes */
body.theme-emerald {
  --bg-main: #0f1a14;
  --bg-panel: #16261d;
  --bg-module: #121f18;
  --bg-header: #14221a;
  --bg-well: #0b140f;
  --bg-track: #09100c;
  --bg-btn: #1f3629;
  --border-panel: #2b4d3a;
  --border-module: #233f30;
  --border-btn: #3a664e;
  --text-main: #e6f5ec;
  --text-heading: #9ef0be;
  --text-sub: #82b396;
  --accent: #4ad682;
  --accent-contrast: #0b1710;
  --funds-bg: #142e1e;
  --funds-border: #57e389;
  --funds-label: #99f5b9;
  --funds-val: #ccffde;
  --rp-bg: #14292b;
  --rp-border: #48b8c9;
  --rp-text: #95e5f2;
}

body.theme-indigo {
  --bg-main: #131321;
  --bg-panel: #1b1b2e;
  --bg-module: #171726;
  --bg-header: #19192b;
  --bg-well: #0e0e1a;
  --bg-track: #0b0b14;
  --bg-btn: #262640;
  --border-panel: #38385c;
  --border-module: #2e2e4d;
  --border-btn: #4a4a78;
  --text-main: #ececfa;
  --text-heading: #c7c4ff;
  --text-sub: #9593bd;
  --accent: #9d8df7;
  --accent-contrast: #100f1f;
  --funds-bg: #172924;
  --funds-border: #4ec99b;
  --funds-label: #92edd0;
  --funds-val: #c7faea;
  --rp-bg: #241b36;
  --rp-border: #b37feb;
  --rp-text: #dec2ff;
}

body.theme-sahara {
  --bg-main: #1f1911;
  --bg-panel: #2d2418;
  --bg-module: #261e14;
  --bg-header: #292116;
  --bg-well: #17120c;
  --bg-track: #120e09;
  --bg-btn: #3d3120;
  --border-panel: #59472e;
  --border-module: #4a3b26;
  --border-btn: #755e3d;
  --text-main: #faf2e6;
  --text-heading: #ffe09e;
  --text-sub: #c2aa84;
  --accent: #f5b841;
  --accent-contrast: #1c150b;
  --funds-bg: #1f2b1c;
  --funds-border: #63b856;
  --funds-label: #a2eb96;
  --funds-val: #d2facc;
  --rp-bg: #2b2119;
  --rp-border: #d98245;
  --rp-text: #f7ba8f;
}

body.theme-cyber {
  --bg-main: #140d1a;
  --bg-panel: #1f1429;
  --bg-module: #191021;
  --bg-header: #1c1224;
  --bg-well: #0f0914;
  --bg-track: #0b070f;
  --bg-btn: #2d1c3b;
  --border-panel: #4a2d61;
  --border-module: #3c244f;
  --border-btn: #643d82;
  --text-main: #f7ebff;
  --text-heading: #ff85d8;
  --text-sub: #b38ec9;
  --accent: #ff47b6;
  --accent-contrast: #170812;
  --funds-bg: #112925;
  --funds-border: #2be0c2;
  --funds-label: #7df7e3;
  --funds-val: #bdfcf2;
  --rp-bg: #162238;
  --rp-border: #4da6ff;
  --rp-text: #a3d1ff;
}

body.theme-coral {
  --bg-main: #0e1b1d;
  --bg-panel: #15282b;
  --bg-module: #112124;
  --bg-header: #132528;
  --bg-well: #0a1416;
  --bg-track: #081012;
  --bg-btn: #1d383d;
  --border-panel: #2b5259;
  --border-module: #23434a;
  --border-btn: #396b75;
  --text-main: #e8f7f9;
  --text-heading: #9bf2ea;
  --text-sub: #82b5ba;
  --accent: #ff7b6b;
  --accent-contrast: #1c0e0c;
  --funds-bg: #132b24;
  --funds-border: #48d1a8;
  --funds-label: #91f2d5;
  --funds-val: #c7fcf0;
  --rp-bg: #142633;
  --rp-border: #56b4e9;
  --rp-text: #a6dbfa;
}

body.theme-glacial {
  --bg-main: #10171f;
  --bg-panel: #17222e;
  --bg-module: #131c26;
  --bg-header: #151f2b;
  --bg-well: #0b1017;
  --bg-track: #080c12;
  --bg-btn: #202f40;
  --border-panel: #324861;
  --border-module: #283a4f;
  --border-btn: #446182;
  --text-main: #edf5fc;
  --text-heading: #bfe0ff;
  --text-sub: #8ea9c4;
  --accent: #6ec4ff;
  --accent-contrast: #0a1521;
  --funds-bg: #132926;
  --funds-border: #52d6be;
  --funds-label: #99f5e4;
  --funds-val: #ccfcf3;
  --rp-bg: #192438;
  --rp-border: #85a9ff;
  --rp-text: #c2d4ff;
}

* {
  box-sizing: border-box;
  font-family: 'JetBrains Mono', monospace;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  margin: 0;
  padding: 14px 20px;
  line-height: 1.35;
}

/* Full-Screen Warm Espresso Intro Screen */
.intro-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  padding: 20px 20px 44px 20px;
  overflow: auto;
}

.intro-art-btn {
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 16px 20px;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.intro-art-btn:hover:not(:disabled) {
  background: transparent;
  border: none;
}

.intro-ascii-art {
  margin: 0;
  color: var(--accent);
  font-size: clamp(6px, 0.9vw, 11px);
  line-height: 1.12;
  text-align: left;
  white-space: pre;
}

.intro-cta-label {
  color: var(--text-heading);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.intro-art-btn:hover:not(:disabled) .intro-ascii-art,
.intro-art-btn:hover:not(:disabled) .intro-cta-label {
  color: var(--text-heading);
  filter: brightness(1.15);
}

.intro-bottom-version {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-sub);
  font-size: 11px;
  letter-spacing: 0.1em;
  white-space: nowrap;
  pointer-events: none;
}

/* Subtle Visual Juice: Screen Shake & Confetti Stars */
@keyframes ui-screen-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, -1px); }
  80% { transform: translate(3px, 2px); }
}

.screen-shake {
  animation: ui-screen-shake 0.28s ease;
}

@keyframes confetti-star-pop {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.7) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--cx)), calc(-50% + var(--cy))) scale(1.25) rotate(140deg);
  }
}

.confetti-star {
  position: fixed;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  pointer-events: none;
  z-index: 2100;
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.75);
  animation: confetti-star-pop 0.78s ease-out forwards;
}

/* Pete Pretzel Ending Letter & Run Stats */
.ending-card {
  max-width: 680px;
  border-color: #ffd166;
}

.pete-letter-box {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  background: var(--bg-well);
  border: 1px solid var(--border-btn);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.pete-portrait {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.1;
  color: var(--accent);
  background: var(--bg-module);
  border: 1px solid var(--border-module);
  border-radius: 8px;
  padding: 10px;
}

.pete-letter-copy {
  flex: 1;
  min-width: 240px;
}

.letter-signoff {
  color: var(--text-heading);
  font-style: italic;
  margin-top: 8px;
}

.ending-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}

.stat-tile {
  background: var(--bg-module);
  border: 1px solid var(--border-module);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-sub);
}

.stat-val {
  font-size: 16px;
  color: var(--text-heading);
}

.best-badge {
  display: inline-block;
  width: fit-content;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 209, 102, 0.22);
  border: 1px solid #ffd166;
  color: #ffe8a3;
}

h1, h2, h3 {
  font-family: 'Lora', Georgia, serif;
  color: var(--text-heading);
  margin: 0 0 8px 0;
  font-weight: 600;
}

h2 {
  font-size: 17px;
  border-bottom: 1px solid var(--border-module);
  padding-bottom: 5px;
}

p {
  margin: 3px 0;
  font-size: 12.5px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 12px;
}

#console-box {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border-panel);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--accent);
  display: flex;
  align-items: center;
  font-size: 13px;
}

.top-stat-badge {
  background: var(--funds-bg);
  border: 1px solid var(--funds-border);
  border-radius: 10px;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  min-width: 130px;
}

.badge-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--funds-label);
}

.badge-value {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--funds-val);
}

.top-ach-btn {
  width: auto;
  margin: 0;
  background: var(--bg-panel);
  border: 1px solid #a8874f;
  color: #f7d996;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-ach-btn:hover:not(:disabled) {
  background: #e8b448;
  color: var(--accent-contrast);
  border-color: #e8b448;
}

.top-ach-btn.ready-to-expand {
  border-color: #ffd166;
  background: #382c12;
  color: #ffe8a3;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.45);
}

.player-badge-btn {
  width: auto;
  margin: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-btn);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  cursor: pointer;
}

.player-badge-btn:hover:not(:disabled) {
  background: var(--bg-btn);
  border-color: var(--accent);
}

#display-player-name {
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-header);
  border: 1px solid var(--border-module);
  border-radius: 12px;
  padding: 10px 20px;
  margin-bottom: 12px;
}

header h1 {
  margin: 0;
  font-size: 24px;
}

.header-territory-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.territory-pill {
  background: var(--bg-well);
  border: 1px solid var(--border-btn);
  color: var(--text-heading);
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 6px;
}

.gold-pill {
  background: #332712;
  border: 1px solid #ffd166;
  color: #ffe8a3;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 6px;
}

#ascii-stage {
  color: var(--accent);
  font-size: 10.5px;
  line-height: 1.1;
  margin: 0;
  background: var(--bg-well);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-module);
  min-width: 160px;
  text-align: center;
  transition: border-color 0.2s ease;
}

@keyframes gentle-sway {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg); }
}

.ascii-sway {
  animation: gentle-sway 3s ease-in-out infinite;
  border-color: var(--accent) !important;
}

/* Horizontal Rows */
.rows-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  padding: 12px 16px;
}

.row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-module);
  padding-bottom: 5px;
  margin-bottom: 8px;
}

.row-header h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.rp-badge {
  background: var(--rp-bg);
  border: 1px solid var(--rp-border);
  color: var(--rp-text);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.supply-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.supply-stock-pill {
  background: var(--bg-well);
  border: 1px solid var(--border-btn);
  color: var(--text-heading);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.row-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.projects-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 2;
}

.module-box {
  background: var(--bg-module);
  border: 1px solid var(--border-module);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 195px;
  flex: 1;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.module-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.module-head p {
  margin: 0;
}

.tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-well);
  border: 1px solid var(--border-btn);
  color: var(--text-sub);
  white-space: nowrap;
}

.module-box.tier-1 {
  border-color: #4fa86e;
  box-shadow: inset 0 0 12px rgba(79, 168, 110, 0.14);
}
.module-box.tier-1 .tier-badge {
  background: rgba(79, 168, 110, 0.18);
  border-color: #4fa86e;
  color: #8ce3a8;
}

.module-box.tier-2 {
  border-color: #4aa3df;
  box-shadow: inset 0 0 14px rgba(74, 163, 223, 0.18);
}
.module-box.tier-2 .tier-badge {
  background: rgba(74, 163, 223, 0.2);
  border-color: #4aa3df;
  color: #8ccbf5;
}

.module-box.tier-3 {
  border-color: #a86bd9;
  box-shadow: inset 0 0 16px rgba(168, 107, 217, 0.22);
}
.module-box.tier-3 .tier-badge {
  background: rgba(168, 107, 217, 0.22);
  border-color: #a86bd9;
  color: #ddb8fa;
}

.module-box.tier-4 {
  border-color: #ffd166;
  box-shadow: inset 0 0 18px rgba(255, 209, 102, 0.26), 0 0 8px rgba(255, 209, 102, 0.18);
}
.module-box.tier-4 .tier-badge {
  background: rgba(255, 209, 102, 0.24);
  border-color: #ffd166;
  color: #ffe8a3;
}

.module-ascii {
  margin: 4px 0 6px 0;
  padding: 4px 6px;
  background: var(--bg-well);
  border: 1px solid var(--border-module);
  border-radius: 6px;
  font-size: 9.5px;
  line-height: 1.08;
  color: var(--text-sub);
  text-align: center;
  user-select: none;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.module-box.tier-1 .module-ascii {
  color: #8ce3a8;
  border-color: rgba(79, 168, 110, 0.45);
}

.module-box.tier-2 .module-ascii {
  color: #8ccbf5;
  border-color: rgba(74, 163, 223, 0.5);
}

.module-box.tier-3 .module-ascii {
  color: #ddb8fa;
  border-color: rgba(168, 107, 217, 0.55);
}

.module-box.tier-4 .module-ascii {
  color: #ffe8a3;
  border-color: rgba(255, 209, 102, 0.65);
}

.hidden {
  display: none !important;
}

button {
  background: var(--bg-btn);
  color: var(--text-main);
  border: 1px solid var(--border-btn);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12.5px;
  width: 100%;
  margin-bottom: 5px;
  transition: all 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  font-weight: 600;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.close-small-btn {
  width: auto;
  margin: 0;
  padding: 5px 12px;
  font-size: 12px;
}

.danger-btn {
  background: #5c2622;
  border-color: #a84f4f;
  color: #ffd6d1;
  font-weight: 600;
}

.danger-btn:hover:not(:disabled) {
  background: #d94b43;
  border-color: #ff6b5b;
  color: #1e1916;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.subtext {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-top: 2px;
}

.big-stat-line {
  font-size: 13.5px;
  margin: 5px 0;
}

.big-stat-num {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-heading);
  transition: color 0.15s ease;
}

.big-stat-num.zero-danger {
  color: #ff6b5b;
}

.income-rate-line {
  font-size: 12.5px;
  color: var(--funds-label);
  margin: 2px 0 4px 0;
}

.income-rate-line.negative-flow {
  color: #ff8c7a;
}

.recipe-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.recipe-row select,
.theme-select {
  width: 100%;
  background: var(--bg-well);
  color: var(--text-heading);
  border: 1px solid var(--border-btn);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12.5px;
  cursor: pointer;
}

.recipe-row select {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
}

.recipe-row select:focus,
.theme-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Target Range Mini-Game */
.range-track {
  position: relative;
  height: 28px;
  background: var(--bg-track);
  border: 1px solid var(--border-panel);
  border-radius: 6px;
  margin: 6px 0;
  overflow: hidden;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.range-target {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 18px;
  border: 1px dashed var(--rp-border);
  background: rgba(79, 168, 155, 0.14);
  border-radius: 4px;
}

.range-crosshair {
  position: absolute;
  top: 50%;
  left: 6%;
  transform: translate(-50%, -50%);
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  user-select: none;
  pointer-events: none;
}

.range-track.flash-hit {
  border-color: #4fa89b;
  background: #192927;
}

.range-track.flash-miss {
  border-color: #a84f4f;
  background: #291919;
}

/* Research Project Cards */
.project-card {
  border: 1px solid var(--border-panel);
  background: var(--bg-module);
  border-radius: 8px;
  padding: 9px 12px;
  min-width: 210px;
  flex: 1;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.project-card.rp-card {
  border-color: var(--rp-border);
}

.project-card.rp-card button:hover:not(:disabled) {
  background: var(--rp-border);
  border-color: var(--rp-border);
  color: #141c1b;
}

.project-card.locked {
  opacity: 0.45;
  border-color: var(--border-module);
}

/* Conquest Card, Spinning ASCII Globe, Dual Progress Bars & Achievements Grid */
.conquest-card {
  background: linear-gradient(135deg, var(--bg-well), #2b2216);
  border: 1px solid #c9973e;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.conquest-main-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.conquest-info-col {
  flex: 1;
  min-width: 260px;
}

.conquest-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.conquest-kicker {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-sub);
  font-weight: 700;
}

.conquest-top h3 {
  margin: 2px 0 0 0;
  font-size: 18px;
  color: #ffe8a3;
}

.gold-pretzel-pill {
  background: #382c12;
  border: 1px solid #ffd166;
  color: #ffe8a3;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.continent-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.cont-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid #5c4b41;
  background: rgba(20, 16, 14, 0.7);
}

.cont-chip.owned {
  border-color: #4fa86e;
  background: rgba(79, 168, 110, 0.18);
  color: #7ef2a6;
}

.cont-chip.active {
  border-color: #ffd166;
  background: rgba(255, 209, 102, 0.2);
  color: #ffe8a3;
}

.cont-chip.rival {
  border-color: #b84a4a;
  background: rgba(184, 74, 74, 0.16);
  color: #ff7b7b;
}

/* Spinning ASCII Globe */
.globe-box {
  background: #0c0f12;
  border: 1px solid #4a3c34;
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 190px;
}

.ascii-globe {
  margin: 0;
  font-size: 10px;
  line-height: 1.05;
  color: #5e7387;
  user-select: none;
}

.globe-ocean {
  color: #46637d;
}

.globe-owned {
  color: #57e389;
  font-weight: 700;
}

.globe-active {
  color: #ffd166;
  font-weight: 700;
}

.globe-rival {
  color: #ff6b6b;
  font-weight: 700;
}

.globe-legend {
  display: flex;
  gap: 8px;
  font-size: 10px;
  margin-top: 5px;
}

.leg-owned { color: #57e389; }
.leg-active { color: #ffd166; }
.leg-rival { color: #ff6b6b; }

.expand-btn {
  margin-top: 10px;
  margin-bottom: 0;
  background: #c9973e;
  border-color: #ffd166;
  color: #1a140c;
  font-weight: 700;
  padding: 9px 12px;
}

.expand-btn:hover:not(:disabled) {
  background: #ffd166;
  border-color: #fff2b2;
  color: #1a140c;
}

.progress-hub-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-well);
  border: 1px solid var(--border-module);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.progress-bar-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-main);
}

.progress-track {
  width: 100%;
  height: 12px;
  background: var(--bg-track);
  border: 1px solid var(--border-btn);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-fill.dom-fill {
  background: linear-gradient(90deg, #4fa89b, #38d9c5);
}

.progress-fill.ach-fill {
  background: linear-gradient(90deg, #c9973e, #ffd166);
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.ach-card {
  background: var(--bg-module);
  border: 1px solid var(--border-module);
  border-radius: 8px;
  padding: 10px 12px;
}

.ach-card.unlocked {
  border-color: #c9973e;
  background: #2b2319;
}

.ach-card.locked {
  opacity: 0.5;
}

.ach-card-title {
  font-size: 13px;
  color: #f7d996;
  margin-bottom: 4px;
}

.ach-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-panel);
  border: 2px solid #e8b448;
  border-radius: 12px;
  padding: 12px 24px;
  text-align: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ach-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ach-toast-kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #e8b448;
  font-weight: 600;
}

.ach-toast-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff2d6;
  margin: 2px 0;
}

.ach-toast-desc {
  font-size: 12px;
  color: #d4c0a8;
}

@keyframes spark-burst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.4);
  }
}

.ach-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #ffd166;
  font-size: 14px;
  pointer-events: none;
  animation: spark-burst 0.8s ease-out forwards;
}

/* Setup Modal & Selectable 12-Art Grid */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 12, 11, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-btn);
  border-radius: 14px;
  padding: 24px;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.small-modal {
  max-width: 440px;
}

.modal-card label {
  display: block;
  font-size: 13px;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.modal-card input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-btn);
  background: var(--bg-well);
  color: var(--text-main);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-card input:focus {
  outline: none;
  border-color: var(--accent);
}

.ascii-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.ascii-option {
  background: var(--bg-well);
  border: 2px solid var(--border-module);
  border-radius: 8px;
  padding: 12px 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

.ascii-option:hover {
  border-color: var(--border-btn);
}

.ascii-option.selected {
  border-color: var(--accent);
  background: var(--bg-btn);
}

.ascii-option pre {
  color: var(--accent);
  font-size: 10px;
  line-height: 1.1;
  margin: 0;
  pointer-events: none;
}

.primary-btn {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  border: none;
  padding: 12px;
  font-size: 15px;
}

.sell-btn {
  border-color: #7d4e38;
  color: #f0c29e;
}

.sell-btn:hover:not(:disabled) {
  background: #d97a43;
  border-color: #d97a43;
  color: #1e1916;
}

/* ASCII Plinko Pegboard */
.plinko-board {
  background: var(--bg-track);
  border: 1px solid var(--border-panel);
  border-radius: 6px;
  padding: 6px 8px;
  margin: 6px 0;
  font-size: 11px;
  line-height: 1.15;
  color: var(--text-heading);
  text-align: center;
  user-select: none;
}

/* 30s Golden Rush Outer Border Glow & Badge */
body.golden-rush-active {
  box-shadow: inset 0 0 28px rgba(255, 200, 65, 0.55);
  outline: 3px solid #ffd166;
  outline-offset: -3px;
}

.golden-rush-badge {
  background: #382c12;
  border: 1px solid #ffd166;
  color: #ffe399;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.35);
}

/* Falling Clickable Golden Pretzels */
.golden-sky-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1500;
  overflow: hidden;
}

@keyframes fall-from-sky {
  0% {
    top: -40px;
    transform: rotate(-15deg) scale(1);
  }
  50% {
    transform: rotate(15deg) scale(1.1);
  }
  100% {
    top: 105vh;
    transform: rotate(-10deg) scale(1);
  }
}

.falling-gold-pretzel {
  position: fixed;
  top: -40px;
  width: auto;
  margin: 0;
  padding: 6px 10px;
  font-size: 22px;
  background: rgba(56, 44, 18, 0.92);
  border: 2px solid #ffd166;
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.8);
  pointer-events: auto;
  cursor: pointer;
  animation: fall-from-sky 4.5s linear forwards;
}

.falling-gold-pretzel:hover {
  transform: scale(1.22);
  background: #ffd166;
}