/* Shared dialog controls.
 *
 * The close mark is drawn from two centered bars instead of a font glyph.
 * Font baselines vary between platforms and made the raw "×" look off-centre
 * even when its button used flex/grid centring.
 */
:where(.ui-close-button) {
  position: relative;
  display: inline-grid;
  place-items: center;
}

button.ui-close-button {
  box-sizing: border-box;
  /* Close controls share a touch target even inside older module button rules.
   * Keep positioning and visibility with the owning window/navigation. */
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  flex: 0 0 44px !important;
  padding: 0 !important;
  border: 1px solid #dc2626 !important;
  border-radius: 10px !important;
  background: #dc2626 !important;
  color: #fff !important;
  box-shadow: none !important;
  line-height: 1 !important;
  vertical-align: middle;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .16s ease, border-color .16s ease;
}

.ui-close-button[hidden] {
  display: none !important;
}

button.ui-close-button:hover:not(:disabled) {
  border-color: #b91c1c !important;
  background: #b91c1c !important;
  color: #fff !important;
  transform: none;
}

button.ui-close-button:active:not(:disabled) {
  border-color: #991b1b !important;
  background: #991b1b !important;
}

button.ui-close-button:disabled {
  opacity: .5;
  cursor: default;
}

.ui-close-button::before,
.ui-close-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  pointer-events: none;
  transform-origin: center;
}

.ui-close-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.ui-close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.ui-close-button:focus-visible {
  outline: 3px solid #fca5a5 !important;
  outline-offset: 3px !important;
}

@media (prefers-reduced-motion: reduce) {
  .ui-close-button {
    transition: none !important;
  }
}
