/* CURRENT fantasy UI kit.
 * Every selector is gated by the document-root skin marker, enabled by default.
 * Appending ?uiKit=base restores the previous paint without touching gameplay or saves.
 * Popup/card/button PNGs use the supplied nine-slice insets without painting
 * their decorated center slice over the content. The edges stretch once so
 * each frame keeps its single intended center ornament at every size.
 */
:root[data-current-ui-kit="fantasy"] {
  --fui-popup-frame: url("../assets/current/ui/fantasy-kit/frames/popup_frame_9slice_large.png");
  --fui-panel-frame: url("../assets/current/ui/fantasy-kit/frames/panel_frame_9slice_light.png");
  --fui-card-frame: url("../assets/current/ui/fantasy-kit/frames/card_frame_normal.png");
  --fui-card-active: url("../assets/current/ui/fantasy-kit/frames/card_frame_active.png");
  --fui-card-disabled: url("../assets/current/ui/fantasy-kit/frames/card_frame_disabled.png");

  --fui-primary-normal: url("../assets/current/ui/fantasy-kit/buttons/primary_button_normal.png");
  --fui-primary-pressed: url("../assets/current/ui/fantasy-kit/buttons/primary_button_pressed.png");
  --fui-primary-disabled: url("../assets/current/ui/fantasy-kit/buttons/primary_button_disabled.png");
  --fui-secondary-normal: url("../assets/current/ui/fantasy-kit/buttons/secondary_button_normal.png");
  --fui-secondary-pressed: url("../assets/current/ui/fantasy-kit/buttons/secondary_button_pressed.png");
  --fui-secondary-disabled: url("../assets/current/ui/fantasy-kit/buttons/secondary_button_disabled.png");

  --fui-close: url("../assets/current/ui/fantasy-kit/icons/common/close_button.png");
  --fui-plus: url("../assets/current/ui/fantasy-kit/icons/common/plus.png");
  --fui-minus: url("../assets/current/ui/fantasy-kit/icons/common/minus.png");
  --fui-up: url("../assets/current/ui/fantasy-kit/icons/common/up_arrow.png");
  --fui-down: url("../assets/current/ui/fantasy-kit/icons/common/down_arrow.png");
  --fui-info: url("../assets/current/ui/fantasy-kit/icons/common/info.png");
  --fui-back: url("../assets/current/ui/fantasy-kit/icons/common/back_return.png");
  --fui-lock: url("../assets/current/ui/fantasy-kit/icons/common/lock.png");
  --fui-confirm: url("../assets/current/ui/fantasy-kit/icons/common/confirm.png");
  --fui-attack: url("../assets/current/ui/fantasy-kit/icons/game/attack.png");
  --fui-hp: url("../assets/current/ui/fantasy-kit/icons/game/hp.png");
  --fui-critical: url("../assets/current/ui/fantasy-kit/icons/game/critical.png");
  --fui-critical-damage: url("../assets/current/ui/fantasy-kit/icons/game/critical_damage.png");
  --fui-equipment: url("../assets/current/ui/fantasy-kit/icons/game/equipment.png");
  --fui-reward: url("../assets/current/ui/fantasy-kit/icons/game/reward.png");
  --fui-upgrade: url("../assets/current/ui/fantasy-kit/icons/game/upgrade.png");
  --fui-summon: url("../assets/current/ui/fantasy-kit/icons/game/summon.png");
}

/* Shared popup shells. The inner surface is inset behind the content so the
 * transparent corners in the supplied frame never expose a square backdrop. */
:root[data-current-ui-kit="fantasy"] :is(
  #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
  #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
  #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
  #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
  #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
) > .popup-card {
  position: relative !important;
  isolation: isolate;
  box-sizing: border-box !important;
  border: 1px solid transparent !important;
  border-image-source: var(--fui-popup-frame) !important;
  border-image-slice: 123 !important;
  border-image-width: 24px !important;
  border-image-repeat: stretch !important;
  border-radius: 22px !important;
  clip-path: inset(0 round 22px) !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 36px !important;
  image-rendering: pixelated;
}

/* Keep the paper fill inside the frame's transparent corners. Painting the
 * card itself made a pale rectangle leak past the frame's pixel-art outline. */
:root[data-current-ui-kit="fantasy"] :is(
  #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
  #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
  #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
  #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
  #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
) > .popup-card::before {
  content: "" !important;
  position: absolute !important;
  z-index: -1 !important;
  inset: 16px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #fffdf6 0%, #fff8e9 100%) !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

/* Replace the companion shell's second frame with the same quiet paper fill. */
:root[data-current-ui-kit="fantasy"] #companionPopup > .popup-card.companion-detail-shell::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  z-index: 0 !important;
  inset: 16px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #fffdf6 0%, #fff8e9 100%) !important;
  box-shadow: none !important;
  pointer-events: none !important;
}
:root[data-current-ui-kit="fantasy"] #companionPopup > .popup-card.companion-detail-shell::after {
  content: none !important;
  display: none !important;
}

/* Pull Results inherits light ink from its dark base shell. The fantasy paper
 * replaces that shell, so its title needs the shared dark paper ink explicitly. */
