:root {
  --primary-color: #ff9a9e;
  --bg-color: #fecfef;
  --panel-bg: #ffffff;
  --text-color: #555;
  --bar-bg: #eee;
  --bar-fill: #a18cd1;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #fad0c4;
  background-image: linear-gradient(0deg, #fad0c4 0%, #ffd1ff 100%);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#game-container {
  width: 90%;
  max-width: 400px;
  height: 650px;
  background-color: var(--panel-bg);
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  transition: opacity 0.3s;
}

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

.active {
  opacity: 1;
  pointer-events: all;
  z-index: 10;
}

/* Select Screen */
#select-screen h1 {
  color: var(--text-color);
  margin-bottom: 40px;
  font-size: 1.5rem;
}

.options {
  display: flex;
  gap: 20px;
}

.select-btn {
  background: #f0f0f0;
  border: 2px solid transparent;
  border-radius: 15px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.select-btn:hover {
  background: #e6e6fa;
  transform: translateY(-5px);
  border-color: var(--primary-color);
}

.select-btn .emoji {
  font-size: 3rem;
  margin-bottom: 10px;
}

/* Main Screen */
#main-screen {
  justify-content: space-between;
  padding: 20px;
  box-sizing: border-box;
  background-image: radial-gradient(#f3e7e9 10%, transparent 10%), radial-gradient(#f3e7e9 10%, transparent 10%);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
}

.header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  color: #777;
}

.scene {
  flex-grow: 1;
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pet-sprite {
  font-size: 5rem;
  transition: transform 0.3s, font-size 0.5s;
  cursor: pointer;
  user-select: none;
  position: relative;
  z-index: 2;
}

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

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

@keyframes sleep {
  0% { transform: scale(1) translateY(0); filter: brightness(1); }
  50% { transform: scale(0.95) translateY(5px); filter: brightness(0.9); }
  100% { transform: scale(1) translateY(0); filter: brightness(1); }
}

.anim-bounce { animation: bounce 0.6s ease infinite; }
.anim-shake { animation: shake 0.4s ease; }
.anim-sleep { animation: sleep 2s ease-in-out infinite; }

.feedback-text {
  position: absolute;
  top: 20%;
  font-weight: bold;
  font-size: 1.2rem;
  opacity: 0;
  transition: opacity 0.5s, top 0.5s;
  pointer-events: none;
  z-index: 5;
}

.feedback-show {
  opacity: 1;
  top: 10%;
}

#poop-container {
  position: absolute;
  bottom: 20px;
  width: 100%;
  height: 50px;
  pointer-events: none;
}

.poop {
  position: absolute;
  font-size: 1.5rem;
  bottom: 0;
  animation: fadeIn 0.5s;
}

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

/* Stats */
.stats-panel {
  width: 100%;
  background: rgba(255,255,255,0.8);
  padding: 15px;
  border-radius: 15px;
  margin-bottom: 15px;
  backdrop-filter: blur(5px);
}

.stat-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #555;
}

.stat-icon {
  width: 80px;
}

.progress-bar {
  flex-grow: 1;
  height: 10px;
  background: var(--bar-bg);
  border-radius: 5px;
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 100%;
  background: var(--bar-fill);
  transition: width 0.5s, background-color 0.5s;
}

/* Color coding bars */
.fill.high { background: #84fab0; }
.fill.medium { background: #fccb90; }
.fill.low { background: #ff9a9e; }

/* Controls */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.action-btn {
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  background: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.1s, background 0.1s;
  color: #444;
}

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

.action-btn:hover {
  background: #f8f8f8;
}

#btn-feed { border-bottom: 3px solid #ff9a9e; }
#btn-play { border-bottom: 3px solid #a18cd1; }
#btn-sleep { border-bottom: 3px solid #84fab0; }
#btn-clean { border-bottom: 3px solid #fccb90; }

/* Modal */
.modal-content {
  text-align: center;
  padding: 30px;
}

.large-emoji {
  font-size: 5rem;
  margin: 20px 0;
}

#btn-restart {
  padding: 10px 25px;
  font-size: 1.1rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  margin-top: 20px;
}
