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

:root {
  --cream: #FFF8F0;
  --orange: #E85A2C;
  --orange-hover: #D14A1C;
  --dark: #2D2A26;
  --gray: #8B8680;
  --light-gray: #E8E4DE;
}

body {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, #FFF8F0 0%, #FFE8D8 100%);
  min-height: 100vh;
  color: var(--dark);
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  animation: fadeIn 0.4s ease;
}

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

/* Welcome Screen */
.welcome-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.app-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
}

.welcome-creature {
  position: relative;
}

.welcome-egg {
  width: 120px;
  height: 120px;
  animation: float 3s ease-in-out infinite;
}

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

.welcome-text {
  font-size: 18px;
  color: var(--gray);
  max-width: 280px;
}

/* Back Button */
.back-button {
  align-self: flex-start;
  background: none;
  border: none;
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  color: var(--dark);
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 8px;
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--light-gray);
  border-radius: 3px;
  margin-bottom: 24px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Wizard */
.wizard-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.wizard-image {
  width: 100px;
  height: 180px;
  object-fit: contain;
  image-rendering: pixelated;
}

/* Speech Bubble */
.speech-bubble {
  background: white;
  border: 2px solid var(--dark);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  position: relative;
}

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

.speech-bubble p {
  font-size: 16px;
  text-align: center;
  font-style: italic;
}

/* Creature Grid */
.creature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.creature-card {
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.creature-card:hover {
  transform: scale(1.02);
}

.creature-card.selected {
  border-width: 3px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.creature-image-container {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creature-card-image {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.creature-card-image.loaded {
  opacity: 1;
}

.image-loader {
  font-size: 24px;
  animation: pulse 1s ease-in-out infinite;
}

.image-loader.large {
  font-size: 40px;
}

.image-loader.xlarge {
  font-size: 60px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.creature-name {
  font-size: 18px;
  font-weight: 600;
}

.creature-element {
  font-size: 14px;
  font-weight: 500;
}

/* CTA Button */
.cta-button {
  width: 100%;
  padding: 16px 24px;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: auto;
}

.cta-button:hover:not(.disabled):not(.completed) {
  background: var(--orange-hover);
  transform: translateY(-2px);
}

.cta-button.disabled {
  background: var(--light-gray);
  color: var(--gray);
  cursor: not-allowed;
}

.cta-button.completed {
  background: #4CAF50;
  cursor: default;
}

/* Habit Input Screen */
.chosen-creature-container {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.creature-glow {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chosen-creature-image {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chosen-creature-image.loaded {
  opacity: 1;
}

.chosen-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
}

.chosen-subtitle {
  font-size: 16px;
  color: var(--gray);
  text-align: center;
  margin-bottom: 32px;
}

.habit-input-container {
  margin-bottom: 24px;
}

.habit-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray);
  margin-bottom: 8px;
}

.habit-input {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--light-gray);
  border-radius: 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  transition: border-color 0.2s ease;
}

.habit-input:focus {
  outline: none;
  border-color: var(--orange);
}

/* Dashboard */
.dashboard-screen {
  gap: 20px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.habit-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
}

.streak-fire {
  font-size: 24px;
  animation: wiggle 0.5s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.creature-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.creature-stage-glow {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.dashboard-creature {
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dashboard-creature.loaded {
  opacity: 1;
}

.dashboard-creature.baby {
  width: 64px;
  height: 64px;
}

.dashboard-creature.teen {
  width: 96px;
  height: 96px;
}

.dashboard-creature.adult {
  width: 128px;
  height: 128px;
}

.creature-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.creature-display-name {
  font-size: 20px;
  font-weight: 600;
}

.stage-badge {
  background: var(--light-gray);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.stats-container {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.stat-box {
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--orange);
}

.stat-label {
  font-size: 12px;
  color: var(--gray);
  text-transform: uppercase;
}

.xp-container {
  background: white;
  border-radius: 12px;
  padding: 16px;
}

.xp-text {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}

.xp-bar {
  height: 12px;
  background: var(--light-gray);
  border-radius: 6px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #FF8C00);
  border-radius: 6px;
  transition: width 0.5s ease;
}

.evolution-preview {
  text-align: center;
  font-size: 14px;
  color: var(--gray);
  padding: 12px;
  background: rgba(232, 90, 44, 0.1);
  border-radius: 8px;
}

.complete-button {
  margin-top: 0;
}

.motivational-message {
  text-align: center;
  font-size: 16px;
  color: var(--gray);
  font-style: italic;
}

.reset-button {
  background: none;
  border: none;
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  color: var(--gray);
  cursor: pointer;
  text-decoration: underline;
  padding: 8px;
  margin: 0 auto;
}

/* Celebration */
.celebration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

.celebration-text {
  font-size: 48px;
  font-weight: 700;
  color: white;
  animation: bounce 0.5s ease;
}

.xp-gain {
  font-size: 32px;
  font-weight: 600;
  color: #FFD700;
  margin-top: 16px;
  animation: slideUp 0.5s ease 0.2s both;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

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

/* Footer */
.app-footer {
  text-align: center;
  padding: 24px;
  margin-top: auto;
}

.app-footer a {
  color: var(--gray);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.app-footer a:hover {
  color: var(--orange);
}

/* Responsive */
@media (min-width: 768px) {
  .app-container {
    padding: 0 24px;
  }
  
  .creature-grid {
    gap: 24px;
  }
  
  .stats-container {
    gap: 48px;
  }
}