@font-face{font-family:Nunito;src:url('./vendor/nunito.woff2') format('woff2');font-weight:400 900;font-display:swap}
:root{--black:#090b0a;--white:#f6f5ef;--muted:#a1a79f;--green:#bcd77e;--ink:#6c614b;--cream:#fffbe7;--yellow:#fff0a5;font-family:Nunito,sans-serif;color:var(--white);background:var(--black);font-synthesis:none;color-scheme:dark}
*{box-sizing:border-box}
body{margin:0;min-width:280px;min-height:100svh;background:var(--black);overflow-x:hidden}
button,a{-webkit-tap-highlight-color:transparent}
button{font:inherit;cursor:pointer;border:0}
a{color:inherit;text-decoration:none}
button:disabled,[aria-disabled=true]{cursor:default}
button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:3px solid var(--green);outline-offset:5px}
[hidden]{display:none!important}
.sr-only,h1{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.skip-link{position:fixed;z-index:10;left:max(20px,env(safe-area-inset-left));top:-100px;padding:14px 22px;border-radius:22px;background:var(--cream);color:var(--ink);font-weight:800}
.skip-link:focus{top:calc(16px + env(safe-area-inset-top))}

.site-header{position:relative;z-index:3;display:flex;align-items:center;min-height:calc(86px + env(safe-area-inset-top));padding:calc(12px + env(safe-area-inset-top)) max(clamp(20px,4vw,64px),env(safe-area-inset-right)) 0 max(clamp(20px,4vw,64px),env(safe-area-inset-left))}
.wordmark{display:block;width:148px;height:66px}
.wordmark img{display:block;width:100%;height:100%;object-fit:contain}
.world-layout{--column-gap:32px;--hero-anchor:calc((100% - var(--column-gap)) * .3);position:relative;isolation:isolate;display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);column-gap:var(--column-gap);row-gap:0;align-items:center;width:100%;max-width:1060px;margin:0 auto;padding:0 max(24px,env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left))}
.introduction,.welcome{display:contents}
.scene-wrap{position:relative;z-index:0;grid-column:1 / -1;grid-row:1;width:100%;height:clamp(300px,calc(100svh - 370px - env(safe-area-inset-top) - env(safe-area-inset-bottom)),480px);min-height:0;margin:0;touch-action:pan-y;user-select:none}
canvas{display:block;width:100%;height:100%;outline:none}
/* Same orthographic framing as the live scene (5.25 by 4.8 world units). */
#sleeping-poster{position:absolute;inset:0;display:grid;place-items:center;container-type:size;pointer-events:none}
.sleeping-frame{position:relative;width:min(100cqw,109.375cqh);aspect-ratio:35/32}
.sleeping-frame:before,.sleeping-frame:after{content:"";position:absolute;inset:0;background:url('./assets/sleeping.webp') center/100% 100% no-repeat}
.sleeping-frame:before{clip-path:inset(64% 0 0)}
.sleeping-crown{position:absolute;inset:0;width:100%;height:100%;clip-path:inset(0 0 35.8%);transform-origin:38% 64%}
.arriving .sleeping-crown{transition:transform 90ms ease-out}
.arriving:has(#shake:active,#world:active) .sleeping-crown{transform:rotate(-2deg)}
.sleeping-frame:after{mask-image:radial-gradient(ellipse 8% 6% at 59% 81%,black 50%,transparent);transform-origin:59% 87%;animation:sleep-breath 1.9s ease-in-out infinite alternate}
@keyframes sleep-breath{from{transform:scaleY(1)}to{transform:scaleY(1.035)}}
body[data-renderer=poster] #world{opacity:0}
.arriving #fallback{display:none}
.fallback{position:absolute;inset:0;pointer-events:none}
.static-avatar{position:absolute;left:var(--hero-anchor);bottom:10%;height:62%;aspect-ratio:384/512;transform:translateX(-50%);background-image:url('./assets/hello.webp');background-size:100% 100%;background-position:100% 100%;background-repeat:no-repeat}
body[data-renderer=static] #world{visibility:hidden}
body[data-renderer=static] .dialogue,body[data-renderer=static] .choices{animation:none}
.catch-note{position:absolute;top:25%;left:55%;margin:0;padding:12px 19px;border-radius:40% 45% 35% 32% / 45% 47% 38% 32%;background:var(--cream);color:#756344;font-size:20px;font-weight:900;opacity:0;transform:translateY(8px) rotate(-7deg) scale(.8);transition:opacity .15s,transform .3s cubic-bezier(.16,1,.3,1);pointer-events:none}
.catch-note.visible{opacity:1;transform:translateY(0) rotate(-7deg) scale(1)}
.intro-action{grid-column:1 / -1;grid-row:2;position:relative;z-index:2;width:100%;max-width:400px;min-height:60px;margin:0 auto;text-align:center}
.shake-button{position:relative;display:flex;align-items:center;justify-content:center;min-height:44px;margin:0 auto;padding:10px 14px;background:transparent;color:#e8e5d7;font-size:15px;font-weight:650;letter-spacing:.3px;transition:color .15s,transform .15s}
.shake-button:hover{color:#fff4bd}
.shake-button:active{transform:translateY(1px)}
.shake-button:disabled{opacity:.6}
.shake-fill{position:absolute;left:14px;right:14px;bottom:5px;height:1px;background:#ffe697;opacity:.75;transform:scaleX(0);transform-origin:left;transition:transform .15s}
body[data-state=playing] .intro-action{opacity:0;pointer-events:none;transition:opacity .2s}

.dialogue{grid-column:1;grid-row:2;position:relative;isolation:isolate;min-width:0;min-height:152px;padding:33px 34px 31px;color:var(--ink);background:var(--cream);border-radius:48px 58px 44px 54px / 48px 50px 35px 38px;box-shadow:0 3px 0 #d8cfaa;animation:bubble-in .48s cubic-bezier(.16,1,.3,1) both;transform-origin:50% 0}
.dialogue:before,.dialogue:after{content:'';position:absolute;z-index:-1;top:18%;width:45%;height:70%;border-radius:50%;background:var(--cream)}
.dialogue:before{left:-6px;transform:rotate(-2deg)}
.dialogue:after{right:-6px;transform:rotate(2deg)}
.speaker{position:absolute;top:-15px;left:34px;padding:6px 23px 5px;background:#f3bc62;color:#684522;transform:rotate(-5deg);border-radius:45% 43% 46% 41% / 45% 48% 44% 42%;font-size:17px;font-weight:900;line-height:1.3}
.dialogue p{margin:0;font-size:20px;font-weight:850;line-height:1.5;min-height:72px;overflow-wrap:break-word}
#dialogue-visual{white-space:pre-line}
.dialogue-caret{position:absolute;bottom:15px;left:50%;width:13px;height:9px;background:#d5a53f;clip-path:polygon(0 0,100% 0,50% 100%);animation:caret-bob 1.4s ease-in-out infinite}
.choices{position:relative;z-index:2;grid-column:2;grid-row:1 / span 2;align-self:center;justify-self:center;display:flex;flex-direction:column;width:min(100%,255px);min-width:0;margin:0;padding:18px 18px 18px 22px;background:var(--yellow);color:#695b3b;border-radius:43% 36% 37% 40% / 22% 21% 24% 25%;box-shadow:0 3px 0 #bba66c;animation:choices-in .4s .2s both;transform:rotate(-1deg)}
.choice{position:relative;display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:46px;padding:9px 14px 9px 20px;border:0;border-radius:50px;background:transparent;color:#695b3b;font-size:17px;font-weight:750;line-height:1.45;text-align:left;transition:background .16s}
.choice:disabled,.choice[aria-disabled=true]{color:#8a7b52}
.choice.social:not([aria-disabled=true]):focus-visible{background:#f7d35c;outline:none}
.choice.social:before{content:'';position:absolute;left:-18px;width:27px;height:25px;background:var(--cream);border:2px solid #716246;border-radius:8px 13px 12px 6px;clip-path:polygon(0 28%,45% 28%,45% 0,64% 0,64% 33%,100% 33%,100% 60%,72% 60%,72% 100%,10% 100%);opacity:0;transform:rotate(-8deg);filter:drop-shadow(1px 1px 0 #716246)}
.choice.social:focus-visible:before{opacity:1}
.choice:focus-visible{box-shadow:0 0 0 2px #8b7338}
.choices:focus-visible{outline-color:#d9bd65;outline-offset:7px}
.soon,.link-state{flex-shrink:0;font-size:11px;font-weight:700}
.link-state.is-arrow{font-size:18px}

@keyframes breathe{50%{transform:rotate(-15deg) scale(1.12);opacity:.55}}
@keyframes bubble-in{from{opacity:0;transform:translateY(12px) scale(.94)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes choices-in{from{opacity:0;transform:translateY(8px) scale(.96) rotate(-1deg)}to{opacity:1;transform:translateY(0) scale(1) rotate(-1deg)}}
@keyframes caret-bob{50%{transform:translateY(4px)}}

/* Narrow screens follow the conversation: character, greeting, then choices. */
@media(max-width:700px){
  .site-header{min-height:calc(72px + env(safe-area-inset-top));padding:calc(8px + env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) 0 max(20px,env(safe-area-inset-left))}
  .wordmark{width:126px;height:56px}
  .world-layout{--hero-anchor:50%;display:flex;flex-direction:column;align-items:stretch;max-width:540px;padding:0 max(20px,env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left))}
  .scene-wrap{order:1;width:calc(100% + 40px);height:clamp(250px,36svh,340px);margin:0 -20px}
  .static-avatar{height:81%;bottom:6%}
  .intro-action{order:2;min-height:56px}
  .dialogue{order:2;min-height:144px;padding:31px 28px 31px;margin:8px 0 0;border-radius:36px 40px 31px 37px / 38px 37px 29px 27px}
  .dialogue:before{left:-4px}.dialogue:after{right:-4px}
  .dialogue p{font-size:19px;line-height:1.5;min-height:57px}
  .speaker{left:22px;top:-14px;font-size:15px;padding:6px 20px}
  .dialogue-caret{bottom:13px;width:12px;height:8px}
  .choices{order:3;align-self:center;width:min(100%,340px);padding:13px 21px;margin:22px 0 0;border-radius:42px 48px 40px 46px / 35px 38px 32px 36px}
  .choice{min-height:46px;font-size:16px;padding:9px 13px 9px 19px}
  .choice.social:before{left:-13px;width:23px;height:22px}
  .catch-note{top:22%;left:55%;font-size:17px;padding:10px 17px}
}
@media(max-width:360px){
  .site-header{min-height:calc(64px + env(safe-area-inset-top));padding-top:calc(6px + env(safe-area-inset-top))}
  .wordmark{width:114px;height:51px}
  .world-layout{padding-left:max(18px,env(safe-area-inset-left));padding-right:max(18px,env(safe-area-inset-right))}
  .scene-wrap{width:calc(100% + 36px);margin-left:-18px;margin-right:-18px}
  .dialogue{padding:29px 25px 29px;min-height:140px}
  .dialogue p{font-size:17px;min-height:66px}
  .choices{padding:12px 18px;margin-top:20px}
  .choice{font-size:15px;gap:8px}
}

/* Short landscape screens retain two readable columns and natural page scroll. */
@media(orientation:landscape) and (max-height:600px){
  .site-header{min-height:calc(54px + env(safe-area-inset-top));padding-top:calc(4px + env(safe-area-inset-top))}
  .wordmark{width:108px;height:46px}
  .world-layout{--column-gap:24px;--hero-anchor:calc((100% - var(--column-gap)) * .3);display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);column-gap:var(--column-gap);align-items:center;max-width:900px;padding-bottom:calc(18px + env(safe-area-inset-bottom))}
  .scene-wrap{grid-column:1 / -1;grid-row:1;order:initial;width:100%;height:clamp(170px,calc(100svh - 180px - env(safe-area-inset-top) - env(safe-area-inset-bottom)),290px);margin:0}
  .static-avatar{height:62%;bottom:10%}
  .intro-action{order:initial;min-height:44px}
  .dialogue{order:initial;grid-column:1;grid-row:2;margin:0;padding:24px 26px 25px;min-height:112px;border-radius:32px 38px 30px 35px}
  .dialogue p{font-size:17px;line-height:1.4;min-height:48px}
  .speaker{top:-13px;left:20px;font-size:13px;padding:5px 16px}
  .dialogue-caret{bottom:10px;width:10px;height:6px}
  .choices{order:initial;grid-column:2;grid-row:1 / span 2;align-self:center;width:min(100%,235px);margin:0;padding:12px 13px;border-radius:43% 36% 37% 40% / 22% 21% 24% 25%}
  .choice{font-size:15px;min-height:44px;padding:8px 10px 8px 14px;gap:7px}
  .choice.social:before{left:-12px;width:21px;height:20px}
  .catch-note{font-size:16px;top:16%}
}
@media(orientation:landscape) and (max-width:600px){
  .world-layout{--column-gap:20px;grid-template-columns:minmax(0,1fr) minmax(0,1fr);--hero-anchor:calc((100% - var(--column-gap)) * .25)}
  .dialogue{padding-left:19px;padding-right:19px}
  .dialogue p{font-size:16px}
  .choices{padding:10px}
  .choice{font-size:14px;padding-left:10px;padding-right:8px;gap:5px}
  .soon,.link-state{font-size:10px}
}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-delay:0ms!important;transition:none!important;scroll-behavior:auto!important}}
body.less-motion *,body.less-motion *:before,body.less-motion *:after{animation-duration:.01ms!important;transition:none!important}

/* Give the opening its own centered viewport; the greeting keeps its layout. */
body:is([data-state=loading],[data-state=sleeping],[data-state=playing]) .world-layout{display:flex;flex-direction:column;justify-content:center;min-height:calc(100svh - 86px - env(safe-area-inset-top));padding-bottom:calc(28px + env(safe-area-inset-bottom))}
body:is([data-state=loading],[data-state=sleeping],[data-state=playing]) .scene-wrap{flex:none;order:1;width:100%;height:min(64svh,620px);margin:0}
body:is([data-state=loading],[data-state=sleeping],[data-state=playing]) .intro-action{flex:none;order:2;min-height:88px}
.gesture-hint:not(.sr-only){max-width:300px;margin:2px auto 0;padding:0 12px;color:var(--muted);font-size:13px;line-height:1.5;text-wrap:balance}
@media(max-width:700px){
  body:is([data-state=loading],[data-state=sleeping],[data-state=playing]) .world-layout{min-height:calc(100svh - 72px - env(safe-area-inset-top));padding-left:0;padding-right:0}
  body:is([data-state=loading],[data-state=sleeping],[data-state=playing]) .scene-wrap{height:min(108vw,calc(100svh - 192px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));min-height:210px}
}
@media(orientation:landscape) and (max-height:600px){
  body:is([data-state=loading],[data-state=sleeping],[data-state=playing]) .world-layout{min-height:calc(100svh - 54px - env(safe-area-inset-top));padding-bottom:env(safe-area-inset-bottom)}
  body:is([data-state=loading],[data-state=sleeping],[data-state=playing]) .scene-wrap{height:calc(100svh - 142px - env(safe-area-inset-top) - env(safe-area-inset-bottom));min-height:120px}
}

/* Touch returns to the menu, without a sticky mouse-hover selection. */
@media(hover:hover) and (pointer:fine){
  .choice.social:not([aria-disabled=true]):hover{background:#f7d35c;outline:none}
  .choice.social:hover:before{opacity:1}
}
.choice[aria-busy=true] .link-state{font-size:11px;white-space:nowrap}

/* Own the tree gesture so Safari keeps horizontal drags on the canvas. */
body[data-state=sleeping] #world{touch-action:none;cursor:grab}
body[data-state=sleeping] #world:active{cursor:grabbing}