:root[data-current-ui-kit="fantasy"] #pullResultsPopup > .popup-card > .popup-header > .dungeon-log-title {
  color: #30271d !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

:root[data-current-ui-kit="fantasy"] :is(
  #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
  #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
  #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
  #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
  #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
) > .popup-card > .popup-header > .popup-close {
  position: absolute !important;
  display: grid !important;
  place-items: center !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0 !important;
  background: var(--fui-close) center / contain no-repeat !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  outline-offset: 3px;
  image-rendering: pixelated;
}

:root[data-current-ui-kit="fantasy"] :is(
  #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
  #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
  #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
  #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
  #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
) > .popup-card > .popup-header > .popup-close::after {
  content: none !important;
  position: static !important;
  display: flex !important;
  width: 100% !important;
  height: 100% !important;
  inset: auto !important;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #54391f !important;
  font: 700 26px/1 system-ui, sans-serif !important;
  box-shadow: none !important;
  image-rendering: pixelated;
}

/* Repeating cards: shared CURRENT surfaces, Familiar cards and Hero stat tiles. */
:root[data-current-ui-kit="fantasy"] :is(
  .dungeon-card:not(.shop-card),.ui-card,.item-card:not(.familiar-card),.result-card,.hero-score-box
) {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-card-frame) !important;
  border-image-slice: 90 !important;
  border-image-width: 13px !important;
    border-image-repeat: stretch !important;
  border-radius: 15px !important;
  image-rendering: pixelated;
}

:root[data-current-ui-kit="fantasy"] #viewFamiliers #familiarsGrid > .familiar-card {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-card-frame) !important;
  border-image-slice: 90 !important;
  border-image-width: 12px !important;
    border-image-repeat: stretch !important;
  border-radius: 15px !important;
  image-rendering: pixelated;
}

:root[data-current-ui-kit="fantasy"] #viewFamiliers #familiarsGrid > .familiar-card::before {
  content: none !important;
  display: none !important;
}

:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-tile {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-card-frame) !important;
  border-image-slice: 90 !important;
  border-image-width: 10px !important;
  border-image-repeat: stretch !important;
  border-radius: 12px !important;
  image-rendering: pixelated;
}

:root[data-current-ui-kit="fantasy"] :is(.panel,.hero-breakdown,.upgrade-shop-featured) {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-panel-frame) !important;
  border-image-slice: 101 !important;
  border-image-width: 14px !important;
  border-image-repeat: stretch !important;
  border-radius: 12px !important;
  image-rendering: pixelated;
}

:root[data-current-ui-kit="fantasy"] :is(
  .familiar-card.familiar-evolved,.result-card.is-active,.item-card[data-equipped="true"],
  .dungeon-card.active,.dungeon-card.selected
) {
  border-image-source: var(--fui-card-active) !important;
}

:root[data-current-ui-kit="fantasy"] :is(
  .familiar-card.locked,.item-card.locked,.dungeon-card.locked,.dungeon-card.disabled,
  [data-ui-surface-role="card"][aria-disabled="true"]
) {
  border-image-source: var(--fui-card-disabled) !important;
}

/* Equipment detail owns a stronger local neutral reset; this opt-in restores
 * only its frame image and leaves item layout/selection behavior untouched. */
:root[data-current-ui-kit="fantasy"] #viewEquipements .equip-detail > .item-card {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-card-frame) !important;
  border-image-slice: 90 !important;
  border-image-width: 13px !important;
  border-image-repeat: stretch !important;
}

/* Large and compact semantic controls. Native CSS border-image keeps the
 * corners fixed while horizontal/vertical center strips absorb size changes. */
:root[data-current-ui-kit="fantasy"] [data-ui-requested-skin="button/large/primary"],
:root[data-current-ui-kit="fantasy"] [data-ui-requested-skin="button/compact/primary"],
:root[data-current-ui-kit="fantasy"] .levelup-btn,
:root[data-current-ui-kit="fantasy"] .evolve-familiar-btn {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-primary-normal) !important;
  border-image-slice: 52 114 52 114 !important;
  border-image-width: 9px 13px !important;
  border-image-repeat: stretch !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #48d5d7 0%, #1495a7 100%) !important;
  box-shadow: none !important;
  color: #10202a !important;
  text-shadow: none !important;
  image-rendering: pixelated;
}

:root[data-current-ui-kit="fantasy"] [data-ui-requested-skin="button/large/secondary"],
:root[data-current-ui-kit="fantasy"] [data-ui-requested-skin="button/compact/secondary"],
:root[data-current-ui-kit="fantasy"] .awaken-btn {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-secondary-normal) !important;
  border-image-slice: 52 116 52 116 !important;
  border-image-width: 9px 13px !important;
  border-image-repeat: stretch !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #f7e9c9 0%, #e9d1a1 100%) !important;
  box-shadow: none !important;
  color: #10202a !important;
  text-shadow: none !important;
  image-rendering: pixelated;
}

