/* Dialogue occupies an overlay, so the merge board keeps its existing layout. */
#modal.story-sheet{width:calc(100% - 24px);max-width:510px;max-height:calc(var(--app-height) - 24px);padding:0;border:3px solid #b7996d;border-radius:25px;background:#fcf3df;overflow:auto;box-shadow:0 0 0 3px #eddbb866,0 18px 70px #26351e99}
.story-sheet .dialog-header{margin:0;padding:9px 12px 9px 17px;min-height:62px;gap:8px;border-bottom:2px solid #c8ceab;background:linear-gradient(110deg,#758d5f,#9bab7c);position:sticky;top:0;z-index:3}
.story-sheet .dialog-header h2{font-size:17px;line-height:1.4;color:#fff9e9;letter-spacing:0;text-shadow:0 2px #55674333}
.story-sheet #modal-close{width:44px;height:44px;min-width:44px;min-height:44px;border:2px solid #e6ddb3;color:#fffbea;background:#8a9e70;font-size:28px;box-shadow:0 2px 0 #536b4b55}
.story-illustration{height:220px;position:relative;overflow:hidden;background:#d1ddbc;isolation:isolate}
.story-room{position:absolute;width:100%;height:100%;inset:0;filter:brightness(.96)}
.story-illustration:after{content:'';position:absolute;bottom:0;left:0;right:0;height:64px;z-index:1;background:linear-gradient(transparent,#5b604936);pointer-events:none}
.story-episode{position:absolute;top:11px;left:12px;background:#fff5dfeb;border:1px solid #d6bf96;border-radius:14px;font-size:10px;color:#796348;padding:6px 10px;z-index:2}
.story-character{position:absolute;bottom:-6px;left:50%;transform:translateX(-50%);width:215px;height:205px;z-index:1;filter:drop-shadow(0 3px 3px #41351d33)}
.story-character svg{display:block;width:100%;height:100%;max-width:none}
.story-location{position:absolute;bottom:10px;right:11px;font-size:9px;color:#fff8e7;z-index:2;text-shadow:0 1px 3px #493c27}
.story-conversation{position:relative;padding:15px 15px 10px;background:linear-gradient(#fbf0d8,#fff8e8)}
.story-dialogue{position:relative;border:2px solid #d6bf90;border-radius:21px;background:#fffcef;box-shadow:0 3px 0 #d6bd8c33;padding:26px 15px 17px;min-height:135px}
.story-speaker{position:absolute;top:-13px;left:15px;padding:6px 17px;border-radius:12px 12px 12px 3px;border:1px solid #9a754f;color:#fff9e8;background:linear-gradient(#ba916c,#a67754);font-weight:800;font-size:14px;box-shadow:0 2px #8f6b4a22}
.owner-turn .story-speaker{left:auto;right:15px;border-radius:12px 12px 3px 12px;background:linear-gradient(#8fa974,#728d56);border-color:#6f8455}
.owner-turn .story-dialogue{border-color:#aaba8a;background:#f6faed}
.story-dialogue .story-line{margin:0;font-size:16px;line-height:1.85;color:#674d39;word-break:keep-all;overflow-wrap:anywhere;letter-spacing:-.25px}
.story-controls{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:12px}
.story-controls button{min-height:46px;border:1px solid #c6ba91;border-radius:13px;background:#efe4c8;color:#7c694c;padding:9px 14px;font-size:12px;font-weight:700}
.story-controls button:disabled{opacity:.45}
.story-controls .story-next{min-width:106px;border-color:#78944f;background:linear-gradient(#99b477,#7d9b59);color:#fffbea;box-shadow:0 3px 0 #617c45;font-size:14px}
.story-controls .story-progress{font-size:10px;color:#a08c68;text-align:center}
.story-skip{display:block;margin:6px 0 0 auto;min-height:44px;padding:7px 3px 3px 15px;border:0;background:none;color:#a28d6b;font-size:11px}
.story-controls button:focus-visible,.story-skip:focus-visible,.story-history-button:focus-visible{outline:3px solid #cf9950;outline-offset:3px}
.story-ending .story-dialogue{min-height:0}
.story-ending h3{font-size:17px;margin:0 0 8px;color:#708850}
.story-ending p{font-size:12px;line-height:1.7;margin:5px 0;color:#886e51}
.story-gifts{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}
.story-gifts>span{display:grid;grid-template-columns:46px minmax(0,1fr);grid-template-rows:auto auto;column-gap:7px;align-items:center;flex:1 1 160px;padding:7px;background:#f1e7cd;border-radius:12px;min-width:0}
.story-gifts i{width:46px;height:46px;grid-row:1/3}
.story-gifts i>svg,.story-gifts .machine-art{width:100%;height:100%}
.story-gifts b{font-size:11px;overflow-wrap:anywhere}
.story-gifts small{font-size:9px;color:#9c8461}
.story-replay-note{background:#eef2de;border-radius:12px;padding:10px;font-size:11px;color:#829263;margin-top:12px}
.story-sheet .story-extra-gift{font-size:11px;background:#f3e9cc;border-radius:9px;padding:7px;margin-top:6px}
.patron-card .story-history{display:grid;gap:7px;margin-top:9px}
.patron-card .story-history-button{display:flex;align-items:center;gap:9px;width:100%;min-height:48px;text-align:left;padding:8px 9px;background:#fff9e8;border:1px solid #dac79e;border-radius:12px;color:#816343;box-shadow:0 2px #dbcaab33}
.story-history-button>span:first-child{display:grid;place-items:center;flex-shrink:0;width:26px;height:26px;border-radius:9px;background:#e4d8b6;color:#92764d;font-size:10px}
.story-history-button strong{font-size:11px;line-height:1.5}
.story-history-button small{margin-left:auto;color:#889461;font-size:9px;white-space:nowrap}
@media(max-width:350px){#modal.story-sheet{width:calc(100% - 16px);border-radius:21px}.story-illustration{height:178px}.story-character{width:182px;height:172px}.story-conversation{padding:14px 10px 7px}.story-dialogue{padding:24px 12px 14px;min-height:130px}.story-dialogue .story-line{font-size:14px}.story-sheet .dialog-header h2{font-size:15px}.story-controls .story-next{min-width:92px}}
@media(max-height:650px) and (orientation:portrait){.story-illustration{height:170px}.story-character{width:180px;height:170px}.story-dialogue{min-height:124px}.story-dialogue .story-line{font-size:14px}}
@media(orientation:landscape) and (max-height:600px){#modal.story-sheet{max-width:760px;max-height:calc(var(--app-height) - 16px)}.story-sheet .dialog-header{min-height:54px;padding-top:5px;padding-bottom:5px}.story-scene{display:grid;grid-template-columns:minmax(170px,.9fr) minmax(250px,1.3fr)}.story-illustration{height:100%;min-height:244px}.story-character{height:215px;width:225px}.story-episode{font-size:9px;padding:5px 7px}.story-conversation{padding-top:22px}.story-dialogue{min-height:126px}.story-dialogue .story-line{font-size:14px}.story-controls{margin-top:10px}.story-controls button{min-height:44px}.story-skip{margin-top:4px}.story-location{display:none}}
