* { box-sizing: border-box; }

:root {
  --ink: #263238;
  --muted: #5f6f73;
  --paper: #fffdf8;
  --coral: #ef765f;
  --coral-dark: #c9504b;
  --teal: #4b9f9a;
  --yellow: #f7c957;
  --line: rgba(38, 50, 56, 0.13);
  --shadow: 0 18px 45px rgba(38, 50, 56, 0.14);
}

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: #f3eee3;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, a { font: inherit; }
button { cursor: pointer; }

.game-shell {
  min-height: 100svh;
  padding: max(22px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 12% 14%, #ffe0b7 0 14%, transparent 35%), radial-gradient(circle at 90% 84%, #cce8dc 0 12%, transparent 34%), #f3eee3;
}

.screen { min-height: calc(100svh - 46px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.screen[hidden] { display: none; }

.back-link, .quiet-button {
  color: var(--ink);
  border: 2px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
  border-radius: 999px;
  padding: 10px 16px;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
}
.back-link { position: absolute; top: max(18px, env(safe-area-inset-top)); left: max(18px, env(safe-area-inset-left)); z-index: 3; }
.back-link:focus-visible, button:focus-visible { outline: 4px solid rgba(75, 159, 154, 0.42); outline-offset: 3px; }

.home-art, .celebrate-art { font-size: clamp(4rem, 16vw, 7rem); letter-spacing: 0.08em; margin-bottom: 12px; }
#home-title, #celebrate-title { margin: 0; font-size: clamp(2.5rem, 7vw, 4rem); line-height: 1; }

.primary-button {
  min-height: 86px;
  min-width: 86px;
  padding: 0;
  border: 0;
  border-radius: 26px;
  color: #fffdf8;
  background: var(--coral);
  box-shadow: 0 8px 0 var(--coral-dark), 0 16px 28px rgba(201, 80, 75, 0.22);
  font-weight: 900;
  font-size: 2.25rem;
}
.primary-button:active { transform: translateY(4px); box-shadow: 0 4px 0 var(--coral-dark); }

.screen-game { justify-content: flex-start; padding-top: 34px; }
.game-header { width: min(760px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; }
.round-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.88);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(38, 50, 56, 0.08);
}
.round-icon { font-size: 1.1rem; }
.quiet-button {
  border: 0;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  color: var(--muted);
  font-size: 1.6rem;
}
.status-message {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.playfield { width: min(760px, 100%); display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 10px 0 26px; }
.animal-card { position: relative; width: min(360px, 78vw); min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 30px; background: var(--paper); box-shadow: var(--shadow); }
.animal-emoji { font-size: clamp(6rem, 22vw, 10rem); line-height: 1; transition: transform 0.25s ease; will-change: transform; }
.animal-card.is-happy .animal-emoji { animation: happy-hop 0.65s ease; }
.animal-name { display: none; }
.mouth-target { position: absolute; left: 50%; top: 49%; width: 132px; height: 104px; transform: translate(-50%, -50%); border: 5px dashed rgba(239, 118, 95, 0.42); border-radius: 50%; pointer-events: none; }
.arrow { margin: 12px 0; color: var(--coral); font-size: 2rem; font-weight: 900; }
.food-tray { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 2vw, 18px); }
.food-choice { position: relative; min-height: 124px; display: flex; align-items: center; justify-content: center; border: 3px solid transparent; border-radius: 24px; background: rgba(255, 253, 248, 0.9); box-shadow: 0 10px 25px rgba(38, 50, 56, 0.1); touch-action: none; user-select: none; transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease; will-change: transform; }
.food-choice:hover, .food-choice:focus-visible { border-color: var(--yellow); transform: translateY(-4px); }
.food-choice.is-dragging { z-index: 4; opacity: 0.88; transform: scale(1.08); box-shadow: 0 18px 35px rgba(38, 50, 56, 0.2); transition: opacity 0.18s ease, border-color 0.18s ease; }
.food-choice.is-returning { animation: return-bounce 0.5s ease; }
.food-choice.is-eaten { opacity: 0; pointer-events: none; transform: scale(0.5) translateY(-80px); }
.food-emoji { font-size: clamp(3.1rem, 12vw, 5rem); line-height: 1; }

@keyframes happy-hop { 0%, 100% { transform: translateY(0) rotate(0); } 35% { transform: translateY(-18px) rotate(-6deg); } 70% { transform: translateY(0) rotate(6deg); } }
@keyframes return-bounce { 0% { transform: translateX(0); } 35% { transform: translateX(-18px); } 65% { transform: translateX(12px); } 100% { transform: translateX(0); } }

@media (max-width: 540px) {
  .screen-game { padding-top: 42px; }
  .animal-card { min-height: 190px; }
  .food-choice { min-height: 104px; border-radius: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
