:root {
  --primary-color: #ffd1dc; /* Pastel Pink */
  --secondary-color: #c1e1c1; /* Pastel Green */
  --accent-color: #aec6cf; /* Pastel Blue */
  --text-color: #555;
  --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
  --card-bg: rgba(255, 255, 255, 0.8);
  --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  --font-main: "Outfit", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none; /* Prevent selection highlighting */
  -webkit-user-select: none;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  height: 100vh;
  display: flex;
  justify-content: center;
  color: var(--text-color);
  overflow: hidden;
}

#app {
  width: 100%;
  max-width: 480px; /* Mobile max width */
  height: 100%;
  position: relative;
  background: white;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  display: flex;
  flex-direction: column;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  z-index: 0;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
  z-index: 10;
}

/* Selection Screen */
#selection-screen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
}

#selection-screen h1 {
  font-size: 2rem;
  color: white;
  margin-bottom: 2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pet-options {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pet-card {
  background: var(--card-bg);
  backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 1rem;
  width: 120px;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid white;
}

.pet-card:hover {
  transform: translateY(-5px) scale(1.05);
}

.pet-card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.pet-card p {
  font-weight: 700;
  color: var(--text-color);
}

/* Game Screen */
#game-screen {
  background: #e0f7fa; /* Light pastel blue bg */
  justify-content: space-between;
}

header {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  border-radius: 0 0 30px 30px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.stats-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat .icon {
  font-size: 1.2rem;
  width: 25px;
  text-align: center;
}

.progress-bar {
  flex-grow: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease-out;
}

#hunger-bar {
  background: #ffb7b2;
} /* Pastel Red */
#happiness-bar {
  background: #ffdac1;
} /* Pastel Orange/Pink */
#energy-bar {
  background: #e2f0cb;
} /* Pastel Green */

.pet-container {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.pet {
  width: 250px;
  height: 250px;
  position: relative;
}

.pet img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
  /* Fix: Prevent browser from selecting/dragging image */
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

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

@keyframes sleep {
  0% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.05, 0.95) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes eat {
  0% { transform: scale(1); }
  20% { transform: scale(1.1, 0.8) translateY(5px); }
  40% { transform: scale(0.9, 1.1) translateY(-5px); }
  60% { transform: scale(1.1, 0.8) translateY(5px); }
  80% { transform: scale(0.9, 1.1) translateY(-5px); }
  100% { transform: scale(1); }
}

@keyframes jump {
  0% { transform: translateY(0) scale(1); }
  25% { transform: translateY(10px) scale(1.1, 0.9); } /* Squash */
  50% { transform: translateY(-50px) scale(0.9, 1.1) rotate(5deg); } /* Stretch & Jump */
  75% { transform: translateY(5px) scale(1.05, 0.95); } /* Land */
  100% { transform: translateY(0) scale(1); } /* Recover */
}

@keyframes wobble {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-10px) rotate(-5deg); }
  30% { transform: translateX(10px) rotate(5deg); }
  45% { transform: translateX(-10px) rotate(-5deg); }
  60% { transform: translateX(10px) rotate(5deg); }
  75% { transform: translateX(0); }
}

@keyframes doze {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(10px) scale(0.98); }
}

.pet.bounce {
  animation: bounce 2s infinite ease-in-out;
}

.pet.eating {
  animation: eat 0.5s ease-in-out;
}
.pet.playing {
  animation: jump 0.8s ease-in-out;
}

.pet.sad {
  animation: wobble 2s infinite ease-in-out;
  /* Removed filter: sepia/grayscale as per user request */
  transform: scale(0.95);
}

.pet.tired {
  animation: doze 4s infinite ease-in-out;
  /* Removed opacity/brightness filter as per user request */
}

#status-effects {
  position: absolute;
  top: 20%;
  right: 20%;
  font-size: 2rem;
  animation: floatUp 1.5s ease-out forwards;
  pointer-events: none;
}

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