:root[data-current-ui-kit="fantasy"] :is(
  #welcomePopup,#settingsPopup,#questsPopup,#achievementsPopup,#shopPopup,#pullLevelPopup,
  #dailyGiftPopup,#clickerPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#companionPopup
) button[data-ui-requested-skin^="button/"] {
  border-radius: 0 !important;
  background-color: #efe1c1 !important;
  box-shadow: none !important;
  color: #10202a !important;
  text-shadow: none !important;
}

:root[data-current-ui-kit="fantasy"] :is(
  [data-ui-requested-skin="button/large/primary"],.levelup-btn,.evolve-familiar-btn
):active:not(:disabled) {
  border-image-source: var(--fui-primary-pressed) !important;
}
:root[data-current-ui-kit="fantasy"] :is(
  [data-ui-requested-skin="button/large/secondary"],[data-ui-requested-skin="button/compact/secondary"],.awaken-btn
):active:not(:disabled) {
  border-image-source: var(--fui-secondary-pressed) !important;
}
:root[data-current-ui-kit="fantasy"] :is(
  [data-ui-requested-skin="button/large/primary"],[data-ui-requested-skin="button/compact/primary"],.levelup-btn,.evolve-familiar-btn
):is(:disabled,[aria-disabled="true"]) {
  border-image-source: var(--fui-primary-disabled) !important;
  background: linear-gradient(180deg, #91b8bf 0%, #648b94 100%) !important;
  opacity: 1 !important;
  filter: none !important;
}
:root[data-current-ui-kit="fantasy"] :is(
  [data-ui-requested-skin="button/large/secondary"],[data-ui-requested-skin="button/compact/secondary"],.awaken-btn
):is(:disabled,[aria-disabled="true"]) {
  border-image-source: var(--fui-secondary-disabled) !important;
  background: linear-gradient(180deg, #f1eadb 0%, #d7cdb9 100%) !important;
  opacity: 1 !important;
  filter: none !important;
}

/* Semantic icons continue to use the CURRENT renderer's icon slots. */
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_verrouille"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_information"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_retour"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_fermeture"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_deplier"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_replier"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_amelioration"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_equipement"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_equiper"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_recompense"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_invocation"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="stat_attaque"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="stat_pv"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="stat_critique"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="stat_degats_critiques"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="state_gain"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="state_gain_stats"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="loot_equipement"] {
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;
  background-color: transparent !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  image-rendering: pixelated;
}
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_verrouille"] { background-image: var(--fui-lock) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_information"] { background-image: var(--fui-info) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_retour"] { background-image: var(--fui-back) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_fermeture"] { background-image: var(--fui-close) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_deplier"] { background-image: var(--fui-down) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="ui_replier"] { background-image: var(--fui-up) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_amelioration"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="state_gain_stats"] { background-image: var(--fui-upgrade) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_equipement"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_equiper"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="loot_equipement"] { background-image: var(--fui-equipment) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_recompense"],
:root[data-current-ui-kit="fantasy"] [data-ui-asset="state_gain"] { background-image: var(--fui-reward) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="action_invocation"] { background-image: var(--fui-summon) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="stat_attaque"] { background-image: var(--fui-attack) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="stat_pv"] { background-image: var(--fui-hp) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="stat_critique"] { background-image: var(--fui-critical) !important; }
:root[data-current-ui-kit="fantasy"] [data-ui-asset="stat_degats_critiques"] { background-image: var(--fui-critical-damage) !important; }

/* The pack has dedicated current-state affordances for the visible controls. */
:root[data-current-ui-kit="fantasy"] #sideIconRailToggle {
  color: transparent !important;
  font-size: 0 !important;
}
:root[data-current-ui-kit="fantasy"] #sideIconRailToggle::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: var(--fui-down) center / contain no-repeat;
  image-rendering: pixelated;
}
:root[data-current-ui-kit="fantasy"] #sideIconRail:not(.collapsed) #sideIconRailToggle::before {
  background-image: var(--fui-up);
}
:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-label::before {
  content: "";
  display: inline-block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  background: center / contain no-repeat;
  image-rendering: pixelated;
}
:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-tile:nth-child(1) .hero-stat-label::before { background-image: var(--fui-attack); }
:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-tile:nth-child(2) .hero-stat-label::before,
:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-tile:nth-child(3) .hero-stat-label::before { background-image: var(--fui-hp); }
:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-tile:nth-child(4) .hero-stat-label::before { background-image: var(--fui-critical); }
:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-tile:nth-child(5) .hero-stat-label::before { background-image: var(--fui-critical-damage); }

