:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2230;
  --border: #2a3240;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --accent-2: #1f6feb;
  --ok: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --viewport-bg: #000;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #11161f, #0d1117);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.brand .logo { color: var(--accent); margin-right: 4px; }
.brand .ver {
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: var(--accent-2);
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.tb {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: all .12s ease;
  white-space: nowrap;
}
.tb:hover { background: #28324a; border-color: var(--accent); }
.tb.tool.active {
  background: var(--accent-2);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.tb:active { transform: translateY(1px); }
.sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* ===== 主区 ===== */
.main {
  display: flex;
  height: calc(100% - 53px);
}
.sidebar {
  width: 250px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar.right { border-right: none; border-left: 1px solid var(--border); width: 280px; }
.panel { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.panel h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
}

/* 序列列表 */
.series-list { list-style: none; margin: 0; padding: 0; }
.series-list li.series {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--panel-2);
}
.series-list li.series:hover { border-color: var(--accent); }
.series-list li.series.active { border-color: var(--accent); background: #1b2c47; }
.series-list li .s-title { font-weight: 600; margin-bottom: 2px; }
.series-list li .s-meta { font-size: 12px; color: var(--muted); }
.series-list li.empty { color: var(--muted); cursor: default; border: none; background: none; padding-left: 0; }

/* 信息表 */
.info-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.info-table tr { border-bottom: 1px solid #21262d; }
.info-table td { padding: 4px 4px; vertical-align: top; }
.info-table td.k { color: var(--muted); width: 38%; white-space: nowrap; }
.info-table td.v { color: var(--text); word-break: break-all; }

.tips ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* ===== 视口 ===== */
.viewport-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.viewport {
  position: relative;
  flex: 1;
  background: var(--viewport-bg);
  overflow: hidden;
  cursor: crosshair;
}
.viewport.dragover { outline: 2px dashed var(--accent); outline-offset: -6px; }
#viewport canvas { display: block; }

.ov {
  position: absolute;
  color: #d6f5d6;
  font-size: 12px;
  line-height: 1.45;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
  pointer-events: none;
  font-family: "Consolas", "Menlo", monospace;
  white-space: pre;
}
.ov-tl { top: 8px; left: 10px; text-align: left; }
.ov-tr { top: 8px; right: 10px; text-align: right; }
.ov-bl { bottom: 8px; left: 10px; text-align: left; }
.ov-br { bottom: 8px; right: 10px; text-align: right; }

.anno {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}
.drop-hint .dh-icon { font-size: 56px; color: #30363d; }
.drop-hint .dh-sub { font-size: 12px; color: #555c66; }

.statusbar {
  height: 26px;
  line-height: 26px;
  padding: 0 12px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statusbar.ok { color: var(--ok); }
.statusbar.warn { color: var(--warn); }
.statusbar.err { color: var(--danger); }

/* 加载遮罩 */
.loading {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  z-index: 5;
}
.loading.show { display: flex; }
.spinner {
  width: 26px; height: 26px;
  border: 3px solid #2a3240;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 标注文字 */
.anno text { fill: #ffd166; font-size: 12px; font-family: "Consolas", monospace; }
.anno line, .anno path { stroke: #ffd166; stroke-width: 1.5; fill: none; }
.anno circle { stroke: #ffd166; stroke-width: 1.5; fill: none; }
