/* EIDOS Global Visual CURRENT — POPUP SKELETON PHYSICAL
 * Bounded migration consumers only:
 * Settings / Quests / Daily Gift / Clicker / Pull Results inherited shell.
 * Companion physical morphology is protected and intentionally absent.
 *
 * Scope: physical shell/header/title/close only. No gameplay, scroll-owner,
 * Pull Results grid/reveal/rarity, or domain-content mutation.
 */

:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup,#dailyGiftPopup,#clickerPopup,#welcomePopup,#pullResultsPopup) > .popup-card {
  box-sizing:border-box;
  background:#182236!important;
  border:1px solid #41516f!important;
  border-image:none!important;
  border-radius:var(--ui-radius-lg)!important;
  clip-path:none!important;
  box-shadow:0 18px 46px rgba(3,8,20,.46)!important;
  color:#edf3ff;
}

/* Pull Results keeps its protected GRID_RESULTS morphology and local header
 * implementation. CURRENT popup owner removes inherited generic shell paint only. */
#pullResultsPopup > .popup-card {
  background:#182236!important;
  border:1px solid #41516f!important;
  border-image:none!important;
  border-radius:var(--ui-radius-lg)!important;
  clip-path:none!important;
  box-shadow:0 18px 46px rgba(3,8,20,.46)!important;
  color:#edf3ff;
}

/* D3 neutral popup coverage: #achievementsPopup,#pullLevelPopup reuse this
 * same shell/header/close skeleton as the other shared popup consumers. */

/* Shared quiet header for the four generic popup witnesses. Pull Results is
 * deliberately excluded because pull-results-current.css is its final local
 * header/close owner. */
:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup,#dailyGiftPopup,#clickerPopup,#welcomePopup) > .popup-card > .popup-header {
  display:grid;
  grid-template-columns:minmax(0,1fr) var(--ui-control-md);
  align-items:center;
  column-gap:var(--ui-space-2);
  min-height:var(--ui-control-md);
  margin:0 0 var(--ui-space-2);
  padding:0;
  border:0;
  border-image:none!important;
  background:transparent;
  box-shadow:none;
}

/* BONUS and INTERACTIVE centered compositions reserve a symmetric close-sized
 * lane so the title centre does not depend on the actual close button. */
:is(#dailyGiftPopup,#clickerPopup,#welcomePopup) > .popup-card > .popup-header {
  grid-template-columns:var(--ui-control-md) minmax(0,1fr) var(--ui-control-md);
}

:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup) > .popup-card > .popup-header > .dungeon-log-title {
  grid-column:1;
  min-width:0;
  max-width:none;
  margin:0!important;
  padding:0;
  overflow:visible;
  text-overflow:clip;
  white-space:normal;
  text-align:left;
  color:var(--ui-text);
  font-family:var(--ui-font-display);
  line-height:1.05;
  background:none!important;
  border:0!important;
  border-image:none!important;
  box-shadow:none!important;
}

/* Onboarding keeps the shared shell but must not reintroduce the retired
 * ornate CTA that made the home surface fail the coherence crash-test. */
#welcomePopup > .popup-card > .popup-header > .dungeon-log-title {
  color:#edf3ff!important;
}

#welcomePopup > .popup-card .dungeon-btn {
  border:1px solid #51688f!important;
  border-image:none!important;
  border-radius:var(--ui-radius-md)!important;
  background:#2b3a58!important;
  background-image:none!important;
  box-shadow:0 4px 12px rgba(3,8,20,.34)!important;
  color:#edf3ff!important;
}

/* Final closure gate: neutralize the remaining retired inner chrome on the
 * five crash-test families while leaving content, rewards and interactions
 * untouched. These selectors own only paint/geometry inside the shared
 * popup surfaces. */
:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup) .mode-tab,
:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup) .quest-claim-btn,
:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup) .dungeon-btn {
  background:#2b3a58!important;
  background-image:none!important;
  border:1px solid #51688f!important;
  border-image:none!important;
  border-radius:var(--ui-radius-md)!important;
  clip-path:none!important;
  box-shadow:0 4px 12px rgba(3,8,20,.34)!important;
  color:#edf3ff!important;
  text-shadow:none!important;
}

:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup) .mode-tab.active {
  background:#3a4f75!important;
  border-color:#87a7d9!important;
}

