:root {
  --bg-1: #f6e9e2;
  --bg-2: #efe0e8;
  --card-bg: #fffaf6;
  --card-border: rgba(201, 161, 90, 0.22);
  --ink: #4a3740;
  --ink-soft: #9c8890;
  --rose: #b6566f;
  --rose-deep: #8d3348;
  --gold: #c9a15a;
  --gold-soft: #f1ddb0;
  --gold-line: rgba(201, 161, 90, 0.35);
  --peach-1: #ffd9c0;
  --peach-2: #ffb6a2;
  --pink-1: #ffbccb;
  --pink-2: #ff96af;
  --eye-color: #3d2c33;
  --shadow-color: rgba(107, 62, 76, 0.16);

  --font-display: "Fraunces", "Iowan Old Style", serif;
  --font-body: "Quicksand", "Segoe UI", sans-serif;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: radial-gradient(120% 100% at 50% 0%, var(--bg-1) 0%, var(--bg-2) 100%);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--ink);
  padding: clamp(10px, 2.5vw, 20px);
  padding-top: max(clamp(10px, 2.5vw, 20px), env(safe-area-inset-top));
  padding-bottom: max(clamp(10px, 2.5vw, 20px), env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  min-height: calc(100dvh - clamp(20px, 5vw, 40px));
  display: flex;
  justify-content: center;
}

/* Layout em tela cheia, sem o cartão */
.card {
  position: relative;
  background: var(--card-bg);
  padding: clamp(22px, 4vw, 40px) clamp(18px, 4vw, 40px) clamp(16px, 3vw, 32px);
  border-radius: clamp(20px, 3vw, 34px);
  border: 1px solid var(--card-border);
  box-shadow:
    0 30px 60px -20px var(--shadow-color),
    0 1px 0 rgba(255, 255, 255, 0.6) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 3vh, 26px);
  width: 100%;
  min-height: calc(100dvh - clamp(20px, 5vw, 40px));
  max-width: none;
}

.card::before {
  /* fina moldura dourada interna, detalhe de acabamento */
  content: "";
  position: absolute;
  inset: clamp(8px, 1.4vw, 14px);
  border-radius: clamp(14px, 2vw, 26px);
  border: 1px solid var(--gold-line);
  pointer-events: none;
}

/* Cabeçalho */
.header {
  text-align: center;
}

.eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 9vw, 2.7rem);
  font-weight: 560;
  color: var(--rose-deep);
  font-style: italic;
  line-height: 1;
  margin-top: 4px;
}

.status {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 8px;
  height: 20px;
  transition: opacity 0.2s ease;
}

/* Arena do Pet */
.stage {
  position: relative;
  width: min(92vw, 64vh);
  aspect-ratio: 1 / 1;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Anel de carinho */
.affection-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.ring-track {
  fill: none;
  stroke: var(--gold-soft);
  stroke-width: 3;
  opacity: 0.5;
}

.ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 628.3;
  stroke-dashoffset: 500;
  transition: stroke-dashoffset 0.5s ease;
  filter: drop-shadow(0 0 4px rgba(201, 161, 90, 0.5));
}

/* Auréola suave atrás do pet */
.halo {
  position: absolute;
  width: 74%;
  height: 74%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 175, 0.55) 0%, rgba(255, 190, 175, 0) 70%);
  animation: haloPulse 3.5s ease-in-out infinite;
  pointer-events: none;
}

/* Estrutura e Animação de Respiração */
.pet {
  position: relative;
  width: 62%;
  height: 62%;
  animation: breathe 3.5s ease-in-out infinite;
  cursor: pointer;
  outline: none;
  transition: filter 0.3s ease;
}

.pet:focus-visible {
  filter: drop-shadow(0 0 0 3px var(--gold));
}

.pet.loved {
  filter: drop-shadow(0 0 14px rgba(201, 161, 90, 0.55));
}

/* Orelhas */
.ear {
  position: absolute;
  top: -8%;
  width: 28%;
  height: 34%;
  background: linear-gradient(160deg, var(--peach-1), var(--peach-2));
  border-radius: 50% 50% 0 0;
  z-index: 1;
}

.ear-left {
  left: 9%;
  transform: rotate(-20deg);
}

.ear-right {
  right: 9%;
  transform: rotate(20deg);
}

/* Corpo */
.body {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--peach-1) 0%, var(--pink-1) 100%);
  border-radius: 50%;
  z-index: 2;
  box-shadow:
    inset -6px -8px 18px rgba(141, 51, 72, 0.08),
    inset 0 3px 6px rgba(255, 255, 255, 0.6);
}

/* Bochechas */
.blush {
  position: absolute;
  top: 53%;
  width: 16%;
  height: 10%;
  background-color: var(--rose);
  opacity: 0.32;
  border-radius: 50%;
}

.blush-left { left: 11%; }
.blush-right { right: 11%; }

/* Olhos e Pálpebras (Piscar) */
.eye {
  position: absolute;
  top: 34%;
  width: 20%;
  height: 24%;
  background-color: var(--eye-color);
  border-radius: 50%;
  overflow: hidden;
  animation: blink 4.2s infinite;
}

