/* v325 - one shared SFG-style close control for full-stage menu windows. */
body #guildHallScreen.active #oaiGuildCloseBtn.oaiGuildClose,
body #oaiStableWindowCloseX_v126{
  position:fixed !important;
  top:calc(var(--stagePad, 4px) + 4px) !important;
  right:calc(50% - (var(--stageW, 100vw) / 2) + 4px) !important;
  left:auto !important;
  z-index:999980 !important;
  display:grid !important;
  place-items:center !important;
  overflow:visible !important;
  isolation:isolate;
  width:38px !important;
  height:38px !important;
  min-width:38px !important;
  min-height:38px !important;
  margin:0 !important;
  padding:0 !important;
  cursor:pointer !important;
  color:transparent !important;
  border:0 !important;
  border-radius:50% !important;
  outline:0 !important;
  background:radial-gradient(circle, rgba(35,22,10,.82) 0 43%, rgba(9,6,3,.42) 58%, transparent 72%) !important;
  box-shadow:none !important;
  filter:drop-shadow(0 3px 3px rgba(0,0,0,.92));
  clip-path:none !important;
  font-size:0 !important;
  line-height:0 !important;
  text-indent:-9999px;
  transition:filter .12s ease, transform .12s ease !important;
}

body #oaiStableWindowCloseX_v126{
  z-index:2147483000 !important;
}

/* Quest journal is centered inside the viewport, so its close control belongs
   inside that frame instead of in the shared game-stage corner. */
body:has(#questPanel.show) #oaiStableWindowCloseX_v126[data-panel-key="quest"]{
  top:calc(var(--stagePad, 4px) + 12px) !important;
  right:calc(50% - (var(--stageW, 100vw) / 2) + 12px) !important;
}

body #oaiStableWindowCloseX_v126:not(.is-visible){
  display:none !important;
}

body #guildHallScreen.active #oaiGuildCloseBtn.oaiGuildClose::after,
body #oaiStableWindowCloseX_v126::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:24px;
  height:24px;
  pointer-events:none;
  background:
    linear-gradient(45deg, transparent 39%, #7a3c00 40% 44%, #ffd64a 45% 55%, #7a3c00 56% 60%, transparent 61%),
    linear-gradient(-45deg, transparent 39%, #7a3c00 40% 44%, #ffd64a 45% 55%, #7a3c00 56% 60%, transparent 61%);
  filter:
    drop-shadow(0 1px 0 rgba(255,244,158,.74))
    drop-shadow(0 0 3px rgba(255,184,30,.62))
    drop-shadow(0 3px 2px rgba(0,0,0,.96));
  transform:translate(-50%, -50%);
}

body #guildHallScreen.active #oaiGuildCloseBtn.oaiGuildClose:hover,
body #guildHallScreen.active #oaiGuildCloseBtn.oaiGuildClose:focus-visible,
body #oaiStableWindowCloseX_v126:hover,
body #oaiStableWindowCloseX_v126:focus-visible{
  background:radial-gradient(circle, rgba(72,42,12,.90) 0 43%, rgba(18,10,4,.46) 59%, transparent 73%) !important;
  filter:brightness(1.16) drop-shadow(0 0 5px rgba(255,191,38,.58)) drop-shadow(0 3px 3px rgba(0,0,0,.94));
  transform:scale(1.08);
}

/* The shared fixed control replaces differently styled close buttons inside these windows. */
body #btnQuestClose,
body #btnCompanionClose,
body #warehouseClose,
body #btnBackToCity,
body #mailPanel .mailClose{
  display:none !important;
  pointer-events:none !important;
}

/* Quest-specific matte wine backdrop; it covers only the game stage, not the left menu. */
body #oaiQuestMatteBackdrop{
  position:fixed !important;
  top:var(--stagePad, 4px) !important;
  left:calc(50% - (var(--stageW, 100vw) / 2) + var(--menuStageW, 340px)) !important;
  width:var(--cityStageW, calc(100vw - 340px)) !important;
  height:var(--cityStageH, calc(100vh - 8px)) !important;
  z-index:249990 !important;
  display:none !important;
  pointer-events:none !important;
  border-radius:var(--stageFrameRadius, 10px) !important;
  background:rgba(4,2,1,.72) !important;
  opacity:1;
  backdrop-filter:blur(3px);
  -webkit-backdrop-filter:blur(3px);
}

body:has(#questPanel.show) #oaiQuestMatteBackdrop{
  display:block !important;
}

body #questPanel.questPanel{
  border:1px solid rgba(214,158,61,.72) !important;
  background:
    radial-gradient(circle at 52% 0, rgba(255,204,120,.08), transparent 46%),
    linear-gradient(180deg, rgba(14,18,17,.98), rgba(5,8,8,.99)),
    url("../img/backgrounds/dungeon.png") center / cover no-repeat !important;
  box-shadow:
    0 24px 70px rgba(0,0,0,.78),
    inset 0 0 38px rgba(255,184,74,.06) !important;
}
