/* ============================================================
   Slides 平台 共享样式 v2 — 毛玻璃 + 呼吸感布局
   ============================================================ */
:root {
  --primary: #6c5ce7;
  --primary-dark: #5546c9;
  --primary-light: rgba(108, 92, 231, .12);
  --accent: #5a8bf7;
  --bg: #eef0fa;
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-border: rgba(255, 255, 255, .72);
  --text: #20263a;
  --text-2: #67708a;
  --border: rgba(120, 130, 170, .20);
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(45, 52, 95, .08);
  --shadow-lg: 0 20px 56px rgba(45, 52, 95, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
/* 柔和渐变背景层（毛玻璃的取景来源） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 720px at 8% -10%, rgba(108, 92, 231, .22), transparent 60%),
    radial-gradient(900px 640px at 105% 4%, rgba(90, 139, 247, .20), transparent 55%),
    radial-gradient(1000px 760px at 50% 112%, rgba(56, 189, 248, .16), transparent 60%),
    radial-gradient(700px 520px at 92% 78%, rgba(244, 114, 182, .12), transparent 55%);
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ---------------- 毛玻璃基础工具 ---------------- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--glass-border);
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 64px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid rgba(255, 255, 255, .65);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
  display: flex; align-items: center; gap: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary);
}
.logo svg { display: block; -webkit-text-fill-color: var(--primary); color: var(--primary); }
.logo-img { height: 26px; width: auto; display: block; object-fit: contain; }
.subtitle { color: var(--text-2); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(255, 255, 255, .7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .2s, color .2s, transform .2s, box-shadow .2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .9); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.icon-btn svg { width: 20px; height: 20px; }
.user-chip {
  max-width: 150px;
  font-size: 12.5px;
  color: var(--text-2);
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(255, 255, 255, .7);
  padding: 6px 14px;
  border-radius: 22px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-menu-wrap { position: relative; }
.user-menu {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  width: 220px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: popIn .16s ease;
}
.user-menu[hidden] { display: none; }
.um-name { font-size: 14px; font-weight: 600; padding: 6px 10px 2px; }
.um-uid {
  font-size: 12px;
  color: var(--primary);
  font-family: Consolas, "Courier New", monospace;
  padding: 4px 10px 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s;
}
.um-uid:hover { background: rgba(108, 92, 231, .08); }
.um-sep { height: 1px; background: rgba(120, 130, 170, .16); margin: 4px 0; }
.um-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--text);
  transition: background .12s, color .12s;
}
.um-item:hover { background: rgba(108, 92, 231, .08); color: var(--primary); }
.um-item.danger { color: var(--danger); }
.um-item.danger:hover { background: var(--danger-light); }

/* ---------------- 登录 / 注册 ---------------- */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-card {
  width: 400px;
  max-width: 100%;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 42px 38px;
  text-align: center;
}
.auth-logo {
  width: 60px; height: 60px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(108, 92, 231, .35);
}
.auth-card h1 { font-size: 23px; margin-bottom: 6px; }
.auth-sub { color: var(--text-2); font-size: 13px; margin-bottom: 28px; }
.auth-card .form-group { text-align: left; }
.btn-block { width: 100%; margin-top: 10px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--text-2); }
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }
.auth-msg { margin-top: 14px; font-size: 12.5px; color: var(--danger); display: none; }
.auth-msg.error { display: block; }

/* ---------------- 首页卡片 ---------------- */
.home-main { padding: 40px 44px 80px; max-width: 1320px; margin: 0 auto; }
.gen-area { max-width: 860px; margin: 0 auto 44px; }
.gen-area-head { text-align: center; margin-bottom: 18px; }
.gen-area-title { font-size: 25px; font-weight: 700; margin-bottom: 6px; letter-spacing: .5px; }
.gen-area-sub { color: var(--text-2); font-size: 13px; }
.gen-box {
  position: relative;
  z-index: 30;
  background: rgba(255, 255, 255, .68);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 20px;
}
.gen-input-wrap { position: relative; }
.chat-input.home-input {
  min-height: 160px;
  height: 160px;
  font-size: 15px;
  border-radius: 18px;
}
.home-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.home-toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-toolbar-right { display: flex; align-items: center; gap: 10px; }
.p-wrap { position: relative; }
.p-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(120, 130, 170, .22);
  color: var(--text-2);
  font-size: 12.5px;
  transition: background .15s, color .15s, border-color .15s;
}
.p-pill:hover { background: rgba(108, 92, 231, .08); color: var(--primary); border-color: rgba(108, 92, 231, .28); }
.p-val {
  color: var(--primary);
  font-weight: 500;
  max-width: 92px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-popup {
  position: absolute;
  left: 0; top: calc(100% + 10px);
  width: 260px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: popIn .16s ease;
}
.p-popup[hidden] { display: none; }
.p-popup label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.p-opt-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.p-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  transition: background .12s, color .12s;
}
.p-opt:hover { background: rgba(108, 92, 231, .08); color: var(--primary); }
.p-opt.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.p-popup select, .p-popup .custom-pages {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 11px;
  background: rgba(255, 255, 255, .85);
  font-size: 13px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.p-popup select:focus, .p-popup .custom-pages:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .12); }
