:root { --bg-color: #ffe; --text-color: #228567; --name-color: #000; --date-color: #808080; --stage-w: 1100px; --stage-h: 680px; --tree-shift-x: 260px; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg-color); min-height: 100%; }
body { font: 14px/1.4 Arial, sans-serif; color: var(--text-color); }
#stage-host { min-height: 100svh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#viewport { position: relative; width: var(--stage-w); height: var(--stage-h); }
#artwork { width: 100%; height: var(--scene-height, 680px); overflow: hidden; }
#main { position: relative; width: var(--stage-w); height: var(--stage-h); transform-origin: top left; }
#ground-canvas, #static-canvas, #canvas { position: absolute; top: 0; left: 0; width: var(--stage-w); height: var(--stage-h); }
#ground-canvas { z-index: 0; }
#static-canvas { transition: transform 1.5s ease-in-out; z-index: 1; }
#static-canvas.shifted { transform: translateX(var(--tree-shift-x)); }
#canvas { z-index: 2; }
#reader { position: absolute; top: 0; left: 0; width: var(--stage-w); height: var(--stage-h); transform: scale(var(--fit-scale, 1)); transform-origin: top left; pointer-events: none; }
#letter { position: absolute; width: 400px; height: 425px; left: 60px; top: 80px; display: none; font-size: 16px; color: var(--text-color); z-index: 3; overflow-y: auto; overflow-wrap: anywhere; pointer-events: auto; scrollbar-width: thin; padding-right: 8px; }
#letter p { margin: 0; min-height: 1.4em; white-space: pre-wrap; }
.typewriter-cursor { display: inline; color: var(--text-color); font-weight: 100; animation: blink .6s step-end infinite; }
.typewriter-cursor--done { animation: blink .6s step-end 6; animation-fill-mode: forwards; opacity: 0; }
@keyframes blink { 50% { opacity: 0; } }
#clock-box { position: absolute; left: 60px; top: 550px; width: 980px; font-size: 28px; opacity: 0; transition: opacity .5s; z-index: 3; }
#clock-box.clock-box--visible { opacity: 1; }
#clock-text { color: var(--date-color); overflow-wrap: anywhere; font-size: 22px; }
#clock-text .name { color: var(--name-color); }
#clock { margin-left: 48px; white-space: nowrap; }
#clock .digit { font-size: 52px; font-variant-numeric: tabular-nums; }
button { cursor: pointer; border: 1px solid #bc3445; border-radius: 24px; padding: 10px 16px; background: #fff9e9; color: #a5293c; font: 14px Arial, sans-serif; }
#startStory { position: absolute; left: 50%; top: 65%; transform: translateX(-50%); z-index: 4; white-space: nowrap; }
#revealLetter { position: absolute; left: 60px; bottom: 170px; z-index: 4; }
#musicToggle { position: fixed; right: 16px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 5; }
[hidden] { display: none !important; }
button:focus-visible, canvas:focus-visible { outline: 3px solid #228567; outline-offset: 3px; }
@media (max-width: 699px) {
  #stage-host { align-items: flex-start; padding: 36px 0 76px; }
  #reader { position: relative; width: 100%; height: auto; transform: none; padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
  #letter { position: relative; top: auto; left: auto; width: 100%; height: auto; max-height: 48svh; font-size: 17px; line-height: 1.65; order: 2; }
  #clock-box { position: relative; top: auto; left: auto; width: 100%; font-size: 15px; order: 1; }
  #clock-text { font-size: 18px; line-height: 1.5; }
  #clock { margin-left: 0; white-space: normal; line-height: 1.8; }
  #clock .digit { font-size: 27px; }
  #revealLetter { position: relative; left: auto; bottom: auto; margin: 0 24px 10px; }
  #startStory { top: calc(var(--scene-height) * .75); }
  html[data-story="seed"] #reader, html[data-story="growing"] #reader { display: none; }
  #static-canvas.shifted { transform: none; }
}
@media (prefers-reduced-motion: reduce) { #static-canvas { transition: none; } .typewriter-cursor { animation: none; } }