/* Action Menu */
.actions-menu {
    position: relative;
    padding-right: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 30px 30px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.action-btn {
  border: none;
  background: #f8f9fa;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  flex: 1;
  color: var(--text-color);
  font-family: var(--font-main);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn span {
  font-weight: 600;
  font-size: 0.9rem;
}

.action-btn .icon {
  font-size: 1.5rem;
}

.action-btn.secondary {
  flex: 0 0 auto;
  background: transparent;
  box-shadow: none;
}

/* Night Mode Theme */
body.night-mode {
  --bg-gradient: linear-gradient(to bottom, #0f2027, #203a43, #2c5364); /* Deep Space Blue */
  --text-color: #eee;
  --card-bg: rgba(0, 0, 0, 0.6);
  transition: all 1s ease;
}

body.night-mode header {
    background: rgba(0, 0, 0, 0.2);
    color: #eee;
}

body.night-mode #btn-restart {
    background: rgba(255, 255, 255, 0.1);
    color: #ffb7b2;
    border-color: #ffb7b2;
}

body.night-mode #game-screen {
    background: transparent;
}

body.night-mode #app {
    background: transparent;
    box-shadow: none;
}

body.night-mode .action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    box-shadow: none;
}

body.night-mode .action-btn.active {
    background: #e2f0ca; /* Keep wake up button bright */
    color: #333;
    opacity: 1 !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Disabled Button state */
.action-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
}


.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.speech-bubble {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    width: 80%;
    max-width: 300px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
    border: 3px solid var(--accent-color);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 20px 20px 0;
    border-style: solid;
    border-color: var(--accent-color) transparent;
    display: block;
    width: 0;
}
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 18px 18px 0;
    border-style: solid;
    border-color: white transparent;
    display: block;
    width: 0;
}


.speech-bubble p {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.survey-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.survey-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-main);
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#survey-yes {
    background: var(--secondary-color);
    color: #4a6fa5;
}

#survey-no {
    background: #FFD1DC;
    color: #a05050;
}

.survey-btn:hover {
    transform: scale(1.05);
    filter: brightness(0.95);
}

.zzz-particle {
  position: absolute;
  font-weight: bold;
  color: var(--accent-color);
  pointer-events: none;
  font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
  z-index: 5;
}

/* Reset Modal & Button Styles */
.warning-bubble {
    border-color: #ff9999;
    color: #a05050;
}

.warning-bubble .sub-text {
    font-size: 0.9rem;
    color: #999;
    font-weight: normal;
    margin-top: -10px;
}

.danger-btn {
    background: #ffb7b2;
    color: white;
}

.cancel-btn {
    background: #e0e0e0;
    color: #555;
}

/* Restyled Reset Button */
#btn-restart {
    background: #fff0f0; /* Very light red */
    color: #d32f2f;
    border: 2px solid #ffcdd2;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    position: absolute;
    top: -80px;
    right: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

#btn-restart .icon {
    font-size: 1.5rem;
}

#btn-restart:hover {
    transform: rotate(180deg);
    background: #ffebee;
}

/* Phase 4: UX Refinements */

/* Sleep Button Active State */
.action-btn.active {
    background: #e2f0cb; /* Pastel Green highlight */
    color: #558b2f;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Critical Stat Bars */
.progress-bar.critical .fill {
    animation: blink 1s infinite;
}

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

/* Refuse Animation (Head Shake) */
@keyframes refuse {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-10px) rotate(-5deg); }
    30% { transform: translateX(10px) rotate(5deg); }
    45% { transform: translateX(-10px) rotate(-5deg); }
    60% { transform: translateX(10px) rotate(5deg); }
    75% { transform: translateX(0); }
}

.pet.refuse {
    animation: refuse 0.5s ease-in-out;
}

/* Phase 5: Critical State Icons */
.status-icon {
    position: absolute;
    top: -20px;
    font-size: 2rem;
    animation: floatIcon 2s infinite ease-in-out;
    background: white;
    border-radius: 50%;
    padding: 5px;
    border: 2px solid var(--text-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 15;
}

.status-icon.left {
    left: -10px;
    animation-delay: 0s;
}

.status-icon.right {
    right: -10px;
    animation-delay: 1s;
}

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

/* All CSS updated with Jump animation */
