/* ========================================================
   TAMAGOTCHI — style.css
   Dark mode, pixel-art vibes, mobile-first
   ======================================================== */

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:          #0d0d1a;
  --bg2:         #13132b;
  --bg3:         #1a1a38;
  --card:        #1e1e42;
  --border:      #2e2e60;
  --accent:      #7c5cfc;
  --accent2:     #fc5cf0;
  --accent3:     #5cfcb8;
  --accent4:     #fccd5c;
  --text:        #e8e8ff;
  --text-dim:    #8888bb;
  --danger:      #fc5c5c;
  --success:     #5cfc7c;
  --bar-hunger:  #fc9a5c;
  --bar-thirst:  #5cb8fc;
  --bar-energy:  #fccd5c;
  --bar-hygiene: #a8fc5c;
  --bar-happy:   #fc5cf0;
  --bar-health:  #fc5c5c;
  --bar-bladder: #5ce8fc;
  --bar-bowel:   #c88844;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --font:        'Segoe UI', 'Arial', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

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

/* ══════════════════════════════════════════
   SCREEN: WELCOME
══════════════════════════════════════════ */
#screen-welcome {
  width: 100%;
  max-width: 480px;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.welcome-title {
  text-align: center;
  margin-top: 16px;
}

.welcome-title h1 {
  font-size: 2.4rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-transform: uppercase;
  filter: drop-shadow(0 0 12px var(--accent));
}

.welcome-title p {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* Step indicators */
.step-indicator {
  display: flex;
  gap: 8px;
  align-items: center;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.step-dot.active {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.step-dot.done {
  background: var(--accent3);
}

/* Animal picker grid */
.animal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
}

.animal-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  user-select: none;
}

.animal-card:hover {
  border-color: var(--accent);
  background: var(--bg3);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(124,92,252,0.3);
}

.animal-card.selected {
  border-color: var(--accent2);
  background: var(--bg3);
  box-shadow: 0 0 16px rgba(252,92,240,0.4);
}

.animal-card .emoji {
  font-size: 2rem;
  display: block;
  line-height: 1;
}

.animal-card .label {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: capitalize;
}

/* Name input step */
.name-step {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.selected-preview {
  font-size: 4rem;
  filter: drop-shadow(0 0 16px rgba(124,92,252,0.6));
  animation: float 2s ease-in-out infinite;
}

.name-step h2 {
  font-size: 1.2rem;
  color: var(--text-dim);
  text-align: center;
}

.name-step h2 span {
  color: var(--accent3);
  font-weight: 700;
}

.personality-blurb {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
  width: 100%;
}

input[type="text"] {
  width: 100%;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.1rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font);
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,92,252,0.2);
}

input[type="text"]::placeholder {
  color: var(--text-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 16px rgba(124,92,252,0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(124,92,252,0.6);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg3);
  border: 2px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #ff8844);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, var(--accent3), #44fc88);
  color: #0d0d1a;
}

.btn-wide {
  width: 100%;
}

/* ══════════════════════════════════════════
   SCREEN: GAME
══════════════════════════════════════════ */
#screen-game {
  width: 100%;
  max-width: 480px;
  padding: 8px 12px 100px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Header bar */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
}

.pet-name-age {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.pet-name-age span {
  color: var(--accent3);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mood-badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: capitalize;
}

.mood-badge.happy    { border-color: var(--bar-happy);   color: var(--bar-happy); }
.mood-badge.sleeping { border-color: var(--bar-energy);  color: var(--bar-energy); }
.mood-badge.sick     { border-color: var(--danger);      color: var(--danger); }
.mood-badge.dirty    { border-color: var(--bar-bowel);   color: var(--bar-bowel); }
.mood-badge.hungry   { border-color: var(--bar-hunger);  color: var(--bar-hunger); }
.mood-badge.tired    { border-color: var(--text-dim);    color: var(--text-dim); }
.mood-badge.bored    { border-color: var(--accent);      color: var(--accent); }
.mood-badge.dead     { border-color: var(--danger);      color: var(--danger); }

/* Pet display */
.pet-display-area {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  min-height: 200px;
}

.pet-bg-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,92,252,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.pet-emoji-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
}

