/* ═══════════════════════════════════════════════════
   POCKET PALS — Main Stylesheet
   ═══════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg:        #FFF5E6;
  --bg2:       #FFECD2;
  --room-bg:   #FFE4B5;
  --card:      #FFFAF4;
  --primary:   #FF7043;
  --primary-d: #E64A19;
  --secondary: #7C4DFF;
  --accent:    #FFD54F;
  --success:   #66BB6A;
  --danger:    #EF5350;
  --warning:   #FFA726;
  --text:      #3E2723;
  --text-muted:#795548;
  --border:    rgba(0,0,0,0.08);
  --shadow:    0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.18);
  --radius:    16px;
  --radius-sm: 10px;
  --stat-hunger:     #FF6B6B;
  --stat-happiness:  #FFD93D;
  --stat-clean:      #6BCB77;
  --stat-energy:     #4D96FF;
  --stat-health:     #FF6BA3;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Dark mode */
.dark {
  --bg:    #1A1212;
  --bg2:   #251818;
  --room-bg: #2D1F10;
  --card:  #2A1A1A;
  --text:  #F5E6D8;
  --text-muted: #A08070;
  --border: rgba(255,255,255,0.08);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #FF8A65 0%, #FFB74D 50%, #FFD54F 100%);
  font-family: var(--font);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── App Container ── */
#app {
  position: fixed;
  inset: 0;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* ── Screens ── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
  z-index: 1;
}
.screen.slide-left { transform: translateX(-30px); }
.screen.slide-right { transform: translateX(30px); }

/* ── LOADING SCREEN ── */
#screen-loading {
  background: linear-gradient(160deg, #FF8A65 0%, #FFB74D 50%, #FFD54F 100%);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.loading-wrap { text-align: center; padding: 2rem; }
.loading-paw {
  font-size: 72px;
  animation: pawBounce 1.2s ease-in-out infinite;
  display: block; margin-bottom: 1rem;
}
.loading-title {
  font-size: 2.4rem; font-weight: 800; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  margin-bottom: 1.5rem;
}
.loading-bar-bg {
  width: 200px; height: 10px; background: rgba(255,255,255,0.35);
  border-radius: 10px; overflow: hidden; margin: 0 auto 1rem;
}
.loading-bar-fill {
  height: 100%; width: 0; background: #fff;
  border-radius: 10px;
  transition: width 0.15s ease;
}
.loading-sub { color: rgba(255,255,255,0.85); font-size: 0.9rem; }

/* ── NEW GAME SCREEN ── */
#screen-new-game {
  background: linear-gradient(160deg, #FFF5E6, #FFE4B5);
  justify-content: flex-start;
  padding: 1rem;
  overflow-y: auto;
}
.new-game-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding-bottom: 2rem; }
.ng-title { font-size: 2.2rem; font-weight: 800; color: var(--primary); margin-top: 1rem; }
.ng-sub { color: var(--text-muted); font-size: 1rem; }

.pet-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  max-width: 360px;
}
.pet-select-card {
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}
.pet-select-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.pet-select-card.selected { border-color: var(--primary); background: #FFF3EE; }
.pet-select-card canvas { width: 100%; max-width: 120px; height: 100px; }
.psc-name { font-weight: 700; font-size: 1.05rem; color: var(--text); margin-top: 0.5rem; }
.psc-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.psc-fav { font-size: 0.7rem; color: var(--primary); margin-top: 0.3rem; }

.name-section { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 0.75rem; align-items: center; }
.name-prompt { color: var(--text-muted); font-size: 0.95rem; }
.name-input {
  width: 100%; padding: 0.75rem 1rem;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1.1rem; font-family: var(--font);
  background: var(--card); color: var(--text);
  outline: none; text-align: center;
  transition: border-color 0.2s;
}
.name-input:focus { border-color: var(--primary); }

/* ── MAIN GAME SCREEN ── */
#screen-main {
  background: var(--bg);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto;
}

