/* Fake “this window cannot be closed” dialog for retro title-bar X buttons.
   Overlay is position:fixed so it never shifts page layout. */

.mito-win-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  margin: 0;
  background: rgba(0, 0, 0, 0.28);
  -webkit-tap-highlight-color: transparent;
}
.mito-win-overlay.is-open { display: flex; }

.mito-win-dialog {
  width: min(320px, calc(100vw - 32px));
  max-width: 100%;
  background: #c0c0c0;
  color: #000;
  border: 2px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: 1px 1px 0 #000, 4px 4px 0 rgba(0, 0, 0, 0.35);
  font: 13px/1.4 "Segoe UI", Tahoma, "MS Sans Serif", sans-serif;
  color-scheme: light;
}
.mito-win-dialog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px;
  padding: 0 4px 0 8px;
  height: 22px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  user-select: none;
}
.mito-win-dialog-x {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 14px;
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #c0c0c0;
  color: #000;
  font: 700 12px/14px Tahoma, sans-serif;
  border: 1px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: inset -1px -1px #808080;
  border-radius: 0;
  cursor: pointer;
  position: relative;
}
.mito-win-dialog-x::after {
  content: "";
  position: absolute;
  inset: -8px;
}
.mito-win-dialog-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 8px 14px;
}
.mito-win-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin-top: 1px;
}
.mito-win-dialog-body p {
  margin: 0;
  flex: 1 1 auto;
  padding-top: 6px;
  color: #000;
  font-size: 13px;
}
.mito-win-dialog-actions {
  display: flex;
  justify-content: center;
  padding: 8px 12px 14px;
}
.mito-win-ok {
  appearance: none;
  -webkit-appearance: none;
  min-width: 88px;
  min-height: 32px;
  padding: 4px 18px;
  margin: 0;
  background: #c0c0c0;
  color: #000;
  font: 13px/1.2 "Segoe UI", Tahoma, "MS Sans Serif", sans-serif;
  border: 2px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: 1px 1px 0 #000;
  border-radius: 0;
  cursor: pointer;
}
.mito-win-ok:focus-visible,
.mito-win-dialog-x:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -3px;
}
.mito-win-ok:active,
.mito-win-dialog-x:active {
  border-color: #000 #fff #fff #000;
  box-shadow: none;
}

/* Subtle shake on the error dialog and optionally the source window. */
.mito-win-shake {
  animation: mito-win-shake 0.32s ease;
}
@keyframes mito-win-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .mito-win-shake { animation: none; }
}

/* WordPress mito-os: turn the old "_ □ ×" text into real controls. */
.window-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  word-spacing: normal;
}
.window-controls .mito-win-min,
.window-controls .mito-win-max,
.window-controls .mito-win-close,
.window-controls [data-mito-win-close] {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0 6px;
  margin: 0;
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  cursor: default;
}
.window-controls [data-mito-win-close],
.window-controls .mito-win-close {
  cursor: pointer;
}

/* Tools hub: make the title-bar X a real button with a larger tap target. */
.win-btns [data-mito-win-close],
.win-btns button.x,
.win-btns i.x {
  pointer-events: auto !important;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  line-height: 14px;
  width: 16px;
  height: 14px;
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  background: var(--face, #c0c0c0);
  color: #000;
  border: 1px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: inset -1px -1px #808080;
  border-radius: 0;
  position: relative;
  flex: none;
  font-family: inherit;
}
.win-btns [data-mito-win-close]::after,
.win-btns button.x::after,
.win-btns i.x::after {
  content: "";
  position: absolute;
  top: -10px;
  right: -8px;
  bottom: -10px;
  left: -4px;
}
