:root {
  color-scheme: light;
  --paper: #eeede8;
  --mat: #f8f7f2;
  --surface: #e2e4d5;
  --ink: #26371b;
  --secondary: #495438;
  --display: 'Hiragino Mincho ProN', 'Yu Mincho', YuMincho, 'Noto Serif CJK JP', serif;
  --text: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', YuGothic, 'Noto Sans CJK JP', system-ui, sans-serif;
  --margin: clamp(16px, 4.2vw, 66px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.55 var(--text); }
button { color: inherit; font: inherit; }
button:enabled { cursor: pointer; }
a { color: inherit; text-underline-offset: .19em; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

.page { width: min(100% - 2 * var(--margin), 1340px); margin: 0 auto; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 74px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 700 clamp(1.25rem, 2.05vw, 1.65rem)/1 var(--display); letter-spacing: -.055em; white-space: nowrap; }
.utility { font-size: .875rem; }
.utility a { display: inline-flex; align-items: center; min-height: 44px; }

.paw { position: relative; display: block; flex: 0 0 24px; height: 24px; transform: rotate(-14deg); }
.paw::after, .paw i { position: absolute; background: currentColor; }
.paw::after { content: ''; width: 13px; height: 11px; left: 5.5px; top: 11px; border-radius: 55% 55% 44% 44%; }
.paw i { width: 4.75px; height: 6px; border-radius: 50%; }
.paw i:nth-child(1) { left: 1px; top: 7px; transform: rotate(-32deg); }
.paw i:nth-child(2) { left: 6px; top: 3px; transform: rotate(-14deg); }
.paw i:nth-child(3) { right: 6px; top: 3px; transform: rotate(14deg); }
.paw i:nth-child(4) { right: 1px; top: 7px; transform: rotate(32deg); }

.intro { display: flex; justify-content: space-between; align-items: end; gap: 18px 30px; padding-block: clamp(14px, 3.5vh, 35px) clamp(18px, 3vw, 29px); }
h1 { margin: 0; font: 700 clamp(2.25rem, 5.55vw, 4.85rem)/1.14 var(--display); letter-spacing: -.065em; }
.intro p { margin: 12px 0 0; }
#instructions { font-size: clamp(1rem, 1.35vw, 1.125rem); }
.controls { display: flex; flex: none; align-items: center; gap: 16px; }
.controls .photo-count { margin: 0; font-size: .875rem; color: var(--secondary); white-space: nowrap; }
.modes { display: flex; gap: 3px; padding: 3px; border-radius: 100px; background: var(--surface); }
.modes button, .reset { min-height: 44px; padding: 4px 13px; border: 0; border-radius: 100px; background: transparent; white-space: nowrap; font-size: .875rem; }
.modes button { font-weight: 650; }
.modes button[aria-pressed="true"] { color: var(--mat); background: var(--ink); }
.modes button:enabled:hover { text-decoration: underline; text-underline-offset: .22em; }

.print { margin: 0 0 24px; padding: clamp(7px, 1.15vw, 16px); background: var(--mat); }
.stage { position: relative; height: clamp(295px, 55vh, 690px); overflow: hidden; isolation: isolate; container-type: inline-size; background: #525f39; }
.photo, .lawn { position: absolute; display: block; max-width: none; user-select: none; }
.photo { height: auto; }
.is-cover, .lawn { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.is-cover { object-position: 39% 55%; }
.lawn { object-position: 50% 31%; }
.stage[data-mode="photos"] :is(.lawn, .dog), .stage[data-mode="garden"] .photo { display: none; }
.stage-input { position: absolute; inset: 0; z-index: 5; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; touch-action: manipulation; }
.stage-input:enabled { cursor: crosshair; }
.stage-input:focus-visible { outline-color: var(--mat); outline-offset: -5px; }

.dog { position: absolute; left: var(--x, 34%); top: var(--y, 70%); width: clamp(108px, 15cqw, 224px); height: 0; transform: scaleX(var(--direction, 1)) scale(var(--depth, 1)); transform-origin: left top; pointer-events: none; z-index: 2; }
.dog::before { content: ''; position: absolute; left: -73%; top: -5px; width: 76%; height: clamp(8px, 1.1cqw, 15px); border-radius: 50%; background: rgb(24 36 8 / 45%); filter: blur(4px); }
.dog[data-pose="reaction"]::before { left: -91%; }
.pose { position: absolute; inset: 0 auto auto 0; display: block; width: 100%; height: auto; transform: translate(var(--anchor-x), var(--anchor-y)); }
.standing { --anchor-x: -76%; --anchor-y: -95%; }
.reacting { --anchor-x: -95%; --anchor-y: -94%; transform-origin: 95% 94%; }
.reacting, .dog[data-pose="reaction"] .standing { visibility: hidden; }
.dog[data-pose="reaction"] .reacting { visibility: visible; }
.dog[data-pose="moving"] .standing { animation: trot .19s alternate infinite ease-in-out; }
@keyframes trot { to { transform: translate(var(--anchor-x), calc(var(--anchor-y) - 4%)) rotate(-2deg); } }

.marker { position: absolute; left: var(--x); top: var(--y); width: 26px; height: 19px; border: 2px solid #fff5c3; border-radius: 50%; translate: -50% -50%; pointer-events: none; outline: 1px solid rgb(26 35 11 / 62%); z-index: 3; }
.marker::after { content: ''; position: absolute; width: 4px; height: 4px; top: 50%; left: 50%; translate: -50% -50%; border-radius: 50%; background: #fff5c3; }
.stage[data-mode="garden"] .target { z-index: 1; }
.aim { z-index: 4; border-style: dashed; }

.details { display: flex; justify-content: space-between; align-items: start; gap: 8px 20px; padding: 11px 4px 0; }
.details p { margin: 0; }
#activity { margin-bottom: 3px; }
.credit, .keyboard { font-size: .875rem; color: var(--secondary); overflow-wrap: anywhere; }
.details-tools { text-align: right; flex: none; }
.reset { margin: -7px -8px 0 0; }
.reset span { font-size: 1.22em; vertical-align: -.045em; }
.reset:disabled { opacity: .64; }
.reset:enabled:hover { background: var(--surface); }

.credits { padding-block: clamp(16px, 4vw, 52px); }
.credits-intro { max-width: 50ch; margin-bottom: 32px; }
.credits h1 { font-size: clamp(2rem, 5vw, 4rem); }
.credits-list { list-style: none; padding: 0; margin: 0; }
.credits-list li { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 8px 20px; padding: 12px 16px; overflow-wrap: anywhere; }
.credits-list li:nth-child(odd) { background: var(--mat); }
.credits-list p { margin: 0; }
.credit-meta { color: var(--secondary); font-size: .875rem; }

@media (max-width: 880px) {
  .masthead { min-height: 60px; }
  .intro { align-items: start; flex-direction: column; }
  .controls { flex-flow: row-reverse wrap; justify-content: flex-end; gap: 8px 13px; }
  .intro p { margin-top: 7px; }
  .stage { height: clamp(285px, 53svh, 590px); }
}
@media (max-width: 565px) {
  .details { flex-direction: column; padding-inline: 2px; }
  .details-tools { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 9px; text-align: left; }
  .reset { margin: -4px 0 0 -5px; padding-inline: 6px; }
  .credits-list li { grid-template-columns: 1fr; }
}
@media (hover: none) and (pointer: coarse) {
  .keyboard { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (prefers-reduced-motion: reduce) {
  .dog[data-pose="moving"] .standing { animation: none; }
}
