:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --ink: #172033;
  --muted: #5f6b85;
  --line: #d7deea;
  --line-strong: #8fa1c4;
  --panel: rgba(255, 255, 255, 0.7);
  --blue-soft: #e9efff;
  --green-soft: #e9f9f0;
  --purple-soft: #f0ebff;
  --amber-soft: #fff4de;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.page {
  width: 680px;
  height: 1070px;
  margin: 0 auto;
  padding: 16px;
}

.canvas {
  position: relative;
  width: 100%;
  height: 1035px;
  border: none;
  border-radius: 6px;
  background: transparent;
  overflow: hidden;
}

.diagram-stage {
  position: relative;
  width: 700px;
  height: 1120px;
  transform: scale(0.92);
  transform-origin: top left;
}

.node {
  position: absolute;
  border-radius: 8px;
  border: 1.3px solid #c8d2e7;
  background: var(--panel);
  padding: 10px 12px 10px 12px;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.node-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.node-subtitle {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.legend {
  position: absolute;
  right: 22px;
  top: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.gpu-area {
  margin-top: 6px;
  display: block;
  width: 100%;
}

.gpu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.gpu-grid.single {
  grid-template-columns: repeat(1, minmax(0, 46px));
  justify-content: center;
}

.gpu-chip {
  border: 1px solid #9eb0d6;
  border-radius: 6px;
  background: #f8fbff;
  color: #4a5f8d;
  font-size: 8.2px;
  line-height: 1;
  text-align: center;
  padding: 4px 0;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.arrow-label {
  fill: #35456a;
  font-size: 9.8px;
  font-weight: 500;
}

.arrow-label-bg {
  fill: rgba(244, 241, 232, 0.9);
  stroke: #d5deef;
  stroke-width: 0.9;
  rx: 4;
  ry: 4;
}

.node-data-fragment {
  position: relative;
  border-radius: 8px;
  margin-top: 8px;
  width: 100%;
  height: 84px;
}

/* Mode selector */

.mode-selector {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 10px 16px 6px;
}

.mode-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 7px 18px;
  border: 1.2px solid #c8d2e7;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.mode-btn:first-child {
  border-radius: 7px 0 0 7px;
}

.mode-btn:last-child {
  border-radius: 0 7px 7px 0;
}

.mode-btn + .mode-btn {
  border-left: none;
}

.mode-btn:hover {
  background: #f0f4fb;
  color: var(--ink);
}

.mode-btn.active {
  background: #e4ecfa;
  color: var(--ink);
  font-weight: 650;
  border-color: #a0b4d8;
}

.mode-btn.active + .mode-btn {
  border-left: none;
}

/* Key annotations */

.key-annotation {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  user-select: none;
}

.key-annotation-label {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* TEE label (positioned on the node's top border) */

.tee-boundary-label {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e3a6e;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 10px;
  border-radius: 4px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 1;
}