/* Top bar */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.75rem 0.4rem;
  background: var(--bg);
}
.coins-display {
  display: flex; align-items: center; gap: 0.3rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 0.3rem 0.75rem;
  font-weight: 700; font-size: 1rem; color: var(--text);
  box-shadow: var(--shadow);
}
.coin-icon { font-size: 1rem; }
.pet-title-area { display: flex; align-items: center; gap: 0.4rem; }
.pet-name-label { font-weight: 700; font-size: 1rem; color: var(--text); }
.badge {
  padding: 0.15rem 0.5rem; border-radius: 12px;
  font-size: 0.7rem; font-weight: 700;
}
.badge-level { background: var(--secondary); color: #fff; }
.badge-stage { background: var(--accent); color: var(--text); }
.top-actions { display: flex; gap: 0.3rem; }
.icon-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 50%; width: 36px; height: 36px;
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); transition: transform 0.1s;
}
.icon-btn:active { transform: scale(0.9); }

/* XP bar */
.xp-bar-wrap {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0 0.75rem 0.4rem;
}
.xp-bar-bg {
  flex: 1; height: 6px; background: var(--bg2);
  border-radius: 6px; overflow: hidden;
}
.xp-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--secondary), #AB47BC);
  border-radius: 6px;
  transition: width 0.5s ease;
}
.xp-label { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }

/* Pet Room */
.pet-room {
  position: relative;
  background: #FBF0D0;
  overflow: hidden;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0;
  border-top: 2px solid rgba(255,200,100,0.3);
  border-bottom: 2px solid rgba(200,150,50,0.3);
}
.room-decor {
  position: absolute; inset: 0; pointer-events: none;
}
#room-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}
.canvas-wrap {
  position: relative;
  z-index: 2;
  max-width: 100%;
  align-self: center;
}
#pet-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: crisp-edges;
}

/* Fainted banner */
#fainted-banner {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  background: rgba(30, 0, 0, 0.82);
  color: #fff;
  border-radius: 14px;
  padding: 0.55rem 1.2rem;
  text-align: center;
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 80, 80, 0.6);
  white-space: nowrap;
  animation: faintedPulse 1.6s ease-in-out infinite;
}
#fainted-banner .fb-icon { font-size: 1.4rem; margin-bottom: 0.1rem; }
#fainted-banner .fb-text { font-size: 0.85rem; font-weight: 700; color: #FFB3B3; }
#fainted-banner .fb-sub  { font-size: 0.7rem; color: rgba(255,255,255,0.65); margin-top: 0.1rem; }
@keyframes faintedPulse {
  0%, 100% { border-color: rgba(255, 80, 80, 0.5); }
  50%       { border-color: rgba(255, 80, 80, 1.0); }
}
.speech-bubble {
  position: absolute; top: 8px; left: 50%;
  transform: translateX(-50%);
  background: #fff; border-radius: 14px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow);
  z-index: 10; white-space: nowrap;
}
.speech-bubble::after {
  content: ''; position: absolute; bottom: -8px; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #fff;
}
#particle-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

/* Stats panel */
.stats-panel {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
}
.stat-row { display: flex; align-items: center; gap: 0.4rem; }
.si { font-size: 0.9rem; width: 20px; }
.sl { font-size: 0.7rem; color: var(--text-muted); width: 42px; flex-shrink: 0; }
.sb-bg { flex: 1; height: 8px; background: var(--bg2); border-radius: 8px; overflow: hidden; }
.sb-fill {
  height: 100%; border-radius: 8px;
  transition: width 0.4s ease, background-color 0.3s;
}
.sb-fill.hunger     { background: var(--stat-hunger); }
.sb-fill.happiness  { background: var(--stat-happiness); }
.sb-fill.cleanliness{ background: var(--stat-clean); }
.sb-fill.energy     { background: var(--stat-energy); }
.sb-fill.health     { background: var(--stat-health); }
.sv { font-size: 0.65rem; color: var(--text-muted); width: 24px; text-align: right; }

