:root {
  --bg: #0e0d0c;
  --bar: rgba(22, 20, 18, 0.94);
  --text: #f2ece4;
  --muted: #9a9187;
  --accent: #ebbe6c;
  --mark: #e8943a;
  --hot: rgba(0, 220, 140, 0.22);
  --hot-line: rgba(0, 255, 160, 0.9);
  --font: "PingFang SC", "Microsoft YaHei", sans-serif;
  --drawer: rgba(18, 16, 14, 0.96);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92em;
  color: var(--accent);
}
a { color: var(--accent); }

.app {
  height: 100%;
  display: grid;
  grid-template-rows: 52px 1fr;
}

.bar {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  background: var(--bar);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 20;
  position: relative;
}
.bar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  padding: 0 10px;
  box-sizing: border-box;
  /* 默认与舞台同宽公式，JS 会按 .frame 实际位置精对齐 */
  width: min(100%, calc((100vh - 52px) * 2732 / 2048));
  margin-left: auto;
  margin-right: auto;
}
.bar-brand {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  margin: 0;
  white-space: nowrap;
  pointer-events: none;
  max-width: calc(100% - 280px);
  overflow: hidden;
}
.bar-title {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.12em;
  color: #f3d7a3;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), 0 0 18px rgba(235, 190, 108, 0.22);
}
.bar-slogan {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #e8c48a;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  opacity: 0.92;
}
.bar-legend {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  max-width: min(62%, 640px);
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 225, 120, 0.22);
  white-space: nowrap;
  pointer-events: none;
  z-index: 0;
}
.bar-legend .leg-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(242, 236, 228, 0.88);
}
.bar-legend .leg-mark {
  display: inline-block;
  flex: 0 0 auto;
}
.bar-legend .leg-diamond {
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  border-radius: 1.5px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.bar-legend .leg-star {
  width: 14px;
  height: 14px;
  background: #3cbe5a;
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.45));
}
.bar-legend .tone-orange .leg-diamond { background: #f08a24; }
.bar-legend .tone-cyan .leg-diamond { background: #2ec8d6; }
.bar-legend .tone-orange { color: #f3c08a; }
.bar-legend .tone-cyan { color: #9fe4ea; }
.bar-legend .tone-green { color: #9ad9a8; }
.muted { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; z-index: 1; }

.sel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.sel select {
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #141414;
  border: 1px solid rgba(255,255,255,0.22);
  color: #f5f5f5;
  font: inherit;
  color-scheme: dark;
}
.sel select option {
  background: #111111;
  color: #ffffff;
}
.sel select option:checked,
.sel select option:hover {
  background: #2a6df5;
  color: #ffffff;
}

.btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { background: rgba(255,255,255,0.12); }
.btn.on { background: var(--accent); color: #2a2214; border-color: var(--accent); }
.btn.ghost { color: var(--muted); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.file-btn { cursor: pointer; }

.stage {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #090807;
  padding: 0;
  container-type: size;
}

.frame {
  position: relative;
  container-type: inline-size;
  /* 尽量放大占满舞台；优先吃掉上下黑边，保持截图比例 */
  aspect-ratio: 2732 / 2048;
  width: min(100%, calc((100vh - 52px) * 2732 / 2048));
  height: auto;
  max-width: 100%;
  max-height: 100%;
  line-height: 0;
  box-shadow: none;
}
@supports (width: 1cqw) {
  .frame {
    width: min(100cqw, calc(100cqh * 2732 / 2048));
  }
}
.frame.edit-marks,
.frame.edit-hots {
  outline: 2px dashed rgba(235, 190, 108, 0.55);
}
.frame.edit-marks { cursor: crosshair; }
.frame.ctrl-live {
  cursor: default;
  outline: none;
}
.frame.ctrl-live .hotspot,
.frame.ctrl-live .tab-hotspot,
.frame.ctrl-live .panel-action {
  background: transparent !important;
  border-color: transparent !important;
  cursor: pointer !important;
}
.frame.ctrl-live .marker { pointer-events: none; }
/* Shift 调位 / Alt 删除：暂时关掉热区命中，让菱形直接接到鼠标 */
.frame.mark-priority .hotspot,
.frame.mark-priority .tab-hotspot,
.frame.mark-priority .panel-action,
.frame.mark-priority .primitive-hotspot-layer button,
.frame.mark-priority .tool-chrome-hots .hotspot,
.frame.mark-priority #tool-rail-hots .hotspot {
  pointer-events: none !important;
}
.field.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.field.check input { width: auto; }

.home {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: fill;
  user-select: none;
}

.viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 1;
  user-select: none;
  background: transparent;
}
/* 右下角永久版本：右对齐贴合原生位置；垫色盖住 2.9.29；不挡点击 */
.version-stamp {
  position: absolute;
  left: auto;
  top: auto;
  /* 覆盖烤进图的版本区（约 2580–2725 × 1905–2015） */
  right: 0.25%;
  bottom: 1.5%;
  width: 5.6%;
  height: 5.4%;
  z-index: 90;
  pointer-events: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  padding: 0.55% 0.55% 0.7% 0.7%;
  background: rgb(14, 10, 10);
  border-radius: 2px;
  color: rgb(168, 168, 168);
  font-family: "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-align: right;
  user-select: none;
}
.version-stamp-ver {
  font-size: clamp(10px, 1.4cqw, 16px);
}
.version-stamp-device {
  font-size: clamp(10px, 1.4cqw, 16px);
}
.prim-bar {
  position: absolute;
  pointer-events: none;
  /* 高于默认叠加菜单；后开的二级菜单由 JS 抬到 40+，会盖住本栏 */
  z-index: 34;
  user-select: none;
}
.viewport.hidden,
.prim-bar.hidden { display: none; }
/* 必须低于 .marker-layer：底栏「盖帽/更多」等热区不能挡住菱形 */
.primitive-hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 35;
}
.view-actions {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.frame.edit-hots .view-actions {
  z-index: 9;
}
.view-actions .hotspot,
.view-actions .view-action-btn {
  pointer-events: auto;
}
.view-action-btn {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: #f08a24;
  color: #111;
  font-size: clamp(12px, 1.2cqw, 16px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  padding: 0;
  transform: translate(-50%, -50%);
}
.frame.mark-priority .view-actions .hotspot,
.frame.mark-priority .view-action-btn {
  pointer-events: none !important;
}

.active-top-icon-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.active-top-icon-layer img {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
/* 标注压在热区之上：只命中菱形本身，周围仍留给热区 */
.marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* 高于基本体底栏，菱形仍可点 */
  z-index: 36;
}
/* 工具特殊菜单打开时，顶栏第二个图标热区必须在弹出层之上，才能再次点击关闭 */
.hotspot-layer.above-pop {
  z-index: 35;
}
.marker-layer.hidden { display: none; }

.show-hot .hotspot,
.frame.show-hot .hotspot {
  background: var(--hot);
  border: 2px solid var(--hot-line);
}
/* 非编辑/非显示热区时，主界面热区也不画框 */
.hotspot {
  position: absolute;
  pointer-events: auto;
  border-radius: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  outline: none;
}

.marker {
  position: absolute;
  pointer-events: auto;
  width: 15px;
  height: 15px;
  margin-left: -7.5px;
  margin-top: -7.5px;
  border-radius: 0;
  background: transparent;
  color: #f08a24;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: none;
  border: 0;
  z-index: 4;
  transition: transform 0.12s ease;
  padding: 0;
  line-height: 1;
  overflow: visible;
  touch-action: none;
  --mark-visual: 15px;
}
/* 图标画在中间；按钮盒本身更大，负责命中（见 makeMarker） */
.marker svg {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--mark-visual);
  height: var(--mark-visual);
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
}
.marker svg .mark-body > * {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 12;
  paint-order: stroke fill;
}
.marker svg .mark-rim > * {
  fill: none;
  stroke: transparent;
  stroke-width: 0;
}
.marker .mark-num {
  position: relative;
  z-index: 1;
  pointer-events: none;
  color: #1a1208;
  font-size: inherit;
  font-weight: 700;
  line-height: 1;
}
.marker.no-num .mark-num { display: none; }
.marker:hover {
  transform: scale(1.12);
}
.marker.active,
.marker.selected {
  transform: scale(1.22);
  z-index: 12;
}
/* 激活 / 多选：白描边（比上一版略收） */
.marker.active svg .mark-rim > *,
.marker.selected svg .mark-rim > * {
  stroke: #fff;
  stroke-width: 34;
  stroke-linejoin: round;
}
.marker.active svg .mark-body > *,
.marker.selected svg .mark-body > * {
  stroke: #fff;
  stroke-width: 18;
  paint-order: stroke fill;
}
.marker.active::after,
.marker.selected::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--mark-visual) * 0.3);
  height: calc(var(--mark-visual) * 0.3);
  margin: calc(var(--mark-visual) * -0.15) 0 0 calc(var(--mark-visual) * -0.15);
  border-radius: 50%;
  background: #fff;
  z-index: 2;
  pointer-events: none;
}
.marker.tone-red { color: #f25a9b; }
.marker.tone-orange { color: #f08a24; }
.marker.tone-yellow { color: #ffe14a; }
.marker.tone-green { color: #3cbe5a; }
.marker.tone-cyan { color: #2ec8d6; }
.marker.tone-blue { color: #3a7bff; }
.marker.tone-purple { color: #8b4dff; }
.marker.tone-blue .mark-num,
.marker.tone-red .mark-num,
.marker.tone-purple .mark-num { color: #fff; }

.panel {
  position: absolute;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: none;
  background: #1c1a18;
  z-index: 5;
  display: flex;
  flex-direction: column;
  /* 只过渡位置/宽度；高度过渡会在换图瞬间让内容溢出，侧边滚动条闪一下 */
  transition: left 0.12s ease, top 0.12s ease, width 0.12s ease;
}
/* 整图滚动面板：圆角已在截图里，避免 CSS 再裁切标题栏 */
.panel.no-radius {
  border-radius: 0;
  background: transparent;
}
.panel.hidden { display: none; }

.panel.panel-overlay {
  z-index: 8;
  overflow: visible;
  /* 叠加面板：透明底，避免矩形黑框露边。不过渡宽高，否则换灯时光条会把上方残留闪一下 */
  box-shadow: none;
  background: transparent;
  border-radius: 0;
  transition: none;
}
.panel.panel-overlay .panel-markers {
  z-index: 12;
}
/* 基线高于基本体/笔刷底栏(34)；运行时 open* 还会按打开顺序继续抬升 */
.panel.panel-pop { z-index: 38; }
.panel.panel-nest { z-index: 39; }

.panel.tool-left {
  /* 左侧常驻栏：低于项目等弹出菜单 */
  z-index: 2;
  overflow: hidden;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  scrollbar-width: none;
}
.panel.tool-left img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}
.panel.tool-rail-cover {
  z-index: 7;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}
.panel.tool-rail-cover img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  pointer-events: none;
}
.tool-rail {
  position: absolute;
  z-index: 12;
  overflow: hidden;
  background: transparent;
  border-radius: 18px;
  pointer-events: auto;
}
.tool-rail.hidden { display: none; }
.tool-rail-scroll {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
  pointer-events: auto;
}
.tool-rail-content { position: relative; width: 100%; pointer-events: auto; }
.tool-rail-long {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
}
.tool-rail-active {
  position: absolute;
  left: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}
.tool-rail-active.hidden { display: none; }
#tool-rail-hots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#tool-rail-hots .hotspot {
  pointer-events: auto;
  touch-action: pan-y;
}
.tool-chrome {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  object-fit: fill;
}
/* A=viewport；C侧顶 D侧栏 E侧小栏 低于弹出菜单；B底栏与基本体底栏同级 */
#tool-chrome-c,
#tool-chrome-d {
  z-index: 2;
}
#tool-chrome-e {
  z-index: 3;
}
#tool-chrome-b {
  z-index: 34;
}
.tool-chrome-fly { z-index: 34; }
.tool-chrome.hidden { display: none; }
/* 纯飞出图上的标注：压在飞出图之上（飞出被 JS 抬升时会同步再抬这一层） */
.tool-chrome-fly-markers {
  z-index: 36;
}
/* 工具底栏/飞出热区：低于菱形标注层；飞出抬升时 JS 会同步抬热区 */
.tool-chrome-hots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 35;
}
.tool-chrome-hots .hotspot {
  pointer-events: auto;
}

.panel-footer {
  position: relative;
  flex: 0 0 auto;
  line-height: 0;
  z-index: 6;
}
.panel-footer.hidden { display: none; }
.panel-footer img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.panel-head {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  z-index: 4;
  line-height: 0;
  border-radius: 14px 14px 0 0;
}
.panel-head img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  user-select: none;
  pointer-events: none;
}
.panel-head-markers {
  z-index: 6;
}
.panel-head .panel-content-actions {
  z-index: 5;
}

.panel-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #666 transparent;
}
/* 吸顶后内容下滚：顶栏下方阴影分界 */
.panel.is-head-scrolled > .panel-scroll::before {
  content: '';
  position: sticky;
  top: 0;
  display: block;
  height: 36px;
  margin-bottom: -36px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.49) 0%,
    rgba(0, 0, 0, 0.27) 40%,
    rgba(0, 0, 0, 0.07) 75%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 8;
}