#pet-emoji {
  font-size: 5rem;
  display: block;
  line-height: 1;
  cursor: default;
  user-select: none;
  position: relative;
  z-index: 2;
}

/* Mood overlays */
.mood-overlay {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 1.5rem;
  line-height: 1;
  z-index: 3;
  pointer-events: none;
}

.flies-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
}

.fly {
  position: absolute;
  font-size: 1rem;
  animation: fly-around 3s linear infinite;
}

.fly:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s; }
.fly:nth-child(2) { top: 30%; left: 70%; animation-delay: -1s; }
.fly:nth-child(3) { top: 60%; left: 40%; animation-delay: -2s; }

.sick-tint {
  position: absolute;
  inset: 0;
  background: rgba(0, 200, 0, 0.08);
  border-radius: var(--radius);
  pointer-events: none;
}

/* Floor area */
.floor-area {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.floor-item {
  font-size: 1.3rem;
  cursor: default;
  user-select: none;
  animation: floor-appear 0.3s ease;
}

/* ── Pet Animations ── */

/* happy / default */
.pet-anim-happy #pet-emoji {
  animation: float 2.2s ease-in-out infinite;
}

/* sleeping */
.pet-anim-sleeping #pet-emoji {
  animation: breathe 3s ease-in-out infinite;
}

/* tired */
.pet-anim-tired #pet-emoji {
  animation: sag 2s ease-in-out infinite;
}

/* bored */
.pet-anim-bored #pet-emoji {
  animation: sway 3s ease-in-out infinite;
}

/* dirty */
.pet-anim-dirty #pet-emoji {
  animation: sway 2s ease-in-out infinite;
}

/* sick */
.pet-anim-sick #pet-emoji {
  animation: wobble 1.2s ease-in-out infinite;
}

/* dead */
.pet-anim-dead #pet-emoji {
  animation: none;
  filter: grayscale(1) brightness(0.6);
}

/* hungry */
.pet-anim-hungry #pet-emoji {
  animation: shake-hunger 1s ease-in-out infinite;
}

/* Flip animation for Dolphin */
.flip-anim {
  animation: flip-spin 0.8s ease-in-out !important;
}

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

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(0.95); opacity: 0.85; }
}

@keyframes sag {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50%       { transform: rotate(-4deg) translateY(4px); }
}

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

@keyframes wobble {
  0%, 100% { transform: rotate(-4deg) translateX(-2px); filter: hue-rotate(0deg) saturate(1.5); }
  25%       { transform: rotate(4deg)  translateX(2px);  filter: hue-rotate(60deg) saturate(2); }
  50%       { transform: rotate(-3deg) translateX(-1px); filter: hue-rotate(120deg) saturate(2); }
  75%       { transform: rotate(3deg)  translateX(1px);  filter: hue-rotate(60deg) saturate(1.5); }
}

@keyframes shake-hunger {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-4px); }
  40%       { transform: translateX(4px); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(3px); }
}

@keyframes fly-around {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(20px, -15px) rotate(90deg); }
  50%  { transform: translate(-10px, -25px) rotate(180deg); }
  75%  { transform: translate(-20px, -10px) rotate(270deg); }
  100% { transform: translate(0, 0) rotate(360deg); }
}

