:root{color-scheme:dark;--ink:#181219;--panel:#241825;--gold:#e8ba71;--off:#f5e5c9;--muted:#ccb79f;--edge:#75503c;font:16px/1.45 system-ui,sans-serif}
*{box-sizing:border-box}
body{margin:0;background:var(--ink);color:var(--off);height:100dvh;display:flex;flex-direction:column}
button,input,select{font:inherit}
button{cursor:pointer;color:var(--off);background:#2d1e2b;border:1px solid var(--edge);border-radius:5px;padding:.55rem .8rem}
button:hover{background:#483148;border-color:var(--gold)}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--gold);outline-offset:3px}
button:disabled{opacity:.48;cursor:default}
button.primary{color:#21140f;background:linear-gradient(#f3d08e,#dc9d55);border-color:#facd85;font-weight:750}
.hud,.actions{display:flex;align-items:center;gap:.65rem;padding:.65rem clamp(.8rem,2.4vw,2rem);background:#1c131d;z-index:3}
.hud{border-bottom:1px solid var(--edge);justify-content:space-between}
.hud nav{display:flex;gap:.4rem}
.hud-link{display:grid;place-items:center;color:var(--off);background:#2d1e2b;border:1px solid var(--edge);border-radius:5px;padding:.55rem .8rem;text-decoration:none}
.hud-link:hover{background:#483148;border-color:var(--gold)}
.brand{color:var(--gold);text-decoration:none;line-height:1.05;display:grid;gap:.23rem;white-space:nowrap}
.brand span,.location small{font-weight:750;font-size:.73rem;letter-spacing:.19em}
.brand strong{font:700 clamp(1.1rem,2vw,1.55rem) Georgia,serif}
main{flex:1;min-height:0;display:flex;flex-direction:column}
.stage{isolation:isolate;position:relative;flex:1;min-height:0;overflow:hidden;container-type:size;background:#201421}
.backdrop{position:absolute;inset:0;background:linear-gradient(180deg,#160e22aa,transparent 30%,transparent 62%,#1b111de8),url('assets/taverna.webp') center center/cover}
.logo,.master,.table{position:absolute;object-fit:contain;pointer-events:none}
.logo{left:3%;top:5%;width:min(19cqw,32cqh);filter:drop-shadow(0 6px 13px #000a)}
.location{position:absolute;top:6%;right:4%;text-align:right;text-shadow:0 2px 8px #000,0 2px 4px #000}
.location small{color:#ffda8e}
.location h1{margin:.2rem 0;font:700 clamp(1.3rem,3.2cqw,3rem) Georgia,serif}
.table{width:min(68cqw,124cqh);left:50%;top:66%;transform:translate(-50%,-50%);filter:drop-shadow(0 15px 14px #1e0f12d9)}
.master{width:min(23cqw,35cqh);height:34%;object-position:center bottom;left:50%;top:21%;transform:translateX(-50%);filter:drop-shadow(0 4px 9px #241421)}
.hotspot{position:absolute;z-index:1;font-size:clamp(.7rem,1.4cqw,.9rem);background:#20141eea;border-color:#bc8955;padding:.35rem .55rem}
.atlas{top:59%;left:50%;transform:translateX(-50%)}
.tower{top:47%;left:calc(50% + min(20cqw,36cqh))}
.quest{top:47%;right:calc(50% + min(20cqw,36cqh));display:grid;justify-items:center}
.quest img{width:3.3rem;margin-top:-1.45rem;pointer-events:none}
.seats{position:absolute;left:50%;top:69%;width:min(60cqw,105cqh);height:24%;transform:translateX(-50%);display:grid;grid-template-columns:repeat(5,1fr);gap:2%;text-align:center}
.seat{min-width:0;position:relative;display:grid;justify-items:center;align-items:start}
.seat img{width:100%;height:80%;object-fit:contain;object-position:center top}
.seat small{position:absolute;top:72%;padding:.12rem .3rem;background:#28192bee;border-radius:3px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.68rem}
.seat .avatar{position:absolute;top:-16%;width:30%;aspect-ratio:1;background:#ab7658;border:3px solid #3e252a;border-radius:46% 46% 39% 39%;box-shadow:0 8px 0 -2px #735299}
.narration{position:absolute;bottom:2%;left:50%;translate:-50% 0;width:min(630px,91%);background:#211622f5;border:1px solid var(--edge);padding:.55rem .9rem;border-radius:6px;text-align:center;box-shadow:0 6px 22px #130b16bd}
.narration strong{color:var(--gold);font-family:Georgia,serif}
.narration p{margin:.1rem 0;font-size:.91rem}
.roll-result{position:absolute;left:50%;top:43%;translate:-50% -50%;z-index:2;margin:0;padding:.25rem .7rem;background:#502e63;border:1px solid var(--gold);border-radius:5px;color:#fff5e3;font-weight:800;pointer-events:none}
.roll-result.reveal{animation:reveal .45s ease-out}
@keyframes reveal{from{transform:scale(.65) rotate(-12deg);opacity:0}to{transform:scale(1);opacity:1}}
.actions{border-top:1px solid var(--edge);justify-content:end}
.identity{margin-right:auto;display:grid}
small,.muted{color:var(--muted)}
dialog{width:min(95vw,570px);max-height:84dvh;padding:0;border:1px solid #b37f55;border-radius:10px;background:var(--panel);color:var(--off);box-shadow:0 18px 70px #000b}
dialog::backdrop{background:#100b16a6}
dialog header{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;padding:.75rem 1.15rem;background:#2d1c2a;border-bottom:1px solid var(--edge);z-index:1}
h2{font:700 1.65rem Georgia,serif;color:var(--gold);margin:0}
#panel{padding:1.05rem 1.15rem}
#panel p:first-child{margin-top:0}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem}
.row{display:flex;gap:.55rem;align-items:center;flex-wrap:wrap;margin:.55rem 0}
label{display:grid;gap:.25rem}
input,select{background:#1e1420;color:var(--off);border:1px solid var(--edge);border-radius:5px;padding:.52rem;width:100%;min-width:0}
form{display:grid;gap:.75rem}
.slots{display:grid;gap:.6rem}
.slot{display:flex;justify-content:space-between;align-items:center;padding:.65rem;background:#1e1420;border:1px solid #573c42;border-radius:5px;gap:.55rem}
.slot small{display:block}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:.5rem}
.stats input{max-width:6rem}
.preview-chip{border:1px solid var(--edge);padding:.55rem .7rem;margin:0;border-radius:5px;background:#331f2c}
.log{padding:.55rem .7rem;max-height:285px;overflow:auto;background:#1b121c;overflow-wrap:anywhere}
.log p{margin:.25rem 0}
.log p[data-type=narrative]{color:#ffd694}
.compact{margin:.25rem 0;padding-left:1.4rem}
.toast{position:fixed;z-index:7;bottom:4.7rem;left:50%;translate:-50% 0;background:#342335;border:1px solid var(--gold);color:var(--off);padding:.65rem .9rem;border-radius:6px;max-width:90vw;width:max-content}
dialog:has(+.toast:not([hidden]))::after{content:none}
.inline-error{color:#ffbbac}
@media(max-width:680px){
 .hud{flex-wrap:wrap;gap:.35rem;padding:.48rem .65rem}.hud nav{order:3;width:100%;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.22rem}.hud nav button,.hud-link,.actions button{padding:.45rem .33rem;font-size:.76rem}
 .actions{gap:.3rem;padding:.45rem .45rem;flex-wrap:wrap;justify-content:center}.identity{width:100%;display:flex;justify-content:space-between;font-size:.8rem}.actions button{flex:1}
 .logo{width:29cqw;top:4%}.location h1{font-size:1.35rem}.location small{font-size:.62rem}
 .table{width:91cqw;top:64%}.master{width:37cqw;height:35%;top:23%}.seats{width:83cqw;top:69%;height:16%}
 .tower{left:auto;right:3%;top:51%}.atlas{top:61%}.quest{right:auto;left:3%;top:51%}.quest img{width:2.25rem}.narration p{font-size:.78rem}
}
@media(max-height:510px) and (min-width:681px){.logo{width:29cqh}.location h1{font-size:1.2rem}.narration{padding:.2rem .5rem}.narration p{font-size:.76rem}.hud,.actions{padding:.32rem 1rem}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;scroll-behavior:auto!important}}
body.still .roll-result{animation:none}
.master{clip-path:inset(0 0 23% 0);top:24%}
.seats{top:70%;height:17%}
.seat small{top:54%}
@media(max-width:680px){.master{top:29%}.seats{top:69%;height:14%}}

/* Use the table width as the reference scale for every piece on the stage. */
.stage{--table-width:min(68cqw,124cqh)}
.table{width:var(--table-width);top:61%}
.master{top:19%}
.atlas{top:54%}
.tower,.quest{top:42%}
.seats{top:65%;height:auto;width:calc(var(--table-width) * .88);gap:1%}
.seat{display:block}
.seat img{display:block;margin:auto;width:81%;height:auto;aspect-ratio:1072/1413;filter:drop-shadow(0 .55rem .32rem #160d13a8)}
.seat small{top:72%;left:50%;translate:-50% 0}
.seat .avatar{left:50%;translate:-50% 0;top:-12%}
.roll-sprite{position:absolute;z-index:2;width:min(30cqw,320px);left:55%;top:47%;pointer-events:none;transform:translate(-50%,-35%)}
a.signin{color:var(--gold)}
@media(max-width:680px){
 .stage{--table-width:91cqw}
 .table{top:61%}.master{top:26%}.tower,.quest{top:49%}.atlas{top:58%}.seats{top:65%}
 .roll-sprite{width:55cqw;top:52%}
}
@media(max-height:510px) and (min-width:681px){.stage{--table-width:min(68cqw,97cqh)}}

#enemy{position:absolute;left:21%;bottom:34%;width:min(20cqw,32cqh);z-index:1;pointer-events:none}
.coin{width:1.55rem;height:1.55rem;vertical-align:middle;margin-inline:.22rem}
.npc-preview{float:right;width:min(35%,150px);margin-left:1rem}
.local-map{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.55rem;padding:1rem;background:linear-gradient(#1b131eb0,#1b131eef),url('assets/panoramas/c1.webp') center/cover;border-radius:.5rem}
.controller-focus{outline:3px solid #ffe89b!important;outline-offset:2px}
.stage[data-location="road"] .backdrop{background-image:linear-gradient(0deg,#1b111de0,transparent 60%),url('assets/estrada1.webp')}
.stage[data-location="v1"] .backdrop{background-image:linear-gradient(0deg,#1b111de0,transparent 60%),url('assets/panoramas/c1.webp')}
html,body{overflow:hidden}
.hud,.actions{flex-wrap:wrap}
.region-map{position:relative;display:block;aspect-ratio:1;background:url('assets/atlas-destemia.webp') center/contain no-repeat #18252d;padding:0}
.region-map button{position:absolute;bottom:5%;left:48%;transform:translateX(-50%);background:#33202d}
.region-map button+button{bottom:16%;left:32%}

/* Game controls are overlays on the scene. */
.game-menu{position:absolute;z-index:4;top:max(.85rem,env(safe-area-inset-top));right:max(1rem,env(safe-area-inset-right));background:#211622e8;border-color:var(--gold)}
.game-menu-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.6rem}
.stage .location{top:4.25rem}
.stage .actions{position:absolute;z-index:3;bottom:max(.7rem,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 1.2rem);justify-content:center;border:1px solid #b58350;border-radius:.6rem;background:#211622ed;padding:.45rem .6rem}
.stage .identity{max-width:14rem;padding-inline:.4rem}
.stage .seats{z-index:2}
.stage .seat{aspect-ratio:1072/1413}
.stage .seat img{position:absolute;bottom:0;left:50%;transform:translateX(-50%);height:100%;width:100%;object-position:center bottom}
.stage .seat.occupied img{height:121%;width:100%;aspect-ratio:auto}
.stage .seat small{top:auto;bottom:-1.15rem;font-size:.78rem}
.stage .narration{z-index:3;bottom:auto;top:calc(19% + 2cqh);left:calc(50% + min(14cqw,19cqh));translate:none;width:min(26cqw,24rem);min-width:12rem;max-height:20cqh;overflow:visible;text-align:left;background:#fff0d1;color:#29182b;border:2px solid #784b30;border-radius:.75rem;pointer-events:none}
.stage .narration strong{color:#663b29}
.stage .narration::before{content:"";position:absolute;top:52%;left:-.55rem;width:.9rem;height:.9rem;background:#fff0d1;border-left:2px solid #784b30;border-bottom:2px solid #784b30;transform:rotate(45deg)}
.character-setup{display:grid;grid-template-columns:minmax(0,1fr) minmax(100px,34%);gap:.8rem;align-items:start}
.character-preview{display:grid;justify-items:center;margin:0;min-width:0;text-align:center;color:var(--gold);background:#1e1420;border:1px solid var(--edge);border-radius:.5rem;padding:.45rem}
.character-preview img{height:clamp(95px,23dvh,210px);width:100%;object-fit:contain}
.character-preview figcaption{font-size:.85rem}
@media(max-width:680px){
 .stage .location{top:3.65rem}
 .stage .narration{top:auto;bottom:75%;left:50%;translate:-50% 0;width:min(66vw,22rem);max-height:none}
 .stage .narration::before{top:auto;bottom:-.55rem;left:48%;transform:rotate(-45deg)}
 .stage .actions{width:max-content;max-width:calc(100% - .7rem);padding:.35rem}
 .stage .identity{width:100%;max-width:none;justify-content:center;gap:.45rem}
 .stage .seat small{font-size:.66rem}
 .character-setup .grid{grid-template-columns:1fr}
}
@media(max-height:520px) and (min-width:681px){.stage .location{top:3.3rem}.stage .narration{top:16%;padding:.35rem .55rem}.stage .actions{bottom:.3rem}}

[hidden]{display:none!important}
#welcome{min-height:100dvh;overflow:auto;display:grid;align-content:center;justify-items:center;gap:.75rem;padding:1rem;background:linear-gradient(#17101bd9,#17101bef),url('assets/taverna.webp') center/cover}
#welcome>img{width:min(58vw,235px);max-height:29dvh;object-fit:contain}
#welcome-actions{width:min(100%,390px);background:#211622ed;border:1px solid var(--edge);border-radius:.7rem;padding:1rem}
#welcome-actions .row{display:grid;margin-bottom:0}
#welcome-actions a{color:var(--gold)}
#welcome-status:empty{display:none}
.stage{--table-width:min(58cqw,100cqh)}
.stage .table{top:61%}
.stage .master{left:50%;top:20%;width:min(22cqw,30cqh)}
.stage .seats{top:65%}
.sheet-portrait{float:right;max-width:32%;height:min(23dvh,165px);object-fit:contain;margin:0 0 .5rem .8rem}
#table-chat{position:absolute;z-index:4;left:max(.6rem,env(safe-area-inset-left));top:39%;width:min(23cqw,245px);min-width:150px;background:#231828ef;border:1px solid #a67549;border-radius:.5rem;overflow:hidden}
#chat-handle{display:block;width:100%;text-align:left;touch-action:none;cursor:grab;border:0;border-radius:0;background:#442a38;color:#ffda97;padding:.35rem .55rem}
#chat-handle:active{cursor:grabbing}
#table-messages{height:clamp(3.2rem,15cqh,8rem);font-size:.78rem}
#table-message-form{display:flex;gap:.25rem;padding:.3rem}
#table-message-form input,#table-message-form button{padding:.3rem;font-size:.75rem}
@media(max-width:680px){
 .stage{--table-width:77cqw}
 .stage .master{top:26%;width:33cqw}
 #table-chat{top:auto;bottom:6.4rem;width:min(54cqw,210px)}
 #table-messages{height:3.5rem}
}

.stage .seats{top:62.5%;width:calc(var(--table-width) * .79);gap:.4%}
#combat-hud{position:absolute;z-index:5;right:max(.6rem,env(safe-area-inset-right));bottom:5.4rem;width:min(28cqw,24rem);min-width:14rem;max-height:42cqh;overflow:auto;padding:.65rem;background:#211622ed;border:1px solid #b58350;border-radius:.55rem;font-size:.86rem}
#fightInfo p{margin:0 0 .35rem}
#fightActions button{display:inline-flex;align-items:center;gap:.35rem;padding:.35rem .5rem}
#fightActions img{width:1.55rem;height:1.55rem;object-fit:contain}
#combat-close{font-size:.75rem;padding:.25rem .4rem}
#combat-effects{position:absolute;inset:0;z-index:6;pointer-events:none}
.battle-effect{position:absolute;translate:-50% -50%;width:clamp(90px,15cqw,235px);aspect-ratio:1;display:grid;place-items:center}
.battle-effect canvas{position:absolute;width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
.battle-effect strong{position:relative;color:#ffb99b;text-shadow:0 2px 3px #000,0 0 4px #000;font-size:clamp(16px,2cqw,30px);animation:combat-rise .62s ease-out both}
.battle-effect strong.healing{color:#9effba}
@keyframes combat-rise{from{transform:translateY(15px);opacity:.5}to{transform:translateY(-22px);opacity:1}}
body.still .battle-effect strong{animation:none}
@media(max-width:680px){#combat-hud{bottom:6.5rem;width:min(55vw,18rem);min-width:0;max-height:35cqh;font-size:.74rem}#fightActions button{padding:.25rem .35rem}}

/* A criatura ocupa o plano do cenário, acima da borda da mesa. */
#enemy{left:29%;bottom:52%;width:min(13cqw,20cqh);max-height:21cqh;object-fit:contain}
.initiative-badge{position:absolute;z-index:4;top:2%;right:5%;display:grid;place-items:center;min-width:1.48rem;height:1.48rem;border:1px solid #edbd67;border-radius:50%;background:#281827;color:#ffe4a2;font-weight:800;font-size:.78rem}
.initiative-current{background:#ffe3a1;color:#301a29;box-shadow:0 0 .7rem #f2b950}
#enemy-order{top:32%;left:38%;right:auto}
.initiative-reveal{position:absolute;top:29%;left:50%;translate:-50% 0;padding:.45rem .85rem;border:1px solid #eac470;border-radius:.4rem;background:#281927e8;color:#ffe2a2;font-weight:800;animation:reveal .45s ease-out}
.combat-wait{color:#ffd789;font-weight:650}
@media(max-width:680px){#enemy{left:22%;bottom:52%;width:21cqw;max-height:18cqh}#enemy-order{left:37%;top:34%}.initiative-badge{min-width:1.16rem;height:1.16rem;font-size:.68rem}}

.stage .table{top:69%}
.stage .master{top:28%}
.stage .seats{top:68.5%;width:calc(var(--table-width) * .77)}
.stage .atlas{top:63%}
.stage .tower,.stage .quest{top:51%}
#enemy{left:33%;bottom:61%;width:min(11cqw,16cqh)}
#enemy-order{left:41%;top:25%}
#enemy-target{position:absolute;left:32%;top:39%;z-index:5;border-color:#ffdf8a;background:#372239;box-shadow:0 0 .9rem #df9e55}
#combat-hud{left:50%;right:auto;bottom:4rem;transform:translateX(-50%);width:max-content;max-width:calc(100% - 1rem);min-width:0;max-height:32cqh;padding:.35rem .55rem;background:linear-gradient(#2f2029eb,#1f1522f5);box-shadow:0 0 0 1px #382437,inset 0 0 14px #c3742928}
#fightInfo .compact{display:none}
#fightInfo p{text-align:center}
#fightActions{justify-content:center;gap:.35rem;margin:.25rem 0}
#fightActions .combat-slot{display:grid;justify-items:center;gap:.13rem;min-width:3.7rem;padding:.25rem .35rem;font-size:.75rem;background:linear-gradient(#594036,#30202b);border-color:#a97b50}
#fightActions .combat-slot:hover:not(:disabled),#fightActions [aria-pressed="true"]{box-shadow:inset 0 0 .7rem #f7b56f6b,0 0 .5rem #bd783d;border-color:#ffda83}
#fightActions img,.combat-symbol{width:1.6rem;height:1.6rem;font-size:1.2rem;text-align:center;color:#f9cc82}
#fightActions small{font-size:.65rem;color:#d6c6ff}
#combat-close{display:block;margin:0 auto}
@media(max-width:680px){#enemy{left:22%;bottom:59%;width:17cqw}#enemy-order{left:36%;top:30%}#enemy-target{left:17%;top:41%;font-size:.72rem}#combat-hud{bottom:5.5rem;max-height:31cqh}.stage .master{top:31%}.stage .seats{top:66%}}

.stage{--table-width:min(47cqw,82cqh)}
.stage .table{top:68%}
.stage .master{top:33%;width:min(18cqw,23cqh);height:29%}
.stage .seats{top:68%;width:calc(var(--table-width) * .78)}
.stage .atlas{top:64%}
.stage .quest{top:64%;right:calc(50% + var(--table-width)*.29)}
.stage .tower{top:56%;left:calc(50% + var(--table-width)*.31)}
.stage .narration{top:30%}
.seat-vitals{position:absolute;z-index:4;top:99%;left:50%;width:100%;min-width:3.4rem;max-width:8rem;translate:-50% 0;background:#211622ef;color:#fff0d3;border:1px solid #b88057;border-radius:.35rem;padding:.2rem .32rem;font-size:clamp(8px,.88cqw,13px)}
.seat-vitals strong{display:block;overflow:hidden;text-overflow:ellipsis}
.vital-row{display:grid;grid-template-columns:auto minmax(.35rem,1fr) auto;align-items:center;gap:.21rem;white-space:nowrap}
.vital-row progress{width:100%;height:.36rem;accent-color:#dd5259}
.vital-row.mp progress{accent-color:#70a9ff}
#fightActions .combat-slot{min-width:4.3rem;min-height:3.8rem;font-size:.8rem}
#fightActions img,.combat-symbol{width:2.18rem;height:2.18rem;font-size:1.68rem}
.journal-entry{padding:.65rem;border:1px solid #a5724c;border-radius:.45rem;margin-bottom:.55rem;background:#382636}
.journal-entry h3{margin:.2rem 0;color:#ffd98c}
@media(max-width:680px){
 .stage{--table-width:min(68cqw,71cqh)}
 .stage .master{top:34%;width:28cqw}
 .stage .seats{top:65%}
 .stage .narration{top:auto;bottom:66%}
 .stage .quest{top:57%}
 #fightActions .combat-slot{min-width:3rem;min-height:2.8rem;font-size:.64rem}
 #fightActions img,.combat-symbol{width:1.65rem;height:1.65rem}
}

#table-chat{width:min(24cqw,285px);min-width:198px;top:32%}
#chat-channels{display:flex;flex-wrap:wrap;gap:.15rem;padding:.2rem}
#chat-channels button,#chat-social{font-size:.75rem;padding:.22rem .31rem}
#chat-channels button[aria-pressed="true"]{color:#241725;background:#ffd991}
#table-message-form{display:grid;grid-template-columns:minmax(0,1fr) auto}
#chat-recipient{grid-column:1/-1;width:100%}
#chat-social{margin:0 .3rem .3rem}
.stage .master{top:41%;width:min(14cqw,19cqh);height:23%}
.stage .table{top:70%}
.stage .seats{top:70%}
.stage .quest{top:60%;right:calc(50% + var(--table-width)*.27);z-index:4}
.stage .narration{top:38%;left:calc(50% + min(9cqw,11cqh));width:min(22cqw,19rem);font-size:.82rem}
.stage .narration p{font-size:inherit}
@media(max-width:680px){
 #table-chat{top:22%;bottom:auto;min-width:0;width:min(50cqw,220px)}
 .stage .master{top:44%;width:22cqw}
 .stage .seats{top:67%}
 .stage .narration{top:auto;bottom:58%;left:75%;width:44cqw;min-width:0;font-size:.7rem}
 .stage .quest{top:57%;right:calc(50% + var(--table-width)*.22)}
}

/* The wooden surface and its interactive objects are separate layers. */
.stage .quest,.stage .atlas,.stage .tower{top:calc(70% - var(--table-width)*.08);z-index:4}
.stage .quest{right:calc(50% + var(--table-width)*.28)}
.stage .quest img{width:clamp(1.4rem,3cqw,2.8rem);margin-top:0}
.stage .tower{left:calc(50% + var(--table-width)*.20)}
.stage .master{top:auto;bottom:32%;clip-path:none}
@media(max-width:680px){
 .stage .seats{top:70%}
 .stage .quest{left:auto}
 .stage .tower{right:auto}
 .stage .quest,.stage .atlas,.stage .tower{font-size:.62rem;padding:.16rem .22rem}
}

.stage .backdrop{inset:-6px -21px;transform:translateX(var(--scenery-x,0px));transition:transform .26s ease-out}
body.still .stage .backdrop{transform:none}
.stage .hotspot{display:grid;justify-items:center;gap:.12rem;border-color:transparent;background:transparent;color:#fff3d8;text-shadow:0 2px 3px #160908,0 0 4px #160908;font-weight:700}
.stage .hotspot:hover,.stage .hotspot:focus-visible{color:#fff0a6}
.stage .hotspot span{font-size:1.45em}
.stage .master{width:min(12cqw,17cqh);height:21%;bottom:34%}
.stage .seats{top:67.5%}
.stage .narration{top:auto;bottom:49%;left:calc(50% + min(6cqw,8cqh));width:min(20cqw,17rem)}
.stage .narration::before{top:74%}
.stage #enemy{bottom:52%;left:31%;width:min(9cqw,13cqh);filter:drop-shadow(0 .4rem .16rem #241211a0)}
.stage[data-location="road"] #enemy{bottom:48%}
.stage #enemy-order{top:36%;left:38%}
.stage #enemy-target{top:46%;left:29%}
#combat-hud{bottom:4.45rem}
.stage .actions{white-space:nowrap}
#fightActions select{width:auto}
.region-map button.atlas-pin{left:var(--pin-x);top:var(--pin-y);bottom:auto;transform:translate(-50%,-50%);z-index:1;width:1.45rem;height:1.45rem;display:grid;place-items:center;border-radius:50%;padding:0;color:#ffe398;background:#382239;border:1px solid #efd078}
.region-map .atlas-pin-current{background:#b15a3a!important}
.region-map .atlas-pin:hover,.region-map .atlas-pin:focus-visible{z-index:3}
.atlas-label{display:none;position:absolute;bottom:120%;left:50%;translate:-50% 0;padding:.2rem .35rem;background:#261729;border:1px solid #b88b56;border-radius:.3rem;white-space:nowrap;pointer-events:none}
.atlas-pin:focus-visible .atlas-label,.atlas-pin:hover .atlas-label{display:block}
@media(max-width:680px){
 .stage .master{width:19cqw;bottom:33%}
 .stage .narration{bottom:48%;left:63%;translate:none;width:34cqw}
 .stage .narration::before{left:-.55rem;bottom:auto;transform:rotate(45deg)}
 .stage #enemy{left:22%;width:17cqw}
 .stage #enemy-order{left:34%;top:37%}
 .stage #enemy-target{left:20%;top:47%}
 .region-map button.atlas-pin{width:1.12rem;height:1.12rem;font-size:.65rem}
}
@media(prefers-reduced-motion:reduce){.stage .backdrop{transform:none;transition:none}}
#combat-hud{background:transparent;border:0;box-shadow:none;bottom:4.7rem;overflow:visible}
#fightInfo p{background:none;color:#fff0cc;text-shadow:0 1px 4px #140812,0 0 4px #140812}
#fightActions .combat-slot{position:relative}
#fightActions kbd{position:absolute;top:.15rem;left:.25rem;font-size:.67rem;color:#ecc784}
#enemy-vitals{position:absolute;z-index:3;left:31%;bottom:49%;width:min(9cqw,13cqh);display:grid;gap:.12rem;text-align:center;color:#fff0d2;text-shadow:0 1px 3px #160612;font-size:.69rem}
#enemy-vitals progress{width:100%;height:.48rem;accent-color:#ff4657}
.stage[data-location="road"] #enemy-vitals{bottom:45%}
.stage #enemy-target{top:53%}
@media(max-width:680px){#enemy-vitals{left:22%;width:17cqw}#combat-hud{bottom:5.65rem;max-width:96%;max-height:31cqh;overflow:auto}}

.stage .tower{top:calc(70% - var(--table-width)*.12);z-index:4}
.stage .tower img{display:block;width:clamp(2rem,calc(var(--table-width)*.085),5rem);height:auto;filter:drop-shadow(0 2px 2px #1d1010a0);pointer-events:none}

.seat-inspect{position:absolute;inset:0;z-index:5;border:0;background:transparent}
.seat-inspect:hover{background:transparent;box-shadow:0 0 .5rem #f8cf7b88}
#enemy-formation{position:absolute;z-index:3;left:28%;right:28%;bottom:48%;display:flex;justify-content:space-around;gap:.25rem}
.stage[data-location="road"] #enemy-formation{bottom:44%}
.enemy-figure{display:grid;justify-items:center;padding:.1rem;flex:0 1 min(10cqw,14cqh);min-width:0;background:none;border-color:transparent}
.enemy-figure img,.enemy-figure progress{width:100%;height:auto}
.enemy-figure img{filter:drop-shadow(0 .4rem .17rem #2514149c);aspect-ratio:1;object-fit:contain}
.enemy-figure progress{height:.35rem;accent-color:#ff4657}
.enemy-figure small{font-size:clamp(.55rem,1cqw,.8rem);white-space:nowrap;text-shadow:0 1px 3px #150917}
.enemy-defeated{opacity:.33}
.aiming .enemy-figure:not(.enemy-defeated){border-color:#fcd98f;box-shadow:0 0 .65rem #e9ae59}
@media(max-width:680px){#enemy-formation{left:17%;right:20%}.enemy-figure{flex-basis:15cqw}}
#check-notice{position:absolute;z-index:5;top:3.3rem;right:1rem;border-color:#f5c378;color:#ffe3a2;background:#3a2536;font-size:.8rem}

dialog.world-atlas{width:min(91vw, calc(88dvh + 150px));max-height:94dvh}
.world-atlas .region-map{width:min(100%,69dvh);margin-inline:auto}
.region-map .atlas-pin:disabled{opacity:.66;color:#c5ac9d;background:#291c26}
.npc-preview{width:min(44%,220px)}
.stage .quest{right:calc(50% + var(--table-width)*.32);top:calc(70% - var(--table-width)*.10)}
.stage .atlas{left:calc(50% + var(--table-width)*.02);top:calc(70% - var(--table-width)*.025)}
.stage .tower{left:calc(50% + var(--table-width)*.31);top:calc(70% - var(--table-width)*.15)}
.origin-story{line-height:1.65}
@media(max-width:680px){
 .stage .tower{left:calc(50% + var(--table-width)*.29)}
 .stage .quest{right:calc(50% + var(--table-width)*.27)}
}
.atlas-routes{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.atlas-routes line{stroke:#ffe39d;stroke-width:5;stroke-dasharray:12 8;filter:drop-shadow(0 0 3px #3f2519)}

.stage .quest{right:calc(50% + var(--table-width)*.34);top:calc(70% - var(--table-width)*.12)}
.stage .atlas{left:calc(50% - var(--table-width)*.24);top:calc(70% - var(--table-width)*.12)}
.stage .tower{left:calc(50% + var(--table-width)*.32);top:calc(70% - var(--table-width)*.15)}
.actor-d20{position:absolute;translate:-50% -50%;width:clamp(3.2rem,8cqw,7rem);height:clamp(3.2rem,8cqw,7rem);display:grid;place-items:center;animation:actor-d20-rise .62s ease-out both}
.actor-d20 img{width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
.actor-d20 b{font-size:1.15rem;padding:.22rem .5rem;color:#fff7d1;background:#532748;border:1px solid #ffc96d;border-radius:.45rem;text-shadow:0 1px 2px #21091a}
@keyframes actor-d20-rise{from{transform:translateY(0) scale(.7)}to{transform:translateY(-3.8rem) scale(1)}}
body.still .actor-d20{animation:none}
@media(prefers-reduced-motion:reduce){.actor-d20{animation:none}}
@media(max-width:680px){
 .stage .quest{right:calc(50% + var(--table-width)*.29)}
 .stage .atlas{left:calc(50% - var(--table-width)*.16)}
 .stage .tower{left:calc(50% + var(--table-width)*.29)}
}

#scene-navigation{display:flex;justify-content:flex-end;align-items:center;gap:.5rem;margin:.45rem 0 0 auto;padding:.3rem;width:max-content;max-width:100%;text-align:left;background:#211623ed;border:1px solid #916b48;border-radius:.5rem}
#scene-navigation[hidden]{display:none}
#scene-navigation strong,#scene-navigation small{display:block}
#scene-navigation strong{font-size:.78rem}
#minimap{display:grid;justify-items:center;gap:.1rem;padding:.2rem;font-size:.72rem}
.minimap-art{position:relative;display:block;width:3.4rem;aspect-ratio:1;border-radius:.2rem;background:url('assets/atlas-destemia.webp') center/contain no-repeat}
#minimap-marker,.atlas-current-road::before{position:absolute;width:.55rem;height:.55rem;border:1px solid #fff4c2;border-radius:50%;background:#ffbf4d;box-shadow:0 0 .3rem #1c1010;transform:translate(-50%,-50%)}
.atlas-current-road{position:absolute;color:#fff4c2;font-size:.72rem;text-shadow:1px 1px #191019,-1px -1px #191019;pointer-events:none;padding-left:.5rem}
.atlas-current-road::before{content:'';left:0;top:50%}
#victory-options:not(:empty){display:flex;flex-wrap:wrap;gap:.3rem;margin-top:.4rem}
#victory-options button{pointer-events:auto;font-size:.74rem;padding:.3rem .45rem}
@media(max-width:680px),(max-height:520px){.minimap-art{width:2rem}#scene-navigation{gap:.3rem}#scene-navigation strong{font-size:.69rem}}

#table-chat{width:clamp(13rem,22cqw,24rem)}
#table-messages{height:clamp(6rem,22cqh,13rem)}
#table-message-form input{min-height:2rem}
#enemy-formation .enemy-figure,#enemy-formation .enemy-figure:is(:hover,:focus,:focus-visible,.controller-focus){background:transparent;border-color:transparent;box-shadow:none;outline:none!important}
#enemy-formation .enemy-figure:is(:hover,:focus-visible,.controller-focus) img,.aiming .enemy-figure:not(.enemy-defeated) img{filter:drop-shadow(0 0 2px #fff6c4) drop-shadow(0 0 5px #ffb62f)}
#resident-scene{--npc-height:min(35cqh,20rem);position:absolute;z-index:6;right:3%;bottom:18%;width:min(24cqw,22rem);display:grid;justify-items:center;grid-template-rows:auto auto;gap:.5rem}
#resident-scene #narrated-npc{display:block;width:100%;height:var(--npc-height);object-fit:contain;object-position:center bottom;grid-row:2}
.resident-bubble{position:relative;grid-row:1;width:100%;background:#fff0d1;color:#29182b;border:2px solid #784b30;border-radius:.65rem;padding:.45rem;font-size:.82rem}
#resident-scene::after{grid-row:1;grid-column:1;align-self:end;justify-self:center;z-index:1;pointer-events:none;content:'';margin-bottom:-.35rem;width:.7rem;height:.7rem;background:#fff0d1;border-right:2px solid #784b30;border-bottom:2px solid #784b30;transform:rotate(45deg)}
#npc-close{float:right;padding:.15rem .4rem}
#resident-choices button{font-size:.72rem}
#camp-scene{position:absolute;left:23%;bottom:36%;z-index:3;display:grid;text-align:center;width:min(20cqw,16rem);aspect-ratio:4/3;background:center/contain no-repeat url('assets/acampamento.webp');align-items:end;pointer-events:none;text-shadow:0 1px 4px #160908}
@media(max-width:680px){#table-chat{width:min(44cqw,13rem)}#table-messages{height:12cqh}#resident-scene{--npc-height:min(31cqh,15rem);right:2%;width:52cqw;bottom:12%}}
#enemy-formation .loot-drop{align-content:end;color:#ffe19a;font-size:1.4rem;text-shadow:0 0 .35rem #b65c1b,0 1px 2px #100a0a}
#enemy-formation .loot-drop small{font-size:.7rem;white-space:normal}
#enemy-formation .loot-drop:is(:hover,:focus-visible){color:#fff;filter:drop-shadow(0 0 .3rem #ffc362)}
.empty-enemy{pointer-events:none}

.cartography{display:grid;grid-template-columns:minmax(0,1fr) minmax(11rem,23%);gap:.65rem;margin-bottom:.7rem}
.cartography-board{position:relative;aspect-ratio:3/2;align-self:start;border:1px solid #c49360;border-radius:.5rem;background:#292228}
.cartography-board canvas{display:block;width:100%;height:auto;border-radius:inherit}
.cartography-board .cartography-pin,.cartography-current{position:absolute;transform:translate(-50%,-50%)}
.cartography-board .cartography-pin{display:grid;place-items:center;width:clamp(1.12rem,2.5vw,1.7rem);aspect-ratio:1;padding:0;border:1px solid #f5d295;border-radius:50%;background:#302231;color:#fff7df;font-size:clamp(.58rem,1.2vw,.82rem);font-weight:bold}
.cartography-board .cartography-pin[aria-pressed=true],.cartography-board .cartography-pin:hover{background:#f1c886;color:#271c23;box-shadow:0 0 0 .15rem #281c29}
.cartography-current{color:#fff5a8;text-shadow:0 0 3px #1d1720,0 1px 3px #1d1720;font-size:1.3rem;pointer-events:none}
.cartography-key{max-height:55dvh;overflow:auto;padding:.5rem;border:1px solid #765840;border-radius:.45rem}
.cartography-key ol{margin:.4rem 0 0;padding-left:1.6rem}
.cartography-key li+li{margin-top:.18rem}
.cartography-key button{width:100%;text-align:left;padding:.3rem .45rem;font-size:.79rem}
.cartography-selected{display:grid;gap:.3rem;padding-bottom:.4rem;border-bottom:1px solid #765840}
.cartography-location{color:#ffe4a3;font-size:.82rem}
@media(max-width:680px){.cartography{grid-template-columns:minmax(0,1fr)}.cartography-key{max-height:30dvh}}

#master-dismiss{float:right;margin:0 0 .15rem .25rem;padding:.08rem .42rem;pointer-events:auto}
#master-guidance button{pointer-events:auto;font-size:.74rem;padding:.3rem .45rem}
#master-guidance:empty{display:none}
#master-talk{position:absolute;z-index:4;left:50%;bottom:34%;transform:translateX(-50%);font-size:.7rem;padding:.2rem .42rem;color:#ffdda2;background:#211622ed;border-color:#ab7d4d}

.cartography-board .cartography-pin{background:transparent;border:0;box-shadow:none;width:clamp(1.65rem,4vw,2.8rem);height:auto;isolation:isolate;text-shadow:0 1px 3px #150e17}
.cartography-board .cartography-pin img{width:100%;height:auto;filter:drop-shadow(0 2px 1px #261f28)}
.cartography-board .cartography-pin[aria-pressed=true],.cartography-board .cartography-pin:hover{background:transparent;color:#fff;box-shadow:none}
.cartography-pin[aria-pressed=true] img,.cartography-pin:hover img{filter:drop-shadow(0 0 4px #ffeb8b)}
.cartography-key button{border-color:#a68a6055;background:#92775126}
#village-conversation{position:absolute;left:50%;top:8%;translate:-50% 0;z-index:6;background:#32686a;color:#fff2cf;border-color:#a7d4bf}
.resident-mood{width:100%;color:#6a452b}
.resident-answers{display:grid;gap:.25rem;width:100%}
#resident-choices .answer-choice{background:#376c64;color:#fff9dc;border-color:#66917e;text-align:left}
#resident-choices .answer-choice[aria-pressed=true]{background:#f1c270;color:#2d2521}
#resident-choices .answer-choice:hover{background:#4e897c}
#resident-choices .primary,.forge-recipe .primary{background:#efba63;color:#32221c}
.forge-recipe{display:grid;gap:.25rem;margin:.5rem 0;padding:.6rem;background:#69533935;border-left:.18rem solid #dd9851}
.forge-recipe p{margin:0}
.resident-bubble{max-height:min(42cqh,calc(100cqh - var(--npc-height) - 20cqh - .5rem));overflow:auto;overscroll-behavior:contain}
#victory-options .road-choice{background:#3c716b;color:#fff8dd;border-color:#82a992}
#victory-options .road-choice.primary,#victory-options .road-choice[aria-pressed=true]{background:#efba63;color:#32221c;border-color:#ffe4a3}
#resident-scene #narrated-npc,.resident-bubble{grid-column:1}

.inventory-items{display:grid;gap:.32rem;margin:.6rem 0}
.inventory-material{display:flex;align-items:center;gap:.45rem;padding:.22rem .35rem;border-bottom:1px solid #a87a5948}
.inventory-icon{width:2.15rem;height:2.15rem;object-fit:contain}
.loot-drop .inventory-icon{margin:auto}

.resident-check{display:grid;gap:.4rem;border-top:1px solid #ac8255;padding-top:.42rem}
.resident-dice{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.3rem}
.resident-die{display:grid;justify-items:center;align-content:start;gap:.22rem;text-align:center;padding:.32rem;background:#e8d1ad;border-radius:.36rem;overflow-wrap:anywhere}
.resident-die img{width:2.45rem;height:2.45rem;object-fit:contain}
.resident-die-face{display:grid;place-items:center;width:2.45rem;aspect-ratio:1;clip-path:polygon(50% 0,97% 29%,97% 72%,50% 100%,3% 72%,3% 29%);background:#32655e;color:#fff8de;font-size:1.08rem}
.resident-die:nth-child(2) .resident-die-face{background:#663c59}
.resident-roll-status,.resident-verdict p{margin:.14rem 0}
.resident-verdict .passed{color:#235343}
.resident-verdict .failed{color:#8d2c35}

#action-status{position:absolute;right:0;bottom:100%;margin-bottom:.18rem;pointer-events:none;color:#ffe1a0;background:#211622;border-radius:.25rem;padding:.1rem .35rem;font-size:.68rem;white-space:nowrap}

#world-link.world-open{border-color:#8bb68c;color:#daebae}
.combat-projectile{position:absolute;width:clamp(35px,7cqw,96px);height:auto;image-rendering:pixelated;pointer-events:none}
.combat-turn-budget{color:#ffe293}

.stage{--master-die-x:calc(50% - min(15cqw,22cqh))}
.stage #rollResult,.stage #rollSprite{left:var(--master-die-x);top:39%;z-index:7}
.stage #rollSprite{width:min(22cqw,235px);transform:translate(-50%,-50%)}
.actor-d20.master-roll{left:var(--master-die-x)!important;top:42%!important}
@media(max-width:680px){.stage{--master-die-x:26%}.stage #rollSprite{width:min(40cqw,155px)}}

dialog.bestiary-dialog{width:min(95vw,70rem);max-height:91dvh}
.bestiary-page{color:#f7e5c7;font-size:1rem}
.bestiary-summary{display:grid;grid-template-columns:1fr auto;gap:1.2rem;align-items:center;margin-bottom:1rem;padding:.85rem 1rem;border-block:1px solid #876448;background:#30202d}
.bestiary-summary strong,.bestiary-summary small{display:block}
.bestiary-summary progress{display:block;width:100%;height:.6rem;margin:.45rem 0;accent-color:#edbd69}
.bestiary-summary small{color:#e0c6a5}
.bestiary-prize{display:grid;grid-template-columns:2.4rem auto;column-gap:.6rem;align-items:center;color:#ffda8e}
.bestiary-prize img{width:100%;grid-row:span 2}
.bestiary-collection{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(8rem,100%),1fr));gap:.65rem}
.bestiary-tile{box-sizing:border-box;display:grid;align-content:start;justify-items:center;gap:.3rem;padding:.5rem .35rem;min-width:0;min-height:9.55rem;text-align:center;color:#f7e7c9;border:1px solid #8c6949;border-radius:.45rem;background:radial-gradient(ellipse at 50% 28%,#86664d,#3a2832 82%)}
.bestiary-tile strong{overflow-wrap:anywhere;font-size:.875rem;line-height:1.2}
.bestiary-tile small{font-size:.76rem;color:#e0c6a5;line-height:1.18}
.bestiary-tile img{display:block;width:100%;max-width:5.6rem;aspect-ratio:1;object-fit:contain}
.catalog-icon{display:inline-block;aspect-ratio:1;background-repeat:no-repeat;flex-shrink:0}
.bestiary-icon{width:min(100%,6.7rem)}
.forge-list{display:grid;gap:.45rem;margin-top:.6rem}
.bestiary-tile.is-unknown{align-content:center}
.bestiary-tile.is-unknown .bestiary-icon{filter:brightness(0) invert(.08) sepia(.23) saturate(1.7)}
.bestiary-tile.is-seen .bestiary-icon{filter:brightness(0) invert(.34) sepia(.23) saturate(2)}
.bestiary-tile.is-defeated{border-color:#c39a61;background:radial-gradient(ellipse at 50% 18%,#ae8352,#512b35 85%)}
.bestiary-tile.is-defeated:hover,.bestiary-tile.is-defeated:focus-visible{border-color:#ffdb88;background:#63403f}
.bestiary-detail{display:grid;grid-template-columns:minmax(12rem, 35%) 1fr;gap:1.25rem;margin-top:1rem;align-items:start}
.bestiary-detail>img{display:block;width:100%;max-height:45dvh;object-fit:contain;border-radius:.5rem}
.bestiary-detail h3{color:#ffdb92;margin-top:0;font:700 clamp(1.25rem,3vw,2rem) Georgia,serif}
.bestiary-attributes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.45rem}
.bestiary-attributes div{background:#332130;border:1px solid #825c43;padding:.35rem .5rem;border-radius:.3rem}
.bestiary-attributes dt{font-weight:700;color:#f5cf8a}
.bestiary-attributes dd{margin:.15rem 0 0}
@media(max-width:550px){
  .bestiary-summary,.bestiary-detail{grid-template-columns:1fr;gap:.7rem}
  .bestiary-prize{justify-content:start}
  .bestiary-collection{grid-template-columns:repeat(auto-fill,minmax(6rem,1fr))}
  .bestiary-detail>img{max-height:30dvh}
}

/* The panorama, actors and controls occupy separate depth bands. */
body{background:radial-gradient(ellipse at 50% 8%,#38262e,#19131b 72%)}
#play-area{display:grid;grid-template-columns:minmax(12rem,17.5rem) minmax(0,1fr) minmax(13rem,18rem);
  gap:clamp(.55rem,1.25vw,1.15rem);width:min(100%,112rem);margin:0 auto;padding:clamp(.55rem,1.25vw,1.15rem)}
.game-sidebar{display:flex;flex-direction:column;gap:.65rem;min-height:0;min-width:0;overflow:auto;scrollbar-width:thin}
.game-frame{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden;
  border:1px solid #987051;border-radius:.8rem;background:#261b26;box-shadow:0 12px 40px #0d090cb3}
.game-frame .stage{--table-width:min(66cqw,107cqh);--table-center-y:77%;--master-seat-y:calc(var(--table-center-y) - var(--table-width) * .105);min-height:18rem}
.game-frame .stage .backdrop{background:none;pointer-events:none;overflow:hidden}
#scene-panorama{position:absolute;inset:0;width:100%;height:100%;max-width:none;object-fit:cover}
.game-frame .backdrop::after{position:absolute;inset:0;content:"";background:linear-gradient(180deg,#1b122ec2,transparent 30%,transparent 54%,#1c111d9e)}
.game-frame .stage .logo{width:min(15cqw,25cqh)}
.game-frame .stage .location{top:4%;right:4%;max-width:63%}
.game-frame .stage .location h1{font-size:clamp(1rem,3.6cqw,2rem);line-height:1.1}
.game-frame .stage .table{top:var(--table-center-y)}
/* Align the wooden shield's center, width and baseline instead of centering each pose's canvas. */
.game-frame .stage .master{
  --master-shield-width:calc(var(--table-width) * .165);
  top:var(--master-seat-y);bottom:auto;
  width:0;height:0;transform:none
}
.master img{
  position:absolute;top:0;left:0;width:calc(var(--master-shield-width) * var(--frame-width));max-width:none;
  transform:translate(var(--shield-x),var(--shield-y));visibility:hidden
}
.master [data-frame="03"]{--frame-width:1.415;--shield-x:-51%;--shield-y:-96.2%}
.master [data-frame="07"]{--frame-width:1.287;--shield-x:-51.9%;--shield-y:-98%}
.master [data-frame="08"]{--frame-width:1.429;--shield-x:-50.6%;--shield-y:-96.85%}
.master [data-frame="09"]{--frame-width:1.289;--shield-x:-45.1%;--shield-y:-92.51%}
.master[data-pose="03"] [data-frame="03"],.master[data-pose="07"] [data-frame="07"],
.master[data-pose="08"] [data-frame="08"],.master[data-pose="09"] [data-frame="09"]{visibility:visible}
.game-frame .stage .seats{top:77%;height:13%;width:calc(var(--table-width) * .84)}
.game-frame .stage .seat-vitals{top:92%;min-width:0;padding:.1rem .2rem;font-size:clamp(.46rem,1.05cqw,.7rem)}
.game-frame .stage .tower{top:calc(77% - var(--table-width)*.11);left:calc(50% + var(--table-width)*.35)}
.game-frame .stage .atlas{top:71%;left:calc(50% - var(--table-width)*.24)}
.game-frame .stage .quest{top:71%;right:calc(50% + var(--table-width)*.37);left:auto}
.game-frame .stage .narration{bottom:31%;left:auto;right:4%;width:min(45cqw,22rem);min-width:0;max-height:none;overflow:visible}
.game-frame #master-talk{bottom:auto;top:calc(var(--master-seat-y) + .2rem);left:calc(50% + var(--table-width) * .095);transform:none}
.game-frame #enemy-formation,.game-frame .stage[data-location="road"] #enemy-formation{left:12%;right:12%;bottom:40%}
.game-frame #enemy-formation .enemy-figure{flex-basis:min(19cqw,23cqh)}
.game-frame #enemy-formation .enemy-figure img{scale:1.12;transform-origin:bottom center}
.game-frame #resident-scene{--npc-height:min(21cqh,10rem);right:8%;bottom:33%;width:min(48cqw,23rem)}
.game-frame .resident-bubble{max-height:none;overflow:visible}
.game-frame #combat-hud{position:relative;inset:auto;transform:none;max-width:none;width:100%;height:9.35rem;
  flex:0 0 9.35rem;display:grid;grid-template-rows:2.38rem minmax(0,1fr);gap:.2rem;overflow:hidden;
  padding:.35rem .5rem;border-top:1px solid #987051;border-radius:0;background:linear-gradient(#332534,#221823)}
.combat-dock-header{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.5rem;align-items:center;min-height:0}
.game-frame #fightInfo{grid-column:1;min-height:0;max-height:100%;overflow:auto;overscroll-behavior:contain;
  scrollbar-width:thin;scrollbar-gutter:stable;padding-inline:.3rem}
.game-frame #fightInfo p{margin:.12rem 0;text-align:left;line-height:1.23}
.game-frame #fightInfo .compact{display:none}
.game-frame #combat-close{grid-column:2;margin:0;padding:.15rem .5rem;font-size:.73rem;white-space:nowrap}
.game-frame #fightActions{display:grid;grid-template-rows:3.8rem minmax(0,1fr);justify-content:stretch;min-height:0;gap:.24rem;margin:0}
.combat-shortcuts{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:clamp(.15rem,.45vw,.42rem);width:100%;min-height:0}
#fightActions .combat-shortcuts .combat-slot{min-width:0;min-height:0;overflow:hidden;line-height:1.03;
  padding:.3rem .13rem;font-size:clamp(.57rem,.82vw,.8rem)}
#fightActions .combat-shortcuts kbd{top:.13rem;left:.17rem;font-size:.58rem}
#fightActions .combat-shortcuts small{font-size:.57rem}
#combat-commands{display:flex;gap:.35rem;align-items:center;justify-content:safe center;min-height:0;min-width:0;
  overflow-x:auto;overflow-y:hidden;overscroll-behavior-inline:contain;scrollbar-width:thin}
#fightActions #combat-commands button{flex:none;white-space:nowrap;padding:.2rem .45rem;font-size:.75rem;line-height:1.15}
.game-sidebar .actions,.sidebar-card,#play-area #table-chat{padding:.62rem;background:#291e2b;border:1px solid #79563e;border-radius:.55rem}
.game-sidebar .actions{position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.35rem;white-space:normal}
.game-sidebar .actions .identity,.game-sidebar .actions #continue,.game-sidebar .actions #action-status{grid-column:1/-1}
.game-sidebar .actions #action-status{position:static;margin:0}
.game-sidebar button,.game-sidebar input{padding:.3rem .45rem;font-size:.82rem;min-width:0}
#play-area #table-chat{position:static;inset:auto;width:auto;min-width:0;min-height:21rem;flex:1;display:flex;flex-direction:column}
#chat-handle,.sidebar-card h2{margin:0 0 .45rem;padding:0;background:none;color:#f1c789;font:700 1.04rem Georgia,serif;cursor:auto}
#play-area #table-messages{height:auto;max-height:none;min-height:12rem;flex:1;scrollbar-gutter:stable;background:#1c151f;font-size:.85rem}
#play-area #table-message-form{display:grid;grid-template-columns:minmax(0,1fr) auto;padding-inline:0}
#chat-recipient{grid-column:1/-1}
#chat-social{align-self:flex-start}
.sidebar-profile{display:grid;grid-template-columns:minmax(3.5rem,40%) 1fr;align-items:center;gap:.45rem}
.sidebar-profile>img{width:100%;height:6.2rem;object-fit:contain;object-position:center bottom}
.sidebar-profile small,.sidebar-profile strong{display:block;overflow-wrap:anywhere}
.sidebar-profile small{font-size:.77rem}
.sidebar-profile button{margin-top:.32rem}
.equipment-slots{margin:.38rem 0 0;font-size:.74rem}
.equipment-slots>div{display:grid;grid-template-columns:39% 1fr;gap:.25rem;padding:.14rem 0;border-top:1px solid #83584055}
.equipment-slots dt{color:#e8bf90}
.equipment-slots dd{display:flex;align-items:center;gap:.22rem;margin:0;overflow-wrap:anywhere}
.equipment-slots .inventory-icon,#inventory-sidebar .inventory-icon{width:1.45rem;height:1.45rem}
#inventory-sidebar p{margin:.25rem 0;font-size:.83rem}
#inventory-sidebar .inventory-items{max-height:16vh;min-height:2rem;overflow:auto;scrollbar-width:thin}
#inventory-sidebar .forge-recipe{margin:0;padding:.3rem;border-width:1px;font-size:.75rem}
#inventory-sidebar .inventory-material{flex-wrap:wrap;font-size:.75rem}
#inventory-sidebar .inventory-material button{font-size:.75rem}
.player-sidebar #scene-navigation{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);align-items:center;gap:.45rem;background:none;max-width:none}
.player-sidebar #scene-navigation .minimap-art{width:100%;min-width:0}
.player-sidebar #scene-navigation #minimap{width:100%}
.rescue-scene{position:absolute;z-index:8;left:50%;top:48%;transform:translate(-50%,-50%);width:min(88%,25rem);
  display:flex;align-items:center;gap:.65rem;padding:.8rem;background:#271d2bf5;border:1px solid #d5a371;border-radius:.65rem;box-shadow:0 .5rem 2rem #110b13d4}
.rescue-scene img{width:27%;aspect-ratio:1;object-fit:contain}
.rescue-scene p{margin:.35rem 0}
.rescue-scene small{display:block;margin-bottom:.35rem;color:#f3bf8b}

@media(max-width:940px){
  #play-area{grid-template-columns:1fr 1fr;overflow:auto;scrollbar-gutter:stable}
  .game-frame{grid-column:1/-1;grid-row:1}
  .game-frame .stage{height:clamp(20rem,56vw,35rem);flex:none}
  #inventory-sidebar .inventory-items{max-height:12rem}
  #play-area #table-chat{flex:none}
  #play-area #table-messages{height:clamp(14rem,35vh,23rem);flex:auto}
}
@media(max-width:570px){
  #play-area{grid-template-columns:1fr;padding:.35rem;gap:.55rem;display:flex}
  .game-frame{order:-1;flex-shrink:0}
  .game-sidebar{overflow:visible;flex-shrink:0}
  .game-frame .stage{height:clamp(18rem,78vw,25rem)}
  .game-frame .stage .narration{width:62cqw;right:3%;font-size:.75rem}
  .game-frame .stage .location{max-width:73%}
  .game-frame #resident-scene{--npc-height:18cqh;width:68cqw;right:5%;bottom:33%}
  .game-frame #fightActions .combat-slot{font-size:.54rem}
  .game-frame #fightActions .combat-slot small{display:none}
  .player-sidebar #scene-navigation{grid-template-columns:minmax(0,9rem) minmax(0,1fr)}
}
.player-sidebar #scene-navigation{width:100%;margin:0;padding:0;border:0}


.speech-panel{--speech-inset:.6rem;padding-inline:var(--speech-inset)}
.speech-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:.24rem}
.speech-heading button{float:none;flex:none;margin:0 0 .15rem;pointer-events:auto}
.speech-content{display:flow-root;min-width:0;overflow-wrap:anywhere}
.speech-panel[data-compact]>.speech-content{position:absolute;visibility:hidden;pointer-events:none;top:0;inset-inline:var(--speech-inset)}
.speech-panel .dialogue-more{pointer-events:auto;margin-top:.35rem;font-size:.76rem;background:#3c716b;color:#fff8dd;border-color:#82a992}
.speech-content #victory-options:not(:empty){display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.speech-content #victory-options>small{grid-column:1/-1}
.speech-content #victory-options button{white-space:normal;min-width:0}

#town-clock{color:#f2c788;line-height:1.2;margin:.25rem 0}
.calendar-days{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.3rem;list-style:none;padding:0}
.calendar-days li{display:grid;gap:.12rem;padding:.35rem;text-align:center;background:#6348363b;border:1px solid #926c49;border-radius:.4rem;font-size:.78rem;overflow-wrap:anywhere}
.calendar-days li[aria-current=date]{background:#edbe77;color:#2d1c19}
.market-area{display:grid;gap:.65rem}
.market-area h3{margin:.65rem 0 .2rem}
.market-stock{display:grid;gap:.45rem}
.market-lot{display:grid;grid-template-columns:minmax(0,1fr) minmax(7rem,.55fr) auto;align-items:center;gap:.45rem;padding:.4rem;border-bottom:1px solid #95664182}
.market-lot .inventory-icon{grid-column:1;grid-row:1}
.market-lot strong:has(+label){overflow-wrap:anywhere}
.market-lot .inventory-icon+strong{grid-column:1;grid-row:1;padding-left:2.5rem}
.market-lot input,.market-lot select{width:100%;min-width:0}
.market-receipt{display:flex;align-items:center;flex-wrap:wrap;gap:.45rem;padding:.5rem;border:1px solid #bb9565;border-radius:.4rem;background:#3d2c3f}
.market-receipt p{margin:0}
.market-receipt img{width:2.45rem;height:2.45rem;object-fit:contain}
.resident-memory{flex-basis:100%;font-style:italic;color:#503328}
#combat-effects .initiative-reveal{top:20%;width:min(90%,38rem);padding:.55rem;max-height:none;text-align:center}
.initiative-rolls{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(6.5rem,28%),1fr));gap:.35rem;margin-top:.4rem}
.initiative-roll{display:grid;grid-template-rows:auto 3.3rem;min-width:0;padding:.3rem;background:#473141;border:1px solid #986e53;border-radius:.35rem}
.initiative-roll>small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}
.initiative-face{display:grid;justify-items:center;align-content:center;line-height:1.05}
.initiative-face img{width:3rem;height:3rem;object-fit:contain}
.initiative-face b{font-size:1.65rem;color:#fff0b6}
.initiative-face small{font-weight:550}
@media(max-width:570px){
  .calendar-days{grid-template-columns:repeat(4,minmax(0,1fr))}
  .market-lot{grid-template-columns:minmax(0,1fr) auto}
  .market-lot strong,.market-lot label:first-of-type{grid-column:1}
  .market-lot .inventory-icon+strong{grid-column:1/-1}
}

.birth-date{margin:.8rem 0;padding:.5rem .65rem;border:1px solid var(--edge);border-radius:.5rem}
.birth-date legend{color:var(--gold);padding:0 .3rem}
.birth-date-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.4rem}
.birth-date-fields select{min-width:0}
.birth-date p{margin:.45rem 0 0;font-size:.85rem}
.stage[data-dungeon] .backdrop::after{background:radial-gradient(ellipse at 50% 44%,transparent 8%,#0b0910d9 88%),linear-gradient(0deg,#180f18ed 8%,transparent 51%)}
.stage[data-dungeon] .backdrop{background:radial-gradient(ellipse at 51% 50%,var(--dungeon-glow),#130e17 74%)}
.stage[data-dungeon] #scene-panorama{opacity:.14;filter:grayscale(.9)}
#dungeon-deposit{position:absolute;z-index:6;top:26%;left:20%;width:clamp(94px,17cqw,160px);display:grid;justify-items:center;text-align:center;isolation:isolate}
#mine-deposit{display:grid;justify-items:center;width:100%;background:none;border:0;padding:0;color:#ffe29e;text-shadow:0 2px 4px #000}
#mine-deposit img{width:100%;max-height:18cqh;object-fit:contain;filter:drop-shadow(0 0 12px #f3bc5e88)}
#deposit-time,#deposit-result{color:#fff3d6;text-shadow:0 2px 4px #000}
.ore-fragments{position:absolute;pointer-events:none;inset:0 auto auto 0;width:100%;aspect-ratio:1;background-repeat:no-repeat;background-size:800% 100%;animation:ore-sparks .24s steps(7,end) forwards}
@keyframes ore-sparks{to{background-position:100% 0}}
@media(max-width:420px){.birth-date-fields{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){.ore-fragments{animation:none;background-position:57% 0}}

.service-block{margin:.65rem 0;padding:.65rem;border:1px solid var(--edge);border-radius:.55rem;display:grid;gap:.45rem}
.service-block h3{margin:.15rem 0;color:var(--gold)}
.service-block fieldset{margin:.4rem 0;border:1px solid var(--edge)}
.forge-tool-icon{display:inline-block;width:2.45rem;height:2.45rem;background:url('assets/forja-encantos.webp') no-repeat;background-size:200% 200%;vertical-align:middle}
.inventory-icon[data-enchant="1"]{filter:drop-shadow(0 0 2px #82c5ff)}
.inventory-icon[data-enchant="2"]{filter:drop-shadow(0 0 3px #64e7ff) drop-shadow(0 0 5px #49a4ff)}
.inventory-icon[data-enchant="3"]{filter:drop-shadow(0 0 3px #ffeba4) drop-shadow(0 0 8px #ff9a26) drop-shadow(0 0 11px #cb72ff)}

[data-ability-class="arqueiro"],[data-action="item"]{--ability-accent:#9ae589;--ability-tone:#294132}
[data-ability-class="barbaro"],[data-action="attack"]{--ability-accent:#ff9f65;--ability-tone:#4f2e2b}
[data-ability-class="guerreiro"],[data-action="guard"]{--ability-accent:#f4cb7a;--ability-tone:#46382b}
[data-ability-class="mago"],[data-action="flee"]{--ability-accent:#d4a4ff;--ability-tone:#3c3051}
.ui-ability-icon{display:block;aspect-ratio:1;object-fit:contain}
.ability-atlas{background-repeat:no-repeat;background-size:500% 400%}
#fightActions .combat-shortcuts .combat-slot{background:linear-gradient(var(--ability-tone,#302333),#261d29);
  border-color:color-mix(in srgb,var(--ability-accent,#c09c74) 50%,#352438);color:#fff3dc}
#fightActions .combat-shortcuts .combat-slot:disabled{opacity:1;color:#cbbdce;border-color:#665064}
#fightActions .combat-shortcuts .ui-ability-icon{width:min(2rem,86%);height:auto;filter:drop-shadow(0 2px 2px #160e18)}
#fightActions .combat-shortcuts .combat-slot-name{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#fightActions .combat-shortcuts .empty-slot{background:#241b272b;border-style:dashed;color:#bca396}
.empty-slot-mark{font-size:1.45rem}
.skill-book-summary{display:flex;gap:.55rem .9rem;align-items:center;flex-wrap:wrap}
.skill-book-summary button{margin-inline-start:auto}
.skill-book-status{color:#e0cbdc;font-size:.85rem}
.skill-book{display:grid;gap:.55rem}
.skill-card{display:grid;grid-template-columns:4.15rem minmax(0,1fr);gap:.35rem .75rem;align-items:center;
  padding:.45rem .55rem;border-radius:.55rem;border:1px solid #73566a;
  background:linear-gradient(110deg,var(--ability-tone),#2e2130)}
.skill-card h3,.skill-card p{margin:0}
.skill-card h3{color:var(--ability-accent);font-size:1rem}
.skill-card-copy{display:grid;gap:.2rem}
.skill-card-copy small{color:#e5d2c6}
.skill-card-emblem{display:grid;place-items:center;aspect-ratio:1;width:100%;padding:.12rem;
  border:1px solid var(--ability-accent);border-radius:.5rem;background:#1d1629;overflow:hidden}
.skill-card-emblem .ui-ability-icon{width:100%;height:auto}
.skill-card-action:disabled{opacity:1;border-color:#806786}
.skill-card-action:hover:not(:disabled),.skill-card-action:focus-visible{
  border-color:#fff1b9;box-shadow:0 0 .65rem var(--ability-accent)}
.skill-targets{grid-column:2}
.skill-targets button{margin:.1rem}
.forge-tabs{display:flex;gap:.4rem;flex-wrap:wrap}
.smelt-recipe{grid-template-columns:minmax(0,1fr) auto;align-items:center}
.smelt-material{display:flex;align-items:center;gap:.45rem;grid-column:1}
.smelt-material .inventory-icon{width:1.85rem;height:1.85rem}
.smelt-recipe button{grid-area:1/2/3/3}
@media(max-width:570px){
  #fightActions .combat-shortcuts .ui-ability-icon{width:min(1.55rem,86%)}
  .skill-card{grid-template-columns:3.7rem minmax(0,1fr)}
}

.stage[data-dungeon] #scene-panorama.dungeon-panorama{opacity:.9;filter:none}
.stage[data-dungeon] .backdrop:has(.dungeon-panorama)::after{
  background:linear-gradient(0deg,#130e18a6,transparent 48%,#170c1c4d)
}
.master-illustration{min-height:9rem;padding:1rem;display:flex;flex-direction:column;justify-content:flex-end;
  gap:.25rem;border-radius:.55rem;color:#fff0d0;border:1px solid var(--edge);
  background:url('assets/mestre-03.webp') 94% 87% / auto 95% no-repeat,
    linear-gradient(90deg,#2c1524 26%,#2c152499 65%,transparent),
    url('assets/taverna.webp') center 48% / cover}
.master-illustration strong{font:700 1.6rem Georgia,serif}
.master-places{display:grid;gap:.45rem;margin-top:.75rem}
.master-places img{width:100%;height:7rem;object-fit:cover;border-radius:.4rem}

.encounter-victory{position:absolute;z-index:7;left:50%;top:19%;translate:-50% 0;pointer-events:none;
  display:grid;gap:.3rem;text-align:center;padding:.7rem 1.15rem;color:#ffe3a3;
  background:linear-gradient(90deg,transparent,#21152be8 22% 78%,transparent);
  text-shadow:0 2px 3px #120e18;animation:victory-reveal .55s ease-out}
.encounter-victory strong{font:700 clamp(1.4rem,3vw,2.3rem) Georgia,serif}
@keyframes victory-reveal{from{opacity:0;translate:-50% .75rem}to{opacity:1;translate:-50% 0}}
@media(prefers-reduced-motion:reduce){.encounter-victory{animation:none}}

.atlas-traveler{position:absolute;display:grid;place-items:center;z-index:4;translate:-50% -75%;pointer-events:none;
  filter:drop-shadow(0 0 5px #35261e) drop-shadow(0 0 2px #ffd68b)}
.atlas-traveler-sprite{width:2.45rem;aspect-ratio:1;background:url('assets/map-icons/viajante.webp') 0 0 / 200% 100% no-repeat;
  image-rendering:pixelated}
.atlas-walking{animation:atlas-step .34s steps(2,end) infinite}
@keyframes atlas-step{to{background-position:200% 0}}
.atlas-journey-status{margin:.6rem 0;text-align:center;color:#ffe3a4;font-weight:700}
.settlement-panorama{display:block;width:100%;height:clamp(5rem,13vw,10rem);object-fit:cover;object-position:center 55%;
  border:1px solid #be936a;border-radius:.5rem;margin-bottom:.65rem}
.settlement-board .cartography-pin{z-index:1}
.settlement-board .settlement-npc{position:absolute;z-index:2;display:grid;place-items:center;translate:-50% -75%;
  width:clamp(1.2rem,3.5vw,2.5rem);height:clamp(1.4rem,4vw,3rem);padding:0;background:none;border:0}
.settlement-npc img{display:block;width:100%;height:100%;object-fit:contain;object-position:center bottom;
  filter:drop-shadow(0 2px 2px #171019);image-rendering:pixelated}
.settlement-npc:hover img,.settlement-npc:focus-visible img{filter:drop-shadow(0 0 4px #ffdd8d)}

.creation-appearance{margin:.65rem 0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem;border:1px solid var(--edge)}
.creation-appearance[hidden],.creation-pose-pair img[hidden]{display:none}
.creation-pose-pair{display:flex;justify-content:center;width:100%;gap:.25rem}
.creation-pose-pair img{flex:1 1 0;min-width:0}

.living-city{container-type:inline-size;width:100%;aspect-ratio:2/1;position:relative;isolation:isolate;overflow:hidden;border:1px solid var(--edge);border-radius:.65rem;background:#271e26}
.living-city-background{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none}
.living-city .city-pawn,.living-city .city-entrance{left:50%;top:85%;position:absolute;transform:translate(-50%,-100%)}
.living-city .city-pawn{z-index:2;padding:0;border:0;background:transparent;display:grid;justify-items:center;transition:left .6s linear,top .6s linear}
.city-pawn img{width:var(--pawn-size,44px);height:calc(var(--pawn-size,44px) * 1.35);object-fit:contain;object-position:bottom;filter:drop-shadow(0 2px 2px #291a22)}
.city-pawn span{color:#d7f9ff;background:#182530e8;padding:1px 4px;border-radius:4px;font-size:clamp(.6rem,1vw,.8rem);white-space:nowrap}
.city-self span{color:#ffdd93}
.living-city .city-npc{z-index:1}
.city-npc img{
  width:clamp(40px,calc(var(--pawn-size) * 1.95),min(110px, 10cqw));
  height:auto;
  aspect-ratio:1 / 1.35;
  filter:drop-shadow(0 1px 1px #211321) drop-shadow(0 3px 2px #211321c9);
}
.living-city .city-npc:is(:hover,:focus-visible){z-index:2}
.city-npc:hover img,.city-pawn:focus-visible img{filter:drop-shadow(0 1px 1px #211321) drop-shadow(0 0 4px #ffdc6f)}
.living-city .city-entrance{z-index:3;font-size:clamp(.57rem,1.15vw,.88rem);padding:.24rem .4rem;color:#ffe0a1;background:#251925ed;white-space:nowrap}
.city-status{color:#e4c6ad}.city-interior-art{display:block;width:100%;max-height:61vh;object-fit:contain;margin-bottom:.7rem}
.city-inbox .row{align-items:center;padding:.3rem 0}.city-inbox .row span{flex:1 1 14rem}
@media(prefers-reduced-motion:reduce){.living-city .city-pawn{transition:none}}

.living-city .city-npc{transition:left 1.35s linear,top 1.35s linear}
body.still .living-city .city-npc{transition:none}
body.still .living-city #resident-scene #narrated-npc{animation:none}
.living-city .city-npc img{width:clamp(43px,calc(var(--pawn-size) * 2.45),min(142px,12cqw))}
.living-city .city-speaking{opacity:0;pointer-events:none}
.living-city .city-self,.living-city .city-pawn:not(.city-npc){z-index:105}
.living-city .city-entrance{z-index:110}
.city-npc .city-npc-speech{
  position:absolute;bottom:90%;left:50%;translate:-50%;
  width:max-content;max-width:min(19cqw,11rem);white-space:normal;
  background:#fff0db;color:#332124;border:1px solid #8d6236;
  padding:.3rem .4rem;box-shadow:0 2px 6px #150f13a0;
}
.living-city #resident-scene{
  inset:0;width:100%;display:block;z-index:120;pointer-events:none;
}
.living-city #resident-scene[hidden]{display:none}
.living-city #resident-scene::after{display:none}
.living-city #resident-scene #narrated-npc{
  position:absolute;left:var(--speaker-x);top:var(--speaker-y);
  translate:-50% -100%;width:clamp(120px,27cqw,328px);height:70%;
  filter:drop-shadow(0 .35rem .45rem #211321bd);
  transform-origin:bottom;animation:city-approach .28s ease-out;
}
@keyframes city-approach{from{scale:.45;opacity:.6}to{scale:1;opacity:1}}
.living-city .resident-bubble{
  position:absolute;
  top:5%;left:clamp(0px,calc(var(--speaker-x) - 11rem),calc(100% - min(94%,22rem)));
  width:min(94%,22rem);max-height:87%;overflow:auto;pointer-events:auto;
}
#enemy-formation .enemy-figure{position:relative;min-width:0}
#enemy-formation .initiative-badge{position:absolute;right:0;top:0}
@media(max-width:600px){
  .living-city .resident-bubble{top:auto;bottom:2%;max-height:52%}
  .living-city #resident-scene #narrated-npc{height:76%}
}
@media(prefers-reduced-motion:reduce){
  .living-city .city-npc{transition:none}
  .living-city #resident-scene #narrated-npc{animation:none}
}

/* Preserve recognizable silhouettes at tabletop scale. */
#fightActions .combat-shortcuts .ui-ability-icon{width:min(2.85rem,92%)}
#combat-effects .battle-effect{width:clamp(125px,22cqw,330px)}
#combat-effects .combat-projectile{width:clamp(58px,12cqw,156px)}
#combat-effects .actor-d20{width:clamp(4.4rem,13cqw,10rem);height:clamp(4.4rem,13cqw,10rem)}
#combat-effects .actor-d20 b{font-size:clamp(1.35rem,3.3cqw,2.35rem)}
.stage #rollSprite{width:min(30cqw,300px)}
.initiative-roll{grid-template-rows:auto minmax(3.3rem,auto)}
.initiative-face img{width:clamp(3rem,9cqw,4.6rem);height:auto}
.city-interior .city-npc img{width:clamp(68px,13cqw,172px)}
.city-interior .city-interior-art{width:100%;height:100%;max-height:none;object-fit:fill;margin:0;display:block}
.city-door{box-shadow:0 1px 5px #120b09a8}
.provision-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,12rem),1fr));gap:.65rem;margin:.7rem 0}
.provision-card{display:grid;grid-template-columns:2.3rem 1fr;gap:.3rem .55rem;align-items:center;padding:.55rem;background:#382a39;border:1px solid #795b48;border-radius:.45rem}
.provision-card img{width:2.3rem;height:2.3rem;object-fit:contain;grid-row:span 2}
.provision-card small,.provision-card button{grid-column:2}
.camp-cooking{display:block;width:96px;height:96px;margin:auto;image-rendering:pixelated}
.living-city-background{transform-origin:var(--focus-x,50%) var(--focus-y,75%);transition:transform .36s ease,filter .36s ease}
.living-city.city-conversation .living-city-background{transform:scale(1.22);filter:brightness(.55)}
.living-city.city-conversation :is(.city-pawn,.city-door){visibility:hidden}
.living-city.city-conversation #resident-scene #narrated-npc{left:26%;top:96%;width:46%;height:92%}
.living-city.city-conversation .resident-bubble{left:52%;top:auto;bottom:7%;width:45%;max-height:85%}
@media(max-width:600px){
 .living-city.city-conversation #resident-scene #narrated-npc{left:23%;width:43%}
 .living-city.city-conversation .resident-bubble{left:43%;width:55%;max-height:91%}
}
@media(prefers-reduced-motion:reduce){.living-city-background{transition:none}}
.global-chest-art{display:block;width:min(190px,52%);margin:.5rem auto;object-fit:contain}
.chest-coins{display:flex;align-items:end;flex-wrap:wrap;gap:.4rem;margin:.5rem 0}
.chest-columns{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,16rem),1fr));gap:.6rem}
.chest-columns section{padding:.45rem;border:1px solid #80604c;border-radius:.4rem}
.living-city.city-conversation .living-city-background{transform:scale(1.12);filter:blur(3px) brightness(.74)}
.living-city.city-conversation #resident-scene #narrated-npc{left:14%;top:96%;width:25%;height:54%;transform-origin:bottom center;animation:resident-closeup .52s cubic-bezier(.2,.72,.33,1) both}
@keyframes resident-closeup{from{transform:translate(var(--speaker-start-x),var(--speaker-start-y)) scale(.28)}to{transform:translate(0,0) scale(1)}}
.living-city.city-conversation .resident-bubble{left:24%;top:auto;bottom:2%;width:69%;max-height:65%;background:#211620e8;color:#fff3d9;border:2px solid #6e5544;box-shadow:0 5px 14px #100b0c60;padding:clamp(.65rem,2.1cqw,1.45rem);font-size:clamp(.9rem,1.74cqw,1.4rem)}
.living-city.city-conversation .resident-bubble small{color:#dec3aa}
.living-city.city-conversation .resident-bubble button{font-size:clamp(.78rem,1.2cqw,1rem)}
@media(max-width:600px){
 .living-city.city-conversation #resident-scene #narrated-npc{left:13%;width:23%;height:59%}
 .living-city.city-conversation .resident-bubble{left:24%;width:74%;max-height:86%}
}
@media(prefers-reduced-motion:reduce){.living-city.city-conversation #resident-scene #narrated-npc{animation:none}}
.living-city .city-self{transition:left .155s linear,top .155s linear}
.city-pawn span:not(.city-npc-speech){position:absolute;top:100%;left:50%;translate:-50%;pointer-events:none}
.living-city .city-pawn:focus-visible{outline:1px solid #fdcb72}
@media(prefers-reduced-motion:reduce){.living-city .city-self{transition:none}}

.cauldron-setup{display:grid;justify-items:center;gap:.65rem;margin-block:1rem}
.cauldron-slots{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.4rem;width:100%}
.cauldron-slots select{min-width:0;width:100%;padding:.4rem}
.cauldron-button{display:grid;justify-items:center;gap:.35rem}
.cauldron-button img{width:105px;height:105px;object-fit:contain}
@media(max-width:480px){.cauldron-slots{grid-template-columns:repeat(2,minmax(0,1fr))}}


/* Hero artwork fills more of its frame than resident artwork. */
.living-city .city-pawn:not(.city-npc) img{width:clamp(31px,calc(var(--pawn-size) * 1.76),min(102px,8.64cqw));height:auto;aspect-ratio:1 / 1.35}

#city-chat-slot:empty{display:none}
dialog.city-chat-docked{width:min(96vw,1320px)}
.city-chat-docked .dialog-content{display:grid;grid-template-columns:clamp(12rem,16vw,16rem) minmax(0,1fr);align-items:start}
#city-chat-slot{padding:1.05rem 0 1.05rem 1.15rem;min-width:0}
#city-chat-slot #table-chat{position:static;inset:auto;width:auto;min-width:0;padding:.62rem;background:#291e2b;border:1px solid #79563e;border-radius:.55rem}
#city-chat-slot #table-messages{height:clamp(8rem,29dvh,19rem)}
#city-chat-slot #table-message{min-width:0}
@media(max-width:720px){
 .city-chat-docked .dialog-content{grid-template-columns:minmax(0,1fr)}
 #city-chat-slot{padding:.75rem 1rem 0}
 #city-chat-slot #table-messages{height:clamp(4rem,12dvh,8rem)}
}
