/* Story/tribulation additions use existing preparation and character panels. */
.story-availability{margin:5px 3px 0;color:#a7b797;font-size:11px;line-height:1.6}
.story-summary{margin:8px 3px 0;color:#c4d3b8;font-size:12px;line-height:1.6}
.story-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:3px}
.story-chapter-option{position:relative;min-width:0;cursor:pointer}
.story-chapter-option input{position:absolute;opacity:0;width:1px;height:1px}
.story-chapter-copy{display:flex;flex-direction:column;justify-content:center;gap:8px;min-height:84px;padding:12px;border:1px solid #6c875c66;border-radius:8px;background:#172d22;color:#dce5c9}
.story-chapter-copy strong{font-size:13px;line-height:1.5}.story-chapter-status{color:#9fb296;font-size:10px;line-height:1.4}
.story-chapter-option input:checked+.story-chapter-copy{border-color:#c1d99a;background:#2b432b;box-shadow:inset 0 0 0 1px #c1d99a33}
.story-chapter-option input:focus-visible+.story-chapter-copy{outline:2px solid #f4dfa5;outline-offset:3px}
.story-chapter-option input:disabled+.story-chapter-copy{opacity:.55}.story-chapter-option:has(input:disabled){cursor:default}
@media(max-width:440px){.story-options{gap:8px}.story-chapter-copy{min-height:76px;padding:10px}.story-chapter-copy strong{font-size:12px}}
#character-hud .story-buff{border-color:#e6c78577;color:#efdaa1;background:#5b432533;gap:3px}
#character-hud .story-buff .buff-name{font-size:9px}
.tribulation-progress{display:block;margin-top:7px;font-size:10px;color:#dfd0ff;letter-spacing:.4px}
.realm-preparation{margin-top:20px;padding-top:14px;border-top:1px solid #cbb5f02b}.realm-preparation h3{color:#d3c0f2}.realm-materials{border:0;margin:13px 0;padding:0;display:flex;flex-wrap:wrap;gap:8px}.realm-materials legend{font-size:11px;color:#b9b1ca;margin-bottom:10px}.realm-materials label{cursor:pointer;display:flex;align-items:center;gap:5px;color:#d4c8e9;border:1px solid #b5a0db44;border-radius:6px;padding:8px}.realm-materials input{accent-color:#b8a1ed}.realm-materials label:has(input:disabled){opacity:.4;cursor:default}.realm-preparation .secondary-button{min-height:42px;color:#e5d8ff}.realm-preparation .secondary-button:disabled{opacity:.5}
@media(max-width:440px){.prepare-screen .adventure-modes{width:100%;display:flex;gap:3px}.prepare-screen .adventure-mode{flex:1;text-align:center}.prepare-screen .adventure-mode span{padding:10px 8px;font-size:11px}}


.story-recap p{white-space:pre-line;line-height:1.8;font-size:12px;color:#c4ceb7}

#run-summary:has(.tribulation-progress:not(.hidden)) .timer-goal{display:none}

/* Keep the chapter objective readable within the existing progress HUD. */
#run-summary.story-progress{flex-wrap:wrap;gap:3px 9px;max-width:min(440px,calc(100% - 120px - var(--safe-left) - var(--safe-right)))}
#run-summary.story-progress .timer-goal{order:-1;flex-basis:100%;white-space:normal;overflow:visible;color:#e3f1d8;font:600 12px/1.5 "PingFang SC",system-ui,sans-serif;border-left:2px solid #bce6d2;padding-left:7px;text-shadow:0 1px 3px #10231d,0 0 6px #10231d}

/* Scripted conversations own a stable screen-space surface. Gameplay bubbles
   remain a separate presentation system for the free exploration modes. */
#arena .story-dialogue-layer{align-items:flex-end;padding:20px 32px calc(22px + var(--safe-bottom));background:linear-gradient(0deg,#08130cb0,transparent 48%);backdrop-filter:none}
.story-dialogue-panel{position:relative;width:min(1060px,100%);max-height:calc(100% - 42px - var(--safe-top));min-height:184px;padding:22px 28px 8px 180px;border:1px solid #cfcca567;border-radius:3px;background:linear-gradient(100deg,#233a30ed,#152b23f5 55%,#12271ff0);box-shadow:0 8px 36px #06110c70,inset 0 1px #f2e7bd1a;color:#f0eddb;text-align:left;cursor:pointer;touch-action:manipulation}
.story-dialogue-panel:focus{outline:none}
.story-dialogue-portrait-area{position:absolute;left:14px;top:0;bottom:0;width:144px;display:flex;align-items:center;justify-content:center;pointer-events:none}
#story-dialogue-portrait{display:block;width:144px;height:156px;pointer-events:none;background:radial-gradient(ellipse at 50% 50%,#b2c39212,transparent 70%)}
.story-dialogue-copy{min-width:0}.story-dialogue-copy strong{display:table;position:relative;margin-top:-38px;padding:5px 17px;border:1px solid #c9be8c85;border-radius:2px;background:#2c4233;color:#f0dcaa;font-size:16px;line-height:1.5;letter-spacing:2px}.story-dialogue-copy p{font-size:17px;line-height:1.9;min-height:64px;max-height:33vh;overflow:auto;margin:15px 0 0;overflow-wrap:anywhere}
.story-dialogue-footer{display:flex;align-items:center;gap:14px;margin-top:8px;min-height:38px}.story-dialogue-footer button{border:0;background:transparent;color:#a9baa8;min-height:38px;padding:6px 2px;font-size:11px;touch-action:manipulation;cursor:pointer}.story-dialogue-footer #story-dialogue-next{margin-left:auto;color:#e8dcae;font-size:12px;letter-spacing:1px}.story-dialogue-footer #story-dialogue-next::after{content:' ▾';font-size:12px;margin-left:5px}.story-dialogue-footer #story-dialogue-next.story-departure{font-size:14px;font-weight:600;letter-spacing:2px;color:#f2e2ac;padding-inline:12px;border-bottom:1px solid #dbcf9a80}.story-dialogue-footer #story-dialogue-next.story-departure::after{content:' →'}
.story-dialogue-panel button:focus-visible{outline:2px solid #f4dfa5;outline-offset:3px}
.story-preparation .hero-option,.story-preparation .weapon-option{flex-grow:0;flex-basis:max(var(--story-card-min,104px),calc((100% - 20px)/3))}.story-preparation .weapon-option{--story-card-min:96px}
@media(max-width:760px){.story-preparation .hero-option,.story-preparation .weapon-option{flex-basis:max(var(--story-card-min,94px),calc((100% - 16px)/3))}}
@media(max-width:370px){.story-preparation .weapon-option{--story-card-min:88px}}
.story-victory .end-panel{width:min(410px,100%)}.story-victory .end-panel .panel-body{display:none}.story-victory .end-actions{grid-template-columns:minmax(180px,240px);justify-content:center}.story-victory #home-button{margin:0;min-width:180px;color:#e4e9cc}
.story-speaking #joystick,.story-speaking #touch-skill,.story-speaking #game-bottom,.story-speaking #context-action,.story-speaking #touch-context-action,.story-speaking #toast{display:none!important}
/* A quiet line below the upper HUD leaves the center of the world unobscured. */
.story-objective{position:absolute;z-index:4;left:50%;top:calc(64px + var(--safe-top));transform:translateX(-50%);width:min(380px,calc(100% - 520px));padding:0;border:0;border-radius:0;background:none;box-shadow:none;pointer-events:none;color:#e1eed5;text-shadow:0 1px 3px #071c14,0 0 5px #071c14}
.story-objective-heading{display:flex;align-items:center;justify-content:center;min-width:0}.story-objective-heading strong{font:500 12px/1.5 "PingFang SC",system-ui,sans-serif;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.story-stage-progress{margin-top:3px}.story-progress-copy{display:flex;justify-content:space-between;gap:8px;font-size:10px;line-height:1.4;color:#c6d5b7}.story-progress-track{height:2px;background:#29433980;border-radius:2px;overflow:hidden;margin-top:3px}.story-progress-track i{display:block;height:100%;background:#d6d89e;width:0;transition:width .12s linear}
#run-summary.story-progress .timer-goal{display:none}
@media(max-width:900px){.story-objective{top:calc(137px + var(--safe-top));width:min(400px,calc(100% - 28px))}}
.narrow-hud .story-objective{top:calc(168px + var(--safe-top));width:calc(100% - 28px)}
@media(max-height:450px){.story-objective,.narrow-hud .story-objective{top:calc(64px + var(--safe-top));width:min(300px,calc(100% - 420px))}}
@media(max-width:600px){#arena .story-dialogue-layer{padding:20px 10px calc(16px + var(--safe-bottom))}.story-dialogue-panel{min-height:178px;padding:21px 14px 5px 94px}.story-dialogue-portrait-area{left:8px;width:76px}#story-dialogue-portrait{width:76px;height:114px}.story-dialogue-copy strong{font-size:14px;margin-top:-37px;padding:5px 13px}.story-dialogue-copy p{font-size:15px;line-height:1.8;min-height:73px;margin-top:12px}.story-dialogue-footer{gap:13px;margin-top:5px}.story-dialogue-footer button{min-height:40px}.story-dialogue-footer #story-dialogue-next{font-size:11px}}
@media(max-width:350px){.story-dialogue-panel{padding-left:82px;padding-right:11px}.story-dialogue-copy p{font-size:14px}.story-dialogue-footer{gap:10px}.story-dialogue-portrait-area{left:6px;width:66px}#story-dialogue-portrait{width:66px;height:106px}}

/* World conversations share the quiet dialogue palette, with deliberate choices. */
.sidequest-choice-layer{align-items:flex-end;padding:20px;background:linear-gradient(transparent 10%,#10251b44 85%)}
.sidequest-choice-panel{width:min(620px,100%);max-height:calc(100% - 24px);overflow-y:auto;padding:20px 24px 14px;border:1px solid #c1b77a88;border-radius:13px;background:linear-gradient(145deg,#263e32fa,#172d25fc);box-shadow:0 8px 30px #07150f66;color:#eee8cd;outline:none}
.sidequest-choice-speaker{font-size:12px;color:#c5ccaa;letter-spacing:.05em}.sidequest-choice-speaker:empty{display:none}
.sidequest-choice-panel h2{font-size:20px;margin:5px 0 8px;font-weight:650}.sidequest-choice-panel>p{font-size:14px;line-height:1.65;margin:0 0 14px;color:#d7dcc7}.sidequest-choice-panel>p:empty{display:none}
#sidequest-choice-options{display:grid;gap:8px}.sidequest-choice-option{display:flex;flex-direction:column;gap:4px;text-align:left;width:100%;padding:11px 14px;border:1px solid #a8b3875c;border-radius:7px;background:#52644735;color:#ece6c8;cursor:pointer}
.sidequest-choice-option strong{font-size:14px;font-weight:600}.sidequest-choice-option span{font-size:12px;line-height:1.5;color:#bfc9af}.sidequest-choice-option:disabled{opacity:.45;cursor:default}.sidequest-choice-option:focus-visible{outline:2px solid #e1d29a;outline-offset:2px}.sidequest-choice-option:active{background:#71815b55}
.sidequest-choice-panel footer{display:flex;justify-content:flex-end;margin-top:10px}.sidequest-choice-panel footer button{border:0;background:transparent;color:#bcc6b0;padding:8px 4px;font-size:12px;cursor:pointer}.sidequest-choice-panel footer button:focus-visible{outline:2px solid #e1d29a}
@media(hover:hover){.sidequest-choice-option:not(:disabled):hover{border-color:#c7ca9a;background:#64754b50}}
@media(max-width:600px){.sidequest-choice-layer{padding:12px 10px max(14px,env(safe-area-inset-bottom))}.sidequest-choice-panel{padding:15px 15px 10px;border-radius:10px;max-height:70%}.sidequest-choice-panel h2{font-size:18px}.sidequest-choice-option{padding:11px 12px}}
