@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/IBMPlexSans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/IBMPlexSans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/IBMPlexSans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/IBMPlexSans-700.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/IBMPlexMono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/IBMPlexMono-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/IBMPlexMono-600.woff2") format("woff2"); }

:root {
  --cds-background: #ffffff;
  --cds-background-hover: #e8e8e8;
  --cds-background-active: #c6c6c6;
  --cds-background-selected: #e0e0e0;
  --cds-layer-01: #f4f4f4;
  --cds-layer-02: #ffffff;
  --cds-layer-accent-01: #e0e0e0;
  --cds-layer-hover-01: #e8e8e8;
  --cds-field-01: #f4f4f4;
  --cds-border-subtle-01: #e0e0e0;
  --cds-border-subtle-02: #c6c6c6;
  --cds-border-strong-01: #8d8d8d;
  --cds-text-primary: #161616;
  --cds-text-secondary: #525252;
  --cds-text-placeholder: #a8a8a8;
  --cds-text-helper: #6f6f6f;
  --cds-text-on-color: #ffffff;
  --cds-icon-primary: #161616;
  --cds-icon-secondary: #525252;
  --cds-button-primary: #0f62fe;
  --cds-button-primary-hover: #0050e6;
  --cds-button-primary-active: #002d9c;
  --cds-focus: #0f62fe;
  --cds-interactive: #0f62fe;
  --cds-link-primary: #0f62fe;
  --play-0: #007d79;
  --play-1: #007d79;
  --play-2: #0043ce;
  --play-3: #d12771;
  --play-4: #da1e28;
  --play-5: #8a3ffc;
  --play-6: #198038;
  --play-7: #8a3800;
  --play-8: #005d5d;
  --play-9: #6f6f6f;
  --conn-neutral: #393939;
  --kind-native: #0f62fe;
  --font-sans: "IBM Plex Sans", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --cds-background: #161616;
  --cds-background-hover: #353535;
  --cds-background-active: #525252;
  --cds-background-selected: #353535;
  --cds-layer-01: #262626;
  --cds-layer-02: #393939;
  --cds-layer-accent-01: #525252;
  --cds-layer-hover-01: #333333;
  --cds-field-01: #262626;
  --cds-border-subtle-01: #393939;
  --cds-border-subtle-02: #525252;
  --cds-border-strong-01: #6f6f6f;
  --cds-text-primary: #f4f4f4;
  --cds-text-secondary: #c6c6c6;
  --cds-text-placeholder: #6f6f6f;
  --cds-text-helper: #8d8d8d;
  --cds-icon-primary: #f4f4f4;
  --cds-icon-secondary: #c6c6c6;
  --cds-button-primary: #0f62fe;
  --cds-button-primary-hover: #0353e9;
  --cds-button-primary-active: #002d9c;
  --cds-focus: #ffffff;
  --cds-interactive: #4589ff;
  --cds-link-primary: #78a9ff;
  --play-0: #3ddbd9;
  --play-1: #3ddbd9;
  --play-2: #4589ff;
  --play-3: #ff7eb6;
  --play-4: #fa4d56;
  --play-5: #be95ff;
  --play-6: #6fdc8c;
  --play-7: #ffb784;
  --play-8: #08bdba;
  --play-9: #c6c6c6;
  --conn-neutral: #e0e0e0;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  color: var(--cds-text-primary);
  background: var(--cds-background);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100vh; }

.cds-shell { flex-shrink: 0; }
.cds-shell__bar1 {
  height: 48px;
  background: #161616;
  color: #ffffff;
  padding: 0 0 0 16px;
  display: flex;
  align-items: stretch;
}
.cds-shell__brand { display: inline-flex; align-items: center; flex-shrink: 0; }

