:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --ink: #10213f;
  --muted: #607086;
  --line: #d4e0ec;
  --blue: #2f6fed;
  --blue-soft: #e8f1ff;
  --green: #17a574;
  --green-soft: #e7f7ef;
  --amber: #f2a51a;
  --amber-soft: #fff4d9;
  --red: #df5454;
  --red-soft: #fdecec;
  --navy: #0f2347;
  --shadow: 0 24px 70px rgba(15, 35, 71, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(47, 111, 237, .12), transparent 28%),
    linear-gradient(135deg, #f7fbff 0%, #eef3f7 48%, #f9fbfd 100%);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.is-hidden {
  display: none !important;
}

.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  align-items: center;
  gap: 56px;
  padding: 72px;
  max-width: 1320px;
  margin: 0 auto;
}

.gate-copy {
  padding: 64px 0;
}

.brand-mark {
  width: 70px;
  height: 70px;
  border-radius: 22px;
  overflow: hidden;
  background: transparent;
  box-shadow: var(--shadow);
}

.brand-mark.small {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 15px;
  box-shadow: none;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.eyebrow {
  margin: 24px 0 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.gate h1 {
  margin: 0;
  max-width: 740px;
  font-size: clamp(48px, 6vw, 82px);
  line-height: 1.02;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 22px;
  line-height: 1.55;
}

.gate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.gate-meta span {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  font-size: 14px;
}

.gate-form {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
}

.gate-form label {
  display: block;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.gate-form input {
  width: 100%;
  margin-bottom: 18px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbfe;
  color: var(--ink);
  outline: none;
}

.gate-form input:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .12);
}

.gate-form button,
.member-card button {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 15px 18px;
  color: #fff;
  background: var(--navy);
  font-weight: 850;
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--red);
  font-size: 13px;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legal-links,
.member-legal {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legal-links a,
.member-legal a,
.legal-page a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 750;
}

.legal-links a:hover,
.member-legal a:hover,
.legal-page a:hover {
  text-decoration: underline;
}

.member-legal {
  margin-top: 12px;
}

.legal-page {
  min-height: 100vh;
  padding: 64px 22px;
}

.legal-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow);
}

.legal-back {
  display: inline-flex;
  align-items: center;
  margin-bottom: 24px;
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

.legal-shell h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.12;
}

.legal-shell h2 {
  margin: 34px 0 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 22px;
}

.legal-shell p,
.legal-shell li {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.legal-shell ul {
  padding-left: 20px;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.side-top {
  display: flex;
  gap: 14px;
  align-items: center;
}

.side-top strong,
.side-top span {
  display: block;
}

.side-top strong {
  font-size: 16px;
}

.side-top span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  align-content: start;
  gap: 8px;
  margin-top: 34px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 750;
}

.nav-item.is-active {
  color: var(--blue);
  background: var(--blue-soft);
}

.member-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fbfe;
}

.member-card span,
.member-card strong {
  display: block;
}

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

.member-card strong {
  margin: 6px 0 14px;
  font-size: 15px;
}

.member-card button {
  padding: 10px 12px;
  background: #dce6f2;
  color: var(--ink);
}

.workspace {
  padding: 30px;
  min-width: 0;
}

.workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.workspace-head .eyebrow {
  margin-top: 0;
}

.workspace-head h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 110px);
  gap: 10px;
}

.stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.75);
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 24px;
}

.stats span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px 220px;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar input,
.toolbar select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: white;
  color: var(--ink);
  outline: none;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, .92fr) minmax(420px, 1.08fr);
  gap: 16px;
  align-items: start;
}

.model-list,
.detail-panel,
.map-viewer,
.maps-panel,
.future-grid article,
.pipeline {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 12px 40px rgba(15, 35, 71, .06);
}

.model-list {
  height: calc(100vh - 162px);
  overflow: auto;
  padding: 10px;
}

.cards {
  display: grid;
  gap: 10px;
}

.model-card {
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 14px;
  background: #f8fbfe;
  cursor: pointer;
}

.model-card:hover,
.model-card.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

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

.model-card h3 {
  margin: 0;
  font-size: 17px;
}

.model-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tag {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: white;
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
}

