/* ============================================================
   江小鱼白板 · 界面样式
   ============================================================ */
:root {
  --bg: #1b1f26;
  --bar: linear-gradient(180deg, #23272e 0%, #1b1f26 100%);
  --panel: #242931;
  --panel-2: #1f242b;
  --border: #3a4150;
  --btn: #333a46;
  --btn-hover: #424b5b;
  --text: #e9ecf1;
  --muted: #97a1b1;
  --accent: #ffb020;
  --accent-soft: rgba(255, 176, 32, .16);
  --accent-text: #1b1f26;
  --shadow: 0 12px 34px rgba(0, 0, 0, .38);
  --radius: 10px;
}
body[data-theme="ocean"] {
  --bg: #0b1f2b; --bar: linear-gradient(180deg, #123143 0%, #0b1f2b 100%);
  --panel: #12303f; --panel-2: #0e2733; --border: #1e4b60; --btn: #17405a; --btn-hover: #1f506e;
  --text: #dff3ff; --muted: #8fb4c8; --accent: #2fd4ff; --accent-soft: rgba(47, 212, 255, .16); --accent-text: #06202b;
}
body[data-theme="forest"] {
  --bg: #0f231b; --bar: linear-gradient(180deg, #173229 0%, #0f231b 100%);
  --panel: #173229; --panel-2: #10251d; --border: #2f5343; --btn: #1e3d31; --btn-hover: #285043;
  --text: #e2f2e9; --muted: #93b6a4; --accent: #51cf66; --accent-soft: rgba(81, 207, 102, .16); --accent-text: #0b1f16;
}
body[data-theme="grape"] {
  --bg: #17123a; --bar: linear-gradient(180deg, #241c52 0%, #17123a 100%);
  --panel: #241c52; --panel-2: #1a1440; --border: #3d3370; --btn: #2c2460; --btn-hover: #382d74;
  --text: #e6e2ff; --muted: #a79fd6; --accent: #b197fc; --accent-soft: rgba(177, 151, 252, .18); --accent-text: #17123a;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
svg { width: 100%; height: 100%; }

/* ---------- 通用按钮 ---------- */
.primary-btn {
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 9px; height: 42px; padding: 0 18px;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: .16s;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; }
.ghost-btn {
  background: var(--btn); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; height: 40px; padding: 0 14px; font-size: 13px; cursor: pointer; transition: .16s;
}
.ghost-btn:hover { background: var(--btn-hover); }
.ghost-btn:disabled { opacity: .55; cursor: not-allowed; }
.mini-btn {
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
  border-radius: 8px; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.mini-btn:hover { border-color: var(--accent); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; padding: 8px; transition: .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--btn); color: var(--text); }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }

/* ============================================================
   登录
   ============================================================ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 85;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 24px; overflow: auto;
  background: linear-gradient(180deg, rgba(16, 20, 26, .46) 0%, rgba(12, 15, 20, .58) 100%);
  backdrop-filter: blur(2px);
}
.auth-overlay .login-card { animation: popIn .18s ease-out; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.auth-close {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: #8a94a4;
  font-size: 13px; line-height: 1; cursor: pointer; transition: .14s;
}
.auth-close:hover { background: rgba(255, 255, 255, .07); color: #dfe5ee; border-color: #3d4553; }
.login-glow {
  position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 32, .12), transparent 66%);
  filter: blur(10px); top: -220px; right: -140px; pointer-events: none;
}
.login-card {
  position: relative; width: 100%; max-width: 396px; background: rgba(32, 37, 45, .96);
  border: 1px solid #39404e; border-radius: 18px; padding: 28px 26px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55); backdrop-filter: blur(14px);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.logo-mark {
  width: 52px; height: 52px; border-radius: 14px; padding: 9px; flex: none;
  background: linear-gradient(160deg, #ffc44d, #ff9f1a); color: #2a1d05;
  box-shadow: 0 8px 22px rgba(255, 159, 26, .3);
}
.login-brand h1 { font-size: 21px; letter-spacing: .5px; }
.login-brand p { color: #8e99a9; font-size: 12.5px; margin-top: 5px; }

.login-tabs { display: flex; gap: 6px; background: #1b1f26; border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.ltab {
  flex: 1; height: 34px; border: 0; border-radius: 8px; background: transparent;
  color: #97a1b1; font-size: 13.5px; cursor: pointer; transition: .16s;
}
.ltab.active { background: #313846; color: #fff; font-weight: 700; }

.field { display: block; margin-bottom: 6px; }
.field > span { display: block; font-size: 12px; color: #8e99a9; margin: 0 0 7px 2px; }
.field input {
  width: 100%; height: 44px; border-radius: 9px; border: 1px solid #3b4350;
  background: #1b2028; padding: 0 13px; font-size: 14.5px; outline: none; transition: .16s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 176, 32, .13); }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row .ghost-btn { height: 44px; flex: none; min-width: 104px; }
.field-error { color: #ff8080; font-size: 12px; min-height: 16px; margin: 2px 2px 3px; }
.login-error { color: #ff8080; font-size: 12.5px; min-height: 18px; margin: 4px 2px 8px; }
#loginForm .primary-btn { width: 100%; margin-top: 2px; }
.login-tip { color: #7d8797; font-size: 11.5px; line-height: 1.6; margin-top: 12px; }
.login-foot { color: #5d6878; font-size: 11.5px; }

/* 微信登录 */
.login-or {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 12px; color: #6b7585; font-size: 11.5px;
}
.login-or::before, .login-or::after {
  content: ''; flex: 1; height: 1px; background: #39404e;
}
.wechat-btn {
  width: 100%; height: 44px; display: flex; align-items: center; justify-content: center; gap: 9px;
  border: 0; border-radius: 9px; cursor: pointer; font-size: 14.5px; font-weight: 700;
  color: #fff; background: #07c160; box-shadow: 0 6px 18px rgba(7, 193, 96, .22);
  transition: .16s;
}
.wechat-btn svg { width: 20px; height: 20px; flex: none; }
.wechat-btn:hover { background: #06ad56; }
.wechat-btn:active { transform: translateY(1px); }
.wechat-btn:disabled { opacity: .6; cursor: not-allowed; }
.login-wechat-tip { color: #7d8797; font-size: 11.5px; margin-top: 9px; text-align: center; }

/* 等待授权 */
.gate-card {
  position: relative; width: 100%; max-width: 430px; text-align: center;
  background: rgba(35, 40, 48, .95); border: 1px solid #39404e; border-radius: 18px;
  padding: 34px 28px 26px; box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.gate-badge {
  width: 58px; height: 58px; border-radius: 17px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center; font-size: 27px;
  background: rgba(255, 176, 32, .14); border: 1px solid rgba(255, 176, 32, .28);
}
.gate-card h2 { font-size: 19px; letter-spacing: .3px; margin-bottom: 10px; }
.gate-text { color: var(--muted); font-size: 13px; line-height: 1.8; }
.gate-text b { color: var(--text); }
.gate-acts { display: flex; gap: 10px; margin-top: 22px; }
.gate-acts > * { flex: 1; }
.gate-tip { color: #7d8797; font-size: 11.5px; margin-top: 14px; line-height: 1.6; }

/* 成员管理 */
.member-mask {
  position: fixed; inset: 0; z-index: 95; padding: 18px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 13, 18, .66); backdrop-filter: blur(4px);
}
.member-box {
  width: 100%; max-width: 560px; max-height: 78vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); overflow: hidden;
}
.member-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px 13px 16px; border-bottom: 1px solid var(--border); flex: none;
}
.member-head h3 { font-size: 15px; letter-spacing: .3px; }
.member-head-acts { display: flex; align-items: center; gap: 8px; }
.member-head-acts .icon-btn { width: 28px; height: 28px; padding: 6px; }
.member-sum { padding: 10px 16px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); flex: none; }
.member-list { flex: 1; overflow-y: auto; padding: 6px 8px 10px; }
.member-sec { padding: 12px 8px 4px; font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; }
.member-row:hover { background: var(--panel-2); }
.member-ava {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; background: var(--btn); color: var(--text);
}
.member-meta { flex: 1; min-width: 0; }
.member-name { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.member-name .tag-admin {
  font-size: 10px; padding: 1px 6px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(255, 176, 32, .35);
}
.member-sub {
  font-size: 11px; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member-acts { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; max-width: 210px; }
.member-acts button {
  height: 26px; padding: 0 9px; border-radius: 7px; font-size: 11.5px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  transition: .14s; white-space: nowrap;
}
.member-acts button:hover { border-color: var(--muted); }
.member-acts button.ok { background: rgba(47, 158, 68, .18); border-color: rgba(47, 158, 68, .5); color: #69db7c; }
.member-acts button.warn { background: rgba(255, 107, 107, .14); border-color: rgba(255, 107, 107, .42); color: #ffa8a8; }
.member-acts button:disabled { opacity: .45; cursor: not-allowed; }
.member-empty { text-align: center; color: var(--muted); font-size: 12px; padding: 28px 10px; line-height: 1.8; }
.member-foot {
  padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted); line-height: 1.6; flex: none;
}

/* 微信回调处理中的遮罩 */
.auth-busy {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  gap: 12px; background: rgba(16, 19, 24, .82); color: #e9edf3; font-size: 14px;
  backdrop-filter: blur(3px);
}
.auth-busy .spin {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255, 255, 255, .25); border-top-color: #ffb020;
  animation: authSpin .8s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* ============================================================
   应用骨架
   ============================================================ */
.app {
  height: 100vh; display: grid; grid-template-rows: 54px 1fr 62px;
  position: relative; background: var(--bg);
}
/* 未登录 / 未授权：主页照常渲染，但不可交互（登录卡覆盖其上） */
.app.locked { pointer-events: none; }
.topbar { grid-row: 1; }
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px;
  background: var(--bar); border-bottom: 1px solid var(--border); z-index: 40;
}
.brand { display: flex; align-items: center; gap: 7px; padding: 0 4px; flex: none; }
.brand b { font-size: 14px; letter-spacing: .4px; white-space: nowrap; }
.logo-mini { width: 24px; height: 24px; color: var(--accent); display: inline-block; }
.title-input {
  min-width: 120px; max-width: 320px; width: 220px; height: 32px;
  background: transparent; border: 1px solid transparent; border-radius: 7px;
  padding: 0 9px; font-size: 13.5px; color: var(--text); outline: none; transition: .15s;
}
.title-input:hover { border-color: var(--border); }
.title-input:focus { border-color: var(--accent); background: var(--panel-2); }
.save-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 20px; background: var(--panel-2); border: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted); flex: none; white-space: nowrap;
}
.save-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #51cf66; }
.save-chip.saving .dot { background: var(--accent); animation: pulse 1s infinite; }
.save-chip.error { color: #ff8f8f; }
.save-chip.error .dot { background: #ff6b6b; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.topbar-spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 5px;
  border-radius: 18px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12.5px;
}
.user-chip .avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px;
  background-size: cover; background-position: center; flex: none;
}
.user-chip .avatar.has-img { color: transparent; }
.user-chip .uname { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

/* 顶栏登录入口（未登录时显示） */
.login-entry {
  height: 32px; padding: 0 16px; border-radius: 16px; cursor: pointer;
  border: 1px solid rgba(255, 176, 32, .5); background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
  transition: .15s;
}
.login-entry:hover { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* 未登录：主页可见但不可操作，仅顶栏登录入口与主题按钮可点 */
.app.locked #btnLoginEntry, .app.locked #btnTheme { pointer-events: auto; }
.app.locked .toolbar { opacity: .5; }

/* ---------- 底部工具栏 ---------- */
.toolbar {
  grid-row: 3;
  display: flex; align-items: stretch; padding: 0 10px;
  background: var(--bar); border-top: 1px solid var(--border);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; z-index: 35;
}
.toolbar::-webkit-scrollbar { display: none; }
/* 内层用 margin:auto 实现居中：放得下时居中，放不下时退回左对齐并可横向滚动，
   避免 flex 居中在窄屏把最左侧的「上传」「目录」裁到不可见区域 */
.toolbar-inner {
  display: flex; align-items: center; gap: 2px;
  flex: 0 0 auto; margin: 0 auto; padding: 0;
}
.tbtn {
  flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; height: 48px; min-width: 50px; padding: 5px 6px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  font-size: 10.5px; cursor: pointer; transition: .14s;
}
.tbtn svg { width: 19px; height: 19px; }
/* 画笔 / 激光笔 / 荧光笔：底部当前色标识条 */
.tbtn.has-color { gap: 2px; padding: 4px 6px 5px; }
.tbtn .tool-color {
  width: 22px; height: 3px; border-radius: 2px; background: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); flex: none;
}
/* 全屏按钮：默认显示「进入全屏」图标，全屏态切换为「退出全屏」 */
#btnFullscreen .fs-out { display: none; }
#btnFullscreen.is-fs .fs-in { display: none; }
#btnFullscreen.is-fs .fs-out { display: block; }
#btnFullscreen.is-fs { background: var(--accent-soft); color: var(--accent); border-color: rgba(255, 176, 32, .35); }
.tbtn:hover { background: var(--btn); color: var(--text); }
.tbtn.active {
  background: var(--accent-soft); color: var(--accent); border-color: rgba(255, 176, 32, .35);
  box-shadow: 0 -2px 0 rgba(255, 176, 32, .55) inset;
}
.tsep { flex: none; width: 1px; height: 30px; background: var(--border); margin: 0 5px; }

/* ---------- 目录树面板 ---------- */
.lib-panel {
  position: absolute; top: 54px; left: 0; bottom: 62px; width: 300px; z-index: 30;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transform: translateX(calc(-100% - 16px));
  transition: transform .22s cubic-bezier(.2, .8, .3, 1); box-shadow: var(--shadow);
}
.lib-panel.open { transform: translateX(0); }
/* 右缘把手：点一下向左收起 */
.lib-handle {
  position: absolute; right: -15px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 56px; padding: 0;
  border: 1px solid var(--border); border-left: 0; border-radius: 0 9px 9px 0;
  background: var(--panel); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.lib-handle svg { width: 11px; height: 11px; }
.lib-handle:hover { color: var(--accent); background: var(--panel-2); }
.mini-btn.x svg { width: 13px; height: 13px; display: block; }
.lib-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 10px 9px 13px; border-bottom: 1px solid var(--border); flex: none;
}
.lib-head b { font-size: 13.5px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.dir-ico { font-size: 14px; }
.lib-head-acts { display: flex; gap: 5px; align-items: center; }
.mini-btn {
  height: 26px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted); font-size: 11.5px; cursor: pointer;
  white-space: nowrap; transition: .14s;
}
.mini-btn:hover { color: var(--text); border-color: var(--muted); }
.mini-btn.hl { background: var(--accent-soft); color: var(--accent); border-color: rgba(255, 176, 32, .4); }
.mini-btn.x { padding: 0 7px; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.mini-btn.wide { flex: 1; }
.lib-sec {
  padding: 9px 13px 4px; font-size: 11px; color: var(--muted);
  letter-spacing: .6px; text-transform: uppercase; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.mini-btn.xs { height: 20px; padding: 0 7px; font-size: 12px; line-height: 1; border-radius: 6px; }
.lib-list { flex: 1; overflow-y: auto; padding: 2px 8px 10px; }

/* 目录行 */
.dir-row {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px;
  border-radius: 8px; cursor: pointer; font-size: 12.8px; color: var(--text);
  position: relative; user-select: none;
}
.dir-row:hover { background: var(--panel-2); }
.dir-row.sel { background: var(--accent-soft); }
.dir-row.canvas { height: 42px; }
.dir-row .dr-ico { width: 16px; flex: none; text-align: center; font-size: 13px; }
.dir-row.canvas .dr-thumb {
  width: 34px; height: 24px; flex: none; border-radius: 4px; overflow: hidden;
  background: #fff; border: 1px solid var(--border);
}
.dir-row.canvas .dr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dir-row .dr-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dir-row.canvas .dr-name { font-size: 12.6px; }
.dir-row .dr-meta { font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.dir-row .dr-caret {
  width: 16px; flex: none; text-align: center; font-size: 10px; color: var(--muted);
  transition: transform .15s;
}
.dir-row .dr-caret.open { transform: rotate(90deg); }
.dir-row .dr-menu {
  width: 22px; height: 22px; flex: none; border: 0; border-radius: 5px; background: transparent;
  color: var(--muted); cursor: pointer; opacity: 0; font-size: 14px; line-height: 1;
}
.dir-row:hover .dr-menu { opacity: 1; }
.dir-row .dr-menu:hover { background: var(--btn); color: var(--text); }
.dir-row .dr-badge {
  font-size: 9.5px; padding: 1px 5px; border-radius: 4px; flex: none;
  background: var(--accent-soft); color: var(--accent);
}
.dir-empty { text-align: center; color: var(--muted); font-size: 12px; line-height: 1.9; padding: 30px 10px; }
.dir-empty .mini-btn { margin-top: 10px; }

.lib-foot { padding: 9px 12px 11px; border-top: 1px solid var(--border); flex: none; }
.dir-cur { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-cur b { color: var(--text); }
.dir-acts { display: flex; gap: 6px; margin-bottom: 8px; }
.dir-hint { font-size: 10.8px; color: var(--muted); line-height: 1.65; }

/* ---------- 画布 ---------- */
.stage { grid-row: 2; position: relative; overflow: hidden; background: var(--bg); touch-action: none; }
#mainCanvas, #overlayCanvas { position: absolute; inset: 0; display: block; touch-action: none; }
#overlayCanvas { pointer-events: none; }

/* ---------- 右下角 GIF 卡片（工具栏「广告」总开关控制，默认开启） ----------
   透明底（不挡画布）+ 图片底部渐变压暗条 + 标题栏 */
.ad-card {
  position: absolute; right: 14px; bottom: 14px; z-index: 14;
  width: 168px; border-radius: 12px; overflow: hidden;
  background: transparent; border: 0;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .38));
  transition: opacity .22s, transform .22s;
  user-select: none;
}
.ad-card.hidden { display: none !important; }
.ad-card.is-swap { opacity: 0; transform: translateY(4px); }
.ad-gif { display: block; width: 100%; height: auto; border-radius: 12px; background: transparent; }
/* 底部渐变压暗条 */
.ad-shade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 52%; min-height: 46px;
  background: linear-gradient(to top,
    rgba(0, 0, 0, .80) 0%,
    rgba(0, 0, 0, .52) 38%,
    rgba(0, 0, 0, .16) 72%,
    rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}
.ad-x {
  position: absolute; right: 5px; top: 5px; width: 18px; height: 18px; padding: 0;
  border: 0; border-radius: 50%; font-size: 10px; line-height: 1; cursor: pointer;
  color: #e8eef8; background: rgba(8, 10, 14, .55); opacity: 0; transition: opacity .16s, background .16s;
}
.ad-card:hover .ad-x { opacity: 1; }
.ad-x:hover { background: rgba(214, 62, 62, .9); color: #fff; }
@media (max-width: 760px) {
  .ad-card { width: 118px; right: 10px; bottom: 10px; }
}
.empty-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: #9aa4b3; font-size: 13px; background: rgba(27, 31, 38, .82);
  border: 1px dashed rgba(150, 165, 185, .4); padding: 10px 18px; border-radius: 30px;
  pointer-events: none; transition: opacity .3s;
}
.empty-hint.hidden { opacity: 0; }

.wb-text-input {
  position: absolute; z-index: 20; resize: none; overflow: hidden;
  background: rgba(255, 255, 255, .06); border: 1px dashed var(--accent);
  border-radius: 4px; padding: 2px 4px; outline: none; font-weight: 600;
  white-space: pre; min-height: 1.4em;
}

/* 工具栏内的翻页 / 缩放组（原画布浮条移入底部工具栏） */
.tgroup {
  flex: none; display: flex; align-items: center; gap: 1px;
  padding: 0 3px;
}
.pb-btn {
  height: 32px; min-width: 28px; padding: 0 5px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; font-size: 14px;
}
.pb-btn svg { width: 16px; height: 16px; }
.pb-btn:hover { background: var(--btn); }
.pb-btn.wide { font-size: 11px; padding: 0 8px; color: var(--muted); }
.page-ind { font-size: 11.5px; color: var(--muted); min-width: 42px; text-align: center; }
.pb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }
.zoom-val { min-width: 46px; height: 32px; border: 0; background: transparent; color: var(--text); font-size: 12px; cursor: pointer; border-radius: 8px; }
.zoom-val:hover { background: var(--btn); }

/* ---------- 属性面板（紧凑版：粘顶标题 + 细分隔线 + 一体式分段控件） ---------- */
.style-panel {
  position: absolute; top: 12px; right: 14px; width: 228px; z-index: 15;
  padding: 0 0 10px; max-height: calc(100% - 56px); overflow-y: auto;
  background: linear-gradient(180deg, rgba(44, 50, 60, .98), rgba(31, 36, 44, .98));
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .46), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(12px); scrollbar-width: thin;
}
.style-panel::-webkit-scrollbar { width: 6px; }
.style-panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 3px; }

/* 标题栏：吸顶，金色竖条 + 标题 + 关闭 */
.sp-head {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 7px;
  padding: 9px 8px 9px 11px;
  background: linear-gradient(180deg, rgba(53, 60, 71, .99), rgba(44, 50, 60, .97));
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.sp-head::before {
  content: ''; width: 3px; height: 13px; border-radius: 2px; flex: none;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.sp-head b { flex: 1; font-size: 12.5px; font-weight: 700; letter-spacing: .4px; }
.sp-close {
  width: 22px; height: 22px; flex: none; padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 11px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .15s;
}
.sp-close:hover { background: var(--btn); color: var(--text); }

/* 分组：细分隔线；首组与紧跟隐藏组的分组不留空线 */
.sp-sec { margin-top: 7px; padding: 7px 12px 0; border-top: 1px solid rgba(255, 255, 255, .06); }
.sp-head + .sp-sec, .sp-sec.hidden + .sp-sec { margin-top: 0; padding-top: 8px; border-top: 0; }
.sp-sec.hidden { display: none; }
/* 双列参数（粗细 + 透明度）：只有一个时自动占满整行 */
.sp-duo { display: flex; gap: 10px; }
.duo-item { flex: 1 1 0; min-width: 0; }
.duo-item.hidden { display: none; }
.sp-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px; color: var(--muted); margin-bottom: 5px;
}
.sp-label em {
  font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; background: var(--accent-soft);
  padding: 1px 6px; border-radius: 999px; line-height: 1.5;
}
/* 棱数行：标签 + 数值 + 加减微调按钮 */
#shapeNBar .sp-label > span {
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.n-step { display: flex; gap: 3px; flex: none; }
.n-step button {
  width: 22px; height: 20px; padding: 0; border-radius: 6px; cursor: pointer;
  font-size: 13px; line-height: 1; font-weight: 700;
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, .08); color: var(--text);
  display: flex; align-items: center; justify-content: center; transition: .13s;
}
.n-step button:hover:not(:disabled) { background: var(--btn-hover); border-color: var(--accent); color: var(--accent); }
.n-step button:disabled { opacity: .3; cursor: default; }
.sp-hint {
  font-size: 10.8px; line-height: 1.65; color: var(--muted);
  padding: 6px 8px; border-radius: 8px;
  background: rgba(255, 255, 255, .03); border-left: 2px solid var(--accent);
}

/* 选择工具：选中对象卡片（参照参考网页：序号 + 色点 + 名称 + 锁，纵向滚动列表） */
.sel-box {
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 10px;
  padding: 7px 7px 6px; margin-bottom: 6px;
  background: rgba(255, 255, 255, .03);
}
.sel-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 5px; }
.sel-head .t {
  display: flex; align-items: center; font-size: 11px; font-weight: 700;
  letter-spacing: .5px; color: var(--text);
}
.sel-head .t::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; margin-right: 5px; flex: none;
  background: var(--accent); box-shadow: 0 0 6px var(--accent);
}
.sel-head .c {
  font-size: 10px; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sel-list {
  display: flex; flex-direction: column; gap: 2px;
  /* 一屏 8 条（22px + 2px 间隙），超过 8 条时右侧出现滚动条 */
  max-height: 192px; overflow-y: auto; overflow-x: hidden;
  padding-right: 2px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.sel-list::-webkit-scrollbar { width: 6px; }
.sel-list::-webkit-scrollbar-track { background: transparent; }
.sel-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 3px; }
.sel-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .34); }
.sel-item {
  display: flex; align-items: center; gap: 6px; width: 100%; box-sizing: border-box;
  flex: 0 0 auto; height: 22px; min-height: 22px; padding: 0 6px; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  font-size: 11px; font-family: inherit; line-height: 1.4; text-align: left;
  cursor: pointer; white-space: nowrap; overflow: hidden; user-select: none; transition: .12s;
}
.sel-item:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: var(--text); }
.sel-item.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.sel-item.is-locked { opacity: .72; }
.sel-item .i {
  flex: none; min-width: 14px; font-size: 9.5px; opacity: .6;
  font-variant-numeric: tabular-nums;
}
.sel-item .dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(255, 255, 255, .28);
}
.sel-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-item .nm em { font-style: normal; font-size: 9.5px; opacity: .72; margin-left: 3px; }
.sel-item .lk { flex: none; font-size: 9.5px; opacity: .9; }
.sel-empty { font-size: 10.5px; color: var(--muted); line-height: 1.6; padding: 3px 2px; }
.sel-empty.hidden { display: none; }
.sel-tip { font-size: 10px; color: var(--muted); line-height: 1.55; margin: 0 1px 6px; }

