/* BlackVeil — bottom-docked, portrait-led dialogue. No server-side animation. */
.bv-npc-overlay[hidden],.bv-npc-overlay [hidden]{display:none!important}
.bv-npc-overlay{
  position:fixed;inset:0;z-index:3500;display:flex;align-items:flex-end;justify-content:center;
  padding:0 calc(16px + env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background:linear-gradient(180deg,transparent 31%,rgba(5,7,5,.16) 58%,rgba(0,0,0,.50) 100%);
}
.bv-npc-card{
  --npc-portrait-width:255px;
  position:relative;isolation:isolate;flex:0 1 1120px;max-width:100%;min-height:204px;
  border:1px solid #8f774c;border-radius:5px;
  background:linear-gradient(105deg,#151911f2,#191c17f7 31%,#171812f7 100%);
  box-shadow:0 -7px 38px #0009,0 14px 50px #000c,inset 0 0 0 2px #201d13,inset 0 0 0 3px #5d4a2d6a;
  color:#eadfc7;font:14px/1.55 var(--bv-font-ui,'Malgun Gothic',sans-serif);
  overflow:visible;animation:bv-npc-panel-appear .26s ease-out both;
}
.bv-npc-card::before{content:'';position:absolute;top:4px;left:12px;right:12px;height:1px;background:linear-gradient(90deg,transparent,#ad895180,transparent);pointer-events:none}
.bv-npc-portrait{
  position:absolute;z-index:1;left:5px;bottom:2px;width:var(--npc-portrait-width);height:318px;
  pointer-events:none;display:flex;align-items:flex-end;justify-content:center;
}
.bv-npc-portrait-light{
  position:absolute;bottom:0;left:8%;width:80%;height:88%;
  background:radial-gradient(ellipse at 49% 56%,#b29a5741,transparent 64%);
  animation:bv-npc-lamplight 6.4s ease-in-out infinite;opacity:.65;
}
.bv-npc-portrait-image{
  position:relative;width:100%;height:100%;object-fit:contain;object-position:center bottom;
  filter:drop-shadow(5px 3px 8px #000b) saturate(.9) brightness(.95);
  transform-origin:50% 90%;animation:bv-npc-breath 5.4s ease-in-out infinite;
  -webkit-mask-image:linear-gradient(to bottom,#000 0%,#000 80%,transparent 100%);
  mask-image:linear-gradient(to bottom,#000 0%,#000 80%,transparent 100%);
}
.bv-npc-portrait-placeholder{
  position:relative;margin-bottom:25px;display:grid;place-items:center;width:145px;height:145px;
  border:1px solid #b39a6555;border-radius:50%;box-shadow:0 0 0 8px #8c6f3a13,0 0 25px #0008;
  background:radial-gradient(circle,#71644338,#171a17aa 70%);font:700 23px/1.3 var(--bv-font-story,serif);color:#d5bc83;
}
.bv-npc-content{
  position:relative;z-index:2;margin-left:var(--npc-portrait-width);padding:16px 23px 13px 8px;
  min-height:204px;display:flex;flex-direction:column;
}
.bv-npc-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;border-bottom:1px solid #89724a79;padding-bottom:7px}
.bv-npc-header>div{display:flex;flex-direction:column;min-width:0}
.bv-npc-header small{font:700 9px/1.3 var(--bv-font-title,serif);letter-spacing:.17em;color:#a99570}
.bv-npc-header strong{font:700 clamp(18px,2vw,23px)/1.45 var(--bv-font-story,serif);color:#f6e6c6;text-shadow:0 1px 3px #000}
.bv-npc-header span{color:#baaa8b;font-size:11px}
.bv-npc-card button{cursor:pointer;border:1px solid #967a4a;border-radius:3px;background:linear-gradient(#3d3525,#29281c);color:#f1dfb4;padding:7px 14px;font:inherit;transition:background .15s,border-color .15s}
.bv-npc-card button:hover{background:#5a4830;border-color:#d4b67b}
.bv-npc-card button:focus-visible{outline:2px solid #e2c485;outline-offset:2px}
#bv-npc-dialogue{white-space:pre-line;min-height:52px;margin:11px 0 12px;font:400 clamp(13px,1.3vw,15px)/1.75 var(--bv-font-story,serif);color:#ebe0c8;overflow-wrap:anywhere}
.bv-npc-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;margin-top:auto}
#bv-npc-shop{margin:9px 0 0;min-height:0;flex:1;display:flex;flex-direction:column}
#bv-npc-shop>header{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:0 0 6px}
#bv-npc-shop>header strong{color:#e2c493}
#bv-npc-shop>small{display:block;color:#bdb29a;font-size:11px;margin-bottom:8px}
#bv-npc-products{display:grid;gap:2px;overflow:auto;min-height:0;max-height:clamp(90px,32vh,260px);overscroll-behavior:contain;scrollbar-color:#836c49 #1d211b;scrollbar-width:thin}
.bv-npc-product{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:5px 8px;border-bottom:1px solid #4f46357d}
.bv-npc-product:nth-child(odd){background:#c0a2710b}
.bv-npc-product span{font-size:12px}.bv-npc-product button{white-space:nowrap;font-size:12px;padding:5px 9px}
#bv-npc-status{min-height:17px;margin:3px 0 0;color:#dfc78e;font-size:11px}
.bv-npc-overlay.is-shopping .bv-npc-card{height:min(73vh,510px);max-height:calc(100dvh - 30px)}
.bv-npc-overlay.is-shopping .bv-npc-content{height:100%}
.bv-npc-overlay.is-shopping #bv-npc-dialogue{min-height:0;margin:8px 0 3px;font-size:12px}
.bv-npc-overlay.is-shopping #bv-npc-products{max-height:none;flex:1}
@keyframes bv-npc-panel-appear{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
@keyframes bv-npc-breath{0%,100%{transform:translate3d(0,0,0) rotate(0deg)}50%{transform:translate3d(0,-3px,0) rotate(.26deg)}}
@keyframes bv-npc-lamplight{0%,100%{opacity:.55}43%{opacity:.8}72%{opacity:.63}}
@media(max-width:650px){
 .bv-npc-overlay{padding:0 calc(6px + env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left))}
 .bv-npc-card{--npc-portrait-width:clamp(108px,23vw,155px);min-height:187px}
 .bv-npc-portrait{height:clamp(156px,44vw,228px);left:0}
 .bv-npc-portrait-placeholder{width:83px;height:83px;font-size:17px;margin-bottom:18px}
 .bv-npc-content{min-height:187px;padding:9px 10px 9px 2px}
 .bv-npc-header{padding-bottom:4px}
 .bv-npc-header strong{font-size:18px}
 .bv-npc-header small{font-size:8px}
 .bv-npc-header span{font-size:10px}
 #bv-npc-dialogue{font-size:12px;line-height:1.55;margin:7px 0 9px;min-height:42px;max-height:clamp(44px,16vh,90px);overflow:auto}
 .bv-npc-actions{gap:5px}
 .bv-npc-actions button{padding:5px 8px;font-size:11px}
 #bv-npc-status{font-size:10px}
 .bv-npc-overlay.is-shopping .bv-npc-card{height:min(78dvh,460px)}
 .bv-npc-overlay.is-shopping #bv-npc-dialogue{max-height:50px}
}
@media(max-height:470px){
 .bv-npc-card{--npc-portrait-width:clamp(120px,22vw,170px);min-height:146px}
 .bv-npc-portrait{height:clamp(152px,33vh,198px)}
 .bv-npc-content{min-height:146px;padding-top:7px;padding-bottom:5px}
 #bv-npc-dialogue{min-height:25px;margin:4px 0;line-height:1.45}
 .bv-npc-overlay.is-shopping .bv-npc-card{height:min(88dvh,355px)}
}
/* v0.2.59.2 — Lineage-style full-height character portrait. The PNGs remain unmodified.
   Keep all interaction in the right-hand content and anchor the art to the viewport bottom. */
.bv-npc-overlay{padding:0 0 env(safe-area-inset-bottom) 0;align-items:flex-end}
.bv-npc-card{
  --npc-portrait-width:clamp(330px,36vw,470px);
  flex:1 1 100%;max-width:1340px;min-height:clamp(208px,29vh,244px);
  border-radius:3px 3px 0 0;
  background:linear-gradient(180deg,rgba(15,17,14,.84),rgba(10,11,9,.96));
}
.bv-npc-portrait{
  left:0;bottom:-1px;z-index:3;
  width:var(--npc-portrait-width);height:clamp(400px,74dvh,565px);
  overflow:visible;align-items:flex-end;justify-content:flex-start;
}
.bv-npc-portrait-image{
  width:100%;height:100%;object-fit:contain;object-position:left bottom;
  -webkit-mask-image:none;mask-image:none;
  filter:drop-shadow(9px 5px 14px rgba(0,0,0,.68)) saturate(.91) brightness(.96);
}
.bv-npc-portrait-light{left:0;width:100%;height:80%;opacity:.4}
.bv-npc-portrait-placeholder{margin:0 0 38px 30px}
.bv-npc-content{z-index:2;margin-left:var(--npc-portrait-width);padding:16px 25px 14px 6px;min-height:clamp(208px,29vh,244px)}
.bv-npc-overlay.is-shopping .bv-npc-card{height:min(73dvh,510px)}
@media(max-width:900px){
 .bv-npc-card{--npc-portrait-width:clamp(245px,34vw,320px)}
 .bv-npc-portrait{height:clamp(310px,78dvh,490px)}
 .bv-npc-content{padding-right:14px}
}
@media(max-width:650px){
 .bv-npc-card{--npc-portrait-width:clamp(140px,38vw,200px);min-height:218px}
 .bv-npc-portrait{left:0;bottom:-1px;width:var(--npc-portrait-width);height:clamp(280px,46dvh,385px);overflow:visible}
 .bv-npc-portrait-image{object-fit:cover;object-position:51% bottom}
 .bv-npc-content{min-height:218px;margin-left:var(--npc-portrait-width);padding:10px 9px 9px 5px}
 .bv-npc-portrait-placeholder{margin:0 0 23px 8px;width:100px;height:100px}
 .bv-npc-header strong{font-size:17px}
 .bv-npc-header span{font-size:9px}
 .bv-npc-header small{font-size:7px}
 #bv-npc-dialogue{max-height:clamp(52px,20vh,100px);min-height:48px;font-size:12px}
 .bv-npc-actions{gap:5px}
 .bv-npc-actions button{padding:5px 7px;font-size:11px}
 .bv-npc-overlay.is-shopping .bv-npc-card{height:min(80dvh,500px)}
}
@media(max-height:470px){
 .bv-npc-card{--npc-portrait-width:clamp(205px,28vw,265px);min-height:146px}
 .bv-npc-portrait{left:0;bottom:-1px;width:var(--npc-portrait-width);height:clamp(220px,95dvh,360px)}
 .bv-npc-portrait-image{object-fit:cover;object-position:50% bottom}
 .bv-npc-content{margin-left:var(--npc-portrait-width);min-height:146px;padding:7px 10px 5px 6px}
 #bv-npc-dialogue{min-height:25px;margin:4px 0;max-height:40px;line-height:1.45}
 .bv-npc-overlay.is-shopping .bv-npc-card{height:min(89dvh,365px)}
}
@media(prefers-reduced-motion:reduce){
 .bv-npc-card,.bv-npc-portrait-image,.bv-npc-portrait-light{animation:none!important}
 .bv-npc-card button{transition:none}
}

/* v0.2.59.3 — Real potion icons and server-authoritative bulk purchases. */
#bv-npc-products{display:grid;grid-template-columns:repeat(auto-fill,minmax(105px,1fr));align-content:start;gap:8px;padding:3px 4px 7px}
.bv-npc-product{
 display:flex;flex-direction:column;justify-content:center;align-items:center;gap:3px;
 padding:8px 5px;min-width:0;min-height:106px;border:1px solid #635239;
 background:linear-gradient(145deg,#302e25,#1b211b);text-align:center;
}
.bv-npc-product:nth-child(odd){background:linear-gradient(145deg,#373125,#21221a)}
.bv-npc-product:hover{background:#4a3b2b;border-color:#b99b63}
.bv-npc-product.is-selected,.bv-npc-product.is-selected:nth-child(odd){border-color:#e4bb73;background:linear-gradient(145deg,#52422c,#292c20);box-shadow:inset 0 0 0 1px #c59c5570}
.bv-npc-product img{height:49px;width:49px;object-fit:contain;image-rendering:auto;filter:drop-shadow(0 2px 4px #0008)}
.bv-npc-product .bv-npc-product-name{font-size:11px;line-height:1.3;white-space:normal;overflow-wrap:keep-all;color:#f0e4cd}
.bv-npc-product .bv-npc-product-price{font-size:11px;color:#dfbd7c}
.bv-npc-purchase{flex:0 0 auto;border-top:1px solid #7b6545;padding:9px 3px 2px;display:flex;flex-direction:column;gap:8px}
.bv-npc-purchase-heading{display:flex;align-items:center;gap:8px;min-width:0}
.bv-npc-purchase-heading img{width:42px;height:42px;object-fit:contain;flex:none}
.bv-npc-purchase-heading>div{display:flex;flex-direction:column;min-width:0;flex:1}
.bv-npc-purchase-heading strong{font-size:13px;color:#f0dfc5}
.bv-npc-purchase-heading small{font-size:11px;color:#c1b49a}
#bv-npc-purchase-total{font:700 16px/1.2 var(--bv-font-ui,sans-serif);color:#ebcb85;white-space:nowrap}
.bv-npc-purchase-controls{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.bv-npc-purchase-controls label{color:#d1c3a9;font-size:12px;margin-right:auto}
.bv-npc-purchase-controls button{padding:5px 10px;min-width:31px;line-height:1.3}
#bv-npc-quantity{width:62px;min-width:48px;box-sizing:border-box;background:#10150f;color:#efdfc2;border:1px solid #90764c;border-radius:3px;padding:5px;text-align:center;font:13px/1.3 var(--bv-font-ui,sans-serif)}
#bv-npc-quantity::-webkit-inner-spin-button,#bv-npc-quantity::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
#bv-npc-purchase-submit{min-width:98px;background:linear-gradient(#665030,#48341e);color:#fff0cc;font-weight:bold}
#bv-npc-purchase-submit:disabled{opacity:.57;cursor:wait}
.bv-npc-overlay.is-shopping #bv-npc-products{max-height:none;min-height:65px;flex:1;overflow:auto}
@media(max-width:650px){
 #bv-npc-products{grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:5px;padding:3px 1px}
 .bv-npc-product{min-height:84px;padding:4px 2px;gap:2px}
 .bv-npc-product img{width:37px;height:37px}
 .bv-npc-product .bv-npc-product-name{font-size:10px}
 .bv-npc-product .bv-npc-product-price{font-size:10px}
 .bv-npc-purchase{gap:4px;padding-top:5px}
 .bv-npc-purchase-heading{gap:4px}
 .bv-npc-purchase-heading img{width:30px;height:30px}
 .bv-npc-purchase-heading strong{font-size:11px}
 .bv-npc-purchase-heading small{font-size:10px}
 #bv-npc-purchase-total{font-size:12px}
 .bv-npc-purchase-controls{gap:3px}
 .bv-npc-purchase-controls label{width:100%;font-size:10px}
 .bv-npc-purchase-controls button{padding:4px 6px;min-width:24px;font-size:11px}
 #bv-npc-quantity{width:47px;padding:4px 2px}
 #bv-npc-purchase-submit{min-width:74px;margin-left:auto}
}
@media(max-height:470px){
 .bv-npc-overlay.is-shopping #bv-npc-dialogue{display:none}
 .bv-npc-product{min-height:77px}
 .bv-npc-product img{width:33px;height:33px}
 .bv-npc-purchase-heading img{width:27px;height:27px}
}

/* v0.2.70.27 — distinct centered response menu, matching the screenshot.
   NPC art and dialogue remain docked at the bottom; answer buttons never occupy it. */
.bv-npc-choice-panel{
 position:fixed;z-index:8;left:50%;top:43%;transform:translate(-50%,-50%);
 width:min(480px,calc(100vw - 28px));max-height:min(52dvh,350px);
 padding:13px 15px 12px;overflow-y:auto;overscroll-behavior:contain;
 background:linear-gradient(165deg,rgba(16,16,13,.95),rgba(12,12,11,.9));
 border-top:2px solid #a1844e;border-bottom:1px solid #625138;
 border-left:1px solid #51412b;border-right:1px solid #51412b;
 box-shadow:0 12px 38px #000c,inset 0 1px 0 #d1b37f16;
 box-sizing:border-box;color:#efdfb8;
}
.bv-npc-choice-title{display:block;margin:0 0 9px;font:600 14px/1.5 var(--bv-font-story,serif);color:#d9ba82}
.bv-npc-choice-panel .bv-npc-actions{display:flex;flex-direction:column;flex-wrap:nowrap;gap:5px;margin:0}
.bv-npc-choice-panel .bv-npc-actions button{
 width:100%;min-height:36px;display:block;text-align:left;
 padding:8px 12px;border:1px solid transparent;border-radius:2px;
 background:rgba(57,50,37,.26);color:#ebe0cf;
 font:500 12px/1.5 var(--bv-font-story,serif);
 cursor:url('../assets/cursors/point.png') 7 5,pointer;touch-action:manipulation;
}
.bv-npc-choice-panel .bv-npc-actions button:hover,
.bv-npc-choice-panel .bv-npc-actions button:focus-visible{
 color:#ffe3a5;border-color:#ab8857;background:rgba(128,97,45,.32);outline:none;
}
.bv-npc-choice-panel .bv-npc-actions button:before{content:'›';margin-right:9px;color:#b99b62}
@media(max-width:650px){
 .bv-npc-choice-panel{top:38%;max-height:43dvh;padding:9px 10px 8px;}
 .bv-npc-choice-title{font-size:12px;margin-bottom:6px}
 .bv-npc-choice-panel .bv-npc-actions button{font-size:11px;min-height:35px;padding:7px 9px}
}
@media(max-height:470px){
 .bv-npc-choice-panel{top:38%;max-height:50dvh;width:min(480px,calc(100vw - 20px));padding:7px 10px}
 .bv-npc-choice-title{margin-bottom:3px;font-size:11px}
 .bv-npc-choice-panel .bv-npc-actions button{min-height:29px;padding:5px 8px}
}
