/* DrawingBoard 自研内核算样式 —— 全部为项目自有，无第三方 UI 库 */

:root {
  --bg: #F7F8FA;
  --ink: #1D2129;
  --sub: #4E5969;
  --muted: #86909C;
  --line: #E5E6EB;
  --panel: #FFFFFF;
  --accent: #165DFF;
  --shadow: 0 2px 10px rgba(29, 33, 41, .07);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); overflow: hidden; }
body {
  font: 12px/1.5 system-ui, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
}

#board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: default;
}

/* 文本编辑覆盖层 */
#editor-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}
.db-editor {
  position: absolute;
  pointer-events: auto;
  margin: 0;
  padding: 0;
  border: none;
  outline: 1px dashed rgba(22, 93, 255, .55);
  background: rgba(255, 255, 255, .0);
  caret-color: var(--accent);
  transform-origin: top left;
  white-space: pre;
  overflow-wrap: normal;
  min-width: 4px;
  min-height: 1em;
}

/* 左侧工具栏 */
.toolbar {
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.tb-btn {
  width: 34px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 500 13px/1 system-ui, "Microsoft YaHei", sans-serif;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.tb-btn:hover { background: #F2F3F5; }
.tb-btn.on { background: rgba(22, 93, 255, .10); color: var(--accent); }
.tb-btn:disabled { color: #C9CDD4; cursor: default; background: transparent; }
.tb-sep { height: 1px; margin: 3px 4px; background: var(--line); }

/* 右侧样式面板 */
.panel {
  position: fixed;
  right: 12px;
  top: 12px;
  bottom: 12px;
  width: 236px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 20;
  overflow: hidden;
}
.pn-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.pn-head span { font-weight: 600; font-size: 12px; }
.pn-head em { color: var(--muted); font-style: normal; font-size: 11px; }
.pn-body { padding: 4px 12px 12px; overflow-y: auto; }
.pn-body::-webkit-scrollbar { width: 8px; }
.pn-body::-webkit-scrollbar-thumb { background: #E5E6EB; border-radius: 4px; }
.pn-body::-webkit-scrollbar-thumb:hover { background: #C9CDD4; }
.pn-sec { padding: 5px 0 2px; border-bottom: 1px dashed var(--line); }
.pn-sec:last-child { border-bottom: 0; }
.pn-title { color: var(--sub); font-weight: 600; margin-bottom: 4px; }
.pn-hint { color: var(--muted); margin-top: 4px; font-size: 11px; }
.pn-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.pn-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.pn-sw {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  border: 1px solid rgba(29, 33, 41, .12);
  cursor: pointer;
  padding: 0;
}
.pn-sw:hover { transform: scale(1.08); }
.pn-sw-none {
  background:
    linear-gradient(45deg, transparent 45%, #F53F3F 45%, #F53F3F 55%, transparent 55%),
    #FFF;
}
.pn-chip {
  flex: 1 1 auto;
  min-width: 34px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #FFF;
  color: var(--sub);
  font: 11px/1.2 inherit;
  cursor: pointer;
}
.pn-chip:hover { border-color: #C9CDD4; color: var(--ink); }

/* HUD / 提示 */
.hud {
  position: fixed;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--sub);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 20;
}
.badge {
  position: fixed;
  right: 260px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(22, 93, 255, .08);
  border: 1px solid rgba(22, 93, 255, .18);
  color: var(--accent);
  pointer-events: none;
  z-index: 20;
}
.hint {
  position: fixed;
  bottom: 12px;
  left: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  color: var(--sub);
  pointer-events: none;
  z-index: 20;
}
.hint b { color: var(--ink); font-weight: 600; }

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%) translateY(0);
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(29, 33, 41, .9);
  color: #fff;
  z-index: 40;
  transition: opacity .4s, transform .4s;
}
.toast-out { opacity: 0; transform: translateX(-50%) translateY(6px); }

/* 协作状态角标（仅连接房间时显示） */
.room-chip {
  position: fixed;
  top: 46px;
  left: 12px;
  display: none;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(0, 180, 42, .10);
  border: 1px solid rgba(0, 180, 42, .28);
  color: #00B42A;
  z-index: 20;
  pointer-events: none;
}

/* 只读分享模式：隐藏编辑 UI，只留画布与协作状态 */
body.viewer .toolbar,
body.viewer .panel,
body.viewer .hint {
  display: none !important;
}
body.viewer .badge {
  background: rgba(0, 180, 42, .10);
  border-color: rgba(0, 180, 42, .28);
  color: #00B42A;
}
