:root {
  --bg-start: #e8d5f5;
  --bg-end: #c8f0e0;
  --card-bg: rgba(255, 255, 255, 0.85);
  --text-primary: #2d2040;
  --text-secondary: #6b5e7b;
  --accent-pink: #ff7eb3;
  --accent-mint: #7ee8c8;
  --accent-blue: #7ec8ff;
  --accent-lavender: #b89eff;
  --accent-yellow: #ffe47e;
  --pixel-border: #4a3660;
  --bar-red: #ff6b6b;
  --bar-yellow: #ffd93d;
  --bar-green: #6bcb77;
}

[data-theme="dark"] {
  --bg-start: #1a1028;
  --bg-end: #0d2a20;
  --card-bg: rgba(40, 30, 55, 0.9);
  --text-primary: #e8d5f5;
  --text-secondary: #a090b5;
  --pixel-border: #9070c0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
}

.font-pixel {
  font-family: 'Press Start 2P', cursive;
}

.pixel-border {
  border: 3px solid var(--pixel-border);
  box-shadow:
    3px 3px 0 var(--pixel-border),
    inset 0 0 0 1px rgba(255,255,255,0.1);
}

.pixel-border-sm {
  border: 2px solid var(--pixel-border);
  box-shadow: 2px 2px 0 var(--pixel-border);
}

/* Floating particles */
@keyframes float-up {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.7; }
  100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

.particle {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  animation: float-up linear infinite;
}

/* Pet animations */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255, 126, 179, 0.4)); }
  50% { filter: drop-shadow(0 0 20px rgba(255, 126, 179, 0.8)); }
}

@keyframes sway {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-5px) rotate(-2deg); }
  75% { transform: translateX(5px) rotate(2deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-3px); }
  20% { transform: translateX(3px); }
  30% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  50% { transform: translateX(0); }
}

@keyframes zzz {
  0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
  50% { opacity: 1; transform: translateY(-20px) scale(1); }
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

@keyframes rain {
  0% { transform: translateY(-10px); opacity: 1; }
  100% { transform: translateY(20px); opacity: 0; }
}

@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100px) rotate(720deg); opacity: 0; }
}

.pet-thriving { animation: bounce 1s ease-in-out infinite; }
.pet-content { animation: sway 3s ease-in-out infinite; }
.pet-meh { animation: wobble 4s ease-in-out infinite; }
.pet-struggling { animation: shake 2s ease-in-out infinite; }
.pet-sos { animation: none; }
.pet-glow { animation: pulse-glow 2s ease-in-out infinite; }

/* Progress bar animation */
@keyframes bar-fill {
  from { width: 0%; }
}

.stat-bar-fill {
  animation: bar-fill 0.6s ease-out;
  transition: width 0.5s ease-out, background-color 0.3s;
}

/* Modal slide up */
@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay {
  animation: fade-in 0.2s ease-out;
}

.modal-content {
  animation: slide-up 0.3s ease-out;
}

/* Button press effect */
.btn-press {
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-press:active {
  transform: scale(0.95) translateY(2px);
  box-shadow: 0 1px 0 var(--pixel-border) !important;
}

/* Speech bubble */
@keyframes bubble-in {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.speech-bubble {
  animation: bubble-in 0.4s ease-out;
  position: relative;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 12px solid var(--card-bg);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent-lavender); border-radius: 3px; }

/* Tab underline */
.tab-active {
  border-bottom: 3px solid var(--accent-pink);
}