/* 教学数据大屏 — 深色科技风 · 全屏自适应布局 */

/* ── 默认主题：深海科技 ─────────────────────────────────────────────────── */
:root {
  /* 基础色板 */
  --bg-deep: #050a14;
  --bg-panel: rgba(8, 18, 40, 0.72);
  --border-cyan: #00f2ff;
  --accent-pink: #ff2d55;
  --accent-orange: #ff9500;
  --accent-green: #4cd964;
  --accent-purple: #b967ff;
  --text: #e8f4ff;
  --text-dim: rgba(232, 244, 255, 0.50);

  /* 发光效果 */
  --glow-cyan:   0 0 14px rgba(0, 242, 255, 0.50);
  --glow-orange: 0 0 14px rgba(255, 149, 0,  0.50);

  /* 背景 */
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #0d1b3a 0%, #050a14 55%);
  --header-bg:   linear-gradient(90deg, rgba(0, 30, 60, 0.9), rgba(5, 10, 20, 0.4));
  --grid-line:   rgba(0, 242, 255, 0.025);

  /* ── 组件卡片抽象变量（随主题自动变化）── */
  --widget-border:        rgba(0, 242, 255, 0.26);
  --widget-border-left:   #00f2ff;
  --widget-glow-in:       rgba(0, 242, 255, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(0, 242, 255, 0.22);
  --widget-header-bg:     rgba(0, 242, 255, 0.10);
  --widget-header-border: rgba(0, 242, 255, 0.14);

  /* 顶部栏高度随视口高度自适应 */
  --header-h: clamp(52px, 6.5vh, 72px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-gradient);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  transition: background 0.6s ease;
}

.viewport {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* 大屏主容器 — 完全铺满视口，不再固定 1920×1080 */
.screen {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  /* 双轴网格 + 顶部辉光 */
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(0, 242, 255, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 10% 90%, rgba(0, 242, 255, 0.03) 0%, transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(74, 158, 255, 0.03) 0%, transparent 35%),
    repeating-linear-gradient(
      90deg,
      transparent 0px, transparent 79px,
      var(--grid-line) 79px, var(--grid-line) 80px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0px, transparent 79px,
      var(--grid-line) 79px, var(--grid-line) 80px
    );
}

/* 顶部 */
/* ── 顶部 Logo ─────────────────────────────────────────────────── */
.header-logo {
  display: flex;
  align-items: center;
  margin-right: 14px;
  flex-shrink: 0;
}

.header-logo-img {
  height: clamp(32px, 3.2vh, 46px);
  width: auto;
  object-fit: contain;
  mix-blend-mode: screen;
}

.screen-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.25);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  background: var(--header-bg);
  position: relative;
}

.screen-header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-cyan), transparent);
  opacity: 0.6;
}

.header-title {
  font-size: clamp(13px, 1.1vw, 22px);
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: var(--glow-cyan);
  min-width: clamp(180px, 20vw, 380px);
  flex-shrink: 0;
}

.header-title input {
  width: 100%;
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.35);
  color: var(--text);
  padding: clamp(4px, 0.5vh, 6px) 12px;
  font-size: clamp(12px, 0.95vw, 18px);
  border-radius: 4px;
}

.header-tabs {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 0.4vw, 8px);
  flex-wrap: nowrap;
  /* overflow: visible 让 tab-del-btn 的绝对定位 badge 不被裁剪 */
  overflow: visible;
}

.header-clock {
  min-width: clamp(120px, 9vw, 168px);
  text-align: center;
  font-size: clamp(11px, 0.75vw, 14px);
  font-variant-numeric: tabular-nums;
  color: var(--accent-green);
  text-shadow: 0 0 10px rgba(76, 217, 100, 0.45);
  padding: 0 8px;
  flex-shrink: 0;
}

/* ── 页签容器 ── */
.tab-item {
  position: relative;
  display: flex;
  align-items: center;
}

body.edit-mode:not(.presentation-mode) .tab-item {
  cursor: grab;
}

body.edit-mode:not(.presentation-mode) .tab-item:active {
  cursor: grabbing;
}

.tab-btn {
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  padding: clamp(6px, 0.7vh, 10px) clamp(14px, 1.8vw, 36px);
  border: none;
  cursor: pointer;
  font-size: clamp(11px, 0.75vw, 14px);
  color: var(--text-dim);
  background: rgba(0, 40, 80, 0.5);
  border: 1px solid rgba(0, 242, 255, 0.2);
  transition: color 0.2s, box-shadow 0.2s, background 0.2s;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--border-cyan);
  background: rgba(0, 242, 255, 0.12);
  box-shadow: var(--glow-cyan);
  border-color: rgba(0, 242, 255, 0.55);
}

/* 页签内文字容器 */
.tab-label {
  pointer-events: none;
}

/* ✏ 重命名图标：编辑模式下悬停时显示 */
.tab-edit-icon {
  font-style: normal;
  font-size: 10px;
  margin-left: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  cursor: pointer;
  vertical-align: middle;
  filter: drop-shadow(0 0 3px var(--border-cyan));
}

body.edit-mode:not(.presentation-mode) .tab-btn:hover .tab-edit-icon,
body.edit-mode:not(.presentation-mode) .tab-btn.active .tab-edit-icon {
  opacity: 0.75;
  pointer-events: auto;
}

body.edit-mode:not(.presentation-mode) .tab-edit-icon:hover {
  opacity: 1;
}

/* 内联重命名输入框 */
.tab-rename-input {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--border-cyan);
  color: var(--border-cyan);
  font-size: inherit;
  font-family: inherit;
  width: clamp(60px, 8vw, 120px);
  outline: none;
  text-align: center;
  padding: 0 4px;
}

/* 删除页签按钮（× 号，edit-mode 下显示） */
.tab-del-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 45, 85, 0.85);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  display: none;
  z-index: 10;
  transition: background 0.2s, transform 0.15s;
  user-select: none;
}

.tab-del-btn:hover {
  background: #ff2d55;
  transform: scale(1.2);
}

body.edit-mode:not(.presentation-mode) .tab-del-btn { display: block; }

/* 复制页签按钮（⧉，edit-mode 下显示） */
.tab-copy-btn {
  position: absolute;
  bottom: -6px;
  right: 12px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 10px;
  background: rgba(0, 242, 255, 0.85);
  color: #01223a;
  font-size: 9px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  display: none;
  z-index: 10;
  transition: background 0.2s, transform 0.15s;
  user-select: none;
  font-weight: 700;
}

.tab-copy-btn:hover {
  background: #00f2ff;
  transform: scale(1.15);
}

body.edit-mode:not(.presentation-mode) .tab-copy-btn { display: block; }

/* "+" 添加页签按钮 */
.tab-add-btn {
  width: clamp(22px, 2vw, 28px);
  height: clamp(22px, 2.5vh, 28px);
  border-radius: 50%;
  background: transparent;
  border: 1.5px dashed rgba(0, 242, 255, 0.4);
  color: rgba(0, 242, 255, 0.6);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  margin-left: 4px;
}

.tab-add-btn:hover {
  border-color: var(--border-cyan);
  color: var(--border-cyan);
  background: rgba(0, 242, 255, 0.08);
}

body.edit-mode:not(.presentation-mode) .tab-add-btn { display: flex; }

.header-class {
  min-width: clamp(120px, 12vw, 220px);
  text-align: right;
  font-size: clamp(11px, 0.8vw, 15px);
  color: var(--accent-orange);
  flex-shrink: 0;
}

.header-class input {
  width: 100%;
  text-align: right;
  background: rgba(255, 149, 0, 0.1);
  border: 1px solid rgba(255, 149, 0, 0.35);
  color: var(--accent-orange);
  padding: clamp(4px, 0.5vh, 6px) 10px;
  font-size: clamp(11px, 0.75vw, 14px);
  border-radius: 4px;
}

/* 主体三栏 — 铺满剩余高度 */
.screen-body {
  display: flex;
  flex: 1;              /* 撑满 .screen 剩余高度 */
  min-height: 0;        /* 允许 flex 子项收缩 */
  padding: clamp(6px, 1vh, 12px) clamp(8px, 0.8vw, 16px) clamp(8px, 1.2vh, 16px);
  gap: clamp(6px, 0.6vw, 12px);
}

.col {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 0.7vh, 10px);
  min-height: 0;
  overflow-y: auto;     /* 组件超出高度时列内滚动，防止被压缩得过小 */
  overflow-x: hidden;
}
/* 细滚动条样式（深色主题） */
.col::-webkit-scrollbar { width: 4px; }
.col::-webkit-scrollbar-track { background: transparent; }
.col::-webkit-scrollbar-thumb { background: rgba(0,242,255,.18); border-radius: 2px; }
.col::-webkit-scrollbar-thumb:hover { background: rgba(0,242,255,.35); }

.col-left {
  width: 24%;
  flex-shrink: 0;
}

.col-center {
  flex: 1;              /* 中间列自动填充剩余宽度 */
  min-width: 0;
}

.col-right {
  width: 24%;
  flex-shrink: 0;
}

/* ── 自由多列布局（按页签开关）─────────────────────────────────────────────
 * 默认隐藏；当 body.free-layout-on 时，3 列容器隐藏，col-free 取代为 4 等分网格。
 * 4 列等宽，每格 = 25% 屏宽；widget 通过 data-colspan="1|2|3|4" 决定占几格（默认 1 格）。
 * 三列布局映射：左 widget colSpan=1 / 中 widget colSpan=2 / 右 widget colSpan=1 = 1+2+1=4 格 → 视觉 1:2:1。
 *
 * grid-auto-flow: row（不是 dense）→ 严格按 freeOrder 顺序流式排布，
 *   组件不会因为某个 widget 改了 colSpan 就被自动重排到别处。
 */
.col-free {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  /* 行高单位（小颗粒）：widget 通过 rowSpan 控制总高，默认 4 行 ≈ 320px，与传统三列布局视觉相当 */
  grid-auto-rows: 80px;
  grid-auto-flow: row;
  /* 水平 gap 与 .screen-body 的水平 gap 完全一致；垂直 gap 与 .col 内部 gap 一致 */
  column-gap: clamp(6px, 0.6vw, 12px);
  row-gap: clamp(6px, 0.7vh, 10px);
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  align-content: start;
}
.col-free::-webkit-scrollbar { width: 4px; }
.col-free::-webkit-scrollbar-track { background: transparent; }
.col-free::-webkit-scrollbar-thumb { background: rgba(0,242,255,.18); border-radius: 2px; }
.col-free::-webkit-scrollbar-thumb:hover { background: rgba(0,242,255,.35); }

body.free-layout-on .col-left,
body.free-layout-on .col-center,
body.free-layout-on .col-right {
  display: none !important;
}
body.free-layout-on .col-free {
  display: grid;
}

/* 自由模式下 widget 的尺寸：
 *   列宽：colspan 1 → 1 格 · 2 → 1+1=2 格 · 3 → 1+1+1=3 格 · 4 → 1+1+1+1=4 格（整屏）
 *         由 widget 工具栏「↔」按钮循环切换，resize 抓手不参与
 *   行高：rowspan 决定占多少行（每行 80px + gap）。默认 4 行（≈ 320px），跟传统列等高分布的体验接近 */
body.free-layout-on .col-free > .widget {
  grid-column: span 1;
  grid-row: span 4;   /* 默认值；具体 widget 会被 [data-rowspan] 覆盖 */
  flex: none;          /* 网格控制宽度，禁用 flex 填充 */
  min-height: 0;       /* 让 grid-row 真正决定高度，不再被 flex-basis/200px 干扰 */
  flex-basis: auto;
}
body.free-layout-on .col-free > .widget[data-colspan="1"] { grid-column: span 1; }
body.free-layout-on .col-free > .widget[data-colspan="2"] { grid-column: span 2; }
body.free-layout-on .col-free > .widget[data-colspan="3"] { grid-column: span 3; }
body.free-layout-on .col-free > .widget[data-colspan="4"] { grid-column: span 4; }
body.free-layout-on .col-free > .widget[data-rowspan="2"]  { grid-row: span 2; }
body.free-layout-on .col-free > .widget[data-rowspan="3"]  { grid-row: span 3; }
body.free-layout-on .col-free > .widget[data-rowspan="4"]  { grid-row: span 4; }
body.free-layout-on .col-free > .widget[data-rowspan="5"]  { grid-row: span 5; }
body.free-layout-on .col-free > .widget[data-rowspan="6"]  { grid-row: span 6; }
body.free-layout-on .col-free > .widget[data-rowspan="7"]  { grid-row: span 7; }
body.free-layout-on .col-free > .widget[data-rowspan="8"]  { grid-row: span 8; }
body.free-layout-on .col-free > .widget[data-rowspan="9"]  { grid-row: span 9; }
body.free-layout-on .col-free > .widget[data-rowspan="10"] { grid-row: span 10; }
body.free-layout-on .col-free > .widget[data-rowspan="11"] { grid-row: span 11; }
body.free-layout-on .col-free > .widget[data-rowspan="12"] { grid-row: span 12; }

/* 自由模式下 widget 底部中央的 resize 抓手 — 仅向下拖动调整高度（宽度由「↔」按钮控制） */
.widget-resize-handle {
  display: none;
  position: absolute;
  left: 50%; bottom: 1px;
  transform: translateX(-50%);
  width: 56px; height: 8px;
  cursor: ns-resize;
  opacity: 0;
  transition: opacity .15s, height .15s;
  background: rgba(0,242,255,.55);
  border-radius: 0 0 5px 5px;
  z-index: 5;
}
.widget-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 2px;
  background: rgba(4,18,44,.55);
  border-radius: 1px;
  box-shadow: 0 -3px 0 rgba(4,18,44,.55), 0 3px 0 rgba(4,18,44,.55);
}
body.free-layout-on .widget-resize-handle { display: block; }
body.free-layout-on .widget:hover .widget-resize-handle { opacity: .55; }
body.free-layout-on .widget-resize-handle:hover { opacity: .95 !important; height: 12px; }
body.free-layout-on .widget.is-resizing { transition: none !important; outline: 1px dashed rgba(0,242,255,.55); outline-offset: -1px; }
.widget-resize-hint {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,242,255,.92);
  color: #04122c;
  font-size: 10px; font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: .04em;
  pointer-events: none;
  z-index: 6;
  font-family: JetBrains Mono, Consolas, monospace;
}