.panel-content {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100%;
  line-height: 0;
}
/* 长图 + 标注同一层，吸顶时一起上移，避免各算各的高度 */
.panel-body-stack {
  position: relative;
  width: 100%;
  line-height: 0;
}

.panel-scroll img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
  /* 圆角在 PNG alpha 里；深色底会在透明角露出方块毛边 */
  background: transparent;
}

.panel-content-actions,
.panel-content-tabs,
.panel-active-icon-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
/* 高于 tab/action 热区，避免点标注却打开菜单 */
.panel-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}
.panel-active-icon-layer img {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
}
.panel-markers.hidden { display: none; }
.panel-markers .marker,
.panel-content-actions .panel-action,
.panel-content-tabs .tab-hotspot {
  pointer-events: auto;
  z-index: 3;
}

.frame.edit-marks .marker { cursor: grab; }
.frame.edit-marks .marker.dragging { cursor: grabbing; z-index: 8; }
.frame.nudge-marks .marker,
.frame.mark-priority .marker { cursor: grab; }
.frame.nudge-marks .marker.dragging,
.frame.mark-priority .marker.dragging { cursor: grabbing; z-index: 8; }
.frame.edit-marks .panel-markers,
.frame.nudge-marks .panel-markers,
.frame.mark-priority .panel-markers { z-index: 9; }
/* 编辑态也须高于基本体/笔刷底栏(34)与其热区(35)，否则底栏上的菱形会被盖住 */
.frame.edit-marks .marker-layer,
.frame.nudge-marks .marker-layer,
.frame.mark-priority .marker-layer { z-index: 37; }
.frame.edit-marks .tool-chrome-fly-markers,
.frame.nudge-marks .tool-chrome-fly-markers,
.frame.mark-priority .tool-chrome-fly-markers { z-index: 37; }