.detail-panel {
  min-height: calc(100vh - 162px);
  padding: 24px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-head h3 {
  margin: 6px 0 8px;
  font-size: 36px;
  line-height: 1.08;
}

.detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.detail-body {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.info-block {
  padding: 16px;
  border-radius: 18px;
  background: #f8fbfe;
}

.info-block strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.info-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.actions a,
.actions button,
.section-title a {
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  background: var(--navy);
  color: white;
  text-decoration: none;
  font-weight: 800;
}

.actions .ghost {
  background: var(--blue-soft);
  color: var(--blue);
}

.knowledge-preview {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: white;
}

.knowledge-preview img {
  display: block;
  width: 100%;
}

.model-network-panel {
  height: calc(100vh - 162px);
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 12px 40px rgba(15, 35, 71, .06);
}

.network-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.network-panel-head .eyebrow {
  margin: 0 0 8px;
}

.network-panel-head h3 {
  margin: 0;
  font-size: 28px;
}

.network-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.network-tools button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font-weight: 850;
}

.network-viewport {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(rgba(47,111,237,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47,111,237,.05) 1px, transparent 1px),
    radial-gradient(circle at 30% 18%, rgba(47,111,237,.1), transparent 32%),
    #f8fbfe;
  background-size: 36px 36px, 36px 36px, auto, auto;
  cursor: grab;
}

.network-viewport.is-dragging {
  cursor: grabbing;
}

.network-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  user-select: none;
}

.network-link {
  fill: none;
  stroke: rgba(47,111,237,.22);
  stroke-width: 1.2;
  transition: opacity .16s ease, stroke .16s ease, stroke-width .16s ease;
}

.network-link.weight-9,
.network-link.weight-10 {
  stroke: rgba(23,165,116,.34);
  stroke-width: 1.8;
}

.network-link.weight-4 {
  stroke: rgba(96,112,134,.18);
}

.network-node {
  filter: url(#nodeGlow);
  transition: opacity .16s ease;
}

.network-node circle {
  stroke: white;
  stroke-width: 3;
  transition: transform .18s ease, stroke-width .18s ease;
}

.network-node text {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 850;
  paint-order: stroke;
  stroke: rgba(248,251,254,.9);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.network-node.is-model,
.network-node.is-podcast {
  cursor: pointer;
}

.network-node.is-model circle {
  fill: var(--navy);
}

.network-node.is-model text,
.network-node.is-podcast text {
  fill: var(--navy);
  font-size: 14px;
}

.network-node.is-source circle {
  fill: #101828;
}

.network-node.is-source text {
  fill: #101828;
  font-size: 15px;
}

.network-node.is-chapter circle {
  fill: var(--blue);
}

.network-node.is-theme circle {
  fill: var(--green);
}

.network-node.is-scene circle {
  fill: var(--amber);
}

.network-node.is-podcast circle {
  fill: var(--red);
}

.network-node.is-hovered circle,
.network-node.is-model:hover circle,
.network-node.is-model:focus circle,
.network-node.is-podcast:hover circle,
.network-node.is-podcast:focus circle {
  transform: scale(1.22);
  stroke-width: 4;
}

.network-svg.has-network-focus .network-node.is-dimmed {
  opacity: .16;
}

.network-svg.has-network-focus .network-link.is-dimmed {
  opacity: .08;
}

.network-svg.has-network-focus .network-node.is-related {
  opacity: 1;
}

.network-svg.has-network-focus .network-node.is-related circle {
  stroke: #fff;
  stroke-width: 4;
}

.network-svg.has-network-focus .network-node.is-focus-node circle {
  transform: scale(1.3);
  stroke: #2f6fed;
  stroke-width: 5;
}

.network-svg.has-network-focus .network-link.is-related {
  opacity: 1;
  stroke: rgba(47,111,237,.78);
  stroke-width: 3;
}

.network-tooltip {
  position: absolute;
  z-index: 4;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid rgba(47,111,237,.26);
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 850;
  pointer-events: none;
}

.network-drilldown {
  border: 1px solid rgba(47,111,237,.24);
  border-radius: 20px;
  padding: 16px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 16px 50px rgba(15,35,71,.1);
}

.drilldown-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.drilldown-head span,
.drilldown-block-head span,
.drilldown-subgrid span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.drilldown-head h4 {
  margin: 6px 0 4px;
  font-size: 22px;
}

.drilldown-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.drilldown-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.drilldown-body {
  display: grid;
  gap: 12px;
  max-height: 430px;
  margin-top: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.drilldown-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #f8fbfe;
}

.drilldown-block-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.drilldown-block-head strong {
  font-size: 16px;
}

.drilldown-block-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.drilldown-scenes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.drilldown-scenes span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #7a5209;
  font-size: 12px;
  font-weight: 850;
}

.drilldown-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.drilldown-subgrid section {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: white;
}

.drilldown-subgrid section > strong {
  display: block;
  margin: 5px 0 10px;
}

.drilldown-articles {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.drilldown-article {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.drilldown-subgrid .drilldown-article {
  background: #f8fbfe;
}

.drilldown-article:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.drilldown-article strong,
.drilldown-article span {
  display: block;
}

.drilldown-article strong {
  font-size: 13px;
  line-height: 1.35;
}

.drilldown-article span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.network-empty {
  fill: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.network-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.network-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.network-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.network-legend .source { background: #101828; }
.network-legend .chapter { background: var(--blue); }
.network-legend .theme { background: var(--green); }
.network-legend .scene { background: var(--amber); }
.network-legend .model { background: var(--navy); }

body.has-modal {
  overflow: hidden;
}

.model-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 34px;
}

.model-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8,18,38,.54);
  backdrop-filter: blur(10px);
}

.model-modal-panel {
  position: relative;
  z-index: 1;
  width: min(1440px, 94vw);
  max-height: 90vh;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 24px;
  background: #f8fbfe;
  box-shadow: 0 34px 110px rgba(8,18,38,.32);
}

.model-modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.model-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  padding: 24px 70px 20px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.78);
}

