/* Compact, bubble-anchored message actions. */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 320;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fade) ease-out;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.sheet-mask.show {
  opacity: 1;
  pointer-events: auto;
}
.sheet {
  position: fixed;
  display: flex;
  width: min(320px, calc(100vw - 24px));
  height: 64px;
  padding: 4px;
  border: 0.5px solid var(--ios-separator);
  border-radius: var(--radius-card);
  background: var(--panel);
  transform: translateY(5px) scale(0.97);
  transform-origin: center;
  opacity: 0;
  transition: transform 150ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 150ms ease-out;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.sheet-mask.show .sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.sheet-mask.share-mode {
  background: rgba(18, 24, 32, 0.32);
}
.sheet-mask.share-mode .sheet {
  display: none;
}
.share-sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  flex-direction: column;
  width: min(480px, 100vw);
  max-height: min(78vh, 650px);
  margin: 0 auto;
  padding: 12px 24px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border-top: 0.5px solid var(--ios-separator);
  border-radius: 12px 12px 0 0;
  background: var(--panel);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 150ms ease-out, transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-mask.show.share-mode .share-sheet {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
/* 左滑删除确认框：滑入 300ms 带过冲曲线弹出（特指度高于 .share-sheet 默认过渡，确保覆盖生效） */
/* 基态：面板始终渲染（display:flex）但停在屏幕外 100% + 透明——不依赖 display:none→flex 切换，
   iOS 上 transition 必然从已渲染的 100% 状态播放到 0，保证滑入/滑出动画可靠、最终态一定可见 */
.sheet-mask.share-mode:not(.show) .share-sheet.sheet-confirm,
.sheet-mask.share-mode .share-sheet.sheet-confirm.closing {
  display: flex;
  transform: translateY(100%); /* 初始/关闭：屏幕底部之外 */
  opacity: 0;
  transition: opacity var(--dur-fade) ease-out, transform var(--dur-pop-out) var(--ease-spring);
}
.sheet-mask.show.share-mode .share-sheet.sheet-confirm {
  display: flex;
  transform: translateY(0);
  opacity: 1;
  transition: opacity var(--dur-fade) ease-out, transform var(--dur-pop) var(--ease-spring-pop);
}
.share-sheet-grabber {
  width: 38px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: var(--ios-separator);
}
.share-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.share-sheet-header h2 {
  margin: 0;
  font-size: 17px;
}
.share-sheet-header p,
.share-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.share-sheet-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--ios-fill);
  color: var(--text);
  font-size: 24px;
}
.share-label {
  display: block;
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 600;
}
#shareExpiry,
.share-url {
  width: 100%;
  min-height: 46px;
  padding: 12px 12px;
  border: 1px solid var(--ios-separator);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}
.share-primary {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--ios-blue);
  color: #fff;
  font: inherit;
  font-weight: 650;
}
.share-primary.secondary {
  border: 1px solid var(--ios-separator);
  background: var(--ios-fill);
  color: var(--ios-blue);
}
.share-primary:disabled {
  opacity: 0.55;
}
.share-result {
  text-align: center;
}
.share-result img {
  display: block;
  width: min(220px, 65vw);
  height: auto;
  margin: 8px auto 12px;
  border-radius: var(--radius-control);
  background: #fff;
}
.share-url {
  max-height: 84px;
  overflow: auto;
  overflow-wrap: anywhere;
  text-align: left;
  font-size: 13px;
}
.share-result-actions {
  display: flex;
  gap: 12px;
}
.share-result-actions .share-primary {
  flex: 1;
}
.sheet button {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 4px 4px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.sheet button:active {
  background: rgba(118, 118, 128, 0.14);
}
.sheet button.danger {
  color: var(--ios-red);
}
.sheet button:focus-visible {
  outline: 2px solid var(--ios-blue);
  outline-offset: -2px;
}
@media (prefers-reduced-motion: reduce) {
  .sheet,
  .share-sheet {
    transition: none;
  }
}
