/* ─────────────────────────────────────────────────────────────
   Chop Grass – Global Stylesheet
   Big, bold, adapts to every screen
   ───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto:wght@300;400;700&display=swap');

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a0604;
  font-family: 'Roboto', sans-serif;
  color: #e8dcc8;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}

/* ── Game Container — fills entire viewport ──────────────── */

#game-container {
  width: 100vw; height: 100vh;
  position: fixed; top: 0; left: 0;
}

/* Let Phaser manage the canvas size — no CSS override needed */

/* ── HUD ─────────────────────────────────────────────────── */

#game-hud {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
  z-index: 50; pointer-events: none;
  align-items: flex-start; justify-content: space-between;
  font-size: 16px;
}
#game-hud > * { pointer-events: auto; }

.hud-left, .hud-center, .hud-right {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.hud-left { align-items: flex-start; }
.hud-right { align-items: flex-end; }

.hud-oxygen { display: flex; align-items: center; gap: 8px; }
.hud-label { font-family: 'Press Start 2P', monospace; font-size: 14px; color: #4fc3f7; }
.hud-bar-bg {
  width: 160px; height: 14px;
  background: #222; border-radius: 7px; overflow: hidden; border: 1px solid #444;
}
.hud-bar-fill { height: 100%; background: #4caf50; transition: width 0.3s; border-radius: 7px; }
#hud-o2-txt { font-family: 'Press Start 2P', monospace; font-size: 12px; min-width: 30px; text-align: right; }
.hud-coins { font-family: 'Press Start 2P', monospace; font-size: 16px; color: #ffd700; }
.hud-biome { font-family: 'Press Start 2P', monospace; font-size: 12px; color: #ffd700; text-shadow: 1px 1px 3px #000; }
.hud-depth { font-size: 14px; color: #aaa; }
.hud-timer { font-family: 'Press Start 2P', monospace; font-size: 12px; color: #ccc; }

.hud-bank-btn {
  font-family: 'Press Start 2P', monospace; font-size: 12px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #d4a017, #b8860b);
  border: 2px solid #ffd700; color: #fff; border-radius: 8px;
  cursor: pointer; transition: transform 0.1s, box-shadow 0.1s;
}
.hud-bank-btn:hover { transform: scale(1.08); box-shadow: 0 0 16px rgba(255,215,0,0.5); }
.hud-bank-btn:active { transform: scale(0.95); }

/* ── Touch Controls — big, friendly buttons ──────────────── */

#touch-controls {
  display: none;
  position: fixed; bottom: 20px; left: 0; right: 0;
  z-index: 50; justify-content: space-between; align-items: flex-end;
  padding: 0 20px; pointer-events: none;
}
#touch-controls > * { pointer-events: auto; }

.touch-dpad { display: flex; gap: 14px; }
.touch-actions { display: flex; gap: 14px; align-items: flex-end; }

.touch-btn {
  width: 70px; height: 70px; border-radius: 50%;
  background: rgba(255,255,255,0.18); border: 3px solid rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  cursor: pointer; transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn:active { background: rgba(255,255,255,0.4); }

.touch-btn-chop {
  width: 90px; height: 90px;
  font-family: 'Press Start 2P', monospace; font-size: 13px;
  background: rgba(76,175,80,0.35); border-color: #4caf50;
  border-width: 3px;
}
.touch-btn-jump {
  font-family: 'Press Start 2P', monospace; font-size: 11px;
  background: rgba(33,150,243,0.35); border-color: #2196f3;
}

/* ── Overlays ────────────────────────────────────────────── */

.overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8);
  align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
  padding: 16px;
}
.overlay-panel {
  background: linear-gradient(135deg, #2a1a0a, #1a0e08);
  border: 2px solid #d4a017; border-radius: 16px;
  padding: 28px;
  max-width: 640px; max-height: 88vh; width: 100%;
  overflow-y: auto; position: relative;
  box-shadow: 0 0 80px rgba(212,160,23,0.2), inset 0 1px 0 rgba(255,215,0,0.1);
  animation: slideUp 0.25s ease-out;
}
.overlay-panel::-webkit-scrollbar { width: 6px; }
.overlay-panel::-webkit-scrollbar-thumb { background: #d4a017; border-radius: 3px; }
.overlay-panel::-webkit-scrollbar-track { background: #1a0e08; }

.overlay-title {
  font-family: 'Press Start 2P', monospace; font-size: 20px;
  color: #ffd700; text-align: center; margin-bottom: 20px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.overlay-close {
  position: absolute; top: 14px; right: 18px;
  font-size: 28px; color: #f44336; cursor: pointer;
  background: none; border: none; line-height: 1;
  padding: 6px 10px; border-radius: 6px; transition: background 0.2s;
}
.overlay-close:hover { background: rgba(244,67,54,0.2); }

/* ── Upgrade Grid ────────────────────────────────────────── */

.upgrade-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid rgba(212,160,23,0.2);
}
.upgrade-header-coins {
  font-family: 'Press Start 2P', monospace; font-size: 16px; color: #ffd700;
}
#upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.upgrade-card {
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(212,160,23,0.25);
  border-radius: 12px; padding: 18px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.upgrade-card:hover { border-color: rgba(212,160,23,0.6); transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.upgrade-maxed { border-color: #4caf50 !important; background: rgba(76,175,80,0.1); }
.upgrade-icon { font-size: 32px; margin-bottom: 6px; }
.upgrade-name { font-family: 'Press Start 2P', monospace; font-size: 11px; color: #ffd700; margin-bottom: 6px; }
.upgrade-level { font-size: 14px; color: #aaa; margin-bottom: 6px; }
.upgrade-desc { font-size: 14px; color: #ccc; margin-bottom: 10px; }
.upgrade-bar { width: 100%; height: 8px; background: #222; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.upgrade-bar-fill { height: 100%; background: linear-gradient(90deg, #d4a017, #ffd700); border-radius: 4px; transition: width 0.3s; }
.upgrade-cost { font-size: 13px; color: #aaa; text-align: center; }
.upgrade-cost.maxed { color: #4caf50; font-weight: bold; font-size: 14px; }
.upgrade-buy-btn {
  width: 100%; padding: 12px;
  font-family: 'Press Start 2P', monospace; font-size: 11px;
  background: linear-gradient(135deg, #d4a017, #b8860b);
  border: 2px solid #ffd700; color: #fff; border-radius: 8px;
  cursor: pointer; transition: all 0.2s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.upgrade-buy-btn:hover { background: linear-gradient(135deg, #e8b41e, #d4a017); box-shadow: 0 0 16px rgba(255,215,0,0.4); transform: scale(1.03); }
.upgrade-buy-btn.disabled { background: #333; border-color: #555; color: #666; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Shop Grid ───────────────────────────────────────────── */

#shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.shop-card {
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(156,39,176,0.3);
  border-radius: 12px; padding: 18px; text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}
.shop-card:hover { border-color: rgba(156,39,176,0.7); transform: translateY(-3px); }
.shop-owned { border-color: #4caf50 !important; background: rgba(76,175,80,0.1); }
.shop-icon { font-size: 40px; margin-bottom: 8px; }
.shop-name { font-family: 'Press Start 2P', monospace; font-size: 10px; color: #ce93d8; margin-bottom: 6px; }
.shop-desc { font-size: 13px; color: #aaa; margin-bottom: 10px; min-height: 32px; }
.shop-price { font-family: 'Press Start 2P', monospace; font-size: 15px; color: #ffd700; margin-bottom: 12px; }
.shop-status { font-size: 14px; color: #4caf50; font-weight: bold; }
.shop-buy-btn {
  width: 100%; padding: 12px;
  font-family: 'Press Start 2P', monospace; font-size: 11px;
  background: linear-gradient(135deg, #9c27b0, #7b1fa2);
  border: 2px solid #ce93d8; color: #fff; border-radius: 8px;
  cursor: pointer; transition: all 0.2s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.shop-buy-btn:hover { background: linear-gradient(135deg, #ab47bc, #9c27b0); box-shadow: 0 0 16px rgba(156,39,176,0.5); }

/* ── Settings ────────────────────────────────────────────── */

#settings-content { display: flex; flex-direction: column; gap: 16px; }
.settings-section {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 18px;
}
.settings-section h3 {
  font-family: 'Press Start 2P', monospace; font-size: 13px; color: #ffd700; margin-bottom: 12px;
}
.settings-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.settings-row label { min-width: 110px; font-size: 14px; }
.settings-row input[type="range"] { flex: 1; min-width: 100px; accent-color: #d4a017; height: 6px; }
.settings-row span { min-width: 40px; text-align: right; font-size: 13px; color: #aaa; }
.settings-input {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px; color: #e8dcc8; font-size: 16px; font-family: 'Roboto', sans-serif;
  margin-bottom: 10px; outline: none; transition: border-color 0.2s;
}
.settings-input:focus { border-color: #d4a017; }
.settings-input::placeholder { color: #555; }
.settings-btn {
  padding: 10px 18px; font-family: 'Roboto', sans-serif; font-size: 14px; font-weight: 600;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25);
  color: #e8dcc8; border-radius: 8px; cursor: pointer; transition: all 0.2s;
  flex: 1; min-width: 120px;
}
.settings-btn:hover { background: rgba(255,255,255,0.2); }
.settings-btn:active { transform: scale(0.97); }
.settings-btn-danger { background: rgba(244,67,54,0.2); border-color: #f44336; color: #f44336; }
.settings-btn-danger:hover { background: rgba(244,67,54,0.35); }
.settings-btn-google { background: rgba(66,133,244,0.2); border-color: #4285f4; color: #8ab4f8; width: 100%; }
.settings-divider { text-align: center; color: #555; font-size: 13px; margin: 10px 0; }
.settings-user { font-size: 14px; color: #aaa; margin-bottom: 12px; }
.settings-user strong { color: #ffd700; }
.settings-note { font-size: 13px; color: #888; font-style: italic; line-height: 1.6; }
.settings-status { font-size: 13px; margin-top: 10px; min-height: 20px; }
.settings-status-info { color: #4fc3f7; }
.settings-status-error { color: #f44336; }
.settings-danger-zone { border-color: rgba(244,67,54,0.3); }
.settings-auth-form { display: flex; flex-direction: column; gap: 6px; }

/* ── Biome Select ────────────────────────────────────────── */

#biome-grid { display: flex; flex-direction: column; gap: 12px; }
.biome-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border: 2px solid rgba(255,255,255,0.1); border-radius: 12px;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}
.biome-card[style*="cursor"] { cursor: pointer; }
.biome-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
.biome-card[style*="cursor"]:hover { box-shadow: 0 6px 24px rgba(255,215,0,0.2); }
.biome-swatch { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.2); }
.biome-label { flex: 1; font-size: 16px; font-weight: 700; }

/* ── Dashboard ───────────────────────────────────────────── */

.dash-player { text-align: center; font-size: 20px; color: #ffd700; margin-bottom: 18px; }
.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.dash-biome {
  background: rgba(255,255,255,0.05); border: 2px solid #333;
  border-radius: 12px; padding: 14px;
}
.dash-biome-name { font-family: 'Press Start 2P', monospace; font-size: 10px; margin-bottom: 8px; }
.dash-stat { font-size: 14px; color: #ccc; margin-bottom: 4px; }
.dash-stat strong { color: #ffd700; }
.dash-totals {
  display: flex; gap: 24px; justify-content: center; flex-wrap: wrap;
  padding: 14px; background: rgba(255,255,255,0.05); border-radius: 10px; margin-bottom: 18px;
  font-size: 16px; color: #ccc;
}
.dash-totals strong { color: #ffd700; }
.dash-section-title { font-family: 'Press Start 2P', monospace; font-size: 11px; color: #ffd700; margin-bottom: 10px; }
.dash-upgrades { margin-top: 10px; }
.dash-upgrade-row { display: flex; flex-wrap: wrap; gap: 10px; }
.dash-upgrade-item {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(212,160,23,0.2);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; color: #ccc;
}
.dash-upgrade-item strong { color: #ffd700; }

/* ── Animations ──────────────────────────────────────────── */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 600px) {
  #upgrade-grid { grid-template-columns: 1fr; }
  #shop-grid { grid-template-columns: 1fr 1fr; }
  .overlay-panel { padding: 18px; }
  .overlay-title { font-size: 16px; }
  .settings-row { flex-direction: column; align-items: stretch; }
  .settings-row label { min-width: auto; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-height: 420px) {
  .overlay-panel { padding: 14px; max-height: 94vh; }
  .overlay-title { font-size: 14px; margin-bottom: 12px; }
  #upgrade-grid, #shop-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
  .upgrade-card, .shop-card { padding: 10px; }
  .biome-card { padding: 10px 14px; }
}P