/* Subtle VGA finish: existing palette/layout/type sizes, crisp edges and stepped shading. */
:root{--pixel-highlight:#ead09a;--pixel-shadow:#654725}
:is(#sidepanel,.parchmentSpeech,#modal,.modal,.menuWindow,.ha-menu,.haMenu,#party-rail,#ha-floating-huds .party-card,.quickShortcuts){
 border-radius:0!important;box-shadow:2px 2px 0 #201b16,4px 4px 0 #201b163d!important;
 background-image:repeating-linear-gradient(0deg,#ffffff03 0 2px,#00000003 2px 4px)!important;
}
:is(#actionbar,#sidepanel,#dialogueLayer,#modalBackdrop,.ha-menu,.haMenu,.quickShortcuts) button{
 border-radius:0!important;text-shadow:none;box-shadow:inset 2px 2px 0 #ffffff22,inset -2px -2px 0 #00000033!important;
}
#actionbar.actionbar.qfgBar .action{
 background:linear-gradient(90deg,#d5af76 0 20%,#dfbb83 20% 40%,#e5c58e 40% 60%,#dfbb83 60% 80%,#d5af76 80% 100%)!important;
}
:is(#party-rail,#ha-floating-huds) .party-card{border-radius:0!important}
:is(#party-rail,#ha-floating-huds) .party-card::after{border-radius:0!important;background:none}
:is(#party-rail,#ha-floating-huds) .party-vitals b{border-radius:0!important;background:#d6b77e;box-shadow:inset 2px 2px 0 #edcf96,inset -2px -2px 0 #9e7944}
:is(#party-rail,#ha-floating-huds) meter{border-radius:0!important}
:is(#party-rail,#ha-floating-huds) meter::-webkit-meter-bar{border-radius:0;background:#182019}
:is(#party-rail,#ha-floating-huds) meter::-webkit-meter-optimum-value{border-radius:0}
:is(#party-rail,#ha-floating-huds) meter[id^=hp]::-webkit-meter-optimum-value{background:linear-gradient(#c77960 0 25%,#a13d30 25% 75%,#69261e 75%)}
:is(#party-rail,#ha-floating-huds) meter[id^=sp]::-webkit-meter-optimum-value{background:linear-gradient(#a3b274 0 25%,#657e47 25% 75%,#354c2c 75%)}
:is(#party-rail,#ha-floating-huds) .companion-action{box-shadow:0 0 0 2px #171b13,inset 0 2px 0 #f5d69555,inset 0 -2px 0 #0007,2px 2px 0 #0008!important}
:is(#actionbar,#sidepanel,#dialogueLayer,#modalBackdrop,#party-rail,#ha-floating-huds) :is(img,canvas){image-rendering:pixelated}
:is(input,select,textarea){border-radius:0}
/* Text remains native and legible; scene sprites/canvas and hitboxes are not filtered. */
body.haPixelWorkshop :is(header,.subbar,aside,footer,.inspector,.panel){border-radius:0;box-shadow:inset 1px 1px 0 #ffffff10,inset -1px -1px 0 #0005}
body.haPixelWorkshop button{border-radius:0;box-shadow:inset 1px 1px 0 #ffffff20,inset -1px -1px 0 #0006}
/* v35: actual square-grid letterforms, stronger pixel edges and flat color bands. */
@font-face{font-family:AdventurePixel;src:url('fonts/adventure-pixel-serif.ttf?v=46') format('truetype');font-weight:100 900;font-style:normal;font-display:swap}
body,button,input,select,textarea,
:is(.mast,#actionbar,#sidepanel,#dialogueLayer,#modalBackdrop,#party-rail,#ha-floating-huds,#quick-shortcuts,dialog,.menuWindow,.ha-menu,.haMenu) *{
 font-family:AdventurePixel,Georgia,serif!important;font-synthesis:none;text-shadow:none!important;
}
:is(#sidepanel,.parchmentSpeech,#modal,.modal,.menuWindow,.ha-menu,.haMenu,#party-rail,#quick-shortcuts,dialog){
 border-radius:0!important;border-style:solid!important;border-color:#e2c58b #735432 #735432 #e2c58b!important;
 box-shadow:inset 2px 2px 0 #fff0c22b,inset -2px -2px 0 #231a164d,3px 3px 0 #171511!important;
 background-image:repeating-conic-gradient(#ffffff05 0% 25%,#00000005 0% 50%)!important;background-size:4px 4px!important;
}
:is(#party-rail,#ha-floating-huds) .companion-action{background-image:radial-gradient(circle at 35% 25%,#57615a 0 23%,#35423a 23% 55%,#1a2721 55% 100%)!important}
:is(#party-rail,#ha-floating-huds) .companion-circle{box-shadow:0 0 0 2px #1d251c,0 0 0 4px #806634,2px 3px 0 #0009!important}
:is(#quick-shortcuts,dialog,#sidepanel,#modalBackdrop) button{border-radius:0!important;background-image:none!important;box-shadow:inset 2px 2px 0 #ffffff24,inset -2px -2px 0 #0006!important}
:is(#party-rail,#ha-floating-huds) .companion-action:is([data-action=heavy],[data-action=melee],[data-action=attack]){background-image:radial-gradient(circle at 35% 25%,#b67848 0 23%,#613921 23% 55%,#25160e 55%)!important}
:is(#party-rail,#ha-floating-huds) .companion-action:is([data-action=guard],[data-action=acrobat]){background-image:radial-gradient(circle at 35% 25%,#91aa74 0 23%,#38583b 23% 55%,#15291f 55%)!important}
:is(#party-rail,#ha-floating-huds) .companion-action[data-action=throw]{background-image:radial-gradient(circle at 35% 25%,#aa9e79 0 23%,#56563b 23% 55%,#242717 55%)!important}
:is(#party-rail,#ha-floating-huds) .companion-action:is([data-action=collect],[data-action^='item:']){background-image:radial-gradient(circle at 35% 25%,#bb8c51 0 23%,#684321 23% 55%,#2b1d11 55%)!important}
/* Include dynamically-created windows, tooltips, form controls and SVG labels. */
html body :is(button,input,select,textarea,dialog,[role=dialog],[role=menu],[role=tooltip],.tooltip,.panel,.window,.toolbar,.hud,.menu) *,
html body :is(button,input,select,textarea,dialog,[role=dialog],[role=menu],[role=tooltip],.tooltip,.panel,.window,.toolbar,.hud,.menu),
html body svg text{font-family:AdventurePixel,Georgia,serif!important;font-synthesis:none}
html body :is(button,.toolbar,.hud,#actionbar,#party-rail,#ha-floating-huds,#quick-shortcuts,dialog) svg{shape-rendering:crispEdges}
html body :is(button,.toolbar,.hud,#actionbar,#party-rail,#ha-floating-huds,#quick-shortcuts,dialog) img{image-rendering:pixelated}

/* Dialogue glyphs must not inherit gaps in the decorative pixel typeface. */
html body :is(#bookHistory,#bookHistory *,#bookReply,#bookQuestion,.parchmentSpeech,.parchmentSpeech *){font-family:monospace!important;font-weight:600;line-height:1.5!important;text-shadow:none!important;background-image:none!important;}

/* Dialogue refresh: solid pixel glyphs, stepped frames, clear scene-centered messages. */
@font-face{font-family:AdventureDialoguePixel;src:url('fonts/adventure-dialogue-pixel.ttf?v=46') format('truetype');font-weight:100 900;font-display:swap}
html body #bookDialogue :is(#bookHistory,#bookHistory *,#bookQuestion,#bookReply,#bookStatus),html body #messages,html body #dialogueText{
 font-family:AdventureDialoguePixel,monospace!important;font-weight:400!important;font-synthesis:none;line-height:1.4!important;text-shadow:none!important;
}
html body #bookDialogue .bookWindow{gap:12px;padding:8px;grid-template-columns:112px minmax(0,1fr)}
html body #bookDialogue .bookParchment{background:#1e302b;border:4px solid;border-color:#ebcf8e #78603a #78603a #ebcf8e;box-shadow:0 0 0 2px #171d17,inset 0 0 0 2px #9a7a42,6px 6px 0 #101611;color:#eddbb0;padding:14px 18px;gap:10px}
html body #bookDialogue .bookParchment::before,html body #bookDialogue .bookParchment::after{content:none}
html body #bookDialogue .bookHeading{border-bottom:2px solid #806b40;padding-bottom:10px}
html body #bookDialogue #bookName{color:#f2d594;font-size:22px}
html body #bookDialogue #bookHistory{padding:10px 10px 4px 0;scrollbar-color:#aa8b50 #14231f}
html body #bookDialogue #bookHistory .bookLine{font-size:calc(24px * var(--ha-dialogue-scale,1));margin-bottom:16px;color:#f0dfb6}
html body #bookDialogue #bookHistory .player{color:#c0c8ad}
html body #bookDialogue #bookHistory .bookLine strong{color:#e5be76;font-size:18px}
html body #bookDialogue #bookHistory details{border-color:#806b40}
html body #bookDialogue #bookHistory::-webkit-scrollbar-thumb{border-radius:0;background:#aa8b50;border:3px solid #14231f}
html body #bookDialogue #bookHistory::-webkit-scrollbar-track{background:#14231f}
html body #bookDialogue #bookAsk{border-top:2px solid #806b40}
html body #bookDialogue #bookAsk label,html body #bookDialogue #bookStatus{color:#d1c49f}
html body #bookDialogue #bookQuestion{background:#14231f;color:#f0dfb6;font-size:24px;border:2px solid #9c814b;border-radius:0;padding:8px}
html body #bookDialogue #bookQuestion::placeholder{color:#a4af9a;opacity:1}
html body #bookDialogue button{background:#b39761;color:#201e15;border:2px solid;border-color:#edd29a #685536 #685536 #edd29a;border-radius:0;box-shadow:2px 2px 0 #101611;font-family:AdventurePixel,serif!important}
html body #bookDialogue #bookPortrait{border:4px solid;border-color:#ebcf8e #78603a #78603a #ebcf8e;outline:2px solid #171d17;box-shadow:4px 4px 0 #101611}
html body #messages{left:50%;top:44%;bottom:auto;transform:translate(-50%,-50%);width:max-content;max-width:min(78%,620px);box-sizing:border-box;padding:16px 22px;background:#1e302b;color:#f0dfb6;font-size:24px;border:4px solid;border-color:#ebcf8e #78603a #78603a #ebcf8e;box-shadow:0 0 0 2px #171d17,inset 0 0 0 2px #9a7a42,5px 5px 0 #101611;border-radius:0;transition:none}
@media(max-width:700px),(max-height:520px){html body #bookDialogue .bookWindow{grid-template-columns:72px minmax(0,1fr);gap:8px;padding:4px}html body #bookDialogue .bookParchment{padding:8px 10px;gap:5px}html body #bookDialogue #bookHistory .bookLine,html body #bookDialogue #bookQuestion,html body #messages{font-size:calc(24px * var(--ha-dialogue-scale,1))}html body #bookDialogue #bookHistory .bookLine strong{font-size:16px}html body #messages{max-width:84%;padding:12px 16px}}
@media(max-width:600px) and (orientation:portrait){html body #bookDialogue .bookWindow{display:block}html body #bookDialogue #bookPortrait{width:60px;left:20px;top:20px}html body #bookDialogue #bookName{padding-left:74px;min-height:60px}}

html body #bookDialogue #bookDismiss{order:99;min-width:32px;min-height:32px;padding:0;font-size:20px}
body:has(#bookDialogue:not([hidden])) #messages{opacity:0!important}

/* Notifications use screen-relative sizes, independent of dialogue scaling. */
html body #messages{font-size:16px!important;line-height:1.35!important;padding:8px 12px!important;max-width:min(70%,520px)!important;letter-spacing:0!important}
@media(pointer:coarse),(max-height:520px){html body #messages{font-size:14px!important;padding:6px 10px!important;border-width:2px!important;max-width:min(70vw,480px)!important}}

/* Solid, proportional dialogue glyphs with a restrained pixel grid. */
@font-face{font-family:AdventureReadablePixel;src:url('fonts/adventure-readable-pixel.ttf?v=1') format('truetype');font-weight:400;font-style:normal;font-display:swap}
html body #dialogueText,html body #messages,html body #bookDialogue :is(#bookHistory,#bookHistory *,#bookQuestion,#bookReply,#bookStatus){font-family:AdventureReadablePixel,sans-serif!important;font-weight:400!important;letter-spacing:0!important;text-shadow:none!important;line-height:1.45!important;}
html body #dialogueText{font-size:clamp(16px,1.5vw,21px)!important;}
html body #bookDialogue #bookHistory .bookLine{font-size:clamp(16px,1.5vw,20px)!important;}
html body #messages{font-size:16px!important;}
@media(pointer:coarse),(max-height:520px){html body #dialogueText,html body #bookDialogue #bookHistory .bookLine{font-size:16px!important;}html body #messages{font-size:14px!important;}}

html body #messages:empty{display:none!important}