.model-modal-head h3 {
  margin: 10px 0 8px;
  font-size: 32px;
  line-height: 1.12;
}

.model-modal-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.model-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  max-height: calc(90vh - 140px);
  padding: 20px;
  overflow: hidden;
}

.modal-article-reader,
.modal-map-aside {
  max-height: calc(90vh - 180px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-map-aside {
  padding-right: 2px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.section-title .eyebrow {
  margin-top: 0;
}

.section-title h3 {
  margin: 0;
  font-size: 30px;
}

.map-viewer {
  padding: 24px;
}

.map-viewer img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: white;
}

.maps-panel {
  padding: 24px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.category-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 13px;
  background: white;
  color: var(--ink);
}

.category-tab:hover,
.category-tab.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.category-tab strong {
  font-size: 14px;
}

.category-tab span {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--navy);
  color: white;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.map-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 16px;
}

.map-toolbar input,
.map-toolbar select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: white;
  color: var(--ink);
  outline: none;
}

.map-toolbar input:focus,
.map-toolbar select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .12);
}

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

.map-cards,
.map-preview {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fbfe;
}

.map-cards {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 300px);
  min-height: 380px;
  overflow: auto;
  padding: 12px;
}

.map-list-card {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 14px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.map-list-card:hover,
.map-list-card.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.map-list-card span,
.map-list-card strong,
.map-list-card small {
  display: block;
}

.map-list-card span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
}

.map-list-card strong {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.35;
}

.map-list-card small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.map-preview {
  max-height: calc(100vh - 300px);
  overflow: hidden;
  padding: 22px;
}

.map-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.map-preview-head > div:first-child {
  min-width: 0;
}

.map-preview-head h3 {
  margin: 10px 0 8px;
  font-size: 34px;
  line-height: 1.12;
}

.map-preview-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.map-head-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  margin-top: 0;
}

.map-reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  height: calc(100vh - 430px);
  min-height: 420px;
  margin-top: 18px;
  align-items: start;
}

.map-article-reader {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.map-preview .map-aside {
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

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

.future-grid article {
  padding: 24px;
  min-height: 250px;
}

.future-grid span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
}

.future-grid h3,
.pipeline h3 {
  margin: 12px 0 10px;
  font-size: 28px;
}

.future-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.masters-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 12px 40px rgba(15, 35, 71, .06);
}

.source-pill {
  min-width: 130px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbfe;
}

.source-pill strong,
.source-pill span {
  display: block;
}

.source-pill strong {
  font-size: 24px;
}

.source-pill span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.master-list-panel,
.master-detail {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fbfe;
}

.master-list-panel {
  position: sticky;
  top: 30px;
  max-height: calc(100vh - 60px);
  overflow: hidden;
  padding: 14px;
}

.source-note {
  padding: 14px;
  border-radius: 16px;
  background: white;
}

.source-note strong,
.source-note span {
  display: block;
}

.source-note strong {
  font-size: 14px;
}