.p-popup .custom-pages { margin-top: 8px; }
.params-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(120, 130, 170, .10);
  border: 1px solid rgba(120, 130, 170, .22);
  color: var(--text-2);
  font-size: 12.5px;
  transition: background .15s, color .15s, border-color .15s;
}
.params-trigger:hover { background: rgba(108, 92, 231, .10); color: var(--primary); border-color: rgba(108, 92, 231, .28); }
.params-popup {
  position: absolute;
  left: 0; top: calc(100% + 12px);
  width: 340px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: popIn .18s ease;
}
.pp-row { display: flex; flex-direction: column; gap: 8px; }
.pp-row label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.pp-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 11px;
  background: rgba(255, 255, 255, .85);
  font-size: 13px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.pp-row select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .12); }
.pp-inline { display: flex; gap: 10px; }
.pp-inline select { flex: 1; }
.pp-inline .custom-pages {
  width: 88px;
  padding: 10px 12px;
  border-radius: 11px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 22px;
  letter-spacing: .3px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
}
.deck-card {
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(45, 52, 95, .07);
  overflow: hidden;
  cursor: pointer;
  transition: transform .22s, box-shadow .22s, background .22s;
}
.deck-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 24px 54px rgba(45, 52, 95, .15);
  background: rgba(255, 255, 255, .78);
}
.deck-card.generating { cursor: progress; }
.deck-card.generating:hover { transform: none; box-shadow: 0 10px 30px rgba(45, 52, 95, .07); }
.deck-card.generating .more-btn { pointer-events: none; opacity: .5; }
.gen-mask {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.gen-mask .spinner {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(108, 92, 231, .18);
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
.gen-mask-text { font-size: 12.5px; color: var(--text-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(160deg, #f4f5fc, #e9ecf8);
  overflow: hidden;
  border-bottom: 1px solid rgba(120, 130, 170, .12);
}
.card-preview.ratio-43 { aspect-ratio: 4 / 3; }
.card-preview iframe {
  position: absolute;
  top: 0; left: 0;
  width: 960px; height: 540px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
}
.card-preview .preview-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-2); font-size: 13px; gap: 8px;
}
.card-info {
  display: flex; align-items: center;
  padding: 16px 18px;
  gap: 8px;
}
.card-name {
  flex: 1;
  font-size: 15px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.card-meta { padding: 0 18px 18px; color: var(--text-2); font-size: 12.5px; }

/* 新建卡片 */
.new-card {
  border: 2px dashed rgba(108, 92, 231, .45);
  background: rgba(255, 255, 255, .38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 22px;
  display: flex; flex-direction: column;
  color: var(--primary);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
.new-card:hover {
  border-color: var(--primary);
  background: rgba(108, 92, 231, .08);
  transform: translateY(-5px);
  box-shadow: 0 20px 44px rgba(108, 92, 231, .14);
}
.new-card .new-preview {
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px dashed rgba(108, 92, 231, .25);
}
.new-card .new-text {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500;
  padding: 6px;
}
.new-card .plus {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 300;
  box-shadow: 0 10px 24px rgba(108, 92, 231, .32);
  transition: transform .2s;
}
.new-card:hover .plus { transform: scale(1.08) rotate(90deg); }

/* 更多菜单 */
.more-btn {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.more-btn:hover { background: rgba(108, 92, 231, .12); color: var(--primary); }
.more-menu {
  position: fixed;
  z-index: 200;
  max-height: 152px;
  overflow-y: auto;
  scrollbar-width: none;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  min-width: 130px;
  padding: 6px;
  animation: popIn .16s ease;
}
.more-menu::-webkit-scrollbar { display: none; }
.more-menu .menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  transition: background .15s;
}
.more-menu .menu-item:hover { background: rgba(108, 92, 231, .10); color: var(--primary); }
.more-menu .menu-item.danger:hover { background: var(--danger-light); color: var(--danger); }
.more-menu .menu-item svg { width: 16px; height: 16px; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(24, 29, 52, .38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .18s ease;
}
.modal {
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  width: 420px;
  max-width: calc(100vw - 40px);
  padding: 26px;
  animation: popIn .2s ease;
}
.modal-title { font-size: 16.5px; font-weight: 600; margin-bottom: 8px; }
.modal-desc { color: var(--text-2); font-size: 13.5px; line-height: 1.7; margin-bottom: 18px; }
.modal input[type="text"], .modal input[type="password"], .modal input[type="number"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 14px;
  background: rgba(255, 255, 255, .8);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.modal input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .14); }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px;
}
.btn {
  padding: 9px 20px;
  border-radius: 11px;
  font-size: 14px;
  transition: background .18s, transform .18s, box-shadow .18s;
}
.btn-plain { color: var(--text-2); }
.btn-plain:hover { background: rgba(120, 130, 170, .12); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 8px 20px rgba(108, 92, 231, .28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(108, 92, 231, .36); }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #ef4444); color: #fff; box-shadow: 0 8px 20px rgba(239, 68, 68, .25); }
.btn-danger:hover { transform: translateY(-1px); }
.btn-fade { color: var(--text-2); opacity: .65; }
.btn-fade:hover { background: rgba(120, 130, 170, .10); opacity: 1; }
.share-path-box {
  background: rgba(120, 130, 170, .08);
  border: 1px solid rgba(120, 130, 170, .16);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 12.5px;
  color: var(--text-2);
  word-break: break-all;
  margin-bottom: 12px;
  user-select: all;
}
.share-path-label { font-size: 11px; color: var(--text-2); opacity: .8; margin-bottom: 4px; }
.share-path-text { word-break: break-all; }
.share-link-box {
  background: rgba(120, 130, 170, .06);
  border: 1px dashed rgba(120, 130, 170, .25);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 12px;
  color: var(--text-2);
  word-break: break-all;
  margin-bottom: 12px;
}
.share-zip-note {
  font-size: 12px;
  color: var(--text-2);
  background: rgba(108, 92, 231, .08);
  border: 1px solid rgba(108, 92, 231, .18);
  border-radius: 9px;
  padding: 8px 12px;
  margin-bottom: 4px;
}
.share-url-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--glass-strong);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: text;
}
.share-url-input:focus { border-color: var(--primary); }
.player-title {
  position: absolute;
  top: 22px; left: 24px;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, .82);
  font-size: 14px;
  background: rgba(255, 255, 255, .1);
  padding: 6px 14px;
  border-radius: 999px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(.96) translateY(4px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  top: 78px; left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 34, 58, .82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  padding: 12px 22px;
  border-radius: 13px;
  font-size: 13.5px;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity .22s, transform .22s;
  pointer-events: none;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(5px); }
.toast.error { background: rgba(220, 38, 38, .88); }

/* ---------------- 功能页 (编辑器) ---------------- */
.editor-body { display: flex; height: calc(100vh - 64px); }
.editor-topbar .back-btn { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 14px; padding: 8px 10px; border-radius: 10px; transition: background .15s, color .15s; }
.editor-topbar .back-btn:hover { background: rgba(108, 92, 231, .10); color: var(--primary); }
.deck-title { font-size: 16px; font-weight: 600; }
.deck-info { color: var(--text-2); font-size: 12.5px; }

/* 左侧对话区 */
.chat-panel {
  width: 360px;
  min-width: 300px;
  border-right: 1px solid rgba(255, 255, 255, .65);
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  display: flex;
  flex-direction: column;
}
.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(120, 130, 170, .14);
  font-size: 13px;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.chat-clear-btn {
  font-size: 12px;
  color: var(--text-2);
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(120, 130, 170, .22);
  background: rgba(255, 255, 255, .6);
  transition: color .15s, border-color .15s, background .15s;
}
.chat-clear-btn:hover { color: var(--danger); border-color: rgba(239, 68, 68, .4); background: var(--danger-light); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.msg {
  max-width: 94%;
  padding: 11px 14px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 8px 20px rgba(108, 92, 231, .22);
}
.msg.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .8);
  border-bottom-left-radius: 5px;
}
.msg.ai.error { background: var(--danger-light); color: var(--danger); }
.msg .msg-label { font-size: 11.5px; opacity: .7; margin-bottom: 3px; }

/* 底部控制区：文本输入 + 参数区 */
.chat-controls {
  position: relative;
  border-top: 1px solid rgba(120, 130, 170, .14);
  background: rgba(255, 255, 255, .5);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex-shrink: 0;
}
.chat-input-row {
  padding: 12px 14px 10px;
  display: flex;
  gap: 0;
}
.chat-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.chat-input {
  min-height: 66px;
  height: 66px;
  overflow-y: auto;
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 13px;
  padding: 11px 44px 12px 13px;
  font-size: 13.5px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  outline: none;
  line-height: 1.55;
  transition: border-color .15s, box-shadow .15s;
  word-break: break-word;
}
.chat-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .12); }
.chat-input.is-empty:before, .chat-input:empty:before {
  content: attr(data-placeholder);
  color: rgba(103, 112, 138, .65);
  pointer-events: none;
}
.chat-input .cmd-line { min-height: 1.55em; }
.chat-input .cmd-line + .cmd-line { margin-top: 2px; }
.input-resizer {
  height: 7px;
  cursor: ns-resize;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.input-resizer::after {
  content: '';
  width: 36px;
  height: 3px;
  border-radius: 3px;
  background: rgba(120, 130, 170, .28);
  transition: background .15s;
}
.input-resizer:hover::after { background: var(--primary); }
.btn-send {
  position: absolute;
  right: 7px; bottom: 10px;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px rgba(108, 92, 231, .25);
  transition: transform .18s, box-shadow .18s, opacity .18s;
}
.btn-send svg { width: 16px; height: 16px; }
.btn-send:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(108, 92, 231, .34); }
.btn-send:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* 参数区 */
.param-panel {
  padding: 10px 14px 14px;
  position: relative;
}
.param-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.param-scroll::-webkit-scrollbar { display: none; }
.param-panel select {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 9px;
  background: rgba(255, 255, 255, .7);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.param-panel select:hover, .param-panel select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(108, 92, 231, .10); }