/* widget 工具栏的列宽切换按钮 — 仅自由模式可见 */
.btn-colspan {
  display: none !important;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(140, 200, 255, .14);
  border: 1px solid rgba(140, 200, 255, .35);
  color: #aac8ff;
  cursor: pointer;
  font-weight: 600;
  transition: all .18s;
  letter-spacing: .03em;
}
body.free-layout-on .btn-colspan { display: inline-flex !important; align-items: center; gap: 2px; }
.btn-colspan:hover { background: rgba(140, 200, 255, .26); border-color: rgba(140, 200, 255, .55); color: #fff; }
.btn-colspan[data-span="2"] { background: rgba(255, 200, 100, .18); border-color: rgba(255, 200, 100, .4); color: #ffd28a; }
.btn-colspan[data-span="3"] { background: rgba(255, 100, 180, .2); border-color: rgba(255, 100, 180, .42); color: #ffa3d3; }

/* 页签上的「自由布局」开关按钮 */
.tab-free-toggle {
  cursor: pointer;
  font-size: 12px;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 4px;
  opacity: .55;
  transition: all .15s;
  user-select: none;
  display: none; /* 仅编辑模式显示 */
}
body.edit-mode .tab-free-toggle { display: inline-block; }
body.edit-mode .tab-free-toggle:hover { opacity: 1; background: rgba(0,242,255,.15); }
.tab-free-toggle[data-on="1"] {
  opacity: 1;
  color: #ffb84d;
  background: rgba(255,184,77,.16);
  box-shadow: inset 0 0 0 1px rgba(255,184,77,.45);
}
.tab-btn[data-free-on="1"] {
  background: linear-gradient(180deg, rgba(255,184,77,.06), rgba(255,184,77,.02)) !important;
  border-bottom: 2px solid rgba(255,184,77,.55) !important;
}

/* 自由布局开启时 tab 上的 (?) 小问号 — 悬停弹自定义 tooltip（替代原横幅气泡） */
.tab-free-help {
  display: none;
  margin-left: 3px;
  width: 14px; height: 14px;
  line-height: 14px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  font-family: JetBrains Mono, Consolas, monospace;
  color: #ffb84d;
  background: rgba(255,184,77,.14);
  border: 1px solid rgba(255,184,77,.45);
  border-radius: 50%;
  cursor: help;
  user-select: none;
  position: relative;
  transition: all .15s;
}
body.edit-mode .tab-free-help { display: inline-block; }
.tab-free-help:hover {
  color: #1a0a00;
  background: rgba(255,184,77,.92);
}
.tab-free-help:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(15, 28, 56, 0.97);
  color: #cfe6ff;
  border: 1px solid rgba(0,242,255,.35);
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1.7;
  white-space: pre;
  text-align: left;
  width: max-content;
  max-width: 360px;
  z-index: 1000;
  box-shadow: 0 6px 24px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,242,255,.12);
  pointer-events: none;
  animation: fl_help_in .18s ease both;
}
.tab-free-help:hover::before {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%) translateY(2px);
  border: 6px solid transparent;
  border-bottom-color: rgba(15, 28, 56, 0.97);
  z-index: 1001;
  pointer-events: none;
}
@keyframes fl_help_in {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 面板卡片 */
.widget {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--widget-border);
  border-left: 2.5px solid var(--widget-border-left);
  border-radius: 6px;
  box-shadow:
    inset 0 0 50px var(--widget-glow-in),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 28px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  /* 最小高度保障：无论列多拥挤，组件不会被压缩到无法辨认 */
  min-height: 200px;
  flex: 1;
  flex-basis: 200px;   /* flex 分配基准高度，保证多组件时平均不低于此值 */
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

.widget:hover {
  border-color: var(--border-cyan);
  border-left-color: var(--border-cyan);
  box-shadow:
    inset 0 0 50px var(--widget-glow-in),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 28px rgba(0, 0, 0, 0.45),
    var(--widget-hover-shadow);
}

/* 四角装饰线 */
.widget::before,
.widget::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-cyan);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.35s, width 0.35s, height 0.35s;
}

.widget:hover::before,
.widget:hover::after {
  opacity: 0.9;
  width: 18px;
  height: 18px;
}

.widget::before {
  top: -1px; left: -1px;
  border-right: none;
  border-bottom: none;
}

.widget::after {
  bottom: -1px; right: -1px;
  border-left: none;
  border-top: none;
}

/* 组件标题栏 */
.widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: clamp(6px,0.6vh,10px) 14px;
  background: linear-gradient(90deg, var(--widget-header-bg), transparent 70%);
  border-bottom: 1px solid var(--widget-header-border);
  flex-shrink: 0;
  position: relative;
}

.widget-drag-handle {
  cursor: grab;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  user-select: none;
  flex-shrink: 0;
  letter-spacing: -2px;
}

.widget-drag-handle:active {
  cursor: grabbing;
  color: var(--border-cyan);
}

.widget-title {
  font-size: clamp(11px, 0.75vw, 14px);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--border-cyan);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget.sortable-ghost {
  opacity: 0.45;
  outline: 2px dashed var(--accent-pink);
}

.widget.sortable-drag {
  opacity: 0.95;
}

.widget-actions {
  display: flex;
  gap: 6px;
}

.widget-actions button {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
  padding: 2px clamp(5px, 0.4vw, 8px);
  font-size: clamp(10px, 0.65vw, 12px);
  cursor: pointer;
  border-radius: 3px;
}

.widget-actions button:hover {
  color: var(--text);
  border-color: var(--border-cyan);
}

.widget-body {
  flex: 1;
  min-height: 150px;    /* 保证图表内容区不低于此高度 */
  position: relative;
  padding: clamp(3px, 0.4vh, 6px);
  overflow: hidden;
}

.widget-body .chart {
  width: 100%;
  height: 100%;
  min-height: 0;        /* 完全跟随容器，不再固定最小高度 */
}

/* 知识图谱工具条 */
.kg-toolbar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

.kg-toolbar button {
  background: rgba(0, 20, 40, 0.85);
  border: 1px solid rgba(0, 242, 255, 0.4);
  color: var(--border-cyan);
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
}

.kg-toolbar button.active {
  background: rgba(0, 242, 255, 0.2);
  box-shadow: var(--glow-cyan);
}

.kg-legend {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  background: rgba(0, 10, 25, 0.85);
  border: 1px solid rgba(0, 242, 255, 0.25);
  padding: 8px 10px;
  font-size: 11px;
  max-width: 200px;
}

.kg-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.kg-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* 浮动编辑工具栏 */
/* ════════════════════════════════════════════════════════════════════════════
   右侧可收起编辑面板  —  side-panel
════════════════════════════════════════════════════════════════════════════ */
.side-panel {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  align-items: stretch;
  transition: transform 0.32s cubic-bezier(.4,0,.2,1);
}

/* 收起状态：面板主体滑出屏幕右侧，只留折叠箭头 */
.side-panel.collapsed {
  transform: translateY(-50%) translateX(calc(100% - 26px));
}

/* 折叠/展开箭头按钮 */
.side-toggle {
  width: 22px;
  align-self: stretch;
  min-height: 56px;
  background: rgba(0, 10, 28, 0.88);
  border: 1px solid rgba(0, 242, 255, 0.28);
  border-right: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
}
.side-toggle:hover { background: rgba(0, 242, 255, 0.1); }

.side-toggle-arrow {
  font-size: 16px;
  color: rgba(0, 242, 255, 0.8);
  line-height: 1;
  transition: transform 0.28s ease;
  display: inline-block;
}
.side-panel.collapsed .side-toggle-arrow {
  transform: rotate(180deg);
}

/* 面板主体卡片 */
.side-panel-inner {
  width: 168px;
  background: linear-gradient(160deg, rgba(0, 12, 35, 0.96), rgba(0, 6, 22, 0.98));
  border: 1px solid rgba(0, 242, 255, 0.2);
  border-right: none;
  border-radius: 0;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 88vh;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,242,255,0.15) transparent;
  /* 顶部底部圆角 */
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  box-shadow: -4px 0 32px rgba(0, 242, 255, 0.08), -2px 0 8px rgba(0,0,0,0.5);
}

/* 每个分组区块 */
.sp-section {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.08);
}
.sp-section:last-child { border-bottom: none; }

.sp-section-title {
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(0, 242, 255, 0.4);
  margin-bottom: 7px;
  font-weight: 600;
}

/* 按钮网格 */
.sp-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

/* 通用按钮 */
.sp-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 242, 255, 0.18);
  color: rgba(180, 220, 255, 0.85);
  padding: 6px 4px;
  cursor: pointer;
  font-size: 10px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  line-height: 1.3;
}
.sp-btn:hover {
  background: rgba(0, 242, 255, 0.12);
  border-color: rgba(0, 242, 255, 0.45);
  color: #00f2ff;
}

/* 强调按钮（用户中心/模板库） */
.sp-btn.sp-btn-accent {
  background: rgba(0, 242, 255, 0.08);
  border-color: rgba(0, 242, 255, 0.3);
  color: #00f2ff;
  font-weight: 600;
  grid-column: span 1;
}
.sp-btn.sp-btn-accent:hover {
  background: rgba(0, 242, 255, 0.2);
  box-shadow: 0 0 10px rgba(0,242,255,0.2);
}

/* 危险按钮 */
.sp-btn.sp-btn-danger {
  border-color: rgba(255, 45, 85, 0.3);
  color: rgba(255, 100, 120, 0.85);
}
.sp-btn.sp-btn-danger:hover {
  background: rgba(255, 45, 85, 0.15);
  border-color: #ff2d55;
  color: #ff2d55;
}

/* 激活状态（动态大屏运行中） */
.sp-btn.dynamic-active {
  background: rgba(76, 217, 100, 0.12) !important;
  border-color: rgba(76, 217, 100, 0.5) !important;
  color: #4cd964 !important;
}

.sp-btn.toggle-on {
  background: rgba(76, 217, 100, 0.14) !important;
  border-color: rgba(76, 217, 100, 0.55) !important;
  color: #4cd964 !important;
}

.sp-save-status {
  margin-top: 6px;
  font-size: 10px;
  color: rgba(180, 210, 255, 0.52);
  line-height: 1.35;
  min-height: 14px;
}

.sp-save-status.pending { color: #ffd166; }
.sp-save-status.ok { color: #4cd964; }
.sp-save-status.err { color: #ff6b8a; }

/* ── 用户信息区 ── */
.sp-user { padding-bottom: 10px; }

.sp-user-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
}

.sp-avatar { font-size: 14px; flex-shrink: 0; }

.sp-username {
  flex: 1;
  font-size: 11px;
  color: var(--border-cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-logout {
  font-size: 9px !important;
  padding: 2px 5px !important;
  border: 1px solid rgba(255,45,85,0.4) !important;
  border-radius: 3px !important;
  background: transparent !important;
  color: rgba(255,45,85,0.75) !important;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s;
}
.sp-logout:hover {
  background: rgba(255,45,85,0.15) !important;
  color: #ff2d55 !important;
}

.sp-user-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

/* 管理员专属模块的"管理员"小标签（贴在 sp-section-title 后面） */
.sp-admin-only-tag {
  display: inline-block;
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.15), rgba(255, 100, 60, 0.1));
  border: 1px solid rgba(255, 45, 85, 0.4);
  color: #ff7585;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
  letter-spacing: 0.4px;
  vertical-align: middle;
}

/* 管理员徽章（顶栏） */
.sp-admin-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.2), rgba(255, 80, 120, 0.15));
  border: 1px solid rgba(255, 45, 85, 0.45);
  color: #ff2d55;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  letter-spacing: 0.4px;
  text-shadow: 0 0 4px rgba(255, 45, 85, 0.4);
  flex-shrink: 0;
  margin-right: 4px;
  animation: spAdminBadgePulse 2.4s ease-in-out infinite;
}

@keyframes spAdminBadgePulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255,45,85,0); }
  50% { box-shadow: 0 0 8px rgba(255,45,85,0.55); }
}

/* 代入身份提示横条 */
.sp-impersonate-tip {
  font-size: 10px;
  color: #ffd166;
  background: rgba(255, 209, 102, 0.08);
  border: 1px dashed rgba(255, 209, 102, 0.4);
  border-radius: 4px;
  padding: 4px 7px;
  margin-bottom: 6px;
  line-height: 1.35;
}

/* 进入管理后台按钮（admin 专属） */
.sp-btn.sp-btn-admin {
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.18), rgba(255, 100, 60, 0.12));
  border-color: rgba(255, 80, 100, 0.5);
  color: #ff7585;
  font-weight: 600;
}
.sp-btn.sp-btn-admin:hover {
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.32), rgba(255, 100, 60, 0.22));
  box-shadow: 0 0 10px rgba(255, 45, 85, 0.28);
  color: #ffeef0;
}

.sp-btn.sp-btn-admin-ghost {
  background: transparent;
  border-color: rgba(255, 80, 100, 0.35);
  color: rgba(255, 130, 150, 0.85);
  font-weight: 500;
}
.sp-btn.sp-btn-admin-ghost:hover {
  background: rgba(255, 45, 85, 0.1);
  color: #ff7585;
}

/* 新建大屏 —— 危险操作按钮 */
.sp-btn.sp-btn-danger {
  background: rgba(255, 100, 30, 0.12);
  border-color: rgba(255, 120, 40, 0.45);
  color: #ff9a60;
  font-weight: 600;
}
.sp-btn.sp-btn-danger:hover {
  background: rgba(255, 100, 30, 0.28);
  border-color: rgba(255, 140, 60, 0.75);
  color: #ffb880;
  box-shadow: 0 0 10px rgba(255, 100, 30, 0.25);
}

/* 登录框底部提示（管理员入口） */
.auth-foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(0, 242, 255, 0.18);
}
.auth-tip {
  font-size: 11px;
  color: rgba(180, 210, 255, 0.55);
}
.auth-tip code {
  background: rgba(0, 242, 255, 0.1);
  border: 1px solid rgba(0, 242, 255, 0.25);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 11px;
  color: #00f2ff;
  margin: 0 2px;
}
.auth-link {
  font-size: 11px;
  color: #ff7585;
  text-decoration: none;
  border: 1px solid rgba(255, 80, 100, 0.4);
  padding: 3px 9px;
  border-radius: 12px;
  transition: all 0.18s;
  white-space: nowrap;
}
.auth-link:hover {
  background: rgba(255, 80, 100, 0.12);
  color: #ffaab5;
  border-color: rgba(255, 80, 100, 0.6);
}

/* 兼容旧 floating-bar 引用（保留空规则防止其他地方报错） */
.floating-bar { display: none; }

/* 兼容旧 user-info-bar 引用（新版已整合到 .sp-user） */
.user-info-bar { display: none; }

/* 重置成功提示 Toast */
.reset-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(76, 217, 100, 0.15);
  border: 1px solid rgba(76, 217, 100, 0.5);
  color: #4cd964;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 9999;
  animation: toastIn 0.3s ease, toastOut 0.4s ease 2.6s forwards;
  pointer-events: none;
}

@keyframes toastIn  { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ════════════════════════════════════════════════════════════════════════════
   登录 / 注册弹窗
════════════════════════════════════════════════════════════════════════════ */
/* ════════════════════════════════════════════════════════════════════════════
   用户中心 / 配置库
════════════════════════════════════════════════════════════════════════════ */

/* 保存栏 */
.uc-save-bar {
  background: rgba(0, 242, 255, 0.04);
  border: 1px solid rgba(0, 242, 255, 0.18);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.uc-save-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.uc-save-row {
  display: flex;
  gap: 10px;
}

.uc-name-input {
  flex: 1;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 242, 255, 0.25);
  border-radius: 5px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.uc-name-input:focus { border-color: var(--border-cyan); }

.uc-save-btn {
  padding: 9px 18px;
  background: rgba(0, 242, 255, 0.1);
  border: 1px solid rgba(0, 242, 255, 0.4);
  border-radius: 5px;
  color: var(--border-cyan);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s;
}

.uc-save-btn:hover {
  background: rgba(0, 242, 255, 0.18);
  box-shadow: var(--glow-cyan);
}

.uc-msg {
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
  color: var(--text-dim);
}

/* 分隔行 */
.uc-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--text-dim);
  font-size: 12px;
}

.uc-divider::before,
.uc-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(0, 242, 255, 0.15);
}

/* 卡片网格 */
.uc-case-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

.uc-case-list::-webkit-scrollbar { width: 4px; }
.uc-case-list::-webkit-scrollbar-thumb { background: rgba(0, 242, 255, 0.25); border-radius: 4px; }

.uc-empty,
.uc-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 0;
  color: var(--text-dim);
  font-size: 13px;
}

/* 配置卡片 */
.uc-card {
  background: rgba(0, 242, 255, 0.04);
  border: 1px solid rgba(0, 242, 255, 0.18);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.3s, transform 0.3s;
  cursor: default;
}

.uc-card:hover {
  border-color: rgba(0, 242, 255, 0.45);
  box-shadow: 0 0 16px rgba(0, 242, 255, 0.08);
}

.uc-card-removing {
  opacity: 0;
  transform: scale(0.95);
}

.uc-card-top {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.uc-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: text;
  line-height: 1.3;
  word-break: break-all;
}

.uc-card-name:hover { color: var(--border-cyan); }

.uc-card-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.uc-course {
  font-size: 12px;
  color: var(--accent-orange);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uc-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.uc-tab-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.2);
  color: rgba(0, 242, 255, 0.75);
  white-space: nowrap;
}

.uc-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.uc-btn-load,
.uc-btn-del {
  flex: 1;
  padding: 6px 0;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.uc-btn-load {
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.35);
  color: var(--border-cyan);
}

.uc-btn-load:hover {
  background: rgba(0, 242, 255, 0.18);
  border-color: var(--border-cyan);
}

.uc-btn-del {
  background: transparent;
  border: 1px solid rgba(255, 45, 85, 0.25);
  color: rgba(255, 45, 85, 0.65);
}

.uc-btn-del:hover {
  background: rgba(255, 45, 85, 0.1);
  border-color: rgba(255, 45, 85, 0.55);
  color: #ff2d55;
}

