body {
  margin: 0;
  overflow: hidden;
  font-family: Arial, sans-serif;
  background: #20170b;
}
#ui {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(255,255,255,0.8);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 22px;
  box-shadow: 2px 2px 8px #0008;
  display: flex;
  gap: 32px;
  justify-content: center;
  align-items: center;
}
.quit-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 110;
  font-size: 20px;
  padding: 7px 20px;
  border-radius: 8px;
  border: none;
  background: #db3a3a;
  color: #fff;
  cursor: pointer;
  box-shadow: 2px 2px 8px #0008;
  font-family: inherit;
  transition: background 0.15s;
}
.quit-btn:hover,
.quit-btn:active {
  background: #a22121;
}
#popup, #troopPopup, #resourcePopup {
  position: fixed;
  left: 50%;
  top: 32px;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 16px #000a;
  padding: 20px 32px;
  z-index: 150;
  font-size: 18px;
  min-width: 200px;
  min-height: 60px;
}
#troopPopup {
  top: 110px;
}
#resourcePopup {
  top: 190px;
}
#progressBarContainer {
  margin-top: 10px;
}
.progress-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}
.progress-bar-x {
  margin-left: 10px;
  font-size: 22px;
  color: #a22121;
  background: #fff;
  border: 1.5px solid #a22121;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s, color 0.2s;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
}
.progress-bar-x:active {
  background: #a22121;
  color: #fff;
}
.progress-bar-inner {
  flex: 1 1 auto;
  position: relative;
}
#deselectTroop {
  font-size: 24px;
  padding: 10px 28px;
  min-width: 120px;
  margin-top: 10px;
}
@media (max-width: 700px) {
  #deselectTroop {
    font-size: 32px;
    padding: 16px 32px;
    min-width: 180px;
  }
}
button {
  font-size: 16px;
  margin: 4px 2px;
  padding: 6px 20px;
  border-radius: 6px;
  border: none;
  background: #3a7edb;
  color: #fff;
  cursor: pointer;
  box-shadow: 1px 1px 6px #0004;
  transition: background 0.15s;
}
button:hover {
  background: #235fa2;
}
.mobile-scroll {
  position: fixed;
  bottom: 50%;
  transform: translateY(50%);
  opacity: 0.92;
  font-size: 44px;
  width: 64px;
  height: 84px;
  background: #000c;
  color: #fff;
  border: none;
  border-radius: 12px;
  z-index: 1000;
  box-shadow: 2px 2px 18px #000a;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, opacity 0.2s;
}
.mobile-scroll:active,
.mobile-scroll.pressed {
  background: #235fa2;
  color: #ffd700;
  opacity: 1;
}
#scrollLeft {
  left: 0;
  border-radius: 0 16px 16px 0;
}
#scrollRight {
  right: 0;
  border-radius: 16px 0 0 16px;
}
@media (max-width: 900px) {
  .mobile-scroll {
    display: flex;
  }
  #popup, #troopPopup, #resourcePopup {
    min-width: 50vw;
    left: 0;
    right: 0;
    transform: none;
  }
}
canvas#gameCanvas {
  position: absolute;
  left: 0; top: 0;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  display: block;
}
#rotateOverlay {
  display: none;
  position: fixed;
  z-index: 999;
  width: 100vw;
  height: 100vh;
  left: 0;
  top: 0;
  background: rgba(0,0,0,0.9);
  color: white;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  text-align: center;
}