@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  font-family: Manrope, system-ui, sans-serif;
  font-synthesis: none;
  --bg: #070b14;
  --bg-deep: #0b1020;
  --surface: rgba(15, 22, 38, .84);
  --surface-solid: #10182a;
  --surface-raised: #151f35;
  --surface-soft: rgba(21, 32, 56, .6);
  --border: rgba(129, 155, 211, .16);
  --border-strong: rgba(139, 166, 255, .34);
  --text: #eff3ff;
  --text-soft: #c2cde4;
  --muted: #7c8ba8;
  --faint: #4f5e7b;
  --blue: #829bff;
  --cyan: #65dfdb;
  --violet: #c29aff;
  --amber: #ffc574;
  --green: #79e1a9;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-width: 980px;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 52% -14%, rgba(75, 100, 208, .28), transparent 68%),
    radial-gradient(620px 460px at 100% 55%, rgba(34, 110, 151, .11), transparent 72%),
    var(--bg);
}
button { font: inherit; }

.app-shell { min-height: 100vh; }
.topbar {
  position: relative;
  z-index: 5;
  height: 82px;
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 0 38px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 20, .72);
  backdrop-filter: blur(22px);
}
.brand { display: flex; align-items: center; gap: 13px; min-width: 286px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid rgba(169, 185, 255, .33); border-radius: 12px;
  color: #d8e0ff; font-size: 20px;
  background: linear-gradient(145deg, #4055b9, #192545);
  box-shadow: 0 0 34px rgba(99, 122, 255, .3), inset 0 1px rgba(255,255,255,.18);
}
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: .24em; }
.brand-sub { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.top-stats { display: flex; align-items: center; gap: 28px; flex: 1; color: var(--muted); font-size: 11px; }
.top-stats b { margin-right: 4px; color: var(--text-soft); font: 500 14px DM Mono, monospace; }
.live { color: var(--green); }
.live i, .status-dot, .detail-status i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 13px var(--green); }
.top-actions { display: flex; gap: 9px; }
.ghost, .icon-btn, .view-chip {
  border: 1px solid var(--border); border-radius: 9px; color: var(--text-soft); background: rgba(20, 30, 51, .72);
  cursor: pointer; transition: .2s ease;
}
.ghost { padding: 9px 13px; font-size: 11px; }
.icon-btn { width: 35px; height: 35px; padding: 0; font-size: 16px; }
.ghost:hover, .icon-btn:hover, .view-chip:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(39, 54, 91, .8); color: var(--text); }