@media (max-width: 640px) {
  :root[data-current-ui-kit="fantasy"] :is(
    #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
    #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
    #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
    #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
    #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
  ) > .popup-card {
    border-image-width: 24px !important;
    padding: 36px !important;
  }
  :root[data-current-ui-kit="fantasy"] :is(
    #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
    #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
    #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
    #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
    #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
  ) > .popup-card::before {
    inset: 16px !important;
  }
  :root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-label::before {
    flex-basis: 14px;
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 360px) {
  :root[data-current-ui-kit="fantasy"] :is(
    #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
    #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
    #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
    #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
    #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
  ) > .popup-card {
    border-image-width: 20px !important;
    padding: 30px !important;
  }
  :root[data-current-ui-kit="fantasy"] :is(
    #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
    #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
    #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
    #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
    #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
  ) > .popup-card::before {
    inset: 16px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-current-ui-kit="fantasy"] button { transition: none !important; }
}

/* Small-screen Settings labels must stay inside their native 44px tabs.
 * This changes text spacing only, not the supplied fantasy frame or modal owner. */
@media (max-width: 360px) {
  :root[data-current-ui-kit="fantasy"] #settingsPopup #settingsTabs .mode-tab {
    font-size: 11px !important;
    letter-spacing: 0 !important;
    padding-inline: 6px !important;
    gap: 4px !important;
  }
}

/* Fantasy uses a bare close glyph; keyboard focus stays visible. */
:root[data-current-ui-kit="fantasy"] .popup-overlay > .popup-card > .popup-header > .popup-close::before {
  content: none !important;
  display: none !important;
}

/* OWNER autonomous visual-correction layer — 2026-09-27.
 * Loaded last on the fantasy skin to retire residual legacy chrome without
 * changing runtime semantics, navigation, persistence or gameplay. */
:root[data-current-ui-kit="fantasy"] [data-ui-requested-skin^="button/large/"],
:root[data-current-ui-kit="fantasy"] .levelup-btn,
:root[data-current-ui-kit="fantasy"] .awaken-btn,
:root[data-current-ui-kit="fantasy"] .evolve-familiar-btn {
  min-height: 44px !important;
  box-sizing: border-box !important;
}

:root[data-current-ui-kit="fantasy"] #viewFamiliers #autoAwakenFamiliarsBtn,
:root[data-current-ui-kit="fantasy"] #viewAdventure #battlePrevBtn,
:root[data-current-ui-kit="fantasy"] #viewAdventure #battleNextBtn {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-secondary-normal) !important;
  border-image-slice: 52 116 52 116 !important;
  border-image-width: 7px 9px !important;
  border-image-repeat: stretch !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #f7e9c9 0%, #e9d1a1 100%) !important;
  box-shadow: none !important;
  color: #30271d !important;
  text-shadow: none !important;
  image-rendering: pixelated;
}

/* Do not force a tall ornamental card frame onto 48px hero metrics. */
:root[data-current-ui-kit="fantasy"] #viewHero #heroStatsGrid .hero-stat-tile,
:root[data-current-ui-kit="fantasy"] #viewHero .current-hero-power-inline {
  border-image: none !important;
  border: 1px solid #d8c397 !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, #fffdf6 0%, #fff7e6 100%) !important;
  box-shadow: none !important;
}
:root[data-current-ui-kit="fantasy"] #viewHero .current-hero-power-inline {
  min-height: 32px !important;
  height: auto !important;
  overflow: visible !important;
}

/* Stage section already owns the fantasy panel: retire the nested heavy frame. */
:root[data-current-ui-kit="fantasy"] #viewAdventure #currentStageCard {
  border-image: none !important;
  border: 1px solid #d8c397 !important;
  border-radius: 10px !important;
  background: #fffdf6 !important;
  box-shadow: none !important;
  padding: 10px 12px !important;
}

/* Compact combat controls: keep the 44px target and retire the old dark bevel. */
:root[data-current-ui-kit="fantasy"] #viewAdventure #battleSkillBar .battle-skill-btn {
  border: 1px solid #c9ae79 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #f6e7c5 0%, #e5c98f 100%) !important;
  box-shadow: 0 2px 0 rgba(94, 61, 22, .14) !important;
  color: #30271d !important;
  text-shadow: none !important;
}
:root[data-current-ui-kit="fantasy"] #viewAdventure #battleSkillBar .battle-skill-btn > small {
  border-color: rgba(84, 57, 31, .25) !important;
  background: rgba(255, 253, 246, .72) !important;
  color: #5f4c35 !important;
}
:root[data-current-ui-kit="fantasy"] #viewAdventure #battleSkillBar .battle-skill-time {
  color: #655441 !important;
}

/* Use the supplied fantasy information glyph instead of the legacy letter-i disc. */
:root[data-current-ui-kit="fantasy"] .feature-info-btn--banner {
  background: var(--fui-info) center / 30px 30px no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
}
:root[data-current-ui-kit="fantasy"] .feature-info-btn--banner::before {
  content: none !important;
  display: none !important;
}

:root[data-current-ui-kit="fantasy"] #viewAdventure .feature-info-btn--banner {
  background: var(--fui-info) center / 30px 30px no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
}
:root[data-current-ui-kit="fantasy"] #heroPanelHero .hero-breakdown:last-child {
  min-height: 78px !important;
  padding: 12px 14px 14px !important;
}
:root[data-current-ui-kit="fantasy"] #heroPanelHero .hero-breakdown:last-child .dungeon-card-desc {
  margin: 8px 0 0 !important;
  line-height: 1.35 !important;
}

