:root {
  --floating-alert-z: 10050;
  --floating-alert-gap: 12px;
  --floating-alert-width: min(390px, calc(100vw - 24px));
  --floating-alert-radius: 18px;
  --floating-alert-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
  --floating-alert-border: rgba(15, 23, 42, 0.08);
}

:where(
  .ui-alert,
  .um-alert,
  .auth-alert,
  .alert.alert-success,
  .alert.alert-danger,
  .alert.alert-warning,
  .alert.alert-info,
  .alert.alert-primary,
  .alert.alert-secondary,
  .alert.alert-light,
  .alert.alert-dark,
  .alert.alert--success,
  .alert.alert--danger,
  .alert.alert--warning,
  .alert.alert--info
):not(.floating-alert) {
  display: none !important;
}

#floating-alert-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--floating-alert-z);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--floating-alert-gap);
  width: var(--floating-alert-width);
  pointer-events: none;
}

.toast-sound-prompt {
  position: fixed;
  top: 20px;
  right: calc(var(--floating-alert-width) + 36px);
  z-index: calc(var(--floating-alert-z) - 1);
  width: min(320px, calc(100vw - 36px));
  padding: 15px 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(14px);
  animation: floatingAlertEnter 220ms ease-out forwards;
}

.toast-sound-prompt__title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.toast-sound-prompt__text {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #475467;
}

.toast-sound-prompt__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.toast-sound-prompt__btn {
  flex: 1 1 0;
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
}

.toast-sound-prompt__btn--yes {
  background: #ecfdf3;
  border-color: rgba(22, 163, 74, 0.18);
  color: #166534;
}

.toast-sound-prompt__btn--no {
  background: #fff7ed;
  border-color: rgba(217, 119, 6, 0.18);
  color: #9a3412;
}

.floating-alert {
  --floating-alert-accent: #2563eb;
  --floating-alert-bg: rgba(239, 246, 255, 0.96);
  --floating-alert-text: #1d4ed8;
  --floating-alert-shadow-color: rgba(37, 99, 235, 0.14);
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  width: 100%;
  margin: 0;
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--floating-alert-accent) 18%, var(--floating-alert-border));
  border-left: 4px solid var(--floating-alert-accent);
  border-radius: var(--floating-alert-radius);
  background: var(--floating-alert-bg);
  color: var(--floating-alert-text);
  box-shadow: var(--floating-alert-shadow), 0 8px 22px var(--floating-alert-shadow-color);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  overflow: hidden;
  animation: floatingAlertEnter 220ms ease-out forwards;
}

.floating-alert::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.floating-alert.is-closing {
  animation: floatingAlertExit 200ms ease-in forwards;
}

.floating-alert [hidden] {
  display: none !important;
}

.floating-alert__icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--floating-alert-accent) 14%, white);
  color: var(--floating-alert-accent);
  flex: 0 0 auto;
}

.floating-alert__icon svg {
  width: 18px;
  height: 18px;
}

.floating-alert__content {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
  font-size: 14px;
  line-height: 1.45;
}

.floating-alert__title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.88;
}

.floating-alert__content > div:last-child {
  word-break: break-word;
}

.floating-alert__content > :first-child {
  margin-top: 0;
}

.floating-alert__content > :last-child {
  margin-bottom: 0;
}

.floating-alert__close {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  color: color-mix(in srgb, var(--floating-alert-accent) 72%, #344054);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.floating-alert__close:hover {
  background: rgba(255, 255, 255, 0.82);
  transform: translateY(-1px);
}

.floating-alert__close:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--floating-alert-accent) 55%, white);
  outline-offset: 2px;
}

.floating-alert--success {
  --floating-alert-accent: #16a34a;
  --floating-alert-bg: rgba(240, 253, 244, 0.96);
  --floating-alert-text: #166534;
  --floating-alert-shadow-color: rgba(22, 163, 74, 0.13);
}

.floating-alert--error {
  --floating-alert-accent: #dc2626;
  --floating-alert-bg: rgba(254, 242, 242, 0.97);
  --floating-alert-text: #991b1b;
  --floating-alert-shadow-color: rgba(220, 38, 38, 0.14);
}

.floating-alert--warning {
  --floating-alert-accent: #d97706;
  --floating-alert-bg: rgba(255, 247, 237, 0.97);
  --floating-alert-text: #9a3412;
  --floating-alert-shadow-color: rgba(217, 119, 6, 0.14);
}

.floating-alert--info {
  --floating-alert-accent: #2563eb;
  --floating-alert-bg: rgba(239, 246, 255, 0.96);
  --floating-alert-text: #1d4ed8;
  --floating-alert-shadow-color: rgba(37, 99, 235, 0.14);
}

@keyframes floatingAlertEnter {
  from {
    opacity: 0;
    transform: translate3d(0, -10px, 0) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes floatingAlertExit {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate3d(0, -8px, 0) scale(0.98);
  }
}

@media (max-width: 640px) {
  .toast-sound-prompt {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    width: auto;
  }

  #floating-alert-container {
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
  }
}