.upload-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 9px;
  border: 1px dashed var(--primary);
  color: var(--primary);
  font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 2px 0;
  background: rgba(108, 92, 231, .08);
  transition: background .18s, color .18s, transform .18s;
}
.upload-btn:hover { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; transform: scale(1.06); }
.custom-pages {
  width: 58px; flex-shrink: 0;
  font-size: 12px;
  padding: 6px 7px;
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 9px;
  background: rgba(255, 255, 255, .7);
  outline: none;
}
.custom-pages:focus { border-color: var(--primary); }
.file-info {
  flex: 0 0 auto; max-width: 180px;
  font-size: 11.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(108, 92, 231, .08);
  border: 1px solid rgba(108, 92, 231, .18);
  border-radius: 16px;
  padding: 4px 10px;
}
.file-info.has-file { color: #0f9d6e; }
.param-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(108, 92, 231, .32);
  z-index: 5;
  transition: transform .15s, box-shadow .15s;
}
.param-nav:hover { transform: translateY(-50%) scale(1.1); box-shadow: 0 6px 16px rgba(108, 92, 231, .42); }
.param-nav.left { left: 4px; }
.param-nav.right { right: 4px; }
.param-nav[hidden] { display: none; }

/* 文件浮窗 */
.file-popup {
  position: absolute;
  top: 14px; left: 14px;
  bottom: 14px;
  width: min(600px, 72%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateX(-24px);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
}
.file-popup.show { transform: translateX(0); opacity: 1; pointer-events: auto; }
.file-popup[hidden] { display: none; }
.file-popup.centered {
  left: 50%;
  width: min(680px, 80%);
  transform: translate(-50%, -10px);
}
.file-popup.centered.show { transform: translate(-50%, 0); }
.file-popup-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(120, 130, 170, .16);
}
.file-popup-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-right: 12px;
}
.file-popup-close {
  width: 28px; height: 28px;
  border-radius: 9px;
  font-size: 17px;
  line-height: 1;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.file-popup-close:hover { background: var(--danger-light); color: var(--danger); }
.file-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  color: #374151;
}