/* 选择工具：操作按钮（等分紧凑芯片；.cols2 用于底部两个宽按钮） */
.sel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-bottom: 3px; }
.sel-grid.cols2 { grid-template-columns: 1fr 1fr; margin-bottom: 0; }
.sel-grid.cols2 + .sel-grid.cols2 { margin-top: 3px; }
.sel-grid button {
  height: 22px; padding: 0 2px; border-radius: 7px; font-size: 10.5px; font-weight: 500;
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, .07);
  color: var(--text); cursor: pointer; transition: .13s; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.sel-grid button:hover:not(:disabled) { background: var(--btn-hover); border-color: var(--accent); }
.sel-grid button.danger { color: #ff7b72; }
.sel-grid button.danger:hover:not(:disabled) { background: rgba(255, 90, 80, .16); border-color: #ff7b72; }
.sel-grid button:disabled { opacity: .34; cursor: default; }

/* 分段控件：一体式（底色轨道 + 选中金色块） */
.seg {
  display: flex; gap: 2px; padding: 2px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, .05);
}
.seg button {
  flex: 1; min-width: 0; height: 23px; padding: 0 2px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: .14s;
}
.seg button:hover { color: var(--text); }
.seg button.on {
  background: var(--accent); color: var(--accent-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
/* 多行分段（画板底纹）：独立小块可换行 */
.seg.wrap { flex-wrap: wrap; gap: 4px; padding: 0; background: none; border: 0; }
.seg.wrap button {
  flex: 1 1 calc(33.333% - 3px); height: 25px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, .07);
}
.seg.wrap button:hover { border-color: var(--accent); }
.seg.wrap button.on { background: var(--accent-soft); color: var(--accent); border-color: rgba(255, 176, 32, .45); box-shadow: none; }

/* 颜色：圆形色点（6 列 × 2 行）+ 自定义 */
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.sw {
  width: 100%; max-width: 24px; margin: 0 auto; aspect-ratio: 1; border-radius: 50%; border: 0;
  cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); transition: .14s;
}
.sw:hover { transform: scale(1.08); }
.sw.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--accent); }
.custom-color {
  display: flex; align-items: center; gap: 7px; margin-top: 7px;
  height: 26px; padding: 0 7px; border-radius: 8px; font-size: 10.5px; color: var(--muted);
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, .06);
}
.custom-color input {
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; cursor: pointer; flex: none;
}

