
.dialog-overlay {
  position: fixed;
  inset: 0;
  bottom: var(--pin-bottom);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: var(--ua-sheet-backdrop);
  touch-action: none;
  overscroll-behavior: contain;
  animation: dialog-fade var(--motion-d-sheet-in) var(--motion-ease-enter) both;
}

.dialog-panel {
  width: 100%;
  max-width: 340px;
  padding: 22px 18px 16px;
  background: var(--ua-sheet-background);
  border: 1px solid var(--ua-sheet-border);
  border-radius: var(--r-lg);
  box-shadow: var(--ua-sheet-shadow);
  animation: dialog-pop var(--motion-d-sheet-in) var(--motion-ease-enter) both;
}

.dialog-title {
  margin: 0 4px 8px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-hi);
  overflow-wrap: anywhere;
}
.dialog-title + .dialog-message { color: var(--text-mid); font-size: 15px; }

.dialog-message {
  margin: 0 4px 20px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-hi);
}

.dialog-actions {
  display: flex;
  gap: 10px;
}

.dialog-btn {
  flex: 1 1 0;
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  transition: background var(--motion-d-quick) var(--motion-ease-out), border-color var(--motion-d-quick) var(--motion-ease-out),
              transform var(--motion-d-press) var(--motion-ease-spring);
}
.dialog-btn:not(.dialog-btn-primary):active { transform: scale(0.97); }
:where(.dialog-btn):focus-visible {
  outline: 2px solid var(--purple-bright);
  outline-offset: 2px;
}

.dialog-btn-cancel {
  background: var(--surface-tint);
  border: 1px solid var(--line);
  color: var(--text-hi);
}

.dialog-btn-danger {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface-underlay, transparent));
  border: 1px solid color-mix(in srgb, var(--danger) 50%, transparent);
  color: var(--danger);
}

.dialog-overlay.is-closing {
  pointer-events: none;
  animation: dialog-fade-out var(--motion-d-sheet-out) var(--motion-ease-sheet-out) both;
}
.dialog-overlay.is-closing .dialog-panel {
  animation: dialog-pop-out var(--motion-d-sheet-out) var(--motion-ease-sheet-out) both;
}

@keyframes dialog-fade { from { background-color: transparent; } }
@keyframes dialog-fade-out { to { background-color: transparent; } }
@keyframes dialog-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dialog-pop-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(6px) scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  .dialog-overlay, .dialog-panel { animation: none !important; }
}