/* @ 弹窗 */
.at-popup {
  position: absolute;
  left: 14px; right: 14px;
  bottom: 100%;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
  max-height: 216px; /* 单屏最多 5 项 */
  overflow-y: auto;
  scrollbar-width: none;
}
.at-popup::-webkit-scrollbar { display: none; }
.at-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text);
  transition: background .12s;
}
.at-opt:hover { background: rgba(108, 92, 231, .10); color: var(--primary); }

/* @ 胶囊 / 区域胶囊 */
.at-chip {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  padding: 2px 11px;
  margin: 0 2px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 10px rgba(108, 92, 231, .28);
  cursor: pointer;
  user-select: none;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.at-chip.region {
  background: linear-gradient(135deg, #0ea5e9, #14b8a6);
  box-shadow: 0 4px 10px rgba(14, 165, 233, .30);
}
.at-chip.file {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  box-shadow: 0 4px 10px rgba(245, 158, 11, .32);
}
.at-chip:hover {
  transform: translateY(-1px) scale(1.05);
  filter: brightness(1.08);
  box-shadow: 0 8px 18px rgba(108, 92, 231, .38);
}
.at-chip.region:hover { box-shadow: 0 8px 18px rgba(14, 165, 233, .4); }
.at-chip.file:hover { box-shadow: 0 8px 18px rgba(245, 158, 11, .42); }
.at-chip.pulse { animation: chipPulse .45s ease; }
@keyframes chipPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* 上传后模式切换提醒 */
.upload-prompt {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  width: 330px;
  max-width: calc(100vw - 40px);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  z-index: 400;
  animation: popIn .2s ease;
}
.up-title { font-size: 14.5px; font-weight: 600; margin-bottom: 5px; }
.up-desc { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.up-never {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2);
  margin-bottom: 14px; cursor: pointer;
  user-select: none;
}
.up-never input { accent-color: var(--primary); }
.up-actions { display: flex; justify-content: flex-end; gap: 9px; }
.up-close {
  position: absolute; top: 10px; right: 12px;
  font-size: 17px; line-height: 1;
  color: var(--text-2);
  padding: 3px;
  transition: color .15s;
}
.up-close:hover { color: var(--text); }

/* 右侧幻灯片区 */
.slides-panel { flex: 1; display: flex; flex-direction: column; background: transparent; min-width: 0; position: relative; }
.slides-stage {
  flex: 1;
  margin: 22px 22px 14px;
  background: rgba(255, 255, 255, .60);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.main-frame-wrap {
  box-shadow: 0 12px 36px rgba(45, 52, 95, .16);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.main-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.fs-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: #10131f;
}
.in-fullscreen .fs-frame { display: block; }
.in-fullscreen .main-frame-wrap { display: none; }
#mainFrame {
  width: 100%; height: 100%;
  border: 0;
}
.page-num-badge {
  position: absolute;
  bottom: 14px; right: 16px;
  background: rgba(30, 34, 58, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 22px;
  pointer-events: none;
}
.version-badge {
  position: absolute;
  top: 14px; left: 16px;
  z-index: 20;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(30, 34, 58, .55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .15s;
  user-select: none;
}
.version-badge:hover { background: rgba(30, 34, 58, .72); transform: translateY(-1px); }
.version-badge.previewing { background: rgba(14, 165, 233, .78); }
.vb-caret { font-size: 10px; opacity: .85; }
.version-drop {
  position: absolute;
  top: 52px; left: 16px;
  width: 320px;
  max-height: calc(100% - 70px);
  overflow-y: auto;
  z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  animation: popIn .16s ease;
}
.version-drop.show { display: block; }
.vd-section { margin-bottom: 8px; }
.vd-section:last-child { margin-bottom: 0; }
.vd-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  padding: 6px 8px 4px;
}
.vd-body { display: flex; gap: 10px; }
.vd-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 92px;
  flex-shrink: 0;
  border-right: 1px solid rgba(120, 130, 170, .14);
  padding-right: 8px;
}
.vd-tab {
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--text-2);
  text-align: left;
  transition: background .15s, color .15s;
}
.vd-tab:hover { background: rgba(108, 92, 231, .08); color: var(--primary); }
.vd-tab.active { background: rgba(108, 92, 231, .12); color: var(--primary); font-weight: 600; }
.vd-content { flex: 1; min-width: 0; max-height: 300px; overflow-y: auto; }
.vd-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
  transition: background .12s;
}
.vd-item:hover { background: rgba(108, 92, 231, .10); }
.vd-item-title { font-size: 13px; font-weight: 600; }
.vd-item-sub { font-size: 11.5px; color: var(--text-2); }
.vd-empty { font-size: 12px; color: var(--text-2); padding: 8px 10px; }
.vd-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background .12s;
}
.vd-file:hover { background: rgba(108, 92, 231, .08); }
.vd-file-info { flex: 1; min-width: 0; }
.vd-file-info .vd-item-title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vd-file-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.vd-act {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(108, 92, 231, .10);
  color: var(--primary);
  font-size: 15px;
  line-height: 1;
  transition: background .15s, color .15s, transform .15s;
}
.vd-act svg { width: 14px; height: 14px; }
.vd-act:hover { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; transform: scale(1.06); }

