:root {
  color-scheme: dark;
  --ink-0: #081714;
  --ink-1: #0d211c;
  --ink-2: #142d26;
  --ink-3: #1b3930;
  --paper: #f2ead8;
  --muted: #a9b6aa;
  --faint: #75847a;
  --line: rgba(214, 187, 123, 0.2);
  --line-strong: rgba(214, 187, 123, 0.42);
  --gold: #d6bb7b;
  --gold-soft: #a98b4e;
  --good: #79aa85;
  --warn: #d69a62;
  --bad: #c36d62;
  --unknown: #82959d;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink-0);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 12% 0%, rgba(57, 98, 78, 0.2), transparent 35rem),
    radial-gradient(circle at 92% 8%, rgba(169, 139, 78, 0.12), transparent 28rem),
    linear-gradient(145deg, #071511 0%, #0b1b17 52%, #071411 100%);
}

button,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
[tabindex]:focus-visible,
.skip-link:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 12px;
  top: 12px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--ink-0);
  background: var(--gold);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1880px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.boot-card,
.cockpit-card {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(20, 45, 38, 0.95), rgba(10, 27, 22, 0.98)),
    var(--ink-1);
  box-shadow: var(--shadow);
}

.boot-card {
  padding: 48px;
}

.cockpit-card {
  position: relative;
  overflow: hidden;
}

.cockpit-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(214, 187, 123, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 187, 123, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 36%);
}

.cockpit-card > * {
  position: relative;
}

.governance-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 24px;
  border-bottom: 1px solid rgba(214, 154, 98, 0.4);
  color: #ffe1c1;
  background: rgba(112, 60, 30, 0.55);
}

.governance-banner strong {
  letter-spacing: 0.02em;
}

.governance-banner span {
  color: #e7cbb0;
}