/* Readability closure for light fantasy surfaces that inherited dark-shell ink. */
:root[data-current-ui-kit="fantasy"] #shopPopup .shop-card .dungeon-card-title,
:root[data-current-ui-kit="fantasy"] #shopPopup .shop-card .dungeon-meta-row,
:root[data-current-ui-kit="fantasy"] #shopPopup .shop-card .dungeon-meta-row strong {
  color: #30271d !important;
  opacity: 1 !important;
}
:root[data-current-ui-kit="fantasy"] #shopPopup .shop-card .dungeon-meta-row span,
:root[data-current-ui-kit="fantasy"] #viewDonjon .dungeon-card-desc,
:root[data-current-ui-kit="fantasy"] #viewHero .companion-row :is(.companion-role,.companion-bonus,.item-meta) {
  color: #665b4d !important;
  opacity: 1 !important;
}

/* OWNER authority closure: requested fantasy controls must not fall back to
 * the retired flat/bevel paint in feature-specific styles. */
:root[data-current-ui-kit="fantasy"] :is(
  #viewEquipements #catTabs .cat-tab,
  #viewHero .mode-tab,
  #settingsPopup .mode-tab,
  #shopPopup .mode-tab
) {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-secondary-normal) !important;
  border-image-slice: 52 116 52 116 !important;
  border-image-width: 7px 9px !important;
  border-image-repeat: stretch !important;
  border-radius: 9px !important;
  background: linear-gradient(180deg, #f7e9c9 0%, #e9d1a1 100%) !important;
  box-shadow: none !important;
  color: #30271d !important;
  text-shadow: none !important;
  image-rendering: pixelated;
}
:root[data-current-ui-kit="fantasy"] :is(
  #viewEquipements #catTabs .cat-tab.active,
  #viewEquipements #catTabs .cat-tab[aria-selected="true"],
  #viewHero .mode-tab.active,
  #viewHero .mode-tab[aria-selected="true"],
  #settingsPopup .mode-tab.active,
  #shopPopup .mode-tab.active
) {
  border-image-source: var(--fui-primary-normal) !important;
  background: linear-gradient(180deg, #48d5d7 0%, #1495a7 100%) !important;
  color: #10202a !important;
}

:root[data-current-ui-kit="fantasy"] :is(
  #viewEquipements #autoAwakenItemsBtn,
  #achievementsPopup .quest-claim-btn,
  #questsPopup .quest-claim-btn,
  #shopPopup .dungeon-btn
) {
  min-height: 44px !important;
  border: 1px solid transparent !important;
  border-image-source: var(--fui-primary-normal) !important;
  border-image-slice: 52 114 52 114 !important;
  border-image-width: 8px 11px !important;
  border-image-repeat: stretch !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #48d5d7 0%, #1495a7 100%) !important;
  box-shadow: none !important;
  color: #10202a !important;
  text-shadow: none !important;
  image-rendering: pixelated;
}
:root[data-current-ui-kit="fantasy"] #viewEquipements #autoAwakenItemsBtn {
  border-image-source: var(--fui-secondary-normal) !important;
  border-image-slice: 52 116 52 116 !important;
  background: linear-gradient(180deg, #f7e9c9 0%, #e9d1a1 100%) !important;
  color: #30271d !important;
}

/* Selected-object actions: remove the old flat gold/grey rectangle underneath
 * the fantasy border while preserving disabled semantics and 44px targets. */
:root[data-current-ui-kit="fantasy"] #viewEquipements .equip-detail .levelup-btn.item-detail-action-btn {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-primary-normal) !important;
  border-image-slice: 52 114 52 114 !important;
  border-image-width: 9px 13px !important;
  border-image-repeat: stretch !important;
  background: linear-gradient(180deg, #48d5d7 0%, #1495a7 100%) !important;
  color: #10202a !important;
  box-shadow: none !important;
  opacity: 1 !important;
  filter: none !important;
}
:root[data-current-ui-kit="fantasy"] #viewEquipements .equip-detail .levelup-btn.item-detail-action-btn:disabled {
  border-image-source: var(--fui-primary-disabled) !important;
  background: linear-gradient(180deg, #91b8bf 0%, #648b94 100%) !important;
  color: #20343a !important;
  opacity: 1 !important;
  filter: none !important;
}
:root[data-current-ui-kit="fantasy"] #viewEquipements .equip-detail .awaken-btn.item-detail-action-btn {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-secondary-normal) !important;
  border-image-slice: 52 116 52 116 !important;
  border-image-width: 9px 13px !important;
  border-image-repeat: stretch !important;
  background: linear-gradient(180deg, #f7e9c9 0%, #e9d1a1 100%) !important;
  color: #30271d !important;
  box-shadow: none !important;
}

/* Action controls that were semantically mapped to fantasy but lost the paint
 * to legacy high-specificity feature selectors. */
:root[data-current-ui-kit="fantasy"] #achievementsPopup .quest-claim-btn,
:root[data-current-ui-kit="fantasy"] #questsPopup .quest-claim-btn,
:root[data-current-ui-kit="fantasy"] #shopPopup .dungeon-btn {
  min-height: 44px !important;
  border: 1px solid transparent !important;
  border-image-source: var(--fui-primary-normal) !important;
  border-image-slice: 52 114 52 114 !important;
  border-image-width: 8px 11px !important;
  border-image-repeat: stretch !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #48d5d7 0%, #1495a7 100%) !important;
  box-shadow: none !important;
  color: #10202a !important;
  text-shadow: none !important;
  image-rendering: pixelated;
}
:root[data-current-ui-kit="fantasy"] #viewDonjon .dungeon-btn {
  min-height: 44px !important;
  height: auto !important;
}

