* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.gameBody {
  display: flex;
  flex-direction: column;
  height: 100vh;
  font-family: "Courier New", monospace;
  background-color: #2b2b2b;
  color: #fff;
  overflow: hidden;
}

.gameHeader {
  background-color: #1a1a1a;
  border-bottom: #4a9eff solid 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  gap: 20px;
}

.gameTitle {
  color: #4a9eff;
  text-shadow: 2px 2px 1px #2563eb;
  letter-spacing: 2px;
  font-size: 1.8em;
}

.headerBox {
  background-color: #333;
  color: lightgray;
  padding: 8px 16px;
  border: 3px solid #4a9eff;
  box-shadow: 4px 4px 0 #2563eb;
}

.headerBoxes {
  display: flex;
  gap: 10px;
}

.marketBtn {
  padding: 12px 24px;
  background: #3a3a3a;
  color: #ffd700;
  border: 3px solid #4a9eff;
  box-shadow: 4px 4px 0 #2563eb;
  font-family: "Courier New", monospace;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}

.marketBtn:hover {
  background: #4a4a4a;
  border-color: #ffd700;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #b8860b;
}

.marketBtn:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #b8860b;
}

.sidebarLeft {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 20px;
  background-color: #1a1a1a;
  width: 220px;
  border-right: 5px solid #4a9eff;
  overflow-y: auto;
  min-height: 0;
}

.container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.gameMenu {
  color: #4a9eff;
  margin-bottom: 15px;
  font-size: 1.2em;
  border-bottom: 3px solid #4a9eff;
  padding-bottom: 5px;
  width: 100%;
  text-shadow: 2px 2px 1px #2563eb;
}

.menu1,
.menu2,
.menu3,
.menu4,
.menu5,
.menu6,
.menu7,
.menu8 {
  background-color: #3a3a3a;
  color: lightgray;
  padding: 10px 15px;
  margin-bottom: 10px;
  width: 100%;
  border: 3px solid #666666;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 3px 3px 0 #1a1a1a;
  user-select: none;
}

.menu1 a,
.menu1 a:visited {
  color: lightgray;
  text-decoration: none;
  display: block;
}

.menu1:hover,
.menu2:hover,
.menu3:hover,
.menu4:hover,
.menu5:hover,
.menu6:hover,
.menu7:hover,
.menu8:hover {
  background-color: #4a4a4a;
  border-color: #4a9eff;
  box-shadow: 5px 5px 0 #1a1a1a;
  transform: translate(-2px, -2px);
}

.menu1:active,
.menu2:active,
.menu3:active,
.menu4:active,
.menu5:active,
.menu6:active,
.menu7:active,
.menu8:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #1a1a1a;
}

::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: #2b2b2b;
  border: 2px solid #1a1a1a;
}
::-webkit-scrollbar-thumb {
  background: #4a9eff;
  border: 2px solid #2563eb;
}
::-webkit-scrollbar-thumb:hover {
  background: #6bb3ff;
}

.sidebarRight {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 20px 15px;
  background-color: #1a1a1a;
  width: 280px;
  border-left: 5px solid #4a9eff;
  overflow-y: auto;
  min-height: 0;
}

.gameMain {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.upgrade1,
.upgrade2,
.upgrade3,
.upgrade4,
.upgrade5 {
  background-color: #3a3a3a;
  color: lightgray;
  padding: 10px 15px;
  margin-bottom: 10px;
  width: 100%;
  border: 3px solid #666666;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 3px 3px 0 #1a1a1a;
  user-select: none;
}

.upgrades {
  color: #4a9eff;
  margin-bottom: 15px;
  font-size: 1.2em;
  border-bottom: 3px solid #4a9eff;
  padding-bottom: 5px;
  width: 100%;
  text-shadow: 2px 2px 1px #2563eb;
}

.upgradeCard {
  background: #3a3a3a;
  padding: 12px;
  margin: 12px 0;
  border: 3px solid #666;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 3px 3px 0 #1a1a1a;
  min-width: 150px;
  width: 100%;
  box-sizing: border-box;
  user-select: none;
}

.upgradeCard:hover {
  background: #4a4a4a;
  border-color: #4a9eff;
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 #1a1a1a;
}

.upgradeCard:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #1a1a1a;
}

