:root {
  --tibiu-alert-shell: 1170px;
  --tibiu-alert-primary: #2196F3;
  --tibiu-alert-primary-hover: #1e88e5;
  --tibiu-alert-primary-soft: #d8ecff;
  --tibiu-alert-primary-border: #64b5f6;
  --tibiu-alert-text: #171a1c;
  --tibiu-alert-muted: #636b74;
  --tibiu-alert-line: #cdd7e1;
  --tibiu-alert-soft: #f0f4f8;
  --tibiu-alert-shadow: 0 12px 32px rgba(21, 21, 21, 0.14), 0 2px 8px rgba(21, 21, 21, 0.08);
}

.tibiu-top-alert {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--tibiu-layer-top-alert, 1200);
  display: none;
  pointer-events: none;
  padding: 14px 0 0;
}

.tibiu-top-alert.is-mounted {
  display: block;
}

.tibiu-top-alert.is-active .tibiu-top-alert__inner {
  opacity: 1;
  transform: translateY(0);
}

.tibiu-top-alert.is-closing .tibiu-top-alert__inner {
  opacity: 0;
  transform: translateY(-18px);
}

.tibiu-top-alert__shell {
  width: min(var(--tibiu-alert-shell), calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.tibiu-top-alert__inner {
  width: min(100%, 560px);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-18px);
  transition: transform 0.22s cubic-bezier(0, 0, 0.2, 1), opacity 0.2s ease;
}

.tibiu-top-alert__card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--tibiu-alert-line);
  box-shadow: var(--tibiu-alert-shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.tibiu-top-alert__card::before {
  display: none;
}

.tibiu-top-alert__body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  padding: 18px 18px 14px;
}

.tibiu-top-alert__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.tibiu-top-alert__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--top-alert-soft, var(--tibiu-alert-primary-soft));
  border: 1px solid var(--top-alert-border, var(--tibiu-alert-primary-border));
  box-shadow: none;
  color: var(--top-alert-start, var(--tibiu-alert-primary));
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.tibiu-top-alert__title {
  margin: 0;
  color: var(--tibiu-alert-text);
  font-size: 17px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0;
  text-align: left;
  word-break: break-word;
}

.tibiu-top-alert__close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tibiu-alert-muted);
  box-shadow: none;
  cursor: pointer;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease;
}

.tibiu-top-alert__close:hover {
  transform: none;
  background: var(--tibiu-alert-soft);
  color: var(--tibiu-alert-text);
}

.tibiu-top-alert__content {
  margin: 0;
  padding: 0 50px 0 52px;
  color: var(--tibiu-alert-muted);
  font-size: 14px;
  line-height: 1.68;
  text-align: left;
  white-space: pre-line;
  word-break: break-word;
}

.tibiu-top-alert__content p {
  margin: 0;
}

.tibiu-top-alert__content p + p {
  margin-top: 8px;
}

.tibiu-top-alert__progress {
  position: relative;
  overflow: hidden;
  height: 4px;
  border-radius: 999px;
  background: var(--tibiu-alert-soft);
}

.tibiu-top-alert__progress-bar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--top-alert-start, var(--tibiu-alert-primary));
  transform-origin: left center;
  transform: scaleX(1);
}

.tibiu-top-alert.is-active[data-has-timer="1"] .tibiu-top-alert__progress-bar {
  animation: tibiuAlertCountdown var(--top-alert-duration, 3200ms) linear forwards;
}

.tibiu-top-alert[data-has-timer="0"] .tibiu-top-alert__progress {
  display: none;
}

.tibiu-top-alert[data-theme="primary"] .tibiu-top-alert__card {
  --top-alert-start: #2196F3;
  --top-alert-soft: #d8ecff;
  --top-alert-border: #64b5f6;
}

.tibiu-top-alert[data-theme="success"] .tibiu-top-alert__card {
  --top-alert-start: #2e7d32;
  --top-alert-soft: #edf7ed;
  --top-alert-border: #a5d6a7;
}

.tibiu-top-alert[data-theme="warning"] .tibiu-top-alert__card {
  --top-alert-start: #f59e0b;
  --top-alert-soft: #fff4de;
  --top-alert-border: #ffcc80;
}

.tibiu-top-alert[data-theme="danger"] .tibiu-top-alert__card {
  --top-alert-start: #e53935;
  --top-alert-soft: #ffebee;
  --top-alert-border: #ef9a9a;
}

.tibiu-stack-alerts {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--tibiu-layer-stack-alert, 1210);
  pointer-events: none;
  padding-top: 14px;
}

.tibiu-stack-alerts__shell {
  width: min(var(--tibiu-alert-shell), calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
}

.tibiu-stack-alerts__list {
  width: min(100%, 460px);
  display: grid;
  gap: 10px;
}

.tibiu-stack-alert {
  position: relative;
  overflow: visible;
  pointer-events: auto;
  min-height: 64px;
  opacity: 0;
  transform: translateY(-18px);
  transition: transform 0.22s cubic-bezier(0, 0, 0.2, 1), opacity 0.2s ease;
}

.tibiu-stack-alert.is-active {
  opacity: 1;
  transform: translateY(0);
}

.tibiu-stack-alert.is-closing {
  opacity: 0;
  transform: translateY(-12px);
}

.tibiu-stack-alert__card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--tibiu-alert-line);
  box-shadow: 0 8px 24px rgba(21, 21, 21, 0.1), 0 1px 2px rgba(21, 21, 21, 0.08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.tibiu-stack-alert__card::before {
  display: none;
}

.tibiu-stack-alert__body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 10px;
}

