/* ============================================================
   PRISM · 浮层：下拉 / 气泡 / 提示 / 弹窗 / 抽屉 / 通知 / 命令面板
   ============================================================ */

.layer-root { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-dropdown); }
.layer-root > * { pointer-events: auto; }

.pop {
  position: fixed; z-index: var(--z-dropdown); min-width: 180px;
  background: var(--overlay); border: 1px solid var(--border-2);
  border-radius: var(--r-md); box-shadow: var(--shadow-3);
  animation: popIn var(--dur-2) var(--ease-out); transform-origin: var(--pop-origin, top center);
  overflow: hidden;
}
@keyframes popIn { from { opacity: 0; transform: scale(.95) translateY(-4px); } to { opacity: 1; transform: none; } }
.pop.closing { animation: popOut var(--dur-1) var(--ease) forwards; }
@keyframes popOut { to { opacity: 0; transform: scale(.97) translateY(-3px); } }
.pop-arrow { position: absolute; width: 9px; height: 9px; background: var(--overlay); border: 1px solid var(--border-2); transform: rotate(45deg); }

.popover { padding: 13px 15px; max-width: 300px; font-size: 12.5px; color: var(--text-2); line-height: 1.65; }
.popover-title { font-size: 13px; font-weight: 620; color: var(--text); margin-bottom: 5px; }

.tooltip {
  position: fixed; z-index: var(--z-tooltip); padding: 6px 10px; max-width: 260px;
  background: var(--text); color: var(--bg); font-size: 11.5px; font-weight: 540; line-height: 1.5;
  border-radius: var(--r-xs); box-shadow: var(--shadow-2); pointer-events: none;
  animation: fadeIn var(--dur-1) var(--ease-out);
}
.tooltip .kbd { background: rgba(128,128,128,.25); border-color: transparent; color: inherit; }

