/* Ant Architect */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #3E2723;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  touch-action: none;
  cursor: crosshair;
  display: block;
}

/* HUD — viewport'a sabitlenir, #app yüksekliğine bağlı değil */
.hud-bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: auto;
  padding: 8px 12px;
}

.hud-top {
  top: 0;
  padding-top: max(8px, env(safe-area-inset-top));
  flex-wrap: wrap;
  justify-content: flex-start;
  background: linear-gradient(180deg, rgba(0,0,0,0.45) 0%, transparent 100%);
  pointer-events: none;
}

.hud-top .stat-pill { pointer-events: auto; }

.hud-bottom {
  bottom: 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  flex-wrap: wrap;
  justify-content: center;
  background: linear-gradient(0deg, rgba(0,0,0,0.55) 0%, transparent 100%);
}

.hud-toast {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  pointer-events: none;
  background: rgba(0,0,0,0.7);
  color: #FFF9C4;
  padding: 10px 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: clamp(0.85rem, 3.5vw, 1rem);
  white-space: normal;
  line-height: 1.35;
  transition: opacity 0.3s;
  max-width: 92vw;
  text-align: center;
}

.hud-toast.hidden { opacity: 0; }

.stat-pill {
  background: rgba(255,255,255,0.95);
  border-radius: 999px;
  padding: 7px 13px;
  font-weight: 800;
  font-size: clamp(0.75rem, 3vw, 0.9rem);
  color: #4E342E;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.hud-btn {
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 800;
  font-size: clamp(0.75rem, 3vw, 0.88rem);
  background: rgba(255,255,255,0.95);
  color: #4E342E;
  box-shadow: 0 3px 12px rgba(0,0,0,0.2);
  cursor: pointer;
  touch-action: manipulation;
}

.hud-btn:active { transform: scale(0.9); }
.hud-btn:disabled { opacity: 0.4; }

.hud-btn.primary {
  background: linear-gradient(135deg, #66BB6A, #43A047);
  color: white;
}

.hud-btn.speed { padding: 10px 13px; min-width: 42px; }
.hud-btn.speed.active { background: #FF7043; color: white; }
.speed-group { display: flex; gap: 4px; }

.hud-btn.reward-ad {
  background: linear-gradient(135deg, #42A5F5, #1E88E5);
  color: white;
  width: 100%;
  margin-top: 8px;
}

.error-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 300;
  background: #FFEBEE;
  color: #C62828;
  padding: 16px;
  border-radius: 12px;
  max-width: 90%;
  font-size: 0.85rem;
}

.error-banner.hidden { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: auto;
}

.modal.hidden { display: none; }

.modal-panel {
  background: #FFF8E1;
  border-radius: 20px;
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.modal-panel h2 { text-align: center; color: #4E342E; margin-bottom: 16px; }
.modal-panel.celebration { text-align: center; }
.modal-panel.celebration p { color: #5D4037; margin-bottom: 16px; }

.upgrade-item, .shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  gap: 8px;
}

.upgrade-item button, .shop-item button {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  background: #81C784;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
}

.upgrade-item button:disabled, .shop-item button:disabled { background: #BDBDBD; }
.upgrade-item .name, .shop-item .name { font-weight: 700; color: #4E342E; font-size: 0.9rem; }
.upgrade-item .desc, .shop-item .desc { font-size: 0.75rem; color: #795548; }
.upgrade-item .info, .shop-item .info { flex: 1; }

.modal-close {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 999px;
  background: #FF7043;
  color: white;
  font-weight: 800;
  cursor: pointer;
}
