:root {
  --bg-0: #efe2c8;
  --bg-1: #f7f0e1;
  --cream: #fcf6ea;
  --brown-0: #3a2918;
  --brown-1: #6b4a2b;
  --brown-2: #8a6740;
  --brown-soft: #a98a63;
  --text: #3a2918;
  --text-muted: #7a6347;
  --line: rgba(58, 41, 24, 0.16);
  --line-soft: rgba(58, 41, 24, 0.09);

  /* Memphis accent pops */
  --c-mustard: #f4b942;
  --c-coral: #ff7a6b;
  --c-teal: #4cc9b0;
  --c-pink: #ff9ec7;
  --c-lilac: #b79cf0;

  --radius: 30px;
  --maxw: 820px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 640px at 50% -12%, var(--cream), transparent 60%),
    radial-gradient(900px 600px at 92% 108%, #ddc79a, transparent 55%),
    radial-gradient(700px 500px at 6% 96%, #e7d6b2, transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Dotted background pattern */
#bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--line-soft) 1.4px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 72%);
  opacity: 0.8;
}

/* Floating Memphis blobs */
.blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  animation: floaty 14s ease-in-out infinite;
}

.blob--1 { width: 120px; height: 120px; left: 8%;  top: 16%; background: var(--c-mustard); animation-delay: 0s;  animation-duration: 16s; }
.blob--2 { width: 80px;  height: 80px;  left: 84%; top: 22%; background: var(--c-teal);    animation-delay: -3s; animation-duration: 13s; }
.blob--3 { width: 150px; height: 150px; left: 78%; top: 74%; background: var(--c-coral);   animation-delay: -6s; animation-duration: 18s; }
.blob--4 { width: 90px;  height: 90px;  left: 12%; top: 76%; background: var(--c-pink);    animation-delay: -9s; animation-duration: 15s; }

.blob--ring {
  background: transparent;
  border: 3px solid var(--brown-2);
  opacity: 0.4;
  filter: none;
}
.blob--5 { width: 70px; height: 70px; left: 22%; top: 64%; border-color: var(--c-lilac); animation-delay: -2s; animation-duration: 20s; }
.blob--6 { width: 46px; height: 46px; left: 70%; top: 12%; animation-delay: -7s; animation-duration: 12s; }

@keyframes floaty {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(14px, -22px) scale(1.06); }
  50% { transform: translate(-10px, 12px) scale(0.96); }
  75% { transform: translate(8px, -8px) scale(1.03); }
}

.page {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(16px, 4vw, 40px);
}

.stage-wrap {
  width: 100%;
  max-width: var(--maxw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 3vw, 28px);
}

/* Text */
.text {
  text-align: center;
  max-width: 640px;
}

.text h1 {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--brown-0);
}

.text h1::after {
  content: "";
  display: inline-block;
  width: 0.5em;
}

.squiggle {
  display: block;
  width: min(300px, 78%);
  height: 16px;
  margin: 6px auto 12px;
  overflow: visible;
}

.squiggle path {
  fill: none;
  stroke: var(--c-coral);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: draw 4.5s ease-in-out infinite;
}

@keyframes draw {
  0% { stroke-dashoffset: 420; opacity: 0; }
  10% { opacity: 1; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  85% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

.subheadline {
  margin: 0 0 8px;
  font-size: clamp(1.02rem, 2.7vw, 1.3rem);
  color: var(--brown-0);
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(0.92rem, 2.2vw, 1.05rem);
  font-weight: 600;
}

/* Stage area (no box – dog floats free over the page background) */
.stage-frame {
  position: relative;
  width: 100%;
  height: clamp(300px, 56vh, 540px);
  background: transparent;
  border: 0;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 2;
}

#dog-stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

/* Decorative doodles + particles removed – dog floats free. */

/* Loader overlay (small, transparent – never hides the dog) */
.loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
}

.loader-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--brown-1);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 18px;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

/* Responsive */
@media (max-width: 640px) {
  .stage-frame { height: clamp(280px, 50vh, 420px); }
  .blob { opacity: 0.42; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .blob { display: none; }
  .squiggle path { stroke-dashoffset: 0; opacity: 1; }
}