.upgradeIcon {
  font-size: 2em;
  margin-bottom: 5px;
}

.upgradeTitle {
  color: #4a9eff;
  font-size: 1em;
  margin-bottom: 5px;
  font-weight: bold;
}

.upgradeDescription {
  color: #999;
  font-size: 0.85em;
  margin: 5px 0;
}

.upgradeCost {
  color: #ffd700;
  font-weight: bold;
  margin-top: 8px;
  text-shadow: 1px 1px 0 #b8860b;
}

.upgradeOwned {
  color: #4a9eff;
  font-size: 0.85em;
  margin-top: 5px;
}
.clickerArea {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.serverRack {
  width: 240px;
  height: 280px;
  background: #2a2a2a;
  border: 6px solid #1a1a1a;
  box-shadow: 8px 8px 0 #0a0a0a;
  position: relative;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  cursor: pointer;
  transition: transform 0.1s;
}

.serverRack:hover {
  transform: scale(1.05);
}

.serverRack:active {
  transform: scale(0.95);
}

.serverSlot {
  width: 100%;
  height: 50px;
  background: #404040;
  border: 3px solid #1a1a1a;
  position: relative;
  transition: background 0.3s;
}

/* Inactive slots are darker */
.serverSlot {
  background: #2a2a2a;
}

/* Active slots light up */
.serverSlot.active {
  background: #404040;
}

.led {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  right: 15px;
  top: 19px;
  background: #333; /* Off by default */
  transition: background 0.3s;
}

/* Only active slots have blinking LEDs */
.serverSlot.active .led {
  background: #00ff00;
  box-shadow: 0 0 8px #00ff00;
  animation: blink-led 1s infinite;
}

@keyframes blink-led {
  0%,
  50% {
    opacity: 1;
    box-shadow: 0 0 8px #00ff00;
  }
  51%,
  100% {
    opacity: 0.2;
    box-shadow: 0 0 2px #00ff00;
  }
}

.clickText {
  margin-top: 25px;
  font-size: 1.3em;
  font-weight: bold;
  color: #2b2b2b;
  text-shadow: 2px 2px 0 #999;
}

.statsRow {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.statBox {
  background: #3a3a3a;
  color: #4a9eff;
  padding: 10px 20px;
  border: 3px solid #4a9eff;
  box-shadow: 3px 3px 0 #1a1a1a;
  font-size: 1.1em;
}

/* ─────────────────────────────────────────────
   Mobile tab bar — hidden on desktop
   ───────────────────────────────────────────── */
.mobileTabs {
  display: none;
}

@media (max-width: 768px) {

  /* Use dynamic viewport height so browser chrome doesn't cause overflow */
  .gameBody {
    height: 100dvh;
    overflow-x: hidden;
  }

  /* Shrink header so it fits on one line */
  .gameHeader {
    padding: 6px 10px;
    gap: 6px;
  }
  .gameTitle {
    font-size: 0.7em;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }
  .gameTitle h1 {
    font-size: 1em;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .headerBox {
    padding: 5px 8px;
    font-size: 0.75em;
  }
  .headerBoxes {
    gap: 5px;
  }
  .marketBtn {
    padding: 8px 10px;
    font-size: 0.8em;
  }

  /* Hide both sidebars by default */
  .sidebarLeft,
  .sidebarRight {
    display: none;
  }

  /* When a sidebar tab is active, show it full width */
  .sidebarLeft.mobileActive,
  .sidebarRight.mobileActive {
    display: flex;
    width: 100%;
    border: none;
  }

  /* Hide main game when another tab is active */
  .gameMain.mobileHidden {
    display: none;
  }

  /* Show tab bar — padding-bottom pushes buttons above phone's system nav bar */
  .mobileTabs {
    display: flex;
    flex-shrink: 0;
    background: #1a1a1a;
    border-top: 3px solid #4a9eff;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .mobileTab {
    flex: 1;
    background: #2b2b2b;
    color: #666;
    border: none;
    border-right: 2px solid #333;
    font-family: "Courier New", monospace;
    font-size: 0.85em;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 13px 0;
    cursor: pointer;
  }

  .mobileTab:last-child {
    border-right: none;
  }

  .mobileTabActive {
    background: #1a1a1a;
    color: #4a9eff;
    border-top: 3px solid #4a9eff;
    margin-top: -3px;
  }
}

/* ─────────────────────────────────────────────
   Clickable menu buttons
   ───────────────────────────────────────────── */
.menuBtn {
  cursor: pointer;
  transition: color 0.2s;
}
.menuBtn:hover {
  color: #4a9eff;
}
.resetBtn:hover {
  color: #ff4444;
}

/* ─────────────────────────────────────────────
   Reset confirmation modal
   ───────────────────────────────────────────── */
.resetModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.resetModal.visible {
  display: flex;
}
.resetModalBox {
  background: #1a1a1a;
  border: 2px solid #ff4444;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  font-family: "Courier New", monospace;
  color: #ccc;
}
.resetModalBox h2 {
  color: #ff4444;
  margin-bottom: 16px;
  letter-spacing: 2px;
}
.resetModalBox p {
  line-height: 1.6;
  margin-bottom: 28px;
}
.resetModalBtns {
  display: flex;
  gap: 16px;
  justify-content: center;
}
.resetConfirmBtn {
  background: #ff4444;
  color: #fff;
  border: none;
  padding: 10px 20px;
  font-family: "Courier New", monospace;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 1px;
}
.resetConfirmBtn:hover {
  background: #cc0000;
}
.resetCancelBtn {
  background: #2b2b2b;
  color: #ccc;
  border: 1px solid #555;
  padding: 10px 20px;
  font-family: "Courier New", monospace;
  cursor: pointer;
  letter-spacing: 1px;
}
.resetCancelBtn:hover {
  border-color: #4a9eff;
  color: #4a9eff;
}

/* ─────────────────────────────────────────────
   Save toast notification
   ───────────────────────────────────────────── */
.saveToast {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  border: 1px solid #4a9eff;
  color: #4a9eff;
  padding: 8px 24px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  letter-spacing: 1px;
  z-index: 500;
  pointer-events: none;
}
.saveToast.visible {
  display: block;
}

/* ─────────────────────────────────────────────
   Save / Load slot modal
   ───────────────────────────────────────────── */
.saveModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.saveModal.visible {
  display: flex;
}
.saveModalBox {
  background: #1a1a1a;
  border: 2px solid #4a9eff;
  border-radius: 8px;
  padding: 28px;
  width: 90%;
  max-width: 480px;
  color: #ccc;
}
.saveModalBox h2 {
  color: #4a9eff;
  margin-bottom: 20px;
  letter-spacing: 2px;
}
.saveSlots {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.saveSlot {
  background: #2b2b2b;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 12px 16px;
}
.saveSlotHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.saveSlotName {
  font-weight: bold;
  color: #fff;
  letter-spacing: 1px;
}
.saveSlotActive {
  font-size: 0.75em;
  color: #4a9eff;
  letter-spacing: 1px;
}
.saveSlotDetails {
  font-size: 0.82em;
  color: #888;
  margin-bottom: 10px;
}
.saveSlotBtns {
  display: flex;
  gap: 10px;
}
.saveSlotBtns button {
  flex: 1;
  padding: 6px 0;
  border: 1px solid #4a9eff;
  background: transparent;
  color: #4a9eff;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  transition: background 0.2s, color 0.2s;
}
.saveSlotBtns button:hover:not(:disabled) {
  background: #4a9eff;
  color: #000;
}
.saveSlotBtns button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: #555;
  color: #555;
}
.saveModalClose {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid #555;
  color: #aaa;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  transition: border-color 0.2s, color 0.2s;
}
.saveModalClose:hover {
  border-color: #ccc;
  color: #fff;
}