/* 聊天区文件胶囊（对话框1） */
.chat-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(245, 158, 11, .30);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.chat-file-chip:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 10px 22px rgba(245, 158, 11, .42); }
.cfi-icon { font-size: 14px; }
.cfi-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 全屏模式浮层适配 */
.in-fullscreen .modal-mask { position: absolute; inset: 0; }
.in-fullscreen .text-toolbar { position: absolute; }
.in-fullscreen .file-popup { position: absolute; }
.fs-region-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(30, 34, 58, .45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  color: var(--text-2);
  text-align: center;
  padding: 24px;
}
.empty-state svg { width: 60px; height: 60px; opacity: .35; }
.empty-state .tip { font-size: 14.5px; }
.empty-state .sub-tip { font-size: 12.5px; opacity: .8; }

/* 主展示区功能浮窗 */
.stage-fn-panel {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: var(--shadow);
}
.fn-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .9);
  color: var(--text-2);
  transition: background .15s, color .15s, transform .15s;
}
.fn-btn:hover { color: var(--primary); transform: translateY(-1px); }
.fn-btn.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.fn-btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.fn-btn[hidden] { display: none; }
.sel-exit {
  position: absolute;
  top: 14px; right: 16px;
  z-index: 25;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 18px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px rgba(108, 92, 231, .36);
  transition: transform .15s, box-shadow .15s;
}
.sel-exit:hover { transform: scale(1.1); box-shadow: 0 10px 22px rgba(108, 92, 231, .46); }
.sel-exit[hidden] { display: none; }
.slides-stage.mode-select #mainFrame { cursor: crosshair; }

/* AI 返回结果的版本超链接 */
.version-link {
  display: block;
  margin-top: 9px;
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  opacity: .9;
}
.version-link:hover { text-decoration: underline; opacity: 1; }

/* 文字编辑浮窗 */
.text-toolbar {
  position: fixed;
  z-index: 260;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: var(--shadow-lg);
}
.text-toolbar select, .text-toolbar input[type="color"] {
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 8px;
  background: rgba(255, 255, 255, .85);
  font-size: 12px;
  padding: 4px 6px;
  outline: none;
}
.text-toolbar input[type="color"] { width: 30px; height: 28px; padding: 2px; cursor: pointer; }
.tb-btn {
  width: 30px; height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(120, 130, 170, .22);
  background: rgba(255, 255, 255, .85);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  transition: background .12s, color .12s;
}
.tb-btn:hover { background: rgba(108, 92, 231, .10); color: var(--primary); }
.tb-btn.on { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }

/* 文件库 */
.lib-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.lib-wrap {
  display: flex;
  gap: 14px;
  min-height: 260px;
  max-height: 420px;
}
.lib-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 108px;
  flex-shrink: 0;
  border-right: 1px solid rgba(120, 130, 170, .14);
  padding-right: 12px;
}
.lib-tab {
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-2);
  text-align: left;
  transition: background .15s, color .15s;
}
.lib-tab:hover { background: rgba(108, 92, 231, .08); color: var(--primary); }
.lib-tab.active { background: rgba(108, 92, 231, .12); color: var(--primary); font-weight: 600; }
.lib-right {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.lib-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid rgba(120, 130, 170, .16);
  background: rgba(255, 255, 255, .7);
  text-align: left;
  transition: border-color .15s, background .15s, transform .15s;
}
.lib-item:hover { border-color: var(--primary); background: rgba(108, 92, 231, .06); transform: translateY(-1px); }
.lib-item.static { cursor: default; }
.lib-item.static:hover { border-color: rgba(120, 130, 170, .16); background: rgba(255, 255, 255, .7); transform: none; }
.lib-item-title { font-size: 13.5px; font-weight: 600; }
.lib-item-sub { font-size: 12px; color: var(--text-2); }
.lib-empty { color: var(--text-2); font-size: 13px; padding: 40px 0; text-align: center; }

/* 缩略图区 */
.thumb-strip {
  min-height: 120px;
  padding: 8px 22px 22px;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  flex-shrink: 0;
  align-items: flex-start;
}
.thumb {
  width: 168px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, .68);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(45, 52, 95, .08);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.thumb:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(45, 52, 95, .14); }
