* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #fff;
}

#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#canvas-container canvas {
  display: block;
}

/* ——— Main Menu ——— */
#main-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

#main-menu h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #f0a030;
  text-shadow: 0 2px 8px rgba(240, 160, 48, 0.3);
}

#main-menu .subtitle {
  color: #aaa;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

#main-menu .controls-hint {
  color: #777;
  font-size: 0.85rem;
  margin-top: 1.5rem;
}

.save-slot {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  margin-bottom: 0.75rem;
  width: 500px;
  max-width: 90vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.slot-info {
  font-size: 0.95rem;
}

.slot-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ——— Buttons ——— */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: #f0a030;
  color: #1a1a2e;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover {
  background: #ffc040;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-danger {
  background: #e74c3c;
  color: #fff;
}

.btn-danger:hover {
  background: #ff6b5a;
}

/* ——— Game UI ——— */
#game-ui {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#game-ui > * {
  pointer-events: auto;
}

/* HUD Bar */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1.5rem;
  font-size: 1rem;
}

#hud .label {
  color: #aaa;
  font-size: 0.85rem;
}

#hud .value {
  font-weight: 700;
  font-size: 1.1rem;
}

.load-bar {
  width: 120px;
  height: 14px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 7px;
  overflow: hidden;
}

.load-bar-fill {
  height: 100%;
  background: #2ecc71;
  border-radius: 7px;
  transition: width 0.15s;
}

/* Bottom Bar */
#bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

/* ——— Upgrade Panel ——— */
#upgrade-panel {
  display: none;
  position: absolute;
  top: 56px;
  right: 8px;
  width: 320px;
  max-height: calc(100vh - 120px);
  overflow-y: scroll;
  background: rgba(10, 10, 30, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 1rem;
}

#upgrade-panel::-webkit-scrollbar {
  width: 6px;
}

#upgrade-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

#upgrade-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

#upgrade-panel h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: #f0a030;
}

.upgrade-item {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.upgrade-item.disabled {
  opacity: 0.5;
}

.upgrade-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.upgrade-level {
  color: #aaa;
  font-size: 0.85rem;
}

.upgrade-desc {
  font-size: 0.8rem;
  color: #ccc;
  margin-bottom: 0.5rem;
}

.btn-upgrade {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  width: 100%;
}

.strategy-select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
}

.strategy-select:hover {
  background: rgba(255, 255, 255, 0.15);
}

.upgrade-category {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f0a030;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.75rem 0 0.35rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(240, 160, 48, 0.25);
}

.upgrade-category:first-child {
  margin-top: 0;
}

/* ——— Mode Selection ——— */
#mode-select {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 110;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

#mode-select h2 {
  font-size: 1.8rem;
  color: #f0a030;
  text-shadow: 0 2px 8px rgba(240, 160, 48, 0.3);
}

.mode-options {
  display: flex;
  gap: 1.5rem;
  max-width: 90vw;
}

.mode-card {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1.5rem;
  width: 240px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  text-align: center;
}

.mode-card:hover {
  border-color: #f0a030;
  background: rgba(240, 160, 48, 0.1);
  transform: translateY(-2px);
}

.mode-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.mode-card p {
  font-size: 0.85rem;
  color: #aaa;
  line-height: 1.4;
}

.mode-card.mode-unlimited {
  border-color: rgba(160, 100, 255, 0.4);
}

.mode-card.mode-unlimited:hover {
  border-color: #a064ff;
  background: rgba(160, 100, 255, 0.12);
}

.mode-card.mode-unlimited h3 {
  color: #c8a0ff;
}

.mode-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 0.4rem;
}

.mode-badge-normal {
  background: rgba(240, 160, 48, 0.2);
  color: #f0a030;
}

.mode-badge-unlimited {
  background: rgba(160, 100, 255, 0.2);
  color: #c8a0ff;
}

/* ——— Pause Menu ——— */
#pause-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.7);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

#pause-menu h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

#pause-menu .btn {
  width: 200px;
  padding: 0.75rem;
  font-size: 1.1rem;
}

#pause-menu .btn-unlimited {
  background: #a064ff;
  color: #fff;
}

#pause-menu .btn-unlimited:hover {
  background: #b880ff;
}

/* ——— Virtual Joystick (mobile only) ——— */
#joystick-container {
  position: fixed;
  bottom: 70px;
  left: 30px;
  z-index: 30;
  pointer-events: none;
}

#joystick-base {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
}

#joystick-knob {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.6);
  transition: transform 0.05s;
  pointer-events: none;
}

/* ——— Floating Text ——— */
.floating-text {
  position: absolute;
  color: #ffd700;
  font-weight: 700;
  font-size: 1.2rem;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%);
  z-index: 20;
}
