
/* v1.0.0-beta.5.7.2 — Cloudflare-safe interaction and mobile recovery */
:root{--v45-safe-gap:calc(84px + env(safe-area-inset-bottom));}
html,body{max-width:100%;overflow-x:clip!important}

/* Keep decorative layers beautiful but never clickable. */
.ambient,.living-section-art-v138,.living-section-art-v138 *,
.living-aura-overlay-v138,#beta31AuraOverlay,.theme-decor,
.theme-motion,.theme-flourish,.character-card::before,.character-card::after,
.section-head::before,.section-head::after,.modal::before,.modal::after{
  pointer-events:none!important;
}
.section-head,.section-head>*{position:relative;z-index:2}
.section-magic-relic,.section-magic-relic *{pointer-events:auto!important;touch-action:manipulation}
.section-magic-relic{z-index:16!important;cursor:pointer!important}

/* Dossier navigation must always sit above artwork and accept touch. */
#profileModal .modal-head{position:relative;z-index:40}
#profileContent{position:relative;z-index:1;overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
#profileContent .profile-nav{position:sticky!important;z-index:35!important;pointer-events:auto!important;isolation:isolate;background:rgba(18,15,23,.94)!important;backdrop-filter:blur(14px)}
#profileContent .profile-nav button{position:relative;z-index:2;pointer-events:auto!important;touch-action:manipulation;cursor:pointer}
#profileContent .profile-nav button.active,#profileContent .profile-nav button[aria-current="true"]{color:var(--gold-2);background:rgba(210,177,116,.1);box-shadow:inset 0 -2px 0 var(--gold)}

/* Inventory: showcase is a cabinet, list is a compact ledger. */
.inventory-grid.inventory-showcase{grid-template-columns:repeat(auto-fit,minmax(230px,1fr))!important;gap:16px!important;perspective:1100px}
.inventory-grid.inventory-showcase .inventory-item{
  min-height:250px!important;display:flex!important;flex-direction:column!important;justify-content:space-between!important;
  padding:18px!important;border:1px solid color-mix(in srgb,var(--item-color) 34%,var(--line))!important;
  border-top:4px solid var(--item-color)!important;border-left-width:1px!important;border-radius:20px!important;
  background:radial-gradient(circle at 86% 14%,color-mix(in srgb,var(--item-color) 18%,transparent),transparent 34%),linear-gradient(155deg,rgba(40,36,45,.95),rgba(17,17,23,.98))!important;
  box-shadow:0 22px 45px rgba(0,0,0,.28),inset 0 1px rgba(255,255,255,.035)!important;overflow:hidden!important
}
.inventory-grid.inventory-showcase .inventory-item::before{content:"";position:absolute;inset:7px;border:1px solid color-mix(in srgb,var(--item-color) 15%,transparent);border-radius:14px;pointer-events:none}
.inventory-grid.inventory-showcase .inventory-item::after{right:10px!important;bottom:-24px!important;font-size:112px!important;opacity:.8}
.inventory-grid.inventory-showcase .inventory-top{align-items:flex-start}
.inventory-grid.inventory-showcase .inventory-rune{display:grid;place-items:center;width:48px;height:48px;border:1px solid color-mix(in srgb,var(--item-color) 34%,var(--line));border-radius:50%;background:color-mix(in srgb,var(--item-color) 9%,rgba(10,10,15,.86));font-size:24px;box-shadow:0 0 28px color-mix(in srgb,var(--item-color) 18%,transparent)}
.inventory-grid.inventory-showcase .inventory-item p{margin:18px 0!important;line-height:1.62!important}
.inventory-grid.inventory-list{display:grid!important;grid-template-columns:1fr!important;gap:7px!important}
.inventory-grid.inventory-list .inventory-item{
  min-height:0!important;display:grid!important;grid-template-columns:minmax(210px,.75fr) minmax(0,1.45fr) auto!important;gap:14px!important;align-items:center!important;
  padding:11px 13px!important;border:1px solid var(--line)!important;border-left:4px solid var(--item-color)!important;border-radius:12px!important;
  background:rgba(255,255,255,.018)!important;box-shadow:none!important;overflow:visible!important
}
.inventory-grid.inventory-list .inventory-item::before,.inventory-grid.inventory-list .inventory-item::after{content:none!important}
.inventory-grid.inventory-list .inventory-top{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:8px!important;align-items:center!important}
.inventory-grid.inventory-list .inventory-rune{font-size:18px!important;opacity:.75}
.inventory-grid.inventory-list .inventory-item h4{margin:2px 0!important;font-size:17px!important}
.inventory-grid.inventory-list .inventory-item p{margin:0!important;font-size:12px!important;line-height:1.42!important}
.inventory-grid.inventory-list .inventory-badges{justify-content:flex-end}