.view-switch {
  display: flex;
  align-items: stretch;
  margin-left: 24px;
  min-width: 0;
  flex: 1;
}
.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #8d8d8d;
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.view-tab:hover { color: #e0e0e0; background: #353535; }
.view-tab.is-active {
  color: #ffffff;
  border-bottom-color: #0f62fe;
}
.view-tab:focus-visible { outline: 2px solid #ffffff; outline-offset: -2px; }
.view-tab__hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6f6f6f;
}
.view-tab.is-active .view-tab__hint { color: #a8a8a8; }
.view-tab__wip {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #161616;
  background: #f1c21b;
  padding: 1px 5px;
}
@media (max-width: 1100px) {
  .view-tab__hint { display: none; }
}
.cds-shell__wordmark {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.01em;
}
.cds-shell__divider {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: #393939;
  margin: 0 12px;
}
.cds-shell__product {
  font-size: 14px;
  font-weight: 400;
  color: #c6c6c6;
}
.cds-shell__meta {
  margin-left: auto;
  display: flex;
  align-items: stretch;
}
.cds-shell__meta-text {
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8d8d8d;
}
.cds-shell__theme-btn {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #c6c6c6;
  cursor: pointer;
  transition: background-color 0.11s, color 0.11s;
  font-size: 18px;
}
.cds-shell__theme-btn:hover { background: #353535; color: #ffffff; }
.cds-shell__theme-btn:focus-visible { outline: 2px solid #ffffff; outline-offset: -2px; }
[data-theme="dark"] .cds-shell__theme-btn .icon-glyph { transform: rotate(180deg); display: inline-block; }

.cds-shell__bar2 {
  height: 48px;
  background: var(--cds-background);
  border-bottom: 1px solid var(--cds-border-subtle-01);
  display: flex;
  align-items: stretch;
  padding: 0 16px;
  gap: 16px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0; padding: 0; margin: -1px;
}

.search-container {
  display: flex;
  align-items: center;
  position: relative;
  width: 320px;
  flex-shrink: 0;
}
.search-input {
  width: 100%;
  height: 32px;
  padding: 0 32px 0 12px;
  background: var(--cds-field-01);
  border: 1px solid var(--cds-border-subtle-01);
  border-bottom: 1px solid var(--cds-border-strong-01);
  color: var(--cds-text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}
.search-input:hover { background: var(--cds-background-hover); }
.search-input:focus { border-color: var(--cds-focus); }
.search-input::placeholder { color: var(--cds-text-placeholder); }
.search-clear {
  position: absolute;
  right: 4px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--cds-icon-secondary);
  cursor: pointer;
  font-size: 16px;
  display: none;
  align-items: center;
  justify-content: center;
}
.search-clear.is-visible { display: flex; }
.search-results-count {
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cds-text-secondary);
  white-space: nowrap;
}

#play-legend {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  justify-content: space-between;
  overflow-x: auto;
  scrollbar-width: none;
}
#play-legend::-webkit-scrollbar { display: none; }
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 48px;
  background: transparent;
  border: none;
  color: var(--cds-text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.legend-chip.is-active { color: var(--cds-text-primary); box-shadow: inset 0 -2px 0 var(--cds-text-primary); }
.legend-chip.is-idle { opacity: 0.38; }
.legend-count {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--cds-text-helper);
}
.legend-chip .dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.kind-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cds-text-helper);
}
.kind-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cds-text-secondary);
}
.kind-swatch i {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2px solid var(--cds-text-secondary);
}
.kind-swatch[data-kind="native"] i { border-top-style: solid; }
.kind-swatch[data-kind="platform"] i { border-top-style: dashed; }
.kind-swatch[data-kind="optional"] i { border-top-style: dotted; }

#main {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: var(--cds-background);
}

#map-area {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--cds-background);
}
#svg-connections {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}
#lanes {
  position: absolute;
  inset: 0;
  z-index: 0;
}
#nodes {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.lane-strip {
  position: absolute;
  left: 0; right: 0;
  pointer-events: none;
  background: color-mix(in srgb, var(--cds-layer-01) 55%, transparent);
}
.lane-label {
  position: absolute;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cds-text-helper);
  pointer-events: none;
  z-index: 1;
}
.lane-divider {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: var(--cds-border-subtle-01);
  pointer-events: none;
}