/* 重命名输入框 */
.uc-rename-input {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--border-cyan);
  color: var(--border-cyan);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  width: 100%;
  outline: none;
  padding: 0;
}

.auth-overlay {
  background: rgba(2, 6, 18, 0.92);
  backdrop-filter: blur(12px);
  z-index: 9000; /* 高于所有其他弹窗 */
}

.auth-modal {
  width: min(420px, 95vw) !important;
  padding: 0 !important;
  border-color: rgba(0, 242, 255, 0.35) !important;
  box-shadow: 0 0 60px rgba(0, 242, 255, 0.12), 0 24px 48px rgba(0, 0, 0, 0.6) !important;
}

.auth-logo {
  text-align: center;
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.15);
  background: linear-gradient(180deg, rgba(0, 242, 255, 0.05) 0%, transparent 100%);
}

.auth-logo-img {
  width: clamp(130px, 14vw, 170px);
  height: auto;
  object-fit: contain;
  mix-blend-mode: screen;
}

/* 登录/注册页签 */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0, 242, 255, 0.15);
}

.auth-tab-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--text-dim);
  transition: color 0.2s, background 0.2s;
}

.auth-tab-btn:hover { color: var(--text); }

.auth-tab-btn.active {
  color: var(--border-cyan);
  background: rgba(0, 242, 255, 0.06);
  border-bottom: 2px solid var(--border-cyan);
  text-shadow: var(--glow-cyan);
}

/* 表单面板 */
.auth-panel {
  padding: 24px 28px;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.auth-field input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 242, 255, 0.05);
  border: 1px solid rgba(0, 242, 255, 0.25);
  border-radius: 5px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-field input:focus {
  border-color: var(--border-cyan);
  box-shadow: 0 0 0 3px rgba(0, 242, 255, 0.12);
}

.auth-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, rgba(0, 242, 255, 0.2), rgba(0, 242, 255, 0.08));
  border: 1px solid rgba(0, 242, 255, 0.5);
  border-radius: 5px;
  color: var(--border-cyan);
  font-size: 15px;
  letter-spacing: 3px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  margin-top: 4px;
}

.auth-submit:hover {
  background: rgba(0, 242, 255, 0.2);
  box-shadow: var(--glow-cyan);
}

.auth-error {
  text-align: center;
  font-size: 12px;
  color: var(--accent-pink);
  padding: 0 28px 12px;
  min-height: 20px;
}

.auth-copyright {
  text-align: center;
  padding: 10px 24px 18px;
  border-top: 1px solid rgba(0, 242, 255, 0.08);
}

.auth-copyright a {
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.auth-copyright a:hover {
  color: var(--border-cyan);
  text-shadow: var(--glow-cyan);
}

/* 未鉴权时隐藏大屏内容，避免未登录时看到内容 */
body:not(.authenticated) .screen,
body:not(.authenticated) .floating-bar,
body:not(.authenticated) .side-panel,
body:not(.authenticated) .dynamic-badge {
  visibility: hidden;
}

/* 模态 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.show {
  display: flex;
}

/* 资源库弹窗：始终在最顶层，可从组件编辑弹窗内唤起 */
#modalMedia {
  z-index: 4000;
}

.modal {
  background: #0a1528;
  border: 1px solid rgba(0, 242, 255, 0.4);
  border-radius: 8px;
  width: min(920px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 242, 255, 0.2);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.2);
  font-size: 16px;
  font-weight: 600;
  color: var(--border-cyan);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 14px 18px;
  overflow: auto;
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--accent-pink);
}

.widget-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  align-items: flex-end;
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.meta-field input {
  min-width: 200px;
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.3);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
}

.meta-field input#widgetFlexInput {
  min-width: 100px;
  max-width: 120px;
}

textarea.config-json {
  width: 100%;
  min-height: 420px;
  background: #050a14;
  border: 1px solid rgba(0, 242, 255, 0.3);
  color: #b8e8ff;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  padding: 12px;
  border-radius: 4px;
  resize: vertical;
}

/* ── 组件库工具栏 ─────────────────────────────────────────── */
.lib-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 0;
  background: rgba(0,10,30,.4);
  border-bottom: 1px solid rgba(0,242,255,.1);
}

.lib-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(0,242,255,.25);
  border-radius: 8px;
  padding: 0 10px;
  transition: border-color .15s;
}
.lib-search-wrap:focus-within { border-color: rgba(0,242,255,.6); }

.lib-search-icon { font-size: 13px; color: rgba(0,242,255,.5); flex-shrink: 0; }

.lib-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e8f4ff;
  font-size: 13px;
  padding: 7px 0;
}
.lib-search-input::placeholder { color: rgba(180,210,255,.35); }

.lib-search-clear {
  background: none;
  border: none;
  color: rgba(180,210,255,.4);
  cursor: pointer;
  font-size: 16px;
  padding: 0 2px;
  line-height: 1;
  transition: color .15s;
  flex-shrink: 0;
}
.lib-search-clear:hover { color: rgba(0,242,255,.8); }

/* 分类标签 */
.lib-cat-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 8px;
}
.lib-cat-tabs::-webkit-scrollbar { display: none; }

