/* A quiet notebook for the story, a compact command screen for the boss. */
#p01-overlay[hidden],#p01-panel[hidden],#p01-bridge-recipe[hidden],#p01-bridge-confirm[hidden]{display:none!important}
#p01-overlay{position:fixed;inset:0;z-index:200;background:#14251f;overflow:auto;overscroll-behavior:contain;padding:clamp(8px,2vw,24px);padding-bottom:max(14px,env(safe-area-inset-bottom));color:#392d21}
body.p01-active{overflow:hidden}
#p01-content{max-width:760px;margin:0 auto;outline:none}
.p01-story{--opening-height:calc(100dvh - 96px);min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%}.p01-story-nav{width:min(100%,510px)}
.p01-story-nav{display:flex;justify-content:space-between;align-items:center;gap:12px;color:#eee1bd;padding:14px 0}.p01-story-nav button{min-height:44px;background:#eee2c3;color:#433b29}
.p01-fade{animation:p01-appear 1.1s ease-out both}@keyframes p01-appear{from{opacity:0}to{opacity:1}}
.p01-battle{background:#ede4cc;border:1px solid #c4af85;padding:clamp(12px,3vw,24px);border-radius:12px;box-shadow:0 8px 40px #0007}
.p01-battle-title{display:flex;justify-content:space-between;gap:16px;color:#685b45;letter-spacing:.08em;font-size:13px}
.p01-enemy{text-align:center;background:radial-gradient(ellipse at 50% 75%,#c2c59b,#e3dec0 58%,#eae3ce);border-radius:8px;margin-top:14px;padding:12px}.p01-enemy h2{font-size:18px;margin:0}.p01-enemy img{display:block;width:192px;height:192px;image-rendering:pixelated;margin:4px auto}.p01-enemy-hp{max-width:310px;margin:auto}
.p01-battle-party{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0}.p01-unit{background:#fff9e7;border:1px solid #cbbb96;border-radius:7px;padding:10px;min-width:0}.p01-unit h3{font-size:14px;margin:0 0 5px;overflow-wrap:anywhere}.p01-hp{display:flex;flex-direction:column;gap:2px;font-size:11px;color:#665b46}.p01-hp progress{width:100%;height:9px;accent-color:#66815b}.p01-down{opacity:.6}.p01-commands{display:flex;gap:4px;flex-wrap:wrap;margin-top:8px}.p01-commands button{font-size:12px;padding:7px 8px;min-height:38px;background:#eee4c9;color:#443b2b;border:1px solid #bbaa84}.p01-commands button[aria-pressed=true]{background:#536c4b;color:white;border-color:#405738}
.p01-support{padding:12px;background:#ded9bb;border-radius:7px}.p01-support h3{font-size:14px;margin:0 0 8px}.p01-support select,.p01-support button{width:100%;margin:4px 0;min-height:40px}.p01-support small{display:block}.p01-battle-controls{display:flex;gap:8px;margin:12px 0}.p01-battle-controls button{min-height:44px;flex:1}.p01-battle-log{max-height:190px;overflow:auto;font-size:13px;line-height:1.6;border-top:1px solid #bbaa84;padding-top:8px}.p01-battle-log p{margin:3px 0}
#p01-message{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);max-width:90vw;z-index:300;color:#fff3d5;background:#263f32ed;padding:10px 16px;border-radius:8px;pointer-events:auto;cursor:pointer;touch-action:manipulation;white-space:pre-line}#p01-message:empty{display:none}
#p01-message:focus-visible{outline:3px solid var(--lime);outline-offset:3px}
#p01-panel,#p01-bridge-recipe,.p01-test-tools{margin:14px 0;padding:14px;border:1px solid #c1b38d;border-radius:8px;background:#f3edd8}#p01-panel p{white-space:pre-line}#p01-panel small{display:block;margin-top:8px}.p01-party-choice{display:flex;align-items:center;gap:9px;padding:8px 0;border-bottom:1px solid #d5cdb7}.p01-party-choice input{width:20px;height:20px;flex-shrink:0}.p01-test-tools summary{cursor:pointer}.p01-test-tools button{display:block;margin:8px 0}
#p01-bridge-confirm{padding:12px;background:#e4edcc;border:1px solid #8a9e65;border-radius:8px;margin:8px 0}#p01-bridge-confirm button{margin-right:8px}#p01-bridge-cancel{margin:8px}
@media(max-width:430px){.p01-battle{padding:10px}.p01-enemy img{width:144px;height:144px}.p01-enemy{padding:8px}.p01-unit{padding:8px}.p01-commands button{flex:1;padding:7px 3px;font-size:11px}.p01-battle-party{gap:6px}.p01-story-copy{font-size:14px;line-height:1.75}.p01-paper{padding:17px}.p01-paper img{max-height:35dvh}.p01-story-nav{padding:10px 0}}
@media(prefers-reduced-motion:reduce){.p01-fade{animation:none}}

/* The exact opening parchment, silhouette, frame mask and folio are shared. */
#p01-content.p01-story{max-width:none}
#p01-overlay:has(.p01-story){padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));overflow:hidden}
#p01-content.p01-story{--opening-height:calc(100dvh - max(8px,env(safe-area-inset-top)) - max(8px,env(safe-area-inset-bottom)) - 62px)}
#p01-panel,#p01-panel p,#p01-panel small,#p01-panel h3,#p01-panel label,#p01-bridge-recipe,#p01-bridge-recipe p{color:#392d21}
#p01-panel .p01-party-choice{display:grid;grid-template-columns:22px minmax(0,1fr);align-items:start;gap:10px;margin:0;padding:12px 0;font-size:15px;width:100%;min-width:0}
#p01-panel .p01-party-choice input{width:20px;height:20px;margin:3px 0;accent-color:#536c4b}
#p01-panel .p01-party-text{display:block;min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.6}
#p01-panel .p01-party-text strong{display:block;color:#392d21;white-space:normal;overflow:visible}
#p01-panel .p01-party-text small{display:block;margin-top:2px;color:#675943;font-size:12px}
#p01-depart-confirm{width:min(440px,calc(100% - 24px))}

/* Status and placement controls are outside the aspect-ratio map viewport. */
#world{position:absolute;inset:0;width:100%;height:100%}
.p01-map-actions{min-width:0}

#p01-bridge-confirm{color:#392d21;margin:8px 12px}
#p01-bridge-confirm p{color:#392d21}

.p01-skill-menu{margin-top:10px;padding:10px;background:#e4dec2;border:1px solid #b4a27c;border-radius:6px;min-width:0}
.p01-skill-menu p{font-size:12px;line-height:1.6;margin:6px 0;color:#4b402c}.p01-skill-menu select{display:block;width:100%;max-width:100%;min-width:0;margin:8px 0;min-height:40px;font:inherit;color:#392d21;background:#fff9e7}.p01-skill-menu button{font-size:12px;min-height:40px;margin:3px 4px 0 0;padding:7px 9px}.p01-skill-selected{display:block;margin-top:7px;font-size:12px;color:#536541;overflow-wrap:anywhere}.p01-skill-status{font-size:12px;color:#6b5037;margin:8px 0 0}

/* A whole turn stays on the page until the reader explicitly continues. */
.p01-review h2{font-size:21px;color:#3e3928;margin:4px 0 12px}.p01-review-hint{color:#6a6047;font-size:13px}.p01-action-list{list-style:none;margin:18px 0;padding:0;counter-reset:action}.p01-action-list li{counter-increment:action;padding:13px 12px 13px 42px;position:relative;background:#fff9e7;border:1px solid #d1c29d;border-radius:7px;margin:9px 0;font-size:15px;line-height:1.85;overflow-wrap:anywhere;color:#392d21}.p01-action-list li::before{content:counter(action);position:absolute;left:13px;top:14px;font:italic 16px Georgia,serif;color:#827451}.p01-review-next{display:block;position:sticky;bottom:0;width:100%;min-height:52px;margin-top:20px;box-shadow:0 -5px 14px #ede4cc}.p01-log-history{margin:18px 0;color:#504630}.p01-log-history summary{cursor:pointer;padding:10px 0}.p01-result-hp{padding:12px;background:#e0ddc4;border-radius:8px;display:grid;grid-template-columns:minmax(0,1fr) minmax(100px,1fr);gap:10px;align-items:center;font-size:13px;overflow-wrap:anywhere}.p01-reward{color:#4c5c39;line-height:1.7}

/* The illustration supplies the grain and paper colour, without recolouring its art. */
.p01-story .opening-paper::before{border-image-source:none;background:linear-gradient(90deg,#a96c261f,transparent 5%,transparent 95%,#a96c261f);border:0;mix-blend-mode:normal;opacity:1;mask-image:none;-webkit-mask-image:none}
