:root {
  color-scheme: dark;
  --bg: #050b16;
  --surface: #0a1424;
  --surface-strong: #0d192b;
  --surface-soft: #101d31;
  --border: #27364c;
  --border-strong: #3b4f69;
  --text: #f5f8fc;
  --muted: #b5c1d2;
  --subtle: #8797ab;
  --cyan: #55d8ff;
  --cyan-strong: #23c7f5;
  --cyan-soft: rgba(85, 216, 255, 0.12);
  --lime: #b7f632;
  --lime-soft: rgba(183, 246, 50, 0.11);
  --amber: #ffba32;
  --amber-soft: rgba(255, 186, 50, 0.12);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 78% -8%, rgba(52, 157, 209, 0.13), transparent 35%),
    radial-gradient(circle at 15% 18%, rgba(64, 216, 255, 0.06), transparent 25%),
    var(--bg);
  line-height: 1.5;
}

button, input { font: inherit; }
button, label[for="workspace-file"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible, label[for="workspace-file"]:focus-visible, .object-button:focus-visible {
  outline: 3px solid rgba(85, 216, 255, 0.42);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-180%);
  padding: 10px 14px;
  border-radius: 8px;
  color: #00141c;
  background: var(--cyan);
  font-weight: 800;
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 78px;
  padding: 14px clamp(20px, 3vw, 48px);
  border-bottom: 1px solid rgba(62, 83, 111, 0.65);
  background: rgba(5, 11, 22, 0.9);
  backdrop-filter: blur(18px);
}

.brand-lockup, .header-actions, .lineage-step, .download-heading-row, .graph-heading, .graph-toolbar,
.guide-heading, .guide-heading > div, .deliverable-grid article, .boundary-note {
  display: flex;
  align-items: center;
}