/* ── 遮罩 / 弹窗 ──────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn var(--dur-2) var(--ease-out); overflow-y: auto;
}
.scrim.closing { animation: fadeOut var(--dur-2) var(--ease) forwards; }
@keyframes fadeOut { to { opacity: 0; } }

.modal {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; background: var(--overlay);
  border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); animation: modalIn var(--dur-3) var(--ease-out); overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.scrim.closing .modal { animation: modalOut var(--dur-2) var(--ease) forwards; }
@keyframes modalOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1040px; }
.modal-full { max-width: none; width: calc(100vw - 48px); height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: flex-start; gap: 13px; padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-ico { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); }
.modal-ico .icon { width: 18px; height: 18px; }
.modal-ico.danger { background: var(--danger-soft); color: var(--danger); }
.modal-ico.warning { background: var(--warning-soft); color: var(--warning); }
.modal-ico.success { background: var(--success-soft); color: var(--success); }
.modal-title { font-family: var(--font-display); font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.modal-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.55; }
.modal-x { margin-left: auto; width: 28px; height: 28px; border-radius: var(--r-xs); display: grid; place-items: center; color: var(--text-3); flex-shrink: 0; }
.modal-x:hover { background: var(--hover); color: var(--text); }
.modal-x .icon { width: 15px; height: 15px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; font-size: 13px; line-height: 1.7; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; }
.modal-foot.between { justify-content: space-between; }

/* ── 抽屉 ─────────────────────────────────────────────── */
.drawer-scrim { position: fixed; inset: 0; z-index: var(--z-drawer); background: var(--scrim); backdrop-filter: blur(3px); animation: fadeIn var(--dur-2); }
.drawer-scrim.closing { animation: fadeOut var(--dur-2) forwards; }
.drawer {
  position: fixed; top: 0; bottom: 0; right: 0; z-index: calc(var(--z-drawer) + 1);
  width: min(520px, 100vw); display: flex; flex-direction: column;
  background: var(--overlay); border-left: 1px solid var(--border-2);
  box-shadow: var(--shadow-3); animation: drawerIn var(--dur-3) var(--ease);
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
.drawer.closing { animation: drawerOut var(--dur-2) var(--ease) forwards; }
@keyframes drawerOut { to { transform: translateX(100%); } }
.drawer-left { left: 0; right: auto; border-left: none; border-right: 1px solid var(--border-2); animation: drawerInLeft var(--dur-3) var(--ease); }
@keyframes drawerInLeft { from { transform: translateX(-100%); } to { transform: none; } }
.drawer-left.closing { animation: drawerOutLeft var(--dur-2) var(--ease) forwards; }
@keyframes drawerOutLeft { to { transform: translateX(-100%); } }
.drawer-sm { width: min(380px, 100vw); }
.drawer-lg { width: min(760px, 100vw); }
.drawer-xl { width: min(1000px, 100vw); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-body.tight { padding: 0; }
.drawer-foot { display: flex; align-items: center; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; }

/* ── 轻提示 ───────────────────────────────────────────── */
.toast-root { position: fixed; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 9px; pointer-events: none; padding: 16px; }
.toast-root.top-right { top: 0; right: 0; align-items: flex-end; }
.toast-root.top-center { top: 0; left: 50%; transform: translateX(-50%); align-items: center; }
.toast-root.bottom-right { bottom: 0; right: 0; align-items: flex-end; }
.toast-root.bottom-center { bottom: 0; left: 50%; transform: translateX(-50%); align-items: center; }
.toast {
  pointer-events: auto; position: relative; display: flex; gap: 11px; align-items: flex-start;
  width: min(384px, calc(100vw - 32px)); padding: 13px 14px;
  background: var(--overlay); border: 1px solid var(--border-2); border-radius: var(--r-md);
  box-shadow: var(--shadow-3); overflow: hidden; animation: toastIn var(--dur-3) var(--ease-spring);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(28px) scale(.96); } to { opacity: 1; transform: none; } }
.toast-root.bottom-right .toast, .toast-root.bottom-center .toast { animation-name: toastInUp; }
@keyframes toastInUp { from { opacity: 0; transform: translateY(22px) scale(.96); } to { opacity: 1; transform: none; } }
.toast.closing { animation: toastOut var(--dur-2) var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(28px) scale(.95); margin-bottom: -60px; } }
.toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--t-c, var(--accent)); }
.toast-ico { width: 19px; height: 19px; flex-shrink: 0; color: var(--t-c, var(--accent)); margin-top: 1px; }
.toast-title { font-size: 13px; font-weight: 600; line-height: 1.45; }
.toast-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.55; }
.toast-actions { display: flex; gap: 8px; margin-top: 9px; }
.toast-x { color: var(--text-3); width: 22px; height: 22px; border-radius: var(--r-xs); display: grid; place-items: center; flex-shrink: 0; }
.toast-x:hover { background: var(--hover); color: var(--text); }
.toast-x .icon { width: 13px; height: 13px; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--t-c, var(--accent)); opacity: .5; animation: timer linear forwards; }
@keyframes timer { from { width: 100%; } to { width: 0%; } }
.toast-success { --t-c: var(--success); }
.toast-danger { --t-c: var(--danger); }
.toast-warning { --t-c: var(--warning); }
.toast-info { --t-c: var(--info); }

/* ── 命令面板 ─────────────────────────────────────────── */
.cmd-scrim { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim); backdrop-filter: blur(6px); display: flex; justify-content: center; padding: 12vh 20px 20px; animation: fadeIn var(--dur-2); }
.cmd {
  width: 100%; max-width: 620px; height: fit-content; max-height: 68vh; display: flex; flex-direction: column;
  background: var(--overlay); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); overflow: hidden; animation: modalIn var(--dur-3) var(--ease-out);
}
.cmd-input-row { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.cmd-input-row .icon { width: 18px; height: 18px; color: var(--text-3); }
.cmd-input { flex: 1; font-size: 15px; outline: none; }
.cmd-input::placeholder { color: var(--text-3); }
.cmd-list { overflow-y: auto; padding: 7px; flex: 1; }
.cmd-group { padding: 9px 10px 5px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.cmd-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; color: var(--text-2); }
.cmd-item .icon { width: 16px; height: 16px; flex-shrink: 0; }
.cmd-item.cursor { background: var(--accent-soft); color: var(--accent); }
.cmd-item .cmd-hint { margin-left: auto; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.cmd-item.cursor .cmd-hint { color: var(--accent); opacity: .8; }
.cmd-foot { display: flex; align-items: center; gap: 14px; padding: 9px 15px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 11px; color: var(--text-3); }
.cmd-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* 图片预览 */
.lightbox { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(4,8,10,.9); display: grid; place-items: center; padding: 40px; animation: fadeIn var(--dur-2); }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--r-md); box-shadow: var(--shadow-3); animation: scaleIn var(--dur-3) var(--ease-out); }
.lightbox-x { position: absolute; top: 20px; right: 20px; }