/* ============================================================
   Poodle Park — design tokens, field aesthetics & animations
   ============================================================ */

:root {
  --pp-grass-1: #86c26a;
  --pp-grass-2: #79b75e;
  --pp-grass-line: rgba(255, 255, 255, 0.10);
  --pp-ink: #12240f;
  --pp-glass: rgba(255, 255, 255, 0.72);
  --pp-glass-border: rgba(255, 255, 255, 0.55);
  --pp-shadow-soft: 0 12px 40px -12px rgba(23, 58, 21, 0.35);
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #f8fafc;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

/* Dual radial glow backdrop behind everything */
.pp-page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60rem 40rem at 85% -10%, rgba(110, 231, 183, 0.35), transparent 60%),
    radial-gradient(50rem 34rem at 0% 110%, rgba(167, 139, 250, 0.16), transparent 60%),
    #f8fafc;
}

/* Subtle pale paw-print polka layer */
.pp-paws {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%2322520f' transform='rotate(-18 60 60)'%3E%3Cellipse cx='60' cy='66' rx='13' ry='10'/%3E%3Cellipse cx='45' cy='51' rx='5.5' ry='6.5'/%3E%3Cellipse cx='56' cy='46' rx='5.5' ry='6.5'/%3E%3Cellipse cx='67' cy='48' rx='5.5' ry='6.5'/%3E%3Cellipse cx='76' cy='56' rx='5.5' ry='6.5'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Glassmorphism helpers (light theme) ---------- */
.pp-glass {
  background: var(--pp-glass);
  border: 1px solid var(--pp-glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--pp-shadow-soft);
}

.pp-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(5, 150, 105, 0.2);
  background: rgba(16, 185, 129, 0.1);
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #065f46;
}

/* ---------- Buttons ---------- */
.pp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: all 0.15s ease;
  cursor: pointer;
}

.pp-btn:hover { opacity: 0.93; }
.pp-btn:active { transform: scale(0.97); }
.pp-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #047857; }
.pp-btn:disabled { pointer-events: none; opacity: 0.5; }

.pp-btn-primary {
  background: #059669;
  color: #fff;
  box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.4);
}

.pp-btn-ghost {
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.pp-btn-ghost:hover {
  border-color: #cbd5e1;
  color: #0f172a;
}

.pp-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  width: 2.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.85);
  color: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pp-btn-icon:hover { color: #0f172a; }
.pp-btn-icon:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #047857; }
.pp-btn-icon svg { width: 1.15rem; height: 1.15rem; }

/* ---------- Cards ---------- */
.pp-card {
  border-radius: 1rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: all 0.2s ease;
}

.pp-card-hover:hover {
  transform: translateY(-4px);
  border-color: #6ee7b7;
  box-shadow: 0 14px 30px -10px rgba(5, 150, 105, 0.25);
}

/* ============================================================
   THE PARK FIELD
   ============================================================ */

.pp-field-outer {
  position: relative;
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: var(--pp-shadow-soft), 0 0 0 1px rgba(20, 83, 45, 0.25), 0 0 0 8px rgba(250, 250, 249, 0.6), 0 0 0 9px rgba(20, 83, 45, 0.12);
}

.pp-field {
  position: absolute;
  top: 0;
  left: 0;
  width: 1600px;
  height: 900px;
  transform-origin: top left;
  user-select: none;
  cursor: crosshair;
  background:
    /* mowed lawn stripes */
    repeating-linear-gradient(105deg,
      var(--pp-grass-line) 0 90px, transparent 90px 180px),
    radial-gradient(120% 90% at 50% 0%, #93cb74 0%, var(--pp-grass-1) 55%, var(--pp-grass-2) 100%);
  touch-action: none;
}

.pp-field::after {
  /* soft inner vignette */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px rgba(13, 48, 14, 0.28);
  border-radius: inherit;
}

/* Decor (bushes / trees / pond / flowers) */
.pp-decor {
  position: absolute;
  pointer-events: none;
  filter: drop-shadow(0 10px 10px rgba(13, 48, 14, 0.25));
}

/* Entities are absolutely positioned at (0,0) and moved via transform */
.pp-entity {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  pointer-events: none;
}

.pp-entity-shadow {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 70%;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 9999px;
  background: radial-gradient(closest-side, rgba(13, 48, 14, 0.30), transparent);
  animation: pp-shadow-breathe 2.4s ease-in-out infinite;
}

/* Look-target ripple where the owner points */
.pp-tap-ring {
  position: absolute;
  width: 64px;
  height: 64px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 9999px;
  pointer-events: none;
  animation: pp-tap 0.55s ease-out forwards;
}

.pp-tap-ring::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  animation: pp-tap-dot 0.55s ease-out forwards;
}

@keyframes pp-tap {
  from { transform: translate(-50%, -50%) scale(0.3); opacity: 0.9; }
  to   { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

@keyframes pp-tap-dot {
  0%, 60% { opacity: 0.9; transform: scale(1); }
  100%    { opacity: 0; transform: scale(0.4); }
}

@keyframes pp-shadow-breathe {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.8; }
  50%      { transform: translateX(-50%) scale(0.86); opacity: 0.55; }
}

/* Poodle / rival pup sprites */
.pp-dog-sprite {
  filter: drop-shadow(0 8px 6px rgba(13, 48, 14, 0.22));
  transform-origin: 50% 90%;
}

.pp-dog-sprite.is-walking {
  animation: pp-bob 0.32s ease-in-out infinite;
}

.pp-dog-sprite.is-dashing {
  animation: pp-bob 0.18s ease-in-out infinite;
}

.pp-dog-sprite.is-idle {
  animation: pp-breathe 2.2s ease-in-out infinite;
}

@keyframes pp-bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg) scaleY(1); }
  50%      { transform: translateY(-5px) rotate(1.5deg) scaleY(1.03); }
}

