:root{color-scheme:dark;--ink:#183940;--paper:#fff2cc;--gold:#ffd36b;font-family:"Trebuchet MS",system-ui,sans-serif}*{box-sizing:border-box}body{margin:0;background:#102830;color:var(--paper);user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;overscroll-behavior:none}html,body,#cabinet{width:100%;height:100%;overflow:hidden}#cabinet{display:grid;place-items:center;background:radial-gradient(ellipse at center,#294d52,#102830)}#frame{width:min(100vw,177.778dvh);aspect-ratio:16/9;position:relative;isolation:isolate;container-type:inline-size;background:#376c78;overflow:hidden}canvas{display:block;width:100%;height:100%;touch-action:none;outline:0}button{touch-action:manipulation;cursor:pointer;font-family:inherit;font-weight:800;border:0}button:focus-visible{outline:3px solid white;outline-offset:3px}button:active{transform:translateY(2px)}[hidden]{display:none!important}.screen{position:absolute;inset:0}#home{background:#163c40;overflow:hidden}.cover-art{position:absolute;inset:0;background:linear-gradient(90deg,#15393a 0%,#15393af0 25%,#15393a99 46%,transparent 72%),url(title.webp) center right/cover no-repeat}.home-copy{position:absolute;left:6%;top:50%;transform:translateY(-50%);width:51%;text-shadow:0 2px 3px #122e2e55}.folio,#stop{font:800 clamp(10px,1.55cqw,17px)/1.4 ui-monospace,"Courier New",monospace;letter-spacing:.13em}.home-copy .folio{color:#fee0a0}.home-copy h1{font:1000 clamp(30px,8.1cqw,110px)/.97 "Trebuchet MS",system-ui,sans-serif;letter-spacing:-.075em;margin:3% 0 0;color:#fff6cf;text-shadow:0 .045em #27422e,0 .085em #142e2a;white-space:nowrap}.home-copy h1 em{font-style:normal;color:#ffd36b}.subtitle{font:italic 700 clamp(18px,4.85cqw,68px)/1.05 Georgia,serif;letter-spacing:-.055em;color:#ffcd67}.home-copy p{max-width:32ch;color:#fff3d4;line-height:1.45;font-size:clamp(12px,1.8cqw,23px);margin:5% 0}.home-actions,.menu-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.gold,.ink{padding:.67em 1.12em;border-radius:.45em;font-size:clamp(13px,1.9cqw,24px);line-height:1.15}.gold{color:#173e3c;background:#ffcf67;box-shadow:0 3px 0 #ad7433}.ink{color:#fff3ce;background:#285253}.shade{background:#112c39a8;display:grid;place-items:center}.paper{color:#263f42;background:#fff3d9;border:3px solid #315253;border-radius:14px;padding:clamp(12px,2.5cqw,30px);width:min(76%,660px);box-shadow:0 6px 0 #17393c88;max-height:97%;overflow:auto}.paper.small{width:min(84%,475px)}h2{font:800 clamp(21px,4.2cqw,49px)/1.1 Georgia,serif;letter-spacing:-.045em;margin:.18em 0 .45em}.paper p{line-height:1.45}.menu-actions{gap:12px}.menu-actions .gold{width:100%}#hud{position:absolute;inset:3% 2.4% auto;display:flex;align-items:flex-start;justify-content:space-between;pointer-events:none}#hud .location,.hud-end>span,#pause{border:1px solid #fff0be70;background:#133539e8;color:#fff2c6;box-shadow:0 2px 0 #183b3966;border-radius:7px}.location{padding:.38em .78em;display:flex;gap:.6em;align-items:center}#stop{color:#ffd26e;font-size:clamp(9px,1.25cqw,15px)}#place{font-size:clamp(12px,2.1cqw,26px)}.hud-end{display:flex;align-items:center;gap:6px}.hud-end>span,#pause{padding:.45em .65em;font-size:clamp(12px,1.7cqw,20px)}#pause{pointer-events:auto;min-width:36px}#hint{position:absolute;bottom:13%;left:50%;transform:translateX(-50%);background:#12363def;color:#fff3cc;border:1px solid #ffe4aa88;padding:.55em .85em;border-radius:6px;text-align:center;font-size:clamp(12px,1.75cqw,21px);width:max-content;max-width:78%;pointer-events:none}#touch{position:absolute;inset:auto 2% 2.5%;display:flex;align-items:flex-end;justify-content:space-between;pointer-events:none}.cluster{display:flex;align-items:flex-end;gap:8px}#touch button{pointer-events:auto;touch-action:none;color:#203f42;background:#fff3cedc;border:2px solid #28484a;border-radius:17px;min-width:48px;height:48px;font-size:19px;box-shadow:0 3px 0 #183c4177}#touch #jump{padding:0 12px;background:#ffd371f0}#touch .held{background:#ffb651;transform:translateY(2px)}#dialogue{position:absolute;left:5%;right:5%;bottom:4%;display:flex;align-items:center;gap:16px;color:var(--ink);border:3px solid #264a49;border-radius:10px;background:#fff2d5;box-shadow:0 4px 0 #123b3f80;padding:1.3% 2%}.talk-body{flex:1}#speaker{color:#78502f}#speech{font-size:clamp(14px,2.1cqw,26px);line-height:1.28;margin:.23em 0;font-weight:650}#dialogue button{flex:none}@media(pointer:coarse){#hint{bottom:24%}}@media(max-width:540px) and (orientation:portrait){#frame{width:100%;height:100%;aspect-ratio:auto;overflow:hidden}#world{position:absolute;top:49%;transform:translateY(-50%);height:auto;aspect-ratio:16/9}#touch{bottom:5%}#hud{top:4%}#dialogue{bottom:3%;left:3%;right:3%;gap:8px;padding:10px;max-height:37%;overflow:auto}#speech{font-size:15px}#hint{bottom:17%;max-width:94%}.cover-art{background-position:67% center;background-image:linear-gradient(0deg,#15393a 12%,#15393aee 33%,transparent 68%),url(title.webp)}.home-copy{left:7%;top:auto;bottom:6%;transform:none;width:86%}.home-copy h1{font-size:clamp(38px,11vw,65px)}.subtitle{font-size:clamp(23px,7vw,40px)}.home-copy p{font-size:14px;margin:3% 0 5%}.paper{width:94%}.home-actions button,.menu-actions button{font-size:15px}}

#pause{display:grid;place-items:center;height:2.1em}#pause i{display:block;width:11px;height:14px;border-inline:4px solid currentColor}

#touch :is([data-input="left"],[data-input="right"]){width:62px;min-width:62px;height:62px}

/* Keep the jump thumb target in the same position while swimming and on land. */
#touch #jump{width:72px;height:66px;padding:0;border-radius:22px;touch-action:none}
#touch button.held{background:#ffc65a;box-shadow:inset 0 2px 0 #c79445,0 2px 0 #183c4177}
#frame:has(#dialogue.centred:not([hidden]))::after{content:"";position:absolute;inset:0;background:#142d343a;pointer-events:none}
#dialogue.centred{z-index:2;left:50%;top:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);width:min(67%,570px);max-height:90%;overflow:auto;display:flex;flex-direction:column;align-items:center;text-align:center;gap:clamp(10px,1.7cqw,19px);padding:clamp(15px,2.8cqw,32px);border-radius:14px}
#dialogue.centred #speech{margin:.55em 0 0;text-wrap:pretty}
@media(max-width:540px) and (orientation:portrait){#dialogue.centred{width:90%;padding:20px 16px}}

#end .paper{width:min(92%,710px);text-align:center}
#end h2{margin-bottom:.15em}
#end-text{margin:.4em auto .8em}
#treasure-case{list-style:none;padding:0;margin:0 auto 1em;display:flex;flex-wrap:wrap;justify-content:center;gap:6px}
#treasure-case li{flex:0 0 22%;display:grid;align-content:start;justify-items:center;padding:.25em;background:#f4e7c8;border-radius:8px;line-height:1.15}
#treasure-case canvas{width:clamp(36px,6cqw,70px);height:auto;aspect-ratio:100/76}
#treasure-case strong,#treasure-case span{font-size:clamp(9px,1.3cqw,15px)}
#treasure-case span{font-weight:normal;color:#655b49;padding:.22em 0}
#treasure-case .missed{background:#ece2cd;color:#675f52}
#jump{line-height:1.05}
@media(max-height:415px) and (orientation:landscape){#end .paper{padding:8px 12px}#treasure-case{margin-bottom:.4em}#end h2{font-size:26px}#treasure-case canvas{width:37px}}

/* Keep the friends in view when their conversation opens on the branch. */
#dialogue.centred.treetop{top:4%;transform:translateX(-50%);padding:clamp(10px,1.8cqw,22px);gap:.6em}
@media(prefers-reduced-motion:no-preference){#dialogue.treetop:not([hidden]){animation:treetop-dialogue .22s ease-out}@keyframes treetop-dialogue{from{opacity:0}to{opacity:1}}}