/* Wide horizontal cards must use the quieter panel grammar. The tall card
 * artwork was visibly stretched across familiar rows and the selected item. */
:root[data-current-ui-kit="fantasy"] #viewFamiliers #familiarsGrid > .familiar-card {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-panel-frame) !important;
  border-image-slice: 101 !important;
  border-image-width: 10px !important;
  border-image-repeat: stretch !important;
  border-radius: 12px !important;
}
:root[data-current-ui-kit="fantasy"] #viewFamiliers #familiarsGrid > .familiar-card.locked {
  border-image-source: var(--fui-panel-frame) !important;
  filter: grayscale(.82) saturate(.32) !important;
  opacity: .82 !important;
}
:root[data-current-ui-kit="fantasy"] #viewEquipements .equip-detail > .item-card {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-panel-frame) !important;
  border-image-slice: 101 !important;
  border-image-width: 12px !important;
  border-image-repeat: stretch !important;
}
/* Once the tabs themselves own fantasy chrome, remove the obsolete dark tray. */
:root[data-current-ui-kit="fantasy"] #viewEquipements #catTabs {
  gap: 3px !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

/* The selected-object inner tabs are controls too; do not leave the old flat
 * rectangles inside an otherwise fantasy-framed component. */
:root[data-current-ui-kit="fantasy"] #viewEquipements .item-detail-tab {
  min-height: 44px !important;
  border: 1px solid transparent !important;
  border-image-source: var(--fui-secondary-normal) !important;
  border-image-slice: 52 116 52 116 !important;
  border-image-width: 7px 9px !important;
  border-image-repeat: stretch !important;
  border-radius: 9px !important;
  background: linear-gradient(180deg, #f7e9c9 0%, #e9d1a1 100%) !important;
  box-shadow: none !important;
  color: #30271d !important;
  text-shadow: none !important;
  image-rendering: pixelated;
}
:root[data-current-ui-kit="fantasy"] #viewEquipements .item-detail-tab:is(.active,[aria-selected="true"]) {
  border-image-source: var(--fui-primary-normal) !important;
  background: linear-gradient(180deg, #48d5d7 0%, #1495a7 100%) !important;
  color: #10202a !important;
}
:root[data-current-ui-kit="fantasy"] #viewEquipements .item-detail-tabs {
  gap: 5px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

:root[data-current-ui-kit="fantasy"] #shopPopup > .popup-card > .popup-header > .dungeon-log-title {
  border: 0 !important;
  border-image: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

@media (max-width: 640px) {
  :root[data-current-ui-kit="fantasy"] :is(
    #viewAdventure,#viewComptoir,#viewEquipements,#viewSkills,#viewHero,
    #viewFamiliers,#viewDonjon,#viewFouille,#viewFoire
  ) {
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
  }
}

:root[data-current-ui-kit="fantasy"] #viewSkills #skillsGrid .skill-current-card {
  border: 1px solid transparent !important;
  border-image-source: var(--fui-card-frame) !important;
  border-image-slice: 90 !important;
  border-image-width: 10px !important;
  border-image-repeat: stretch !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #fffdf6 0%, #fff7e6 100%) !important;
  box-shadow: none !important;
  image-rendering: pixelated;
}
:root[data-current-ui-kit="fantasy"] #viewSkills #skillsGrid .skill-current-card .dungeon-card-desc {
  color: #665b4d !important;
  opacity: 1 !important;
}

/* Keep secondary popup chrome fixed while only their content panes scroll.
 * This preserves the close control and tabs in the viewport on mobile. */
:root[data-current-ui-kit="fantasy"] :is(#achievementsPopup,#questsPopup,#shopPopup) > .popup-card {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
:root[data-current-ui-kit="fantasy"] :is(#achievementsPopup,#questsPopup,#shopPopup) > .popup-card > .popup-header,
:root[data-current-ui-kit="fantasy"] #questsPopup > .popup-card > .mode-tabs,
:root[data-current-ui-kit="fantasy"] #shopPopup > .popup-card > #shopTabs {
  flex: 0 0 auto !important;
}
:root[data-current-ui-kit="fantasy"] #achievementsPopup #achievementsList,
:root[data-current-ui-kit="fantasy"] #questsPopup :is(#questPanelDaily,#questPanelWeekly),
:root[data-current-ui-kit="fantasy"] #shopPopup :is(#dustShopSection,#starShopSection) {
  min-height: 0 !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}

/* ========================================================================== */
/* OWNER REJECTION PASS — restrained fantasy hierarchy                       */
/* The fantasy kit decorates hierarchy, not every nested surface.             */
/* ========================================================================== */