/* 热区编辑：热区回到标注之上，拖拽手感不受菱形挡 */
.frame.edit-hots .marker-layer {
  z-index: 2;
}
.frame.edit-hots .panel-markers {
  z-index: 1;
}
.frame.edit-hots .hotspot-layer {
  z-index: 4;
}
.frame.edit-hots .tab-hotspot-layer {
  z-index: 7;
}
.frame.edit-hots .panel-content-actions {
  z-index: 7;
}
/* 须高于 .prim-bar / 笔刷底栏(34)，否则底栏热区编辑时点不到、也看不见框 */
.frame.edit-hots .primitive-hotspot-layer,
.frame.edit-hots .tool-chrome-hots {
  z-index: 38;
}

.tab-hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.tab-hotspot,
.panel-action {
  position: absolute;
  pointer-events: auto;
  border-radius: 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
/* 默认完全看不见；仅「热区」或热区编辑时显示（用 outline，避免 border 参与盒模型导致退出编辑位移） */
.panel.show-tabs .tab-hotspot,
.panel.show-tabs .panel-action,
.frame.edit-hots .tab-hotspot,
.frame.edit-hots .panel-action,
.frame.show-hot .hotspot,
.frame.edit-hots .hotspot {
  background: rgba(80, 180, 255, 0.18);
  border: 0;
  outline: 2px solid rgba(100, 200, 255, 0.85);
  outline-offset: -2px;
}
.frame.edit-hots .tab-hotspot.selected,
.frame.edit-hots .panel-action.selected,
.frame.edit-hots .hotspot.selected {
  background: rgba(255, 176, 74, 0.28);
  outline-color: rgba(255, 190, 100, 0.95);
}
.frame.edit-hots .tab-hotspot,
.frame.edit-hots .panel-action,
.frame.edit-hots .hotspot {
  cursor: grab;
  touch-action: none;
}
.snap-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}
.snap-v,
.snap-h {
  position: absolute;
  pointer-events: none;
}
.snap-v {
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed rgba(255, 214, 90, 0.95);
}
.snap-h {
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed rgba(255, 214, 90, 0.95);
}
.frame.edit-hots .tab-hotspot.dragging,
.frame.edit-hots .panel-action.dragging,
.frame.edit-hots .hotspot.dragging {
  cursor: grabbing;
  background: rgba(235, 190, 108, 0.35);
  border-color: rgba(235, 190, 108, 0.95);
  z-index: 9;
}

