/* Zoom participates in layout; the scene/canvas is never transformed. */
#party-rail,#party-touch,.actionbar.qfgBar,.gamehead,.gamefoot,.objectiveStrip{zoom:var(--ha-hud-scale,1)}
.modal,.geoEditor,.geoExchangeInner,#character-folio,#party-hud-editor,#companion-defaults{zoom:var(--ha-window-scale,1)}
.modalBackdrop{box-sizing:border-box;padding:12px;align-items:center}
.modal{box-sizing:border-box;display:flex;flex-direction:column;min-height:0;max-width:calc((100vw - 24px)/var(--ha-window-scale,1))!important;max-height:calc((100dvh - 24px)/var(--ha-window-scale,1))!important;overflow:hidden}
.modalheader{flex:none;display:flex;justify-content:space-between;align-items:center;gap:10px;padding:8px 12px}
.modalbody{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y}
.modalButtons{flex:none;overflow:auto;max-height:calc(28dvh/var(--ha-window-scale,1));overscroll-behavior:contain;touch-action:pan-y;padding:8px 12px}
.modalheader .interfaceClose{flex:none;min-width:44px;min-height:40px;border:2px outset #d8b68a;background:#5b4133;color:#ffe5b6;font:bold 15px Georgia;padding:4px 10px;cursor:pointer}
.interfaceSizing{border:2px double #9a754a;padding:10px;margin:12px 0;color:#362216}.interfaceSizing h3{font:small-caps bold 17px Georgia;margin:0 0 6px}.interfaceSizing p{font:13px/1.4 Georgia;margin:0 0 10px}.interfaceScaleRow{display:grid;grid-template-columns:1fr auto;gap:4px 12px;margin:10px 0;font:13px Georgia}.interfaceScaleRow input{grid-column:1/-1;width:100%;height:28px;margin:0;accent-color:#74502d;touch-action:pan-x}.interfaceSizing button{min-height:36px;padding:6px 10px;border:2px outset #d6b78b;background:#c9a777;color:#362216;font:13px Georgia}
#character-folio{max-width:calc((100vw - 24px)/var(--ha-window-scale,1))!important;max-height:calc((100dvh - 24px)/var(--ha-window-scale,1))!important}
#party-hud-editor,#companion-defaults{position:fixed!important;inset:0!important;margin:auto!important;box-sizing:border-box;width:min(560px,calc((100vw - 24px)/var(--ha-window-scale,1)))!important;max-width:calc((100vw - 24px)/var(--ha-window-scale,1))!important;max-height:calc((100dvh - 24px)/var(--ha-window-scale,1))!important;height:fit-content;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;padding:0 12px 12px;z-index:16000}
#party-hud-editor::backdrop{background:#0009}
#party-hud-editor header,#companion-defaults header{position:sticky;top:0;z-index:3;min-height:48px;background:#d5be93;border-bottom:1px solid #9a754a;padding:8px 0;box-sizing:border-box}
#party-hud-editor header button,#companion-defaults header button{min-width:44px;min-height:44px;font-size:23px}
#party-hud-editor footer{position:sticky;bottom:-12px;background:#d5be93;z-index:2;padding:8px 0;border-top:1px solid #9a754a}
#party-hud-editor footer button{min-height:40px}
#party-touch{position:relative;padding-right:44px!important;gap:8px;overflow:auto}
#hud-touch-close{position:absolute;right:2px;top:2px;min-width:36px;min-height:36px;border:2px ridge #bb9c62;background:#263427;color:#eed4a0;font:20px Georgia;cursor:pointer}
/* Floating touch islands. Empty space passes taps to the scene beneath. */
#canvasbox #party-touch{position:absolute;inset:auto 10px 10px!important;z-index:12;width:auto;min-height:0;height:calc(110px * var(--ha-touch-scale,1));flex:none!important;zoom:1!important;padding:0!important;gap:12px;background:transparent!important;border:0!important;box-shadow:none!important;overflow:visible;pointer-events:none!important;align-items:flex-end}
#party-touch #touch-stick{box-sizing:border-box;flex:none;display:grid;grid-template-columns:repeat(3,calc(32px * var(--ha-touch-scale,1)));grid-template-rows:repeat(3,calc(32px * var(--ha-touch-scale,1)));width:calc(100px * var(--ha-touch-scale,1));height:calc(100px * var(--ha-touch-scale,1));border:2px solid #e0d7b4aa;border-radius:50%;padding:0;background:#18201966;box-shadow:inset 0 0 0 1px #1118;opacity:var(--ha-touch-opacity,.45);pointer-events:auto;touch-action:none}
#party-touch #touch-stick button{font:calc(23px * var(--ha-touch-scale,1)) Georgia;color:#fff5d9;touch-action:none;min-width:0;min-height:0}
#party-touch #touch-stick span{color:#f0e4c6aa;font-size:calc(14px * var(--ha-touch-scale,1))}
#party-touch .touch-actions{display:grid;grid-template-columns:repeat(2,calc(48px * var(--ha-touch-scale,1)));gap:calc(7px * var(--ha-touch-scale,1));pointer-events:none;align-content:end}
#party-touch .touch-actions button{box-sizing:border-box;width:calc(48px * var(--ha-touch-scale,1));height:calc(48px * var(--ha-touch-scale,1));min-height:0;border:2px solid #e0d7b4aa;background:#18201966;box-shadow:none;color:#fff5d9;font:bold calc(11px * var(--ha-touch-scale,1)) Georgia;opacity:var(--ha-touch-opacity,.45);pointer-events:auto;touch-action:none;padding:2px}
#party-touch #hud-touch-close{position:absolute;top:auto;bottom:calc(114px * var(--ha-touch-scale,1));right:0;box-sizing:border-box;width:28px;height:28px;min-width:28px;min-height:28px;border:1px solid #e0d7b488;border-radius:50%;background:#18201955;color:#fff5d9;font:20px Georgia;padding:0;opacity:var(--ha-touch-opacity,.45);pointer-events:auto;touch-action:manipulation}
#party-touch #touch-stick:active,#party-touch .touch-actions button:active,#party-touch #hud-touch-close:active,#party-touch button:focus-visible{opacity:.95;outline-color:#fff5d9}
/* Direct window controls, usable without opening Options. */
.haWindowTitle{cursor:move;touch-action:none}
.haWindowTools{display:inline-flex;gap:3px;align-items:center;flex:none;margin-left:auto;vertical-align:middle}
#bookDialogue .haWindowTools button,.haWindowTools button{min-width:30px!important;min-height:30px!important;width:30px;height:30px;padding:0!important;font:bold 19px/1 Georgia!important;border:2px outset #cfb17b!important;background:#c5a274!important;color:#382515!important;cursor:pointer}
.haWindowGrip{position:absolute!important;right:0;bottom:0;z-index:5;width:30px!important;height:28px!important;min-width:0!important;min-height:0!important;padding:0!important;border:0!important;background:transparent!important;color:#775431!important;font:24px/1 Georgia!important;cursor:nwse-resize;touch-action:none}
#bookDialogue .bookControls{padding-right:20px}.modal{position:relative}.modalButtons{padding-right:32px}
#party-hud-editor form{position:relative;min-height:100%}#party-hud-editor:has(>.haWindowGrip){overflow:hidden}#party-hud-editor form{max-height:100%;overflow:auto;box-sizing:border-box}
#companion-defaults{padding-bottom:30px}
@media(max-width:600px){.haWindowTools{gap:2px}.haWindowTools button,#bookDialogue .haWindowTools button{min-width:28px!important;width:28px;height:32px!important}.bookHeading{flex-wrap:wrap}.bookHeading .haWindowTools{margin-left:auto}}
@media(max-width:600px) and (max-height:480px){#bookPortrait{display:none}#bookDialogue #bookName{padding:0;min-height:0;font-size:16px}.bookHeading{flex-wrap:nowrap;gap:4px}#bookDialogue #bookReadMore{padding:3px 6px;font-size:11px}}
.haWindowGrip{pointer-events:auto!important}
@media(max-width:600px) and (orientation:portrait){.bookHeading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px}.bookHeading #bookName{grid-column:1/-1}.bookHeading #bookReadMore{justify-self:start}.bookHeading .haWindowTools{grid-column:2}}
@media(max-width:600px) and (max-height:480px){.bookHeading{display:flex}.bookHeading #bookName{flex:1}}
#party-hud-editor[open]{display:flex;flex-direction:column}#party-hud-editor form{flex:1;min-height:0}
#party-hud-editor form{min-height:0;min-width:0}#party-hud-editor,#companion-defaults{min-width:0}
/* Opening story size matches the reviewed desktop window; Options opens expanded. */
.modal{width:720px;min-height:240px}
.modal[data-window-kind=chapter]{width:720px;height:290px}
.modal[data-window-kind=chapter] .modalbody{font:20px/1.5 Georgia,serif;white-space:pre-line;padding:14px 18px}
.modal[data-window-kind=chapter] .modalheader{font-size:19px}
.modal[data-window-kind=chapter] .modalButtons button{font-size:14px;min-height:42px}
.modal:has(.optionsBody){width:900px;height:min(780px,calc((100dvh - 24px)/var(--ha-window-scale,1)))}
.modal[data-window-kind=chapter] .modalbody{line-height:1.3;padding:12px 16px}
.modal[data-window-kind=chapter] .modalbody{padding-block:10px}
@media(max-width:600px) and (orientation:portrait){.modal[data-window-kind=chapter]{height:min(560px,calc((100dvh - 24px)/var(--ha-window-scale,1)))}}
#loot-window{zoom:var(--ha-window-scale,1);width:520px;max-width:calc((100vw - 24px)/var(--ha-window-scale,1));max-height:calc((100dvh - 24px)/var(--ha-window-scale,1));box-sizing:border-box;overflow:auto;border:5px ridge #e0bd85;background:#cfaf7c;color:#352216;font:17px/1.5 Georgia;padding:12px}#loot-window:not([open]){display:none}#loot-window::backdrop{background:#0008}.lootHeading{display:flex;align-items:center;gap:8px}#loot-items p{display:flex;align-items:center;justify-content:space-between;gap:12px}#loot-window button{min-height:36px;padding:5px 12px;background:#d6b781;color:#352216;border:2px outset #edce96;font:14px Georgia}.lootInventory{padding:10px 4px;border-top:1px solid #8e764d}.lootInventory p{margin:4px 0}

.throw-slot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:12px 4px;border-block:1px solid #8e764d}.throw-slot strong{width:100%}.throw-slot button{padding:10px;border:2px outset #e4c18b;background:#c9a56d;color:#352216;font:15px Georgia}.throw-slot button[aria-pressed="true"]{outline:2px solid #76502a;background:#e0bf87}