/* Large page sections: never stretch the ornamental panel asset over a
 * multi-hundred-pixel surface. Keep a quiet parchment container instead. */
:root[data-current-ui-kit="fantasy"] #viewAdventure :is(#statsShopSection,.stage-section),
:root[data-current-ui-kit="fantasy"] #viewHero .hero-breakdown {
  border-image: none !important;
  border: 1px solid #d8c397 !important;
  border-radius: 14px !important;
  background: rgba(255,253,246,.88) !important;
  box-shadow: 0 8px 22px rgba(84,57,31,.07) !important;
  image-rendering: auto !important;
}

/* Familiar rows are content cards, not ornamental frames. */
:root[data-current-ui-kit="fantasy"] #viewFamiliers #familiarsGrid > .familiar-card {
  border-image: none !important;
  border: 1px solid #d8c397 !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg,#fffdf6 0%,#fbf2df 100%) !important;
  box-shadow: 0 4px 12px rgba(84,57,31,.06) !important;
  filter: none !important;
  opacity: 1 !important;
}
:root[data-current-ui-kit="fantasy"] #viewFamiliers #familiarsGrid > .familiar-card.locked {
  border-color: #c9c1b2 !important;
  background: linear-gradient(180deg,#f2efe8 0%,#e7e2d8 100%) !important;
  filter: grayscale(.72) saturate(.35) !important;
  opacity: .88 !important;
}

/* The selected object already owns a dark product shell; a second fantasy
 * panel around it creates a frame-inside-frame collision. */
:root[data-current-ui-kit="fantasy"] #viewEquipements .equip-detail > .item-card {
  border-image: none !important;
  border: 1px solid rgba(218,194,145,.58) !important;
  border-radius: 16px !important;
  box-shadow: 0 14px 28px rgba(4,8,19,.22) !important;
}
:root[data-current-ui-kit="fantasy"] #viewEquipements .equip-detail > .item-card[data-equipped="true"] {
  border-color: #2f9e58 !important;
}

/* Navigation tabs are a segmented control. Do not wrap every 44px tab in a
 * 342px fantasy button illustration. */
:root[data-current-ui-kit="fantasy"] :is(
  #viewEquipements #catTabs .cat-tab,
  #viewHero .mode-tab,
  #settingsPopup .mode-tab,
  #shopPopup .mode-tab,
  #viewEquipements .item-detail-tab
) {
  min-height: 44px !important;
  border-image: none !important;
  border: 1px solid #cbb58b !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg,#fffdf6 0%,#f4e8cf 100%) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.75) inset !important;
  color: #3d3327 !important;
  text-shadow: none !important;
  image-rendering: auto !important;
}
:root[data-current-ui-kit="fantasy"] :is(
  #viewEquipements #catTabs .cat-tab.active,
  #viewEquipements #catTabs .cat-tab[aria-selected="true"],
  #viewHero .mode-tab.active,
  #viewHero .mode-tab[aria-selected="true"],
  #settingsPopup .mode-tab.active,
  #shopPopup .mode-tab.active,
  #viewEquipements .item-detail-tab:is(.active,[aria-selected="true"])
) {
  border-image: none !important;
  border-color: #157f8e !important;
  background: linear-gradient(180deg,#35c8cc 0%,#1594a5 100%) !important;
  color: #10202a !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.32) inset !important;
}

/* Repeated / secondary actions: compact modern controls. Reserve ornate
 * button artwork for the primary action of a surface. */
:root[data-current-ui-kit="fantasy"] :is(
  #viewAdventure #battlePrevBtn,
  #viewAdventure #battleNextBtn,
  #viewAdventure #clearedPopupBtn,
  #viewAdventure #statsShopSection .levelup-btn,
  #viewFamiliers #autoAwakenFamiliarsBtn,
  #viewFamiliers #familiarsGrid .levelup-btn,
  #viewFamiliers #familiarsGrid .awaken-btn,
  #viewEquipements #autoAwakenItemsBtn,
  #viewHero #heroPanelCompanion .levelup-btn,
  #viewHero #heroPanelCompanion .awaken-btn,
  #viewHero #heroPanelCompanion .dungeon-btn,
  #achievementsPopup .quest-claim-btn,
  #questsPopup .quest-claim-btn,
  #shopPopup .dungeon-btn
) {
  min-height: 44px !important;
  height: auto !important;
  border-image: none !important;
  border: 1px solid #178a99 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg,#42cfd2 0%,#1795a5 100%) !important;
  box-shadow: 0 2px 5px rgba(20,79,88,.12) !important;
  color: #10202a !important;
  text-shadow: none !important;
  image-rendering: auto !important;
}
:root[data-current-ui-kit="fantasy"] :is(
  #viewAdventure #battlePrevBtn,
  #viewAdventure #battleNextBtn,
  #viewAdventure #clearedPopupBtn,
  #viewFamiliers #autoAwakenFamiliarsBtn,
  #viewFamiliers #familiarsGrid .awaken-btn,
  #viewEquipements #autoAwakenItemsBtn
) {
  border-color: #c6b182 !important;
  background: linear-gradient(180deg,#fffdf6 0%,#f0dfbd 100%) !important;
  color: #3d3327 !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset !important;
}
:root[data-current-ui-kit="fantasy"] #viewFamiliers #familiarsGrid :is(.levelup-btn,.awaken-btn),
:root[data-current-ui-kit="fantasy"] #viewHero #heroPanelCompanion :is(.levelup-btn,.awaken-btn,.dungeon-btn) {
  width: auto !important;
  max-width: 100% !important;
}

/* Secondary-popup actions must not collide with progress bars/content. */
:root[data-current-ui-kit="fantasy"] #achievementsPopup .quest-claim-btn,
:root[data-current-ui-kit="fantasy"] #questsPopup .quest-claim-btn {
  min-width: 96px !important;
  width: auto !important;
  padding-inline: 14px !important;
  flex: 0 0 auto !important;
}