/* Pulse stat bars when low */
.sb-fill.critical {
  animation: pulseRed 1s ease-in-out infinite;
}

/* Action buttons */
.action-buttons {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 0.3rem; padding: 0.4rem 0.5rem;
  background: var(--bg);
}
.action-btn {
  display: flex; flex-direction: column; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.5rem 0.1rem;
  cursor: pointer; transition: all 0.15s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  position: relative; overflow: hidden;
}
.action-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.action-btn:active { transform: scale(0.93); }
.action-btn.cooldown { opacity: 0.5; pointer-events: none; }
.action-btn.revive-pulse {
  border-color: #FF5252;
  box-shadow: 0 0 0 3px rgba(255,82,82,0.35);
  animation: revivePulse 0.9s ease-in-out infinite;
}
@keyframes revivePulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,82,82,0.3); }
  50%       { box-shadow: 0 0 0 6px rgba(255,82,82,0.0); }
}
.ai { font-size: 1.3rem; }
.al { font-size: 0.6rem; color: var(--text-muted); margin-top: 0.15rem; font-weight: 600; }

/* Cooldown fill */
.action-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.07);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform 0s linear;
}
.action-btn.cooling::before { transform: scaleY(1); }

/* Bottom nav */
.bottom-nav {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 0.3rem 0 env(safe-area-inset-bottom, 0.3rem);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center;
  background: none; border: none; cursor: pointer;
  padding: 0.4rem 0; color: var(--text-muted);
  transition: color 0.2s, transform 0.15s;
}
.nav-btn.active { color: var(--primary); }
.nav-btn:active { transform: scale(0.9); }
.ni { font-size: 1.25rem; }
.nl { font-size: 0.6rem; font-weight: 600; margin-top: 0.1rem; }

/* ── SCREEN HEADER (shared) ── */
.screen-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 5;
}
.screen-header h2 { font-size: 1.1rem; font-weight: 700; }
.back-btn {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-size: 0.9rem; font-weight: 600;
  padding: 0.25rem 0;
}
.coins-display-sm {
  display: flex; gap: 0.25rem; align-items: center;
  font-weight: 700; font-size: 0.95rem; color: var(--text);
}