.lib-cat-tab {
  flex-shrink: 0;
  background: rgba(0,242,255,.05);
  border: 1px solid rgba(0,242,255,.18);
  border-radius: 16px;
  padding: 3px 12px;
  font-size: 12px;
  color: rgba(180,210,255,.7);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  user-select: none;
}
.lib-cat-tab:hover { background: rgba(0,242,255,.12); color: #00f2ff; }
.lib-cat-tab.active {
  background: rgba(0,242,255,.18);
  border-color: rgba(0,242,255,.5);
  color: #00f2ff;
  font-weight: 600;
}

/* ── 组件库网格 ─────────────────────────────────────────── */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

/* 缩略图卡片 */
.library-item {
  background: rgba(0,15,40,.6);
  border: 1px solid rgba(0,242,255,.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.library-item:hover {
  background: rgba(0,30,70,.7);
  border-color: rgba(0,242,255,.55);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}

/* 缩略图区域 */
.lib-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(0,5,20,.8);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(0,242,255,.1);
  flex-shrink: 0;
}
.lib-thumb svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 信息区 */
.lib-info {
  padding: 8px 10px;
  flex: 1;
}
.lib-info h4 {
  margin: 0 0 3px;
  font-size: 12px;
  font-weight: 600;
  color: #c8e8ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-info p {
  margin: 0;
  font-size: 10px;
  color: rgba(140,180,220,.6);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 分类角标 */
.lib-cat-badge {
  display: inline-block;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-bottom: 3px;
  background: rgba(0,242,255,.1);
  border: 1px solid rgba(0,242,255,.2);
  color: rgba(0,242,255,.7);
}

/* 添加按钮 */
.lib-add-btn {
  margin: 4px 8px 8px;
  background: rgba(0,242,255,.08);
  border: 1px solid rgba(0,242,255,.2);
  border-radius: 5px;
  color: #00c8ff;
  font-size: 11px;
  padding: 4px 0;
  cursor: pointer;
  transition: all .15s;
  width: calc(100% - 16px);
}
.lib-add-btn:hover {
  background: rgba(0,242,255,.18);
  border-color: rgba(0,242,255,.5);
}

.library-item.lib-hidden { display: none; }

.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* 活动列表 */
.activity-list {
  overflow: auto;
  max-height: 100%;
  padding: 4px 8px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: clamp(6px, 0.8vh, 10px) 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: clamp(11px, 0.72vw, 13px);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icons {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.activity-meta {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 4px;
}

/* 优秀榜 */
/* ── 优秀榜 ───────────────────────────────────── */
.leader-wrap {
  display: flex;
  gap: 10px;
  padding: 8px;
  height: 100%;
  min-height: 220px;
  align-items: stretch;
}

.leader-podium-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: radial-gradient(ellipse at 50% 100%, rgba(0, 242, 255, 0.10), transparent 70%);
  border-radius: 6px;
  overflow: hidden;
  min-height: 180px;
}

/* Person info row sits above the steps */
.leader-person-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px 0;
}

.leader-person {
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-bottom: 6px;
}

.lp-medal {
  font-size: clamp(16px, 1.4vw, 22px);
  line-height: 1;
}

.lp-avatar {
  width: clamp(32px, 2.8vw, 44px);
  height: clamp(32px, 2.8vw, 44px);
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(13px, 1vw, 17px);
}

.leader-person.rank1 .lp-avatar {
  width: clamp(38px, 3.2vw, 52px);
  height: clamp(38px, 3.2vw, 52px);
  font-size: clamp(15px, 1.1vw, 19px);
}

.lp-name {
  font-size: clamp(9px, 0.6vw, 11px);
  color: rgba(220, 240, 255, 0.9);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}

.lp-score {
  font-size: clamp(10px, 0.65vw, 12px);
  font-weight: 700;
}

/* Step platforms */
.leader-step-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
}

.leader-step {
  width: 76px;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.leader-step.rank1 { width: 84px; }

.leader-step-label {
  font-size: clamp(9px, 0.58vw, 11px);
  font-weight: 600;
  letter-spacing: 0.04em;
  position: absolute;
  bottom: 6px;
}

/* Reflective floor strip */
.leader-floor {
  height: 4px;
  background: linear-gradient(90deg, transparent, rgba(0,242,255,0.25) 30%, rgba(255,215,0,0.3) 50%, rgba(0,242,255,0.25) 70%, transparent);
  box-shadow: 0 0 10px rgba(0,242,255,0.2);
}

/* Right list */
.leader-list {
  width: 42%;
  overflow: auto;
  font-size: 12px;
}

.leader-list-row {
  display: flex;
  justify-content: space-between;
  padding: clamp(4px, 0.5vh, 6px) 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: clamp(10px, 0.65vw, 12px);
}

/* KPI 数字卡片 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 8px;
  height: 100%;
}

.kpi-cell {
  background: rgba(0, 242, 255, 0.06);
  border: 1px solid rgba(0, 242, 255, 0.2);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
}

.kpi-value {
  font-size: clamp(14px, 1.15vw, 22px);
  font-weight: 700;
  color: var(--accent-orange);
}

.kpi-label {
  font-size: clamp(10px, 0.65vw, 12px);
  color: var(--text-dim);
  margin-top: 4px;
}

/* 编辑模式高亮 */
body.edit-mode .widget {
  outline: 1px dashed rgba(255, 45, 85, 0.5);
}

/* 演示：隐藏工具条与卡片操作，仅展示内容 */
body.presentation-mode .floating-bar,
body.presentation-mode .side-panel {
  display: none !important;
}

body.presentation-mode .widget-actions,
body.presentation-mode .widget-drag-handle {
  display: none !important;
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  margin-right: 6px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(76, 217, 100, 0.6);
  }
  50% {
    opacity: 0.85;
    box-shadow: 0 0 0 8px rgba(76, 217, 100, 0);
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   主题色卡 — 6 套预设方案
   ════════════════════════════════════════════════════════════════════════════ */

/* 火焰学堂 */
/* ══ 主题 2：翡翠知林 ══ */
[data-theme="green"] {
  --bg-deep: #020f08;
  --bg-panel: rgba(4, 22, 12, 0.78);
  --border-cyan: #00e87a;
  --accent-pink: #00cfb4;
  --accent-orange: #c8ff00;
  --accent-green: #4dffb4;
  --accent-purple: #00b890;
  --text: #e8fff2;
  --text-dim: rgba(200, 255, 220, 0.55);
  --glow-cyan:   0 0 14px rgba(0, 232, 122, 0.55);
  --glow-orange: 0 0 14px rgba(200, 255, 0,  0.50);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #041a0c 0%, #020f08 55%);
  --header-bg: linear-gradient(90deg, rgba(0, 38, 18, 0.9), rgba(2, 15, 8, 0.4));
  --grid-line: rgba(0, 232, 122, 0.025);
  --widget-border:        rgba(0, 232, 122, 0.26);
  --widget-border-left:   #00e87a;
  --widget-glow-in:       rgba(0, 232, 122, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(0, 232, 122, 0.25);
  --widget-header-bg:     rgba(0, 232, 122, 0.10);
  --widget-header-border: rgba(0, 232, 122, 0.14);
}

/* ══ 主题 3：紫晶星空 ══ */
[data-theme="purple"] {
  --bg-deep: #080312;
  --bg-panel: rgba(16, 6, 32, 0.80);
  --border-cyan: #b967ff;
  --accent-pink: #ff2d95;
  --accent-orange: #ea80fc;
  --accent-green: #a8ff78;
  --accent-purple: #6c8fff;
  --text: #f5e8ff;
  --text-dim: rgba(235, 210, 255, 0.55);
  --glow-cyan:   0 0 14px rgba(185, 103, 255, 0.55);
  --glow-orange: 0 0 14px rgba(255, 45,  149, 0.50);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #18053a 0%, #080312 55%);
  --header-bg: linear-gradient(90deg, rgba(28, 5, 52, 0.9), rgba(8, 3, 18, 0.4));
  --grid-line: rgba(185, 103, 255, 0.025);
  --widget-border:        rgba(185, 103, 255, 0.26);
  --widget-border-left:   #b967ff;
  --widget-glow-in:       rgba(185, 103, 255, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(185, 103, 255, 0.25);
  --widget-header-bg:     rgba(185, 103, 255, 0.10);
  --widget-header-border: rgba(185, 103, 255, 0.14);
}

/* ══ 主题 4：烈焰橙辉 ══ */
[data-theme="orange"] {
  --bg-deep: #0f0600;
  --bg-panel: rgba(28, 12, 4, 0.80);
  --border-cyan: #ff8c00;
  --accent-pink: #ff4500;
  --accent-orange: #ffcc00;
  --accent-green: #a8e063;
  --accent-purple: #ff6b35;
  --text: #fff5e0;
  --text-dim: rgba(255, 235, 190, 0.55);
  --glow-cyan:   0 0 14px rgba(255, 140, 0, 0.60);
  --glow-orange: 0 0 14px rgba(255, 204, 0, 0.55);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #261000 0%, #0f0600 55%);
  --header-bg: linear-gradient(90deg, rgba(48, 16, 0, 0.9), rgba(20, 8, 0, 0.4));
  --grid-line: rgba(255, 140, 0, 0.025);
  --widget-border:        rgba(255, 140, 0, 0.26);
  --widget-border-left:   #ff8c00;
  --widget-glow-in:       rgba(255, 140, 0, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(255, 140, 0, 0.28);
  --widget-header-bg:     rgba(255, 140, 0, 0.10);
  --widget-header-border: rgba(255, 140, 0, 0.14);
}

/* ══ 主题 5：玫瑰晨曦 ══ */
[data-theme="rose"] {
  --bg-deep: #120108;
  --bg-panel: rgba(26, 4, 16, 0.80);
  --border-cyan: #ff4d7d;
  --accent-pink: #ff2d55;
  --accent-orange: #ff9ec8;
  --accent-green: #ffb347;
  --accent-purple: #c2185b;
  --text: #ffe8f4;
  --text-dim: rgba(255, 210, 235, 0.55);
  --glow-cyan:   0 0 14px rgba(255, 77, 125, 0.58);
  --glow-orange: 0 0 14px rgba(255, 158, 200, 0.50);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #2e0318 0%, #120108 55%);
  --header-bg: linear-gradient(90deg, rgba(46, 3, 24, 0.9), rgba(18, 1, 8, 0.4));
  --grid-line: rgba(255, 77, 125, 0.025);
  --widget-border:        rgba(255, 77, 125, 0.26);
  --widget-border-left:   #ff4d7d;
  --widget-glow-in:       rgba(255, 77, 125, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(255, 77, 125, 0.26);
  --widget-header-bg:     rgba(255, 77, 125, 0.10);
  --widget-header-border: rgba(255, 77, 125, 0.14);
}

/* ══ 主题 6：帝王金铜 ══ */
[data-theme="gold"] {
  --bg-deep: #0a0800;
  --bg-panel: rgba(22, 16, 2, 0.80);
  --border-cyan: #ffd700;
  --accent-pink: #ff8c00;
  --accent-orange: #ffc107;
  --accent-green: #8bc34a;
  --accent-purple: #daa520;
  --text: #fff8e0;
  --text-dim: rgba(255, 240, 190, 0.55);
  --glow-cyan:   0 0 14px rgba(255, 215, 0, 0.55);
  --glow-orange: 0 0 14px rgba(255, 140, 0, 0.50);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #1e1400 0%, #0a0800 55%);
  --header-bg: linear-gradient(90deg, rgba(36, 24, 0, 0.9), rgba(14, 10, 0, 0.4));
  --grid-line: rgba(255, 215, 0, 0.025);
  --widget-border:        rgba(255, 215, 0, 0.24);
  --widget-border-left:   #ffd700;
  --widget-glow-in:       rgba(255, 215, 0, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(255, 215, 0, 0.24);
  --widget-header-bg:     rgba(255, 215, 0, 0.08);
  --widget-header-border: rgba(255, 215, 0, 0.14);
}

/* ══ 主题 7：极地冰川 ══ */
[data-theme="arctic"] {
  --bg-deep: #060c1a;
  --bg-panel: rgba(8, 18, 38, 0.78);
  --border-cyan: #64d8ff;
  --accent-pink: #00b4d8;
  --accent-orange: #a8e8ff;
  --accent-green: #b2dfdb;
  --accent-purple: #4fc3f7;
  --text: #e8f6ff;
  --text-dim: rgba(180, 220, 255, 0.55);
  --glow-cyan:   0 0 14px rgba(100, 216, 255, 0.55);
  --glow-orange: 0 0 14px rgba(0,  180, 216, 0.50);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #0a1830 0%, #060c1a 55%);
  --header-bg: linear-gradient(90deg, rgba(8, 22, 46, 0.9), rgba(6, 12, 26, 0.4));
  --grid-line: rgba(100, 216, 255, 0.025);
  --widget-border:        rgba(100, 216, 255, 0.24);
  --widget-border-left:   #64d8ff;
  --widget-glow-in:       rgba(100, 216, 255, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(100, 216, 255, 0.24);
  --widget-header-bg:     rgba(100, 216, 255, 0.09);
  --widget-header-border: rgba(100, 216, 255, 0.14);
}

/* ══ 主题 8：霓虹赛博 ══ */
[data-theme="neon"] {
  --bg-deep: #090012;
  --bg-panel: rgba(14, 0, 24, 0.82);
  --border-cyan: #ff00ff;
  --accent-pink: #ff4500;
  --accent-orange: #00ffff;
  --accent-green: #7fff00;
  --accent-purple: #ff66ff;
  --text: #fff0ff;
  --text-dim: rgba(240, 200, 255, 0.55);
  --glow-cyan:   0 0 16px rgba(255, 0, 255, 0.60);
  --glow-orange: 0 0 16px rgba(0, 255, 255, 0.55);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #1a0030 0%, #090012 55%);
  --header-bg: linear-gradient(90deg, rgba(28, 0, 48, 0.9), rgba(10, 0, 20, 0.4));
  --grid-line: rgba(255, 0, 255, 0.03);
  --widget-border:        rgba(255, 0, 255, 0.28);
  --widget-border-left:   #ff00ff;
  --widget-glow-in:       rgba(255, 0, 255, 0.05);
  --widget-hover-shadow:  0 0 20px rgba(255, 0, 255, 0.30);
  --widget-header-bg:     rgba(255, 0, 255, 0.10);
  --widget-header-border: rgba(255, 0, 255, 0.16);
}

/* ══ 主题 9：翡青竹影 ══ */
[data-theme="teal"] {
  --bg-deep: #010e0a;
  --bg-panel: rgba(2, 20, 14, 0.80);
  --border-cyan: #00c896;
  --accent-pink: #ff8c69;
  --accent-orange: #00ffcc;
  --accent-green: #00e87a;
  --accent-purple: #64ffda;
  --text: #e0fff8;
  --text-dim: rgba(180, 255, 230, 0.55);
  --glow-cyan:   0 0 14px rgba(0, 200, 150, 0.55);
  --glow-orange: 0 0 14px rgba(0, 255, 204, 0.50);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #021c12 0%, #010e0a 55%);
  --header-bg: linear-gradient(90deg, rgba(2, 28, 18, 0.9), rgba(1, 14, 10, 0.4));
  --grid-line: rgba(0, 200, 150, 0.025);
  --widget-border:        rgba(0, 200, 150, 0.26);
  --widget-border-left:   #00c896;
  --widget-glow-in:       rgba(0, 200, 150, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(0, 200, 150, 0.25);
  --widget-header-bg:     rgba(0, 200, 150, 0.10);
  --widget-header-border: rgba(0, 200, 150, 0.14);
}

/* ══ 主题 10：深渊赤焰 ══ */
[data-theme="crimson"] {
  --bg-deep: #0e0004;
  --bg-panel: rgba(22, 2, 8, 0.82);
  --border-cyan: #ff2244;
  --accent-pink: #ff6680;
  --accent-orange: #ffd700;
  --accent-green: #00c896;
  --accent-purple: #ff4466;
  --text: #ffe8ec;
  --text-dim: rgba(255, 200, 210, 0.55);
  --glow-cyan:   0 0 14px rgba(255, 34, 68, 0.60);
  --glow-orange: 0 0 14px rgba(255, 215, 0, 0.50);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #280008 0%, #0e0004 55%);
  --header-bg: linear-gradient(90deg, rgba(40, 0, 12, 0.9), rgba(14, 0, 4, 0.4));
  --grid-line: rgba(255, 34, 68, 0.025);
  --widget-border:        rgba(255, 34, 68, 0.26);
  --widget-border-left:   #ff2244;
  --widget-glow-in:       rgba(255, 34, 68, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(255, 34, 68, 0.28);
  --widget-header-bg:     rgba(255, 34, 68, 0.10);
  --widget-header-border: rgba(255, 34, 68, 0.14);
}

/* ══ 主题 11：星际蓝紫 ══ */
[data-theme="galaxy"] {
  --bg-deep: #04021a;
  --bg-panel: rgba(8, 4, 36, 0.80);
  --border-cyan: #4d88ff;
  --accent-pink: #a64dff;
  --accent-orange: #00d4ff;
  --accent-green: #50fa7b;
  --accent-purple: #6c8fff;
  --text: #e8eeff;
  --text-dim: rgba(200, 215, 255, 0.55);
  --glow-cyan:   0 0 14px rgba(77, 136, 255, 0.58);
  --glow-orange: 0 0 14px rgba(166, 77, 255, 0.52);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #0e0438 0%, #04021a 55%);
  --header-bg: linear-gradient(90deg, rgba(14, 4, 56, 0.9), rgba(4, 2, 26, 0.4));
  --grid-line: rgba(77, 136, 255, 0.025);
  --widget-border:        rgba(77, 136, 255, 0.26);
  --widget-border-left:   #4d88ff;
  --widget-glow-in:       rgba(77, 136, 255, 0.04);
  --widget-hover-shadow:  0 0 18px rgba(77, 136, 255, 0.26);
  --widget-header-bg:     rgba(77, 136, 255, 0.10);
  --widget-header-border: rgba(77, 136, 255, 0.14);
}

/* ══ 主题 12：素雅银蓝 ══ */
[data-theme="silver"] {
  --bg-deep: #090d14;
  --bg-panel: rgba(12, 18, 28, 0.80);
  --border-cyan: #7ec8e3;
  --accent-pink: #5ba8c4;
  --accent-orange: #b8d4e8;
  --accent-green: #80cbc4;
  --accent-purple: #90a4ae;
  --text: #eaf4ff;
  --text-dim: rgba(180, 210, 235, 0.55);
  --glow-cyan:   0 0 12px rgba(126, 200, 227, 0.45);
  --glow-orange: 0 0 12px rgba(91,  168, 196, 0.40);
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #101820 0%, #090d14 55%);
  --header-bg: linear-gradient(90deg, rgba(14, 24, 36, 0.9), rgba(9, 13, 20, 0.4));
  --grid-line: rgba(126, 200, 227, 0.02);
  --widget-border:        rgba(126, 200, 227, 0.22);
  --widget-border-left:   #7ec8e3;
  --widget-glow-in:       rgba(126, 200, 227, 0.03);
  --widget-hover-shadow:  0 0 16px rgba(126, 200, 227, 0.20);
  --widget-header-bg:     rgba(126, 200, 227, 0.08);
  --widget-header-border: rgba(126, 200, 227, 0.12);
}

/* ══ 活力主题 1：电光蓝  高饱和荧光蓝，科技感十足 ══ */
[data-theme="light-sky"] {
  --bg-deep: #03080f;
  --bg-panel: rgba(2, 10, 22, 0.82);
  --border-cyan: #00c8ff;
  --accent-pink: #ff2aaa;
  --accent-orange: #ff8800;
  --accent-green: #00ff88;
  --accent-purple: #aa44ff;
  --text: #e8f8ff;
  --text-dim: rgba(180, 230, 255, 0.55);
  --glow-cyan:   0 0 18px rgba(0, 200, 255, 0.70);
  --glow-orange: 0 0 18px rgba(255, 136, 0, 0.60);
  --bg-gradient: radial-gradient(ellipse 130% 80% at 50% -10%, #061830 0%, #03080f 60%);
  --header-bg: linear-gradient(90deg, rgba(0, 60, 120, 0.9), rgba(3, 8, 15, 0.4));
  --grid-line: rgba(0, 200, 255, 0.04);
  --widget-border:        rgba(0, 200, 255, 0.30);
  --widget-border-left:   #00c8ff;
  --widget-glow-in:       rgba(0, 200, 255, 0.06);
  --widget-hover-shadow:  0 0 20px rgba(0, 200, 255, 0.30);
  --widget-header-bg:     rgba(0, 200, 255, 0.10);
  --widget-header-border: rgba(0, 200, 255, 0.18);
}

/* ══ 活力主题 2：荧光绿  超高饱和荧光绿，青春活力 ══ */
[data-theme="light-green"] {
  --bg-deep: #020d08;
  --bg-panel: rgba(2, 14, 8, 0.82);
  --border-cyan: #00ff88;
  --accent-pink: #ff2d7d;
  --accent-orange: #ffdd00;
  --accent-green: #7fff00;
  --accent-purple: #cc44ff;
  --text: #e8fff2;
  --text-dim: rgba(160, 255, 200, 0.55);
  --glow-cyan:   0 0 18px rgba(0, 255, 136, 0.70);
  --glow-orange: 0 0 18px rgba(255, 221, 0, 0.60);
  --bg-gradient: radial-gradient(ellipse 130% 80% at 50% -10%, #021a0c 0%, #020d08 60%);
  --header-bg: linear-gradient(90deg, rgba(0, 50, 25, 0.9), rgba(2, 13, 8, 0.4));
  --grid-line: rgba(0, 255, 136, 0.04);
  --widget-border:        rgba(0, 255, 136, 0.30);
  --widget-border-left:   #00ff88;
  --widget-glow-in:       rgba(0, 255, 136, 0.06);
  --widget-hover-shadow:  0 0 20px rgba(0, 255, 136, 0.30);
  --widget-header-bg:     rgba(0, 255, 136, 0.10);
  --widget-header-border: rgba(0, 255, 136, 0.18);
}

/* ══ 活力主题 3：炽烈橙  超亮橙金，热情四射 ══ */
[data-theme="light-orange"] {
  --bg-deep: #0d0500;
  --bg-panel: rgba(18, 8, 0, 0.82);
  --border-cyan: #ff8800;
  --accent-pink: #ff2244;
  --accent-orange: #ffdd00;
  --accent-green: #88ff44;
  --accent-purple: #ff44cc;
  --text: #fff5e8;
  --text-dim: rgba(255, 220, 160, 0.55);
  --glow-cyan:   0 0 18px rgba(255, 136, 0, 0.70);
  --glow-orange: 0 0 18px rgba(255, 221, 0, 0.60);
  --bg-gradient: radial-gradient(ellipse 130% 80% at 50% -10%, #1e0a00 0%, #0d0500 60%);
  --header-bg: linear-gradient(90deg, rgba(60, 25, 0, 0.9), rgba(13, 5, 0, 0.4));
  --grid-line: rgba(255, 136, 0, 0.04);
  --widget-border:        rgba(255, 136, 0, 0.32);
  --widget-border-left:   #ff8800;
  --widget-glow-in:       rgba(255, 136, 0, 0.06);
  --widget-hover-shadow:  0 0 20px rgba(255, 136, 0, 0.32);
  --widget-header-bg:     rgba(255, 136, 0, 0.10);
  --widget-header-border: rgba(255, 136, 0, 0.18);
}

/* ══ 活力主题 4：梦幻紫  超饱和霓虹紫，艺术梦幻 ══ */
[data-theme="light-purple"] {
  --bg-deep: #06020e;
  --bg-panel: rgba(10, 4, 22, 0.82);
  --border-cyan: #cc44ff;
  --accent-pink: #ff44aa;
  --accent-orange: #ff9900;
  --accent-green: #44ffcc;
  --accent-purple: #7744ff;
  --text: #f8eeff;
  --text-dim: rgba(220, 180, 255, 0.55);
  --glow-cyan:   0 0 18px rgba(204, 68, 255, 0.70);
  --glow-orange: 0 0 18px rgba(255, 68, 170, 0.60);
  --bg-gradient: radial-gradient(ellipse 130% 80% at 50% -10%, #140428 0%, #06020e 60%);
  --header-bg: linear-gradient(90deg, rgba(40, 10, 80, 0.9), rgba(6, 2, 14, 0.4));
  --grid-line: rgba(204, 68, 255, 0.04);
  --widget-border:        rgba(204, 68, 255, 0.30);
  --widget-border-left:   #cc44ff;
  --widget-glow-in:       rgba(204, 68, 255, 0.06);
  --widget-hover-shadow:  0 0 20px rgba(204, 68, 255, 0.30);
  --widget-header-bg:     rgba(204, 68, 255, 0.10);
  --widget-header-border: rgba(204, 68, 255, 0.18);
}

/* ════════════════════════════════════════════════════════════════════════════
   主题色卡弹窗
   ════════════════════════════════════════════════════════════════════════════ */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 4px 0;
}

.theme-swatch {
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 16px 12px 12px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
}

.theme-swatch:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.theme-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2), 0 8px 24px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}

/* 亮色主题卡片 */
.theme-swatch-light {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.1);
}
.theme-swatch-light .theme-name {
  color: #1a1a2e;
}
.theme-swatch-light .theme-desc {
  color: rgba(30, 30, 60, 0.6);
}
.theme-swatch-light:hover {
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.theme-swatch-light.active {
  border-color: #1a7fd4;
  box-shadow: 0 0 0 3px rgba(26, 127, 212, 0.25), 0 8px 24px rgba(0, 0, 0, 0.2);
}

.theme-preview {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-bottom: 10px;
}

.theme-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.theme-name {
  font-size: 13px;
  font-weight: 700;
  color: #e8f4ff;
  letter-spacing: 1px;
}

.theme-desc {
  font-size: 11px;
  color: rgba(232, 244, 255, 0.5);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════════════════════
   KPI 数值更新闪光动画
   ════════════════════════════════════════════════════════════════════════════ */
@keyframes kpiFlash {
  0%   { color: var(--accent-green); text-shadow: 0 0 10px var(--accent-green); }
  60%  { color: var(--accent-orange); }
  100% { color: var(--accent-orange); text-shadow: none; }
}

.kpi-value.kpi-flash {
  animation: kpiFlash 0.6s ease-out forwards;
}

/* 动态大屏 — 浮动状态标签 */
.dynamic-badge {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--border-cyan);
  color: var(--border-cyan);
  padding: 6px 18px;
  font-size: 12px;
  border-radius: 20px;
  box-shadow: var(--glow-cyan);
  z-index: 999;
  display: none;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

body.dynamic-mode .dynamic-badge {
  display: flex;
}

/* ════════════════════════════════════════════════════════════════════════════
   可视化表单编辑器
   ════════════════════════════════════════════════════════════════════════════ */

.visual-form {
  padding: 2px 0 8px;
}

/* 紧凑网格：3列自适应 */
.vf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px 16px;
  margin-bottom: 16px;
}

.vf-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.vf-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.vf-input {
  background: rgba(0, 242, 255, 0.07);
  border: 1px solid rgba(0, 242, 255, 0.28);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 13px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.vf-input:focus {
  outline: none;
  border-color: var(--border-cyan);
  box-shadow: 0 0 0 2px rgba(0, 242, 255, 0.14);
}

.vf-input-num {
  max-width: 110px;
}

.vf-input-wide {
  max-width: 100%;
}

.vf-color {
  width: 44px;
  height: 34px;
  padding: 2px 3px;
  border: 1px solid rgba(0, 242, 255, 0.3);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.vf-section {
  margin-bottom: 18px;
}

.vf-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--border-cyan);
  border-bottom: 1px solid rgba(0, 242, 255, 0.18);
  padding-bottom: 6px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.vf-sep {
  border-top: 1px dashed rgba(0, 242, 255, 0.15);
  margin: 14px 0;
}

/* 列表表格 */
.vf-list-section {
  margin-bottom: 4px;
}

.vf-table {
  width: 100%;
  border: 1px solid rgba(0, 242, 255, 0.14);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}

.vf-table-head {
  display: flex;
  background: rgba(0, 242, 255, 0.09);
  border-bottom: 1px solid rgba(0, 242, 255, 0.14);
  padding: 5px 8px;
  gap: 4px;
}

.vf-th {
  flex: 1;
  font-size: 11px;
  color: var(--border-cyan);
  padding: 2px 3px;
  font-weight: 600;
}

.vf-th-sm {
  flex: 0 0 52px;
  text-align: center;
}

.vf-table-body {
  max-height: 260px;
  overflow-y: auto;
}

.vf-table-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  gap: 4px;
  transition: background 0.1s;
}

.vf-table-row:last-child {
  border-bottom: none;
}

.vf-table-row:hover {
  background: rgba(0, 242, 255, 0.04);
}

.vf-td {
  flex: 1;
  padding: 2px 3px;
  min-width: 0;
}

.vf-td input {
  width: 100%;
  padding: 4px 7px;
  font-size: 12px;
}

.vf-td-sm {
  flex: 0 0 52px;
  text-align: center;
}

.vf-add-btn {
  background: rgba(0, 242, 255, 0.06);
  border: 1px dashed rgba(0, 242, 255, 0.32);
  color: var(--border-cyan);
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background 0.15s;
  font-family: inherit;
}

.vf-add-btn:hover {
  background: rgba(0, 242, 255, 0.13);
}

.vf-del-btn {
  background: rgba(255, 45, 85, 0.08);
  border: 1px solid rgba(255, 45, 85, 0.28);
  color: var(--accent-pink);
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.vf-del-btn:hover {
  background: rgba(255, 45, 85, 0.18);
}

/* 系列行（雷达/折线） */
.vf-series-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.vf-series-row {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 242, 255, 0.1);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.vf-series-row .vf-del-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

.vf-series-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding-right: 60px;
}

/* 组件编辑器 — 模式切换栏 */
.widget-edit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.12);
  padding-bottom: 8px;
  gap: 8px;
}

.widget-edit-toolbar span {
  font-size: 12px;
  color: var(--text-dim);
}

.btn-mode-toggle {
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.25);
  color: var(--border-cyan);
  padding: 4px 12px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-mode-toggle:hover {
  background: rgba(0, 242, 255, 0.16);
}

.widget-form-area {
  min-height: 80px;
}

.widget-json-area-wrap {
  display: none;
}

.widget-json-area-wrap.show {
  display: block;
}

/* 动态大屏按钮激活态（新侧面板） */
.sp-btn.dynamic-active {
  border-color: #4cd964 !important;
  color: #4cd964 !important;
  background: rgba(76, 217, 100, 0.1) !important;
  box-shadow: 0 0 8px rgba(76, 217, 100, 0.3) !important;
}

/* ════════════════════════════════════════════════════════════════════
   扩展组件样式 — 摄像头 / 行为分析 / AI 对话
   ════════════════════════════════════════════════════════════════════ */

/* 摄像头组件扫描线动效 */
@keyframes scanMove {
  0%   { background-position: 0 0; }
  100% { background-position: 0 100%; }
}

/* 行为分析：进度条容器滚动条 */
.widget [style*="overflow-y: auto"],
.widget [style*="overflow-y:auto"] {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 242, 255, 0.2) transparent;
}
.widget ::-webkit-scrollbar        { width: 4px; }
.widget ::-webkit-scrollbar-track  { background: transparent; }
.widget ::-webkit-scrollbar-thumb  { background: rgba(0, 242, 255, 0.2); border-radius: 2px; }

/* AI 对话：消息区滚动条 */
.widget textarea {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 242, 255, 0.2) transparent;
}
.widget textarea::-webkit-scrollbar       { width: 4px; }
.widget textarea::-webkit-scrollbar-thumb { background: rgba(0, 242, 255, 0.18); border-radius: 2px; }

/* ════════════════════════════════════════════════════════════════════
   模板库弹窗样式
   ════════════════════════════════════════════════════════════════════ */
.presets-modal { display: flex; flex-direction: column; overflow: hidden; }
.presets-modal .modal-header + p { padding: 0 2px; }

/* ══════════════════════════════════════════════════════════════════
   使用说明 Guide Modal
══════════════════════════════════════════════════════════════════ */
.guide-modal {
  position: relative;
  width: min(780px, 96vw);
  max-height: 92vh;
  background: linear-gradient(160deg, #0d1b35 0%, #0a1020 100%);
  border: 1px solid rgba(0,242,255,0.2);
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 60px rgba(0,242,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: guideIn 0.35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes guideIn {
  from { opacity:0; transform:scale(0.92) translateY(20px); }
  to   { opacity:1; transform:scale(1)    translateY(0); }
}

/* Header */
.guide-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0,242,255,0.12);
  background: rgba(0,242,255,0.04);
}
.guide-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: screen;
  flex-shrink: 0;
}
.guide-header-text { flex: 1; }
.guide-header-text h2 {
  font-size: clamp(14px,1.2vw,18px);
  font-weight: 700;
  color: #e8f4ff;
  margin: 0 0 4px;
  letter-spacing: 0.5px;
}
.guide-header-text p {
  font-size: 12px;
  color: rgba(180,220,255,0.55);
  margin: 0;
}
.guide-close {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  color: rgba(200,220,255,0.7);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.guide-close:hover { background: rgba(255,60,60,0.2); color: #ff6b6b; }

/* Progress bar */
.guide-progress {
  height: 3px;
  background: rgba(255,255,255,0.08);
}
.guide-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00f2ff, #4a9eff);
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(0,242,255,0.6);
}

/* Step dots */
.guide-step-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 4px;
}
.guide-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}
.guide-dot.active {
  background: #00f2ff;
  transform: scale(1.3);
  box-shadow: 0 0 6px rgba(0,242,255,0.7);
}
.guide-dot:hover { background: rgba(0,242,255,0.5); }

/* Steps container */
.guide-steps {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 320px;
}
.guide-step {
  position: absolute;
  inset: 0;
  padding: 20px 28px 16px;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  overflow-y: auto;
}
.guide-step.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
.guide-step.exit {
  opacity: 0;
  transform: translateX(-40px);
}

/* Step header */
.guide-step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.guide-step-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,242,255,0.15), rgba(74,158,255,0.1));
  border: 1px solid rgba(0,242,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.guide-step-title {
  font-size: clamp(14px,1.1vw,17px);
  font-weight: 700;
  color: #e8f4ff;
}
.guide-step-subtitle {
  font-size: 12px;
  color: rgba(180,220,255,0.5);
  margin-top: 2px;
}

/* Step body */
.guide-tips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.guide-tip {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(0,242,255,0.1);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: border-color 0.2s, background 0.2s;
}
.guide-tip:hover {
  border-color: rgba(0,242,255,0.3);
  background: rgba(0,242,255,0.05);
}
.guide-tip-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1.4;
}
.guide-tip-text strong {
  display: block;
  font-size: 12px;
  color: #c8e6ff;
  margin-bottom: 3px;
}
.guide-tip-text span {
  font-size: 11px;
  color: rgba(180,210,255,0.55);
  line-height: 1.6;
}

/* Highlight box */
.guide-highlight {
  background: rgba(0,242,255,0.06);
  border-left: 3px solid #00f2ff;
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-size: 12px;
  color: rgba(200,230,255,0.75);
  line-height: 1.7;
  margin-bottom: 14px;
}
.guide-highlight b { color: #00f2ff; }

/* Footer */
.guide-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px 10px;
  border-top: 1px solid rgba(0,242,255,0.1);
}
.guide-page-label {
  font-size: 12px;
  color: rgba(180,210,255,0.45);
}
.guide-btn {
  padding: 8px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  border: none;
}
.guide-btn:active { transform: scale(0.97); }
.guide-btn-primary {
  background: linear-gradient(90deg, #00c8e0, #4a9eff);
  color: #fff;
}
.guide-btn-primary:hover { opacity: 0.88; }
.guide-btn-ghost {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(200,220,255,0.7);
}
.guide-btn-ghost:hover { background: rgba(255,255,255,0.12); }
.guide-btn-ghost:disabled { opacity: 0.3; cursor: default; }

/* Finish button */
.guide-btn-finish {
  background: linear-gradient(90deg, #00d084, #00a86b);
  color: #fff;
}

/* "不再弹出" checkbox */
.guide-no-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 24px 14px;
  font-size: 11px;
  color: rgba(180,210,255,0.4);
  cursor: pointer;
  user-select: none;
}
.guide-no-more input { accent-color: #00f2ff; cursor: pointer; }
.guide-no-more:hover { color: rgba(180,210,255,0.7); }

/* Sidebar guide button */
.sp-guide-entry {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(0,242,255,0.1);
}
.sp-btn-guide {
  width: 100%;
  background: linear-gradient(90deg, rgba(0,242,255,0.1), rgba(74,158,255,0.08)) !important;
  border: 1px solid rgba(0,242,255,0.25) !important;
  color: rgba(0,242,255,0.85) !important;
}
.sp-btn-guide:hover {
  background: linear-gradient(90deg, rgba(0,242,255,0.2), rgba(74,158,255,0.15)) !important;
  border-color: rgba(0,242,255,0.5) !important;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,242,255,0.2) transparent;
}

.preset-card {
  border: 1px solid rgba(0,242,255,0.18);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0,20,50,0.85), rgba(0,10,30,0.9));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.22s, box-shadow 0.22s, transform 0.18s;
  position: relative;
  overflow: hidden;
}
.preset-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,242,255,0.04), transparent);
  opacity: 0; transition: opacity 0.22s;
}
.preset-card:hover { border-color: rgba(0,242,255,0.5); box-shadow: 0 4px 24px rgba(0,242,255,0.18); transform: translateY(-2px); }
.preset-card:hover::before { opacity: 1; }

.preset-icon { font-size: 32px; line-height: 1; margin-bottom: 2px; }
.preset-name { font-size: 14px; font-weight: 700; color: #e8f4ff; }
.preset-desc { font-size: 10px; color: rgba(180,210,255,0.6); line-height: 1.55; flex: 1; }

.preset-tags {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.preset-tag {
  font-size: 9px; padding: 2px 7px; border-radius: 10px;
  background: rgba(0,242,255,0.1); border: 1px solid rgba(0,242,255,0.22);
  color: #00f2ff;
}

.preset-tabs {
  font-size: 9px; color: rgba(180,210,255,0.4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.preset-footer {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid rgba(0,242,255,0.1); padding-top: 8px; margin-top: 2px;
}
.preset-load-btn {
  padding: 5px 16px; border-radius: 5px;
  background: rgba(0,242,255,0.12); border: 1px solid rgba(0,242,255,0.35);
  color: #00f2ff; font-size: 11px; font-weight: 600; cursor: pointer;
  transition: background 0.18s;
}
.preset-load-btn:hover { background: rgba(0,242,255,0.25); }

.preset-theme-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
}

/* ════════════════════════════════════════════════════════════════════
   智慧教育专用组件样式
   ════════════════════════════════════════════════════════════════════ */

/* 进度环矩阵 hover 发光 */
.widget svg circle.pa { will-change: stroke-dashoffset; }

/* 计时器数字防抖 */
.widget [style*="font-family:'Courier New'"] { font-variant-numeric: tabular-nums; }

/* 蜂巢矩阵 canvas 铺满 */
.widget canvas { max-width: 100%; max-height: 100%; }

/* 技能标签墙动画 */
@keyframes tagPop {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1);   }
}

/* 赛马图标签 */
.widget .race-label { font-size: 9px; color: rgba(180,210,255,0.6); }

/* 排名卡前三名发光边框 */
.widget [style*="border-left: 3px solid #ffd700"]  { box-shadow: -2px 0 8px rgba(255,215,0,0.25); }
.widget [style*="border-left: 3px solid #b0b0b0"]  { box-shadow: -2px 0 6px rgba(176,176,176,0.2); }
.widget [style*="border-left: 3px solid #cd7f32"]  { box-shadow: -2px 0 6px rgba(205,127,50,0.2);  }

/* ════════════════════════════════════════════════════════════════════
   📱 移动端响应式适配
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* 取消固定视口高度，允许滚动 */
  .viewport {
    width: 100%; height: auto;
    min-height: 100dvh; overflow-y: auto; overflow-x: hidden;
  }
  .screen {
    width: 100%; height: auto; min-height: 100dvh;
  }

  /* 顶部标题栏：紧凑折叠 */
  .screen-header {
    height: auto; min-height: 44px; flex-wrap: wrap;
    padding: 6px 10px; gap: 4px;
  }
  .header-title { min-width: 0; font-size: 13px; }
  .header-title input { font-size: 13px; letter-spacing: 0; }
  .header-tabs { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .tab-btn { font-size: 11px; padding: 3px 10px; white-space: nowrap; }
  .header-clock { font-size: 11px; }
  .header-class input { font-size: 11px; }

  /* 三列 → 纵向单列 */
  .screen-body {
    flex-direction: column;
    padding: 6px 6px 80px;
    gap: 8px;
    overflow-y: visible;
  }
  .col { min-height: 0; overflow-y: auto; overflow-x: hidden; }
  .col-left, .col-right { width: 100%; flex-shrink: 0; }

  /* 移动端组件最小高度保证可见 */
  .widget { min-height: 240px; flex-basis: 240px; }
  .widget-body { min-height: 190px; }

  /* 侧边栏：固定在底部（收起状态），点击箭头弹出 */
  .side-panel {
    position: fixed; bottom: 0; right: 0; top: auto;
    width: 100% !important; max-height: 60vh;
    border-radius: 16px 16px 0 0; overflow-y: auto;
    z-index: 500;
    transform: translateY(calc(100% - 48px));
    transition: transform 0.3s ease;
  }
  .side-panel.mobile-open {
    transform: translateY(0);
  }
  .side-panel-inner { padding-bottom: 20px; }
  /* 箭头改为向上/向下 */
  .side-toggle {
    position: absolute; top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 20px;
    border-radius: 10px;
  }
  .side-toggle-arrow { display: none; }
  .side-toggle::after {
    content: "⋯"; font-size: 18px; color: rgba(180,220,255,0.6);
  }

  /* 主内容区不因侧边栏偏移 */
  .viewport { margin-right: 0 !important; }

  /* 全屏按钮：移动端放大点击区域 */
  #shareFullscreenBtn {
    padding: 8px 16px; font-size: 13px;
  }

  /* 弹窗：全屏化 */
  .modal {
    width: 100% !important; max-width: 100% !important;
    border-radius: 14px 14px 0 0;
    position: fixed; bottom: 0; left: 0; right: 0;
    max-height: 90vh; overflow-y: auto;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* 用户中心、模板库弹窗 */
  .presets-modal { max-height: 90vh; }
  .presets-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

  /* 组件编辑弹窗 */
  .settings-row { grid-template-columns: 1fr !important; }

  /* AI 对话组件：移动端全宽 */
  .widget .ai-chat-wrap,
  .widget [class*="chat"] { font-size: 12px; }

  /* 动态徽标 */
  .dynamic-badge { font-size: 11px; padding: 4px 10px; }
}

/* 横屏手机：双列保留 */
@media (max-width: 768px) and (orientation: landscape) {
  .screen-body { flex-direction: row; flex-wrap: wrap; }
  .col-left, .col-right { width: 30%; }
  .col-center { flex: 1; min-width: 0; }
  .widget { min-height: 160px; }
}

/* 平板 (769–1024px)：两列布局 */
@media (min-width: 769px) and (max-width: 1024px) {
  .col-left  { width: 30%; }
  .col-right { width: 30%; }
  .screen-body { padding: 8px; gap: 8px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   视觉风格主题 — 12 套独立风格 (与配色方案正交组合)
   通过 html[data-vstyle="xxx"] 切换
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── 风格 1: 玻璃拟态 (glass) ─────────────────────────────────────────────── */
html[data-vstyle="glass"] .widget {
  background: rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(28px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(160%) !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  border-radius: 20px !important;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}
html[data-vstyle="glass"] .widget:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 14px 56px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--widget-hover-shadow) !important;
}
html[data-vstyle="glass"] .widget::before,
html[data-vstyle="glass"] .widget::after { display: none !important; }
html[data-vstyle="glass"] .widget-header {
  background: rgba(255, 255, 255, 0.06) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 20px 20px 0 0 !important;
}
html[data-vstyle="glass"] .widget-title {
  font-weight: 500 !important;
  letter-spacing: 0.5px !important;
}
html[data-vstyle="glass"] .screen-header {
  background: rgba(255, 255, 255, 0.04) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}
html[data-vstyle="glass"] .screen-header::before { display: none !important; }

/* ── 风格 2: 霓虹矩阵 (neon-matrix) ────────────────────────────────────────── */
html[data-vstyle="neon-matrix"] {
  --grid-line: rgba(var(--border-cyan, 0, 242, 255), 0.08);
}
html[data-vstyle="neon-matrix"] .screen {
  background:
    repeating-linear-gradient(90deg, transparent 0px, transparent 39px, rgba(0, 242, 255, 0.06) 39px, rgba(0, 242, 255, 0.06) 40px),
    repeating-linear-gradient(0deg, transparent 0px, transparent 39px, rgba(0, 242, 255, 0.06) 39px, rgba(0, 242, 255, 0.06) 40px),
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(0, 242, 255, 0.08) 0%, transparent 60%) !important;
}
html[data-vstyle="neon-matrix"] .widget {
  border-radius: 4px !important;
  border: 1px solid var(--widget-border) !important;
  border-left: 3px solid var(--widget-border-left) !important;
  box-shadow:
    0 0 0 1px rgba(0, 242, 255, 0.04),
    inset 0 0 40px var(--widget-glow-in),
    0 0 20px rgba(0, 0, 0, 0.5) !important;
  animation: neon-pulse 3s ease-in-out infinite !important;
}
@keyframes neon-pulse {
  0%, 100% { box-shadow: inset 0 0 40px var(--widget-glow-in), 0 0 20px rgba(0,0,0,0.5); }
  50%       { box-shadow: inset 0 0 60px var(--widget-glow-in), 0 0 24px rgba(0,242,255,0.12); }
}
html[data-vstyle="neon-matrix"] .widget::before,
html[data-vstyle="neon-matrix"] .widget::after {
  width: 20px !important;
  height: 20px !important;
  opacity: 0.8 !important;
  border-width: 2px !important;
}

/* ── 风格 3: 极简线框 (minimal) ─────────────────────────────────────────────── */
html[data-vstyle="minimal"] .widget {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 2px !important;
  box-shadow: none !important;
}
html[data-vstyle="minimal"] .widget:hover {
  background: rgba(255, 255, 255, 0.02) !important;
  border-color: var(--border-cyan) !important;
  box-shadow: none !important;
}
html[data-vstyle="minimal"] .widget::before,
html[data-vstyle="minimal"] .widget::after { display: none !important; }
html[data-vstyle="minimal"] .widget-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html[data-vstyle="minimal"] .screen-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: none !important;
}
html[data-vstyle="minimal"] .screen-header::before { display: none !important; }
html[data-vstyle="minimal"] .screen {
  background:
    repeating-linear-gradient(90deg, transparent 0px, transparent 119px, rgba(255,255,255,0.03) 119px, rgba(255,255,255,0.03) 120px),
    repeating-linear-gradient(0deg, transparent 0px, transparent 119px, rgba(255,255,255,0.03) 119px, rgba(255,255,255,0.03) 120px) !important;
}
html[data-vstyle="minimal"] .widget-title {
  font-weight: 400 !important;
  letter-spacing: 2px !important;
  font-size: clamp(10px, 0.65vw, 12px) !important;
  text-transform: uppercase !important;
  color: rgba(255,255,255,0.5) !important;
}

/* ── 风格 4: 复古终端 (terminal) ─────────────────────────────────────────────── */
html[data-vstyle="terminal"] {
  font-family: 'Courier New', 'Consolas', 'Lucida Console', monospace !important;
}
html[data-vstyle="terminal"] body {
  font-family: 'Courier New', 'Consolas', monospace !important;
  background: #000 !important;
}
html[data-vstyle="terminal"] .screen {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,20,0,0.25) 2px, rgba(0,20,0,0.25) 4px),
    #000d00 !important;
}
html[data-vstyle="terminal"] .widget {
  background: rgba(0, 12, 0, 0.92) !important;
  border: 1px solid #00cc44 !important;
  border-left: 1px solid #00cc44 !important;
  border-radius: 0 !important;
  box-shadow: 0 0 12px rgba(0, 204, 68, 0.2), inset 0 0 30px rgba(0, 204, 68, 0.04) !important;
}
html[data-vstyle="terminal"] .widget:hover {
  border-color: #39ff14 !important;
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.35), inset 0 0 30px rgba(57, 255, 20, 0.06) !important;
}
html[data-vstyle="terminal"] .widget::before,
html[data-vstyle="terminal"] .widget::after {
  border-color: #39ff14 !important;
  width: 8px !important;
  height: 8px !important;
}
html[data-vstyle="terminal"] .widget-header {
  background: rgba(0, 204, 68, 0.08) !important;
  border-bottom: 1px solid rgba(0, 204, 68, 0.3) !important;
}
html[data-vstyle="terminal"] .widget-title {
  color: #39ff14 !important;
  font-family: 'Courier New', monospace !important;
  font-size: 11px !important;
  letter-spacing: 2px !important;
  text-shadow: 0 0 8px #39ff14 !important;
}
html[data-vstyle="terminal"] .widget-title::before { content: "> "; color: #007722; }
html[data-vstyle="terminal"] .screen-header {
  background: rgba(0, 8, 0, 0.95) !important;
  border-bottom: 1px solid #00cc44 !important;
}
html[data-vstyle="terminal"] .screen-header::before {
  background: #39ff14 !important;
  opacity: 0.4 !important;
}
html[data-vstyle="terminal"] .header-title {
  font-family: 'Courier New', monospace !important;
  color: #39ff14 !important;
  text-shadow: 0 0 10px #39ff14 !important;
  letter-spacing: 4px !important;
}

/* ── 风格 5: 碳纤维 (carbon) ────────────────────────────────────────────────── */
html[data-vstyle="carbon"] .screen {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 6px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 6px),
    #0a0a0c !important;
}
html[data-vstyle="carbon"] .widget {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.018) 0px, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 5px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.018) 0px, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 5px),
    rgba(14, 14, 18, 0.95) !important;
  border: 1px solid rgba(160, 160, 180, 0.22) !important;
  border-left: 2px solid rgba(200, 200, 220, 0.4) !important;
  border-radius: 3px !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06) !important;
}
html[data-vstyle="carbon"] .widget:hover {
  border-color: rgba(220, 220, 240, 0.4) !important;
  border-left-color: var(--border-cyan) !important;
  box-shadow: 0 6px 32px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.08), var(--widget-hover-shadow) !important;
}
html[data-vstyle="carbon"] .widget::before,
html[data-vstyle="carbon"] .widget::after {
  border-color: rgba(160, 160, 180, 0.5) !important;
}
html[data-vstyle="carbon"] .widget-header {
  background: rgba(255, 255, 255, 0.04) !important;
  border-bottom: 1px solid rgba(160, 160, 180, 0.15) !important;
}
html[data-vstyle="carbon"] .widget-title {
  letter-spacing: 1.5px !important;
  font-weight: 600 !important;
  color: rgba(200, 210, 230, 0.9) !important;
}
html[data-vstyle="carbon"] .screen-header {
  background: rgba(10, 10, 14, 0.95) !important;
  border-bottom: 1px solid rgba(160, 160, 180, 0.2) !important;
}
html[data-vstyle="carbon"] .screen-header::before {
  background: linear-gradient(90deg, transparent, rgba(200,200,220,0.4), transparent) !important;
}

