.warpbox-popups {
  position: fixed;
  z-index: 120;
  inset-block-start: calc(1rem + env(safe-area-inset-top));
  inset-inline-end: calc(1rem + env(safe-area-inset-right));
  width: min(26rem, calc(100vw - 2rem));
  display: grid;
  gap: 0.75rem;
  pointer-events: none;
}

.warpbox-popup {
  pointer-events: auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 0.25rem);
  background: color-mix(in srgb, var(--card) 96%, transparent);
  color: var(--card-foreground);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-0.55rem);
  transition: opacity 160ms ease, transform 160ms ease;
  overflow: hidden;
}

.warpbox-popup.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.warpbox-popup-chrome {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: start;
  padding: 0.95rem;
}

.warpbox-popup-icon {
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--primary);
  font-weight: 800;
  line-height: 1;
}

.warpbox-popup-warning .warpbox-popup-icon {
  background: color-mix(in srgb, var(--primary) 26%, transparent);
  color: var(--primary-hover);
}

.warpbox-popup-error .warpbox-popup-icon {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: var(--danger);
}

.warpbox-popup-title {
  display: block;
  margin: 0 0 0.18rem;
  font-size: 0.92rem;
  line-height: 1.2;
}

.warpbox-popup-message {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.84rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.warpbox-popup-close {
  min-height: 1.8rem;
  width: 1.8rem;
  padding: 0;
  border-color: var(--border);
  color: var(--muted-foreground);
  background: var(--surface-1);
  font-size: 1rem;
  line-height: 1;
}

.warpbox-popup-close:hover {
  color: var(--foreground);
  background: var(--surface-1-hover);
}

.warpbox-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  padding: 0 0.95rem 0.95rem;
}

:root[data-theme="retro"] .warpbox-popups {
  inset-block-start: 2.65rem;
  font-family: "PixeloidSans", "PixelOperator", "Microsoft Sans Serif", Tahoma, sans serif;
}

:root[data-theme="retro"] .warpbox-popup {
  border: 1px solid #000000;
  background: #c0c0c0;
  color: #000000;
  box-shadow: inset -1px -1px 0 #404040, inset 1px 1px 0 #ffffff, inset -2px -2px 0 #808080, inset 2px 2px 0 #dfdfdf, 3px 3px 0 rgba(0, 0, 0, 0.45);
}

:root[data-theme="retro"] .warpbox-popup::before {
  content: "Warpbox";
  display: block;
  margin: 0.18rem 0.18rem 0;
  padding: 0.22rem 0.35rem;
  background: linear-gradient(to right, #000078, 80%, #0f80cd);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
}

:root[data-theme="retro"] .warpbox-popup-error::before {
  content: "Warpbox - Error";
}

:root[data-theme="retro"] .warpbox-popup-warning::before {
  content: "Warpbox - Warning";
}

:root[data-theme="retro"] .warpbox-popup-info::before {
  content: "Warpbox - Info";
}

:root[data-theme="retro"] .warpbox-popup-chrome {
  padding: 0.8rem;
}

:root[data-theme="retro"] .warpbox-popup-icon {
  border: 1px solid #000000;
  background: #ffffff;
  color: #000078;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #ffffff;
}

:root[data-theme="retro"] .warpbox-popup-warning .warpbox-popup-icon {
  color: #9a5b00;
}

:root[data-theme="retro"] .warpbox-popup-error .warpbox-popup-icon {
  color: #c00000;
}

:root[data-theme="retro"] .warpbox-popup-message {
  color: #000000;
}

:root[data-theme="retro"] .warpbox-popup-close {
  width: 1.45rem;
  height: 1.25rem;
  min-height: 1.25rem;
  background: #c0c0c0;
  color: #000000;
  border: 1px solid #000000;
  box-shadow: inset -1px -1px 0 #404040, inset 1px 1px 0 #ffffff, inset -2px -2px 0 #808080, inset 2px 2px 0 #dfdfdf;
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 640px) {
  .warpbox-popups {
    inset-inline: 1rem;
    width: auto;
  }
}
