:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #e8eaf0;
  --text-dim: #9096a8;
  --text-dimmer: #5c6278;
  --accent: #7c9fff;
  --accent-2: #a37cff;
  --accent-3: #4ddbc0;
  --danger: #ff6b7a;
  --node-class: #6ea8ff;
  --node-interface: #b98bff;
  --node-method: #4ddbc0;
  --node-external: #7d8399;
  --edge-calls: rgba(125, 159, 255, 0.55);
  --edge-extends: rgba(185, 139, 255, 0.55);
  --edge-implements: rgba(77, 219, 192, 0.5);
  --edge-contains: rgba(255, 255, 255, 0.12);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(124, 159, 255, 0.18), transparent 60%),
    radial-gradient(50% 40% at 100% 20%, rgba(163, 124, 255, 0.14), transparent 60%),
    radial-gradient(40% 40% at 50% 100%, rgba(77, 219, 192, 0.08), transparent 60%);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 600;
}

.brand-mark {
  color: var(--accent);
  font-size: 1.1em;
  filter: drop-shadow(0 0 8px rgba(124, 159, 255, 0.6));
}

.brand-name {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.85rem;
}

.tier1-badge {
  font-size: 0.72rem;
  color: var(--text-dimmer);
  font-family: var(--mono);
  letter-spacing: 0.01em;
  max-width: 560px;
  text-align: right;
}

.layout {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  padding: 0 32px 32px;
  min-height: 0;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

.intake {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: fit-content;
}

.intake h1 {
  font-size: 1.35rem;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.lede {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 4px;
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-panel.active {
  display: flex;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.field input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--mono);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 159, 255, 0.15);
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 9px;
  padding: 11px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06070a;
  box-shadow: 0 8px 24px -8px rgba(124, 159, 255, 0.5);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px -8px rgba(124, 159, 255, 0.65);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.examples {
  font-size: 0.78rem;
  color: var(--text-dimmer);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.example-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 0.76rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.example-chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.dropzone {
  border: 1.5px dashed var(--panel-border);
  border-radius: 12px;
  padding: 36px 16px;
  text-align: center;
  transition: all 0.15s ease;
  color: var(--text-dim);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(124, 159, 255, 0.06);
}

.dropzone-icon {
  font-size: 1.6rem;
  margin-bottom: 6px;
  color: var(--text-dimmer);
}

.dropzone p {
  margin: 4px 0;
  font-size: 0.85rem;
}

.dropzone-sub {
  font-size: 0.72rem !important;
  color: var(--text-dimmer);
}

.status {
  font-size: 0.82rem;
  min-height: 1.2em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status.error {
  color: var(--danger);
}

.status.busy::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(124, 159, 255, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.graph-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-border);
}

.search-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  width: 200px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 0.74rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

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

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.graph-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
}

.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

#graph-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#graph-canvas:active {
  cursor: grabbing;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dimmer);
  pointer-events: none;
}

/* Higher specificity than `.empty-state` alone -- an author `display: flex`
   rule otherwise beats the UA default `[hidden] { display: none }`, so
   toggling the `hidden` attribute in app.js silently did nothing. */
.empty-state[hidden] {
  display: none;
}

.empty-icon {
  font-size: 2.4rem;
  opacity: 0.5;
}

.empty-state p {
  margin: 0;
  font-size: 0.9rem;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10, 11, 16, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 0.76rem;
  max-width: 340px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  z-index: 5;
}

.tooltip .t-name {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.tooltip .t-meta {
  color: var(--text-dim);
  margin-top: 3px;
}

.stats-bar {
  display: flex;
  gap: 20px;
  padding: 10px 18px;
  border-top: 1px solid var(--panel-border);
  font-size: 0.76rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* See the .empty-state[hidden] comment above -- same author-vs-UA-default
   `display` fight, same fix. */
.stats-bar[hidden] {
  display: none;
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 14px;
  color: var(--text-dimmer);
  font-size: 0.72rem;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
  }
}