/* ── 风格 6: 全息投影 (hologram) ─────────────────────────────────────────────── */
html[data-vstyle="hologram"] .screen {
  background:
    repeating-linear-gradient(0deg, rgba(0,200,255,0.03) 0px, rgba(0,200,255,0.03) 1px, transparent 1px, transparent 4px),
    radial-gradient(ellipse 120% 80% at 50% -20%, #001528 0%, #000810 55%) !important;
}
html[data-vstyle="hologram"] .widget {
  background: rgba(0, 120, 200, 0.06) !important;
  border: 1px solid rgba(0, 200, 255, 0.35) !important;
  border-left: 1px solid rgba(0, 200, 255, 0.35) !important;
  border-radius: 0 !important;
  box-shadow:
    0 0 0 1px rgba(0, 200, 255, 0.08),
    0 0 30px rgba(0, 150, 255, 0.08),
    inset 0 0 50px rgba(0, 200, 255, 0.04),
    inset 0 1px 0 rgba(0, 220, 255, 0.12) !important;
}
html[data-vstyle="hologram"] .widget::before,
html[data-vstyle="hologram"] .widget::after {
  border-color: rgba(0, 220, 255, 0.9) !important;
  width: 16px !important;
  height: 16px !important;
  border-width: 2px !important;
  opacity: 0.7 !important;
}
html[data-vstyle="hologram"] .widget:hover {
  border-color: rgba(0, 240, 255, 0.7) !important;
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.15),
    0 0 40px rgba(0, 200, 255, 0.15),
    inset 0 0 60px rgba(0, 220, 255, 0.06),
    0 0 2px rgba(0,240,255,0.8) !important;
}
html[data-vstyle="hologram"] .widget-header {
  background: rgba(0, 180, 255, 0.08) !important;
  border-bottom: 1px solid rgba(0, 200, 255, 0.2) !important;
}
html[data-vstyle="hologram"] .widget-title {
  color: #00e8ff !important;
  text-shadow: 0 0 8px rgba(0, 232, 255, 0.6) !important;
  letter-spacing: 2px !important;
}
html[data-vstyle="hologram"] .screen-header {
  background: rgba(0, 10, 24, 0.9) !important;
  border-bottom: 1px solid rgba(0, 200, 255, 0.25) !important;
}