.eye-left { left: 22%; }
.eye-right { right: 22%; }

/* Pupila e Brilho */
.pupil {
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  transition: transform 0.2s ease-out;
}

.sparkle {
  position: absolute;
  top: 8%;
  right: 14%;
  width: 34%;
  height: 34%;
  background-color: #ffffff;
  border-radius: 50%;
}

/* Nariz e Boca */
.snout {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nose {
  width: 7.5%;
  height: 5%;
  min-width: 8px;
  min-height: 6px;
  background-color: var(--rose-deep);
  border-radius: 4px 4px 8px 8px;
}

.mouth {
  width: 10%;
  height: 6%;
  min-width: 12px;
  min-height: 8px;
  border-bottom: 3px solid var(--rose-deep);
  border-radius: 0 0 10px 10px;
  margin-top: 3px;
  transition: all 0.2s ease;
}

.mouth.happy {
  height: 9%;
  min-height: 12px;
  background-color: var(--rose);
  border: none;
  border-radius: 0 0 12px 12px;
}

/* Patinhas */
.paws {
  position: absolute;
  bottom: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 16%;
  z-index: 3;
}

.paw {
  width: 17%;
  height: 12%;
  min-width: 18px;
  min-height: 14px;
  background: linear-gradient(180deg, var(--pink-1), var(--pink-2));
  border-radius: 12px 12px 6px 6px;
  box-shadow: 0 2px 4px rgba(141, 51, 72, 0.12);
}

/* Sombra */
.shadow {
  position: absolute;
  bottom: 6%;
  width: 46%;
  height: 8%;
  background-color: rgba(141, 51, 72, 0.12);
  border-radius: 50%;
  animation: shadowScale 3.5s ease-in-out infinite;
  z-index: 0;
}

/* Partículas: corações e brilhos que seguem o toque */
.particles {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 5;
}

.particle {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 15px;
  line-height: 1;
  animation: floatUp 900ms ease-out forwards;
  will-change: transform, opacity;
}

.particle-heart {
  color: var(--rose);
}

.particle-sparkle {
  color: var(--gold);
  font-size: 13px;
}

/* Dica de uso */
.hint {
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-align: center;
  opacity: 0.85;
}

/* Rodapé agrupado */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2.2vh, 18px);
  width: 100%;
}

/* Botão Alimentar */
.controls {
  display: flex;
  width: 100%;
  max-width: 420px;
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 8px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--rose), var(--rose-deep));
  color: #fff5f2;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 0 #732539, 0 12px 20px -8px rgba(141, 51, 72, 0.5);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-icon {
  font-size: 1.05rem;
}

.btn:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #732539, 0 6px 12px -6px rgba(141, 51, 72, 0.5);
}

.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Assinatura pessoal */
.signature {
  font-size: 0.72rem;
  color: var(--gold);
  text-align: center;
  font-weight: 600;
  opacity: 0.85;
}

/* Keyframes das Animações */
@keyframes breathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.03, 0.97) translateY(-4px); }
}

@keyframes haloPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 0.4; }
}

@keyframes shadowScale {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.08); opacity: 0.5; }
}

@keyframes blink {
  0%, 92%, 98%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.05); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  18% { opacity: 1; transform: translate(-50%, -140%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -260%) scale(0.85); }
}

/* Animações de Ação (JS) */
.bounce {
  animation: bounceAnim 0.6s ease;
}

@keyframes bounceAnim {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-22%) scale(1.05, 0.95); }
}

.wiggle {
  animation: wiggleAnim 0.5s ease;
}

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

/* Estado de Sono (quando o Pip está com sono) */
.pet.sleeping {
  animation: breatheSleep 4.6s ease-in-out infinite;
}

@keyframes breatheSleep {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.02, 0.98) translateY(-2px); }
}

.pet.sleeping .eye {
  animation: none;
  background: transparent;
  border-bottom: 2.5px solid var(--eye-color);
  border-radius: 0 0 70% 70% / 0 0 100% 100%;
  height: 9%;
  top: 41%;
}

.pet.sleeping .pupil {
  display: none;
}

.pet.sleeping .mouth {
  width: 7%;
  height: 5%;
  min-height: 6px;
  border: none;
  background-color: var(--rose-deep);
  border-radius: 50%;
  opacity: 0.5;
  margin-top: 4px;
}

/* Letrinhas Zzz que sobem quando o Pip dorme */
.particle-z {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 560;
  color: var(--ink-soft);
  animation: zzzFloat 2000ms ease-out forwards;
}

@keyframes zzzFloat {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6) rotate(-8deg); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + 30px), calc(-50% - 78px)) scale(1.15) rotate(8deg); }
}

/* Acessibilidade: respeita preferência por menos movimento */
@media (prefers-reduced-motion: reduce) {
  .pet,
  .shadow,
  .halo {
    animation: none;
  }
  .pet.sleeping {
    animation: none;
  }
  .eye {
    animation: none;
  }
}

/* Telas bem pequenas */
@media (max-width: 340px) {
  .card {
    padding: 24px 18px 20px;
    border-radius: 26px;
  }
}
