:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-strong: #eef3f5;
  --ink: #16202a;
  --muted: #64717e;
  --line: #d9e0e6;
  --primary: #155b6e;
  --primary-soft: #dceef2;
  --accent: #d85f3f;
  --green: #43826c;
  --blue: #315fbd;
  --amber: #a86f1e;
  --violet: #6954a6;
  --danger: #b24640;
  --shadow: 0 18px 50px rgba(31, 45, 61, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(21, 91, 110, 0.08), rgba(246, 247, 251, 0) 360px),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 28px;
  align-items: stretch;
  padding: 42px;
  color: #f7fbfc;
  background:
    linear-gradient(135deg, rgba(12, 43, 53, 0.94), rgba(21, 91, 110, 0.9)),
    linear-gradient(45deg, rgba(216, 95, 63, 0.6), rgba(49, 95, 189, 0.4));
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 auto;
  width: min(48vw, 620px);
  height: 180px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  transform: skewY(-7deg);
  opacity: 0.55;
}

.hero-copy,
.hero-dashboard {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #ffc2aa;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 960px;
  margin-bottom: 20px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

.lede {
  max-width: 820px;
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.75;
  color: rgba(247, 251, 252, 0.86);
}

.hero-dashboard {
  align-self: center;
  display: grid;
  gap: 14px;
}

.hero-dashboard > div {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.metric-number {
  display: block;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.metric-label {
  display: block;
  margin-top: 7px;
  color: rgba(247, 251, 252, 0.72);
  font-size: 14px;
}

.lens-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.lens-button {
  display: flex;
  min-height: 84px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.lens-button span {
  font-weight: 800;
}

.lens-button small {
  color: var(--muted);
}

.lens-button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 12px 30px rgba(21, 91, 110, 0.16);
}

.lens-button:hover {
  transform: translateY(-2px);
}

.view-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid rgba(217, 224, 230, 0.72);
  border-radius: 8px;
  background: rgba(246, 247, 251, 0.86);
  backdrop-filter: blur(14px);
  overflow-x: auto;
}

.view-tabs a {
  flex: 0 0 auto;
  padding: 10px 14px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 700;
}

.view-tabs a:hover,
.view-tabs a:focus {
  color: var(--primary);
  background: var(--surface);
}

.section-band {
  margin-top: 18px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 34px rgba(31, 45, 61, 0.06);
}

.section-heading {
  max-width: 960px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin-bottom: 10px;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: 0;
}

.section-heading p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.operating-chain {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.chain-step {
  min-height: 138px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.chain-step strong {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
}

.chain-step p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 12px;
}

.map-wrap,
.matrix-panel,
.pair-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.map-toolbar,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.map-title,
.panel-heading h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.map-subtitle,
.panel-heading span {
  color: var(--muted);
  font-size: 13px;
}

.compact-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
}

select:focus,
input:focus,
button:focus {
  outline: 3px solid rgba(21, 91, 110, 0.18);
  outline-offset: 2px;
}

#roleNetwork {
  display: block;
  width: 100%;
  height: min(62vw, 560px);
  min-height: 380px;
  background:
    linear-gradient(90deg, rgba(21, 91, 110, 0.06) 25%, transparent 25% 50%, rgba(216, 95, 63, 0.055) 50% 75%, transparent 75%),
    linear-gradient(180deg, #fbfcfd, #f4f7f9);
}

.network-label {
  font-size: 12px;
  font-weight: 700;
  fill: #22313d;
}

.network-node {
  cursor: pointer;
}

.network-node circle {
  transition:
    r 160ms ease,
    stroke-width 160ms ease;
}

.network-node:hover circle {
  r: 13px;
  stroke-width: 4px;
}

.axis-caption {
  fill: rgba(22, 32, 42, 0.48);
  font-size: 13px;
  font-weight: 700;
}

.axis-title {
  fill: rgba(22, 32, 42, 0.72);
  font-size: 14px;
  font-weight: 800;
}

.axis-note {
  fill: rgba(22, 32, 42, 0.42);
  font-size: 12px;
  font-weight: 800;
}

.network-plot-bg {
  fill: rgba(255, 255, 255, 0.66);
  stroke: rgba(21, 91, 110, 0.16);
  stroke-width: 1.5;
}

.network-grid-line {
  stroke: rgba(21, 91, 110, 0.14);
  stroke-dasharray: 6 7;
  stroke-width: 1;
}

.network-grid-line.strong {
  stroke: rgba(216, 95, 63, 0.22);
  stroke-width: 1.3;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.4fr) minmax(180px, 0.8fr);
  gap: 12px;
  margin-bottom: 16px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.48fr);
  gap: 16px;
  align-items: start;
}