/* ── 风格 7: 极光幻彩 (aurora) ─────────────────────────────────────────────── */
html[data-vstyle="aurora"] body,
html[data-vstyle="aurora"] html { background: #080212 !important; }
html[data-vstyle="aurora"] .screen {
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(130, 0, 255, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 70%, rgba(0, 220, 180, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 50% 10%, rgba(0, 100, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 40% 35% at 10% 80%, rgba(255, 50, 120, 0.06) 0%, transparent 50%),
    #080212 !important;
  animation: aurora-shift 8s ease-in-out infinite alternate !important;
}
@keyframes aurora-shift {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(30deg); }
}
html[data-vstyle="aurora"] .widget {
  background: rgba(255, 255, 255, 0.04) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(180, 120, 255, 0.2) !important;
  border-left: 2px solid var(--widget-border-left) !important;
  border-radius: 14px !important;
  box-shadow: 0 6px 36px rgba(100, 0, 200, 0.15), inset 0 1px 0 rgba(255,255,255,0.08) !important;
}
html[data-vstyle="aurora"] .widget:hover {
  border-color: rgba(200, 150, 255, 0.4) !important;
  box-shadow: 0 10px 50px rgba(130, 0, 255, 0.22), inset 0 1px 0 rgba(255,255,255,0.12), var(--widget-hover-shadow) !important;
}
html[data-vstyle="aurora"] .widget::before,
html[data-vstyle="aurora"] .widget::after { display: none !important; }
html[data-vstyle="aurora"] .widget-header {
  background: rgba(180, 100, 255, 0.07) !important;
  border-bottom: 1px solid rgba(180, 120, 255, 0.12) !important;
  border-radius: 14px 14px 0 0 !important;
}
html[data-vstyle="aurora"] .screen-header {
  background: rgba(10, 4, 26, 0.85) !important;
  backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(180, 100, 255, 0.2) !important;
}

/* ── 风格 8: 扁平方块 (flat-block) ──────────────────────────────────────────── */
html[data-vstyle="flat-block"] .screen {
  background: #0a0c10 !important;
}
html[data-vstyle="flat-block"] .widget {
  background: #111420 !important;
  border: none !important;
  border-left: 4px solid var(--widget-border-left) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
html[data-vstyle="flat-block"] .widget:hover {
  background: #141826 !important;
  border-left-color: var(--border-cyan) !important;
  box-shadow: none !important;
}
html[data-vstyle="flat-block"] .widget::before,
html[data-vstyle="flat-block"] .widget::after { display: none !important; }
html[data-vstyle="flat-block"] .widget-header {
  background: rgba(255, 255, 255, 0.04) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
html[data-vstyle="flat-block"] .widget-title {
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
}
html[data-vstyle="flat-block"] .screen-header {
  background: #0a0c10 !important;
  border-bottom: 2px solid var(--border-cyan) !important;
  box-shadow: none !important;
}
html[data-vstyle="flat-block"] .screen-header::before { display: none !important; }
html[data-vstyle="flat-block"] .tab-item {
  border-radius: 0 !important;
  border: none !important;
  border-bottom: 3px solid transparent !important;
}
html[data-vstyle="flat-block"] .tab-item.active {
  background: rgba(255,255,255,0.05) !important;
  border-bottom-color: var(--border-cyan) !important;
}

/* ── 风格 9: 水墨东方 (oriental) ─────────────────────────────────────────────── */
html[data-vstyle="oriental"] {
  --border-cyan: #c8a052;
  --widget-border-left: #c8a052;
  --widget-border: rgba(200, 160, 82, 0.28);
  --widget-glow-in: rgba(200, 160, 82, 0.04);
  --widget-hover-shadow: 0 0 18px rgba(200, 160, 82, 0.22);
  --widget-header-bg: rgba(200, 160, 82, 0.08);
  --widget-header-border: rgba(200, 160, 82, 0.15);
}
html[data-vstyle="oriental"] .screen {
  background:
    radial-gradient(ellipse 50% 60% at 15% 50%, rgba(120, 20, 20, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 85% 50%, rgba(120, 20, 20, 0.04) 0%, transparent 55%),
    radial-gradient(ellipse 80% 30% at 50% 5%, rgba(200, 160, 82, 0.04) 0%, transparent 50%),
    #0c0804 !important;
}
html[data-vstyle="oriental"] .widget {
  background: rgba(14, 10, 4, 0.90) !important;
  border: 1px solid rgba(200, 160, 82, 0.25) !important;
  border-left: 3px solid #c8a052 !important;
  border-radius: 2px !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), inset 0 0 40px rgba(200,160,82,0.03) !important;
  position: relative;
}
html[data-vstyle="oriental"] .widget::before,
html[data-vstyle="oriental"] .widget::after {
  border-color: #c8a052 !important;
  opacity: 0.45 !important;
  width: 12px !important;
  height: 12px !important;
}
html[data-vstyle="oriental"] .widget:hover {
  border-color: rgba(200, 160, 82, 0.5) !important;
  box-shadow: 0 6px 30px rgba(0,0,0,0.6), inset 0 0 50px rgba(200,160,82,0.05), 0 0 16px rgba(200,160,82,0.2) !important;
}
html[data-vstyle="oriental"] .widget-header {
  background: linear-gradient(90deg, rgba(200,160,82,0.1), transparent 70%) !important;
  border-bottom: 1px solid rgba(200, 160, 82, 0.18) !important;
}
html[data-vstyle="oriental"] .widget-title {
  color: #d4a843 !important;
  font-family: "STKaiti", "KaiTi", "楷体", "FZKai-Z03", serif !important;
  letter-spacing: 3px !important;
  text-shadow: 0 0 8px rgba(212, 168, 67, 0.5) !important;
}
html[data-vstyle="oriental"] .header-title {
  font-family: "STKaiti", "KaiTi", "楷体", serif !important;
  color: #d4a843 !important;
  letter-spacing: 6px !important;
  text-shadow: 0 0 12px rgba(200, 160, 82, 0.6) !important;
}
html[data-vstyle="oriental"] .screen-header {
  background: rgba(8, 6, 2, 0.95) !important;
  border-bottom: 1px solid rgba(200, 160, 82, 0.3) !important;
}
html[data-vstyle="oriental"] .screen-header::before {
  background: linear-gradient(90deg, transparent, #c8a052, transparent) !important;
}

/* ── 风格 10: 复古电波 (retro-wave) ─────────────────────────────────────────── */
html[data-vstyle="retro-wave"] {
  --border-cyan: #ff2eff;
  --widget-border-left: #ff2eff;
  --widget-border: rgba(255, 46, 255, 0.28);
  --widget-glow-in: rgba(255, 46, 255, 0.05);
  --widget-hover-shadow: 0 0 20px rgba(255, 46, 255, 0.35);
  --widget-header-bg: rgba(255, 46, 255, 0.08);
  --widget-header-border: rgba(255, 46, 255, 0.15);
}
html[data-vstyle="retro-wave"] .screen {
  background:
    linear-gradient(to bottom, #0a0018 0%, #0a0018 60%, #140030 100%),
    repeating-linear-gradient(
      to bottom,
      transparent 0px, transparent 30px,
      rgba(255, 46, 255, 0.06) 30px, rgba(255, 46, 255, 0.06) 31px
    ) !important;
}
html[data-vstyle="retro-wave"] .screen::after {
  content: "" !important;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 35vh !important;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0px, transparent calc(100% / 24 - 1px),
      rgba(255, 46, 255, 0.2) calc(100% / 24 - 1px), rgba(255, 46, 255, 0.2) calc(100% / 24)
    ) !important;
  mask-image: perspective(400px) rotateX(60deg) !important;
  -webkit-mask-image: perspective(400px) rotateX(60deg) !important;
  pointer-events: none !important;
  z-index: 0 !important;
}
html[data-vstyle="retro-wave"] .widget {
  background: rgba(20, 0, 40, 0.85) !important;
  border: 1px solid rgba(255, 46, 255, 0.3) !important;
  border-left: 2px solid #ff2eff !important;
  border-radius: 0 !important;
  box-shadow: 0 0 24px rgba(255, 46, 255, 0.1), inset 0 0 30px rgba(255, 46, 255, 0.04) !important;
}
html[data-vstyle="retro-wave"] .widget:hover {
  border-color: rgba(255, 46, 255, 0.6) !important;
  box-shadow: 0 0 32px rgba(255, 46, 255, 0.22), inset 0 0 40px rgba(255, 46, 255, 0.07) !important;
}
html[data-vstyle="retro-wave"] .widget::before,
html[data-vstyle="retro-wave"] .widget::after {
  border-color: #ff2eff !important;
  opacity: 0.7 !important;
}
html[data-vstyle="retro-wave"] .widget-header {
  background: rgba(255, 46, 255, 0.07) !important;
  border-bottom: 1px solid rgba(255, 46, 255, 0.18) !important;
}
html[data-vstyle="retro-wave"] .widget-title {
  color: #ff2eff !important;
  text-shadow: 0 0 10px rgba(255, 46, 255, 0.7), 0 0 20px rgba(255, 46, 255, 0.4) !important;
  font-style: italic !important;
  letter-spacing: 2px !important;
}
html[data-vstyle="retro-wave"] .header-title {
  color: #ff2eff !important;
  text-shadow: 0 0 14px rgba(255, 46, 255, 0.8), 0 0 28px rgba(0, 255, 255, 0.4) !important;
}
html[data-vstyle="retro-wave"] .screen-header {
  background: rgba(10, 0, 24, 0.95) !important;
  border-bottom: 1px solid rgba(255, 46, 255, 0.3) !important;
}
html[data-vstyle="retro-wave"] .screen-header::before {
  background: linear-gradient(90deg, transparent, #ff2eff, #00ffff, #ff2eff, transparent) !important;
  opacity: 0.5 !important;
}

/* ── 风格 11: 电路板 (circuit) ──────────────────────────────────────────────── */
html[data-vstyle="circuit"] {
  --border-cyan: #00ff88;
  --widget-border-left: #00ff88;
  --widget-border: rgba(0, 255, 136, 0.26);
  --widget-glow-in: rgba(0, 255, 136, 0.04);
  --widget-hover-shadow: 0 0 18px rgba(0, 255, 136, 0.25);
  --widget-header-bg: rgba(0, 255, 136, 0.08);
  --widget-header-border: rgba(0, 255, 136, 0.14);
}
html[data-vstyle="circuit"] .screen {
  background:
    repeating-linear-gradient(90deg, transparent 0px, transparent 19px, rgba(0, 255, 136, 0.04) 19px, rgba(0, 255, 136, 0.04) 20px),
    repeating-linear-gradient(0deg, transparent 0px, transparent 19px, rgba(0, 255, 136, 0.04) 19px, rgba(0, 255, 136, 0.04) 20px),
    #010d06 !important;
}
html[data-vstyle="circuit"] .widget {
  background: rgba(0, 12, 6, 0.92) !important;
  border: 1px solid rgba(0, 255, 136, 0.22) !important;
  border-left: 2px solid #00ff88 !important;
  border-radius: 1px !important;
  box-shadow: 0 0 16px rgba(0, 200, 100, 0.08), inset 0 0 30px rgba(0, 255, 136, 0.03) !important;
}
html[data-vstyle="circuit"] .widget:hover {
  border-color: rgba(0, 255, 136, 0.5) !important;
  box-shadow: 0 0 24px rgba(0, 255, 136, 0.18), inset 0 0 40px rgba(0, 255, 136, 0.06) !important;
}
html[data-vstyle="circuit"] .widget::before,
html[data-vstyle="circuit"] .widget::after {
  border-color: #00ff88 !important;
  width: 10px !important;
  height: 10px !important;
  border-width: 2px !important;
  opacity: 0.6 !important;
}
html[data-vstyle="circuit"] .widget-header {
  background: rgba(0, 255, 136, 0.06) !important;
  border-bottom: 1px solid rgba(0, 255, 136, 0.14) !important;
}
html[data-vstyle="circuit"] .widget-title {
  color: #00ff88 !important;
  font-family: 'Courier New', monospace !important;
  font-size: 10px !important;
  letter-spacing: 2px !important;
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.5) !important;
}
html[data-vstyle="circuit"] .screen-header {
  background: rgba(0, 8, 4, 0.96) !important;
  border-bottom: 1px solid rgba(0, 255, 136, 0.24) !important;
}
html[data-vstyle="circuit"] .screen-header::before {
  background: linear-gradient(90deg, transparent, #00ff88, transparent) !important;
}

/* ── 风格 12: 工程蓝图 (blueprint) ──────────────────────────────────────────── */
html[data-vstyle="blueprint"] {
  --border-cyan: #60a8ff;
  --widget-border-left: #60a8ff;
  --widget-border: rgba(96, 168, 255, 0.28);
  --widget-glow-in: rgba(96, 168, 255, 0.04);
  --widget-hover-shadow: 0 0 18px rgba(96, 168, 255, 0.25);
  --widget-header-bg: rgba(96, 168, 255, 0.08);
  --widget-header-border: rgba(96, 168, 255, 0.15);
}
html[data-vstyle="blueprint"] .screen {
  background:
    repeating-linear-gradient(90deg, rgba(96, 168, 255, 0.06) 0px, rgba(96, 168, 255, 0.06) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(0deg, rgba(96, 168, 255, 0.06) 0px, rgba(96, 168, 255, 0.06) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(90deg, rgba(96, 168, 255, 0.12) 0px, rgba(96, 168, 255, 0.12) 1px, transparent 1px, transparent 200px),
    repeating-linear-gradient(0deg, rgba(96, 168, 255, 0.12) 0px, rgba(96, 168, 255, 0.12) 1px, transparent 1px, transparent 200px),
    #011628 !important;
}
html[data-vstyle="blueprint"] .widget {
  background: rgba(1, 20, 44, 0.88) !important;
  border: 1px solid rgba(96, 168, 255, 0.35) !important;
  border-left: 1px solid rgba(96, 168, 255, 0.35) !important;
  border-radius: 0 !important;
  box-shadow: 0 2px 16px rgba(0, 30, 80, 0.5), inset 0 0 30px rgba(96, 168, 255, 0.03) !important;
}
html[data-vstyle="blueprint"] .widget:hover {
  border-color: rgba(96, 168, 255, 0.7) !important;
  box-shadow: 0 4px 24px rgba(0, 40, 120, 0.5), inset 0 0 40px rgba(96, 168, 255, 0.05) !important;
}
html[data-vstyle="blueprint"] .widget::before,
html[data-vstyle="blueprint"] .widget::after {
  border-color: #60a8ff !important;
  width: 18px !important;
  height: 18px !important;
  border-width: 1px !important;
  opacity: 0.8 !important;
}
html[data-vstyle="blueprint"] .widget:hover::before,
html[data-vstyle="blueprint"] .widget:hover::after {
  width: 22px !important;
  height: 22px !important;
}
html[data-vstyle="blueprint"] .widget-header {
  background: rgba(96, 168, 255, 0.06) !important;
  border-bottom: 1px solid rgba(96, 168, 255, 0.2) !important;
}
html[data-vstyle="blueprint"] .widget-title {
  color: #a8ccff !important;
  font-family: 'Courier New', 'Consolas', monospace !important;
  font-size: 10px !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
}
html[data-vstyle="blueprint"] .screen-header {
  background: rgba(0, 12, 30, 0.96) !important;
  border-bottom: 1px solid rgba(96, 168, 255, 0.3) !important;
}
html[data-vstyle="blueprint"] .screen-header::before {
  background: linear-gradient(90deg, transparent, rgba(96, 168, 255, 0.6), transparent) !important;
}
html[data-vstyle="blueprint"] .header-title {
  font-family: 'Courier New', monospace !important;
  letter-spacing: 4px !important;
}

/* ── 视觉风格选择器 UI ─────────────────────────────────────────────────────── */
.vstyle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 4px 2px;
}
.vstyle-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 10px 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.vstyle-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
.vstyle-card.active {
  border-color: var(--border-cyan);
  background: rgba(0,242,255,0.06);
  box-shadow: 0 0 16px rgba(0,242,255,0.2);
}
.vstyle-card.active::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 12px;
  color: var(--border-cyan);
  font-weight: 700;
}
.vstyle-preview {
  width: 100%;
  height: 64px;
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.vstyle-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.vstyle-desc {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VFE — Visual Field Editor 统一设计体系（v2）
   适用于：modalWidget 内的所有可视化字段编辑器
   覆盖：vf- / vfe- / scbe- / lrk- / gsfe- / crtfe- / aahe- / madfe- / ccaie-
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── modalWidget 头部 · 实时预览徽章 ── */
#modalWidget .modal-header { display: flex; align-items: center; gap: 10px; }
#modalWidget .modal-header > span:first-child { flex: 1; }
.vfe-live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0, 242, 255, 0.16), rgba(0, 200, 255, 0.08));
  border: 1px solid rgba(0, 242, 255, 0.42);
  color: #6ce8ff;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
  cursor: help;
  transition: all 0.18s ease;
  box-shadow: 0 0 18px rgba(0, 242, 255, 0.2) inset, 0 0 12px rgba(0, 242, 255, 0.08);
}
.vfe-live-badge:hover {
  background: linear-gradient(135deg, rgba(0, 242, 255, 0.25), rgba(0, 200, 255, 0.12));
  color: #00f2ff;
}
.vfe-live-badge.flash { animation: vfeLivePulse 0.4s ease; }
.vfe-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #00f2ff;
  box-shadow: 0 0 8px #00f2ff, 0 0 14px rgba(0, 242, 255, 0.6);
  animation: vfeLiveBlink 1.6s ease-in-out infinite;
}
@keyframes vfeLiveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}
@keyframes vfeLivePulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); box-shadow: 0 0 22px rgba(0, 242, 255, 0.5); }
  100% { transform: scale(1); }
}

