:root {
  color-scheme: light;
  --ink: #432d31;
  --berry: #903b55;
  --pink: #efaab7;
  --cream: #fff8ea;
  --paper: #f9ecdc;
  --muted: #795d60;
  --sans: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 4% 14%, #eaa6b43d, transparent 45%),
    radial-gradient(ellipse at 99% 91%, #dfae9c4a, transparent 43%),
    linear-gradient(#a66f6d12 1px, transparent 1px),
    linear-gradient(90deg, #a66f6d12 1px, transparent 1px);
  background-size: auto, auto, 20px 20px, 20px 20px;
  font: 16px/1.5 var(--sans);
}
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 12;
  opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.32' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: wait; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #a33a63; outline-offset: 5px; }
::selection { color: #452633; background: #f4b2c3; }
.desk {
  width: min(1080px, 100%); min-height: 100svh;
  margin-inline: auto; padding: 0 clamp(18px, 4vw, 58px);
  display: flex; flex-direction: column;
}
.mast, .foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: #674751;
}
.mast {
  min-height: 74px; padding-block: 10px;
  border-bottom: 1px dashed #8d686456;
}
.mast strong, .mast b { font: bold 18px var(--serif); }
.mast svg, .sound svg, .back svg { vertical-align: middle; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 clamp(19px,2vw,24px)/1.1 var(--serif); letter-spacing: -.04em; }
.brand svg { width: 31px; height: 31px; color: var(--berry); }
.controls { display: flex; justify-content: center; align-items: center; gap: 9px; min-height: 30px; margin-bottom: 13px; }
.controls .back { position: absolute; left: 0; }
.sound, .back, .quiet {
  padding: 8px 12px; min-height: 44px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 14px;
}
.sound {
  border: 1px solid #a48580; background: #fff8ebbc;
  box-shadow: 0 2px 0 #b5978f60;
}
.paper {
  position: relative;
  width: min(100%, 690px); margin: auto; padding: clamp(20px, 4vh, 42px) 0;
}
.intro-art {
  position: relative; display: block;
  width: min(96%, 614px); margin: 0 auto 22px;
  padding: 7px 7px 9px; background: #fff9ec; border: 1px solid #ab8c80;
  box-shadow: 2px 4px 0 #be9a8b5e; transform: rotate(-1deg);
  image-rendering: pixelated;
}
.intro-art:before, .intro-art:after {
  content: ""; pointer-events: none; position: absolute; z-index: 1;
  width: 51px; height: 18px; background: repeating-linear-gradient(90deg,#e4a4a398 0 3px,#eabdafa3 3px 6px);
  border-inline: 1px dashed #ca958b;
}
.intro-art:before { left: -14px; top: 1px; transform: rotate(-33deg); }
.intro-art:after { right: -14px; bottom: 1px; transform: rotate(-33deg); }
.intro-art canvas { display: block; width: 100%; height: auto; aspect-ratio: 720 / 252; }
.intro-art img, img.intro-art, canvas.intro-art, svg.intro-art {
  display: block; max-width: 100%; height: auto; margin-inline: auto;
}
.scene { text-align: center; animation: settle-in .34s ease-out both; }
.eyebrow, .step, .foot, .progress {
  font: 600 11px/1.45 var(--mono);
  letter-spacing: .12em; text-transform: uppercase;
}
.eyebrow { color: var(--berry); margin: 0 auto 10px; }
h1 {
  max-width: 18ch; margin: 0 auto;
  font: 600 clamp(41px, 5.6vw, 69px)/1.02 var(--serif);
  letter-spacing: -.055em; text-wrap: balance;
}
h1 em { color: var(--berry); font-weight: inherit; }
.subtitle, .reply {
  max-width: 49ch; margin: 16px auto;
  color: var(--muted); font-size: clamp(15px, 1.5vw, 17px);
  text-wrap: pretty;
}
.reply:empty { display: none; }
.choices, .actions {
  margin: 25px auto 0; display: flex; align-items: center;
  justify-content: center; gap: 12px; flex-wrap: wrap;
}
.choice, .secondary, .primary, .taped {
  --fill: #fffbef;
  position: relative; isolation: isolate; display: inline-flex;
  justify-content: center; align-items: center; gap: 8px;
  min-height: 49px; padding: 10px 20px;
  border: 1.5px solid #563b3d; border-radius: 14px;
  font: 700 clamp(15px,1.45vw,17px)/1.22 var(--sans);
  background-color: var(--fill); color: var(--ink);
  box-shadow: 2px 3px 0 #61454a;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.choice:nth-child(4n+1), .primary { --fill: #f1aeba; }
.choice:nth-child(4n+2) { --fill: #fff6d7; }
.choice:nth-child(4n+3) { --fill: #f7e1dc; }
.choice:nth-child(4n) { --fill: #f9f1e2; }
.choice.taped { --fill: #f8e5dc; }
.choice:active, .secondary:active, .primary:active, .taped:active, .pressed {
  transform: translate(2px,3px); box-shadow: 0 0 0 #61454a;
}
.taped {
  --fill: #f8e5dc;
  background-image: linear-gradient(113deg,transparent 65%,#976e702b 65%,#976e702b 66%,transparent 66%);
}
.taped::before, .taped::after {
  content: ""; pointer-events: none;
  position: absolute; width: 27px; height: 13px;
  border-inline: 1px dashed #d09291;
  background: repeating-linear-gradient(90deg,#eab0adcf 0 3px,#f4c4bcca 3px 5px);
}
.taped::before { top: -5px; left: -8px; transform: rotate(-31deg); }
.taped::after { right: -7px; bottom: -4px; transform: rotate(-29deg); }
.tape-state { color: var(--berry); font: 600 14px/1.5 var(--mono); }
.primary:disabled { opacity: .65; }
.quiet { text-decoration: underline; text-underline-offset: 4px; }
.progress, .step { color: var(--muted); }
.progress {
  width: 49px !important; height: 7px; border-radius: 2px;
  background: linear-gradient(to right, #9e5268 0 var(--completed,20%),#ccaeaa var(--completed,20%) 100%);
  mask: repeating-linear-gradient(90deg,#000 0 7px,transparent 7px 10px);
}
body[data-scene="day"] { --completed: 40%; }
body[data-scene="time"] { --completed: 60%; }
body[data-scene="place"] { --completed: 80%; }
body[data-scene="note"],body[data-scene="final"] { --completed: 100%; }
.actions:empty { display: none; }
body[data-scene="place"] .choices { max-width: 485px; display: grid; grid-template-columns: 1fr 1fr; }
.scene h1:focus { outline: none; }
.taped[data-presses="1"]::before { transform: translateX(-2px) rotate(-43deg); }
.taped[data-presses="2"]::after { transform: translateY(5px) rotate(21deg); }
.taped[data-presses="3"] { color: #826669; border-style: dashed; cursor: default; box-shadow: 1px 1px 0 #b89e96; }
.taped[data-presses="3"]::after { opacity: 0; }
.tear { display: inline-block; margin-left: .35em; animation: settle-in .4s ease-out; }
.foot {
  margin-top: auto; min-height: 58px; padding-block: 12px;
  border-top: 1px dashed #8d686456;
}
textarea {
  display: block; width: min(100%, 500px); min-height: 142px;
  margin: 24px auto 0; padding: 15px 18px;
  border: 1px solid #a78782; border-radius: 6px 13px 9px 11px;
  color: var(--ink); resize: vertical; line-height: 30px;
  background: repeating-linear-gradient(transparent 0 29px,#b9928b45 29px 30px) 0 17px/100% 30px var(--cream);
  box-shadow: 2px 4px 0 #c6a59b55;
}
textarea::placeholder { color: #82666b; }
.time, .clock { font: 500 clamp(38px,6vw,58px)/1.15 var(--serif); font-variant-numeric: tabular-nums; }
.early { color: var(--muted); font-size: 13px; font-family: var(--mono); }
.hour-rail, .hour-limits { width: min(100%,475px); margin: 0 auto; display: flex; align-items: center; }
.hour-rail { margin-top: 12px; }
.hour-rail .early {
  flex: 0 0 22%; letter-spacing: .12em;
  color: #796166; line-height: 17px;
  background: repeating-linear-gradient(90deg,#ad8f8b 0 1px, transparent 1px 16px) center bottom/100% 3px no-repeat;
}
.hour-rail .range { width: 78%; margin: 0; }
.hour-limits { display: grid; grid-template-columns: 22% auto 1fr; color: var(--muted); font: 13px/1.4 var(--mono); }
.hour-limits span:first-child { grid-column: 2; }
.hour-limits span:last-child { justify-self: end; }
.range { width: min(100%,355px); }
output.time { display: block; margin: 22px auto 4px; color: var(--berry); }
.clock { margin: 7px auto 0; color: var(--berry); }
input[type="range"] { accent-color: var(--berry); min-height: 44px; cursor: pointer; max-width: 100%; }
.map { position: relative; overflow: hidden; margin: 20px auto; border-radius: 12px; max-width: 600px; }
.map img, .map canvas, .map svg { width: 100%; height: auto; display: block; }
.pop { animation: settle-in .32s ease-out; }
.confetti { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.confetti i { position: absolute; top: 50%; left: 50%; width: 6px; height: 10px; background:#d87891; animation: sprinkle .62s ease-out both; }
.confetti i:nth-child(3n) { background:#deb568; }
.confetti i:nth-child(3n+1) { background:#89ada0; }
@keyframes sprinkle { from { opacity: 0; transform: scale(.3); } 12% { opacity: 1; } to { opacity: 0; transform: translate(var(--x),var(--y)) rotate(var(--r)); } }
@keyframes settle-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@media(hover:hover) {
  .choice:hover, .secondary:hover, .primary:hover, .taped:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 3px 6px 0 #61454a; }
  .choice:nth-child(even):hover { transform: translateY(-3px) rotate(1deg); }
  .quiet:hover, .back:hover, .sound:hover { background-color: #f4d8d3; color: var(--ink); }
}
@media(max-width:600px) {
  .mast { min-height: 59px; }
  .paper { padding-block: 24px; }
  .intro-art { margin-bottom: 16px; }
  .intro-art:before,.intro-art:after { width: 35px; height: 14px; }
  .intro-art:before { left: -8px; } .intro-art:after { right: -7px; }
  .choices, .actions { gap: 10px; margin-top: 20px; }
  .choice, .secondary, .primary, .taped { padding: 11px 15px; }
  .foot { font-size: 10px; letter-spacing: .06em; }
}
@media(max-width:380px) {
  .desk { padding-inline: 13px; }
  .choices { column-gap: 8px; }
  .choice, .taped { padding-inline: 12px; }
}
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Let the runner use the viewport after the welcome scene has settled. */
.scene:has(.button-chase:not([hidden]) .chase-track:not([hidden])) {animation:none;transform:none}
.chase-track {position:fixed;width:146px;z-index:10;isolation:isolate}
.chase-track .taped {position:relative;width:100%;margin:0;z-index:1}
.chase-meter {position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);
  padding:1px 9px;border:1px solid #c2949d;border-radius:12px;background:#fff5e9;
  color:#a13e5e;font:700 14px/1.35 var(--mono);letter-spacing:2px;white-space:nowrap;pointer-events:none}
.chase-track:not([data-tired="true"]) .chase-meter {animation:heart-glow 1.05s ease-in-out infinite alternate}
@keyframes heart-glow {to{opacity:.63;box-shadow:0 0 6px #dc96a5}}
.runner-legs {position:absolute;top:calc(100% - 1px);left:28%;width:44%;height:15px;display:flex;justify-content:space-between;pointer-events:none}
.runner-legs i {position:relative;width:4px;height:10px;background:#754c59;transform-origin:top}
.runner-legs i::after {content:'';position:absolute;bottom:-2px;left:-2px;width:12px;height:5px;border-radius:2px 5px 1px 1px;background:#a54d64;box-shadow:0 2px #62434b}
.dashing .runner-legs i {animation:button-stride 100ms linear infinite alternate}
.dashing .runner-legs i+i {animation-direction:alternate-reverse}
@keyframes button-stride {from{transform:rotate(-54deg)}to{transform:rotate(54deg)}}
@media(prefers-reduced-motion:reduce){.chase-track .chase-meter,.chase-track .runner-legs i{animation:none!important}}
.letter-maze {width:min(calc(100% - 32px),330px);margin:auto;text-align:center;color:var(--ink);padding:14px;border:1px solid #ae8786;border-radius:14px;background:#fff7e9;box-shadow:2px 3px #c69a94}
.letter-maze strong {font:600 16px/1.35 var(--sans)}
.maze-board {display:grid;grid-template-columns:repeat(7,1fr);width:min(100%,245px);margin:12px auto;border:2px solid #815d68;border-radius:4px;overflow:hidden;touch-action:manipulation}
.maze-board span {display:grid;place-items:center;aspect-ratio:1;font:bold 20px/1 var(--sans);color:#963f59}
.maze-path {background:#fff0df;box-shadow:inset 0 0 0 1px #edddd1;cursor:pointer}
.maze-wall {background:repeating-linear-gradient(135deg,#c994a3 0 5px,#d7a8b2 5px 9px)}
.maze-letter {background:#f4c4c8}
.maze-pad {display:flex;gap:5px;justify-content:center}
.maze-pad button {min-width:44px;min-height:44px;border:1px solid #936a74;border-radius:8px;background:#f8d8dc;box-shadow:0 2px #b48991;font-size:20px}

.letter-maze::backdrop {background:#51323d60}
.letter-maze .quiet {margin-top:8px}