/* Context menu never becomes a permanent overlay. */
#qol139Context[hidden]{display:none!important}
#qol139Context{z-index:1200!important;max-height:min(420px,calc(100dvh - 20px));overflow:auto;overscroll-behavior:contain}

/* Local map: both the map and its information card have real scroll regions. */
#localMapModal>.modal{display:grid!important;grid-template-rows:auto minmax(0,1fr) auto!important;max-height:min(92dvh,920px)!important;overflow:hidden!important}
#localMapModal .local-map-layout{min-height:0!important;overflow:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
#localMapModal .local-map-stage-shell{min-width:0;min-height:0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
#localMapModal .local-map-sidebar{min-height:0!important;max-height:100%!important;overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
#localMapModal .local-point-list{max-height:none!important;overflow:visible!important;flex:0 0 auto}
#localMapModal .local-point-detail{min-height:150px!important;max-height:none!important;overflow:visible!important}
#localMapModal .local-map-toolbar{position:relative;z-index:10;background:rgba(18,18,24,.98);padding-top:10px!important}

/* Board interaction surfaces. */
#board .board-canvas-view,#board .board-shell,#board .board-pan-space,#board .investigation-board{pointer-events:auto!important}
#board .board-shell.board-pan-viewport{touch-action:none;cursor:grab}
#board .board-shell.board-pan-viewport.is-board-panning{cursor:grabbing}
#board .board-edge-vignette,#board .board-space-tooltip{pointer-events:none!important}
#board .board-navigation-bar,#board .board-navigation-actions,#board [data-board-view-action]{position:relative;z-index:30;pointer-events:auto!important;touch-action:manipulation}

/* Tools menu: no empty boxes, reliable accordions. */
.ux1391-section>summary{pointer-events:auto!important;user-select:none}
.ux1391-section.ux1391-empty{display:none!important}
.ux1391-actions:empty{display:none!important}
.ux1391-actions>.v45-menu-proxy{display:flex!important}

