:root {
  color-scheme: dark;
  --bg: #040b14;
  --panel: rgba(7, 20, 36, .82);
  --panel-strong: rgba(8, 25, 45, .94);
  --ink: #f4f9ff;
  --muted: #96aec6;
  --soft: #c7d9ea;
  --line: rgba(99, 183, 255, .22);
  --line-strong: rgba(111, 198, 255, .48);
  --blue: #3ea7ff;
  --blue-hot: #75d7ff;
  --blue-deep: #0b3263;
  --indigo: #7b8cff;
  --signal: #8ee8ff;
  --ok: #7df2bc;
  --shadow: 0 24px 70px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(16, 55, 102, .34) 0%, rgba(4, 11, 20, .2) 34%, rgba(4, 8, 14, .96) 100%),
    linear-gradient(115deg, rgba(35, 119, 215, .22) 0%, transparent 36%),
    linear-gradient(245deg, rgba(92, 217, 255, .12) 0%, transparent 30%),
    #040b14;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(95, 175, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95, 175, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .9), transparent 88%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, .022) 0, rgba(255, 255, 255, .022) 1px, transparent 1px, transparent 8px);
  opacity: .32;
}

a {
  color: inherit;
}

#networkCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .66;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1540px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.workspace-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  gap: 18px;
  min-height: 116px;
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-hot);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 64px;
  line-height: 1.02;
  letter-spacing: 0;
  text-shadow: 0 0 28px rgba(117, 215, 255, .14);
}

.system-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 15px 16px;
  background: linear-gradient(180deg, rgba(14, 39, 70, .76), rgba(6, 17, 31, .86));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(18px);
}

.status-light {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(125, 242, 188, .12), 0 0 24px rgba(125, 242, 188, .75);
}

.system-panel strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.system-panel span:last-child {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  margin: 2px 0 18px;
}

.overview-panel,
.control-panel {
  background: linear-gradient(180deg, rgba(9, 29, 54, .78), rgba(5, 14, 26, .9));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(20px);
}

.overview-panel {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(430px, 1fr);
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-height: 294px;
  padding: 14px;
}

.orbit-caption {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 3px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
}

.orbit-caption strong {
  color: var(--soft);
  font-size: 12px;
}

.summary-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.summary-node {
  position: relative;
  min-height: 58px;
  padding: 11px 12px;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(124, 198, 255, .12);
  border-radius: 8px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.summary-node::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 92px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(117, 215, 255, .62));
  transform: rotate(-22deg);
}

.summary-node:hover,
.summary-node.is-active {
  transform: translateX(3px);
  border-color: var(--line-strong);
  background: rgba(62, 167, 255, .12);
}

.summary-node span {
  display: block;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
}

.summary-node strong {
  display: block;
  margin-top: 5px;
  font-size: 28px;
  line-height: 1;
}

.node-cloud {
  position: relative;
  min-height: 236px;
  overflow: hidden;
  border: 1px solid rgba(99, 183, 255, .18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(99, 183, 255, .08) 1px, transparent 1px),
    linear-gradient(rgba(99, 183, 255, .08) 1px, transparent 1px),
    radial-gradient(ellipse at center, rgba(62, 167, 255, .14), transparent 62%),
    rgba(0, 0, 0, .16);
  background-size: 34px 34px, 34px 34px, auto, auto;
}

.node-cloud::before,
.node-cloud::after {
  content: "";
  position: absolute;
  inset: 20% 8%;
  border: 1px solid rgba(117, 215, 255, .28);
  border-radius: 50%;
}

.node-cloud::after {
  inset: 34% 20%;
  border-color: rgba(123, 140, 255, .22);
}

.cloud-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: grid;
  place-items: center;
  width: 42px;
  height: 28px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(42, 130, 220, .2);
  border: 1px solid rgba(117, 215, 255, .62);
  border-radius: 6px;
  box-shadow: 0 0 22px rgba(62, 167, 255, .18);
  transform: translate(-50%, -50%) scale(0);
  animation: node-in .45s ease forwards;
  animation-delay: var(--delay);
}

.cloud-node.service {
  border-color: rgba(142, 232, 255, .76);
  background: rgba(54, 174, 255, .26);
}

.cloud-node.generated {
  border-color: rgba(123, 140, 255, .76);
  background: rgba(91, 111, 255, .24);
}

.cloud-node:hover {
  z-index: 2;
  transform: translate(-50%, -50%) scale(1.18);
  border-color: #fff;
}

.cloud-node span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .02em;
}

@keyframes node-in {
  to { transform: translate(-50%, -50%) scale(1); }
}

.control-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}

.search-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, .052);
  border: 1px solid rgba(124, 198, 255, .14);
  border-radius: 8px;
}

.search-box span {
  color: var(--muted);
  font-size: 12px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
}

.search-box input::placeholder {
  color: rgba(199, 217, 234, .52);
}

