/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #ff6b35;
  --secondary: #004e89;
  --accent: #f7c948;
  --dark: #1a1a2e;
  --darker: #0f0f1a;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 107, 53, 0.15);
  --card-hover: rgba(255, 107, 53, 0.08);
  --light: #f0f0f0;
  --green: #4caf50;
  --red: #e74c3c;
  --gold: #ffd700;
  --purple: #9b59b6;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--darker);
  color: var(--light);
  overflow-x: hidden;
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
}

h2, h3 { font-family: 'Bangers', cursive; letter-spacing: 1.5px; }

.hidden { display: none !important; }

#particles {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}

/* ===== TOP BAR ===== */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(15, 15, 26, 0.95);
  border-bottom: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem; z-index: 100;
  backdrop-filter: blur(10px);
}

.back-link {
  color: var(--primary); text-decoration: none;
  font-weight: 600; font-size: 0.85rem;
}

.top-center { display: flex; gap: 1rem; align-items: center; }

.prestige-badge, .souls-display {
  font-size: 0.9rem; font-weight: 700;
  padding: 2px 10px; border-radius: 20px;
}

.prestige-badge {
  background: rgba(247, 201, 72, 0.15);
  color: var(--accent); border: 1px solid rgba(247, 201, 72, 0.3);
}

.souls-display {
  background: rgba(155, 89, 182, 0.15);
  color: var(--purple); border: 1px solid rgba(155, 89, 182, 0.3);
}

.dps-display { color: #888; font-size: 0.85rem; }
.dps-display strong {
  color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: 0.95rem;
}

/* ===== GAME CONTAINER ===== */
.game-container {
  display: grid;
  grid-template-columns: 320px 1fr 300px;
  min-height: 100vh;
  padding-top: 48px;
  position: relative; z-index: 1;
}

/* ===== SHOP PANEL (LEFT) ===== */
.shop-panel {
  background: rgba(15, 15, 26, 0.92);
  border-right: 1px solid var(--card-border);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px);
}

.shop-tabs, .right-tabs {
  display: flex; border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}

.shop-tab, .right-tab {
  flex: 1; padding: 0.6rem 0.4rem;
  background: none; border: none; color: #888;
  font-size: 0.8rem; font-weight: 700; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.shop-tab.active, .right-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(255, 107, 53, 0.05);
}

.shop-tab:hover, .right-tab:hover { color: var(--light); }

/* Buy amount bar */
.buy-amount-bar {
  display: flex; padding: 0.4rem; gap: 0.3rem;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}

.buy-amt {
  flex: 1; padding: 0.35rem;
  background: var(--card); border: 1px solid var(--card-border);
  color: #888; font-size: 0.75rem; font-weight: 700;
  border-radius: 6px; cursor: pointer; transition: all 0.15s;
}

.buy-amt.active {
  background: rgba(255, 107, 53, 0.15);
  color: var(--primary);
  border-color: var(--primary);
}

.shop-tab-content, .right-tab-content {
  display: none; overflow-y: auto; flex: 1;
  padding: 0.6rem;
}

.shop-tab-content.active, .right-tab-content.active { display: block; }

.prestige-shop-header {
  padding: 0.5rem; margin-bottom: 0.5rem;
  font-size: 0.8rem; color: #888; line-height: 1.4;
}

.souls-balance {
  margin-top: 0.4rem; color: var(--purple);
}

.souls-balance strong {
  font-family: 'Bangers', cursive; font-size: 1.2rem;
}

/* Shop items */
.shop-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 0.6rem;
  position: relative;
}

.shop-item:hover {
  background: var(--card-hover);
  border-color: var(--primary);
  transform: translateX(3px);
}

.shop-item.cannot-afford { opacity: 0.35; cursor: not-allowed; }
.shop-item.cannot-afford:hover { transform: none; border-color: var(--card-border); }
.shop-item.purchased { opacity: 0.25; pointer-events: none; }

.shop-item-icon { font-size: 1.6rem; flex-shrink: 0; width: 36px; text-align: center; }

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

