.flash-card {
  position: fixed;
  top: 5rem;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #fff;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
  z-index: 99999;
  overflow: hidden;
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.flash-card.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.flash-card.hidden {
  display: none;
}

.flash-inner {
  display: grid;
  grid-template-columns: 40px 1fr 34px;
  gap: 10px;
  padding: 12px 12px 10px 12px;
  align-items: start;
}

.flash-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  user-select: none;
}

.flash-content {
  min-width: 0;
}
.flash-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  margin-bottom: 2px;
}
.flash-message {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.35;
  word-wrap: break-word;
}

.flash-close {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform 0.08s ease, filter 0.12s ease;
}
.flash-close:hover {
  filter: brightness(0.95);
}
.flash-close:active {
  transform: scale(0.98);
}

/* progress slider */
.flash-progress {
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
}
.flash-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left;
  transform: scaleX(1);
}

/* Modes */
.flash-card[data-mode="success"] {
  border-color: rgba(16, 185, 129, 0.35);
}
.flash-card[data-mode="success"] .flash-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #0f9f73;
}
.flash-card[data-mode="success"] .flash-progress-bar {
  background: #10b981;
}
.flash-card[data-mode="success"] .flash-content {
  color: #10b981;
}

.flash-card[data-mode="error"] {
  border-color: rgba(197, 36, 36, 0.35);
}
.flash-card[data-mode="error"] .flash-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.flash-card[data-mode="error"] .flash-content {
  color: #ef4444;
}

.flash-card[data-mode="error"] .flash-progress-bar {
  background: #ef4444;
}

.flash-card[data-mode="info"] {
  border-color: rgba(59, 130, 246, 0.35);
}
.flash-card[data-mode="info"] .flash-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}
.flash-card[data-mode="info"] .flash-progress-bar {
  background: #3b82f6;
}

.flash-card[data-mode="info"] .flash-content {
  color: #3b82f6;
}


@media (max-width: 769px) {
  .flash-card {
    top: 4.5rem;
    right: 16px;
    width: min(420px, calc(100vw - 32px));
    border-radius: 16px;
  }

  .flash-inner {
    grid-template-columns: 42px 1fr 36px;
    gap: 12px;
    padding: 14px 14px 12px 14px;
  }

  .flash-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 18px;
  }

  .flash-title {
    font-size: 15px;
  }

  .flash-message {
    font-size: 14px;
    line-height: 1.4;
  }

  .flash-close {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }

  .flash-progress {
    height: 4px;
  }
}

@media (max-width: 426px) {
  .flash-card {
    top: 1rem !important;
    right: 12px;
    width: calc(100vw - 24px);
    border-radius: 14px;
  }

  .flash-inner {
    grid-template-columns: 38px 1fr 32px;
    gap: 10px;
    padding: 12px;
  }

  .flash-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 16px;
  }

  .flash-title {
    font-size: 14px;
  }

  .flash-message {
    font-size: 13px;
    line-height: 1.35;
  }

  .flash-close {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .flash-progress {
    height: 3px;
  }
}


@media (max-width: 320px) {
  .flash-card {
    right: 8px;
    width: calc(100vw - 16px);
    border-radius: 12px;
  }

  .flash-inner {
    grid-template-columns: 34px 1fr 28px;
    gap: 8px;
    padding: 10px;
  }

  .flash-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 14px;
  }

  .flash-title {
    font-size: 13px;
  }

  .flash-message {
    font-size: 12px;
    line-height: 1.3;
  }

  .flash-close {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }

  .flash-progress {
    height: 3px;
  }
}