.pnode {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 6px 10px 6px 12px;
  background: var(--cds-background);
  border: 1px solid var(--cds-border-subtle-02);
  border-left: 3px solid var(--node-color, var(--cds-border-strong-01));
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--cds-text-primary);
  cursor: pointer;
  white-space: nowrap;
  z-index: 5;
  user-select: none;
  transition: opacity 0.18s ease, background-color 0.11s, border-color 0.11s;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pnode.is-deprecated {
  border-style: dashed;
  color: var(--cds-text-secondary);
}
.deprecated-flag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #da1e28;
  border: 1px solid #da1e28;
  padding: 1px 4px;
  line-height: 1.2;
}
[data-theme="dark"] .deprecated-flag {
  color: #ff8389;
  border-color: #ff8389;
}
.pnode.is-hub {
  border-left-width: 5px;
  font-weight: 600;
  padding: 8px 12px 8px 14px;
}
.pnode:hover { background: var(--cds-background-hover); z-index: 30; }
.pnode:focus-visible { outline: 2px solid var(--cds-focus); outline-offset: -2px; }
.pnode.dimmed {
  opacity: 0.14;
  z-index: 1;
}
.pnode.highlighted {
  opacity: 1;
  z-index: 25;
}
.pnode.selected,
.pnode.selected:hover {
  background: #161616;
  color: #ffffff;
  border-color: #161616;
  border-left-color: var(--node-color);
  z-index: 50;
  opacity: 1;
}
[data-theme="dark"] .pnode.selected,
[data-theme="dark"] .pnode.selected:hover {
  background: #ffffff;
  color: #161616;
  border-color: #ffffff;
}

#map-area.is-focused .pnode:not(.selected):not(.highlighted) {
  opacity: 0.14;
}

.conn-path {
  fill: none;
  stroke: var(--conn-neutral);
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.12;
}
.conn-path.is-native { stroke-dasharray: none; }
.conn-path.is-platform { stroke-dasharray: 6 4; }
.conn-path.is-optional { stroke-dasharray: 2 3; }
.conn-path.is-coming { opacity: 0.07; }
.conn-path.is-deprecated {
  stroke-dasharray: 1 5;
  opacity: 0.2;
}
#map-area.is-focused .conn-path:not(.active) {
  opacity: 0.045;
  stroke: var(--conn-neutral);
  stroke-width: 1;
}
.conn-path.active {
  opacity: 1;
  stroke: var(--edge-color, var(--cds-interactive));
  stroke-width: 2;
  stroke-dasharray: none;
}

#sidebar {
  width: 320px;
  flex-shrink: 0;
  border-left: 1px solid var(--cds-border-subtle-01);
  background: var(--cds-layer-01);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#sidebar-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--cds-border-subtle-01);
  flex-shrink: 0;
}
.sidebar-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cds-text-secondary);
}
#reset-btn {
  height: 32px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--cds-border-strong-01);
  color: var(--cds-text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
  display: none;
}
#reset-btn.is-visible { display: inline-flex; align-items: center; }
#reset-btn:hover { background: var(--cds-background-hover); }
#sidebar-inner {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
}
#sidebar-inner::-webkit-scrollbar { width: 6px; }
#sidebar-inner::-webkit-scrollbar-thumb { background: var(--cds-border-subtle-02); }