/* 颜色行：右侧小色块即"自定义"入口 */
.sp-label #colorPicker {
  width: 20px; height: 20px; padding: 0; flex: none; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 6px; background: transparent;
}

/* 画笔参数行：标签 + 滑条 + 数值 同排（更紧凑） */
.sld-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.sld-row > span { flex: none; width: 36px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.sld-row > input { flex: 1; min-width: 0; }
.sld-row > em {
  flex: none; width: 20px; text-align: right; font-style: normal;
  font-size: 10.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums;
}

/* 画笔专属：笔型 / 平滑 / 压感 / 笔锋 / 渐变 / 预览 */
.sp-label.pen-slider { margin-top: 8px; }
.grad-row { display: flex; align-items: center; gap: 6px; }
.grad-lab { flex: none; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.grad-row .seg { flex: 1; }
#gradToColor {
  width: 30px; height: 28px; padding: 0; border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 7px; background: transparent; cursor: pointer; flex: none;
}
#penPreview {
  display: block; width: 100%; height: auto; margin-top: 8px;
  border-radius: 8px; border: 1px solid var(--border); background: #f6f7f9;
}

/* 滑条：细轨 + 环形金色滑块（面板内更紧密） */
.style-panel input[type="range"] {
  width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, rgba(255, 176, 32, .55), var(--btn));
  border-radius: 3px; outline: none; margin: 0 0 2px;
}
.style-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff3; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.style-panel input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: var(--accent);
  border: 2px solid #fff3; cursor: pointer;
}

