:root {
  /* ── Inherited from project Design Tokens ── */
  --canvas-bg: #1A1A1A;

  /* Align with css/style.css tokens */
  --text-primary: rgba(255, 255, 255, 0.88);
  --text-secondary: rgba(255, 255, 255, 0.45);
  --text-label: rgba(255, 255, 255, 0.30);
  --text-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;

  --tag-bg: rgba(255, 255, 255, 0.06);
  --tag-border: rgba(255, 255, 255, 0.10);

  --toolbar-bg: rgba(20, 20, 20, 0.96);
  --toolbar-border: rgba(255, 255, 255, 0.07);
  --toolbar-height: 44px;

  --sans: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--canvas-bg);
  color: var(--text-primary);
  font-family: var(--sans);
}

body {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.toolbar {
  height: var(--toolbar-height);
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--toolbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  z-index: 100;
}

.toolbar-l,
.toolbar-r {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-r {
  gap: 10px;
}

.home-link {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--tag-border);
  background: var(--tag-bg);
  color: var(--text-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.home-link:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.toolbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--toolbar-border);
}

.graph-title {
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 260px;
  font-family: var(--text-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-root,
.graph-shell,
.graph-canvas {
  width: 100vw;
  height: 100%;
}

.app-root {
  flex: 1;
  min-height: 0;
}

.graph-shell {
  position: relative;
  background: var(--canvas-bg);
}

.graph-canvas {
  position: relative;
  touch-action: none;
}

.x6-graph {
  background: var(--canvas-bg);
}

.x6-node text,
.x6-edge text {
  font-family: var(--sans);
}

.model-picker {
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.view-btn,
.model-btn {
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.view-btn.active,
.model-btn.active {
  background: rgba(255, 255, 255, 0.88);
  border-color: transparent;
  color: #111111;
}

.view-btn:hover,
.model-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--text-primary);
}

.view-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 320px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: rgba(20, 20, 20, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  pointer-events: none;
  z-index: 40;
}

.view-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.view-panel-note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.view-summary-list,
.view-legend {
  display: grid;
  gap: 8px;
}

.view-summary-item,
.view-legend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}

.view-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.view-copy {
  min-width: 0;
}

.view-copy strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.view-copy span {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}

@media (max-width: 880px) {
  .toolbar {
    padding: 0 10px;
  }

  .toolbar-r {
    gap: 8px;
  }

  .view-btn,
  .model-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .graph-title {
    max-width: 180px;
  }

  .view-panel {
    width: min(300px, calc(100vw - 24px));
  }
}

@media (max-width: 720px) {
  .toolbar {
    height: auto;
    min-height: var(--toolbar-height);
    padding-top: 8px;
    padding-bottom: 8px;
    align-items: flex-start;
  }

  .toolbar-l,
  .toolbar-r {
    flex-wrap: wrap;
  }

  .view-panel {
    top: auto;
    bottom: 12px;
  }
}