.brand-lockup { gap: 13px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid rgba(183, 246, 50, 0.45);
  border-radius: 13px;
  color: var(--lime);
  background: linear-gradient(145deg, rgba(183, 246, 50, 0.1), rgba(85, 216, 255, 0.04));
  font-weight: 900;
  letter-spacing: -0.03em;
}
.brand-lockup h1 { margin: 0; font-size: clamp(19px, 1.8vw, 26px); line-height: 1.1; letter-spacing: -0.025em; }
.eyebrow, .section-label {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.section-label { display: flex; align-items: center; gap: 7px; }
.section-label i { font-size: 17px; }
.free-badge, .local-chip, .validation-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.free-badge { padding: 6px 9px; color: var(--lime); background: var(--lime-soft); border: 1px solid rgba(183, 246, 50, 0.32); }
.header-actions { justify-content: flex-end; gap: 10px; }
.button, .tool-button, .icon-button {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, color 160ms ease;
}
.button:hover, .tool-button:hover, .icon-button:hover { border-color: var(--cyan); background: var(--surface-soft); }
.button:active, .tool-button:active { transform: translateY(1px); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 780;
  text-decoration: none;
}
.button i { font-size: 20px; }
.button-primary { color: #00141c; border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 22px rgba(85, 216, 255, 0.12); }
.button-primary:hover { color: #00141c; border-color: #93e9ff; background: #79e2ff; }
.button-secondary { color: var(--muted); }

.shell { width: min(1640px, calc(100% - 36px)); margin: 0 auto; padding: 22px 0 56px; }
.orientation-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(460px, 0.95fr); gap: 14px; }
.lineage-card, .download-card, .task-card, .graph-panel, .guide-card, .deliverables, .boundary-note {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(15, 29, 49, 0.94), rgba(8, 18, 33, 0.94));
  box-shadow: var(--shadow);
}
.lineage-card, .download-card { padding: 18px 20px; }
.lineage-flow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; margin-top: 12px; }
.lineage-step { gap: 14px; min-width: 0; }
.lineage-link {
  padding: 10px;
  margin: -10px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.lineage-link:hover { border-color: var(--border-strong); background: rgba(85, 216, 255, 0.055); transform: translateY(-1px); }
.lineage-link.is-current { border-color: rgba(183, 246, 50, 0.24); background: rgba(183, 246, 50, 0.035); }
.product-number {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  flex: 0 0 47px;
  border-radius: 11px;
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
  margin: 0;
}
.product-five { color: var(--cyan); border: 1px solid rgba(85, 216, 255, 0.5); background: var(--cyan-soft); }
.product-six { color: var(--lime); border: 1px solid rgba(183, 246, 50, 0.45); background: var(--lime-soft); }
.lineage-copy { display: block; min-width: 0; }
.lineage-copy small, .lineage-copy strong, .lineage-copy > span { display: block; }
.lineage-copy small { color: var(--cyan); font-size: 10px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.lineage-link.is-current .lineage-copy small { color: var(--lime); }
.lineage-copy strong { margin-top: 3px; font-size: 15px; line-height: 1.25; }
.lineage-copy > span { margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.lineage-arrow { color: var(--cyan); font-size: 28px; }
.handoff-loop {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid rgba(59, 79, 105, 0.55);
  list-style: none;
}
.handoff-loop li { min-width: 0; padding: 10px; border: 1px solid rgba(59, 79, 105, 0.62); border-radius: 11px; background: rgba(4, 13, 25, 0.36); }
.handoff-loop li > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #00141c; background: var(--cyan); font-size: 11px; font-weight: 900; }
.handoff-loop li:nth-child(2) > span, .handoff-loop li:nth-child(3) > span { background: var(--lime); }
.handoff-loop strong, .handoff-loop small { display: block; }
.handoff-loop strong { margin-top: 9px; font-size: 12px; line-height: 1.3; }
.handoff-loop small { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.42; }
.download-heading-row { justify-content: space-between; gap: 16px; }
.download-heading-row h2 { margin: 0; font-size: 18px; letter-spacing: -0.015em; }
.local-chip { padding: 6px 9px; color: var(--lime); border: 1px solid rgba(183, 246, 50, 0.3); background: var(--lime-soft); }
.file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; margin: 15px 0 12px; padding: 0; list-style: none; }
.file-grid li { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.file-grid i { color: var(--cyan); font-size: 18px; }
.privacy-note { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; }
.privacy-note i { color: var(--lime); font-size: 18px; }
.pack-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(59, 79, 105, 0.55); }
.pack-preview-button { flex: 0 1 auto; min-height: 40px; padding: 8px 12px; color: var(--cyan); border-color: rgba(85, 216, 255, 0.42); background: var(--cyan-soft); }

.task-card { display: grid; grid-template-columns: minmax(360px, 0.9fr) minmax(700px, 1.4fr); align-items: stretch; margin-top: 14px; padding: 20px; }
.task-title-block { padding-right: 22px; border-right: 1px solid var(--border); }
.task-title-block h2 { margin: 0; font-size: clamp(24px, 2.4vw, 36px); line-height: 1.16; letter-spacing: -0.035em; }
.task-title-block > p:last-child { max-width: 640px; margin: 9px 0 0; color: var(--muted); font-size: 15px; }
.task-facts { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; }
.task-facts > div { min-width: 0; padding: 3px 20px; border-right: 1px solid var(--border); }
.task-facts > div:last-child { border-right: 0; }
.task-facts dt { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 760; }
.task-facts dt i { color: var(--cyan); font-size: 19px; }
.task-facts dd { margin: 9px 0 0; color: var(--text); font-size: 15px; font-weight: 720; line-height: 1.35; }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 14px; margin-top: 14px; }
.graph-panel { min-width: 0; overflow: hidden; }
.graph-heading { justify-content: space-between; gap: 24px; padding: 20px 22px 17px; border-bottom: 1px solid var(--border); }
.graph-heading h2 { margin: 0; font-size: clamp(21px, 2vw, 28px); letter-spacing: -0.025em; }
.graph-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.validation-state { padding: 8px 11px; color: var(--lime); border: 1px solid rgba(183, 246, 50, 0.32); background: var(--lime-soft); }
.graph-toolbar { flex-wrap: wrap; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: rgba(5, 11, 22, 0.28); }
.search-control {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 260px;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
}
.search-control i { color: var(--subtle); font-size: 19px; }
.search-control input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-control input::placeholder { color: var(--subtle); }
.tool-button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 11px; border-radius: 9px; color: var(--muted); font-weight: 700; }
.tool-button i { font-size: 18px; }
.tool-button[aria-pressed="true"], .tool-button[aria-expanded="true"].info-button { color: var(--cyan); border-color: rgba(85, 216, 255, 0.48); background: var(--cyan-soft); }
.info-button { margin-left: auto; }
.explainer-mobile-slot { display: none; }
.explainer-mobile-slot .guide-card { margin: 12px 14px 0; box-shadow: none; }
.graph-stage-wrap { position: relative; height: 515px; background: radial-gradient(circle at 50% 42%, rgba(33, 129, 174, 0.12), transparent 48%), #06101d; }
#knowledge-graph { width: 100%; height: 100%; }
.graph-legend {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: rgba(5, 11, 22, 0.92);
  font-size: 12px;
}
.graph-legend[hidden] { display: none; }
.graph-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { display: inline-block; width: 25px; height: 0; border-top: 2px solid; }
.legend-line.verified { border-color: var(--lime); }
.legend-line.uncertain { border-color: var(--amber); border-top-style: dashed; }
.legend-line.selected { border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.path-ribbon { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin: 0; padding: 14px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); list-style: none; }
.path-ribbon li { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 720; text-align: center; }
.path-ribbon li:not(:last-child)::after { content: ""; position: absolute; right: -5px; width: 10px; height: 1px; background: var(--border-strong); }
.path-ribbon span { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: #00141c; background: var(--cyan); font-size: 11px; font-weight: 900; }
.path-ribbon .is-current { color: var(--text); }
.path-ribbon .is-current span { box-shadow: 0 0 14px rgba(85, 216, 255, 0.55); }
.accessible-objects { padding: 15px 18px 18px; }
.accessible-objects h3 { margin: 0 0 10px; font-size: 14px; }
.object-list { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.object-button { width: 100%; min-height: 48px; padding: 8px 7px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: rgba(7, 15, 27, 0.72); cursor: pointer; font-size: 12px; font-weight: 700; line-height: 1.25; }
.object-button:hover, .object-button[aria-current="true"] { color: var(--text); border-color: var(--cyan); background: var(--cyan-soft); }

.guide-column { display: grid; gap: 14px; }
.guide-card { padding: 18px; }
.guide-heading { justify-content: space-between; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.guide-heading > div { gap: 8px; }
.guide-heading i { color: var(--cyan); font-size: 21px; }
.guide-heading h2 { margin: 0; font-size: 17px; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 8px; }
.guide-card > p { margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.explain-list { display: grid; gap: 15px; margin: 16px 0 0; padding: 0; list-style: none; }
.explain-list li { display: grid; grid-template-columns: 23px 1fr; gap: 9px; color: var(--muted); font-size: 14px; }
.explain-list li > i { margin-top: 2px; color: var(--cyan); font-size: 20px; }
.explain-list strong { display: block; margin-bottom: 2px; color: var(--text); }
.inspector-card h2 { margin: 11px 0 0; color: var(--cyan); font-size: 19px; line-height: 1.3; }
.connection-details { display: grid; gap: 13px; margin: 17px 0 0; }
.connection-details div { padding-top: 12px; border-top: 1px solid rgba(59, 79, 105, 0.58); }
.connection-details dt { color: var(--cyan); font-size: 11px; font-weight: 850; letter-spacing: 0.11em; text-transform: uppercase; }
.connection-details dd { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.verified-text { display: inline-flex; align-items: center; gap: 6px; color: var(--lime); }
.uncertain-text { display: inline-flex; align-items: center; gap: 6px; color: var(--amber); }

.deliverables { display: grid; grid-template-columns: 245px 1fr; gap: 22px; margin-top: 14px; padding: 19px 20px; }
.deliverables h2 { margin: 0; font-size: 20px; }
.deliverable-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.deliverable-grid article { gap: 11px; min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: rgba(5, 11, 22, 0.34); }
.deliverable-grid article > i { color: var(--cyan); font-size: 27px; }
.deliverable-grid h3 { margin: 0; font-size: 14px; }
.deliverable-grid p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.boundary-note { gap: 12px; margin-top: 14px; padding: 14px 18px; box-shadow: none; }
.boundary-note > i { color: var(--cyan); font-size: 22px; }
.boundary-note p { margin: 0; color: var(--muted); font-size: 13px; }
.boundary-note strong { color: var(--text); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  max-width: min(430px, calc(100vw - 40px));
  padding: 13px 16px;
  border: 1px solid var(--cyan);
  border-radius: 10px;
  color: var(--text);
  background: #0c1b2c;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

.pack-dialog {
  width: min(1040px, calc(100% - 32px));
  max-height: min(880px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  color: var(--text);
  background: #07111f;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.72);
}
.pack-dialog::backdrop { background: rgba(1, 5, 12, 0.82); backdrop-filter: blur(10px); }
.pack-dialog-shell { padding: clamp(18px, 3vw, 30px); }
.pack-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.pack-dialog-heading h2 { margin: 0; font-size: clamp(24px, 3vw, 36px); line-height: 1.12; letter-spacing: -0.035em; }
.pack-dialog-heading p:last-child { max-width: 760px; margin: 8px 0 0; color: var(--muted); }
.pack-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 18px; }
.pack-preview-grid article { display: grid; grid-template-columns: 42px 1fr; gap: 12px; min-width: 0; padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(145deg, rgba(15, 29, 49, 0.82), rgba(8, 18, 33, 0.82)); }
.file-index { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(85, 216, 255, 0.42); border-radius: 9px; color: var(--cyan); background: var(--cyan-soft); font-size: 12px; font-weight: 900; }
.pack-preview-grid h3 { margin: 0; color: var(--text); font-size: 15px; }
.pack-preview-grid p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.pack-preview-grid strong { color: var(--text); }
.pack-dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.pack-dialog-footer p { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; }
.pack-dialog-footer p i { color: var(--lime); font-size: 18px; }

@media (max-width: 1220px) {
  .topbar { position: static; align-items: flex-start; }
  .header-actions { flex-wrap: wrap; }
  .orientation-grid, .workbench { grid-template-columns: 1fr; }
  .task-card { grid-template-columns: 1fr; }
  .task-title-block { padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--border); }
  .task-facts { margin-top: 17px; }
  .guide-column { grid-template-columns: 1fr 1fr; }
  .explainer-mobile-slot { display: block; }
  .graph-stage-wrap { height: 560px; }
  .deliverables { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topbar { flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1 1 260px; }
  .shell { width: min(100% - 24px, 1640px); padding-top: 12px; }
  .lineage-flow { grid-template-columns: 1fr; }
  .lineage-link { margin: 0; }
  .lineage-arrow { transform: rotate(90deg); justify-self: center; }
  .handoff-loop { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-grid { grid-template-columns: 1fr; }
  .pack-actions { align-items: flex-start; flex-direction: column; }
  .task-facts { grid-template-columns: 1fr 1fr; }
  .task-facts > div { padding: 12px; border-bottom: 1px solid var(--border); }
  .task-facts > div:nth-child(2) { border-right: 0; }
  .task-facts > div:nth-child(3), .task-facts > div:nth-child(4) { border-bottom: 0; }
  .graph-heading { align-items: flex-start; }
  .graph-toolbar { align-items: stretch; }
  .search-control { min-width: 100%; }
  .info-button { margin-left: 0; }
  .graph-stage-wrap { height: 820px; }
  .path-ribbon { grid-template-columns: 1fr; gap: 8px; }
  .path-ribbon li { justify-content: flex-start; text-align: left; }
  .path-ribbon li:not(:last-child)::after { display: none; }
  .object-list { grid-template-columns: repeat(2, 1fr); }
  .guide-column, .deliverable-grid { grid-template-columns: 1fr; }
  .graph-legend { left: 12px; right: auto; flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .brand-lockup { flex-wrap: wrap; }
  .brand-lockup > div { min-width: calc(100% - 66px); }
  .free-badge { margin-left: 61px; }
  .header-actions .product-page-link { flex-basis: 100%; }
  .lineage-card, .download-card, .task-card, .guide-card { padding: 15px; }
  .handoff-loop { grid-template-columns: 1fr; }
  .task-facts { grid-template-columns: 1fr; }
  .task-facts > div { border-right: 0; border-bottom: 1px solid var(--border) !important; }
  .task-facts > div:last-child { border-bottom: 0 !important; }
  .graph-heading { flex-direction: column; padding: 17px; }
  .tool-button { flex: 1 1 140px; justify-content: center; }
  .object-list { grid-template-columns: 1fr; }
  .deliverables { padding: 16px; }
  .pack-preview-grid { grid-template-columns: 1fr; }
  .pack-dialog-footer { align-items: stretch; flex-direction: column; }
  .pack-dialog-footer .button { width: 100%; }
}

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