.sidebar-empty {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--cds-text-secondary);
}
.sidebar-empty p { font-size: 13px; line-height: 1.4; }
.sidebar-empty .empty-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cds-text-helper);
}
.kind-key {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.kind-key div {
  font-size: 12px;
  color: var(--cds-text-secondary);
  padding-left: 10px;
  border-left: 3px solid var(--cds-border-subtle-02);
}
.kind-key .k-native { border-left-style: solid; border-left-color: var(--play-2); }
.kind-key .k-platform { border-left-style: dashed; border-left-color: var(--play-5); }
.kind-key .k-optional { border-left-style: dotted; border-left-color: var(--play-3); }

.sb-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cds-text-secondary);
  margin-bottom: 12px;
}
.sb-product-name {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 400;
  margin-bottom: 6px;
}
.sb-category {
  font-size: 13px;
  color: var(--cds-text-secondary);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--cds-border-subtle-01);
}
.sb-section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cds-text-secondary);
  margin: 20px 0 10px;
}
.play-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 6px;
  background: var(--cds-background);
  border: 1px solid var(--cds-border-subtle-02);
  font-size: 12px;
  font-weight: 500;
  margin: 0 4px 4px 0;
}
.play-pill .dot { width: 8px; height: 8px; background: var(--play-color); }
.sb-description {
  font-size: 13px;
  line-height: 1.5;
  color: var(--cds-text-secondary);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--cds-border-subtle-01);
}
.sb-value {
  font-size: 13px;
  line-height: 1.5;
  background: var(--cds-background);
  padding: 12px;
  border-left: 3px solid var(--cds-interactive);
  margin-bottom: 16px;
}
.sb-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--cds-link-primary);
  text-decoration: none;
}
.sb-link:hover { text-decoration: underline; }
.sb-competitors, .sb-differentiators {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--cds-border-subtle-01);
}
.competitor-tag {
  padding: 4px 10px;
  background: var(--cds-background);
  border: 1px solid var(--cds-border-subtle-02);
  font-size: 12px;
  color: var(--cds-text-secondary);
}
.sb-differentiators { display: block; }
.differentiator-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}
.diff-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cds-interactive);
  color: var(--cds-text-on-color);
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
}
.diff-text { font-size: 13px; line-height: 1.4; }
.sb-question-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--cds-background);
  border: 1px solid var(--cds-border-subtle-01);
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.4;
}
.sb-question-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cds-interactive);
  color: var(--cds-text-on-color);
  font-size: 11px;
  font-weight: 600;
}
.conn-list {
  display: flex;
  flex-direction: column;
  background: var(--cds-background);
  border: 1px solid var(--cds-border-subtle-01);
}
.conn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--cds-background);
  border: none;
  border-bottom: 1px solid var(--cds-border-subtle-01);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--font-sans);
  color: var(--cds-text-primary);
}
.conn-row:last-child { border-bottom: none; }
.conn-row:hover { background: var(--cds-background-hover); }
.conn-accent {
  width: 4px;
  height: 28px;
  background: var(--accent-color, var(--cds-text-secondary));
  flex-shrink: 0;
}
.conn-accent.is-platform { background-image: repeating-linear-gradient(180deg, var(--accent-color) 0 3px, transparent 3px 5px); }
.conn-accent.is-optional { background-image: repeating-linear-gradient(180deg, var(--accent-color) 0 1px, transparent 1px 3px); }
.conn-info { flex: 1; min-width: 0; }
.conn-name { font-size: 13px; font-weight: 500; line-height: 1.3; }
.conn-play {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cds-text-secondary);
  margin-top: 2px;
}
.conn-explanation {
  font-size: 12px;
  line-height: 1.4;
  color: var(--cds-text-secondary);
  margin-top: 4px;
}
.conn-arrow { font-size: 16px; color: var(--cds-icon-secondary); }

#footer {
  border-top: 1px solid var(--cds-border-subtle-01);
  background: var(--cds-background);
  padding: 0 16px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cds-text-secondary);
}
#footer .footer-stats { display: inline-flex; gap: 16px; }
#footer .footer-stat strong {
  color: var(--cds-text-primary);
  font-weight: 500;
  margin-right: 4px;
}
#footer .footer-hint { color: var(--cds-text-helper); }

.status-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--cds-border-subtle-02);
  color: var(--cds-text-helper);
  vertical-align: middle;
}
.status-pill.is-deprecated {
  color: #da1e28;
  border-color: #da1e28;
}
.status-pill.is-placeholder {
  color: #8a3800;
  border-color: #f1c21b;
  background: #f1c21b;
}
.sb-deprecation {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 3px solid #da1e28;
  background: var(--cds-background);
  font-size: 13px;
  line-height: 1.45;
  color: var(--cds-text-primary);
}
.sb-deprecation.is-placeholder { border-left-color: #f1c21b; }
.conn-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--cds-text-secondary);
}

@media (max-width: 900px) {
  #sidebar { width: 260px; }
  .search-container { width: 200px; }
  .cds-shell__product { display: none; }
  #footer .footer-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pnode, .conn-path { transition: none; }
}