.cockpit-header {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-start;
  padding: 34px 38px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4 {
  margin: 0;
}

.brand-block h1 {
  max-width: 860px;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(1.65rem, 3vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.audience {
  margin: 10px 0 0;
  color: var(--muted);
}

.lock-panel {
  display: flex;
  max-width: 520px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.76rem;
}

.read-only-mark {
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--gold);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.67rem;
  font-weight: 780;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.tone-good,
.text-good {
  color: #a7d7b1;
}

.tone-good {
  border-color: rgba(121, 170, 133, 0.45);
  background: rgba(121, 170, 133, 0.1);
}

.tone-warn,
.text-warn {
  color: #f0be8e;
}

.tone-warn {
  border-color: rgba(214, 154, 98, 0.48);
  background: rgba(214, 154, 98, 0.1);
}

.tone-bad,
.text-bad {
  color: #f0a29a;
}

.tone-bad {
  border-color: rgba(195, 109, 98, 0.5);
  background: rgba(195, 109, 98, 0.11);
}

.tone-unknown,
.text-unknown {
  color: #afc0c6;
}

.tone-unknown {
  border-style: dashed;
  border-color: rgba(130, 149, 157, 0.55);
  background: rgba(130, 149, 157, 0.08);
}

.tone-gold,
.text-gold {
  color: #f2d99f;
}

.tone-gold {
  border-color: rgba(214, 187, 123, 0.55);
  background: rgba(214, 187, 123, 0.12);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 34px;
  padding: 34px 38px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(214, 187, 123, 0.06), transparent 62%);
}

.hero-title {
  max-width: 980px;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(1.6rem, 3.1vw, 3.6rem);
  font-weight: 520;
  line-height: 1.14;
  letter-spacing: -0.045em;
}

.hero-why {
  max-width: 880px;
  margin: 18px 0 0;
  color: #c7d2c8;
  font-size: 1rem;
  line-height: 1.75;
}

.hero-quartet {
  display: grid;
  gap: 8px;
}

.hero-fact {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border-left: 3px solid var(--line-strong);
  border-radius: 0 10px 10px 0;
  background: rgba(255, 255, 255, 0.025);
}

.hero-fact span {
  color: var(--faint);
  font-size: 0.72rem;
}

.hero-fact strong {
  font-size: 0.84rem;
  line-height: 1.5;
}

.fact-uncertainty {
  border-left-color: var(--warn);
}

.fact-short-board {
  border-left-color: var(--bad);
}

.fact-next {
  border-left-color: var(--good);
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.pulse-card {
  display: flex;
  min-height: 116px;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.pulse-card:last-child {
  border-right: 0;
}

.pulse-label,
.pulse-note {
  color: var(--faint);
  font-size: 0.7rem;
  line-height: 1.4;
}

.pulse-value {
  font-size: clamp(1rem, 1.4vw, 1.35rem);
  font-weight: 680;
}

.matrix-section,
.aux-section {
  padding: 34px 38px;
}

.matrix-section {
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  align-items: end;
  gap: 18px 36px;
  margin-bottom: 20px;
}

.section-heading .eyebrow {
  grid-column: 1 / -1;
  margin-bottom: -6px;
}

.section-heading h2 {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(1.45rem, 2.2vw, 2.35rem);
  font-weight: 560;
}

.section-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.matrix-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(4, 16, 13, 0.48);
  scrollbar-color: var(--gold-soft) var(--ink-1);
}

.matrix-grid {
  display: grid;
  min-width: 1180px;
}

.matrix-grid.domains-5 {
  grid-template-columns: 104px repeat(5, minmax(206px, 1fr));
}

.matrix-grid.domains-6 {
  grid-template-columns: 104px repeat(6, minmax(196px, 1fr));
}

.matrix-grid.domains-7 {
  grid-template-columns: 104px repeat(7, minmax(188px, 1fr));
}

.matrix-grid.domains-8 {
  grid-template-columns: 104px repeat(8, minmax(180px, 1fr));
}

.matrix-corner,
.domain-head,
.layer-head,
.cell-frame {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.matrix-corner,
.domain-head,
.layer-head {
  min-height: 72px;
  padding: 14px;
  background: rgba(19, 45, 37, 0.78);
}

.matrix-corner,
.layer-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--gold);
  text-align: center;
}

.layer-head b {
  font-size: 1.2rem;
}

.layer-head span,
.domain-head span {
  margin-top: 4px;
  color: var(--faint);
  font-size: 0.66rem;
  line-height: 1.35;
}

.domain-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.domain-head strong {
  font-size: 0.92rem;
}

.cell-frame {
  padding: 7px;
}

.cell-card {
  display: flex;
  width: 100%;
  min-height: 290px;
  flex-direction: column;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(214, 187, 123, 0.14);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  background: linear-gradient(160deg, rgba(25, 57, 47, 0.62), rgba(10, 30, 24, 0.78));
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

.cell-card:hover {
  z-index: 1;
  border-color: var(--line-strong);
  background: linear-gradient(160deg, rgba(30, 68, 55, 0.76), rgba(10, 30, 24, 0.92));
  transform: translateY(-2px);
}

.cell-card.state-missing,
.cell-card.state-unassessed,
.cell-card.state-candidate {
  border-style: dashed;
  background: rgba(18, 38, 33, 0.45);
}

.cell-card.state-blocked {
  border-color: rgba(195, 109, 98, 0.42);
}

.cell-topline {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.cell-objective {
  min-height: 58px;
  font-size: 0.93rem;
  font-weight: 630;
  line-height: 1.5;
}

.axis-stack {
  display: grid;
  gap: 5px;
}

.axis-line {
  display: grid;
  grid-template-columns: 18px minmax(72px, auto) 1fr;
  gap: 6px;
  align-items: center;
  color: var(--faint);
  font-size: 0.65rem;
}

.axis-line b {
  color: var(--gold);
}

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

.ipo-node {
  display: flex;
  min-height: 38px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 8px;
  opacity: 0.88;
}

.ipo-node b {
  font-size: 0.68rem;
}

.ipo-node em {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.58rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-evidence {
  margin: 0;
  color: var(--faint);
  font-size: 0.65rem;
}

.cell-next {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  margin: auto 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
  line-height: 1.45;
}

.cell-next span {
  color: var(--gold);
}

.cell-next strong {
  font-weight: 560;
}

.tab-list {
  display: flex;
  max-width: 100%;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.tab-button {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.025);
}

.tab-button[aria-selected="true"] {
  border-color: var(--gold);
  color: var(--ink-0);
  background: var(--gold);
}

.tab-panels {
  min-height: 220px;
  padding-top: 14px;
}

.tab-panel[hidden] {
  display: none;
}

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

.queue-list,
.history-list,
.drawer-stack,
.atom-list {
  display: grid;
  gap: 10px;
}

.gold-grid,
.drawer-axis-grid,
.ipo-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

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

.list-card,
.detail-card,
.history-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
}

.list-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  align-items: start;
}

.list-card h3 {
  font-size: 0.84rem;
  line-height: 1.4;
}

.list-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

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

.meta-item {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

.meta-item strong {
  max-width: 70%;
  color: var(--paper);
  font-weight: 560;
  text-align: right;
  overflow-wrap: anywhere;
}

.quality-table {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.quality-row {
  display: grid;
  grid-template-columns: 34px 52px 1fr;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.67rem;
}

.quality-row b {
  color: var(--gold);
}

.quality-row strong {
  color: var(--paper);
}

.history-event {
  display: grid;
  grid-template-columns: minmax(160px, auto) 1fr auto;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.7rem;
}

.cockpit-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 38px 28px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.68rem;
}

.cockpit-footer p {
  margin: 0;
}

.drawer {
  width: min(1040px, calc(100% - 32px));
  max-height: min(88vh, 900px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  color: var(--paper);
  background: var(--ink-1);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
}

.drawer::backdrop {
  background: rgba(2, 9, 7, 0.8);
  backdrop-filter: blur(6px);
}

.drawer-shell {
  display: flex;
  max-height: min(88vh, 900px);
  flex-direction: column;
}

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

.drawer-title {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 560;
}

.drawer-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.drawer-close {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
}

.drawer-tabs {
  padding: 15px 28px 0;
}

.drawer-panels {
  min-height: 0;
  overflow-y: auto;
  padding: 8px 28px 28px;
}

.detail-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.detail-section h4,
.detail-card h4 {
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

.detail-card p {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.6;
}

.key-value-list {
  display: grid;
  grid-template-columns: minmax(96px, 0.35fr) minmax(0, 1fr);
  margin: 0;
  font-size: 0.74rem;
}

.key-value-list dt,
.key-value-list dd {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.key-value-list dt {
  color: var(--faint);
}

.key-value-list dd {
  overflow-wrap: anywhere;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.65;
}

.noscript {
  margin: 20px;
  padding: 16px;
  border: 1px solid var(--warn);
  color: #ffe1c1;
  background: #442718;
}

@media (max-width: 1180px) {
  .pulse-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pulse-card:nth-child(3) {
    border-right: 0;
  }

  .pulse-card:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .aux-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px;
  }

  .cockpit-header,
  .hero-panel,
  .section-heading,
  .cockpit-footer {
    grid-template-columns: 1fr;
  }

  .cockpit-header,
  .cockpit-footer {
    flex-direction: column;
  }

  .lock-panel {
    justify-content: flex-start;
  }

  .hero-panel {
    display: grid;
  }

  .section-heading .eyebrow {
    margin-bottom: 0;
  }

  .pulse-grid,
  .aux-grid,
  .gold-grid,
  .drawer-axis-grid,
  .ipo-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pulse-card:nth-child(n) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .pulse-card:nth-child(2n) {
    border-right: 0;
  }

  .meta-grid,
  .quality-table {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .cockpit-card {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .governance-banner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }

  .cockpit-header,
  .hero-panel,
  .matrix-section,
  .aux-section,
  .cockpit-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .cockpit-header {
    padding-top: 24px;
  }

  .hero-panel {
    gap: 22px;
  }

  .hero-title {
    font-size: 1.72rem;
  }

  .hero-fact {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .pulse-grid,
  .aux-grid,
  .gold-grid,
  .drawer-axis-grid,
  .ipo-detail-grid {
    grid-template-columns: 1fr;
  }

  .pulse-card:nth-child(n) {
    min-height: 92px;
    border-right: 0;
  }

  .matrix-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .matrix-grid,
  .matrix-grid.domains-5,
  .matrix-grid.domains-6,
  .matrix-grid.domains-7,
  .matrix-grid.domains-8 {
    display: block;
    min-width: 0;
  }

  .matrix-corner,
  .domain-head,
  .layer-head {
    display: none;
  }

  .cell-frame {
    position: relative;
    margin-bottom: 12px;
    padding: 31px 0 0;
    border: 0;
  }

  .cell-frame::before {
    position: absolute;
    top: 7px;
    left: 2px;
    content: attr(data-domain-label) " · " attr(data-layer-label);
    color: var(--gold);
    font-size: 0.7rem;
    font-weight: 760;
    letter-spacing: 0.03em;
  }

  .cell-card {
    min-height: 0;
  }

  .cell-objective {
    min-height: 0;
  }

  .section-heading {
    display: grid;
    gap: 10px;
  }

  .drawer {
    width: 100%;
    max-height: 96vh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .drawer-shell {
    max-height: 96vh;
  }

  .drawer-header,
  .drawer-tabs,
  .drawer-panels {
    padding-right: 16px;
    padding-left: 16px;
  }

  .key-value-list {
    grid-template-columns: 1fr;
  }

  .key-value-list dt {
    padding-bottom: 2px;
    border-bottom: 0;
  }

  .key-value-list dd {
    padding-top: 0;
  }

  .history-event {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .cockpit-footer {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
