:root {
  --bg-color: #0d1117;
  --panel-bg: rgba(22, 27, 34, 0.7);
  --accent-color: #58a6ff;
  --accent-hover: #79c0ff;
  --text-main: #c9d1d9;
  --text-muted: #8b949e;
  --border-color: rgba(48, 54, 61, 0.5);
  --success-color: #3fb950;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  overflow-x: hidden;
  overflow-y: auto;
  background-image: radial-gradient(circle at 15% 50%, rgba(88, 166, 255, 0.05), transparent 25%),
                    radial-gradient(circle at 85% 30%, rgba(138, 43, 226, 0.05), transparent 25%);
}

.app-container {
  display: flex;
  width: 100%;
  height: auto;
  min-height: calc(100vh - 60px);
  margin-top: 60px;
}

/* APP HEADER */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 50;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.header-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
}

.header-controls {
  display: flex;
  gap: 1rem;
}

.header-btn {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 600;
}

.header-btn:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--text-muted);
}

/* LEFT: MAIN CLICKER AREA */
.clicker-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.stats-container {
  text-align: center;
  margin-bottom: 4rem;
  z-index: 10;
}

.code-count {
  font-size: 5rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 30px rgba(88, 166, 255, 0.4);
  letter-spacing: -2px;
}

.cps-count {
  font-size: 1.3rem;
  color: var(--accent-color);
  margin-top: 0.5rem;
  font-weight: 600;
}

.main-button-container {
  position: relative;
}

.main-button {
  background: linear-gradient(135deg, #1f242c, #161b22);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 2px 20px rgba(255,255,255,0.05);
  transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.main-button img {
  width: 120px;
  opacity: 0.8;
  pointer-events: none;
}

.main-button i {
  font-size: 65px;
  color: #fff;
  text-shadow: 0 0 20px var(--accent-color);
  pointer-events: none;
}

/* Floating Text Animation */
.floating-text {
  position: absolute;
  color: var(--success-color);
  font-weight: bold;
  font-size: 2rem;
  pointer-events: none;
  animation: floatUp 1s cubic-bezier(0.0, 0.0, 0.2, 1) forwards;
  text-shadow: 0 0 10px rgba(63, 185, 80, 0.8);
  font-family: monospace;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.9); }
}

/* RIGHT: UPGRADES PANEL */
.upgrades-section {
  width: 400px;
  background-color: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  overflow-y: auto;
  box-shadow: -5px 0 20px rgba(0,0,0,0.3);
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 0.8rem;
}