.shop-item-name {
  font-weight: 700; font-size: 0.8rem; color: var(--light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.shop-item-desc {
  font-size: 0.68rem; color: #666; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.shop-item-cost {
  font-size: 0.72rem; color: var(--accent); font-weight: 700; margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.shop-item-count {
  font-family: 'Bangers', cursive; font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.12); flex-shrink: 0;
  min-width: 28px; text-align: right;
}

/* Upgrade progress bar (multi-click) */
.upgrade-progress {
  position: absolute; bottom: 0; left: 0;
  height: 3px; background: var(--primary);
  border-radius: 0 0 10px 10px;
  transition: width 0.15s;
}

/* Prestige shop items */
.prestige-item {
  background: rgba(155, 89, 182, 0.05);
  border: 1px solid rgba(155, 89, 182, 0.2);
}

.prestige-item:hover {
  border-color: var(--purple);
  background: rgba(155, 89, 182, 0.1);
}

.prestige-item .shop-item-cost { color: var(--purple); }

/* ===== CLICKER AREA (CENTER) ===== */
.clicker-area {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1.5rem;
  position: relative;
  background: radial-gradient(ellipse at center, rgba(255, 107, 53, 0.04) 0%, transparent 70%);
}

.dogged-counter-display { text-align: center; margin-bottom: 0.8rem; }

.counter-value {
  font-family: 'Bangers', cursive;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(247, 201, 72, 0.25);
  line-height: 1; transition: transform 0.08s;
}

.counter-value.bump { transform: scale(1.04); }

.counter-label {
  font-family: 'Bangers', cursive;
  font-size: 1.2rem; color: var(--primary); letter-spacing: 3px;
}

.multiplier-bar {
  display: flex; gap: 1rem; margin-bottom: 1rem;
}

.mult-item {
  font-size: 0.85rem; font-weight: 700;
  padding: 3px 12px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: #888;
}

.combo-display { color: var(--primary); }

/* Big clicker */
.clicker-wrapper {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
}

.big-clicker {
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 5px solid var(--primary);
  background: var(--dark);
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: box-shadow 0.2s;
  box-shadow: 0 0 30px rgba(255, 107, 53, 0.25), 0 0 60px rgba(255, 107, 53, 0.08);
  -webkit-tap-highlight-color: transparent;
}

.big-clicker:hover {
  box-shadow: 0 0 50px rgba(255, 107, 53, 0.4), 0 0 100px rgba(255, 107, 53, 0.15);
}

.big-clicker:active { transform: scale(0.93); }
.big-clicker.clicked { animation: clickPop 0.12s ease-out; }

@keyframes clickPop {
  0% { transform: scale(1); }
  50% { transform: scale(0.89); }
  100% { transform: scale(1); }
}

.clicker-face {
  width: 100%; height: 100%;
  object-fit: cover; pointer-events: none;
}

.click-ring {
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  pointer-events: none; opacity: 0; z-index: -1;
}

.click-ring.active { animation: ringExpand 0.4s ease-out forwards; }

@keyframes ringExpand {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.7); opacity: 0; }
}

.click-power-display {
  margin-top: 0.8rem; color: #666; font-size: 0.85rem;
}