/* ── modalWidget 取消按钮 + 提示 ── */
.vfe-cancel-btn {
  background: rgba(255, 100, 100, 0.08);
  border: 1px solid rgba(255, 100, 100, 0.32);
  color: #ff8e8e;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-weight: 500;
}
.vfe-cancel-btn:hover {
  background: rgba(255, 100, 100, 0.18);
  border-color: rgba(255, 100, 100, 0.55);
  color: #ffa8a8;
}
.vfe-edit-tip {
  font-size: 11px;
  color: rgba(140, 200, 220, 0.55);
  margin-left: auto;
  font-style: italic;
  letter-spacing: 0.02em;
}

/* ── VFE 通用变量与基础排版 ── */
.widget-form-area {
  --vfe-bg-1: rgba(0, 18, 45, 0.5);
  --vfe-bg-2: rgba(0, 25, 60, 0.4);
  --vfe-bg-3: rgba(0, 8, 22, 0.45);
  --vfe-border-1: rgba(0, 242, 255, 0.14);
  --vfe-border-2: rgba(0, 242, 255, 0.28);
  --vfe-border-focus: rgba(0, 242, 255, 0.6);
  --vfe-text-1: #d6f0ff;
  --vfe-text-2: rgba(140, 200, 220, 0.78);
  --vfe-text-3: rgba(140, 180, 220, 0.5);
  --vfe-accent: #00f2ff;
  --vfe-danger: #ff7878;
  --vfe-warn: #ffb74d;
  --vfe-success: #4cd964;
  --vfe-radius: 8px;
}

/* ── 输入控件统一升级（覆盖所有遗留前缀的样式） ── */
.widget-form-area .vf-input,
.widget-form-area .vfe-inp,
.widget-form-area input[type="text"]:not([class*="vfe-stat"]):not([class*="vfe-medal"]):not([class*="vfe-score"]),
.widget-form-area input[type="number"]:not([class*="vfe-stat"]):not([class*="vfe-score"]) {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--vfe-border-1);
  color: var(--vfe-text-1);
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 6px;
  outline: none;
  transition: all 0.15s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