.upgrade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.upgrade-item:hover:not(.disabled) {
  background: rgba(88, 166, 255, 0.15);
  border-color: var(--accent-color);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.upgrade-item:active:not(.disabled) {
  transform: translateY(-1px);
}

.upgrade-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.upgrade-info h3 {
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 0.3rem;
}

.upgrade-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.upgrade-cost {
  text-align: right;
}

.cost-amount {
  display: inline-block;
  font-weight: bold;
  color: #f78166;
  font-size: 1rem;
  background: rgba(247, 129, 102, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.owned-amount {
  font-size: 1.8rem;
  font-weight: 800;
  color: rgba(255,255,255,0.2);
  margin-left: 1rem;
  min-width: 40px;
  text-align: center;
  transition: color 0.3s;
}

.upgrade-item:not(.disabled) .owned-amount {
  color: var(--accent-color);
  text-shadow: 0 0 15px rgba(88, 166, 255, 0.3);
}

/* MONETIZATION PLACEHOLDERS */
.ad-banner {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 8px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.rewarded-ad-btn {
  background: linear-gradient(135deg, #8a2be2, #4b0082);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 1.2rem;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: auto;
  transition: all 0.2s;
  box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
}

.rewarded-ad-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(138, 43, 226, 0.6);
  background: linear-gradient(135deg, #9b30ff, #551a8b);
}

.rewarded-ad-btn:active {
  transform: translateY(1px);
}

.ad-active-tag {
  color: var(--success-color);
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1rem;
  text-align: center;
  display: none;
  background: rgba(63, 185, 80, 0.1);
  padding: 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

/* TOAST NOTIFICATION */
.toast-notification {
  position: fixed;
  top: 80px;
  right: -400px;
  width: 320px;
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid var(--accent-color);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6), 0 0 20px rgba(88, 166, 255, 0.2);
  transition: right 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  backdrop-filter: blur(15px);
}

.toast-notification.show {
  right: 20px;
}

.toast-icon {
  font-size: 2.2rem;
  color: gold;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.toast-content h4 {
  color: #fff;
  margin-bottom: 0.3rem;
  font-size: 1.05rem;
}

.toast-content p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* PRESTIGE BUTTON */
.prestige-btn {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(218, 165, 32, 0.05));
  border: 1px solid rgba(255, 215, 0, 0.6);
  margin-bottom: 1.5rem;
  animation: pulseGold 2.5s infinite;
  text-align: center;
}

.prestige-btn:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(218, 165, 32, 0.15)) !important;
  border-color: #ffd700 !important;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.4) !important;
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.3); }
  70% { box-shadow: 0 0 0 8px rgba(255, 215, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: none; 
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 500px;
  max-width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 15px; right: 15px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover { color: #fff; }

#modal-title {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  color: white;
  margin: 0;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

/* TROPHY GRID */
.trophy-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.trophy-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}

.trophy-item.unlocked {
  border-color: var(--accent-color);
  background: rgba(88, 166, 255, 0.1);
}

.trophy-icon {
  font-size: 2rem;
  color: var(--text-muted);
  width: 40px;
  text-align: center;
}

.trophy-item.unlocked .trophy-icon {
  color: gold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.trophy-info strong {
  display: block;
  color: #fff;
  font-size: 1.1rem;
}

.trophy-info p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* GOLDEN BUG EVENT */
.golden-bug {
  position: fixed;
  font-size: 2.5rem;
  color: #ffb000;
  text-shadow: 0 0 20px rgba(255, 176, 0, 0.8);
  cursor: crosshair;
  z-index: 100;
  animation: flutter 0.1s infinite alternate;
  transition: transform 0.2s, opacity 0.2s;
}

@keyframes flutter {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

/* MINI MAP SUMMARY */
.mini-map-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  max-width: 95%;
}

.minimap-item {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.minimap-item i {
  color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    margin-top: 50px;
    height: calc(100% - 50px);
  }
  
  .app-header {
    height: 50px;
    padding: 0 1rem;
  }
  
  .header-title {
    font-size: 0.95rem;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .header-btn {
    padding: 0.4rem;
    font-size: 0.95rem;
  }

  .header-btn span {
    display: none; /* Hide text to save space, rely on icons */
  }

  .clicker-section {
    padding: 1rem;
    flex: 0 0 35vh; /* Massive reduction from 45vh */
  }
  
  .stats-container {
    margin-bottom: 1rem; /* Eliminated 4rem gap */
  }
  
  .code-count {
    font-size: 3.5rem;
  }

  .cps-count {
    font-size: 1rem;
  }
  
  .main-button {
    width: 140px;
    height: 140px;
  }
  
  .main-button i {
    font-size: 55px;
  }

  .mini-map-container {
    margin-top: 1rem;
  }
  
  .upgrades-section {
    width: 100%;
    flex: 1;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 1rem;
  }
  
  .upgrade-item {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
  }

  .upgrade-info h3 {
    font-size: 1.05rem;
    margin-bottom: 0px;
  }

  .upgrade-info p {
    display: none; /* Hide descriptive text on mobile completely to squish cards */
  }
  
  .cost-amount {
    font-size: 0.9rem;
  }

  .owned-amount {
    font-size: 1.25rem;
  }
}
