html, body { margin: 0; height: 100%; overflow: hidden; background: #c3c6c4; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; font-family: Georgia, 'Times New Roman', serif; color: #f2ead8; }
button { font: inherit; cursor: pointer; pointer-events: auto; color: inherit; }
.slitframe { position: fixed; inset: 0; pointer-events: none; display: none; background: radial-gradient(ellipse 72% 34% at 50% 48%, transparent 92%, rgba(20,18,14,.98) 100%), linear-gradient(90deg, rgba(20,18,14,.9), transparent 6%, transparent 94%, rgba(20,18,14,.9)); }
body.looking .slitframe { display: block; }

.hud { position: absolute; top: env(safe-area-inset-top, 0); left: 0; right: 0; display: flex; gap: 8px; align-items: flex-start; padding: 7px 8px; background: linear-gradient(rgba(28,24,18,.8), rgba(28,24,18,0)); font-size: 11px; text-shadow: 0 1px 2px #000; }
.hud .leg { flex: 1; }
.hud .leg b { display: block; font-size: 14px; letter-spacing: .5px; color: #ffe2a8; }
.hud .leg i { display: block; height: 5px; margin-top: 4px; background: rgba(0,0,0,.45); border-radius: 3px; overflow: hidden; }
.hud .leg u { display: block; height: 100%; background: #d9b26a; }
.hud .meters { display: grid; grid-template-columns: auto auto; gap: 3px 10px; }
.hud .m { display: flex; align-items: center; gap: 4px; }
.hud .m i { display: block; width: 46px; height: 6px; background: rgba(0,0,0,.45); border-radius: 3px; overflow: hidden; }
.hud .m u { display: block; height: 100%; background: #b8c8a0; }
.hud .m.bad u { background: #e8583b; }
.hud .m.bad { color: #ffb0a0; animation: blink .5s infinite alternate; }
.hud .pause { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(242,234,216,.7); background: rgba(28,24,18,.5); font-weight: 900; font-size: 11px; flex: none; }
@keyframes blink { to { opacity: .55 } }

.side { position: absolute; right: 6px; top: 74px; display: flex; flex-direction: column; gap: 4px; width: 74px; }
.side small { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; opacity: .8; text-shadow: 0 1px 2px #000; margin-top: 4px; }
.side button { padding: 5px 2px; border-radius: 6px; border: 1.5px solid rgba(242,234,216,.45); background: rgba(28,24,18,.62); font-size: 11px; }
.side button.on { background: rgba(217,178,106,.75); color: #1e1a12; border-color: #ffe2a8; font-weight: 700; }
body.looking .side { display: none !important; }

.lookbar { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0 8px; }
.lookbar button { padding: 9px 14px; border-radius: 18px; border: 2px solid #ffe2a8; background: rgba(28,24,18,.78); font-size: 14px; }
.lookbar span { width: 100%; text-align: center; font-size: 13px; text-shadow: 0 1px 3px #000; }
body.looking .lookbar { bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); }

.card { position: absolute; left: 8px; bottom: calc(env(safe-area-inset-bottom, 0px) + 140px); display: none; min-width: 170px; padding: 9px 10px; border-radius: 10px; background: rgba(28,24,18,.88); border: 1.5px solid rgba(242,234,216,.4); pointer-events: auto; }
.card b { display: block; font-size: 15px; } .card small { opacity: .75; }
.card span { display: flex; align-items: center; gap: 6px; font-size: 11px; margin: 6px 0; } .card span i { flex: 1; height: 6px; background: rgba(0,0,0,.5); border-radius: 3px; overflow: hidden; } .card span u { display: block; height: 100%; background: #e8a05b; }
.card .talk { padding: 6px 18px; border-radius: 14px; border: 2px solid #ffe2a8; background: rgba(217,178,106,.25); }
.card .x { position: absolute; top: 4px; right: 4px; border: 0; background: none; font-size: 14px; }

.log { position: absolute; left: 8px; right: 90px; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); font-size: 12px; line-height: 1.35; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.6); }
.log div { margin-top: 2px; } .log b { color: #ffe2a8; font-weight: 400; } .log i { color: #ffc0a8; }
body.looking .log { display: none; }
.marks .mk { position: absolute; transform: translate(-50%, -50%); font-size: 18px; text-shadow: 0 0 6px #000; }
.marks .crawler { color: #ff9a7a; } .marks .tall { color: #ff5a4a; font-size: 26px; } .marks .obstacle { color: #ffe2a8; font-size: 14px; } .marks .ghost { color: #c8d0ff; font-size: 20px; animation: blink .4s infinite alternate; }
.bubbles .bub { position: absolute; transform: translate(-50%, -100%); max-width: 180px; padding: 5px 9px; border-radius: 10px; background: rgba(250,244,230,.95); color: #2a2218; font-size: 12px; line-height: 1.25; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.toast { position: absolute; top: 22%; left: 0; right: 0; text-align: center; font-size: clamp(20px, 6vw, 34px); color: #fff3d8; text-shadow: 0 2px 10px #000, 0 0 2px #000; opacity: 0; transition: opacity .5s; padding: 0 16px; }
.toast small { display: block; font-size: .5em; font-style: italic; margin-top: 4px; }
.toast.on { opacity: 1; }

.modal { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; background: rgba(20,18,14,.55); }
.modal.on { display: flex; pointer-events: auto; }
.sheet { width: min(92vw, 460px); max-height: 88vh; overflow-y: auto; padding: 18px; border-radius: 6px; background: linear-gradient(#efe6d0, #ddd0b0); color: #2a2218; box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 0 2px #6a5a40; }
.sheet h2 { margin: 0 0 10px; font-size: 22px; color: #4a2e1a; font-weight: 700; }
.sheet p { margin: 7px 0; line-height: 1.45; font-size: 15px; }
.sheet .gain { font-style: italic; color: #3a5a2a; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice { padding: 10px 12px; border-radius: 4px; border: 1.5px solid #6a5a40; background: #f8f2e2; color: #2a2218; font-size: 15px; text-align: left; }
.choice b { display: block; } .choice small { display: block; font-style: italic; font-size: 13px; margin-top: 2px; }
.choice.big { background: #5a3e26; color: #f2ead8; text-align: center; font-size: 17px; letter-spacing: 1px; }
.modal.title { justify-content: space-between; padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 24px); background: none; }
.modal.title .art { position: absolute; inset: 0; background: url(art/keyart.webp) center / cover; z-index: -1; }
.modal.title .art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,18,14,.35), rgba(0,0,0,0) 30%, rgba(0,0,0,0) 55%, rgba(20,18,14,.9)); }
.modal.title .logo { margin-top: calc(env(safe-area-inset-top, 0px) + 6vh); text-align: center; }
.modal.title h1 { margin: 0; font-size: clamp(40px, 13vw, 88px); letter-spacing: 6px; color: #f2ead8; text-shadow: 0 4px 0 #2a2218, 0 0 30px rgba(0,0,0,.6); }
.modal.title .logo p { margin: 6px 0 0; letter-spacing: 3px; font-style: italic; font-size: 15px; text-shadow: 0 1px 4px #000; }
.menu { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.menu .big { border: 2px solid #f2ead8; border-radius: 4px; padding: 13px 34px; background: #5a3e26; font-size: 20px; letter-spacing: 3px; }
.menu .tip { max-width: 340px; text-align: center; font-size: 14px; line-height: 1.45; margin: 4px 16px 0; text-shadow: 0 1px 3px #000; }