.filter-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 5px;
  background: rgba(0, 0, 0, .2);
  border: 1px solid rgba(124, 198, 255, .12);
  border-radius: 8px;
}

.filter-tabs button {
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  transition: background .18s ease, color .18s ease;
}

.filter-tabs button.is-active {
  color: #03101d;
  background: linear-gradient(180deg, #8ee8ff, #42aaff);
  box-shadow: 0 8px 24px rgba(66, 170, 255, .2);
}

select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(124, 198, 255, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  color: var(--ink);
  font: inherit;
}

select option {
  color: #081827;
}

.result-meter {
  display: flex;
  align-items: end;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(62, 167, 255, .2), rgba(10, 49, 90, .52));
  border: 1px solid rgba(117, 215, 255, .24);
  border-radius: 8px;
}

.result-meter span {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.result-meter strong {
  color: var(--muted);
  font-size: 13px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.project-card {
  position: relative;
  min-height: 264px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 26, 47, .94), rgba(5, 13, 24, .96));
  border: 1px solid rgba(124, 198, 255, .14);
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .24);
  opacity: 0;
  transform: translateY(12px);
  animation: card-in .45s ease forwards;
  animation-delay: calc(var(--index) * 22ms);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(62, 167, 255, .16), transparent 36%),
    linear-gradient(315deg, rgba(117, 215, 255, .07), transparent 42%);
  pointer-events: none;
}

.project-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--blue-hot));
  opacity: .9;
}

.project-card.service::after {
  background: linear-gradient(90deg, #75d7ff, #3ea7ff);
}

.project-card.generated::after {
  background: linear-gradient(90deg, #7b8cff, #75d7ff);
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(117, 215, 255, .56);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .34), 0 0 34px rgba(62, 167, 255, .16);
}

@keyframes card-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-link {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 264px;
  padding: 16px;
  color: inherit;
  text-decoration: none;
}

.project-topline,
.project-meta,
.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-index {
  color: rgba(255, 255, 255, .92);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.kind-chip {
  padding: 6px 8px;
  color: var(--blue-hot);
  background: rgba(0, 0, 0, .18);
  border: 1px solid rgba(117, 215, 255, .22);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.project-body {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 20px 0 14px;
}

.project-meta {
  color: var(--muted);
  font-size: 12px;
}

.running-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-weight: 900;
}

.running-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 14px currentColor;
}

.project-body h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.project-body p {
  margin: 0;
  min-height: 45px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-row span {
  padding: 5px 8px;
  color: #c8ddf1;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(124, 198, 255, .14);
  border-radius: 6px;
  font-size: 12px;
}

.project-footer {
  padding-top: 12px;
  color: var(--muted);
  border-top: 1px solid rgba(124, 198, 255, .12);
  font-size: 13px;
}

.project-footer strong {
  color: var(--ink);
}

.card-link:focus-visible,
.cloud-node:focus-visible,
.summary-node:focus-visible,
.filter-tabs button:focus-visible,
.search-box input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue-hot);
  outline-offset: 3px;
}

.load-error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  color: #9bdcff;
  background: rgba(62, 167, 255, .08);
  border: 1px solid rgba(62, 167, 255, .24);
  border-radius: 8px;
}

.launch-body,
.generated-body {
  background:
    linear-gradient(120deg, rgba(35, 119, 215, .22), transparent 34%),
    linear-gradient(145deg, #040b14 0%, #0b1d32 54%, #04080e 100%);
}

.launch-panel {
  width: min(620px, calc(100% - 32px));
  margin: 18vh auto 0;
  padding: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.launch-kicker {
  margin: 0 0 8px;
  color: var(--blue-hot);
  font-weight: 900;
}

.launch-panel h1 {
  font-size: 38px;
}

.launch-topic {
  color: var(--muted);
}

.progress-line {
  height: 6px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
}

.progress-line span {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-hot));
  animation: loading 1.1s infinite ease-in-out;
}

@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}

#launchLog {
  white-space: pre-wrap;
  color: #9bdcff;
  font: 12px Consolas, monospace;
}

.generated-header,
.generated-main {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

.generated-header {
  padding: 26px 0 18px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--blue-hot);
  text-decoration: none;
  font-weight: 900;
}

.generated-header p {
  margin: 0 0 6px;
  color: var(--muted);
}

.generated-header h1 {
  font-size: 48px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.result-tile {
  margin: 0;
  overflow: hidden;
  background: rgba(7, 20, 36, .82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.result-tile img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.result-tile figcaption {
  padding: 12px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--line);
}

.file-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 40px;
}

.file-strip a {
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

@media (max-width: 1120px) {
  .hero-grid,
  .overview-panel {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .node-cloud {
    min-height: 210px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1540px);
    padding-top: 18px;
  }

  .workspace-head {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  h1 {
    font-size: 32px;
  }

  .system-panel {
    width: 100%;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .card-link {
    min-height: 246px;
  }

  .generated-header h1 {
    font-size: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }

  #networkCanvas {
    display: none;
  }
}
