/* Dialogue is a scene over the world, never the management window's tab strip. */
#modal-backdrop:has(#modal[data-kind=npc-dialogue]){background:linear-gradient(180deg,#050a0d25,#050a0d80 55%,#050a0df2);backdrop-filter:none;padding:20px;align-items:end}
#game:has(#modal-backdrop:not([hidden]) #modal[data-kind=npc-dialogue]) :is(#hud,#quest-tracker){visibility:hidden}
#modal[data-kind=npc-dialogue]{position:relative;width:min(1120px,96cqw);height:min(590px,90cqh);max-height:none;border:0;border-image:none;background:none!important;box-shadow:none;padding:0;overflow:visible}
#modal[data-kind=npc-dialogue]>header{display:none}
#modal[data-kind=npc-dialogue] #modal-body{height:100%;color:#eee9db;line-height:1.6}
.npc-dialogue{position:relative;display:flex;align-items:end;height:100%;isolation:isolate}
.npc-portrait{position:absolute;left:0;bottom:20px;width:36%;aspect-ratio:1;overflow:hidden;pointer-events:none;filter:drop-shadow(0 8px 18px #0008);mask-image:linear-gradient(#000 80%,transparent 97%);-webkit-mask-image:linear-gradient(#000 80%,transparent 97%);animation:npc-enter .2s ease-out}
.npc-portrait img{position:absolute;inset:0;width:100%;height:100%;max-width:none;object-fit:contain;image-rendering:auto}
.npc-art-status{position:absolute;inset:35% 12% auto;text-align:center;font-size:12px;color:#d9d0ba;pointer-events:auto}
#modal-body .npc-art-retry{min-width:0;padding:10px 12px;background:#142120!important;border:1px solid #a08c63;color:#eee5cd;font-size:12px}
.npc-conversation{position:relative;z-index:1;display:flex;flex-direction:column;margin:0 0 24px 37%;width:63%;max-height:calc(100% - 54px);overflow:hidden;background:#141813f5;border:1px solid #80745c88;border-image:none;padding:24px 28px 20px;box-shadow:0 8px 28px #0005;animation:npc-enter .18s ease-out}
.npc-conversation-body{min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#766d59 #141813}
.npc-speaker{display:flex;align-items:center;flex:none;gap:12px;padding:0 0 8px;border:0}
.npc-speaker-info{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 12px;flex:1;min-width:0}
#modal-body .npc-speaker h3{margin:0;color:#e8ddc4;font-size:18px;font-weight:600;letter-spacing:0}
.npc-speaker-info>span{font-size:12px;color:#999f91}
#modal[data-kind=npc-dialogue] .npc-close{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;min-width:0;margin:0;padding:0;border:1px solid #80745c88;border-radius:0;background:transparent!important;box-shadow:none;color:#e8ddc4;font:28px/1 system-ui;text-shadow:none;touch-action:none}
#modal[data-kind=npc-dialogue] .npc-close:hover,#modal[data-kind=npc-dialogue] .npc-close:focus-visible{background:#c1b68b18!important;border-color:#c2b395;outline-offset:2px}
.npc-topic{font-size:12px;color:#cfbd96;line-height:1.5;margin-top:12px}.npc-topic:empty{display:none}
#modal[data-kind=npc-dialogue] .npc-speech{display:block;width:100%;min-width:0;min-height:84px;padding:10px 0 16px;border:0;background:none!important;box-shadow:none;text-shadow:none;text-align:left;color:#eeede4;font-size:16px;font-weight:400;line-height:1.85;word-break:keep-all;overflow-wrap:anywhere;cursor:pointer}
.npc-speech>span{display:block;min-height:3.7em}.npc-speech>small{display:block;text-align:right;font-size:12px;color:#bbae8f;min-height:1.5em}
#modal[data-kind=npc-dialogue] .npc-speech:focus-visible{outline:1px dashed #aea38b80;outline-offset:5px;box-shadow:none}
.npc-speech>small:empty{display:none}
.npc-choices{display:grid;gap:4px;max-height:218px;overflow:auto;overscroll-behavior:contain;margin-top:6px;padding:8px 0 0;border-top:1px solid #8b82633b;scrollbar-width:thin;scrollbar-color:#766d59 #141813}
.npc-conversation-body,.npc-choices,#modal-body .npc-choices button,#modal[data-kind=npc-dialogue] .npc-speech{touch-action:pan-y}
.npc-dialogue:not([data-stage=greeting]) .npc-choices{grid-template-columns:repeat(2,minmax(0,1fr))}
#modal-body .npc-choices button{display:flex;align-items:center;gap:12px;width:100%;min-width:0;min-height:44px;border:1px solid transparent;border-radius:0;background:transparent!important;box-shadow:none;padding:10px 12px;text-align:left;text-shadow:none;line-height:1.45;color:#f4ead2;font-size:14px}
#modal-body .npc-choices button:hover,#modal-body .npc-choices button:focus-visible{background:#c1b68b12!important;border-color:#9e927a66;outline-offset:-2px}
.npc-choices button small{font-size:11px;color:#b9aa83;flex-shrink:0;min-width:64px}.npc-choices button span{flex:1;min-width:0}.npc-choices button i{font-style:normal;color:#999b88}
#modal-body .npc-facts{font-size:12px;color:#d8ddcd;border-top:1px solid #8e7f5b40;padding:10px 0;margin-bottom:10px}
.npc-quest-status{color:#e7d3a5;margin-bottom:5px}.npc-turn-in{margin:5px 0 0!important;color:#adbdb4}
.npc-facts ul{list-style:none;padding:0;margin:0 0 7px}.npc-facts li{display:flex;justify-content:space-between;gap:12px}.npc-facts b{font-weight:400;color:#e0cca2}.npc-rewards{display:flex;align-items:baseline;gap:12px;line-height:1.7;color:#d8c799}.npc-rewards>span{flex-shrink:0;color:#aebbb0}.npc-reward-items{display:flex;flex-wrap:wrap;column-gap:16px;row-gap:2px}.npc-reward-items>span{white-space:nowrap}
#modal-body .npc-response{font-size:12px;color:#d3c4a1;margin:9px 3px 0}.npc-response:empty{display:none}
.content-service-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.content-service-bar>span,.content-wallet{color:#e2c990}.content-wallet{text-align:right;margin-bottom:12px}
@keyframes npc-enter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@container game-viewport (max-height:550px){
  #modal-backdrop:has(#modal[data-kind=npc-dialogue]){padding:8px max(10px,env(safe-area-inset-right)) 8px max(10px,env(safe-area-inset-left))}
  #modal[data-kind=npc-dialogue]{width:100%;height:calc(100cqh - 16px)}
  .npc-portrait{width:32%;left:0;bottom:4px}
  .npc-conversation{margin:0 0 8px 33%;width:67%;max-height:calc(100% - 44px);padding:16px 20px 12px}
  .npc-speaker{padding-bottom:6px;gap:10px}#modal-body .npc-speaker h3{font-size:17px}
  .npc-topic{margin-top:7px}#modal[data-kind=npc-dialogue] .npc-speech{font-size:14px;min-height:76px;line-height:1.7;padding:8px 0 4px}.npc-speech>span{min-height:3.4em}.npc-speech>small:empty{display:none}
  .npc-choices{max-height:134px;gap:5px}#modal-body .npc-choices button{padding:8px 12px;min-height:42px;font-size:13px}.npc-choices button small{min-width:60px}
  #modal-body .npc-facts{padding:7px 0;margin-bottom:6px}.npc-facts ul{margin-bottom:4px}
}
@container game-viewport (max-width:650px){.npc-conversation{margin-left:30%;width:70%;padding-left:14px;padding-right:14px}.npc-portrait{left:0;width:29%}.npc-speaker-info>span{display:none}.npc-choices button small{min-width:52px}.npc-choices{max-height:126px}}
@container game-viewport (max-height:350px){
  .npc-conversation{padding:12px 14px 10px}
  .npc-speaker{padding-bottom:4px}.npc-topic{margin-top:4px}
  #modal[data-kind=npc-dialogue] .npc-speech{min-height:0;padding:6px 0;line-height:1.65;font-size:14px;max-height:92px;overflow:auto}.npc-speech>span{min-height:0}
  #modal-body .npc-facts{padding:5px 0;margin-bottom:4px;max-height:64px;overflow:auto;font-size:12px;line-height:1.5}
  .npc-choices{max-height:126px}#modal-body .npc-choices button{padding:8px 10px;min-height:42px}
}
@media(prefers-reduced-motion:reduce){.npc-portrait,.npc-conversation{animation:none}}
#modal-body .npc-choices button[data-dialogue-action=close]{color:#b4b7a9}
#modal-body .npc-choices button:is([data-dialogue-action=accept],[data-dialogue-action=claim]){background:#82916c20!important;border-color:#929e764d}
#modal[data-kind=npc-dialogue] .npc-speech[data-complete=true]{cursor:default}
#modal[data-kind=npc-dialogue] .npc-speech[data-complete=true]:focus-visible{outline:none}
/* During a Sahar answer/colour decision the dialogue already states the task.
   Reserve the short landscape height for all answers, not a duplicate checklist.
   Full objectives and rewards return immediately after choosing. */
.npc-dialogue[data-side-decision=true] .npc-facts{display:none}