@keyframes floor-appear {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

@keyframes flip-spin {
  0%   { transform: rotateY(0deg) translateY(0); }
  25%  { transform: rotateY(90deg) translateY(-20px); }
  50%  { transform: rotateY(180deg) translateY(-30px); }
  75%  { transform: rotateY(270deg) translateY(-20px); }
  100% { transform: rotateY(360deg) translateY(0); }
}

@keyframes poop-float {
  0%   { transform: translateY(0) scale(1); opacity: 0.8; }
  50%  { transform: translateY(-20px) scale(1.1); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 0.8; }
}

/* ── Stat Bars ── */
.stats-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.stat-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.stat-label .stat-icon {
  font-size: 0.85rem;
}

.stat-label .stat-val {
  font-weight: 700;
  color: var(--text);
  font-size: 0.8rem;
}

.stat-bar-track {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 2px;
}

.stat-bar-fill.hunger  { background: linear-gradient(90deg, var(--bar-hunger), #ffcc88); }
.stat-bar-fill.thirst  { background: linear-gradient(90deg, var(--bar-thirst), #88ddff); }
.stat-bar-fill.energy  { background: linear-gradient(90deg, var(--bar-energy), #ffee88); }
.stat-bar-fill.hygiene { background: linear-gradient(90deg, var(--bar-hygiene), #ccff88); }
.stat-bar-fill.happy   { background: linear-gradient(90deg, var(--bar-happy), #ff88ff); }
.stat-bar-fill.health  { background: linear-gradient(90deg, var(--bar-health), #ff8888); }
.stat-bar-fill.bladder { background: linear-gradient(90deg, var(--bar-bladder), #88ffff); }
.stat-bar-fill.bowel   { background: linear-gradient(90deg, var(--bar-bowel), #ddaa66); }

/* Low-stat pulse warning */
.stat-bar-fill.low {
  animation: bar-pulse 1s ease-in-out infinite;
}

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

/* ── Quick Action Buttons ── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.action-btn {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.5rem;
  padding: 10px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.15s;
  font-family: var(--font);
  user-select: none;
}

.action-btn span.label {
  font-size: 0.6rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.action-btn:hover {
  border-color: var(--accent);
  background: var(--bg3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124,92,252,0.3);
}

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

.action-btn.active-sleep {
  border-color: var(--bar-energy);
  background: rgba(252,205,92,0.1);
  box-shadow: 0 0 10px rgba(252,205,92,0.3);
}

/* ── Menu Panel ── */
.menu-toggle-btn {
  width: 100%;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-family: var(--font);
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  user-select: none;
}

.menu-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.menu-toggle-btn.open {
  border-color: var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.menu-panel {
  background: var(--card);
  border: 2px solid var(--accent);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 12px;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.menu-panel.open {
  display: grid;
}

.menu-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.3rem;
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
  font-family: var(--font);
  user-select: none;
}

.menu-btn span.label {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.menu-btn:hover {
  border-color: var(--accent2);
  background: var(--bg2);
  transform: translateY(-1px);
}

.menu-btn:active {
  transform: scale(0.93);
}

.menu-btn.special {
  border-color: var(--accent4);
  background: rgba(252,205,92,0.07);
}

.menu-btn.special:hover {
  border-color: var(--accent4);
  box-shadow: 0 0 10px rgba(252,205,92,0.3);
}

/* ── Toast Notification ── */
#toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
  width: min(420px, 90vw);
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toast-in 0.3s ease, toast-out 0.4s ease 2.6s forwards;
  text-align: center;
  border-left: 3px solid var(--accent);
  pointer-events: auto;
}

.toast.success { border-left-color: var(--accent3); }
.toast.warning { border-left-color: var(--accent4); }
.toast.danger  { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--bar-thirst); }

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

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

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text);
}

/* Health modal stats */
.health-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.health-stat-row:last-child {
  border-bottom: none;
}

.health-stat-name {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.health-stat-val {
  font-weight: 700;
  font-size: 1rem;
}

.health-stat-bar {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 10px;
}

.health-stat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.mood-display {
  text-align: center;
  padding: 12px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.mood-emoji {
  font-size: 2rem;
}

.mood-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: capitalize;
}

/* ── Talk bubble ── */
.talk-bubble {
  background: var(--bg3);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  font-size: 1rem;
  line-height: 1.6;
  text-align: center;
  margin-top: 8px;
}

.talk-bubble::before {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--accent);
}

/* ── Offline recap ── */
.offline-recap {
  background: var(--bg3);
  border: 1px solid var(--accent4);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 8px;
}

.offline-recap strong {
  color: var(--accent4);
}

/* ══════════════════════════════════════════
   SCREEN: DEATH
══════════════════════════════════════════ */
#screen-death {
  width: 100%;
  max-width: 480px;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.death-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--danger);
  filter: drop-shadow(0 0 10px var(--danger));
  text-shadow: 0 0 20px rgba(252,92,92,0.5);
}

.ghost-wrap {
  position: relative;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dead-pet {
  font-size: 4.5rem;
  filter: grayscale(1) brightness(0.5);
}

.ghost {
  font-size: 2.5rem;
  position: absolute;
  top: 0;
  animation: ghost-rise 3s ease-in-out infinite;
}

@keyframes ghost-rise {
  0%   { transform: translateY(40px); opacity: 0; }
  30%  { opacity: 1; }
  70%  { opacity: 0.8; }
  100% { transform: translateY(-30px); opacity: 0; }
}

.funeral-flies {
  font-size: 1.2rem;
  position: absolute;
  animation: fly-around 2.5s linear infinite;
}

.funeral-flies:nth-child(2) { animation-delay: -0.8s; left: 30%; }
.funeral-flies:nth-child(3) { animation-delay: -1.6s; left: 60%; }

.epitaph {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  width: 100%;
}

.epitaph h2 {
  font-size: 1.1rem;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 8px;
}

.epitaph .pet-name-epitaph {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.epitaph .dates {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 6px 0;
}

.epitaph .age-lived {
  font-size: 0.95rem;
  color: var(--accent3);
  margin-bottom: 10px;
}

.epitaph .death-reason {
  font-size: 0.9rem;
  color: var(--danger);
  font-style: italic;
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 380px) {
  .animal-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .animal-card .emoji { font-size: 1.6rem; }
  .animal-card .label { font-size: 0.55rem; }
  #pet-emoji { font-size: 4rem; }
  .quick-actions { gap: 4px; }
  .action-btn { font-size: 1.3rem; padding: 8px 2px; }
  .stats-panel { gap: 6px 8px; }
}

@media (min-width: 440px) {
  .animal-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ── Utility ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ── Sleeping ZZZ overlay ── */
.zzz {
  position: absolute;
  top: 0;
  right: -8px;
  font-size: 1rem;
  animation: zzz-float 2s ease-in-out infinite;
  pointer-events: none;
}

.zzz:nth-child(2) { font-size: 0.75rem; top: 12px; right: 10px; animation-delay: -0.7s; }
.zzz:nth-child(3) { font-size: 0.6rem;  top: 22px; right: 20px; animation-delay: -1.4s; }

@keyframes zzz-float {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 0.8; }
  100% { transform: translateY(-20px) translateX(8px); opacity: 0; }
}

/* ── Poop float animation (dirty mode) ── */
.dirty-poop-float {
  position: absolute;
  font-size: 1.2rem;
  animation: poop-float 2.5s ease-in-out infinite;
  pointer-events: none;
}

.dirty-poop-float:nth-child(1) { bottom: 100%; left: 10%; animation-delay: 0s; }
.dirty-poop-float:nth-child(2) { bottom: 100%; left: 80%; animation-delay: -1.2s; }

/* ── Hunger hearts ── */
.hunger-heart {
  position: absolute;
  font-size: 1rem;
  animation: hunger-float 1.5s ease-in-out infinite;
  pointer-events: none;
  top: -10px;
}

.hunger-heart:nth-child(1) { left: 10%; animation-delay: 0s; }
.hunger-heart:nth-child(2) { left: 75%; animation-delay: -0.75s; }

@keyframes hunger-float {
  0%   { transform: translateY(0); opacity: 0.8; }
  50%  { transform: translateY(-12px); opacity: 1; }
  100% { transform: translateY(0); opacity: 0.8; }
}
