@layer toast {
  .toast-stage {
    align-items: start;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: clamp(24px, 4vw, 48px);
  }

  .toast-showcase {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 10px;
  }

  .toast-showcase-wide {
    grid-column: 1 / -1;
    justify-items: end;
    width: 100%;
  }

  .toast-example-label {
    width: 100%;
    color: var(--muted-foreground);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: .02em;
  }

  .toast-example-label span {
    float: right;
    font-weight: 400;
  }

  .toast-list {
    display: grid;
    gap: 10px;
  }

  .toast-card {
    width: min(100%, 384px);
    min-height: 62px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 8px);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow:
      0 10px 15px -3px rgb(0 0 0 / .1),
      0 4px 6px -4px rgb(0 0 0 / .1);
    outline: none;
  }

  .toast-content {
    min-height: 60px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .toast-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .toast-title {
    color: var(--popover-foreground);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
  }

  .toast-description {
    overflow-wrap: anywhere;
    color: var(--muted-foreground);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
  }

  .toast-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--popover-foreground);
  }

  .toast-icon svg,
  .toast-close svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .toast-action,
  .toast-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    color: inherit;
    background: transparent;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 100ms ease;
  }

  .toast-action {
    height: 28px;
    padding-inline: 10px;
    border-color: var(--border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--background) 90%, transparent);
    font-size: 12.8px;
    line-height: 19px;
    white-space: nowrap;
  }

  .toast-close {
    position: relative;
    width: 28px;
    height: 28px;
    padding: 5px;
    border-radius: 8px;
    color: var(--muted-foreground);
  }

  .toast-action:hover,
  .toast-close:hover {
    background: var(--muted);
    color: var(--foreground);
  }

  .toast-action:active,
  .toast-close:active {
    transform: translateY(1px);
  }

  .toast-action:focus-visible,
  .toast-close:focus-visible,
  .toast-card:focus-visible {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 45%, transparent);
  }

  .toast-action:disabled,
  .toast-close:disabled {
    pointer-events: none;
    opacity: .5;
  }

  .toast-spinner {
    animation: toast-spin 1s linear infinite;
  }

  .toast-animate {
    animation: toast-enter 500ms cubic-bezier(.22, 1, .36, 1) both;
  }

  .toast-stack {
    position: relative;
    width: min(100%, 384px);
    height: 112px;
    margin-top: 4px;
  }

  .toast-stack-item {
    position: absolute;
    right: 0;
    bottom: 0;
    transition: transform 500ms cubic-bezier(.22, 1, .36, 1), opacity 500ms ease;
    transform-origin: bottom center;
  }

  .toast-stack-back {
    z-index: 1;
    transform: translateY(-24px) scale(.9);
    opacity: .68;
  }

  .toast-stack-middle {
    z-index: 2;
    transform: translateY(-12px) scale(.95);
    opacity: .86;
  }

  .toast-stack-front { z-index: 3; }

  .toast-stack:hover,
  .toast-stack:focus-within {
    height: 222px;
  }

  .toast-stack:hover .toast-stack-back,
  .toast-stack:focus-within .toast-stack-back {
    transform: translateY(-144px) scale(1);
    opacity: 1;
  }

  .toast-stack:hover .toast-stack-middle,
  .toast-stack:focus-within .toast-stack-middle {
    transform: translateY(-72px) scale(1);
    opacity: 1;
  }

  @keyframes toast-enter {
    from { opacity: 0; transform: translateY(150%); }
    to { opacity: 1; transform: translateY(0); }
  }

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

  @media (max-width: 760px) {
    .toast-stage { grid-template-columns: minmax(0, 1fr); }
    .toast-showcase-wide { grid-column: auto; }
    .toast-card,
    .toast-stack { width: 100%; }
  }

  @media (max-width: 420px) {
    .toast-content { padding: 14px; gap: 10px; }
    .toast-action { padding-inline: 8px; }
    .toast-example-label span { display: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    .toast-animate,
    .toast-spinner { animation: none; }
    .toast-stack,
    .toast-stack-item { transition: none; }
  }
}