.click-power-display span {
  color: var(--accent); font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

/* Floating click numbers */
.click-float {
  position: fixed;
  font-family: 'Bangers', cursive;
  color: var(--accent); font-size: 1.3rem;
  pointer-events: none; z-index: 10;
  animation: floatUp 0.8s ease-out forwards;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

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

.click-float.crit {
  color: var(--gold); font-size: 2rem;
  animation: floatUpCrit 1s ease-out forwards;
}

@keyframes floatUpCrit {
  0% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translateY(-140px) scale(1.8) rotate(10deg); }
}

/* Sigve quote */
.sigve-quote {
  margin-top: 1.2rem; font-style: italic;
  color: #555; font-size: 0.9rem;
  max-width: 350px; text-align: center;
  min-height: 1.3em; transition: opacity 0.3s;
}

/* Prestige section */
.prestige-section { text-align: center; margin-top: 1.5rem; }

.prestige-divider {
  width: 200px; height: 1px; margin: 0 auto 1rem;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.prestige-info { color: #888; font-size: 0.9rem; margin-bottom: 0.7rem; }
.prestige-info strong { color: var(--purple); font-family: 'Bangers', cursive; font-size: 1.3rem; }

.prestige-btn {
  background: linear-gradient(135deg, var(--purple), #7d3c98);
  color: white; border: 2px solid var(--accent);
  padding: 0.8rem 2rem; border-radius: 50px;
  font-family: 'Bangers', cursive; font-size: 1.3rem;
  letter-spacing: 2px; cursor: pointer;
  box-shadow: 0 0 25px rgba(155, 89, 182, 0.3);
  transition: all 0.2s;
  animation: prestigeGlow 2s ease-in-out infinite;
}

.prestige-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 40px rgba(155, 89, 182, 0.5);
}

@keyframes prestigeGlow {
  0%, 100% { box-shadow: 0 0 25px rgba(155, 89, 182, 0.3); }
  50% { box-shadow: 0 0 40px rgba(155, 89, 182, 0.5); }
}

.prestige-warning {
  color: #555; font-size: 0.75rem; margin-top: 0.5rem;
}

/* ===== GOLDEN DOGGED ===== */
.golden-dogged {
  position: fixed; z-index: 999;
  cursor: pointer;
  animation: goldenFloat 3s ease-in-out infinite;
  transition: transform 0.1s;
  display: flex; flex-direction: column;
  align-items: center; gap: 0.3rem;
}

.golden-dogged:hover { transform: scale(1.1); }
.golden-dogged:active { transform: scale(0.9); }

.golden-img {
  width: 80px; height: 80px;
  border-radius: 50%; object-fit: cover;
  border: 4px solid var(--gold);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 0 60px rgba(255, 215, 0, 0.3);
  filter: sepia(30%) saturate(200%) brightness(1.1);
}

.golden-dogged span {
  font-size: 0.9rem; color: var(--gold);
  font-weight: 700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

@keyframes goldenFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

/* ===== STATS PANEL (RIGHT) ===== */
.stats-panel {
  background: rgba(15, 15, 26, 0.92);
  border-left: 1px solid var(--card-border);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px);
}

.panel-title {
  font-size: 1.1rem; color: var(--accent);
  margin-bottom: 0.8rem; padding: 0.5rem 0;
  border-bottom: 1px solid var(--card-border);
  display: flex; justify-content: space-between; align-items: center;
}

.panel-title span {
  font-size: 0.8rem; color: #888; font-family: 'Inter', sans-serif;
}

.stats-list { display: flex; flex-direction: column; gap: 0.3rem; }

.stat-row {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: #999;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.stat-row strong {
  color: var(--light);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

/* Achievements */
.achievements-list { display: flex; flex-direction: column; gap: 0.4rem; }

.achievement {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.75rem; opacity: 0.25;
  transition: all 0.3s;
}

.achievement.unlocked {
  opacity: 1;
  border-color: var(--accent);
  background: rgba(247, 201, 72, 0.04);
}

.achievement.just-unlocked {
  animation: achievePop 0.5s ease-out;
}

@keyframes achievePop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.05); border-color: var(--gold); }
  100% { transform: scale(1); }
}

.achievement-icon { font-size: 1.1rem; flex-shrink: 0; }
.achievement-info { flex: 1; }
.achievement-name { font-weight: 700; color: var(--light); font-size: 0.8rem; }
.achievement-desc { color: #666; font-size: 0.65rem; margin-top: 1px; }

/* Save controls */
.save-controls {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.4rem; margin-top: 1rem;
}

.save-btn {
  padding: 0.55rem;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--light);
  border-radius: 8px;
  font-size: 0.78rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}

.save-btn:hover {
  background: var(--card-hover);
  border-color: var(--primary);
}

.reset-btn:hover { border-color: var(--red); color: var(--red); }

/* Leaderboard */
.leaderboard-submit {
  display: flex; gap: 0.4rem; margin-bottom: 0.8rem;
}

.name-input {
  flex: 1; padding: 0.5rem 0.7rem;
  background: var(--card); border: 1px solid var(--card-border);
  color: var(--light); border-radius: 8px;
  font-size: 0.85rem; font-family: 'Inter', sans-serif;
  outline: none;
}

.name-input:focus { border-color: var(--primary); }

.submit-btn {
  padding: 0.5rem 1rem;
  background: var(--primary); border: none;
  color: white; border-radius: 8px;
  font-weight: 700; font-size: 0.8rem;
  cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}

.submit-btn:hover { background: #e55a28; }

.leaderboard-list { flex: 1; overflow-y: auto; }

.lb-entry {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
}

.lb-rank {
  font-family: 'Bangers', cursive;
  font-size: 1rem; color: var(--accent);
  min-width: 28px; text-align: center;
}

.lb-rank.gold { color: var(--gold); font-size: 1.2rem; }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }

.lb-name { flex: 1; color: var(--light); font-weight: 600; }
.lb-score { color: #888; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; }
.lb-prestige { color: var(--purple); font-size: 0.7rem; margin-left: 0.3rem; }

.leaderboard-loading { color: #555; text-align: center; padding: 2rem; font-size: 0.85rem; }

.refresh-btn {
  width: 100%; padding: 0.5rem;
  background: var(--card); border: 1px solid var(--card-border);
  color: #888; border-radius: 8px;
  font-size: 0.8rem; cursor: pointer;
  margin-top: 0.5rem; transition: all 0.15s;
}

.refresh-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; backdrop-filter: blur(5px);
}

.modal {
  background: var(--dark);
  border: 2px solid var(--primary);
  border-radius: 20px;
  padding: 2rem;
  max-width: 450px; width: 90%;
  text-align: center;
}

.modal h2 {
  font-family: 'Bangers', cursive;
  font-size: 1.8rem; color: var(--accent);
  margin-bottom: 1rem;
}

.modal p { color: #ccc; margin-bottom: 0.5rem; font-size: 0.9rem; }
.modal strong { color: var(--purple); font-family: 'Bangers', cursive; font-size: 1.5rem; }

.modal-details {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px; padding: 1rem;
  margin: 1rem 0;
}

.modal-reset { color: var(--red) !important; }
.modal-keep { color: var(--green) !important; }
.modal-bonus { color: var(--gold) !important; }

.modal-buttons {
  display: flex; gap: 0.8rem;
  justify-content: center; margin-top: 1.5rem;
}

.modal-btn {
  padding: 0.7rem 2rem;
  border: none; border-radius: 10px;
  font-weight: 700; font-size: 1rem;
  cursor: pointer; transition: all 0.15s;
}

.modal-btn.confirm {
  background: var(--primary); color: white;
}

.modal-btn.confirm:hover { background: #e55a28; transform: scale(1.03); }

.modal-btn.cancel {
  background: var(--card); color: #888;
  border: 1px solid var(--card-border);
}

.modal-btn.cancel:hover { border-color: #888; color: var(--light); }

.import-textarea {
  width: 100%; height: 100px;
  background: var(--card); border: 1px solid var(--card-border);
  color: var(--light); border-radius: 10px;
  padding: 0.8rem; font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem; resize: vertical;
  margin: 0.5rem 0; outline: none;
}

.import-textarea:focus { border-color: var(--primary); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--dark);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.7rem 1.3rem;
  border-radius: 10px;
  font-size: 0.85rem; font-weight: 700;
  z-index: 1000; opacity: 0;
  transition: all 0.3s;
  pointer-events: none; white-space: nowrap;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== MOBILE NAV ===== */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(15, 15, 26, 0.98);
  border-top: 1px solid var(--card-border);
  z-index: 100; padding: 0.4rem; gap: 0.2rem;
  backdrop-filter: blur(10px);
}

.mobile-nav-btn {
  flex: 1; padding: 0.6rem;
  background: none; border: 1px solid transparent;
  color: #888; font-size: 1.2rem;
  border-radius: 8px; cursor: pointer; transition: all 0.2s;
}

.mobile-nav-btn.active {
  color: var(--primary);
  background: rgba(255, 107, 53, 0.1);
  border-color: var(--card-border);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .game-container { grid-template-columns: 1fr; }

  .shop-panel, .stats-panel {
    display: none; position: fixed;
    top: 48px; bottom: 50px;
    width: 100%; z-index: 50;
    max-height: none;
  }

  .shop-panel { left: 0; }
  .stats-panel { right: 0; }

  .shop-panel.mobile-visible,
  .stats-panel.mobile-visible { display: flex; }

  .clicker-area.mobile-hidden { display: none; }

  .mobile-nav { display: flex; }
  .clicker-area { padding-bottom: 60px; }

  .big-clicker, .click-ring { width: 180px; height: 180px; }
}

@media (max-width: 480px) {
  .big-clicker, .click-ring { width: 160px; height: 160px; }
  .counter-value { font-size: 2rem; }
  .top-center { gap: 0.4rem; }
  .prestige-badge, .souls-display { font-size: 0.75rem; padding: 2px 6px; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 107, 53, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 107, 53, 0.4); }

/* ===== ANIMATIONS ===== */
@keyframes particleFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}
