:root {
  --bg: #ffffff;
  --ink: #000000;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

.scene {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 16px;
}

.fade {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .9s ease, transform .9s ease;
}

.fade.visible {
  opacity: 1;
  transform: none;
}

.title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: .02em;
}

.dog {
  position: relative;
  width: min(220px, 55vw);
  aspect-ratio: 1;
  transform: translateX(calc(-50vw - 240px));
  will-change: transform;
}

.dog > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.fur, .paw, .leg, .pupil {
  fill: var(--ink);
}

.eye-white {
  fill: var(--bg);
}

.tail {
  fill: none;
  stroke: var(--ink);
  stroke-width: 7;
  stroke-linecap: round;
}

.sheet {
  fill: var(--bg);
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.cover {
  fill: var(--bg);
  stroke: none;
}

.outline, .fold, .hole {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.fold { stroke-width: 2.5; }
.hole { stroke-width: 2.2; }

.dog.run {
  animation: run-in 1.7s cubic-bezier(.25, .9, .35, 1) forwards;
}

@keyframes run-in {
  from { transform: translateX(calc(-50vw - 240px)); }
  to   { transform: translateX(0); }
}

.dog-side-inner {
  animation: bob .32s ease-in-out infinite;
}

.leg {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: leg-swing .32s ease-in-out infinite;
}

.leg-b { animation-direction: reverse; }

.tail-side {
  transform-origin: 44px 118px;
  animation: wag-side .32s ease-in-out infinite alternate;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes leg-swing {
  0%   { transform: rotate(-28deg); }
  50%  { transform: rotate(28deg); }
  100% { transform: rotate(-28deg); }
}

@keyframes wag-side {
  from { transform: rotate(-12deg); }
  to   { transform: rotate(14deg); }
}

.dog.stopped .dog-side-inner,
.dog.stopped .leg,
.dog.stopped .tail-side {
  animation: none;
}

.dog-side {
  transform: scaleX(1);
  transform-origin: 50% 50%;
  transition: transform .22s ease-in;
}

.dog.turning .dog-side {
  transform: scaleX(0);
}

.dog-front {
  transform: scaleX(0);
  transform-origin: 50% 50%;
  transition: transform .22s ease-out;
}

.dog.front .dog-front {
  transform: scaleX(1);
}

.settle {
  transform-origin: 100px 185px;
}

.dog.sit .settle {
  animation: settle .55s cubic-bezier(.3, 1.4, .5, 1) both;
}

@keyframes settle {
  0%   { transform: translateY(-10px) scale(.96, 1.04); }
  100% { transform: translateY(0)     scale(1, 1); }
}

.sheet-drop {
  transform-origin: 100px 185px;
  transform: translateY(-90px);
  opacity: 0;
}

.dog.dressed .sheet-drop {
  animation: sheet-drop .9s forwards;
}

@keyframes sheet-drop {
  0% {
    transform: translateY(-90px) scale(1, 1);
    opacity: 0;
    animation-timing-function: cubic-bezier(.5, 0, 1, .7);
  }
  18% {
    opacity: 1;
    animation-timing-function: cubic-bezier(.5, 0, 1, .7);
  }
  60% {
    transform: translateY(0) scale(1, 1);
    animation-timing-function: ease-out;
  }
  74% {
    transform: translateY(0) scale(1.07, .92);
    animation-timing-function: ease-in-out;
  }
  100% {
    transform: translateY(0) scale(1, 1);
    opacity: 1;
  }
}

.sway {
  transform-origin: 100px 185px;
}

.dog.dressed .sway {
  animation: sway 3.4s ease-in-out .9s infinite;
}

@keyframes sway {
  0%, 100% { transform: rotate(-1.6deg); }
  50%      { transform: rotate(1.6deg); }
}

.tail-front {
  transform-origin: 152px 168px;
}

.dog.sit .tail-front {
  animation: wag-front 1.1s ease-in-out .3s infinite alternate;
}

@keyframes wag-front {
  from { transform: rotate(-10deg); }
  to   { transform: rotate(14deg); }
}

.bubble {
  position: absolute;
  left: 74%;
  top: 30%;
  padding: 3px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--bg);
  font-size: clamp(.8rem, 3.6vw, .95rem);
  line-height: 1.5;
  white-space: nowrap;
  transform-origin: 0 50%;
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.bubble .bubble-tail {
  position: absolute;
  left: -12px;
  top: calc(50% - 9px);
  width: 16px;
  height: 18px;
  overflow: visible;
}

.bubble-tail path {
  fill: var(--bg);
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.dog.speaking .bubble {
  animation: bubble-pop .42s cubic-bezier(.3, 1.5, .5, 1) forwards;
}

@keyframes bubble-pop {
  0%   { transform: scale(0);   opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

.dog.hushed .bubble {
  animation: bubble-out 2s ease forwards;
}

@keyframes bubble-out {
  from { transform: scale(1); opacity: 1; }
  to   { transform: scale(1); opacity: 0; }
}

.head,
.head-dog {
  transform-origin: 100px 100px;
  transform:
    translate(calc(var(--look) * 5px), calc(var(--down) * 2px))
    rotate(calc(var(--look) * 9deg));
  transition: transform .35s cubic-bezier(.3, 1, .4, 1);
}

.head-dog .pupil {
  transform: translate(calc(var(--look) * 1.6px), calc(var(--down) * 1.4px));
  transition: transform .35s cubic-bezier(.3, 1, .4, 1);
}

.dog.instant {
  transform: none;
  animation: none;
}

.dog.instant .dog-side { display: none; }
.dog.instant .dog-front { transform: scaleX(1); transition: none; }
.dog.instant .sheet-drop { animation: none; transform: none; opacity: 1; }
.dog.instant .bubble { animation: none; transform: none; opacity: 1; }
.dog.instant.hushed .bubble { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .dog *,
  .dog.sit .settle,
  .dog.sit .tail-front,
  .dog.dressed .sway,
  .dog.dressed .sheet-drop,
  .dog.speaking .bubble,
  .dog.hushed .bubble {
    animation: none !important;
  }
  .head, .head-dog, .pupil, .fade { transition: none !important; }
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 22px;
}

.btn {
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 2px;
  outline: none;
}

.btn:hover,
.btn:focus-visible {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
}

@media (max-width: 480px) {
  html, body { font-size: 14px; }
  .nav { gap: 4px 16px; }
}

.corner {
  position: fixed;
  top: 20px;
  right: 24px;
  color: var(--ink);
  text-decoration: none;
  padding: 4px 2px;
  z-index: 2;
}

.corner:hover,
.corner:focus-visible {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
}