.source-note span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.master-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.master-model {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 13px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.master-model:hover,
.master-model.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.master-model span,
.master-model strong,
.master-model small {
  display: block;
}

.master-model span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
}

.master-model strong {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.35;
}

.master-model small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.master-detail {
  padding: 22px;
}

.master-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.master-detail-head h3 {
  margin: 10px 0 8px;
  font-size: 34px;
  line-height: 1.12;
}

.master-detail-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.master-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.article-reader {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.article-reader h3,
.article-reader h4,
.article-reader h5,
.article-reader p,
.article-reader blockquote,
.article-reader ol,
.article-reader table {
  max-width: 760px;
}

.article-reader h3 {
  margin: 0 0 18px;
  font-size: 30px;
  line-height: 1.2;
}

.article-reader h4 {
  margin: 28px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 21px;
}

.article-reader h5 {
  margin: 22px 0 8px;
  font-size: 16px;
}

.article-reader p,
.article-reader li {
  color: #364761;
  line-height: 1.78;
}

.article-reader blockquote {
  margin: 14px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--blue);
  border-radius: 0 14px 14px 0;
  background: var(--blue-soft);
  color: var(--ink);
  font-weight: 800;
  line-height: 1.7;
}

.article-reader ol {
  padding-left: 22px;
}

.article-reader ul {
  padding-left: 22px;
}

.article-reader table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 14px;
}

.article-reader th,
.article-reader td {
  border: 1px solid var(--line);
  padding: 10px;
  color: #364761;
  text-align: left;
  vertical-align: top;
}

.article-reader th {
  background: var(--blue-soft);
  color: var(--ink);
}

.map-aside {
  display: grid;
  gap: 14px;
}

.sync-card,
.map-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: white;
}

.sync-card strong,
.map-card strong {
  display: block;
  margin-bottom: 8px;
}

.sync-card p,
.map-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.sync-card a {
  display: inline-block;
  margin-top: 12px;
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

.map-card img {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.image-zoom-trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.zoomable-map {
  cursor: zoom-in;
}

body.has-lightbox {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 54px;
  background: rgba(8, 18, 38, .86);
  backdrop-filter: blur(10px);
}

.image-lightbox.is-hidden {
  display: none;
}

.image-lightbox-img {
  max-width: min(92vw, 1800px);
  max-height: 88vh;
  border-radius: 18px;
  background: white;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .36);
  cursor: zoom-out;
  transform-origin: center center;
  transition: transform .12s ease;
}

.image-lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: white;
  font-size: 28px;
  line-height: 1;
}

.image-lightbox-help {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(15, 35, 71, .72);
  color: white;
  font-size: 13px;
  font-weight: 750;
}

.pipeline {
  padding: 24px;
}

.pipeline ol {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.pipeline li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  background: #f8fbfe;
}

.pipeline strong {
  color: var(--blue);
}

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

@media (max-width: 980px) {
  .gate {
    grid-template-columns: 1fr;
    padding: 28px;
  }

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

  .sidebar {
    position: static;
    height: auto;
  }

  .content-grid,
  .toolbar,
  .map-toolbar,
  .future-grid,
  .map-library,
  .masters-grid,
  .map-reader-layout,
  .master-layout {
    grid-template-columns: 1fr;
  }

  .model-list {
    height: 420px;
  }

  .map-preview {
    max-height: none;
    overflow: visible;
  }

  .map-reader-layout {
    height: auto;
    min-height: 0;
  }

  .map-article-reader,
  .map-preview .map-aside {
    height: auto;
    max-height: none;
  }

  .master-list-panel {
    position: static;
    max-height: none;
  }

  .master-list {
    max-height: 420px;
  }

  .workspace-head {
    align-items: start;
    flex-direction: column;
  }

  .stats {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .model-network-panel {
    height: 680px;
  }

  .network-panel-head,
  .model-modal-head {
    align-items: start;
    flex-direction: column;
  }

  .network-tools {
    align-items: start;
    flex-direction: column;
  }

  .model-modal {
    padding: 14px;
  }

  .model-modal-body {
    grid-template-columns: 1fr;
    max-height: calc(92vh - 150px);
    overflow-y: auto;
  }

  .modal-article-reader,
  .modal-map-aside {
    max-height: none;
  }
}

@media (min-width: 981px) and (max-width: 1280px) {
  .map-reader-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .map-article-reader {
    height: 520px;
  }

  .map-preview .map-aside {
    max-height: none;
    overflow: visible;
  }
}
