:root{color-scheme:light;font-family:system-ui,-apple-system,'Hiragino Kaku Gothic ProN',sans-serif;color:#2a2328;background:#fff}
*{box-sizing:border-box}
body{margin:0;height:100dvh;display:flex;flex-direction:column}
button,select{font:inherit;color:inherit;border:0;background:#f3f4f6;border-radius:8px;min-height:44px;padding:8px 12px;touch-action:manipulation}
button:disabled{opacity:.5}
button:focus-visible,select:focus-visible{outline:3px solid #447e80;outline-offset:2px}
[hidden]{display:none!important}
main{max-width:450px;width:100%;margin:auto;flex:1;min-height:440px;padding:3px 8px max(5px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:5px}
.companion{display:flex;align-items:center;gap:8px;min-height:76px}
.companion img{width:76px;height:76px;object-fit:contain}
.companion>div{flex:1;min-width:0}
#cast-name{font-size:11px;color:#6e626a}
#speech{font-size:13px;line-height:1.5;margin:4px 0;background:#fffdf9;border:1px solid #e9dfda;border-radius:5px 16px 16px;padding:7px 10px;min-height:38px}
#stage{position:relative;flex:1;min-height:270px;border-radius:16px;overflow:hidden;background:#b9d9dc}
canvas{width:100%;height:100%;position:absolute;inset:0}
.hud{position:absolute;inset:8px 8px auto;display:flex;align-items:center;justify-content:space-between;gap:5px;font-size:11px}
.hud>span{padding:7px 5px;background:#fffffff0;border-radius:8px}
.hud button{font-size:11px;padding:6px;min-height:44px}
#signal{position:absolute;top:27%;left:12px;right:12px;text-align:center;font-weight:750;font-size:20px;color:#25484d;text-shadow:0 1px 3px #fff;background:#ffffffc9;border-radius:10px;padding:8px;pointer-events:none}
#signal:empty{display:none}
.meters{position:absolute;bottom:12px;left:12px;right:12px;background:#fffffff2;border-radius:12px;padding:10px}
.meter-title{display:flex;justify-content:space-between;font-size:12px;margin:0 0 5px}
.meter-title:nth-of-type(3){margin-top:10px}
.tension-track{position:relative;height:16px;border-radius:8px;background:linear-gradient(90deg,#e4ded8 0 25%,#c9e5d0 25% 75%,#edc0b8 75%);overflow:hidden}
.safe-band{position:absolute;left:25%;width:50%;height:100%;border-inline:1px solid #5c9271}
#needle{position:absolute;left:48%;top:0;height:100%;width:4px;background:#263c43;transform:translateX(-50%)}
progress{display:block;width:100%;height:10px;accent-color:#407b85}
#panel{position:absolute;inset:0;background:#fffdf8f5;display:flex;flex-direction:column;align-items:center;justify-content:safe center;overflow:auto;text-align:center;padding:16px;gap:10px}
#panel h2{font-size:21px;margin:0}
#panel p{font-size:13px;line-height:1.6;margin:0;max-width:320px}
#setup{width:100%}
#casts{display:flex;justify-content:center;gap:8px;margin-bottom:10px}
#casts button{padding:4px;border:2px solid transparent;width:90px;font-size:10px;min-height:88px}
#casts img{width:56px;height:56px;object-fit:contain;display:block;margin:auto}
#casts button[aria-pressed=true]{border-color:#477d85;background:#eef0f3}
#casts button[aria-pressed=true]::after{content:' ✓'}
#area{max-width:220px;margin-left:8px}
#panel .help{margin:10px auto 0;text-align:left;font-size:12px}
#go{background:#315e64;color:white;width:100%;max-width:260px;min-height:48px}
#home{font-size:12px}
#action{flex:none;min-height:58px;background:#315e64;color:#fff;font-size:18px;font-weight:700;touch-action:none;user-select:none;-webkit-user-select:none}
#action:active:not(:disabled){background:#24474c}
#hint,#save-note{font-size:11px;text-align:center;margin:0;color:#6e626a}
#hint{min-height:16px}
dialog{border:1px solid #e3e3e7;border-radius:12px;padding:16px;width:calc(100% - 24px);max-width:420px;max-height:85dvh;color:#2a2328}
dialog::backdrop{background:#26303d66}
.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.dialog-head h2{font-size:18px;margin:0}
#record{font-size:12px;color:#6e626a}
.entry{display:flex;align-items:center;gap:10px;border-top:1px solid #eef0f3;padding:12px 0}
.entry>span{font-size:28px;width:42px}
.entry p{margin:3px 0;font-size:12px;color:#6e626a}
.entry strong{font-size:14px}
@media(max-height:700px){.companion{min-height:62px}
.companion img{width:62px;height:62px}
#panel{padding:10px;gap:7px}
#casts button{min-height:70px}
#casts img{height:42px;width:42px}
#panel .help{font-size:11px;margin-top:7px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}
}


/* Keep status above the hand-operated reel and give the safe zone numeric boundaries. */
.hud>span{white-space:nowrap}
.hud #location{max-width:33%;overflow:hidden;text-overflow:ellipsis}
.hud #score{font-size:10px}
#stage[data-phase="bite"] #signal{border:2px solid #315e64;background:#fffdf8}
#stage[data-phase="caught"] #signal{border:2px solid #477d65}
#stage[data-phase="missed"] #signal{border:1px solid #9a4f48;color:#753b36}
.meter-title span:first-child{min-width:0}
.meter-title span:last-child{flex:none;margin-left:5px}


/* Only the setup choices scroll; the start/retry control keeps its touch size. */
#setup{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 0}
#panel>h2,#panel>p,#go,#home{flex:none}
.hud #location{max-width:48%}
.game-nav-header__actions button{font-size:12px;padding:6px 9px}
#book-open{white-space:nowrap}
