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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-hover: #1a2847;
  --primary: #e94560;
  --accent: #f5a623;
  --text: #eee;
  --text-dim: #888;
  --gold: #ffd700;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
header {
  text-align: center;
  padding: 20px 0;
}

header h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

#stats {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px 24px;
  display: inline-block;
}

#cookie-count {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

#cps {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Main layout */
main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  flex: 1;
  margin-top: 24px;
}

/* Cookie area */
#cookie-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#cookie-btn {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 35%, #c68642, #8b5e3c);
  cursor: pointer;
  transition: transform 0.1s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cookie-btn:hover {
  transform: scale(1.05);
}

#cookie-btn:active {
  transform: scale(0.95);
}

#cookie-btn.clicked {
  animation: pop 0.15s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

#cookie-emoji {
  font-size: 120px;
  user-select: none;
  pointer-events: none;
}

#click-power {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* Shop */
#shop {
  overflow-y: auto;
  max-height: 60vh;
}

#shop h2 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: var(--accent);
}

.upgrade-item {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upgrade-item:hover {
  background: var(--surface-hover);
  border-color: rgba(233, 69, 96, 0.3);
}

.upgrade-item.affordable {
  border-color: rgba(245, 166, 35, 0.4);
}

.upgrade-item.affordable:hover {
  border-color: var(--accent);
}

.upgrade-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.upgrade-icon {
  font-size: 2rem;
  width: 48px;
  text-align: center;
  flex-shrink: 0;
}

.upgrade-info {
  flex: 1;
  min-width: 0;
}

.upgrade-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.upgrade-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.upgrade-meta {
  text-align: right;
  flex-shrink: 0;
}

.upgrade-cost {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}

.upgrade-owned {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Floating numbers */
#floating-numbers {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.float-num {
  position: absolute;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  animation: floatUp 1s ease-out forwards;
  pointer-events: none;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-80px) scale(1.3);
  }
}

/* Footer */
footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 24px;
}

footer button {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

#save-btn {
  background: var(--primary);
  color: white;
}

#save-btn:hover {
  background: #d63851;
}

#reset-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

#reset-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

#save-status {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Scrollbar */
#shop::-webkit-scrollbar {
  width: 6px;
}

#shop::-webkit-scrollbar-track {
  background: transparent;
}

#shop::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 640px) {
  main {
    grid-template-columns: 1fr;
  }

  #cookie-btn {
    width: 180px;
    height: 180px;
  }

  #cookie-emoji {
    font-size: 90px;
  }

  #cookie-count {
    font-size: 1.4rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  #shop {
    max-height: none;
  }
}
