/* 在线白板（纯本地版）样式 —— 仅在白板工具页加载，所有类名统一 wb- 前缀，避免污染页面 */
.wb-root {
  display: flex;
  flex-direction: column;
  height: 70vh;
  max-height: 760px;
  min-height: 560px;
  box-sizing: border-box;
  background: #f5f6f8;
  color: #1f2430;
  border: 1px solid #e3e6eb;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.wb-root * { box-sizing: border-box; }
.wb-root button { font-family: inherit; cursor: pointer; }
.wb-root button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 顶部主工具栏（窄屏横向滚动） ---------- */
.wb-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 6px 8px;
  background: #fff;
  border-bottom: 1px solid #e6e8ed;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}
.wb-toolbar::-webkit-scrollbar,
.wb-subbar::-webkit-scrollbar,
.wb-pages-list::-webkit-scrollbar { height: 6px; width: 6px; }
.wb-toolbar::-webkit-scrollbar-thumb,
.wb-subbar::-webkit-scrollbar-thumb,
.wb-pages-list::-webkit-scrollbar-thumb { background: #d5d9e0; border-radius: 3px; }

.wb-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 36px;
  height: 36px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #4b5563;
  font-size: 10px;
  line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
}
.wb-tool svg { width: 18px; height: 18px; flex: 0 0 auto; }
.wb-root.bar-collapsed .wb-subbar { display: none; }
.wb-tool:hover { background: #f0f2f6; color: #111827; }
.wb-tool.active { background: #e8f0ff; border-color: #bcd3ff; color: #1d4ed8; }
.wb-sep { width: 1px; align-self: stretch; margin: 4px 5px; background: #e5e7eb; flex: 0 0 auto; }
.wb-toolbar .wb-spacer { flex: 1 1 auto; min-width: 8px; }
.wb-local-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 12px;
  background: #eaf7ef;
  color: #24743e;
  font-size: 11px;
  white-space: nowrap;
}

/* ---------- 第二排：颜色 / 粗细 / 透明度 / 操作 / 缩放 ---------- */
.wb-subbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 7px 10px;
  background: #fbfcfd;
  border-bottom: 1px solid #e6e8ed;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}
.wb-group { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.wb-group-label { color: #6b7280; font-size: 11px; margin-right: 2px; }
.wb-swatch {
  width: 18px; height: 18px;
  padding: 0;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 50%;
  background: var(--sw);
  transition: transform .12s, box-shadow .12s;
}
.wb-swatch:hover { transform: scale(1.14); }
.wb-swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2563eb; }
.wb-color-input {
  width: 30px; height: 24px; padding: 1px;
  border: 1px solid #d7dbe2; border-radius: 5px; background: #fff; cursor: pointer;
}
.wb-range { width: 88px; accent-color: #2563eb; cursor: pointer; }
.wb-val { min-width: 34px; color: #4b5563; font-size: 11px; font-variant-numeric: tabular-nums; }
.wb-act {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 28px; padding: 0 8px;
  border: 1px solid #d9dde4; border-radius: 6px;
  background: #fff; color: #374151; font-size: 12px;
  transition: background .15s, border-color .15s, color .15s;
}
.wb-act svg { width: 15px; height: 15px; }
.wb-act:hover:not(:disabled) { background: #f0f3f9; border-color: #b9c2d0; color: #111827; }
.wb-act.active { background: #e8f0ff; border-color: #bcd3ff; color: #1d4ed8; }
.wb-zoom-val { min-width: 42px; text-align: center; color: #374151; font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------- 画布区域 ---------- */
.wb-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 260px;
  overflow: hidden;
  background: #fff;
}
.wb-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
}
.wb-stage[data-tool="select"] .wb-canvas { cursor: default; }
.wb-stage[data-tool="text"] .wb-canvas { cursor: text; }
.wb-stage.is-panning .wb-canvas { cursor: grabbing !important; }

/* 内联文本编辑器：浮在画布上方，编辑时覆盖对应对象 */
.wb-text-editor {
  position: absolute;
  z-index: 5;
  display: block;
  margin: 0;
  padding: 2px 4px;
  border: 1px solid #2563eb;
  border-radius: 3px;
  outline: none;
  resize: both;
  background: rgba(255,255,255,.96);
  box-shadow: 0 2px 10px rgba(37,99,235,.18);
  overflow: auto;
  line-height: 1.25;
  white-space: pre-wrap;
  word-break: break-word;
}
.wb-text-editor[hidden] { display: none; }

/* ---------- 左下角页码与新增页（参照 Draw.Chat 紧凑样式） ---------- */
.wb-pages {
  position: absolute;
  left: 10px; bottom: 10px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wb-page-current,
.wb-page-add {
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #d9dde4;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.wb-page-current:hover,
.wb-page-add:hover { border-color: #9dbcf7; background: #f7faff; }
.wb-page-pop {
  position: absolute;
  left: 0; bottom: 38px;
  width: 230px;
  max-width: calc(100vw - 28px);
  padding: 8px;
  border: 1px solid #e0e4ea;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
}
.wb-page-pop[hidden] { display: none; }
.wb-page-pop .wb-act { width: 100%; justify-content: center; margin-top: 6px; }
.wb-pages-list {
  display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto; min-width: 0; max-height: 180px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.wb-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 82px; height: 58px;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #f3f4f6;
  transition: border-color .15s, background .15s;
}
.wb-thumb:hover { border-color: #9dbcf7; }
.wb-thumb.active { border-color: #2563eb; background: #eaf1ff; }
.wb-thumb canvas { display: block; width: 100%; height: 100%; border-radius: 3px; background: #fff; }
.wb-thumb span {
  position: absolute; right: 3px; bottom: 3px;
  min-width: 16px; padding: 0 3px;
  border-radius: 8px; background: rgba(17,24,39,.65); color: #fff;
  font-size: 10px; text-align: center;
}

/* ---------- 帮助面板 / 轻提示 ---------- */
.wb-help {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: auto;
  padding: 22px;
  background: rgba(249,250,252,.97);
  backdrop-filter: blur(2px);
}
.wb-help[hidden] { display: none; }
.wb-help-card {
  max-width: 720px; margin: 0 auto; padding: 18px 20px;
  background: #fff; border: 1px solid #e3e6eb; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(15,23,42,.08);
}
.wb-help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wb-help h3 { margin: 0 0 10px; font-size: 16px; }
.wb-help h4 { margin: 16px 0 6px; font-size: 13px; color: #111827; }
.wb-help p { margin: 6px 0; color: #4b5563; }
.wb-help ul { margin: 6px 0; padding-left: 18px; color: #4b5563; }
.wb-help li { margin: 3px 0; }
.wb-kbd {
  display: inline-block; min-width: 20px; padding: 1px 5px; margin: 0 1px;
  border: 1px solid #d5d9e0; border-bottom-width: 2px; border-radius: 4px;
  background: #f8fafc; color: #1f2937; font: 11px/1.5 ui-monospace, Consolas, monospace; text-align: center;
}
.wb-notice {
  margin-top: 14px; padding: 10px 12px;
  border: 1px solid #f3d9a4; border-radius: 7px;
  background: #fff9ec; color: #7a5310; font-size: 12px;
}
.wb-msg {
  position: absolute; left: 50%; bottom: 18px; z-index: 30;
  transform: translateX(-50%);
  max-width: 90%; padding: 7px 14px;
  border-radius: 6px; background: rgba(17,24,39,.86); color: #fff;
  font-size: 12px; pointer-events: none; opacity: 0;
  transition: opacity .2s;
}
.wb-msg.show { opacity: 1; }

/* ---------- 窄屏适配：工具栏滚动、画布保持可用 ---------- */
@media (max-width: 720px) {
  .wb-root { height: 62vh; min-height: 420px; border-radius: 8px; }
  .wb-toolbar { padding: 5px 6px; gap: 2px; }
  .wb-tool { min-width: 34px; height: 34px; padding: 4px; }
  .wb-tool svg { width: 17px; height: 17px; }
  .wb-local-badge, .wb-sep { display: none; }
  .wb-subbar { padding: 6px; gap: 8px; }
  .wb-range { width: 66px; }
  .wb-pages { left: 6px; bottom: 6px; }
  .wb-page-current, .wb-page-add { min-width: 30px; height: 28px; }
  .wb-thumb { width: 74px; height: 52px; }
  .wb-help { padding: 10px; }
  .wb-help-card { padding: 14px; }
}