/* 激光笔光圈（跟随光标） */
.laser-dot {
  position: absolute; left: 0; top: 0; width: 52px; height: 52px;
  margin: -26px 0 0 -26px; border-radius: 50%; pointer-events: none; z-index: 9;
  background:
    radial-gradient(circle, rgba(255, 77, 79, .55) 0%, rgba(255, 77, 79, .26) 34%, rgba(255, 77, 79, 0) 70%);
  border: 2px solid rgba(255, 216, 102, .85);
  box-shadow: 0 0 14px rgba(255, 216, 102, .55), 0 0 26px rgba(255, 77, 79, .35);
  animation: laserPulse 1.15s ease-in-out infinite;
}
.laser-dot::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px;
  margin: -4px 0 0 -4px; border-radius: 50%;
  background: #ff4d4f; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9), 0 0 10px rgba(255, 77, 79, .9);
}
.laser-dot.hidden { display: none; }

/* 橡皮擦虚线圈：替代系统指针，直径 = 橡皮擦擦除范围（屏幕像素） */
.eraser-ring {
  position: absolute; left: 0; top: 0; width: 28px; height: 28px;
  transform: translate(-50%, -50%); border-radius: 50%; box-sizing: border-box;
  border: 1.5px dashed rgba(255, 255, 255, .95);
  background: rgba(255, 255, 255, .10);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(0, 0, 0, .38);
  pointer-events: none; z-index: 9;
}
.eraser-ring::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
  margin: -1.5px 0 0 -1.5px; border-radius: 50%;
  background: rgba(255, 255, 255, .95); box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
}
.eraser-ring.hidden { display: none; }
@keyframes laserPulse {
  0%, 100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(1.12); opacity: 1; }
}