.widget-form-area .vf-input:hover,
.widget-form-area .vfe-inp:hover {
  border-color: rgba(0, 242, 255, 0.32);
}
.widget-form-area .vf-input:focus,
.widget-form-area .vfe-inp:focus,
.widget-form-area input:focus,
.widget-form-area textarea:focus,
.widget-form-area select:focus {
  border-color: var(--vfe-border-focus);
  box-shadow: 0 0 0 2px rgba(0, 242, 255, 0.12), inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
.widget-form-area textarea {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--vfe-border-1);
  color: var(--vfe-text-1);
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 6px;
  outline: none;
  transition: all 0.15s ease;
  font-family: inherit;
  line-height: 1.55;
}
.widget-form-area select {
  background: rgba(0, 8, 22, 0.7);
  border: 1px solid var(--vfe-border-1);
  color: var(--vfe-text-1);
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.widget-form-area select:hover { border-color: rgba(0, 242, 255, 0.32); }

/* color picker 美化 */
.widget-form-area input[type="color"],
.widget-form-area .vf-color {
  width: 32px; height: 28px;
  border: 1px solid rgba(0, 242, 255, 0.28);
  border-radius: 6px;
  padding: 1px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
}
.widget-form-area input[type="color"]:hover,
.widget-form-area .vf-color:hover {
  border-color: var(--vfe-border-focus);
  box-shadow: 0 0 8px rgba(0, 242, 255, 0.25);
}

/* ── 通用按钮组（覆盖所有变体） ── */
.widget-form-area .vf-add-btn,
.widget-form-area .vfe-add-card-btn,
.widget-form-area .vfe-btn-add {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border: 1.5px dashed rgba(0, 242, 255, 0.32);
  border-radius: 7px;
  background: rgba(0, 200, 255, 0.04);
  color: var(--vfe-accent);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-top: 6px;
  width: 100%;
}
.widget-form-area .vf-add-btn:hover,
.widget-form-area .vfe-add-card-btn:hover,
.widget-form-area .vfe-btn-add:hover {
  background: rgba(0, 200, 255, 0.12);
  border-color: var(--vfe-border-focus);
  border-style: solid;
  color: #6ce8ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 242, 255, 0.15);
}

.widget-form-area .vf-del-btn {
  background: rgba(255, 100, 100, 0.1);
  border: 1px solid rgba(255, 100, 100, 0.28);
  color: #ff8e8e;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}
.widget-form-area .vf-del-btn:hover {
  background: rgba(255, 100, 100, 0.22);
  border-color: rgba(255, 100, 100, 0.5);
  color: #ffa8a8;
}

/* ── 分组卡片：统一所有 builders 的 group 容器 ── */
.widget-form-area .vfe-group {
  background: var(--vfe-bg-1);
  border: 1px solid var(--vfe-border-1);
  border-radius: var(--vfe-radius);
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 12px;
  position: relative;
  transition: border-color 0.2s ease;
}
.widget-form-area .vfe-group:hover {
  border-color: rgba(0, 242, 255, 0.22);
}
.widget-form-area .vfe-group-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(0, 242, 255, 0.72);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(0, 242, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 字段 label */
.widget-form-area .vf-label,
.widget-form-area .vfe-label {
  font-size: 11px;
  color: var(--vfe-text-2);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  display: block;
}
.widget-form-area .vf-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}

/* ── 表格行编辑器 ── */
.widget-form-area .vf-list-section {
  background: var(--vfe-bg-3);
  border: 1px solid var(--vfe-border-1);
  border-radius: 7px;
  padding: 6px;
  margin-bottom: 10px;
}
.widget-form-area .vf-table {
  display: flex; flex-direction: column;
}
.widget-form-area .vf-table-head {
  display: flex; gap: 6px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.12);
  margin-bottom: 5px;
}
.widget-form-area .vf-th {
  font-size: 10px;
  color: rgba(0, 242, 255, 0.56);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 2;
}
.widget-form-area .vf-th-sm { flex: 0 0 50px !important; text-align: right; }
.widget-form-area .vf-table-body { display: flex; flex-direction: column; gap: 4px; }
.widget-form-area .vf-table-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 5px;
  transition: background 0.15s ease;
}
.widget-form-area .vf-table-row:hover {
  background: rgba(0, 242, 255, 0.04);
}
.widget-form-area .vf-td { flex: 2; min-width: 0; }
.widget-form-area .vf-td-sm { flex: 0 0 50px !important; display: flex; justify-content: flex-end; }

/* ── section title ── */
.widget-form-area .vf-section-title {
  font-size: 12px;
  font-weight: 700;
  color: rgba(0, 242, 255, 0.85);
  letter-spacing: 0.04em;
  margin: 12px 0 6px;
  padding-left: 8px;
  border-left: 3px solid var(--vfe-accent);
}

/* ── 数据预览卡（vfe-stat-card 强化） ── */
.widget-form-area .vfe-stat-card {
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(0, 10, 30, 0.55);
  border: 1px solid rgba(0, 242, 255, 0.1);
  border-left-width: 3px;
  transition: all 0.18s ease;
}
.widget-form-area .vfe-stat-card:hover {
  background: rgba(0, 15, 40, 0.7);
  border-color: rgba(0, 242, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ── 系列卡片 ── */
.widget-form-area .vfe-series-card {
  background: linear-gradient(135deg, rgba(0, 18, 50, 0.6), rgba(0, 30, 70, 0.4));
  border: 1px solid rgba(0, 242, 255, 0.16);
  border-radius: 8px;
  padding: 10px 11px;
  position: relative;
  transition: all 0.18s ease;
}
.widget-form-area .vfe-series-card:hover {
  border-color: rgba(0, 242, 255, 0.32);
  background: linear-gradient(135deg, rgba(0, 25, 60, 0.65), rgba(0, 40, 90, 0.45));
}

/* ── 芯片标签强化 ── */
.widget-form-area .vfe-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 11px;
  border-radius: 11px;
  background: rgba(0, 242, 255, 0.1);
  border: 1px solid rgba(0, 242, 255, 0.28);
  color: var(--vfe-accent);
  font-size: 11.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.widget-form-area .vfe-chip:hover {
  background: rgba(0, 242, 255, 0.18);
  border-color: rgba(0, 242, 255, 0.45);
}

/* ── 滚动条美化（编辑器内部） ── */
.widget-form-area::-webkit-scrollbar { width: 6px; height: 6px; }
.widget-form-area::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }
.widget-form-area::-webkit-scrollbar-thumb { background: rgba(0, 242, 255, 0.25); border-radius: 3px; }
.widget-form-area::-webkit-scrollbar-thumb:hover { background: rgba(0, 242, 255, 0.45); }

/* ═══════════════════════════════════════════════════════════════════════════
   VFE 高级控件（v2 新增）：树编辑器 / 二维表 / 富文本 / 拖拽排序
   ═══════════════════════════════════════════════════════════════════════════ */

/* —— 二维表格编辑器 vfe-grid —— */
.vfe-grid-wrap {
  background: var(--vfe-bg-3, rgba(0, 8, 22, 0.45));
  border: 1px solid var(--vfe-border-1, rgba(0, 242, 255, 0.14));
  border-radius: 8px;
  overflow: hidden;
}
.vfe-grid-toolbar {
  display: flex;
  gap: 6px;
  padding: 7px 9px;
  background: rgba(0, 18, 45, 0.4);
  border-bottom: 1px solid rgba(0, 242, 255, 0.12);
  align-items: center;
  flex-wrap: wrap;
}
.vfe-grid-tip {
  font-size: 10.5px;
  color: rgba(140, 200, 220, 0.55);
  margin-left: auto;
  font-style: italic;
}
.vfe-grid-scroll {
  max-height: 360px;
  overflow: auto;
}
.vfe-grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.vfe-grid-table th,
.vfe-grid-table td {
  padding: 0;
  text-align: left;
  vertical-align: middle;
  position: relative;
}
.vfe-grid-table thead th {
  background: rgba(0, 24, 55, 0.85);
  color: rgba(0, 242, 255, 0.7);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 242, 255, 0.18);
  position: sticky;
  top: 0;
  z-index: 2;
}
.vfe-grid-table tbody tr {
  transition: background 0.12s ease;
}
.vfe-grid-table tbody tr:hover { background: rgba(0, 242, 255, 0.05); }
.vfe-grid-table tbody td {
  border-bottom: 1px solid rgba(0, 242, 255, 0.07);
  padding: 1px 1px;
}
.vfe-grid-table tbody tr:last-child td { border-bottom: none; }
.vfe-grid-cell {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--vfe-text-1, #d6f0ff);
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
  border-radius: 4px;
  transition: all 0.12s ease;
}
.vfe-grid-cell:hover { background: rgba(0, 242, 255, 0.06); border-color: rgba(0, 242, 255, 0.12); }
.vfe-grid-cell:focus {
  background: rgba(0, 242, 255, 0.1);
  border-color: rgba(0, 242, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(0, 242, 255, 0.1);
}
.vfe-grid-th-action { width: 80px !important; text-align: center !important; }
.vfe-grid-row-acts {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 2px;
}
.vfe-grid-iconbtn {
  width: 22px; height: 22px;
  border: 1px solid rgba(0, 242, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  color: var(--vfe-text-2, rgba(140, 200, 220, 0.78));
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.vfe-grid-iconbtn:hover {
  background: rgba(0, 242, 255, 0.12);
  border-color: rgba(0, 242, 255, 0.4);
  color: var(--vfe-accent);
}
.vfe-grid-iconbtn.danger:hover {
  background: rgba(255, 100, 100, 0.18);
  border-color: rgba(255, 100, 100, 0.45);
  color: #ff8e8e;
}
.vfe-grid-empty {
  padding: 30px 14px;
  text-align: center;
  color: rgba(140, 180, 220, 0.4);
  font-size: 12px;
}
.vfe-grid-empty-icon {
  display: block;
  font-size: 26px;
  margin-bottom: 6px;
  opacity: 0.55;
}

/* —— 拖拽排序 —— */
.vfe-grid-table tbody tr.vfe-dragging { opacity: 0.4; }
.vfe-grid-table tbody tr.vfe-drag-over { box-shadow: inset 0 2px 0 #00f2ff; }
.vfe-grid-handle {
  cursor: grab;
  color: rgba(0, 242, 255, 0.4);
  font-size: 14px;
  user-select: none;
}
.vfe-grid-handle:active { cursor: grabbing; }
.vfe-grid-th-handle { width: 24px !important; }

/* —— 树编辑器 vfe-tree —— */
.vfe-tree-wrap {
  background: var(--vfe-bg-3, rgba(0, 8, 22, 0.45));
  border: 1px solid var(--vfe-border-1, rgba(0, 242, 255, 0.14));
  border-radius: 8px;
  padding: 10px;
}
.vfe-tree-node {
  border-left: 2px solid rgba(0, 242, 255, 0.15);
  padding: 6px 0 6px 14px;
  margin-left: 4px;
  position: relative;
}
.vfe-tree-node::before {
  content: "";
  position: absolute;
  left: -2px; top: 18px;
  width: 12px; height: 1px;
  background: rgba(0, 242, 255, 0.3);
}
.vfe-tree-node.is-root { border-left: none; padding-left: 0; margin-left: 0; }
.vfe-tree-node.is-root::before { display: none; }
.vfe-tree-row {
  display: flex; gap: 6px; align-items: center;
  padding: 4px 0;
}
.vfe-tree-row .vfe-grid-iconbtn { flex-shrink: 0; }
.vfe-tree-name {
  flex: 2;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--vfe-border-1, rgba(0, 242, 255, 0.14));
  color: var(--vfe-text-1, #d6f0ff);
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 12px;
  outline: none;
  transition: all 0.12s ease;
}
.vfe-tree-name:focus { border-color: var(--vfe-border-focus, rgba(0, 242, 255, 0.6)); }
.vfe-tree-value {
  flex: 0 0 80px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--vfe-border-1, rgba(0, 242, 255, 0.14));
  color: var(--vfe-text-1, #d6f0ff);
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 12px;
  outline: none;
  text-align: right;
  font-family: 'JetBrains Mono', Consolas, monospace;
}
.vfe-tree-color {
  width: 24px; height: 24px;
  border: 1px solid rgba(0, 242, 255, 0.2);
  border-radius: 5px;
  padding: 1px;
  cursor: pointer;
  flex-shrink: 0;
}
.vfe-tree-toggle {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: rgba(0, 242, 255, 0.6);
  font-size: 10px;
  background: transparent;
  border: none;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.vfe-tree-toggle.collapsed { transform: rotate(-90deg); }
.vfe-tree-children { margin-top: 4px; }
.vfe-tree-children.hidden { display: none; }

/* —— 富文本编辑器 vfe-richtext —— */
.vfe-rt-wrap {
  background: rgba(0, 8, 22, 0.6);
  border: 1px solid var(--vfe-border-1, rgba(0, 242, 255, 0.14));
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.vfe-rt-wrap:focus-within { border-color: var(--vfe-border-focus, rgba(0, 242, 255, 0.5)); }
.vfe-rt-toolbar {
  display: flex; gap: 4px;
  padding: 6px 8px;
  background: linear-gradient(180deg, rgba(0, 24, 55, 0.85), rgba(0, 18, 45, 0.6));
  border-bottom: 1px solid rgba(0, 242, 255, 0.12);
  flex-wrap: wrap;
}
.vfe-rt-btn {
  width: 28px; height: 26px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(0, 242, 255, 0.16);
  color: rgba(200, 232, 255, 0.85);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.vfe-rt-btn:hover {
  background: rgba(0, 242, 255, 0.12);
  border-color: rgba(0, 242, 255, 0.4);
  color: var(--vfe-accent);
}
.vfe-rt-btn.active {
  background: rgba(0, 242, 255, 0.25);
  border-color: rgba(0, 242, 255, 0.55);
  color: var(--vfe-accent);
  box-shadow: 0 0 8px rgba(0, 242, 255, 0.2) inset;
}
.vfe-rt-btn.wide { width: auto; padding: 0 9px; font-size: 11px; }
.vfe-rt-sep {
  width: 1px;
  background: rgba(0, 242, 255, 0.12);
  margin: 2px 4px;
}
.vfe-rt-color {
  width: 26px; height: 26px;
  padding: 1px;
  border-radius: 5px;
  border: 1px solid rgba(0, 242, 255, 0.16);
  cursor: pointer;
  background: transparent;
}
.vfe-rt-editor {
  min-height: 140px;
  max-height: 320px;
  padding: 12px 14px;
  color: var(--vfe-text-1, #d6f0ff);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  overflow: auto;
}
.vfe-rt-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(140, 180, 220, 0.32);
  font-style: italic;
}
.vfe-rt-editor h1, .vfe-rt-editor h2, .vfe-rt-editor h3 {
  margin: 8px 0 4px;
  color: var(--vfe-accent, #00f2ff);
}
.vfe-rt-editor h1 { font-size: 18px; }
.vfe-rt-editor h2 { font-size: 16px; }
.vfe-rt-editor h3 { font-size: 14px; }
.vfe-rt-editor p { margin: 4px 0; }
.vfe-rt-editor strong { color: #fff; }
.vfe-rt-editor a { color: #6ce8ff; text-decoration: underline; }
.vfe-rt-editor ul, .vfe-rt-editor ol { padding-left: 22px; margin: 4px 0; }
.vfe-rt-editor blockquote {
  border-left: 3px solid var(--vfe-accent, #00f2ff);
  padding: 4px 12px;
  margin: 6px 0;
  background: rgba(0, 242, 255, 0.05);
  color: rgba(200, 232, 255, 0.85);
}
.vfe-rt-editor code {
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.9em;
  color: #ffd54f;
}
.vfe-rt-statusbar {
  padding: 4px 10px;
  font-size: 10.5px;
  color: rgba(140, 180, 220, 0.45);
  border-top: 1px dashed rgba(0, 242, 255, 0.1);
  background: rgba(0, 18, 45, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* —— 空白状态 / 提示语 —— */
.vfe-help {
  font-size: 11px;
  color: rgba(140, 180, 220, 0.55);
  background: rgba(0, 100, 180, 0.06);
  border-left: 3px solid rgba(0, 242, 255, 0.3);
  padding: 6px 10px;
  border-radius: 0 5px 5px 0;
  margin: 4px 0 8px;
  line-height: 1.55;
}
.vfe-help strong { color: rgba(0, 242, 255, 0.8); }

/* —— 多列网格布局 —— */
.vfe-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vfe-row-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.vfe-row-4col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.vfe-row-mixed { display: grid; gap: 8px; }
@media (max-width: 720px) {
  .vfe-row-2col, .vfe-row-3col, .vfe-row-4col { grid-template-columns: 1fr; }
}

/* —— 数值滑块 —— */
.vfe-slider-row { display: flex; gap: 8px; align-items: center; }
.vfe-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--vfe-accent, #00f2ff) var(--p, 50%), rgba(0, 242, 255, 0.12) var(--p, 50%));
  outline: none;
  cursor: pointer;
}
.vfe-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--vfe-accent, #00f2ff);
  border: 2px solid #000;
  box-shadow: 0 0 8px rgba(0, 242, 255, 0.5);
  cursor: grab;
}
.vfe-slider::-webkit-slider-thumb:active { cursor: grabbing; }
.vfe-slider-val {
  flex: 0 0 56px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(0, 242, 255, 0.14);
  color: var(--vfe-text-1, #d6f0ff);
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 12px;
  text-align: right;
  font-family: 'JetBrains Mono', Consolas, monospace;
}

/* —— 状态徽标 —— */
.vfe-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.vfe-tag.success { background: rgba(76, 217, 100, 0.15); color: #4cd964; border: 1px solid rgba(76, 217, 100, 0.32); }
.vfe-tag.warn { background: rgba(255, 183, 77, 0.15); color: #ffb74d; border: 1px solid rgba(255, 183, 77, 0.32); }
.vfe-tag.info { background: rgba(0, 242, 255, 0.12); color: var(--vfe-accent, #00f2ff); border: 1px solid rgba(0, 242, 255, 0.32); }