/* 最高浮层：压过目录 / 课文 / 任意抬升菜单（uiLayerZ 常 >40） */
.editor {
  position: fixed;
  top: 60px;
  right: 14px;
  left: auto;
  width: min(380px, calc(100vw - 28px));
  max-height: calc(100vh - 100px);
  overflow: auto;
  background: var(--drawer);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 14px;
  z-index: 520;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
.editor #ed-drag {
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.editor.dragging #ed-drag { cursor: grabbing; }
.editor.dragging { user-select: none; }
.drawer,
.toc {
  position: fixed;
  top: 60px;
  right: 14px;
  left: auto;
  width: min(380px, calc(100vw - 28px));
  max-height: calc(100vh - 100px);
  overflow: auto;
  background: var(--drawer);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 14px;
  z-index: 40;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
/* 点击标注点展开的课文：必须压过任意抬升后的菜单（uiLayerZ 常 >40） */
.drawer {
  z-index: 500;
}
/* 课程目录：压过菜单与课文抽屉，仅次于编辑菜单 */
.toc {
  z-index: 510;
}
.toc #toc-drag {
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.toc.dragging #toc-drag { cursor: grabbing; }
.toc.dragging { user-select: none; }
.drawer.near-mark {
  top: auto;
  right: auto;
  width: min(340px, calc(100vw - 24px));
  max-height: min(70vh, calc(100vh - 24px));
  z-index: 520;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,176,74,0.25);
}
.drawer.hidden,
.toc.hidden,
.editor.hidden { display: none; }

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.drawer-head h2 {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  min-width: 0;
}
.toc .drawer-head h2 {
  flex: 0 1 auto;
}
.toc-filters {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: flex-end;
  margin-right: 2px;
  min-width: 0;
  /* 空白处交给标题栏拖动，按钮本身仍可点 */
  cursor: grab;
}
.toc.dragging .toc-filters { cursor: grabbing; }
.toc-filter {
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
.toc-filter:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.toc-filter.on {
  border-color: rgba(255,176,74,0.55);
  background: rgba(255,176,74,0.18);
  color: #ffd28a;
  font-weight: 600;
}
.toc-filter[data-toc-filter="update"].on {
  border-color: rgba(60,190,90,0.55);
  background: rgba(60,190,90,0.18);
  color: #8be09a;
}
.ed-history {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ed-hist-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #e8e4dc;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.ed-hist-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}
.ed-hist-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.22);
}
.ed-hist-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.drawer-num {
  min-width: 40px;
  height: 40px;
  padding: 0 4px;
  border-radius: 50%;
  background: var(--mark);
  color: #1a1208;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
  box-sizing: border-box;
}
.drawer-num.tone-red { background: #f25a9b; color: #fff; }
.drawer-num.tone-orange { background: #f08a24; color: #1a1208; }
.drawer-num.tone-yellow { background: #ffe14a; color: #1a1208; }
.drawer-num.tone-green { background: #3cbe5a; color: #1a1208; }
.drawer-num.tone-cyan { background: #2ec8d6; color: #1a1208; }
.drawer-num.tone-blue { background: #3a7bff; color: #fff; }
.drawer-num.tone-purple { background: #8b4dff; color: #fff; }
.drawer-num.dig3 { font-size: 12px; }
.drawer-num.dig4 { font-size: 11px; letter-spacing: -0.04em; }
.icon-x {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  color: var(--muted);
}
.icon-x:hover { background: rgba(255,255,255,0.08); color: #fff; }

.drawer-desc {
  font-size: 13px;
  line-height: 1.7;
  color: #d8d0c6;
  margin-bottom: 12px;
}
.drawer-desc p {
  margin: 0 0 0.95em;
  white-space: pre-wrap;
  word-break: break-word;
}
.drawer-desc p:last-child {
  margin-bottom: 0;
}
.drawer-image {
  position: relative;
  margin-bottom: 12px;
  border-radius: 10px;
  overflow: hidden;
  background: #0a0908;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: zoom-in;
}
.drawer-image img {
  display: block;
  width: 100%;
  height: auto;
}
.drawer-image-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: rgba(255,255,255,0.88);
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.14);
  pointer-events: none;
  opacity: 0.85;
}
.drawer-image:hover .drawer-image-hint { opacity: 1; }
.drawer-image.hidden { display: none; }

/* 说明图蒙版放大层 */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  touch-action: none;
}
.img-lightbox.hidden { display: none; }
.img-lightbox-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  background: rgba(20,18,16,0.75);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.img-lightbox-close:hover {
  background: rgba(40,36,32,0.9);
}
.img-lightbox-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: grab;
  padding: 48px 20px 36px;
}
.img-lightbox-stage.dragging { cursor: grabbing; }
.img-lightbox-stage img {
  max-width: min(96vw, 1400px);
  max-height: calc(100vh - 96px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.img-lightbox-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  pointer-events: none;
}
.drawer-video {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  margin-bottom: 12px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}
.drawer-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.drawer-video.hidden,
.drawer-empty.hidden { display: none; }
.drawer-empty {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.toc-search {
  display: block;
  margin: 0 0 10px;
}
.toc-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #eee;
  font-size: 13px;
  outline: none;
}
.toc-search input:focus {
  border-color: rgba(255,176,74,0.55);
  background: rgba(255,255,255,0.09);
}
.toc-search input::placeholder { color: rgba(255,255,255,0.35); }
.toc-list { list-style: none; }
.toc-list li + li { margin-top: 4px; }
.toc-list .toc-empty {
  padding: 12px 8px;
  color: var(--muted);
  font-size: 13px;
}
.toc-group {
  margin: 8px 0 4px;
  padding: 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  background: var(--drawer);
  z-index: 1;
  list-style: none;
}
.toc-list > .toc-group:first-child { margin-top: 0; }
.toc-group-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 8px 6px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.toc-group-btn:hover { background: rgba(255,255,255,0.06); }
.toc-group-chevron {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent rgba(255,210,150,0.75);
  flex-shrink: 0;
  transition: transform 0.15s ease;
  transform-origin: 35% 50%;
}
.toc-group.open .toc-group-chevron {
  transform: rotate(90deg);
}
.toc-group-title {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 210, 150, 0.92);
}
.toc-group-count {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  font-variant-numeric: tabular-nums;
}
.toc-item {
  list-style: none;
}
.toc-list .toc-item button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}
.toc-list .toc-item button:hover { background: rgba(255,255,255,0.06); }
.toc-title {
  min-width: 0;
  line-height: 1.35;
}
.toc-n {
  /* 略放大圆圈：四位数用稍小字号，比硬挤在 28px 里更清晰 */
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--mark);
  color: #1a1208;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.toc-n.dig3 { font-size: 11px; }
.toc-n.dig4 { font-size: 10px; letter-spacing: -0.04em; }
.toc-n.tone-red { background: #f25a9b; color: #fff; }
.toc-n.tone-orange { background: #f08a24; color: #1a1208; }
.toc-n.tone-yellow { background: #ffe14a; color: #1a1208; }
.toc-n.tone-green { background: #3cbe5a; color: #1a1208; }
.toc-n.tone-cyan { background: #2ec8d6; color: #1a1208; }
.toc-n.tone-blue { background: #3a7bff; color: #fff; }
.toc-n.tone-purple { background: #8b4dff; color: #fff; }

.ed-card {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
}
.ed-card-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.ed-inline {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.ed-inline .field { margin-bottom: 10px; }
.field-num { width: 88px; flex-shrink: 0; }
.field-grow { flex: 1; min-width: 0; }
.ed-image {
  position: relative;
  min-height: 64px;
  border-radius: 10px;
  border: 1px dashed rgba(255,176,74,0.35);
  background: rgba(0,0,0,0.28);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  outline: none;
}
.ed-image:focus,
.ed-image:hover {
  border-color: rgba(255,176,74,0.7);
  background: rgba(255,176,74,0.06);
}
.ed-image-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}
.ed-image-empty strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.ed-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 88px;
  object-fit: contain;
  background: #050505;
}
.ed-image img.hidden,
.ed-image-empty.hidden,
.ed-image-clear.hidden { display: none; }
.ed-image.has-image .ed-image-empty { display: none; }
.ed-image-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  font-size: 12px;
}
.ed-dock {
  position: sticky;
  bottom: -14px;
  margin: 12px -14px -14px;
  padding: 12px 14px 14px;
  background: var(--drawer);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}
.color-row .clone-count {
  margin-left: auto;
}
.switch-item.on[data-for="clone"] { color: #7fd4c8; }
.switch.on[id="ed-clone"] {
  background: #2f9e90;
  box-shadow: 0 0 0 1px rgba(127,212,200,0.55), 0 0 12px rgba(47,158,144,0.3);
}
.switch-item.on[data-for="pinfixed"] { color: #c9a0ff; }
.switch.on[id="ed-pinfixed"] {
  background: #7a4fd6;
  box-shadow: 0 0 0 1px rgba(201,160,255,0.55), 0 0 12px rgba(122,79,214,0.35);
}
.switch-item.on[data-for="poslocked"] { color: #ff9a7a; }
.switch.on[id="ed-poslocked"] {
  background: #d45a3a;
  box-shadow: 0 0 0 1px rgba(255,154,122,0.55), 0 0 12px rgba(212,90,58,0.35);
}
.editor.multi-lock .ed-card[aria-label="标注内容"],
.editor.multi-lock .switch-item:not([data-for="pinfixed"]):not([data-for="poslocked"]):not([data-for="clone"]),
.editor.multi-lock .ed-actions {
  opacity: 0.38;
  pointer-events: none;
  filter: grayscale(0.35);
}
.editor.multi-lock .ed-actions #ed-export,
.editor.multi-lock .ed-actions #ed-commit,
.editor.multi-lock .ed-actions #ed-deploy,
.editor.multi-lock .ed-actions .file-btn {
  opacity: 1;
  pointer-events: auto;
  filter: none;
}
.editor.multi-lock .ed-card[aria-label="标记样式"],
.editor.multi-lock .switch-item[data-for="pinfixed"],
.editor.multi-lock .switch-item[data-for="poslocked"],
.editor.multi-lock .switch-item[data-for="clone"],
.editor.multi-lock .ed-align {
  opacity: 1;
  pointer-events: auto;
  filter: none;
}
.ed-align {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  padding: 2px 0 0;
  opacity: 0.42;
  pointer-events: none;
}
.editor.multi-lock .ed-align {
  opacity: 1;
  pointer-events: auto;
}
.align-btn {
  width: 100%;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: #d8dde6;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.align-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
}
.align-btn:active {
  background: rgba(255,176,74,0.2);
  border-color: rgba(255,176,74,0.45);
  color: #ffd29a;
}
.align-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 须压过抬升后的菜单/飞出与标注编辑面板（≥500） */
.marquee-select {
  position: fixed;
  z-index: 560;
  pointer-events: none;
  border: 1.5px solid rgba(255, 176, 74, 0.95);
  background: rgba(255, 160, 60, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.marquee-select.hidden { display: none; }
.clone-count {
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}
.clone-count.has-clones {
  color: #7fd4c8;
  border-color: rgba(127,212,200,0.45);
  background: rgba(47,158,144,0.18);
}
.shape-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
}
.shape-picks {
  display: flex;
  gap: 6px;
  align-items: center;
}
.shape-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.shape-btn.on {
  border-color: #ffb04a;
  background: rgba(255,176,74,0.16);
}
.shape-ico {
  width: 14px;
  height: 14px;
  background: #d8d2c8;
  display: block;
}
.shape-circle { border-radius: 50%; }
.shape-star {
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
}
.shape-tri-down { clip-path: polygon(0 0, 100% 0, 50% 100%); }
.shape-square { border-radius: 2px; }
.shape-diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.size-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 140px;
}
.size-field input[type="range"] {
  flex: 1;
  accent-color: #ffb04a;
}
.size-field #ed-size-val {
  width: 24px;
  text-align: right;
  color: var(--text);
}
.ed-image.dragover {
  border-color: rgba(255,176,74,0.85);
  background: rgba(255,176,74,0.12);
}
.switch-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.switch-stack.switch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  align-items: center;
}
.switch-stack.switch-grid .switch-item {
  min-width: 0;
}
.switch-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.switch-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s ease;
}
.swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.on { border-color: #fff; }
.swatch[data-color="red"] { background: #f25a9b; }
.swatch[data-color="orange"] { background: #f08a24; }
.swatch[data-color="yellow"] { background: #ffe14a; }
.swatch[data-color="green"] { background: #3cbe5a; }
.swatch[data-color="cyan"] { background: #2ec8d6; }
.swatch[data-color="blue"] { background: #3a7bff; }
.swatch[data-color="purple"] { background: #8b4dff; }
.switch-item.on[data-for="mark"] { color: #ffb04a; }
.switch-item.on[data-for="hot"] { color: #5ec8ff; }
.switch-item.on[data-for="shownum"] { color: #e8d06a; }
.switch-item.on[data-for="autonum"] { color: #6ee08a; }
.switch-item .switch,
.switch {
  width: 44px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #3a3a3a;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f3f3f3;
  transition: transform 0.15s ease;
}
.switch.on::after { transform: translateX(20px); }
.switch.on[id="ed-mark"] {
  background: #d8892a;
  box-shadow: 0 0 0 1px rgba(255,176,74,0.55), 0 0 12px rgba(255,176,74,0.35);
}
.switch.on[id="ed-hot"] {
  background: #2a7fbf;
  box-shadow: 0 0 0 1px rgba(94,200,255,0.55), 0 0 12px rgba(94,200,255,0.35);
}
.switch.on[id="ed-shownum"] {
  background: #b89a28;
  box-shadow: 0 0 0 1px rgba(232,208,106,0.55), 0 0 12px rgba(232,208,106,0.3);
}
.switch.on[id="ed-autonum"] {
  background: #2f9a4a;
  box-shadow: 0 0 0 1px rgba(110,224,138,0.55), 0 0 12px rgba(110,224,138,0.3);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.field-desc textarea {
  min-height: 200px;
  height: 200px;
}
.author-only.hidden { display: none; }
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 20px;
}
.auth-modal.hidden { display: none; }
.auth-card {
  width: min(360px, 100%);
  background: #1a1a1a;
  color: #f5f5f5;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
.auth-card.deploy-card {
  width: min(440px, 100%);
}
.deploy-options {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}
.deploy-opt {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: #f2ece4;
  cursor: pointer;
}
.deploy-opt:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(235,190,108,0.45);
}
.deploy-opt.primary {
  border-color: rgba(235,190,108,0.55);
  background: rgba(235,190,108,0.1);
}
.deploy-opt strong {
  font-size: 14px;
  color: #ffe6b0;
}
.deploy-opt span {
  font-size: 12px;
  line-height: 1.4;
  color: #a8a095;
}
.auth-card h2 {
  margin: 0 0 8px;
  font-size: 16px;
}
.auth-card .muted {
  margin: 0 0 12px;
  font-size: 12px;
  color: #bdbdbd;
}
.auth-card code {
  color: #ffe08a;
}
.ed-status {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  white-space: pre-wrap;
}
.ed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

@media (max-width: 800px) {
  .bar {
    align-items: stretch;
    flex-direction: column;
    height: auto;
    min-height: 52px;
    padding: 8px 0;
  }
  .bar-inner {
    width: 100% !important;
    margin-left: 0 !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 4px 10px 8px;
  }
  .bar-brand {
    position: static;
    transform: none;
    width: 100%;
    max-width: none;
    flex-wrap: wrap;
    padding-left: 2px;
  }
  .bar-title {
    font-size: 15px;
    letter-spacing: 0.08em;
  }
  .bar-slogan {
    font-size: 13px;
  }
  .bar-legend {
    position: static;
    transform: none;
    max-width: none;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 2px 0 4px;
    pointer-events: none;
  }
  .actions { justify-content: center; }
  .app { grid-template-rows: auto 1fr; }
  .drawer, .toc, .editor {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 48vh;
    border-radius: 14px 14px 0 0;
  }
}

/* 回访用户（本地已记录）：不挡操作，后台仍刷新标注 */
html.nomad-skip-boot .boot-screen {
  display: none !important;
}

/* 首屏加载蒙版：阻止误触，直到标注层就绪 */
body.is-booting {
  overflow: hidden;
}
body.is-booting .app {
  pointer-events: none;
  user-select: none;
}
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 9, 8, 0.94);
  pointer-events: auto;
  transition: opacity 0.4s ease;
}
.boot-screen.hidden {
  display: none;
}
.boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}
.boot-screen-card {
  width: min(92vw, 360px);
  text-align: center;
  padding: 28px 22px 24px;
  border-radius: 16px;
  background: rgba(28, 25, 22, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
.boot-screen-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
  color: var(--text);
}
.boot-screen-hint {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 18px;
  line-height: 1.45;
}
.boot-screen-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-bottom: 8px;
}
.boot-screen-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c8842e, var(--accent));
  transition: width 0.35s ease;
}
.boot-screen-pct {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin-bottom: 14px;
}
.boot-screen-note {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(154, 145, 135, 0.95);
}