/* 图形下拉菜单（锚定工具栏「图形」按钮上方） */
.shape-menu {
  position: fixed; z-index: 60; width: 344px; padding: 10px 12px 12px;
  background: rgba(35, 40, 48, .97); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.sm-title { font-size: 11.5px; color: var(--muted); margin-bottom: 9px; }
/* 分类行：左侧分类名，右侧图形胶囊自动换行 */
.sm-cat { display: flex; align-items: flex-start; gap: 8px; }
.sm-cat + .sm-cat { margin-top: 9px; }
.sm-cat-name {
  flex: none; width: 28px; padding-top: 7px; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--text); opacity: .9;
  letter-spacing: .5px; user-select: none;
}
.sm-cat .sm-grid { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.sm-grid button {
  height: 28px; padding: 0 11px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--btn); color: var(--text); font-size: 12px; cursor: pointer; transition: .15s;
  white-space: nowrap;
}
.sm-grid button:hover { background: var(--btn-hover, rgba(255, 255, 255, .08)); }
.sm-grid button.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
input[type="range"] {
  width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--btn); border-radius: 3px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff2; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: var(--accent);
  border: 2px solid #fff2; cursor: pointer;
}

/* ---------- PDF 导入进度 ---------- */
.pdf-mask {
  position: fixed; inset: 0; z-index: 96; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 14, .55); backdrop-filter: blur(2px); padding: 20px;
}
.pdf-card {
  width: min(88vw, 344px); background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; box-shadow: var(--shadow);
}
.pdf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pdf-head b { font-size: 13.5px; }
.pdf-head span { font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; }
.pdf-bar { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--border); }
.pdf-bar i { display: block; width: 0; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffb020, #ff8a00); transition: width .18s ease-out; }
.pdf-txt { margin-top: 9px; font-size: 11.5px; color: var(--muted); line-height: 1.65; }

/* ---------- 广告条 B：顶部导航中间（纯文字，30 秒随机轮换） ---------- */
.topbar { position: relative; }
.topbar-textad {
  position: absolute; left: 50%; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 12px;
  width: clamp(648px, 61.2vw, 1368px); height: 48px; padding: 0 8px;
  /* 无外框：透明背景、无边框、无阴影 */
  background: none; border: none; box-shadow: none;
  overflow: hidden; z-index: 5;
}
.topbar-textad .ta-track {
  flex: 1; min-width: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
/* 文案超长需要滚动时才改为左对齐（否则居中会把开头裁掉） */
.topbar-textad .ta-track.roll { justify-content: flex-start; }
.topbar-textad .ta-text {
  display: inline-block; white-space: nowrap;
  font-size: 31px; font-weight: 700; letter-spacing: .5px; color: var(--text);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .35);
  transition: opacity .24s, transform .24s;
}
.topbar-textad .ta-text.is-swap { opacity: 0; transform: translateY(-6px); }
.topbar-textad .ta-date {
  flex: none; white-space: nowrap;
  font-size: 18px; font-weight: 600; letter-spacing: .3px;
  color: var(--text); opacity: .78;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .25);
}
.topbar-textad .ta-track.roll .ta-text {
  animation: taRoll var(--ta-dur, 12s) linear infinite alternate;
}
@keyframes taRoll {
  from { transform: translateX(0); }
  to { transform: translateX(var(--ta-shift, 0)); }
}
@media (max-width: 1199px) { .topbar-textad { display: none; } }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 90; pointer-events: none;
}
.toast {
  background: rgba(30, 35, 42, .97); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 16px; font-size: 12.5px; box-shadow: var(--shadow);
  animation: toastIn .2s ease-out;
}
.toast.ok { border-color: rgba(81, 207, 102, .55); }
.toast.err { border-color: rgba(255, 107, 107, .6); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(8, 10, 14, .62); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px; box-shadow: var(--shadow);
}
.modal h3 { font-size: 15px; margin-bottom: 10px; }
.modal p { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.modal-input {
  width: 100%; height: 40px; margin-top: 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); padding: 0 11px; font-size: 13.5px; outline: none;
}
.modal-input:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-actions .primary-btn { height: 38px; font-size: 13.5px; }
.modal-actions .ghost-btn { height: 38px; }

/* ---------- 右键菜单 ---------- */
.ctx-menu {
  position: fixed; z-index: 120; min-width: 132px; padding: 5px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.ctx-menu button {
  text-align: left; height: 32px; padding: 0 11px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text); font-size: 12.5px; cursor: pointer;
}
.ctx-menu button:hover { background: var(--btn); }
.ctx-menu button.danger { color: #ff8080; }
.ctx-menu button:disabled { color: var(--muted); opacity: .45; cursor: default; }
.ctx-menu button:disabled:hover { background: transparent; }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.ctx-menu#ctxMenu { min-width: 128px; }

/* ---------- 目标目录选择 ---------- */
.pick-mask {
  position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 14, .62); padding: 20px;
}
.pick-box {
  width: 100%; max-width: 360px; max-height: 72vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow);
}
.pick-box h3 { font-size: 14.5px; margin-bottom: 10px; }
.pick-list {
  flex: 1; overflow-y: auto; min-height: 120px;
  border: 1px solid var(--border); border-radius: 9px; padding: 5px; background: var(--panel-2);
}
.pick-item {
  display: flex; align-items: center; width: 100%; height: 32px; padding: 0 8px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text);
  font-size: 12.8px; cursor: pointer; text-align: left; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.pick-item:hover { background: var(--btn); }
