/* Room companions share a dialogue panel. */
.ng { --ng-ink: #20392e; --ng-rule: #c8cbb8; --ng-paper: #f8f5eb; }
button.ng-launch {
  display: inline-flex; align-items: center; gap: 10px; min-height: 46px; max-width: 100%;
  padding: 4px 11px 4px 4px; margin: 4px 0 12px; border: 1px solid #b6c2ae; border-radius: 27px;
  background: #edf1e6; color: var(--ng-ink); text-align: start; cursor: pointer;
}
.ng-small-portrait { display:block; width:38px; height:38px; border-radius:50%; object-fit:cover; background:#dcdac4; }
.ng-call-name { font:600 15px/1.25 var(--serif,Georgia,serif); }
.ng-call-bubble { border-inline-start:1px solid #bfccb7; padding-inline-start:9px; font:500 12px/1.35 var(--sans,system-ui,sans-serif); }
.ng-launch:hover { background:#e4ecd9; border-color:#83977c; }
dialog.ng-dialog {
  --ng-ink: #20392e; --ng-rule: #cecfbc; --ng-paper: #f8f5eb;
  inset: auto 0 max(18px,9dvh); margin: 0 auto; padding: 0; width:min(530px,calc(100vw - 32px));
  max-width: calc(100vw - 20px); max-height: calc(86dvh - 14px); overflow-y: auto;
  overscroll-behavior:contain; background:var(--ng-paper); color:var(--ng-ink);
  border:1px solid #bcb899; border-radius:16px; box-shadow:0 18px 80px #10281fa6; text-align:start;
  font: 15px/1.55 var(--sans,system-ui,sans-serif);
}
dialog.ng-dialog::backdrop { background: rgba(16,30,24,.45); backdrop-filter:blur(2px); }
.ng-header {
  display:grid; grid-template-columns:68px 1fr auto; gap:15px; align-items:center;
  margin:0; padding:16px 20px; position:sticky; top:0; z-index:1;
  background:#203c30; color:#f9f5e4; border-bottom:2px solid #c1a66e;
}
.ng-portrait { width:68px; height:68px; border-radius:9px; object-fit:cover; box-shadow:0 0 0 1px #e3ce9a70; background:#c3c6ad; }
.ng-role { font: 500 12px/1.35 var(--sans,system-ui,sans-serif); color:#dfd5b2; }
.ng-dialog .ng-name { font:500 25px/1.14 var(--serif,Georgia,serif); color:inherit; margin:3px 0 0; }
.ng-name:focus:not(:focus-visible), .ng-line:focus:not(:focus-visible) { outline:none; }
.ng-controls { display:flex; align-items:center; gap:6px; align-self:start; }
.ng-dialog button { cursor:pointer; touch-action:manipulation; }
.ng-controls button {
  display:grid; place-items:center; min-width:34px; min-height:34px; padding:2px 6px;
  background:transparent; border:1px solid #7b8f77; color:#f4ecd1; border-radius:17px;
}
.ng-controls button:hover { background:#345642; }
.ng-language { font:600 12px/1.1 var(--sans,system-ui,sans-serif); }
.ng-done { font:400 22px/1 var(--sans,system-ui,sans-serif); }
.ng-body { padding:19px 22px 15px; }
.ng-dialog .ng-line { font:500 17px/1.55 var(--serif,Georgia,serif); color:#253b2d; margin:0 0 15px; text-wrap:pretty; }
.ng-dialog:lang(zh) .ng-line { line-height:1.75; }
.ng-choices { display:grid; gap:6px; margin:0 0 8px; }
.ng-choices button {
  position:relative; display:flex; align-items:center; justify-content:space-between; gap:10px;
  text-align:start; font:500 14px/1.4 var(--sans,system-ui,sans-serif);
  min-height:41px; padding:8px 13px; border:1px solid var(--ng-rule); border-radius:7px;
  background:#fffdf6; color:var(--ng-ink);
}
.ng-choices .ng-option::after { content:'›'; color:#61765d; font:20px/1 Georgia,serif; }
.ng-choices .ng-option:hover { background:#eaf0e1; border-color:#879e7e; }
.ng-choices .ng-action, .ng-form .ng-go { background:#2c4937; color:#fff9e8; border-color:#2c4937; }
.ng-choices .ng-action:hover,.ng-form .ng-go:hover { background:#3c5841; }
.ng-action::after { content:'→'; }
.ng-more { display:flex; align-items:center; gap:16px; }
.ng-more .ng-text { border:0; background:none; padding:6px 0; min-height:32px; font:500 13px/1.3 var(--sans,system-ui,sans-serif); color:#426348; text-decoration:underline; text-underline-offset:3px; }
.ng-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 8px; margin:12px 0 6px; }
.ng-form-label { grid-column:1/-1; font-size:13px; font-weight:600; }
.ng-form .ng-input { background:#fffefa; color:#213a2a; border:1px solid #a2b39d; border-radius:6px; padding:9px 10px; min-width:0; font:16px/1.35 var(--sans,system-ui,sans-serif); }
.ng-form .ng-go { border:1px solid; border-radius:6px; padding:8px 13px; font:500 14px/1.3 var(--sans,system-ui,sans-serif); }
.ng-dialog button:focus-visible, .ng-launch:focus-visible, .ng-input:focus-visible { outline:3px solid #a88440; outline-offset:2px; }
@media (max-width:520px) {
  dialog.ng-dialog { bottom:max(8px,env(safe-area-inset-bottom)); width:calc(100vw - 16px); max-width:calc(100vw - 16px); max-height:calc(95dvh - 10px); border-radius:12px; }
  .ng-header { grid-template-columns:52px minmax(0,1fr) auto; padding:12px 13px; gap:10px; }
  .ng-portrait { width:52px; height:52px; }
  .ng-dialog .ng-name { font-size:21px; }
  .ng-body { padding:14px 14px 12px; }
  .ng-dialog .ng-line {font-size:16px;}
  .ng-choices button {min-height:43px;}
}
@media (max-height:440px) { dialog.ng-dialog{bottom:5px;max-height:calc(100dvh - 10px)} .ng-header{position:static;} }

.ng-guide-badge {
  display:grid; place-items:center; flex:none; isolation:isolate; position:relative;
  background:var(--ng-seal,#3b5643); color:#fff9df; font:500 31px/1 var(--serif,Georgia,serif);
}
.ng-guide-badge::before { content:''; position:absolute; inset:4px; border:1px solid #fff6d77a; border-radius:inherit; }
.ng-small-portrait.ng-guide-badge { font-size:20px; }
.ng-small-portrait.ng-guide-badge::before { inset:3px; }
.ng-dialog .ng-source {display:inline-block;margin:0 0 16px;color:#345d48;text-underline-offset:3px}
.ng-answer-kind {display:block;margin-bottom:5px;color:#50654d;font-size:13px}
.ng-dialog .ng-condition{margin:0 0 8px;color:#52634e;font:500 13px/1.5 var(--sans,system-ui,sans-serif)}
.ng-dialog .ng-source + .ng-source{display:block;width:fit-content}

/* Character dialogue stays in the room. The reply dock and speech tail are
   independent so a long question list never covers the speaking character. */
.npc-speaking :is(.ww-top,.ww-hint,.ww-stick,.ww-actions,.ww-toast,.hs-head,.hs-hint,.hs-actions,.hs-stick,.hs-near-guide,.hs-passage,.hs-message,.hs-recitation,.npc-invitation){visibility:hidden}
.ww .npc-invitation,.hs .npc-invitation{
  position:absolute;z-index:2;transform:translate(-50%,-100%);padding:7px 12px;border:1px solid #d6c59f;border-radius:12px 12px 12px 3px;
  background:#fff5ddf5;color:#293a2c;font:500 13px/1.3 var(--sans);max-width:185px;box-shadow:0 3px 12px #1e231d3b;
}
.npc-invitation:after{content:'';position:absolute;left:calc(var(--tip,50%) - 4px);bottom:-5px;width:8px;height:8px;transform:rotate(45deg);background:#fff5dd;border-right:1px solid #d6c59f;border-bottom:1px solid #d6c59f}
.npc-invitation[hidden]{display:none!important}
dialog.ng-scene{
  --speaker-y:45vh;--speaker-x:50vw;--chat-height:100dvh;position:fixed;inset:var(--chat-top,0px) 0 auto;margin:0;padding:0;
  width:100%;max-width:none;height:var(--chat-height);max-height:none;overflow:hidden;border:0;border-radius:0;background:transparent;box-shadow:none;
}
dialog.ng-scene::backdrop{background:transparent;backdrop-filter:none}
.ng-scene .ng-speech{
  --bubble-width:min(430px,calc(100% - 24px));position:absolute;box-sizing:border-box;
  width:var(--bubble-width);left:clamp(12px,calc(var(--speaker-x) - var(--bubble-width) / 2),calc(100% - var(--bubble-width) - 12px));
  bottom:clamp(calc(var(--chat-height) * .48),calc(var(--chat-height) - var(--speaker-y) + 12px),calc(var(--chat-height) * .77));
  padding:11px 17px 12px;border:1px solid #baaa86;border-radius:15px;background:#fff8e9;color:#253a2c;box-shadow:0 5px 21px #19291f44;
}
.ng-scene .ng-speech:after{content:'';position:absolute;bottom:-7px;left:calc(50% - 6px);width:12px;height:12px;transform:rotate(45deg);background:#fff8e9;border:solid #baaa86;border-width:0 1px 1px 0}
.ng-scene .ng-header{display:block;position:static;padding:0;margin:0 0 5px;border:0;background:transparent;color:#445d43}
.ng-scene .ng-identity{display:flex;align-items:baseline;gap:7px}
.ng-scene .ng-role{color:#5c6e59;font-size:11px}
.ng-scene .ng-name{margin:0;color:#355038;font:600 15px/1.25 var(--serif)}
.ng-scene .ng-portrait{display:none}
.ng-scene .ng-speech-words{max-height:min(27dvh,calc(var(--chat-height) * .26));overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;text-align:left}
.ng-scene .ng-line{margin:0;font-size:16px;line-height:1.5}
.ng-scene:lang(zh) .ng-line{line-height:1.6}
.ng-scene .ng-source{font-size:12px;margin:6px 0 0}
.ng-scene .ng-answer-kind{font-size:11px;margin-bottom:3px}
.ng-scene .ng-body{
  position:absolute;left:50%;bottom:max(10px,env(safe-area-inset-bottom));transform:translateX(-50%);
  width:min(660px,calc(100% - 24px));max-height:39%;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;
  padding:9px 13px 12px;background:#20392ff5;color:#fff3d8;border:1px solid #bbab82;border-radius:13px;box-shadow:0 5px 19px #15231c42;
}
.ng-reply-toolbar{display:flex;justify-content:space-between;gap:8px;align-items:center;margin-bottom:7px}
.ng-question{font:500 13px/1.35 var(--sans);color:#e5d9bb}
.ng-scene .ng-controls button{min-width:33px;min-height:30px}
.ng-scene .ng-choices{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:4px}
.ng-scene .ng-choices button{min-height:35px;font-size:13px;padding:6px 10px;border-color:#647767;color:#fbf2df;background:#355043}
.ng-scene .ng-choices button:hover{background:#496553}
.ng-scene .ng-choices .ng-action{background:#f1dfb7;color:#20392f}
.ng-scene .ng-choices .ng-option:after{color:#c4c9ab;font-size:15px}
.ng-scene .ng-more .ng-text{color:#ede0b9;min-height:29px;padding:3px 0}
.ng-scene .ng-form{margin:5px 0 0;align-items:stretch}
.ng-scene .ng-form-label{position:absolute;clip-path:inset(50%);width:1px;height:1px;overflow:hidden}
.ng-scene .ng-input{background:#faf6e9;font-size:16px;padding:6px 9px}
.ng-scene .ng-form .ng-go{border-color:#ddc794;background:#ead6a8;color:#22382a}
@media(max-width:650px){.ng-scene .ng-speech{--bubble-width:min(370px,calc(100% - 24px))}.ng-scene .ng-body{padding:8px 10px 9px;max-height:38%}.ng-scene .ng-line{font-size:15px}.ng-scene .ng-choices button{min-height:38px}}
@media(max-height:490px) and (min-width:651px){
  .ng-scene .ng-body{left:auto;right:10px;width:42%;transform:none;max-height:68%}
  .ng-scene .ng-speech{--bubble-width:45%;left:3%;bottom:55%}
}
.ng-scene.ng-flat .ng-header {display:flex;gap:8px;align-items:center}
.ng-scene.ng-flat .ng-portrait {display:grid;place-items:center;width:30px;height:30px;border-radius:50%;font-size:16px}

.ng-dialog .ng-line {white-space:pre-line}
.ng-dialog .ng-conclusion {margin:8px 0 4px;color:#253e30;font:500 15px/1.52 var(--sans,system-ui,sans-serif)}
.ng-dialog .ng-conclusion strong {font-weight:650}
.ng-dialog .ng-caution {display:block;margin:8px 0 11px;color:#59674e;font:500 12px/1.5 var(--sans,system-ui,sans-serif)}
.ng-scene .ng-caution {margin-bottom:0}
.ng-dialog .ng-line:focus {outline:none}
.ng-connection,.ng-draw-context{grid-column:1 / -1;margin:0}
.ng-connection{font:400 12px/1.4 var(--sans,system-ui,sans-serif);color:#526759}
.ng-scene .ng-connection{color:#d1dacb}
.ng-draw-context{color:var(--ng-ink);font-size:14px}
.ng-speech-words .ng-line,.ng-body .ng-line{white-space:pre-line}
.ng-credit-entry { grid-column:1/-1; justify-self:start; color:inherit; background:transparent; border:0; padding:4px 0; font:600 13px/1.4 var(--sans); text-decoration:underline; text-underline-offset:3px; cursor:pointer; }
dialog.ng-credit-dialog { position:fixed; inset:0; margin:auto; width:min(435px,calc(100vw - 32px)); max-height:85dvh; overflow-y:auto; box-sizing:border-box; padding:18px; background:#faf5e8; color:#20392e; border:1px solid #bcb899; border-radius:14px; box-shadow:0 10px 40px #10281f66; text-align:start; font:15px/1.5 var(--sans, system-ui, sans-serif); }
dialog.ng-credit-dialog::backdrop { background:#142c25aa; }
.ng-credit-dialog header { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.ng-credit-dialog h2 { font:500 22px/1.2 var(--serif); margin:0; color:inherit; }
.ng-credit-dialog form,.ng-credit-dialog section { display:grid; gap:8px; }
.ng-credit-dialog p,.ng-credit-dialog label { margin:0; }
.ng-credit-dialog .ng-credit-balance { margin:12px 0 0; font-weight:600; }
.ng-credit-dialog textarea { display:block; box-sizing:border-box; width:100%; margin:4px 0; padding:7px; color:#20392e; border:1px solid #8ea08d; border-radius:6px; background:#fffdf6; font:16px/1.4 var(--sans); }
.ng-credit-dialog button,.ng-credit-dialog a.ng-credit-primary { display:inline-block; margin:0; padding:7px 10px; border:1px solid #a6af9e; border-radius:7px; background:transparent; color:#243f32; font:600 14px/1.4 var(--sans); cursor:pointer; text-decoration:none; }
.ng-credit-dialog .ng-credit-primary { background:#294b3c!important; color:#fff7dd!important; border-color:#294b3c!important; }
.ng-credit-dialog button:disabled { opacity:.55; cursor:default; }
.ng-credit-dialog small,.ng-credit-disclosure,.ng-credit-dialog details,.ng-credit-summary { font-size:13px; line-height:1.45; }
.ng-credit-dialog section:empty,.ng-credit-dialog .ng-credit-status:empty { display:none; }
.ng-credit-dialog .ng-credit-summary,.ng-credit-dialog details[open] { max-height:13em; overflow-y:auto; background:#eeeada; padding:8px 10px; white-space:pre-wrap; }
.ng-credit-dialog .ng-credit-actions { display:flex; flex-wrap:wrap; gap:8px; }