.role-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.role-card {
  min-height: 270px;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.role-card:hover,
.role-card.active {
  border-color: var(--primary);
  box-shadow: 0 14px 30px rgba(21, 91, 110, 0.12);
  transform: translateY(-1px);
}

.role-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.role-card h3 {
  margin-bottom: 5px;
  font-size: 19px;
}

.role-card .en {
  color: var(--muted);
  font-size: 12px;
}

.layer-pill {
  flex: 0 0 auto;
  max-width: 140px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.purpose {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.fit-meter {
  display: grid;
  gap: 7px;
}

.fit-row {
  display: grid;
  grid-template-columns: 74px 1fr 28px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.meter-track {
  height: 8px;
  border-radius: 999px;
  background: #edf1f4;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--meter, var(--primary));
}

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #394855;
  background: #f0f3f6;
  font-size: 12px;
}

.detail-panel {
  position: sticky;
  top: 84px;
  padding: 22px;
}

.detail-panel h3 {
  margin-bottom: 4px;
  font-size: 25px;
}

.detail-en {
  margin-bottom: 18px;
  color: var(--muted);
}

.detail-block {
  margin-top: 18px;
}

.detail-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--primary);
}

.detail-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.score-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.score-item span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.score-bar {
  height: 7px;
  border-radius: 999px;
  background: #e8edf1;
  overflow: hidden;
}

.score-bar i {
  display: block;
  height: 100%;
  width: var(--score);
  background: var(--primary);
}

.overlap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.34fr);
  gap: 16px;
  align-items: start;
}

.matrix-scroll {
  overflow: auto;
  max-height: 680px;
}

#overlapMatrix {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}

#overlapMatrix th,
#overlapMatrix td {
  min-width: 48px;
  height: 42px;
  border: 1px solid #e1e7ec;
  text-align: center;
}

#overlapMatrix th {
  position: sticky;
  z-index: 1;
  background: #f7fafb;
  color: #52616e;
  font-weight: 800;
}

#overlapMatrix thead th {
  top: 0;
}

#overlapMatrix tbody th {
  left: 0;
  min-width: 168px;
  text-align: left;
  padding: 8px;
}

.matrix-cell {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  color: #16202a;
  background: var(--cell);
  font-size: 11px;
  font-weight: 800;
}

.matrix-cell:hover {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.pair-panel {
  padding-bottom: 18px;
}

.pair-panel label {
  display: block;
  margin: 16px 18px 0;
}

.pair-result {
  margin: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.relationship-score {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.relationship-score strong {
  font-size: 38px;
  line-height: 1;
}

.relationship-score span {
  color: var(--muted);
}

.pair-result p {
  color: var(--muted);
  line-height: 1.65;
}

.pair-result ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.boundary-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.boundary-card,
.company-card,
.interview-card,
.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.boundary-card h3,
.company-card h3,
.interview-card h3,
.source-card h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.boundary-card p,
.company-card p,
.interview-card p,
.source-card p {
  color: var(--muted);
  line-height: 1.65;
}

.boundary-card ul,
.company-card ul,
.interview-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.polygon-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.legend-item strong {
  color: var(--primary);
}

.legend-layer-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.layer-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px 4px 10px;
  border: 1px solid color-mix(in srgb, var(--chip) 38%, #ffffff);
  border-radius: 999px;
  color: #24313b;
  background: color-mix(in srgb, var(--chip) 16%, #ffffff);
  font-size: 12px;
  font-weight: 700;
}

.layer-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--chip);
}

.coordinate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.coordinate-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.coordinate-card-heading {
  min-height: 118px;
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--line);
}

.coordinate-card-heading h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.coordinate-card-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.coordinate-svg {
  display: block;
  width: 100%;
  min-height: 360px;
  background:
    linear-gradient(180deg, rgba(21, 91, 110, 0.035), rgba(216, 95, 63, 0.025)),
    #fbfcfd;
}

.coordinate-frame {
  fill: rgba(255, 255, 255, 0.75);
  stroke: rgba(21, 91, 110, 0.18);
  stroke-width: 1.4;
}

.coordinate-grid-line {
  stroke: rgba(21, 91, 110, 0.11);
  stroke-dasharray: 5 6;
}

.coordinate-grid-edge {
  stroke: rgba(22, 32, 42, 0.22);
  stroke-width: 1.2;
}

.coordinate-endpoint,
.coordinate-axis-text {
  fill: rgba(22, 32, 42, 0.58);
  font-size: 13px;
  font-weight: 800;
}

.coordinate-axis-letter {
  fill: var(--accent);
  font-size: 14px;
  font-weight: 900;
}

.coordinate-role {
  cursor: pointer;
}

.coordinate-role polygon {
  transition:
    opacity 140ms ease,
    stroke-width 140ms ease,
    transform 140ms ease;
}

.coordinate-role:hover polygon,
.coordinate-role.active polygon {
  opacity: 0.96;
  stroke-width: 3.2px;
}

.coordinate-role-label {
  fill: #17242f;
  font-size: 11px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.company-card {
  display: grid;
  gap: 14px;
}

.company-card.active {
  border-color: var(--primary);
  box-shadow: 0 16px 34px rgba(21, 91, 110, 0.12);
}

.company-emphasis {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.interview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.interview-card strong {
  color: var(--primary);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.source-card a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.source-card a:hover {
  text-decoration: underline;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
}

@media (max-width: 1180px) {
  .hero,
  .content-grid,
  .overlap-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .role-list,
  .boundary-groups,
  .interview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operating-chain,
  .coordinate-grid,
  .company-grid,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 22px, 1440px);
    padding-top: 12px;
  }

  .hero,
  .section-band {
    padding: 22px;
  }

  .lens-bar,
  .filters,
  .role-list,
  .boundary-groups,
  .coordinate-grid,
  .company-grid,
  .interview-grid,
  .source-grid,
  .operating-chain {
    grid-template-columns: 1fr;
  }

  .map-toolbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  #roleNetwork {
    min-height: 520px;
  }
}