.pick-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.pick-acts .ghost-btn { height: 34px; padding: 0 16px; }

.dr-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .app { grid-template-rows: 50px 1fr 58px; }
  .brand b { display: none; }
  .title-input { width: 120px; font-size: 12.5px; }
  .save-chip span { display: none; }
  .save-chip { padding: 0 9px; }
  .user-chip .uname { display: none; }
  .user-chip { padding: 0 5px; }
  .toolbar { justify-content: flex-start; padding: 0 8px; }
  .tbtn { min-width: 47px; height: 46px; padding: 4px 6px; }
  .tbtn span { font-size: 9.5px; }
  .pb-btn { min-width: 26px; height: 30px; padding: 0 4px; }
  .pb-btn.wide { font-size: 10px; padding: 0 6px; }
  .page-ind { min-width: 36px; font-size: 10.5px; }
  .zoom-val { min-width: 40px; height: 30px; font-size: 11px; }
  .lib-panel { width: min(88vw, 320px); top: 50px; bottom: 58px; }
  .style-panel {
    top: 10px; right: 10px; left: 10px; width: auto; max-height: 46vh;
  }
  .empty-hint { font-size: 11.5px; max-width: 84vw; text-align: center; }
}

/* ============================================================
   演示工具：放大镜 / 聚光灯 / 倒计时（悬浮窗口）
   ============================================================ */
.fx-win {
  position: fixed; left: 0; top: 0; z-index: 58;
  display: flex; flex-direction: column; overflow: hidden;
  border: 3px solid var(--accent); border-radius: 12px; background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5), 0 0 16px rgba(255, 176, 32, .22);
  touch-action: none; user-select: none;
}
.fx-bar {
  flex: 0 0 26px; height: 26px; display: flex; align-items: center; gap: 3px;
  padding: 0 4px 0 9px; background: var(--panel-2); color: var(--text);
  font-size: 12px; font-weight: 700; cursor: move; touch-action: none;
  border-bottom: 1px solid var(--border);
}
.fx-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--accent); letter-spacing: .3px; }
.fx-mini {
  height: 20px; min-width: 20px; padding: 0 6px; flex: none;
  border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1);
  color: var(--text); font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer;
}
.fx-mini:hover { background: rgba(255, 255, 255, .22); }
.fx-mini.wide { min-width: 42px; font-size: 11px; padding: 0 7px; }
.fx-mini.on { background: var(--accent); color: var(--accent-text); }
.fx-x {
  width: 20px; height: 20px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: #5a2b2b; color: #ffb0b0; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.fx-x:hover { background: #7a3a3a; color: #fff; }
.fx-body { flex: 1; position: relative; overflow: hidden; background: #fff; }
.fx-body canvas { display: block; width: 100%; height: 100%; }
.fx-resize {
  position: absolute; right: 1px; bottom: 1px; width: 30px; height: 30px;
  display: flex; align-items: flex-end; justify-content: flex-end; padding: 2px;
  cursor: nwse-resize; color: var(--accent); touch-action: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5));
}
.fx-resize svg { width: 22px; height: 22px; flex: none; }

/* 聚光灯：全屏遮罩 + 挖空窗口 */
.spot-mask { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 56; pointer-events: none; }
.spot-win {
  z-index: 59; background: transparent; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, .3), 0 8px 26px rgba(0, 0, 0, .55);
}
.spot-win .fx-bar { pointer-events: auto; }
.spot-win .fx-body { background: transparent; pointer-events: none; }
.spot-win .fx-resize { pointer-events: auto; }
.spot-win.off .fx-body { background: transparent; }

/* 倒计时：设置下拉 + 独立时间表窗口 */
.cd-menu {
  position: fixed; z-index: 60; width: 316px; padding: 12px 14px 14px;
  background: rgba(30, 35, 43, .97); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 9px;
}
.cdm-head { display: flex; align-items: center; justify-content: space-between; }
.cdm-title { font-size: 14px; font-weight: 700; color: var(--text); }
.cdm-x {
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer; font-size: 12px;
  border: none; background: transparent; color: var(--muted); line-height: 1;
}
.cdm-x:hover { background: var(--btn-hover); color: var(--text); }
.cdm-chips { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.cdm-row { display: flex; align-items: center; gap: 7px; }
.cdm-row.center { justify-content: center; }
.cdm-row #cdCustom { flex: 1; }
.cdm-row #cdOpacity { flex: 1; width: auto; }
.cdm-lab { font-size: 12px; color: var(--text); flex: none; }

.cd-win {
  z-index: 59; min-width: 150px; min-height: 84px;
  background: rgba(30, 35, 43, .97); backdrop-filter: blur(8px);
}
.cd-win.up { z-index: 130; }
/* 小尺寸窗口：标题栏与按钮按比例缩小，避免挤成一团 */
.cd-win .fx-bar { flex: 0 0 22px; height: 22px; padding: 0 3px 0 7px; gap: 2px; font-size: 11px; }
.cd-win .fx-mini.wide { min-width: 32px; height: 18px; padding: 0 4px; font-size: 10px; }
.cd-win .fx-x { width: 18px; height: 18px; font-size: 11px; }
.cd-win .fx-resize { width: 20px; height: 20px; }
.cd-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 2px 6px; overflow: hidden; min-height: 0;
}
.cd-display {
  font-family: Consolas, "SF Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: 2px;
  font-size: 56px; line-height: 1.02; color: var(--accent);
  text-shadow: 0 0 18px rgba(255, 176, 32, .22); white-space: nowrap;
}
.cd-display.warn { color: #ff6b6b; animation: cdflash .55s infinite alternate; }
@keyframes cdflash { from { opacity: 1; } to { opacity: .35; } }
.cd-row { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.cd-chip {
  height: 26px; padding: 0 12px; border-radius: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--btn); color: var(--text); font-size: 12.5px;
}
.cd-chip:hover { background: var(--btn-hover); }
.cd-chip.on { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 700; }
.cd-input {
  width: 86px; height: 27px; padding: 0 6px; border-radius: 7px; text-align: center;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: 12px;
}
.cd-input:focus { outline: none; border-color: var(--accent); }
.cd-btn {
  height: 27px; padding: 0 13px; border-radius: 13px; cursor: pointer; font-size: 12.5px;
  border: 1px solid var(--border); background: var(--btn); color: var(--text); flex: none;
}
.cd-btn:hover { background: var(--btn-hover); }
.cd-btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 700; }
.cd-lab { font-size: 11px; color: var(--muted); flex: none; }
#cdOpacity { accent-color: var(--accent); cursor: pointer; }
.cd-win.full {
  left: 0 !important; top: 0 !important; width: 100vw !important; height: 100vh !important;
  border-radius: 0; border-width: 0;
}
.cd-win.full .cd-display { font-size: 22vmin; }
.cd-win.full .fx-resize { display: none; }

/* ============================================================
   截图：框选图层 + 方式选择 / 结果预览 / 桌面引导 弹窗
   ============================================================ */