:is(#questsPopup,#achievementsPopup) .quest-row,
:is(#settingsPopup,#shopPopup) .guide-progressive-info,
:is(#settingsPopup,#shopPopup) .guide-currency,
:is(#settingsPopup,#shopPopup) .guide-steps li,
:is(#settingsPopup,#shopPopup) .guide-loop {
  background:#202d47!important;
  background-image:none!important;
  border:1px solid #41516f!important;
  border-image:none!important;
  border-radius:var(--ui-radius-md)!important;
  clip-path:none!important;
  box-shadow:none!important;
  color:#dbe7fb!important;
  text-shadow:none!important;
}

:is(#questsPopup,#achievementsPopup) .quest-label,
:is(#questsPopup,#achievementsPopup) .quest-reward,
:is(#settingsPopup,#shopPopup) strong,
:is(#settingsPopup,#shopPopup) h4,
:is(#settingsPopup,#shopPopup) h3,
:is(#settingsPopup,#shopPopup) .guide-h4 {
  color:#edf3ff!important;
  text-shadow:none!important;
}

#settingsPopup #apprenticeManualCurrent,
#settingsPopup #apprenticeManualCurrent * {
  background:#202d47!important;
  background-image:none!important;
  border-color:#41516f!important;
  color:#dbe7fb!important;
  text-shadow:none!important;
}

/* CURRENT follow-up: the shared commerce-card owner was still painting the
 * legacy white/gold shop winner inside the neutral popup. Keep the pack data
 * and purchase handlers unchanged; only normalize the card grammar. */
#shopPopup .shop-card {
  background:#202d47!important;
  background-image:none!important;
  border:1px solid #41516f!important;
  border-image:none!important;
  border-radius:var(--ui-radius-md)!important;
  clip-path:none!important;
  box-shadow:none!important;
  color:#dbe7fb!important;
  text-shadow:none!important;
}

#shopPopup .shop-card .dungeon-card-title,
#shopPopup .shop-card .dungeon-meta-row,
#shopPopup .shop-card .dungeon-meta-row span,
#shopPopup .shop-card .dungeon-meta-row strong {
  color:#edf3ff!important;
  text-shadow:none!important;
}

/* CURRENT follow-up: the Adventure entry controls still exposed the old
 * wood/gold winner around the now-neutral content surfaces. Preserve route
 * labels, disabled states and the battlefield asset; normalize only chrome. */
body:has(#viewAdventure:not([style*="none"])) > .view-tabs .view-tab,
#viewAdventure .menu-banner {
  background:#202d47!important;
  background-image:none!important;
  border:1px solid #41516f!important;
  border-image:none!important;
  border-radius:var(--ui-radius-md)!important;
  clip-path:none!important;
  box-shadow:none!important;
  color:#edf3ff!important;
  text-shadow:none!important;
}

body:has(#viewAdventure:not([style*="none"])) > .view-tabs .view-tab.active {
  background:#3a4f75!important;
  border-color:#87a7d9!important;
}

#viewAdventure .battle-nav-btn {
  background:#2b3a58!important;
  background-image:none!important;
  border:1px solid #51688f!important;
  border-image:none!important;
  border-radius:var(--ui-radius-md)!important;
  clip-path:none!important;
  box-shadow:0 4px 12px rgba(3,8,20,.34)!important;
  color:#edf3ff!important;
  text-shadow:none!important;
}

/* CURRENT follow-up: retain the protected battlefield asset while reducing its
 * historical saturation as the dominant page-level winner. This is paint-only;
 * actor sprites, combat state and scene identity remain untouched. */
#viewAdventure #battleStrip {
  background-color:transparent!important;
  background-blend-mode:normal!important;
}

/* Second and final Adventure neutralization pass: the runtime-owned image is
 * retained, while a bounded paint veil sits below actors and controls. */
#viewAdventure #battleStrip::before {
  content:"";
  position:absolute;
  inset:0;
  z-index:1;
  pointer-events:none;
  background:rgba(24,34,54,.48);
  mix-blend-mode:multiply;
}

#welcomePopup .bonus-popup-sub {
  color:#dbe7fb!important;
  text-shadow:none!important;
}

:is(#dailyGiftPopup,#clickerPopup,#welcomePopup) > .popup-card > .popup-header > .dungeon-log-title {
  grid-column:2;
  min-width:0;
  max-width:none;
  margin:0!important;
  padding:0;
  overflow:visible;
  text-overflow:clip;
  white-space:normal;
  text-align:center;
  color:var(--ui-text);
  font-family:var(--ui-font-display);
  line-height:1.05;
  background:none!important;
  border:0!important;
  border-image:none!important;
  box-shadow:none!important;
}

/* DISMISS_WINDOW: 44x44 interaction envelope / 36x36 painted body.
 * The old pixel polygon/shadow owner is explicitly neutralized because it used
 * !important declarations later in the historical inline-main cascade. */
:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup,#dailyGiftPopup,#clickerPopup,#welcomePopup) > .popup-card > .popup-header > .popup-close {
  position:relative;
  grid-column:2;
  justify-self:end;
  right:auto;
  top:auto;
  transform:none!important;
  width:var(--ui-control-md)!important;
  height:var(--ui-control-md)!important;
  min-width:var(--ui-control-md)!important;
  min-height:var(--ui-control-md)!important;
  padding:0;
  border:0!important;
  border-radius:var(--ui-radius-md)!important;
  clip-path:none!important;
  background:transparent!important;
  box-shadow:none!important;
  color:transparent;
  font-size:0;
  isolation:isolate;
}

:is(#dailyGiftPopup,#clickerPopup,#welcomePopup) > .popup-card > .popup-header > .popup-close {
  grid-column:3;
}

:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup,#dailyGiftPopup,#clickerPopup,#welcomePopup) > .popup-card > .popup-header > .popup-close::after {
  content:"×";
  position:absolute;
  inset:4px;
  display:flex;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
  border:var(--ui-border-strong);
  border-radius:var(--ui-radius-md);
  background:var(--ui-surface-soft);
  color:var(--ui-text);
  font:700 17px/1 system-ui,sans-serif;
  box-shadow:var(--ui-shadow-surface);
  pointer-events:none;
}

:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup,#dailyGiftPopup,#clickerPopup,#welcomePopup) > .popup-card > .popup-header > .popup-close:active::after {
  transform:translateY(1px);
  box-shadow:none;
}

:is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup,#dailyGiftPopup,#clickerPopup,#welcomePopup) > .popup-card > .popup-header > .popup-close:focus-visible {
  outline:var(--ui-border-focus);
  outline-offset:2px;
}

@media(max-width:640px){
  :is(#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup,#dailyGiftPopup,#clickerPopup,#welcomePopup,#pullResultsPopup) > .popup-card {
    border-radius:var(--ui-radius-lg)!important;
  }
}