/* Keep ornate chrome only on real popup shells, but reduce its visual mass. */
:root[data-current-ui-kit="fantasy"] :is(
  #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
  #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
  #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
  #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
  #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
) > .popup-card {
  border-image-width: 16px !important;
  padding: 26px !important;
}
:root[data-current-ui-kit="fantasy"] :is(
  #settingsPopup,#shopPopup,#pullResultsPopup,#equipPopup,#awakenPopup,#questsPopup,
  #achievementsPopup,#companionPopup,#pullLevelPopup,#clearedPopup,#autoAwakenPopup,
  #fouillesLevelPopup,#dailyGiftPopup,#energyBoltPopup,#welcomePopup,#firstCombatPopup,
  #firstTutorialDefeatPopup,#featureUnlockPopup,#featureInfoPopup,#firstVictoryPopup,
  #offlinePopup,#clickerPopup,#memoryPopup,#matchPopup,#skillsCurrentDetailPopup
) > .popup-card::before {
  inset: 11px !important;
}

/* 44px remains the hit target; the visible close ornament is deliberately
 * smaller than the target so it no longer dominates the header. */
:root[data-current-ui-kit="fantasy"] .popup-overlay > .popup-card > .popup-header > .popup-close {
  background-size: 34px 34px !important;
}

/* Give scrollable popup content breathing room above the lower frame. */
:root[data-current-ui-kit="fantasy"] #achievementsPopup #achievementsList,
:root[data-current-ui-kit="fantasy"] #questsPopup :is(#questPanelDaily,#questPanelWeekly),
:root[data-current-ui-kit="fantasy"] #shopPopup :is(#dustShopSection,#starShopSection) {
  padding-bottom: 18px !important;
}

/* Repeated stat-shop upgrades use the compact action grammar too. */
:root[data-current-ui-kit="fantasy"] #viewAdventure #statsShopSection .dungeon-btn {
  min-height: 44px !important;
  border-image: none !important;
  border: 1px solid #178a99 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg,#42cfd2 0%,#1795a5 100%) !important;
  box-shadow: 0 2px 5px rgba(20,79,88,.12) !important;
  color: #10202a !important;
  text-shadow: none !important;
  image-rendering: auto !important;
}

/* Programmatic focus on a dialog heading is for screen-reader context, not a
 * black visual box. Keyboard focus rings remain on actionable controls. */
:root[data-current-ui-kit="fantasy"] .popup-header .dungeon-log-title[tabindex="-1"]:focus {
  outline: none !important;
}

/* Disabled repeated actions must read as unavailable, not as active teal CTAs. */
:root[data-current-ui-kit="fantasy"] :is(
  #viewAdventure #statsShopSection .dungeon-btn,
  #viewFamiliers #familiarsGrid .levelup-btn,
  #viewFamiliers #familiarsGrid .awaken-btn,
  #viewHero #heroPanelCompanion .levelup-btn,
  #viewHero #heroPanelCompanion .awaken-btn,
  #viewHero #heroPanelCompanion .dungeon-btn,
  #achievementsPopup .quest-claim-btn,
  #questsPopup .quest-claim-btn,
  #shopPopup .dungeon-btn
):is(:disabled,[aria-disabled="true"]) {
  border-image: none !important;
  border-color: #c9c1b2 !important;
  background: linear-gradient(180deg,#eeeae2 0%,#ddd7cc 100%) !important;
  box-shadow: none !important;
  color: #8a8175 !important;
  opacity: 1 !important;
  filter: none !important;
}

/* Retained primary fantasy CTAs use a lighter frame weight. */
:root[data-current-ui-kit="fantasy"] :is(
  #viewAdventure #autoBattleBtn,
  #viewAdventure #fightCurrentBtn,
  #viewEquipements .equip-detail .item-detail-action-btn
) {
  border-image-width: 7px 10px !important;
}

/* Locked companion prerequisites stay actionable-size without dominating the
 * whole card width. */
:root[data-current-ui-kit="fantasy"] #viewHero #heroPanelCompanion [data-unlock-companion]:disabled {
  width: min(260px, 100%) !important;
  max-width: 260px !important;
  margin-inline: auto !important;
  display: block !important;
}