.layout { display: grid; grid-template-columns: 276px minmax(540px, 1fr) 338px; min-height: calc(100vh - 82px); max-width: 1720px; margin: auto; }
.panel { background: var(--surface); }
.timeline { padding: 39px 26px 25px; border-right: 1px solid var(--border); }
.details { padding: 39px 28px 28px; border-left: 1px solid var(--border); }
.panel-kicker { color: #7889ad; font: 500 10px/1 DM Mono, monospace; letter-spacing: .16em; }
.panel h1, .panel h2 { margin: 10px 0 0; letter-spacing: -.04em; }
.panel h1 { font-size: 22px; }
.panel h2 { font-size: 18px; }
.muted { max-width: 205px; margin: 12px 0 31px; color: var(--muted); font-size: 11px; line-height: 1.7; }

.timeline-list { display: flex; flex-direction: column; }
.timeline-item { position: relative; display: flex; width: 100%; padding: 0 0 27px; border: 0; color: inherit; text-align: left; background: transparent; cursor: pointer; }
.timeline-item .dot { z-index: 2; flex: none; width: 11px; height: 11px; margin: 3px 15px 0 1px; border: 2px solid #405170; border-radius: 50%; background: var(--bg-deep); transition: .2s; }
.timeline-item.active .dot { border-color: var(--blue); background: var(--blue); box-shadow: 0 0 0 5px rgba(130, 155, 255, .12), 0 0 18px rgba(130, 155, 255, .8); }
.time-line { position: absolute; top: 14px; bottom: 0; left: 6px; width: 1px; background: linear-gradient(#33476f, rgba(51, 71, 111, .1)); }
.timeline-item:last-child .time-line { display: none; }
.timeline-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.timeline-copy strong { color: var(--text-soft); font: 500 12px DM Mono, monospace; }
.timeline-copy strong em { margin-left: 8px; color: var(--green); font: 10px Manrope, sans-serif; font-style: normal; }
.timeline-copy small { color: var(--faint); font: 10px DM Mono, monospace; }
.timeline-copy b { margin-top: 6px; color: #b9c5df; font-size: 12px; font-weight: 600; }
.timeline-copy label { max-width: 180px; color: #697a99; font-size: 10px; line-height: 1.6; }
.timeline-item:not(.active):hover .dot { border-color: #829bff; }
.timeline-item:not(.active):hover .timeline-copy b { color: var(--text); }
.timeline-footer { margin-top: 7px; padding-top: 19px; border-top: 1px solid var(--border); color: var(--faint); font-size: 10px; }
.legend-dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 8px var(--blue); }

.canvas-area { display: flex; flex-direction: column; min-width: 0; }
.canvas-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 39px 36px 20px; }
.canvas-toolbar h2 { color: var(--text); font-size: 20px; }
.toolbar-actions { display: flex; gap: 8px; padding-top: 1px; }
.view-chip { padding: 8px 11px; color: var(--muted); font-size: 11px; }
.view-chip.active { border-color: rgba(130, 155, 255, .45); color: #cbd5ff; background: rgba(77, 98, 190, .27); }
.view-chip:disabled { cursor: not-allowed; opacity: .55; }
.view-chip span { margin-left: 5px; color: var(--faint); font-size: 9px; }
.canvas {
  position: relative; flex: 1; min-height: 570px; margin: 0 20px; overflow: hidden;
  border: 1px solid var(--border); border-radius: 18px;
  background: linear-gradient(145deg, rgba(16, 26, 49, .94), rgba(9, 15, 29, .96));
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.025);
}
.canvas:before { content: ''; position: absolute; width: 520px; height: 300px; top: -130px; left: 18%; border-radius: 50%; background: rgba(91, 117, 242, .12); filter: blur(70px); pointer-events: none; }
.grid { position: absolute; inset: 0; opacity: .62; background-image: linear-gradient(rgba(43, 63, 101, .28) 1px, transparent 1px), linear-gradient(90deg, rgba(43, 63, 101, .28) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(ellipse at center, #000 20%, transparent 88%); }
.canvas-hint { position: absolute; z-index: 1; top: 21px; left: 24px; color: #637493; font-size: 10px; letter-spacing: .04em; }
.edges { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.edge-line { fill: none; stroke: #657ec8; stroke-width: 1.8; stroke-dasharray: 6 6; opacity: .8; filter: drop-shadow(0 0 5px rgba(110, 139, 255, .22)); }
.edge-line.provides-ui { stroke: #a77be5; }
.edge-label rect { fill: #121e38; stroke: #304574; }
.edge-label text { fill: #a5b5d9; font: 10px Manrope, sans-serif; }
.nodes { position: absolute; inset: 0; z-index: 2; }
.node { position: absolute; display: flex; min-width: 204px; align-items: center; gap: 12px; padding: 15px 16px; border: 1px solid #38558f; border-radius: 13px; color: var(--text); text-align: left; background: linear-gradient(145deg, #1c2d50, #142039); cursor: pointer; box-shadow: 0 14px 30px rgba(1, 5, 15, .48), inset 0 1px rgba(255,255,255,.06); transform: translate(-50%, -50%); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.node:hover, .node.selected { border-color: #a9baff; box-shadow: 0 0 0 4px rgba(130,155,255,.12), 0 18px 44px rgba(2, 6, 17, .7), inset 0 1px rgba(255,255,255,.1); transform: translate(-50%, -50%) scale(1.035); }
.node.cyan { border-color: #357b8d; background: linear-gradient(145deg, #163b4a, #122b3a); }
.node.violet { border-color: #7655aa; background: linear-gradient(145deg, #302352, #211c40); }
.node-icon { display: grid; flex: none; width: 31px; height: 31px; place-items: center; border-radius: 9px; color: #c0ceff; background: #2b438c; font-size: 16px; }
.node.cyan .node-icon { color: #82eee6; background: #1a5661; }
.node.violet .node-icon { color: #dfc7ff; background: #654092; }
.node-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.node-copy strong { font-size: 12px; white-space: nowrap; }
.node-copy small { color: #91a2c5; font: 10px DM Mono, monospace; white-space: nowrap; }
.node-pulse { flex: none; width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 11px var(--green); }
.zoom-control { position: absolute; right: 18px; bottom: 18px; z-index: 3; display: flex; align-items: center; gap: 4px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 9px; color: #8191af; background: rgba(15, 24, 43, .88); box-shadow: 0 8px 25px rgba(0,0,0,.2); font: 10px DM Mono, monospace; }
.zoom-control button { padding: 0 4px; border: 0; color: #bac7e1; background: none; cursor: pointer; font-size: 17px; line-height: 22px; }
.canvas-footer { display: flex; height: 57px; align-items: center; justify-content: space-between; padding: 0 37px; color: var(--muted); font-size: 10px; }
.mono { color: #667796; font: 10px DM Mono, monospace; }

.details-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.details h2 { color: var(--text); font-size: 19px; }
.type-badge { padding: 6px 8px; border-radius: 6px; color: #bdc9ff; background: #293e82; font-size: 9px; white-space: nowrap; }
.type-badge.cyan { color: #8cebe2; background: #174a54; }
.type-badge.violet { color: #dcc6ff; background: #52357a; }
.detail-status { margin: 17px 0; color: var(--green); font-size: 10px; }
.detail-status span { margin: 0 6px; color: var(--faint); }
.detail-description { margin: 0; padding: 0 0 21px; border-bottom: 1px solid var(--border); color: var(--text-soft); font-size: 12px; line-height: 1.75; }
.detail-section { padding: 19px 0; border-bottom: 1px solid var(--border); }
.detail-section h3 { margin: 0 0 13px; color: #7889a8; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.detail-section h3 span { float: right; color: #8293b3; font: 10px DM Mono, monospace; }
.detail-section ul { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.detail-section li { color: #adbad2; font-size: 11px; }
.detail-section li:before { margin-right: 9px; color: var(--blue); content: '→'; }
.relations { display: grid; gap: 10px; }
.relation { display: grid; grid-template-columns: 17px 1fr; column-gap: 7px; font-size: 10px; }
.relation b { color: var(--blue); }
.relation span { color: #b8c5df; }
.relation small { grid-column: 2; margin-top: 2px; color: #687b9d; }
.meta { border-bottom: 0; }
.meta-row { display: grid; grid-template-columns: 55px 1fr; gap: 8px; align-items: start; margin: 10px 0; color: #687a99; font-size: 10px; }
.meta-row b { color: #bdc9e1; font-weight: 500; }
.meta-row code { color: #9eafd0; font: 9px/1.5 DM Mono, monospace; overflow-wrap: anywhere; }
.repo-link { display: flex; justify-content: space-between; padding-top: 16px; color: #91a9ff; text-decoration: none; font-size: 11px; }
.repo-link:hover { color: #d0d9ff; }
.error { padding: 50px; color: #ffadad; }

body.light { color-scheme: light; --bg: #edf2fa; --bg-deep: #f5f8ff; --surface: rgba(255,255,255,.86); --surface-solid: #fff; --surface-raised: #f1f5ff; --surface-soft: rgba(237,243,255,.8); --border: rgba(73, 101, 154, .18); --border-strong: rgba(74, 96, 184, .42); --text: #1b2944; --text-soft: #445573; --muted: #71809b; --faint: #8b9ab3; --shadow: 0 24px 60px rgba(57, 79, 121, .12); background: #edf2fa; }
body.light .topbar { background: rgba(255,255,255,.82); }
body.light .canvas { background: linear-gradient(145deg, #f8faff, #edf3fc); }
body.light .grid { background-image: linear-gradient(rgba(89,115,164,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(89,115,164,.12) 1px, transparent 1px); }
body.light .node { background: linear-gradient(145deg, #f5f8ff, #eaf0ff); box-shadow: 0 14px 30px rgba(54, 76, 122, .16); }
body.light .node.cyan { background: linear-gradient(145deg, #effcff, #e5f7f8); }
body.light .node.violet { background: linear-gradient(145deg, #fbf5ff, #f1eaff); }
body.light .edge-label rect { fill: #f5f8ff; stroke: #c5d2e9; }
body.light .edge-label text { fill: #53698e; }
body.light .zoom-control, body.light .ghost, body.light .icon-btn, body.light .view-chip { background: rgba(255,255,255,.82); }

@media (max-width: 1200px) {
  body { min-width: 900px; }
  .topbar { padding: 0 24px; gap: 20px; }
  .layout { grid-template-columns: 235px minmax(480px, 1fr) 290px; }
  .timeline, .details { padding-left: 21px; padding-right: 21px; }
  .canvas-toolbar { padding-left: 25px; padding-right: 25px; }
  .canvas-footer { padding-left: 27px; padding-right: 27px; }
}