.shot-layer {
  position: absolute; inset: 0; z-index: 9;
  display: block; width: 100%; height: 100%;
  cursor: crosshair; touch-action: none;
}
.shot-mask {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 14, .62); backdrop-filter: blur(3px);
  padding: 20px;
}
.shot-card {
  width: min(430px, 100%);
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  padding: 20px 20px 16px;
}
.shot-card.wide { width: min(760px, 100%); }
.shot-card h3 { font-size: 16px; font-weight: 800; letter-spacing: .3px; }
.shot-sub { margin-top: 6px; font-size: 12.5px; line-height: 1.75; color: var(--muted); }
.shot-sub strong, .shot-sub b { color: var(--accent); }
.shot-ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 4px; }
.shot-way {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 8px 11px; border-radius: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--btn); color: var(--text);
  font-size: 12.5px; transition: .16s;
}
.shot-way svg { width: 26px; height: 26px; color: var(--accent); }
.shot-way b { font-size: 13px; }
.shot-way small { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.4; }
.shot-way:hover { border-color: var(--accent); background: var(--btn-hover); transform: translateY(-1px); }
.shot-preview {
  margin: 14px 0 4px; border-radius: 12px; overflow: auto;
  background: #0f1319; border: 1px solid var(--border);
  max-height: min(56vh, 520px); display: flex; align-items: center; justify-content: center;
  padding: 10px;
}
.shot-preview img { max-width: 100%; max-height: min(54vh, 500px); display: block; border-radius: 6px; background: #fff; }
.shot-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.shot-actions .primary-btn, .shot-actions .ghost-btn { height: 36px; font-size: 13px; }
@media (max-width: 560px) {
  .shot-ways { grid-template-columns: 1fr; }
}

/* ============================================================
   函数图象面板
   ============================================================ */
.plot-win {
  background: var(--panel); border-color: var(--accent);
  box-shadow: 0 16px 46px rgba(0, 0, 0, .55), 0 0 18px rgba(255, 176, 32, .18);
  max-height: calc(100vh - 16px);
}
.plot-win .fx-body {
  background: var(--panel); overflow-y: auto; overflow-x: hidden;
  flex: 1; min-height: 0;
  padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 8px;
  color: var(--text); user-select: none;
}
.plot-win .fx-body::-webkit-scrollbar { width: 6px; }
.plot-win .fx-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 3px; }

/* 模式切换 */
.pl-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; background: var(--panel-2); padding: 3px; border-radius: 9px; }
.pl-modes button {
  height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 11px; font-weight: 600; cursor: pointer; transition: .14s; white-space: nowrap;
  padding: 0 2px;
}
.pl-modes button:hover { color: var(--text); }
.pl-modes button.on { background: var(--accent); color: var(--accent-text); }

/* 表达式输入 */
.pl-eq {
  display: flex; align-items: center; gap: 7px; padding: 0 10px; height: 40px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  transition: .15s;
}
.pl-eq:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pl-prefix {
  flex: none; font: 700 15px/1 "Cambria", "Times New Roman", serif; color: var(--accent);
  letter-spacing: .5px; min-width: 26px;
}
.pl-input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  color: var(--text); font: 500 14.5px/1.2 "Cambria", "Consolas", "Microsoft YaHei", monospace;
  letter-spacing: .3px;
}
.pl-input::placeholder { color: var(--muted); opacity: .62; font-size: 12.5px; }

.pl-hint { min-height: 15px; font-size: 11px; line-height: 1.45; color: var(--muted); padding: 0 2px; }
.pl-hint.bad { color: #ff8b7f; }

/* 键盘选项卡 */
.pl-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--panel-2); padding: 3px; border-radius: 9px; }
.pl-tabs button {
  height: 24px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: .14s;
}
.pl-tabs button:hover { color: var(--text); }
.pl-tabs button.on { background: var(--accent); color: var(--accent-text); }