.thumb.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .18), 0 12px 26px rgba(45, 52, 95, .14); }
.thumb .thumb-frame { width: 168px; height: 94.5px; position: relative; overflow: hidden; }
.thumb iframe {
  position: absolute; top: 0; left: 0;
  width: 960px; height: 540px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
}
.thumb .thumb-num {
  position: absolute;
  left: 7px; top: 7px;
  background: rgba(30, 34, 58, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  width: 21px; height: 21px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.thumb.add-page {
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 24px;
  border: 2px dashed rgba(108, 92, 231, .45);
  background: rgba(255, 255, 255, .35);
  box-shadow: none;
}
.thumb.add-page:hover { border-color: var(--primary); background: rgba(108, 92, 231, .08); }

/* ---------------- 设置页 ---------------- */
.settings-main { max-width: 720px; margin: 44px auto 80px; padding: 0 20px; }
.settings-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 22px;
}
.back-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(120, 130, 170, .22);
  color: var(--text-2);
  font-size: 13.5px;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.back-pill:hover { background: rgba(108, 92, 231, .08); color: var(--primary); border-color: rgba(108, 92, 231, .28); }
.auth-logo-img { width: 36px; height: 36px; object-fit: contain; }
.settings-card {
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 36px;
}
.settings-card h2 { font-size: 18px; margin-bottom: 6px; }
.settings-card .hint { color: var(--text-2); font-size: 13px; margin-bottom: 26px; line-height: 1.7; }
.settings-card .small-hint { margin-top: 8px; font-size: 12px; margin-bottom: 0; }
.form-group { margin-bottom: 22px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 8px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-group input, .form-group textarea {
  width: 100%;
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 14px;
  background: rgba(255, 255, 255, .78);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .12); }
.form-group textarea { resize: vertical; min-height: 100px; line-height: 1.7; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.settings-actions { display: flex; gap: 12px; margin-top: 10px; }
.prompts-viewer {
  margin-top: 30px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 16px;
  background: rgba(120, 130, 170, .07);
  padding: 14px 18px;
}
.prompts-viewer summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  list-style: none;
}
.prompts-viewer summary::before { content: '▸ '; color: var(--primary); }
.prompts-viewer[open] summary::before { content: '▾ '; }
.prompts-content { margin-top: 14px; display: flex; flex-direction: column; gap: 16px; }
.prompts-loading { color: var(--text-2); font-size: 13px; padding: 8px 0; }
.prompts-loading.error { color: var(--danger); }
.prompt-block-title { font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.prompt-pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(120, 130, 170, .16);
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.7;
  color: #374151;
  max-height: 340px;
  overflow-y: auto;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
.test-result {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 13px;
  display: none;
}
.test-result.ok { display: block; background: rgba(16, 185, 129, .12); color: #047857; }
.test-result.fail { display: block; background: var(--danger-light); color: var(--danger); }
.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-2); font-size: 13.5px;
  margin-bottom: 20px;
  padding: 7px 10px;
  border-radius: 9px;
  transition: background .15s, color .15s;
}
.back-link:hover { background: rgba(108, 92, 231, .10); color: var(--primary); }

/* ---------------- 管理后台 ---------------- */
.admin-main { max-width: 1280px; margin: 40px auto 80px; padding: 0 24px; }
.admin-main .back-btn { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 14px; padding: 8px 10px; border-radius: 10px; transition: background .15s, color .15s; }
.admin-main .back-btn:hover { background: rgba(108, 92, 231, .10); color: var(--primary); }
.admin-layout { display: flex; gap: 22px; align-items: flex-start; }
.admin-side {
  width: 178px;
  flex-shrink: 0;
  position: sticky;
  top: 88px;
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-side-title { font-size: 13px; font-weight: 700; color: var(--text); padding: 6px 10px 10px; }
.admin-nav {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  text-align: left;
  transition: background .15s, color .15s;
}
.admin-nav:hover { background: rgba(108, 92, 231, .08); color: var(--primary); }
.admin-nav.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 6px 14px rgba(108, 92, 231, .28); }
.admin-content { flex: 1; min-width: 0; }
.admin-loading { color: var(--text-2); padding: 60px 0; text-align: center; }
.view-title { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.admin-stats { display: flex; gap: 20px; margin-bottom: 26px; }
.stat-card {
  flex: 1;
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px 26px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-num {
  font-size: 30px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.admin-card {
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
  overflow-x: auto;
}
.admin-card-title { font-size: 16px; font-weight: 600; margin-bottom: 18px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left;
  color: var(--text-2);
  font-weight: 500;
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(120, 130, 170, .16);
  letter-spacing: .3px;
}
.admin-table td { padding: 13px 12px; border-bottom: 1px solid rgba(120, 130, 170, .10); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: rgba(108, 92, 231, .05); }
.admin-table .u-name { font-weight: 500; }
.role-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 22px;
  font-size: 12px;
  background: rgba(120, 130, 170, .12);
  color: var(--text-2);
}
.role-badge.admin { background: rgba(251, 191, 36, .20); color: #b45309; }
.admin-empty { color: var(--text-2); text-align: center; padding: 34px; font-size: 13px; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.role-select {
  font-size: 12.5px;
  padding: 5px 8px;
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 8px;
  background: rgba(255, 255, 255, .85);
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.role-select:focus { border-color: var(--primary); }
.role-select:disabled { opacity: .55; cursor: not-allowed; }
.cell-ellipsis { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-btn {
  font-size: 12.5px;
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 7px;
  transition: background .15s;
}
.link-btn:hover { background: rgba(108, 92, 231, .10); }
.link-btn:disabled { opacity: .4; cursor: not-allowed; }
.prompt-cell { white-space: pre-wrap; word-break: break-word; font-size: 12.5px; line-height: 1.6; color: #374151; }
.pagination { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.page-info { font-size: 12.5px; color: var(--text-2); }
.gen-detail-meta { font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; }
.gen-detail-block { margin-bottom: 14px; }
.gen-detail-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.gen-pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(120, 130, 170, .07);
  border: 1px solid rgba(120, 130, 170, .16);
  border-radius: 10px;
  padding: 12px;
  font-size: 12.5px;
  line-height: 1.7;
  max-height: 220px;
  overflow-y: auto;
}
.gen-frame {
  width: 100%;
  height: 300px;
  border: 1px solid rgba(120, 130, 170, .18);
  border-radius: 10px;
  background: #fff;
}
.prompt-edit-area {
  width: 100%;
  min-height: 260px;
  border: 1px solid rgba(120, 130, 170, .22);
  border-radius: 11px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
  background: rgba(255, 255, 255, .85);
  outline: none;
  resize: vertical;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
.prompt-edit-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .12); }
.custom-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: #b45309;
  background: rgba(251, 191, 36, .18);
  border-radius: 6px;
  padding: 1px 7px;
}
.dim { color: var(--text-2); opacity: .6; }
.gen-deck-card { margin-bottom: 16px; }
.gen-deck-line { font-size: 13px; color: var(--text-2); padding: 3px 0; }
.gen-deck-line b { color: var(--text); }
.gen-record-card {
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.gen-record-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.gen-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
}
.gen-badge.first { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.gen-badge.edit { background: linear-gradient(135deg, #f59e0b, #f97316); }
.gen-record-meta { font-size: 12px; color: var(--text-2); flex: 1; }
.gen-params { margin-bottom: 12px; }
.gen-params-table { width: auto; min-width: 320px; max-width: 100%; }
.gen-params-table td { padding: 6px 12px; font-size: 12.5px; border-bottom: 1px solid rgba(120, 130, 170, .10); }
.gen-params-table .pk { color: var(--text-2); width: 110px; white-space: nowrap; }
.gen-out-wrap { margin-top: 8px; }
#backDetail { font-size: 13.5px; margin-right: 8px; padding: 6px 10px; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(120, 130, 170, .32); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 130, 170, .5); }
::-webkit-scrollbar-track { background: transparent; }

/* ---- 4.8 播放器（首页全屏播放） ---- */
.player-mask {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(10, 13, 23, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .18s ease;
}
.player-mask[hidden] { display: none; }
.player-stage {
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  border-radius: 8px;
  overflow: hidden;
}
.player-stage iframe { width: 100%; height: 100%; border: 0; display: block; }
.player-close {
  position: absolute;
  top: 18px; right: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
}
.player-close:hover { background: rgba(255, 255, 255, .26); transform: scale(1.06); }
.player-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
}
.player-nav:hover { background: rgba(255, 255, 255, .24); transform: translateY(-50%) scale(1.06); }
.player-nav.left { left: 20px; }
.player-nav.right { right: 20px; }
.player-num {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .85);
  font-size: 13px;
  background: rgba(255, 255, 255, .12);
  padding: 5px 14px;
  border-radius: 999px;
}
.no-scroll { overflow: hidden; }

/* 功能页标题可点击重命名 */
.deck-title { cursor: pointer; transition: color .15s; }
.deck-title:hover { color: var(--primary); }

/* ============================================================
   设计规范统一（4.8 样式收敛）
   统一：圆角 / 内边距 / 字体 / 阴影 / 聚焦态 / 玻璃表面
   ============================================================ */
:root {
  --surface: rgba(255, 255, 255, .72);
  --surface-strong: rgba(255, 255, 255, .9);
  --surface-soft: rgba(255, 255, 255, .55);
  --border-strong: rgba(120, 130, 170, .28);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-card: 20px;
  --radius-full: 999px;
  --shadow-sm: 0 2px 8px rgba(45, 52, 95, .06);
  --shadow-md: 0 10px 30px rgba(45, 52, 95, .08);
  --shadow-lg: 0 20px 56px rgba(45, 52, 95, .16);
  --blur: 18px;
  --focus-ring: 0 0 0 3px rgba(108, 92, 231, .12);
  --font-xs: 12px;
  --font-sm: 12.5px;
  --font-md: 13px;
  --font-base: 13.5px;
  --font-lg: 14px;
  --font-xl: 16px;
}

/* ---- 按钮 ---- */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: var(--font-base);
  font-weight: 500;
  transition: background .18s, transform .18s, box-shadow .18s, color .18s;
}
.btn-primary, .btn-danger { box-shadow: 0 6px 16px rgba(108, 92, 231, .22); }
.btn-primary:hover, .btn-danger:hover { transform: translateY(-1px); }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, .7);
}
.btn-send { width: 34px; height: 34px; border-radius: 11px; }
.link-btn { font-size: var(--font-sm); }
.back-pill, .params-trigger { border-radius: var(--radius-full); }

/* ---- 表单控件 ---- */
.form-group input, .form-group textarea, .form-group select,
.modal input, .modal input[type="text"], .modal input[type="password"], .modal input[type="number"],
.p-popup select, .p-popup .custom-pages, .pp-row select, .pp-inline select,
.text-toolbar select, .text-toolbar input[type="color"] {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: var(--font-md);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus,
.modal input:focus, .p-popup select:focus, .p-popup .custom-pages:focus,
.pp-row select:focus, .pp-inline select:focus, .text-toolbar select:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.form-group label, .pp-row label, .p-popup label { font-size: var(--font-sm); font-weight: 500; }
/* 参数行紧凑场景：统一圆角与聚焦态，保持紧凑尺寸 */
.param-panel select, .custom-pages {
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  transition: border-color .15s, box-shadow .15s;
}
.param-panel select:focus, .custom-pages:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, .10);
}

/* ---- 卡片 ---- */
.deck-card, .settings-card, .admin-card, .gen-box, .auth-card, .lib-item {
  border-radius: var(--radius-card);
  border: 1px solid rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-md);
}
.stat-card, .admin-side { border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }

/* ---- 弹窗 / 浮层 ---- */
.modal, .upload-prompt, .p-popup, .params-popup { border-radius: var(--radius-card); }
.more-menu, .at-popup, .user-menu, .version-drop, .text-toolbar, .file-popup { border-radius: var(--radius-xl); }
.modal, .more-menu, .at-popup, .user-menu, .version-drop, .p-popup,
.params-popup, .upload-prompt, .text-toolbar, .file-popup {
  background: var(--surface-strong);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: var(--shadow-lg);
}
.modal { padding: 24px; }

/* ---- 徽章 / 胶囊 ---- */
.at-chip, .user-chip, .role-badge, .custom-badge, .gen-badge, .version-badge,
.file-info, .chat-file-chip {
  border-radius: var(--radius-full);
  font-size: var(--font-sm);
}

/* ---- 提示 / 状态 ---- */
.toast { border-radius: 12px; font-size: var(--font-base); }
.test-result, .auth-msg { border-radius: var(--radius-md); font-size: var(--font-md); }
.empty-state, .admin-empty, .lib-empty, .vd-empty {
  font-size: var(--font-md);
  color: var(--text-2);
}

/* ---- 表格 ---- */
.admin-table th { padding: 10px 12px; font-size: var(--font-xs); }
.admin-table td { padding: 12px; font-size: var(--font-md); }

/* ---- 滚动条 ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120, 130, 170, .32); border-radius: 8px; }