/* ── TAB BAR ── */
.tab-bar {
  display: flex; gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  overflow-x: auto; flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 20px; padding: 0.3rem 0.75rem;
  font-size: 0.75rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; color: var(--text-muted);
  transition: all 0.2s;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── SHOP ── */
.shop-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.6rem; padding: 0.75rem;
  overflow-y: auto; flex: 1;
}
.shop-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 0.6rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow);
  position: relative;
}
.shop-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.shop-item:active { transform: scale(0.97); }
.si-emoji-bg {
  width: 60px; height: 60px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); flex-shrink: 0;
}
.shop-item[data-category="food"] .si-emoji-bg      { background: #FFEDE8; }
.shop-item[data-category="treats"] .si-emoji-bg    { background: #FFE8F5; }
.shop-item[data-category="toys"] .si-emoji-bg      { background: #E8F0FF; }
.shop-item[data-category="accessories"] .si-emoji-bg { background: #EEE8FF; }
.shop-item[data-category="decor"] .si-emoji-bg     { background: #E8F5E8; }
.shop-item[data-category="themes"] .si-emoji-bg    { background: #FFF5E0; }
.si-emoji { font-size: 2rem; }
.si-name { font-size: 0.8rem; font-weight: 700; color: var(--text); text-align: center; }
.si-desc {
  font-size: 0.65rem; color: var(--text-muted); text-align: center; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.si-cost {
  background: var(--accent); border-radius: 12px;
  padding: 0.2rem 0.65rem; font-size: 0.75rem; font-weight: 700; color: var(--text);
}
.si-owned { position: absolute; top: 6px; right: 6px; font-size: 0.6rem; background: var(--success); color: #fff; border-radius: 8px; padding: 0.1rem 0.35rem; }
.shop-item.cant-afford { opacity: 0.5; }

/* ── INVENTORY ── */
.inv-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem; padding: 0.75rem;
  overflow-y: auto; flex: 1;
}
.inv-item {
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center;
  padding: 0.5rem 0.25rem; cursor: pointer;
  transition: all 0.15s; position: relative;
}
.inv-item:hover { border-color: var(--primary); transform: translateY(-2px); }
.inv-item.equipped { border-color: var(--success); background: #F1FFF3; }
.ii-emoji { font-size: 1.8rem; }
.ii-name { font-size: 0.6rem; color: var(--text-muted); text-align: center; margin-top: 0.2rem; }
.ii-qty { position: absolute; top: 3px; right: 3px; font-size: 0.6rem; font-weight: 700; background: var(--primary); color: #fff; border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; }
.inv-empty { grid-column: 1/-1; text-align: center; color: var(--text-muted); padding: 2rem; font-size: 0.9rem; }

.equipped-panel {
  border-top: 1px solid var(--border); padding: 0.75rem;
  flex-shrink: 0; background: var(--bg);
}
.equipped-title { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.equipped-slots { display: flex; gap: 0.5rem; justify-content: center; }
.eq-slot {
  background: var(--card); border: 2px dashed var(--border);
  border-radius: var(--radius-sm); padding: 0.5rem;
  width: 72px; text-align: center; cursor: pointer;
  transition: all 0.15s;
}
.eq-slot:hover { border-color: var(--primary); }
.eq-slot.has-item { border-color: var(--success); border-style: solid; }
.eq-icon { font-size: 1.6rem; }
.eq-label { font-size: 0.6rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── MINI-GAMES ── */
#games-lobby { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.75rem; overflow-y: auto; flex: 1; }
.game-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  box-shadow: var(--shadow); cursor: pointer;
  transition: all 0.2s;
}
.game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.gc-icon { font-size: 2.5rem; }
.gc-info { flex: 1; }
.gc-info h3 { font-size: 1rem; font-weight: 700; }
.gc-info p { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }
.gc-reward { font-size: 0.7rem; color: var(--success); font-weight: 600; margin-top: 0.25rem; }

#minigame-area { display: flex; flex-direction: column; align-items: center; padding: 0.5rem; flex: 1; }
.mg-header { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-bottom: 0.5rem; padding: 0 0.25rem; }
.mg-score { font-size: 1rem; font-weight: 700; }
.mg-timer { font-size: 1rem; font-weight: 700; color: var(--primary); }
#mg-canvas { border-radius: var(--radius); background: var(--room-bg); max-width: 100%; box-shadow: var(--shadow); }
.mg-instructions { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin-top: 0.5rem; }
.mg-tap { width: 180px; height: 180px; border-radius: 50% !important; font-size: 1.4rem !important; margin-top: 1rem; animation: tapPulse 0.6s ease-in-out infinite; }

/* ── ACHIEVEMENTS ── */
.ach-list { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.75rem; overflow-y: auto; flex: 1; }
.ach-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  display: flex; gap: 0.75rem; align-items: center;
  box-shadow: var(--shadow);
}
.ach-item.unlocked { border-color: var(--accent); background: #FFFEF0; }
.ach-emoji { font-size: 2rem; filter: grayscale(1); transition: filter 0.3s; }
.ach-item.unlocked .ach-emoji { filter: none; }
.ach-info { flex: 1; }
.ach-name { font-size: 0.9rem; font-weight: 700; }
.ach-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }
.ach-prog { margin-top: 0.4rem; }
.ach-prog-bar { height: 4px; background: var(--bg2); border-radius: 4px; overflow: hidden; margin-top: 0.2rem; }
.ach-prog-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
.ach-prog-text { font-size: 0.6rem; color: var(--text-muted); }
.ach-reward { font-size: 0.7rem; font-weight: 700; color: var(--success); }

/* ── SETTINGS ── */
.settings-body { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.75rem; overflow-y: auto; flex: 1; }
.setting-group-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding-top: 0.5rem; font-weight: 700; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 1rem;
  font-size: 0.9rem;
}
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.tog-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg2); border-radius: 24px;
  transition: background 0.2s;
}
.tog-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle input:checked + .tog-slider { background: var(--primary); }
.toggle input:checked + .tog-slider::before { transform: translateX(20px); }
.setting-info-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 1rem;
  font-size: 0.8rem; line-height: 1.7; color: var(--text-muted);
}
.setting-note { font-size: 0.7rem; color: var(--text-muted); padding: 0.25rem 0; }

/* ── BUTTONS ── */
.btn {
  border: none; border-radius: var(--radius-sm);
  padding: 0.6rem 1.2rem; font-size: 0.9rem;
  font-weight: 700; cursor: pointer; font-family: var(--font);
  transition: all 0.15s ease; display: inline-flex; align-items: center; justify-content: center;
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(255,112,67,0.4); }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: var(--bg2); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; width: 100%; }
.btn-large { width: 100%; padding: 0.85rem; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }

/* ── OVERLAYS ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
.ov-card {
  background: var(--card); border-radius: 24px;
  padding: 1.75rem 1.5rem; width: 88%; max-width: 340px;
  box-shadow: var(--shadow-lg); text-align: center;
  position: relative;
  animation: slideUp 0.25s ease;
}
.ov-close {
  position: absolute; top: 12px; right: 16px;
  font-size: 1.2rem; cursor: pointer; color: var(--text-muted);
}
.ov-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.ov-card h2 { font-size: 1.4rem; font-weight: 800; color: var(--text); margin-bottom: 0.5rem; }
.ov-card p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }

/* Daily reward */
.reward-big { font-size: 2rem; font-weight: 800; color: var(--primary); margin: 0.75rem 0; }
.streak-track { display: flex; justify-content: center; gap: 0.35rem; margin-bottom: 1rem; }
.streak-day { width: 36px; height: 36px; border-radius: 50%; background: var(--bg2); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; }
.streak-day.done { background: var(--accent); border-color: var(--warning); }
.streak-day.today { background: var(--primary); border-color: var(--primary-d); color: #fff; }

/* Level up */
.celebrate-card { background: linear-gradient(160deg, #FFF8E1, #FFF3CD); }
.celebrate-stars { font-size: 2rem; margin-bottom: 0.5rem; animation: starSpin 1s ease infinite alternate; }
.levelup-bonus { font-size: 0.85rem; color: var(--success); font-weight: 600; }

/* Evolution */
.evolve-card { background: linear-gradient(160deg, #F3E5F5, #E8EAF6); }
.evolve-level-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  padding: 0.3rem 1.2rem;
  border-radius: 20px;
  margin: 0.5rem 0 1rem;
}

/* Buy */
.buy-emoji { font-size: 3.5rem; margin-bottom: 0.5rem; }
.buy-cost { font-size: 1.3rem; font-weight: 700; color: var(--text); margin: 0.5rem 0; }
.buy-btns { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.buy-btns .btn { flex: 1; }

/* Game result */
.result-emoji { font-size: 3rem; margin-bottom: 0.5rem; }
.result-coins { font-size: 1.8rem; font-weight: 800; color: var(--success); margin: 0.5rem 0; }
.result-btns { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.result-btns .btn { flex: 1; }

/* Offline */
.offline-note { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* ── TOASTS ── */
.toast-achievement {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card); border: 1px solid var(--accent);
  border-radius: 16px; padding: 0.6rem 1rem;
  display: flex; align-items: center; gap: 0.6rem;
  box-shadow: var(--shadow-lg); z-index: 200;
  opacity: 0; transition: all 0.3s ease;
  white-space: nowrap;
}
.toast-achievement.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ta-icon { font-size: 1.5rem; }
.ta-top { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.ta-name { font-size: 0.85rem; font-weight: 700; color: var(--text); }

.toast-msg {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(0,0,0,0.75); color: #fff;
  border-radius: 20px; padding: 0.45rem 1.2rem;
  font-size: 0.85rem; font-weight: 600;
  z-index: 200; opacity: 0; transition: all 0.25s ease;
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── PARTICLES ── */
.particle {
  position: absolute; pointer-events: none;
  font-size: 1.2rem; z-index: 5;
  animation: particleFly 0.9s ease-out forwards;
}

/* ── UTILITY ── */
.hidden { display: none !important; }

/* ── ANIMATIONS ── */
@keyframes pawBounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes pulseRed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes starSpin {
  0% { transform: rotate(-5deg) scale(0.9); }
  100% { transform: rotate(5deg) scale(1.1); }
}
@keyframes tapPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,112,67,0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 16px rgba(255,112,67,0); }
}
@keyframes particleFly {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-80px) scale(0.4); opacity: 0; }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}
@keyframes coinPop {
  0% { transform: scale(0) translateY(0); opacity: 1; }
  70% { transform: scale(1.3) translateY(-30px); opacity: 1; }
  100% { transform: scale(1) translateY(-50px); opacity: 0; }
}

/* ── PETS OVERLAY ── */
.ov-pets-card {
  max-height: 88vh;
  overflow-y: auto;
  text-align: left;
  padding: 1.5rem 1.25rem 1.25rem;
  width: 92%;
  max-width: 360px;
}
.ov-pets-card h2 { text-align: center; margin-bottom: 0.25rem; }
.pets-section-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 700;
  margin: 0.9rem 0 0.5rem;
}
.pets-owned-list {
  display: flex; gap: 0.6rem;
  overflow-x: auto; padding-bottom: 0.4rem;
}
.pets-owned-list::-webkit-scrollbar { display: none; }
.pet-slot {
  min-width: 100px; flex-shrink: 0;
  background: var(--bg2); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem 0.4rem;
  text-align: center; cursor: pointer;
  transition: all 0.2s; display: flex; flex-direction: column; align-items: center;
}
.pet-slot:hover { transform: translateY(-2px); border-color: var(--primary); }
.pet-slot.active { border-color: var(--primary); background: #FFF3EE; }
.pet-slot canvas { border-radius: 10px; }
.pet-slot-name { font-size: 0.72rem; font-weight: 700; color: var(--text); margin-top: 0.3rem; }
.pet-slot-badge {
  font-size: 0.6rem; background: var(--primary); color: #fff;
  border-radius: 8px; padding: 0.1rem 0.45rem; margin-top: 0.25rem;
  display: inline-block;
}
.pets-adopt-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.adopt-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.65rem 0.5rem;
  text-align: center; cursor: pointer;
  transition: all 0.2s; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
}
.adopt-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.adopt-card.cant-afford { opacity: 0.5; }
.adopt-name { font-size: 0.78rem; font-weight: 700; color: var(--text); }
.adopt-cost {
  font-size: 0.72rem; font-weight: 700; background: var(--accent);
  border-radius: 10px; padding: 0.1rem 0.5rem; color: var(--text);
}
.pets-all-owned {
  grid-column: 1/-1; text-align: center; color: var(--text-muted);
  padding: 1rem; font-size: 0.85rem;
}

/* ── RESPONSIVE ── */
@media (max-height: 700px) {
  .pet-room { min-height: 160px; }
  .stats-panel { gap: 0.2rem; padding: 0.3rem 0.75rem; }
  .action-buttons { padding: 0.3rem 0.5rem; }
  .ai { font-size: 1.1rem; }
}
@media (min-width: 431px) {
  #app {
    inset: auto;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 430px;
    height: min(760px, 100vh);
    border-radius: 24px;
  }
}