/* 符号键盘 */
.pl-keys { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.pl-keys button {
  height: 26px; padding: 0 2px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, .07);
  color: var(--text); font-size: 11.5px; font-weight: 600; line-height: 1;
  white-space: nowrap; overflow: hidden; transition: .12s;
  font-family: "Cambria", "Microsoft YaHei", sans-serif;
}
.pl-keys button.fn { color: #9ad2ff; font-size: 11px; }
.pl-keys button:hover { background: var(--btn-hover); border-color: var(--accent); }
.pl-keys button:active { transform: translateY(1px); }

/* 数学运算键盘：数字与他人共用 8 列，数字用等宽字体 */
.pl-math button { font-variant-numeric: tabular-nums; }
/* 退格键：各选项卡底部统一样式，宽度按该面板列数铺满 */
.pl-keys button.bk {
  font-size: 11.5px; letter-spacing: .6px;
  color: var(--accent); background: rgba(255, 176, 32, .1);
  border-color: rgba(255, 176, 32, .3);
}
.pl-keys button.bk:hover { background: var(--accent-soft); border-color: var(--accent); }
.pl-math button.bk { grid-column: span 4; }
.pl-alphas button.bk { grid-column: span 13; }
.pl-greek button.bk { grid-column: span 8; }

/* 英文字母 / 希腊字母键盘 */
.pl-alphas { grid-template-columns: repeat(13, 1fr); }
.pl-greek { grid-template-columns: repeat(8, 1fr); }
.pl-alphas button, .pl-greek button {
  font-family: "Cambria", "Times New Roman", "Microsoft YaHei", serif;
  font-size: 12.5px; font-weight: 600; text-transform: none;
}
.pl-greek button { font-size: 13.5px; }
/* 可参与运算的字符高亮 */
.pl-alphas button.ok, .pl-greek button.ok { color: var(--accent); background: rgba(255, 176, 32, .1); }

/* 字母键盘内的大写分区标签 */
.pl-cap-tag {
  grid-column: span 13; height: 15px; display: flex; align-items: center;
  font-size: 10px; line-height: 1; color: var(--muted); letter-spacing: .2px;
  padding-left: 2px; opacity: .85;
}

/* 示例 */
.pl-ex { display: flex; flex-wrap: wrap; gap: 4px; }
.pl-ex button {
  height: 22px; padding: 0 9px; border-radius: 999px; cursor: pointer;
  background: var(--accent-soft); border: 1px solid transparent; color: var(--accent);
  font-size: 11px; font-weight: 600; transition: .13s;
}
.pl-ex button:hover { border-color: var(--accent); }

/* 行 / 字段 */
.pl-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.pl-field { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.pl-field em { font-style: normal; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-field input[type="text"], .pl-field input:not([type]) {
  width: 46px; height: 24px; padding: 0 5px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 11.5px; font-weight: 600; outline: 0; font-variant-numeric: tabular-nums;
}
.pl-field input:not([type]):focus { border-color: var(--accent); }
.pl-field.small { flex: 1; min-width: 0; }
.pl-field input[type="range"] {
  flex: 1; min-width: 40px; height: 3px; appearance: none; -webkit-appearance: none;
  background: var(--btn); border-radius: 2px; outline: 0;
}
.pl-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--panel);
}

.pl-check { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.pl-check input { accent-color: var(--accent); width: 13px; height: 13px; cursor: pointer; }
.pl-check span { white-space: nowrap; }

/* x 范围：触屏步进（−/＋ 可长按连续调节） */
.pl-range { display: flex; flex-direction: column; gap: 5px; }
.plr-head { display: flex; align-items: center; gap: 8px; }
.plr-title { flex: none; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.plr-tip { flex: 1; min-width: 0; font-size: 10px; color: var(--muted); opacity: .68; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plr-row { display: flex; align-items: center; gap: 4px; }
.plr-btn {
  flex: none; width: 34px; height: 34px; padding: 0; border-radius: 9px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  font-size: 17px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; transition: .12s;
}
.plr-btn:hover { background: var(--btn-hover); border-color: var(--accent); }
.plr-btn:active { transform: translateY(1px); background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.plr-val {
  flex: 1; min-width: 44px; height: 34px; padding: 0 4px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: 700 14px/1 "Consolas", "Cambria", "Microsoft YaHei", monospace;
  letter-spacing: .3px; outline: 0; font-variant-numeric: tabular-nums;
}
.plr-val:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.plr-sep { flex: none; font-size: 12px; color: var(--muted); padding: 0 1px; }

/* 参数 α：一行 −/＋ 触屏步进 */
.pl-pbox .plr-row { gap: 4px; }
.pl-pbox .plr-val { min-width: 0; padding: 0 2px; font-size: 13px; }
.pl-tag {
  flex: none; width: 13px; text-align: center;
  font: 700 13px/1 "Cambria", "Times New Roman", "Microsoft YaHei", serif; color: var(--muted);
}

/* 视角：方位角 / 仰角两个滑杆 */
.plv-row { display: flex; align-items: center; gap: 6px; }
.plv-row input[type="range"] {
  flex: 1; min-width: 40px; height: 4px; appearance: none; -webkit-appearance: none;
  background: var(--btn); border-radius: 2px; outline: 0; touch-action: none;
}
.plv-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--panel);
}
.plv-row em {
  flex: none; width: 32px; text-align: right; font-style: normal;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* 参数滑块（画布上浮动）：a / b / c，默认范围 −4 ~ 4 */
.param-win {
  z-index: 58; width: 236px;
  background: var(--panel); border-color: var(--accent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 0 16px rgba(255, 176, 32, .18);
  touch-action: auto;
}
.param-win .fx-bar { flex: 0 0 24px; height: 24px; padding: 0 4px 0 8px; gap: 3px; }
.param-win .fx-name { font-size: 11.5px; }
.param-win .fx-mini.wide { min-width: 34px; height: 18px; font-size: 10px; padding: 0 5px; }
.param-win .fx-x { width: 18px; height: 18px; font-size: 11px; }
.param-body {
  background: var(--panel); overflow: visible;
  padding: 8px 10px 9px; display: flex; flex-direction: column; gap: 6px;
  color: var(--text); user-select: none;
}
.pm-row { display: flex; align-items: center; gap: 8px; transition: opacity .15s; }
.pm-row.off { opacity: .42; }
.pm-name {
  flex: none; width: 12px; text-align: center;
  font: 700 13px/1 "Cambria", "Times New Roman", serif; color: var(--accent);
}
.pm-row.off .pm-name { color: var(--muted); }
.pm-range {
  flex: 1; min-width: 0; height: 20px; margin: 0; padding: 0;
  appearance: none; -webkit-appearance: none; background: transparent;
  cursor: pointer; touch-action: auto;
}
.pm-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--btn); }
.pm-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5.5px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .55); cursor: pointer;
}
.pm-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--btn); }
.pm-range::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--panel); cursor: pointer;
}
.pm-val {
  flex: none; width: 38px; text-align: right;
  font: 700 12px/1 "Consolas", "Cambria", "Microsoft YaHei", monospace;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.pm-tip { font-size: 10px; line-height: 1.3; color: var(--muted); opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 角度参数 φ：读数要放下 -360° */
.pm-row[data-p="pf"] .pm-val { width: 44px; font-size: 11.5px; }

/* 视角滑块（画布上浮动）：空间图形的方位角 / 仰角，与参数滑块同风格 */
.view-win {
  z-index: 58; width: 218px;
  background: var(--panel); border-color: var(--accent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 0 16px rgba(255, 176, 32, .18);
  touch-action: auto;
}
.view-win .fx-bar { flex: 0 0 24px; height: 24px; padding: 0 4px 0 8px; gap: 3px; }
.view-win .fx-name { font-size: 11.5px; }
.view-win .fx-mini.wide { min-width: 34px; height: 18px; font-size: 10px; padding: 0 5px; }
.view-win .fx-x { width: 18px; height: 18px; font-size: 11px; }
.view-body {
  background: var(--panel); overflow: visible;
  padding: 8px 10px 9px; display: flex; flex-direction: column; gap: 7px;
  color: var(--text); user-select: none;
}
.vw-row { display: flex; align-items: center; gap: 8px; }
.vw-tag {
  flex: none; width: 16px; text-align: center;
  font-size: 12px; color: var(--muted);
}
.vw-row .pm-val { width: 40px; }

/* α 范围浮窗：用 α（角度制横坐标）作图时出现，也可用选择工具选中曲线后调出 */
.range-win {
  z-index: 58; width: 232px;
  background: var(--panel); border-color: var(--accent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 0 16px rgba(255, 176, 32, .18);
  touch-action: auto;
}
.range-win .fx-bar { flex: 0 0 24px; height: 24px; padding: 0 4px 0 8px; gap: 3px; }
.range-win .fx-name { font-size: 11.5px; }
.range-win .fx-mini.wide { min-width: 34px; height: 18px; font-size: 10px; padding: 0 5px; }
.range-win .fx-x { width: 18px; height: 18px; font-size: 11px; }
.rw-span {
  flex: 1 1 auto; min-width: 0; text-align: right; padding-right: 1px;
  font: 700 10.5px/1 "Consolas", "Microsoft YaHei", monospace; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.range-body {
  background: var(--panel); overflow: visible;
  padding: 8px 9px 9px; display: flex; flex-direction: column; gap: 6px;
  color: var(--text); user-select: none;
}
.rw-row { display: flex; align-items: center; gap: 5px; }
.rw-tag { flex: none; width: 14px; text-align: center; font-size: 11px; color: var(--muted); }
.rw-btn {
  flex: none; width: 27px; height: 27px; padding: 0; border-radius: 7px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; transition: .12s;
}
.rw-btn:hover { background: var(--btn-hover); border-color: var(--accent); }
.rw-btn:active { transform: translateY(1px); background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.rw-val {
  flex: 1 1 auto; min-width: 0; height: 27px; padding: 0 2px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); font: 700 12.5px/1 "Consolas", "Microsoft YaHei", monospace;
  letter-spacing: .2px; outline: 0; font-variant-numeric: tabular-nums;
}
.rw-val:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rw-presets { display: flex; gap: 3px; }
.rw-presets button {
  flex: 1 1 0; min-width: 0; height: 23px; padding: 0 1px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  font-size: 9.5px; white-space: nowrap; transition: .12s;
}
.rw-presets button:hover { color: var(--text); border-color: var(--accent); }
.rw-presets button.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.range-win .pm-tip { font-size: 10px; }

/* 颜色 */
.pl-swatches { display: flex; gap: 4px; }
.pl-swatch {
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16);
  transition: .13s;
}
.pl-swatch:hover { transform: scale(1.12); }
.pl-swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent); }

/* 底部操作 */
.pl-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.pl-btn {
  height: 32px; padding: 0 18px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--btn); color: var(--text);
  font-size: 12.5px; font-weight: 700; transition: .15s;
}
.pl-btn.primary {
  flex: 1; background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}
.pl-btn.primary:hover { filter: brightness(1.08); }
.pl-btn:active { transform: translateY(1px); }
