@font-face { font-family: 'MZTitle'; src: url('../fonts/title.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'MZBody'; src: url('../fonts/body.woff2') format('woff2'); font-display: swap; font-weight: 400 900; }

:root {
  --ink: #12141a; --ink2: #1d222b; --paper: #efe6d2; --paper2: #d9ccb0; --cinnabar: #b8392c; --gold: #d8b25a; --jade: #6f9a8a;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --u: min(1vw, 1vh * 0.62); /* scale unit that works in portrait and landscape */
  --stick: clamp(118px, 30vmin, 176px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0c1016; overflow: hidden; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body { font-family: 'MZBody', 'Noto Serif SC', 'Songti SC', serif; color: var(--paper); }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.screen { position: fixed; inset: 0; opacity: 0; pointer-events: none; transition: opacity .9s ease; }
.screen.show { opacity: 1; pointer-events: auto; }

/* ---------------- boot ---------------- */
#boot { background: radial-gradient(ellipse at 50% 40%, #1c2430 0%, #0c1016 70%); display: grid; place-items: center; z-index: 50; }
.boot-wrap { position: relative; width: 220px; text-align: center; }
.enso { width: 200px; height: 200px; display: block; margin: 0 auto; }
#ensoPath { transition: stroke-dashoffset .4s ease; opacity: .9; }
.boot-char { position: absolute; top: 58px; left: 0; right: 0; font-family: 'MZTitle', serif; font-size: 64px; color: var(--paper); opacity: .92; }
.boot-tip { margin-top: 18px; font-size: 15px; letter-spacing: .6em; text-indent: .6em; color: var(--paper2); }
.boot-sub { margin-top: 10px; font-size: 12px; letter-spacing: .2em; color: #8a8a86; }

/* ---------------- title ---------------- */
#title { z-index: 20; }
.title-art { position: absolute; right: calc(var(--safe-r) + 9vw); top: calc(var(--safe-t) + 9vh); display: flex; gap: 2.2vmin; align-items: flex-start; }
.title-main { margin: 0; font-family: 'MZTitle', serif; font-weight: 400; writing-mode: vertical-rl; font-size: clamp(54px, 13vmin, 120px); line-height: 1; color: var(--paper); text-shadow: 0 0 24px rgba(0,0,0,.6), 0 2px 0 rgba(0,0,0,.4); letter-spacing: .06em; }
.title-main span { display: inline-block; opacity: 0; transform: translateY(-10px) scale(1.08); filter: blur(6px); animation: inkIn 1.4s cubic-bezier(.2,.7,.2,1) forwards; }
.title-main span:nth-child(1) { animation-delay: .3s } .title-main span:nth-child(2) { animation-delay: .55s } .title-main span:nth-child(3) { animation-delay: .8s } .title-main span:nth-child(4) { animation-delay: 1.05s } .title-main span:nth-child(5) { animation-delay: 1.3s }
@keyframes inkIn { to { opacity: 1; transform: none; filter: blur(0); } }
.seal { align-self: flex-end; margin-top: 0; writing-mode: vertical-rl; font-family: 'MZTitle', serif; font-size: clamp(18px, 4vmin, 30px); color: #f3e3c8; background: var(--cinnabar); padding: .35em .22em; border-radius: 4px; box-shadow: inset 0 0 0 2px rgba(255,230,200,.35), 0 4px 18px rgba(0,0,0,.4); opacity: 0; animation: stamp .5s 2.1s cubic-bezier(.3,1.6,.5,1) forwards; transform: scale(1.6) rotate(-8deg); }
@keyframes stamp { to { opacity: .95; transform: scale(1) rotate(-4deg); } }
.title-poem { writing-mode: vertical-rl; font-size: clamp(12px, 2.4vmin, 16px); line-height: 2.1; letter-spacing: .3em; color: rgba(233,223,200,.72); margin-top: 3.5em; opacity: 0; animation: fadeIn 2s 2.4s forwards; }
@keyframes fadeIn { to { opacity: 1 } }
.tap-hint { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 16vh); text-align: center; font-family: 'MZTitle', serif; font-size: clamp(20px, 4.6vmin, 30px); letter-spacing: .5em; text-indent: .5em; color: var(--paper); opacity: 0; animation: fadeIn 1.2s 2.8s forwards, breathe 2.6s 4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { opacity: .9 } 50% { opacity: .35 } }
.tap-hint.gone { animation: none; opacity: 0; transition: opacity .5s; }
.menu { position: absolute; left: calc(var(--safe-l) + 8vw); bottom: calc(var(--safe-b) + 11vh); display: flex; flex-direction: column; gap: 1.6vmin; opacity: 0; pointer-events: none; transform: translateX(-12px); transition: opacity .8s, transform .8s; }
.menu.show { opacity: 1; pointer-events: auto; transform: none; }
.menu-item { position: relative; text-align: left; font-family: 'MZTitle', serif; font-size: clamp(24px, 5.4vmin, 38px); letter-spacing: .28em; padding: .32em 1.2em .32em .9em; color: var(--paper); text-shadow: 0 2px 10px rgba(0,0,0,.6); transition: color .3s, transform .3s; }
.menu-item i { position: absolute; left: 0; top: 50%; width: 100%; height: 1.15em; transform: translateY(-50%) scaleX(0); transform-origin: left; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 40' preserveAspectRatio='none'%3E%3Cpath d='M4 22 C40 8 120 6 200 12 C250 15 286 10 296 18 C280 30 200 34 120 32 C60 31 20 36 4 22Z' fill='%23b8392c' opacity='.85'/%3E%3C/svg%3E") center/100% 100% no-repeat; z-index: -1; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.menu-item:hover i, .menu-item:focus-visible i, .menu-item:active i { transform: translateY(-50%) scaleX(1); }
.menu-item:active { transform: translateX(6px); }
.menu-item[disabled] { opacity: .35; pointer-events: none; }
.title-foot { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 14px); text-align: center; font-size: 11px; letter-spacing: .18em; color: rgba(220,210,190,.42); }

/* ---------------- cards ---------------- */
#cards { z-index: 30; background: radial-gradient(ellipse at 50% 50%, rgba(20,24,30,.55), rgba(8,10,14,.96)); display: grid; place-items: center; }
.card-text { max-width: min(82vw, 560px); padding: 0 6vw; font-size: clamp(18px, 4.6vmin, 28px); line-height: 2.1; letter-spacing: .16em; text-align: center; color: var(--paper); text-shadow: 0 0 20px rgba(0,0,0,.8); }
.card-text .ch { opacity: 0; display: inline-block; filter: blur(4px); transform: translateY(4px); transition: opacity .7s, filter .9s, transform .9s; }
.card-text .ch.on { opacity: 1; filter: none; transform: none; }
.card-text.out { opacity: 0; filter: blur(8px); transition: opacity .8s, filter .8s; }
.card-skip { position: absolute; bottom: calc(var(--safe-b) + 6vh); left: 0; right: 0; text-align: center; font-size: 12px; letter-spacing: .4em; color: rgba(220,210,190,.45); }

/* ---------------- chapter ---------------- */
#chapter { z-index: 31; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 50%, rgba(10,12,16,.3), rgba(8,10,14,.85)); }
.chap-no { font-size: clamp(14px, 3.4vmin, 20px); letter-spacing: .8em; text-indent: .8em; color: var(--paper2); opacity: 0; }
.chap-name { font-family: 'MZTitle', serif; font-size: clamp(90px, 26vmin, 200px); line-height: 1.1; color: var(--paper); text-shadow: 0 0 40px rgba(0,0,0,.7); opacity: 0; transform: scale(1.15); filter: blur(10px); }
.chap-sub { font-size: clamp(12px, 3vmin, 16px); letter-spacing: .5em; text-indent: .5em; color: rgba(233,223,200,.7); opacity: 0; }
#chapter.show .chap-no { animation: fadeIn 1s .2s forwards; }
#chapter.show .chap-name { animation: inkIn 1.6s .5s cubic-bezier(.2,.7,.2,1) forwards; }
#chapter.show .chap-sub { animation: fadeIn 1s 1.4s forwards; }

/* ---------------- HUD ---------------- */
#hud { z-index: 10; transition: opacity .5s; }
#hud.cine .btns, #hud.cine .stick-zone, #hud.cine .hud-top, #hud.cine .objective, #hud.cine .bossbar { opacity: 0; pointer-events: none; }
.hud-top { position: absolute; top: calc(var(--safe-t) + 10px); left: calc(var(--safe-l) + 12px); right: calc(var(--safe-r) + 12px); display: flex; justify-content: space-between; align-items: flex-start; transition: opacity .4s; }
.hud-player { display: flex; align-items: center; gap: 10px; }
.hud-portrait { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #2f4d5c, #16222b); box-shadow: 0 0 0 2px rgba(216,178,90,.75), 0 0 0 5px rgba(10,12,16,.55), 0 4px 14px rgba(0,0,0,.5); font-family: 'MZTitle', serif; font-size: 28px; color: var(--paper); }
.hud-bars { width: min(46vw, 230px); }
.hud-name { font-family: 'MZTitle', serif; font-size: 17px; letter-spacing: .12em; text-shadow: 0 1px 4px #000; }
.hud-name em { font-style: normal; font-family: 'MZBody', serif; font-size: 11px; color: var(--gold); margin-left: 6px; letter-spacing: .08em; }
.hpbar { position: relative; height: 12px; margin-top: 4px; background: rgba(10,12,16,.65); border-radius: 2px; clip-path: polygon(0 20%, 3% 0, 100% 8%, 98% 100%, 2% 92%); }
.hp-fill, .hp-lag { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transform-origin: left; }
.hp-lag { background: #e9dfc8; opacity: .65; transition: transform .6s .25s ease; }
.hp-fill { background: linear-gradient(90deg, #8a2a22, #c8463a 60%, #e06a52); transition: transform .12s; }
.hp-text { position: absolute; right: 6px; top: -1px; font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000; line-height: 14px; }
.hud-ink { margin-top: 4px; font-size: 12px; color: var(--paper2); text-shadow: 0 1px 3px #000; }
.hud-ink b { font-weight: 400; color: var(--gold); margin-right: 6px; }
.hud-pause { width: 42px; height: 42px; border-radius: 50%; background: rgba(10,12,16,.55); box-shadow: 0 0 0 1.5px rgba(233,223,200,.4); display: flex; gap: 5px; align-items: center; justify-content: center; pointer-events: auto; }
.hud-pause i { width: 4px; height: 15px; background: var(--paper); border-radius: 2px; }
.objective { position: absolute; top: calc(var(--safe-t) + 84px); left: calc(var(--safe-l) + 14px); max-width: 70vw; padding: 6px 14px 6px 10px; font-size: 13px; letter-spacing: .06em; background: linear-gradient(90deg, rgba(10,12,16,.7), rgba(10,12,16,0)); border-left: 3px solid var(--cinnabar); text-shadow: 0 1px 3px #000; transition: opacity .5s, transform .5s; }
.objective b { font-weight: 400; font-family: 'MZTitle', serif; color: var(--gold); margin-right: 8px; font-size: 15px; }
.objective.flash { animation: objFlash 1.2s; }
@keyframes objFlash { 0% { transform: translateX(-20px); opacity: 0 } 30% { transform: none; opacity: 1; background-color: rgba(184,57,44,.35) } 100% { background-color: transparent } }
.objective.hide { opacity: 0; }
.bossbar { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 120px); width: min(80vw, 520px); opacity: 0; transition: opacity .6s; pointer-events: none; }
.bossbar.show { opacity: 1; }
.boss-name { text-align: center; font-family: 'MZTitle', serif; font-size: 20px; letter-spacing: .3em; text-shadow: 0 2px 6px #000; }
.boss-name em { font-style: normal; font-family: 'MZBody', serif; font-size: 11px; color: var(--paper2); margin-left: 8px; letter-spacing: .1em; }
.boss-track { position: relative; height: 9px; margin-top: 4px; background: rgba(10,12,16,.7); clip-path: polygon(0 50%, 2% 0, 98% 0, 100% 50%, 98% 100%, 2% 100%); }
.boss-fill, .boss-lag { position: absolute; inset: 0; transform-origin: left; }
.boss-lag { background: #e9dfc8; opacity: .6; transition: transform .8s .3s; }
.boss-fill { background: linear-gradient(90deg, #4a2a6a, #8a4ad0 50%, #b88af0); transition: transform .15s; }

.offarrow { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; opacity: 0; transition: opacity .3s; pointer-events: none; background: radial-gradient(circle, rgba(216,178,90,.25), transparent 70%); }
.offarrow::after { content: ''; position: absolute; inset: 8px; clip-path: polygon(50% 0, 100% 100%, 50% 75%, 0 100%); background: var(--gold); }
.offarrow.show { opacity: .9; }

.hint { position: absolute; left: 50%; bottom: calc(var(--safe-b) + var(--stick) + 64px); transform: translateX(-50%) translateY(10px); padding: 10px 20px; font-size: 14px; letter-spacing: .08em; white-space: nowrap; background: rgba(10,12,16,.72); border-top: 1px solid rgba(216,178,90,.5); border-bottom: 1px solid rgba(216,178,90,.5); opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none; }
.hint.show { opacity: 1; transform: translateX(-50%); }
.hint b { color: var(--gold); font-weight: 400; }

/* joystick — fixed bottom-left */
.stick-zone { position: absolute; left: 0; bottom: 0; width: 46vw; height: 46vh; max-width: 420px; pointer-events: auto; touch-action: none; transition: opacity .4s; }
.stick { position: absolute; left: calc(var(--safe-l) + 26px); bottom: calc(var(--safe-b) + 30px); width: var(--stick); height: var(--stick); }
.stick-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(10,12,16,.15) 40%, rgba(10,12,16,.45) 100%); box-shadow: inset 0 0 0 2px rgba(233,223,200,.28); }
.stick-ring::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; border-top-color: rgba(216,178,90,.55); border-left-color: rgba(216,178,90,.2); transform: rotate(-30deg); }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; margin: -21% 0 0 -21%; border-radius: 50%; background: radial-gradient(circle at 38% 35%, #f6eedb, #c9bb9a 70%); box-shadow: 0 4px 12px rgba(0,0,0,.45), inset 0 -3px 6px rgba(0,0,0,.2); transition: transform .12s; }
.stick.active .stick-knob { transition: none; }
.stick.active .stick-ring { box-shadow: inset 0 0 0 2px rgba(216,178,90,.6); }

.btns { position: absolute; right: calc(var(--safe-r) + 18px); bottom: calc(var(--safe-b) + 22px); width: calc(var(--stick) * 1.55); height: calc(var(--stick) * 1.5); transition: opacity .4s; pointer-events: none; }
.btn { position: absolute; border-radius: 50%; display: grid; place-items: center; pointer-events: auto; touch-action: none; transition: transform .08s, opacity .3s, box-shadow .2s; }
.btn.down { transform: scale(.9); }
.btn-attack { right: 0; bottom: 0; width: calc(var(--stick) * .74); height: calc(var(--stick) * .74); background: radial-gradient(circle at 40% 35%, #c8463a, #7a1f18 80%); box-shadow: 0 0 0 3px rgba(233,223,200,.55), 0 0 0 7px rgba(10,12,16,.4), 0 8px 18px rgba(0,0,0,.5); color: #f6ead0; }
.btn-attack svg { width: 52%; height: 52%; }
.btn-dodge { right: calc(var(--stick) * .86); bottom: calc(var(--stick) * -0.02); width: calc(var(--stick) * .46); height: calc(var(--stick) * .46); background: rgba(10,12,16,.6); box-shadow: 0 0 0 2px rgba(233,223,200,.45); font-family: 'MZTitle', serif; font-size: calc(var(--stick) * .2); }
.btn-skill { width: calc(var(--stick) * .5); height: calc(var(--stick) * .5); background: radial-gradient(circle at 40% 35%, #2f4d5c, #14212a 80%); box-shadow: 0 0 0 2px rgba(216,178,90,.7), 0 6px 14px rgba(0,0,0,.45); font-family: 'MZTitle', serif; font-size: calc(var(--stick) * .135); overflow: hidden; }
.btn-skill span { position: relative; z-index: 2; }
.btn-skill.s1 { right: calc(var(--stick) * .74); bottom: calc(var(--stick) * .5); }
.btn-skill.s2 { right: calc(var(--stick) * .16); bottom: calc(var(--stick) * .84); background: radial-gradient(circle at 40% 35%, #8a6a2a, #3a2a10 80%); }
.btn-skill.locked { opacity: 0; pointer-events: none; transform: scale(.4); }
.btn-skill.unlock { animation: unlockPop .9s cubic-bezier(.2,1.6,.4,1); }
@keyframes unlockPop { 0% { transform: scale(.3); box-shadow: 0 0 0 0 rgba(255,210,120,.9) } 60% { transform: scale(1.2); box-shadow: 0 0 0 26px rgba(255,210,120,0) } 100% { transform: scale(1) } }
.btn .cd { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(8,10,14,.78) var(--p, 0%), transparent 0); z-index: 1; }
.btn.ready { animation: readyGlow .5s; }
@keyframes readyGlow { 50% { box-shadow: 0 0 0 2px #ffe3a0, 0 0 22px rgba(255,220,140,.9) } }

#dmgLayer { position: fixed; inset: 0; pointer-events: none; z-index: 12; overflow: hidden; }
.dmg { position: absolute; left: 0; top: 0; font-family: 'MZTitle', serif; font-size: 26px; color: #f6ecd6; text-shadow: 0 0 2px #000, 0 2px 6px rgba(0,0,0,.8); will-change: transform, opacity; white-space: nowrap; }
.dmg.crit { color: #ffd36a; font-size: 34px; }
.dmg.hurt { color: #ff7a6a; font-size: 22px; }
.dmg.heal { color: #9be0b0; font-size: 20px; }
.dmg.gain { color: #ffd98a; font-size: 18px; font-family: 'MZBody', serif; }

/* ---------------- dialogue ---------------- */
#letterbox i { position: fixed; left: 0; right: 0; height: 0; background: #07090c; z-index: 14; transition: height .7s cubic-bezier(.6,0,.2,1); }
#letterbox .lb-top { top: 0; } #letterbox .lb-bot { bottom: 0; }
#letterbox.on i { height: 9vh; }
.dialog { position: fixed; z-index: 15; left: 50%; bottom: calc(var(--safe-b) + 4vh); width: min(92vw, 760px); transform: translateX(-50%) translateY(16px); opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; padding: 26px 24px 22px; background: linear-gradient(180deg, rgba(16,19,25,.88), rgba(10,12,16,.95)); border-top: 1px solid rgba(216,178,90,.55); border-bottom: 1px solid rgba(216,178,90,.25); box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.dialog.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.dialog::before { content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(216,178,90,.9), transparent); }
.dlg-name { position: absolute; top: -18px; left: 20px; padding: 4px 16px 3px; font-family: 'MZTitle', serif; font-size: 19px; letter-spacing: .2em; background: var(--cinnabar); color: #f6ead0; box-shadow: 0 4px 12px rgba(0,0,0,.4); clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%); }
.dlg-name.n-monk { background: #8a6a3a; } .dlg-name.n-fox { background: #6f9a8a; } .dlg-name.n-boss { background: #4a2a6a; } .dlg-name.n-narr { background: transparent; box-shadow: none; color: var(--paper2); font-family: 'MZBody', serif; font-size: 12px; letter-spacing: .4em; }
.dlg-text { min-height: 3.6em; font-size: clamp(15px, 4.1vmin, 19px); line-height: 1.8; letter-spacing: .05em; color: #efe6d2; }
.dlg-text .narr { color: #b9b2a2; font-style: normal; }
.dlg-next { position: absolute; right: 18px; bottom: 8px; color: var(--gold); font-size: 14px; animation: bob 1s infinite; opacity: 0; }
.dialog.done .dlg-next { opacity: 1; }
@keyframes bob { 50% { transform: translateY(4px) } }
.dlg-skip { position: absolute; top: 6px; right: 12px; font-size: 11px; letter-spacing: .3em; color: rgba(220,210,190,.5); padding: 6px; }

.banner { position: fixed; z-index: 16; left: 0; right: 0; top: 34vh; text-align: center; pointer-events: none; opacity: 0; transition: opacity .6s; }
.banner.show { opacity: 1; }
.banner-line { height: 1px; width: 60vw; margin: 0 auto 12px; background: linear-gradient(90deg, transparent, rgba(216,178,90,.8), transparent); }
.banner-text { font-family: 'MZTitle', serif; font-size: clamp(36px, 10vmin, 72px); letter-spacing: .25em; text-indent: .25em; color: var(--paper); text-shadow: 0 0 30px rgba(0,0,0,.8); }
.banner-sub { margin-top: 6px; font-size: 13px; letter-spacing: .5em; text-indent: .5em; color: var(--gold); }
.banner.show .banner-text { animation: inkIn 1.2s cubic-bezier(.2,.7,.2,1) both; }

.toast { position: fixed; z-index: 17; left: 50%; top: calc(var(--safe-t) + 26vh); transform: translate(-50%, 10px); padding: 12px 26px; background: rgba(10,12,16,.82); border: 1px solid rgba(216,178,90,.6); font-size: 15px; letter-spacing: .1em; opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none; text-align: center; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast b { display: block; font-family: 'MZTitle', serif; font-weight: 400; font-size: 24px; color: var(--gold); letter-spacing: .3em; margin-bottom: 2px; }

/* ---------------- panels ---------------- */
.panel-wrap { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(6,8,10,.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .35s; }
.panel-wrap.show { opacity: 1; pointer-events: auto; }
.panel { position: relative; width: min(86vw, 420px); max-height: 86vh; padding: 34px 28px 26px; color: var(--ink); background:
  radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.35), transparent 60%),
  repeating-linear-gradient(0deg, rgba(120,100,70,.035) 0 2px, transparent 2px 4px),
  var(--paper); box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 0 0 1px rgba(120,90,50,.25), inset 0 0 60px rgba(160,130,80,.25); text-align: center; }
.panel::before, .panel::after { content: ''; position: absolute; left: -10px; right: -10px; height: 14px; background: linear-gradient(180deg, #3a2a20, #1e1612); border-radius: 7px; box-shadow: 0 3px 6px rgba(0,0,0,.4); }
.panel::before { top: -7px; } .panel::after { bottom: -7px; }
.panel.scroll { overflow: auto; }
.panel h2 { margin: 0 0 18px; font-family: 'MZTitle', serif; font-weight: 400; font-size: 32px; letter-spacing: .3em; text-indent: .3em; color: var(--ink); }
.pbtn { display: block; width: 100%; margin: 10px 0; padding: 12px 0; font-family: 'MZTitle', serif; font-size: 22px; letter-spacing: .3em; text-indent: .3em; color: var(--paper); background: var(--ink2); box-shadow: inset 0 0 0 1px rgba(216,178,90,.4); clip-path: polygon(2% 0, 100% 4%, 98% 100%, 0 94%); transition: background .2s, transform .1s; }
.pbtn:active { transform: scale(.97); background: var(--cinnabar); }
.row { display: flex; align-items: center; justify-content: space-between; margin: 14px 4px; gap: 16px; }
.row label { font-family: 'MZTitle', serif; font-size: 20px; min-width: 3em; text-align: left; }
.seg { display: flex; gap: 6px; }
.seg button { padding: 6px 14px; font-family: 'MZTitle', serif; font-size: 18px; color: var(--ink); box-shadow: inset 0 0 0 1px rgba(30,30,30,.35); }
.seg button.on { background: var(--cinnabar); color: var(--paper); box-shadow: none; }
input[type=range] { flex: 1; accent-color: var(--cinnabar); height: 28px; }
.about p { text-align: left; line-height: 1.9; font-size: 15px; letter-spacing: .04em; margin: 8px 0; }
.about p.small { font-size: 12px; color: #5a5246; }
.death { background: radial-gradient(ellipse at 50% 30%, rgba(184,57,44,.25), transparent 60%), var(--paper); }
.death-big { font-family: 'MZTitle', serif; font-size: 48px; letter-spacing: .2em; color: var(--cinnabar); margin-bottom: 8px; }
.death p { font-size: 15px; letter-spacing: .06em; }

/* ---------------- ending ---------------- */
#ending { z-index: 35; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 45%, rgba(20,24,30,.6), rgba(8,10,14,.95)); }
.end-wrap { text-align: center; width: min(86vw, 460px); }
.end-big { font-family: 'MZTitle', serif; font-size: clamp(40px, 11vmin, 76px); letter-spacing: .12em; color: var(--paper); }
.end-seal { display: inline-block; margin: 10px 0 20px; font-family: 'MZTitle', serif; font-size: 34px; color: #f6e3c8; background: var(--cinnabar); padding: 8px 14px; border-radius: 4px; transform: rotate(-6deg); box-shadow: inset 0 0 0 2px rgba(255,230,200,.35); }
.end-stats { font-size: 14px; line-height: 2; letter-spacing: .1em; color: var(--paper2); margin-bottom: 18px; }
.end-next { font-family: 'MZTitle', serif; font-size: 22px; letter-spacing: .2em; color: var(--gold); margin-bottom: 22px; }
.end-next span { font-family: 'MZBody', serif; font-size: 13px; color: rgba(233,223,200,.7); letter-spacing: .12em; }
#ending .pbtn { width: 70%; margin: 0 auto; }

/* ---------------- responsive ---------------- */
@media (orientation: landscape) {
  .title-art { right: calc(var(--safe-r) + 12vw); top: calc(var(--safe-t) + 8vh); }
  .menu { bottom: calc(var(--safe-b) + 12vh); }
  .tap-hint { bottom: calc(var(--safe-b) + 10vh); }
  .objective { top: calc(var(--safe-t) + 80px); }
  .bossbar { top: calc(var(--safe-t) + 14px); }
  .dialog { bottom: calc(var(--safe-b) + 3vh); }
  #letterbox.on i { height: 7vh; }
  .stick-zone { width: 40vw; height: 60vh; }
}
@media (min-width: 768px) and (min-height: 700px) { /* tablets */
  :root { --stick: clamp(150px, 20vmin, 190px); }
  .hud-portrait { width: 64px; height: 64px; font-size: 34px; }
  .hud-bars { width: 300px; } .hpbar { height: 15px; }
  .hud-name { font-size: 20px; }
  .objective { font-size: 15px; top: calc(var(--safe-t) + 100px); }
  .dlg-text { font-size: 20px; }
}
@media (max-height: 430px) { /* small landscape phones */
  :root { --stick: 112px; }
  .hud-portrait { width: 40px; height: 40px; font-size: 22px; }
  .objective { top: calc(var(--safe-t) + 62px); font-size: 12px; }
  .dialog { padding: 20px 18px 14px; }
  .dlg-text { min-height: 2.6em; font-size: 15px; line-height: 1.6; }
}
#title::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 22%; pointer-events: none; z-index: 0; background: linear-gradient(to top, rgba(6,8,12,.82), rgba(6,8,12,0)); }
#title .title-foot { z-index: 2; text-shadow: 0 1px 6px #000; }