@keyframes pp-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.035); }
}

/* Dust puffs behind dashing paws */
.pp-puff {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.75);
  pointer-events: none;
  animation: pp-puff 0.5s ease-out forwards;
}

@keyframes pp-puff {
  from { transform: scale(0.4); opacity: 0.75; }
  to   { transform: scale(1.7) translateY(-8px); opacity: 0; }
}

/* ============================================================
   ITEMS: bones, toys & treats
   ============================================================ */

.pp-item {
  animation: pp-spawn-pop 0.38s cubic-bezier(0.22, 1.6, 0.4, 1) backwards;
  filter: drop-shadow(0 6px 5px rgba(13, 48, 14, 0.3));
}

.pp-item.is-fading {
  animation: pp-item-blink 0.45s steps(2, jump-none) infinite;
}

.pp-item.is-floating {
  animation:
    pp-item-float 2.6s ease-in-out infinite,
    pp-spawn-pop 0.38s cubic-bezier(0.22, 1.6, 0.4, 1) backwards;
}

@keyframes pp-spawn-pop {
  0%   { transform: scale(0.2) rotate(-24deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes pp-item-float {
  0%, 100% { filter: drop-shadow(0 6px 5px rgba(13, 48, 14, 0.3)); }
  50%      { filter: drop-shadow(0 12px 7px rgba(13, 48, 14, 0.28)); }
}

@keyframes pp-item-blink {
  0% { opacity: 1; } 100% { opacity: 0.25; }
}

/* Pickup ring burst */
.pp-burst {
  position: absolute;
  width: 70px;
  height: 70px;
  margin: -35px 0 0 -35px;
  border-radius: 9999px;
  border: 3px solid currentColor;
  pointer-events: none;
  animation: pp-burst 0.45s ease-out forwards;
}

@keyframes pp-burst {
  from { transform: scale(0.35); opacity: 0.85; }
  to   { transform: scale(1.25); opacity: 0; }
}

/* Floating score popups */
.pp-score-pop {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font: 800 1.15rem/1.2 "Outfit", sans-serif;
  white-space: nowrap;
  pointer-events: none;
  animation: pp-score-rise 0.85s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55), 0 0 14px rgba(255, 255, 255, 0.4);
}

.pp-score-pop small {
  font: 800 0.7em/1 "Outfit", sans-serif;
  margin-left: 2px;
  opacity: 0.85;
}

@keyframes pp-score-rise {
  0%   { transform: translate(-50%, -90%) scale(0.6); opacity: 0; }
  25%  { transform: translate(-50%, -130%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -215%) scale(0.95); opacity: 0; }
}

/* ============================================================
   In-field HUD (glass overlays)
   ============================================================ */

.pp-over {
  position: absolute;
  z-index: 30;
  pointer-events: none;
}

.pp-over .pp-clickable { pointer-events: auto; }

.pp-timer {
  font-variant-numeric: tabular-nums;
  font: 800 1.5rem/1 "Outfit", sans-serif;
  letter-spacing: 0.04em;
}

.pp-timer.hurry { color: #b45309; }

.pp-glass.hurry {
  background: linear-gradient(180deg, #fef3c7, #fde68a);
  border-color: rgba(180, 83, 9, 0.3);
}

.pp-glass.urgent {
  animation: pp-timer-pulse 0.85s ease-in-out infinite;
}

.pp-timer.urgent {
  animation: pp-timer-pulse 0.85s ease-in-out infinite;
}

@keyframes pp-timer-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

.pp-standings-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  line-height: 1;
  padding: 0.22rem 0;
}

.pp-standings-row .place {
  width: 1.05rem;
  font-weight: 800;
  text-align: center;
  opacity: 0.55;
}

.pp-standings-row.is-you {
  font-weight: 800;
  color: #065f46;
}

/* Combo chip */
.pp-combo {
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.pp-combo.show {
  transform: scale(1) rotate(-2deg);
  opacity: 1;
}
.pp-combo.hide {
  transform: scale(0.7);
  opacity: 0;
}

/* Dash meter */
.pp-meter {
  height: 8px;
  border-radius: 9999px;
  background: rgba(6, 78, 59, 0.25);
  overflow: hidden;
  width: 90px;
}
.pp-meter > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #34d399, #059669);
  transition: width 0.08s linear;
}
.pp-meter.is-ready > i {
  background: linear-gradient(90deg, #a7f3d0, #10b981);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

/* Ready / pause / finish overlays */
.pp-veil {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(11, 42, 20, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  text-align: center;
}

.pp-veil.show {
  opacity: 1;
  pointer-events: auto;
}

.pp-count {
  font: 900 clamp(4rem, 9vw, 8rem)/1 "Outfit", sans-serif;
  color: #fff;
  text-shadow: 0 6px 0 rgba(6, 78, 59, 0.45), 0 18px 40px rgba(0, 0, 0, 0.35);
  animation: pp-count-in 0.42s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes pp-count-in {
  0%   { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   Results confetti
   ============================================================ */

.pp-confetti {
  position: fixed;
  top: -16px;
  width: 10px;
  height: 16px;
  z-index: 60;
  border-radius: 2px;
  animation: pp-confetti-fall linear forwards;
}

@keyframes pp-confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.9; }
}

/* ============================================================
   Misc accessibility & motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .pp-dog-sprite.is-walking,
  .pp-dog-sprite.is-idle,
  .pp-dog-sprite.is-dashing,
  .pp-item.is-floating,
  .pp-entity-shadow {
    animation: none !important;
  }
  html { scroll-behavior: auto; }
}

/* Thin, quiet scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Game HUD layers & entity internals
   ============================================================ */

.pp-hud {
  position: absolute;
  z-index: 20;
  pointer-events: none;
}

.pp-hud .pointer-events-auto,
.pp-hud button {
  pointer-events: auto;
}

.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.pp-entity {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  pointer-events: none;
}

.pp-entity .pp-flip {
  position: absolute;
  inset: 0;
  transform-origin: 50% 88%;
}

.pp-entity .pp-dog-sprite {
  position: absolute;
  bottom: 0;
  left: 0;
}

.pp-entity .pp-item {
  position: absolute;
  left: 0;
  bottom: 0;
}

.pp-combo.show {
  transform: scale(1) rotate(-2deg) !important;
}
.pp-combo.hide {
  transform: scale(0.7) rotate(-2deg) !important;
}
.pp-combo.pop {
  animation: pp-combo-pop 0.18s ease;
}

@keyframes pp-combo-pop {
  0%   { transform: scale(1.3) rotate(-3deg) !important; }
  100% { transform: scale(1) rotate(-2deg) !important; }
}

/* View entrance */
.pp-anim-in {
  animation: pp-view-in 0.4s ease both;
}

@keyframes pp-view-in {
  0%   { opacity: 0; transform: translateY(10px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Comp HUD on small phones: shrink, then hide side board below 380px */
@media (max-width: 540px) {
  #pp-board { padding: 0.45rem; min-width: 108px; }
  .pp-standings-row { font-size: 0.68rem; gap: 0.3rem; }
  .pp-timer { font-size: 1.1rem; }
  #pp-chip-score { font-size: 1.2rem; }
}

@media (max-width: 380px) {
  #pp-board { display: none; }
}

/* No rubber-banding while steering the pup */
html { overscroll-behavior-y: contain; }
