/* ============ Toast ============ */
.toast {
  /* 居中偏上：top 8vh，让信息出现在顶部黄金区域，不挡 composer 也不抢屏幕中心 */
  position: fixed;
  top: 8vh;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px 11px 14px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid var(--toast-border, transparent);
  border-radius: 12px;
  box-shadow:
    0 14px 36px -10px rgba(20, 18, 18, 0.18),
    0 4px 12px -4px rgba(20, 18, 18, 0.10);
  z-index: 300;
  pointer-events: none;
  max-width: min(560px, calc(100vw - 48px));
  white-space: normal;
  word-break: break-word;
  /* JS 内 inline style 会覆盖 animation 来同步 duration；这里保留兜底动画。 */
  animation: toastFloatIn 200ms ease-out, toastFloatOut 220ms ease-in 2.4s forwards;
}
html[data-theme="dark"] .toast {
  box-shadow:
    0 14px 36px -10px rgba(0, 0, 0, 0.55),
    0 4px 12px -4px rgba(0, 0, 0, 0.4);
}
.toast-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--toast-fg);
  opacity: 0.85;
}
.toast-icon svg { width: 100%; height: 100%; }
.toast-text { display: inline-block; }

/* 可点击操作按钮（如「刷新」）。toast 整体 pointer-events:none，按钮单独开启
   接收点击。常驻 toast（带 action）才会出现。 */
.toast-action {
  pointer-events: auto;
  flex-shrink: 0;
  margin-left: 6px;
  padding: 4px 12px;
  font: inherit;
  font-weight: 600;
  color: var(--toast-bg);
  background: var(--toast-fg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.92;
  transition: opacity 120ms ease;
}
.toast-action:hover { opacity: 1; }

/* 不同类型只改图标色，文字保持高对比，避免色弱可读性问题 */
.toast-success .toast-icon { color: #4caf75; opacity: 1; }
.toast-warn .toast-icon    { color: #f5b041; opacity: 1; }
.toast-error .toast-icon   { color: #ff8c8c; opacity: 1; }

/* 从顶部落下、向上淡出 — 跟 top:8vh 定位语义一致 */
@keyframes toastFloatIn {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toastFloatOut {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, -8px); }
}
