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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #b5aeaa;
  transition: background-color 0.5s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

/* ---------- dogs ---------- */
.track {
  position: fixed;
  inset: 0;
}

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
  will-change: transform, opacity;
  opacity: 0;
}

.stage.current {
  opacity: 1;
}

.frame {
  position: relative;
  height: 100%;
  width: min(100%, calc(100dvh * 2 / 3));
  overflow: hidden;
}

.frame video,
.frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* reaction layers sit above the sitting loop and switch instantly: every switch is between
   identical frames (baked optical-flow bridges), so there is nothing to fade */
.frame .act {
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.45, 0, 0.55, 1), transform 0.9s cubic-bezier(0.45, 0, 0.55, 1);
}
.frame .act.on { opacity: 1; }

.frame {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%);
}

/* blurred copy of the scene fills the space around the dog on wide screens */
.backdrop {
  position: absolute;
  inset: -60px;
  width: calc(100% + 120px);
  height: calc(100% + 120px);
  object-fit: cover;
  filter: blur(70px) saturate(1.05);
  transform: scale(1.15);
  pointer-events: none;
}

.frame.boop { transform: scale(1.02); }

/* ---------- hearts ---------- */
.fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}

.heart {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  fill: #fff;
  opacity: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
  animation: float 1.4s ease-out forwards;
}

@keyframes float {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(var(--r)); }
  15%  { opacity: 0.95; }
  100% { opacity: 0; transform: translate(var(--dx), -140px) scale(1.15) rotate(var(--r)); }
}

/* ---------- dots ---------- */
.dots {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
}

.dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: all 0.3s ease;
}

.dots span.on {
  height: 18px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.95);
}

/* ---------- action dock ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  z-index: 30;
}

.dock button {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.3s ease;
}

.dock button:active { transform: scale(0.9); }
.dock button[disabled] { opacity: 0.35; }

.dock svg,
.coach svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- first-visit coach mark (icon only) ---------- */
.coach {
  position: fixed;
  left: 50%;
  top: 42%;
  z-index: 25;
  pointer-events: none;
  animation: stroke 2.2s ease-in-out infinite;
}

.coach svg { width: 44px; height: 44px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25)); }
.coach.hidden { display: none; }

@keyframes stroke {
  0%   { transform: translate(-90%, 0) rotate(-8deg); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translate(-10%, -10px) rotate(8deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .stage, .frame video, .frame img { transition: none; }
  .coach { animation: none; }
}

/* ---------- corner buttons (icons only) ---------- */
.corner {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  z-index: 30;
  display: flex;
  gap: 10px;
}
.corner.left { left: 16px; }
.corner.right { right: 16px; }
.round {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.8;
  padding: 0;
  transition: opacity 0.2s ease, transform 0.15s ease;
}
.round:active { transform: scale(0.9); }
.round svg, .gift svg, .toast svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hidden { display: none !important; }

/* ---------- a pet someone sent you ---------- */
.gift {
  position: fixed;
  left: 50%;
  top: 22%;
  z-index: 26;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  pointer-events: none;
  animation: gift 2.8s ease-in-out forwards;
}
.gift svg { width: 34px; height: 34px; fill: #fff; stroke: none; }
@keyframes gift {
  0%   { opacity: 0; transform: translateY(14px) scale(0.6); }
  18%  { opacity: 1; transform: translateY(0) scale(1.08); }
  28%  { transform: scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-24px) scale(0.95); }
}

/* ---------- link-copied confirmation ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(72px + env(safe-area-inset-top));
  z-index: 40;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  animation: toast 1.6s ease forwards;
}
@keyframes toast { 0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- about sheet: the one place with words ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  touch-action: auto;
}
.sheet-card {
  position: relative;
  width: min(100%, 480px);
  margin: 0 12px calc(12px + env(safe-area-inset-bottom));
  padding: 24px 24px 20px;
  border-radius: 22px;
  background: rgba(30, 28, 27, 0.82);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #f4f1ee;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: text;
  user-select: text;
}
.sheet-card h2 { margin: 0 0 10px; font-size: 19px; font-weight: 650; }
.sheet-card p { margin: 0 0 10px; }
.sheet-card .quiet { opacity: 0.6; font-size: 13px; margin-top: 14px; }
.sheet-card .round { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; }
