:root {
  --bg: #071022;
  --panel: #0b1220;
  --accent: #ffcc00;
  --text: #e6eef8;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  padding: 12px;
  font-family: Inter, system-ui, Arial;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, #041224 0%, #07122a 100%);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.card {
  width: 100%;
  max-width: 1100px;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.01),
    rgba(255, 255, 255, 0.005)
  );
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* Developer Credit */
.developer-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-family: Arial, sans-serif;
}

.dev-link {
  color: #60a5fa;
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}

.dev-link:hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* Stats */
#gold,
#xp,
#ageText {
  color: #ffcc00 !important;
  font-size: 16px !important;
  font-weight: bold !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Language Switcher */
.language-switcher {
  display: flex;
  gap: 4px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  border-radius: 10px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13px;
  color: #9fb0d0;
  position: relative;
  overflow: hidden;
}

.lang-option::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
}

.lang-option:hover::before {
  left: 100%;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  transform: translateY(-1px);
}

.lang-option.active {
  background: linear-gradient(
    135deg,
    rgba(255, 204, 0, 0.2),
    rgba(255, 204, 0, 0.1)
  );
  color: #ffcc00;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 204, 0, 0.2);
}

.lang-flag {
  font-size: 15px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.lang-text {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Battle Area */
.battleWrap {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.battle {
  width: 100%;
  height: 520px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.005),
    rgba(255, 255, 255, 0.01)
  );
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.battleArea {
  width: 100%;
  height: 100%;
  position: relative;
}

.topBossInfo {
  background: rgba(0, 0, 0, 0.45);
  padding: 8px 16px;
  border-radius: 8px;
  z-index: 40;
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  width: auto;
  margin: 0 auto; /* Center horizontally */
  justify-content: center; /* Center content inside */
  text-align: center;
  position: static; /* Remove absolute positioning */
  transform: none; /* Remove transform */
  left: auto; /* Remove left positioning */
  top: auto; /* Remove top positioning */
}

.topBossInfo .small {
  font-weight: 400;
  color: #9fb0d0;
  font-size: 13px;
}

.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12%;
  height: 8px;
  background: #213444;
  border-radius: 4px;
  z-index: 20;
}

/* Bases */
.base {
  position: absolute;
  bottom: 14%;
  width: 140px;
  height: 140px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  z-index: 30;
  font-size: 14px;
}

.base.player {
  left: 10px;
  background: linear-gradient(180deg, #ffd57a, #ffb84d);
  color: #07122a;
}

.base.enemy {
  right: 10px;
  background: linear-gradient(180deg, #ffdce5, #ff89a1);
  color: #07122a;
}

/* Units */
.unit {
  position: absolute;
  z-index: 32;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  pointer-events: none;
  bottom: 14% !important;
}

.unit img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bossUnit {
  position: absolute;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  bottom: 14% !important;
}

.bossUnit img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* HP Bars */
.hpBar {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  top: -10px;
  overflow: hidden;
  z-index: 10;
}

.hpFill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  width: 100%;
}

.hpFill.low {
  background: linear-gradient(90deg, #f97316, #ef4444);
}

/* Projectiles */
.proj {
  position: absolute;
  pointer-events: none;
  z-index: 33;
  display: flex;
  align-items: center;
  justify-content: center;
}

.proj img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Bottom Bar */
.bottomBar {
  width: 100%;
  max-width: 980px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(
    180deg,
    rgba(2, 6, 23, 0.55),
    rgba(2, 6, 23, 0.3)
  );
  padding: 10px;
  border-radius: 10px;
  z-index: 50;
}

.stat {
  min-width: 100px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  border-radius: 8px;
  text-align: center;
}

#ageText {
  font-size: 14px;
}

/* Unit Buttons */
.unitButtons {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 4px 2px;
}

.unitButtons.no-scroll {
  overflow: visible;
  flex-wrap: wrap;
  justify-content: center;
}

.unit-btn {
  background: linear-gradient(180deg, #0f1724, #08101a);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

.unit-btn .unit-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.unit-btn .unit-cost {
  font-size: 11px;
  color: #ffcc00;
  font-weight: 700;
}

/* Buttons */
.btn {
  background: linear-gradient(180deg, #0f1724, #08101a);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
}

.btn.active {
  background: linear-gradient(180deg, #1e293b, #0f1724);
  outline: 2px solid rgba(255, 204, 0, 0.3);
}

.small {
  font-size: 13px;
  color: #9fb0d0;
}

.speedBtn.active {
  outline: 2px solid rgba(255, 204, 0, 0.12);
}

/* Hack Popup */
.hackPopup {
  position: absolute;
  bottom: 48px;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px;
  border-radius: 8px;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.centerRow {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Modals */
#pauseModal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.6);
  z-index: 220;
}

#pauseCard {
  background: linear-gradient(180deg, #07122a, #091428);
  padding: 16px;
  border-radius: 12px;
  width: 420px;
  max-width: 92vw;
  text-align: center;
}

#finishOverlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.75);
  z-index: 300;
}

#finishCard {
  background: linear-gradient(180deg, #07122a, #091428);
  padding: 16px;
  border-radius: 12px;
  width: 420px;
  max-width: 92vw;
  text-align: center;
}

.locked {
  opacity: 0.6;
  filter: brightness(0.7);
}

/* Upgrade Animation */
.upgrade-age-blink {
  animation: upgradeBlink 1s infinite;
  background: linear-gradient(180deg, #ffcc00, #ffaa00) !important;
  color: #07122a !important;
}

@keyframes upgradeBlink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

/* Orientation Warning */
.orientation-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 18px;
}

/* Settings */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-label {
  font-size: 14px;
  color: #9fb0d0;
  min-width: 120px;
}

.setting-control {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  min-width: 140px;
}

input[type="range"] {
  width: 140px;
}

/* Boss Selection */
.boss-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  margin: 4px 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.boss-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.boss-item.selected {
  outline: 2px solid rgba(255, 204, 0, 0.3);
  background: rgba(255, 204, 0, 0.05);
}

.boss-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.boss-name {
  font-weight: 600;
  font-size: 14px;
}

.boss-age {
  font-size: 12px;
  color: #9fb0d0;
  margin-top: 2px;
}

.boss-status {
  font-size: 12px;
  color: #9fb0d0;
}

/* Difficulty Switcher */
.difficulty-switcher {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 4px;
}

.diff-btn {
  flex: 1;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
}

.diff-btn.active {
  background: rgba(255, 204, 0, 0.15);
  color: #ffcc00;
  font-weight: 600;
}

/* Upgrade Age */
.upgrade-age-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.upgrade-age-square {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: linear-gradient(180deg, #0f1724, #08101a);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  padding: 8px;
}

.upgrade-age-square:hover {
  background: linear-gradient(180deg, #1e293b, #0f1724);
}

.upgrade-age-square.upgrade-age-blink {
  animation: upgradeBlink 1s infinite;
  background: linear-gradient(180deg, #ffcc00, #ffaa00) !important;
  color: #07122a !important;
}

.upgrade-age-text {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 4px;
}

.upgrade-age-cost {
  font-size: 10px;
  color: #ffcc00;
  font-weight: 700;
}

#panelNormal {
  max-height: 400px;
  overflow-y: auto;
  padding-bottom: 20px;
}

/* Menu Background */
#menuBackground {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: -1;
  overflow: hidden;
}

.menu-unit {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.menu-unit img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Special Unit Positioning */
.unit[data-unit-type="tank"],
.bossUnit[data-boss="hitler"] {
  bottom: 8% !important;
}

/* Double click animation */
.boss-double-click {
  animation: doubleClickPulse 0.6s ease;
}

@keyframes doubleClickPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
    background: rgba(255, 204, 0, 0.2);
  }
  100% {
    transform: scale(1);
  }
}

/* ===== MOBILE OPTIMIZATIONS ===== */

/* Mobile Controls */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(2, 6, 23, 0.95);
  padding: 10px;
  z-index: 100;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-stats {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(2, 6, 23, 0.95);
  padding: 8px;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
}

.mobile-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.mobile-stat-value {
  font-weight: bold;
  color: #ffcc00;
  font-size: 14px;
}

.mobile-boss-info {
  display: none;
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  padding: 6px;
  z-index: 99;
  text-align: center;
  font-size: 11px;
}

.mobile-unit-buttons {
  display: none;
  position: fixed;
  bottom: 70px;
  left: 0;
  right: 0;
  background: rgba(2, 6, 23, 0.9);
  padding: 8px;
  z-index: 90;
  overflow-x: auto;
  gap: 6px;
}

.mobile-unit-btn {
  background: linear-gradient(180deg, #0f1724, #08101a);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  width: 60px;
  height: 45px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  font-size: 10px;
}

.mobile-unit-btn .unit-name {
  font-size: 9px;
  font-weight: 600;
  line-height: 1.1;
}

.mobile-unit-btn .unit-cost {
  font-size: 8px;
  color: #ffcc00;
  font-weight: 700;
}

.mobile-upgrade-btn {
  background: linear-gradient(180deg, #0f1724, #08101a);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 60px;
}

.mobile-upgrade-btn .upgrade-text {
  font-size: 9px;
  font-weight: 600;
}

.mobile-upgrade-btn .upgrade-cost {
  font-size: 8px;
  color: #ffcc00;
  font-weight: 700;
}

.mobile-controls-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.mobile-speed-controls {
  display: flex;
  gap: 4px;
}

.mobile-speed-btn {
  background: linear-gradient(180deg, #0f1724, #08101a);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 10px;
}

.mobile-speed-btn.active {
  background: linear-gradient(180deg, #1e293b, #0f1724);
  outline: 1px solid rgba(255, 204, 0, 0.3);
}

.mobile-action-btns {
  display: flex;
  gap: 6px;
}

.mobile-action-btn {
  background: linear-gradient(180deg, #0f1724, #08101a);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 10px;
  white-space: nowrap;
}

/* ===== ADAPTIVE LAYOUT FOR DIFFERENT SCREEN SIZES ===== */

/* Default: Desktop layout (hidden mobile UI) */
.mobile-stats,
.mobile-boss-info,
.mobile-unit-buttons,
.mobile-controls {
  display: none;
}

.bottomBar,
.topBossInfo {
  display: flex;
}

/* ===== ADAPTIVE LAYOUT FOR DIFFERENT SCREEN SIZES ===== */

/* Default: Desktop layout (hidden mobile UI) */
.mobile-stats,
.mobile-boss-info,
.mobile-unit-buttons,
.mobile-controls {
  display: none;
}

.bottomBar,
.topBossInfo {
  display: flex;
}

/* ===== ADAPTIVE LAYOUT FOR DIFFERENT SCREEN SIZES ===== */

/* Default: Desktop layout (hidden mobile UI) */
.mobile-stats,
.mobile-boss-info,
.mobile-unit-buttons,
.mobile-controls {
  display: none;
}

.bottomBar,
.topBossInfo {
  display: flex;
}

/* ===== PHONES & SMALL TABLETS (up to 600px height) ===== */
@media (max-height: 600px) and (orientation: landscape) {
  /* Keep original BossInfo always visible */
  .topBossInfo {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: translateX(0) !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 6px 10px !important;
    background: rgba(0, 0, 0, 0.85) !important;
    z-index: 999 !important;
    font-size: 11px !important;
    border-radius: 0 !important;
    justify-content: center !important;
  }

  #menuPanels {
    max-height: 300px;
    overflow-y: auto;
    padding-bottom: 20px; /* Extra space for mobile */
    margin-bottom: 20px;
  }

  /* Show mobile bottom bar - exact replica of desktop but compact */
  .bottomBar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 70px !important;
    padding: 8px 10px !important;
    background: rgba(2, 6, 23, 0.95) !important;
    z-index: 1001 !important;
    border-radius: 0 !important;
    max-width: 100% !important;
    gap: 8px !important;
    align-items: center !important;
  }

  /* Battle area adjustment */
  .battle {
    position: fixed !important;
    top: 40px !important; /* Account for topBossInfo height */
    bottom: 70px !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 150px !important;
    border-radius: 0 !important;
  }

  /* Compact stats */
  .stat {
    min-width: 60px !important;
    padding: 6px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
  }

  /* Smaller age text */
  #ageText {
    font-size: 12px !important;
  }

  /* Gold and XP text */
  #gold,
  #xp {
    font-size: 12px !important;
  }

  /* Compact unit buttons */
  .unitButtons {
    flex: 1 !important;
    display: flex !important;
    gap: 6px !important;
    overflow-x: auto !important;
    padding: 2px !important;
    height: 54px !important;
  }

  .unit-btn {
    width: 65px !important;
    height: 50px !important;
    padding: 5px !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
  }

  .unit-btn .unit-name {
    font-size: 10px !important;
  }

  .unit-btn .unit-cost {
    font-size: 9px !important;
  }

  /* Smaller upgrade age button */
  .upgrade-age-square {
    width: 70px !important;
    height: 50px !important; /* Reduced height for mobile */
    padding: 4px !important;
    border-radius: 6px !important;
  }

  .upgrade-age-text {
    font-size: 10px !important;
    margin-bottom: 2px !important;
  }

  .upgrade-age-cost {
    font-size: 9px !important;
  }

  /* Compact action buttons */
  .btn {
    padding: 6px 8px !important;
    border-radius: 6px !important;
    font-size: 10px !important;
    height: 32px !important;
  }

  /* Adjust bases for mobile */
  .base {
    width: 70px !important;
    height: 70px !important;
    font-size: 10px !important;
    bottom: 12% !important;
  }

  /* Adjust units positioning */
  .unit {
    bottom: 9% !important;
    transform: scale(0.7) !important;
  }

  .bossUnit {
    bottom: 9% !important;
    transform: scale(0.7) !important;
  }

  .ground {
    bottom: 11% !important;
    height: 4px !important;
  }

  /* Adjust projectiles for smaller screens */
  .proj {
    transform: scale(0.8) !important;
  }
}

/* ===== VERY SMALL PHONES (up to 400px height) ===== */
@media (max-height: 400px) and (orientation: landscape) {
  /* Ultra-compact layout for very small phones */
  .topBossInfo {
    padding: 4px 8px !important;
    font-size: 10px !important;
    height: 30px !important;
  }

  .bottomBar {
    height: 60px !important;
    padding: 6px 8px !important;
    gap: 6px !important;
  }

  .battle {
    top: 30px !important;
    bottom: 60px !important;
    min-height: 120px !important;
  }

  .stat {
    min-width: 50px !important;
    padding: 4px !important;
    font-size: 10px !important;
  }

  /* Even smaller text */
  #ageText,
  #gold,
  #xp {
    font-size: 11px !important;
  }

  .unitButtons {
    height: 46px !important;
    gap: 4px !important;
  }

  .unit-btn {
    width: 55px !important;
    height: 42px !important;
    padding: 4px !important;
  }

  .unit-btn .unit-name {
    font-size: 9px !important;
  }

  .unit-btn .unit-cost {
    font-size: 8px !important;
  }

  /* Even smaller upgrade age button */
  .upgrade-age-square {
    width: 60px !important;
    height: 42px !important; /* Further reduced height */
    padding: 3px !important;
  }

  .upgrade-age-text {
    font-size: 9px !important;
    margin-bottom: 1px !important;
  }

  .upgrade-age-cost {
    font-size: 8px !important;
  }

  .btn {
    padding: 4px 6px !important;
    font-size: 9px !important;
    height: 28px !important;
  }

  .base {
    width: 65px !important;
    height: 65px !important;
    bottom: 10% !important;
    font-size: 9px !important;
  }

  .unit,
  .bossUnit {
    bottom: 6% !important;
    transform: scale(0.55) !important;
  }

  .ground {
    bottom: 9% !important;
  }

  /* Smaller bullets */
  .proj {
    transform: scale(0.6) !important;
  }
}

/* ===== PORTRAIT MODE BLOCKING ===== */
@media (orientation: portrait) and (max-width: 768px) {
  .orientation-warning {
    display: flex !important;
  }

  .card,
  .battleWrap {
    display: none !important;
  }
}

/* ===== BOSS LIST SCROLLING FOR MOBILE ===== */
@media (max-height: 600px) {
  #bossList {
    max-height: 120px !important;
    overflow-y: auto !important;
  }

  .boss-item {
    min-height: 40px !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
  }

  .boss-name {
    font-size: 12px !important;
  }

  .boss-age {
    font-size: 10px !important;
  }
}

/* ===== DESKTOP/TABLET (601px+ height) ===== */
@media (min-height: 601px) {
  .topBossInfo {
    .topBossInfo {
      position: static !important;
      transform: none !important;
      width: auto !important;
      margin: 0 auto 8px auto !important; /* Center with bottom margin */
      padding: 8px 16px !important;
      background: rgba(0, 0, 0, 0.45) !important;
      border-radius: 8px !important;
      font-size: 14px !important;
      display: flex !important;
      justify-content: center !important;
      text-align: center !important;
    }
  }

  .bottomBar {
    position: static !important;
    height: auto !important;
    padding: 10px !important;
    border-radius: 10px !important;
    max-width: 980px !important;
  }

  .battle {
    position: static !important;
    height: 520px !important;
    border-radius: 10px !important;
    min-height: auto !important;
  }

  /* Reset to original sizes */
  .stat {
    min-width: 100px !important;
    padding: 8px !important;
    font-size: 14px !important;
  }

  #ageText,
  #gold,
  #xp {
    font-size: 16px !important;
  }

  .unitButtons {
    height: auto !important;
    gap: 8px !important;
    padding: 4px 2px !important;
  }

  .unit-btn {
    width: 80px !important;
    height: 60px !important;
    padding: 8px !important;
    border-radius: 8px !important;
  }

  .unit-btn .unit-name {
    font-size: 12px !important;
  }

  .unit-btn .unit-cost {
    font-size: 11px !important;
  }

  /* Reset upgrade age button to original size */
  .upgrade-age-square {
    width: 80px !important;
    height: 80px !important;
    padding: 8px !important;
    border-radius: 8px !important;
  }

  .upgrade-age-text {
    font-size: 11px !important;
    margin-bottom: 4px !important;
  }

  .upgrade-age-cost {
    font-size: 10px !important;
  }

  .btn {
    padding: 8px 10px !important;
    font-size: 13px !important;
    height: auto !important;
    border-radius: 8px !important;
  }

  .base {
    width: 100px !important;
    height: 100px !important;
    font-size: 14px !important;
    bottom: 14% !important;
  }

  .unit,
  .bossUnit {
    bottom: 14% !important;
    transform: scale(1) !important;
  }

  .ground {
    bottom: 12% !important;
    height: 8px !important;
  }

  .proj {
    transform: scale(1) !important;
  }
}

/* ===== LARGE SCREENS (901px+ height) ===== */
@media (min-height: 901px) {
  .battle {
    height: 580px !important;
  }

  .base {
    width: 120px !important;
    height: 120px !important;
    font-size: 16px !important;
  }

  #ageText,
  #gold,
  #xp {
    font-size: 18px !important;
  }
}