/* Mobile header cannot collide with the campaign title. */
@media(max-width:760px){
 body.mobile-layout .topbar-inner{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;column-gap:8px!important;min-width:0!important;padding-inline:10px!important}
 body.mobile-layout .brand{display:grid!important;grid-template-columns:46px minmax(0,1fr)!important;gap:9px!important;min-width:0!important;width:100%!important;overflow:hidden!important}
 body.mobile-layout .brand .sigil{width:46px!important;height:46px!important;min-width:46px!important}
 body.mobile-layout .brand>div:last-child{min-width:0!important;overflow:hidden!important}
 body.mobile-layout #brandTitle,body.mobile-layout .brand h1{max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;font-size:14px!important;line-height:1.15!important}
 body.mobile-layout .brand p{max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;font-size:9px!important}
 body.mobile-layout #mobileToolsBtn{position:relative!important;inset:auto!important;justify-self:end!important;width:auto!important;min-width:78px!important;max-width:86px!important;margin:0!important;padding:10px 8px!important;white-space:nowrap!important;z-index:640!important}
 body.mobile-layout #mainToolbar{left:8px!important;right:8px!important;top:70px!important;max-height:calc(100dvh - 80px)!important;padding-bottom:calc(16px + env(safe-area-inset-bottom))!important}
 body.mobile-layout .ux1391-section>summary{min-height:46px!important;cursor:pointer!important}
 body.mobile-layout .ux1391-actions{grid-template-columns:1fr!important}

 /* Lightweight dossier paging on phones: keep content, remove expensive ghosts/blur/filter. */
 body.mobile-layout .qol1310-magic-layer,
 body.mobile-layout .qol1310-side-ghost,
 body.mobile-layout .qol1392-sidecards,
 body.mobile-layout .qol1392-sidecard{display:none!important}
 body.mobile-layout #profileContent.qol1310-exit,
 body.mobile-layout #npcViewContent.qol1310-exit,
 body.mobile-layout #placeViewContent.qol1310-exit,
 body.mobile-layout #threadViewContent.qol1310-exit,
 body.mobile-layout .qol1310-enter,
 body.mobile-layout .qol1310-stage{animation:none!important;transition:none!important;transform:none!important;filter:none!important;opacity:1!important;box-shadow:none!important}
 body.mobile-layout .modal-backdrop.qol1310-transitioning>.modal::after{display:none!important}
 body.mobile-layout #profileContent .profile-nav{top:0!important;overflow-x:auto!important;display:flex!important;flex-wrap:nowrap!important;scrollbar-width:none}
 body.mobile-layout #profileContent .profile-nav::-webkit-scrollbar{display:none}
 body.mobile-layout #profileContent .profile-nav button{flex:0 0 auto;min-height:42px}

 /* Board list becomes phone cards instead of a clipped desktop table. */
 body.mobile-layout #board .board-list-view{border:0!important;overflow:visible!important;display:grid!important;gap:10px!important}
 body.mobile-layout #board .board-list-row{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:6px!important;width:100%!important;min-width:0!important;padding:13px!important;border:1px solid var(--line)!important;border-left:4px solid var(--card-color,var(--gold))!important;border-radius:14px!important;background:rgba(255,255,255,.022)!important}
 body.mobile-layout #board .board-list-row>*{min-width:0!important;max-width:100%!important;overflow-wrap:anywhere}
 body.mobile-layout #board .board-list-row strong{font-size:17px}
 body.mobile-layout #board .board-list-actions{display:flex!important;width:100%!important;flex-wrap:wrap!important;justify-content:flex-start!important}
 body.mobile-layout #board .board-list-actions .btn{flex:1 1 120px!important;min-width:0!important}

 /* Inventory remains intentionally different even in one column. */
 body.mobile-layout .inventory-grid.inventory-showcase .inventory-item{min-height:225px!important}
 body.mobile-layout .inventory-grid.inventory-list .inventory-item{grid-template-columns:1fr!important;gap:8px!important;padding:11px!important}
 body.mobile-layout .inventory-grid.inventory-list .inventory-badges{justify-content:flex-start}

 /* Local map card follows the map and scrolls normally. */
 body.mobile-layout #localMapModal>.modal{height:100dvh!important;max-height:100dvh!important;border-radius:0!important}
 body.mobile-layout #localMapModal .local-map-layout{display:block!important;padding:10px!important;overflow-y:auto!important}
 body.mobile-layout #localMapModal .local-map-stage-shell{height:min(54dvh,500px)!important;margin-bottom:10px!important}
 body.mobile-layout #localMapModal .local-map-sidebar{max-height:none!important;overflow:visible!important;min-height:0!important}
 body.mobile-layout #localMapModal .local-point-list{max-height:240px!important;overflow-y:auto!important}
 body.mobile-layout #localMapModal .local-point-detail{min-height:130px!important;overflow:visible!important}
}
@media(max-width:370px){
 body.mobile-layout .brand{grid-template-columns:40px minmax(0,1fr)!important;gap:7px!important}
 body.mobile-layout .brand .sigil{width:40px!important;height:40px!important;min-width:40px!important}
 body.mobile-layout #mobileToolsBtn{min-width:70px!important;max-width:76px!important;font-size:11px!important}
}

@media(prefers-reduced-motion:no-preference){
 body:not(.mobile-layout):not(.calm-mode):not(.effects-off) .theme-emblem,
 body:not(.mobile-layout):not(.calm-mode):not(.effects-off) .theme-flourish,
 body:not(.mobile-layout):not(.calm-mode):not(.effects-off) .living-section-art-v138[data-section] svg>*{animation-play-state:running!important}
}