.tibiu-stack-alert__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--stack-alert-soft, var(--tibiu-alert-primary-soft));
  border: 1px solid var(--stack-alert-border, var(--tibiu-alert-primary-border));
  box-shadow: none;
  color: var(--stack-alert-start, var(--tibiu-alert-primary));
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.tibiu-stack-alert__copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tibiu-stack-alert__title {
  display: block;
  overflow: hidden;
  color: var(--tibiu-alert-text);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tibiu-stack-alert__content {
  color: var(--tibiu-alert-muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.tibiu-stack-alert__content p {
  margin: 0;
}

.tibiu-stack-alert__close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tibiu-alert-muted);
  box-shadow: none;
  cursor: pointer;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease;
}

.tibiu-stack-alert__close:hover {
  transform: none;
  background: var(--tibiu-alert-soft);
  color: var(--tibiu-alert-text);
}

.tibiu-stack-alert__progress {
  position: relative;
  overflow: hidden;
  height: 3px;
  margin: 0 14px 12px;
  border-radius: 999px;
  background: var(--tibiu-alert-soft);
}

.tibiu-stack-alert__progress-bar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--stack-alert-start, var(--tibiu-alert-primary));
  transform-origin: left center;
  animation: tibiuAlertCountdown var(--stack-alert-duration, 2200ms) linear forwards;
}

.tibiu-stack-alert[data-has-timer="0"] .tibiu-stack-alert__progress {
  display: none;
}

.tibiu-stack-alert[data-theme="primary"] .tibiu-stack-alert__card {
  --stack-alert-start: #2196F3;
  --stack-alert-soft: #d8ecff;
  --stack-alert-border: #64b5f6;
}

.tibiu-stack-alert[data-theme="success"] .tibiu-stack-alert__card {
  --stack-alert-start: #2e7d32;
  --stack-alert-soft: #edf7ed;
  --stack-alert-border: #a5d6a7;
}

.tibiu-stack-alert[data-theme="warning"] .tibiu-stack-alert__card {
  --stack-alert-start: #f59e0b;
  --stack-alert-soft: #fff4de;
  --stack-alert-border: #ffcc80;
}

.tibiu-stack-alert[data-theme="danger"] .tibiu-stack-alert__card {
  --stack-alert-start: #e53935;
  --stack-alert-soft: #ffebee;
  --stack-alert-border: #ef9a9a;
}

@keyframes tibiuAlertCountdown {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@media (max-width: 760px) {
  .tibiu-top-alert {
    padding-top: 10px;
  }

  .tibiu-top-alert__shell,
  .tibiu-stack-alerts__shell {
    width: min(100%, calc(100% - 20px));
  }

  .tibiu-top-alert__inner,
  .tibiu-stack-alerts__list {
    width: 100%;
  }

  .tibiu-top-alert__body {
    padding: 16px 14px 14px;
  }

  .tibiu-top-alert__head {
    grid-template-columns: 38px minmax(0, 1fr) 34px;
    gap: 10px;
  }

  .tibiu-top-alert__icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .tibiu-top-alert__title {
    font-size: 16px;
  }

  .tibiu-top-alert__content {
    padding: 0;
    font-size: 13px;
  }

  .tibiu-stack-alerts {
    padding-top: 10px;
  }

  .tibiu-stack-alerts__shell {
    justify-content: center;
  }

  .tibiu-stack-alert__body {
    grid-template-columns: 32px minmax(0, 1fr) 28px;
    gap: 10px;
    padding: 12px 12px 10px;
  }

  .tibiu-stack-alert__icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 12px;
  }

  .tibiu-stack-alert__title {
    font-size: 13px;
  }

  .tibiu-stack-alert__content {
    font-size: 11px;
  }

  .tibiu-stack-alert__progress {
    margin: 0 12px 10px;
  }
}

.tibiu-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  color: #8a8f98;
  text-align: center;
}

.tibiu-skeleton-line {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f2f3f5 25%, #e7e9ee 37%, #f2f3f5 63%);
  background-size: 400% 100%;
  animation: tibiu-alert-skeleton 1.4s ease infinite;
}

.tibiu-skeleton-line + .tibiu-skeleton-line {
  margin-top: 10px;
}

.tibiu-skeleton-line.is-short {
  width: 62%;
}

.tibiu-loading-mask {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 120px;
  color: #8a8f98;
}

.tibiu-loading-mask.is-active {
  display: flex;
}

.tibiu-loading-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(33, 150, 243, 0.18);
  border-top-color: #2196F3;
  border-radius: 50%;
  animation: tibiu-alert-spin 0.9s linear infinite;
}

@keyframes tibiu-alert-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tibiu-alert-skeleton {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}
