:root {
  --bg: #070b11;
  --panel: #0d141d;
  --panel-2: #111b26;
  --line: #243244;
  --line-soft: #182431;
  --text: #edf4f4;
  --muted: #9aabb7;
  --mint: #7be0c3;
  --mint-bright: #adf5df;
  --mint-dim: rgba(123, 224, 195, 0.12);
  --blue: #74aee8;
  --danger: #ff9f9f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 72% -8%, rgba(52, 116, 120, 0.18), transparent 31rem), var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .8rem 1rem; background: var(--mint); color: #04110d; border-radius: .4rem; font-weight: 800; }
.skip-link:focus { top: 1rem; }

.site-header { position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; min-height: 70px; padding: .85rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid rgba(123, 224, 195, 0.13); background: rgba(7, 11, 17, 0.89); backdrop-filter: blur(16px); }
.brand { color: var(--text); text-decoration: none; text-transform: uppercase; letter-spacing: .13em; font-size: .76rem; font-weight: 850; }
.brand::before { content: ""; display: inline-block; width: .58rem; height: .58rem; margin-right: .65rem; border: 2px solid var(--mint); transform: rotate(45deg); }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.search-box { display: flex; align-items: center; width: min(27vw, 320px); border: 1px solid var(--line); border-radius: .48rem; background: #0a1119; }
.search-box:focus-within { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-dim); }
.search-box input { width: 100%; border: 0; outline: 0; padding: .65rem .8rem; background: transparent; color: var(--text); }
kbd { margin-right: .55rem; padding: .08rem .4rem; border: 1px solid var(--line); border-radius: .3rem; color: var(--muted); font-size: .72rem; }
.source-link { padding: .62rem .8rem; border: 1px solid var(--line); border-radius: .48rem; color: var(--muted); text-decoration: none; font-size: .82rem; font-weight: 700; }
.source-link:hover { color: var(--mint); border-color: var(--mint); }

main { width: min(1540px, 100%); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 4rem) 5rem; }
.hero { min-height: 545px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); align-items: center; gap: clamp(3rem, 7vw, 8rem); padding: 5rem 0 4.5rem; border-bottom: 1px solid var(--line-soft); }
.eyebrow { margin: 0 0 1rem; color: #87a0ad; font-size: .71rem; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.eyebrow.mint { color: var(--mint); }
.hero h1 { margin: 0; max-width: 880px; font-size: clamp(3rem, 6vw, 6.6rem); line-height: .94; letter-spacing: -.055em; }
.hero h1 span { color: transparent; -webkit-text-stroke: 1.5px var(--mint); }
.lede { max-width: 760px; margin: 2rem 0 0; color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.18rem); line-height: 1.72; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.primary, .secondary { border-radius: .45rem; padding: .85rem 1.1rem; cursor: pointer; font-weight: 800; }
.primary { border: 1px solid var(--mint); background: var(--mint); color: #04110d; }
.secondary { border: 1px solid var(--line); background: transparent; }
.secondary:hover { border-color: var(--mint); color: var(--mint); }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(16, 27, 38, .92), rgba(8, 14, 21, .92)); box-shadow: var(--shadow); }
.hero-stats div { min-height: 148px; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-stats div:nth-child(2n) { border-right: 0; }
.hero-stats div:nth-child(n+3) { border-bottom: 0; }
.hero-stats strong { color: var(--mint); font-size: 2.7rem; line-height: 1; }
.hero-stats span { margin-top: .65rem; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; }

.view-tabs { position: sticky; top: 69px; z-index: 20; display: flex; gap: .25rem; overflow-x: auto; padding: .7rem 0; border-bottom: 1px solid var(--line); background: rgba(7, 11, 17, .96); }
.view-tab { flex: 0 0 auto; border: 0; border-bottom: 2px solid transparent; padding: .75rem 1rem; background: transparent; color: var(--muted); cursor: pointer; font-size: .83rem; font-weight: 750; }
.view-tab:hover, .view-tab.active { color: var(--text); }
.view-tab.active { border-bottom-color: var(--mint); }
.view-tab span { display: inline-grid; min-width: 1.4rem; height: 1.4rem; place-items: center; margin-left: .35rem; border-radius: 99px; background: var(--mint-dim); color: var(--mint); font-size: .7rem; }
.view-panel { display: none; padding-top: 2.5rem; }
.view-panel.active { display: block; }
.section-intro { display: grid; grid-template-columns: 1fr minmax(300px, .8fr); gap: 3rem; align-items: end; margin-bottom: 2rem; }
.section-intro h2, .worksheet-header h2, .about h2 { margin: 0; font-size: clamp(2rem, 3vw, 3.7rem); line-height: 1.02; letter-spacing: -.04em; }
.section-intro > p, .worksheet-header p { margin: 0; color: var(--muted); line-height: 1.7; }

.explorer { display: grid; grid-template-columns: minmax(245px, .82fr) 28px minmax(280px, 1fr) minmax(330px, 1.05fr); gap: 1rem; align-items: start; }
.principle-column, .detail-panel { border: 1px solid var(--line); background: var(--panel); }
.principle-column { min-height: 660px; }
.column-heading { display: flex; gap: 1rem; align-items: center; min-height: 88px; padding: 1rem; border-bottom: 1px solid var(--line); }
.column-heading > span { display: grid; width: 2.1rem; height: 2.1rem; place-items: center; border: 1px solid var(--mint); border-radius: 99px; color: var(--mint); font-size: .72rem; font-weight: 800; }
.column-heading h3 { margin: 0; font-size: .95rem; }
.column-heading p { margin: .22rem 0 0; color: var(--muted); font-size: .76rem; }
.card-list { display: flex; flex-direction: column; gap: .5rem; max-height: 740px; overflow-y: auto; padding: .7rem; }
.principle-card { width: 100%; padding: 1rem; border: 1px solid var(--line-soft); border-radius: .38rem; background: #0a1119; text-align: left; cursor: pointer; transition: border-color .16s, background .16s, opacity .16s; }
.principle-card:hover { border-color: #4a6275; }
.principle-card.active { border-color: var(--mint); background: var(--mint-dim); }
.principle-card.dimmed { opacity: .36; }
.principle-card.dimmed:hover { opacity: .75; }
.card-type { color: var(--mint); font-size: .61rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.card-heading { display: flex; justify-content: space-between; gap: .8rem; align-items: start; margin-top: .35rem; }
.card-heading strong { font-size: .91rem; line-height: 1.27; }
.card-heading span { display: grid; flex: 0 0 auto; min-width: 1.35rem; height: 1.35rem; place-items: center; border-radius: 50%; background: #162433; color: var(--muted); font-size: .65rem; }
.principle-card p { margin: .55rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.flow { align-self: center; color: var(--mint); text-align: center; font-size: 1.4rem; }
.detail-panel { position: sticky; top: 142px; min-height: 600px; max-height: calc(100vh - 160px); overflow-y: auto; padding: 1.4rem; box-shadow: var(--shadow); }
.detail-topline { display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--mint); font-size: .67rem; letter-spacing: .1em; text-transform: uppercase; }
.bookmark { border: 1px solid var(--line); border-radius: .35rem; padding: .48rem .6rem; background: transparent; color: var(--muted); cursor: pointer; font-size: .69rem; letter-spacing: 0; text-transform: none; }
.bookmark.saved { border-color: var(--mint); color: var(--mint); background: var(--mint-dim); }
.detail-panel h2 { margin: 1.2rem 0; font-size: clamp(1.7rem, 2vw, 2.5rem); line-height: 1.06; letter-spacing: -.035em; }
.detail-summary { padding-left: 1rem; border-left: 2px solid var(--mint); color: #d5e3e4; line-height: 1.65; }
.detail-section { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 .7rem; color: var(--muted); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
.detail-section p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.65; }
.relationship-list { display: flex; flex-direction: column; gap: .4rem; }
.relationship-list button { display: flex; justify-content: space-between; gap: .6rem; width: 100%; padding: .64rem .7rem; border: 1px solid var(--line-soft); border-radius: .3rem; background: #0a1119; cursor: pointer; color: #cfdbde; text-align: left; font-size: .78rem; }
.relationship-list button:hover { border-color: var(--mint); }
.relationship-list span { color: var(--mint); }
.source-button { display: flex; justify-content: space-between; gap: 1rem; padding: .78rem; border: 1px solid var(--line); border-radius: .32rem; color: #c4d2d5; text-decoration: none; font-size: .76rem; }
.source-button strong { color: var(--mint); }
.source-button:hover { border-color: var(--mint); }
.empty { margin: 1rem; color: var(--muted); font-size: .82rem; line-height: 1.5; }

.matrix-card { border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.matrix-legend { display: flex; gap: 1.5rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.matrix-legend b { color: var(--mint); }
.table-scroll { max-height: 68vh; overflow: auto; }
table { width: 100%; min-width: 940px; border-collapse: collapse; font-size: .75rem; }
th, td { min-width: 96px; padding: .78rem .55rem; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); text-align: center; }
th:first-child { position: sticky; left: 0; z-index: 2; min-width: 250px; background: #0b131c; text-align: left; }
thead th { position: sticky; top: 0; z-index: 3; background: #0b131c; vertical-align: bottom; }
thead th:first-child { z-index: 4; }
th button { border: 0; padding: .2rem; background: transparent; color: #d8e3e5; cursor: pointer; font-size: .73rem; font-weight: 750; line-height: 1.3; text-align: inherit; }
th button:hover { color: var(--mint); }
td .mark { color: var(--mint); font-size: .9rem; }
td { color: #526474; }

.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.guide-card { min-height: 330px; padding: 1.4rem; border: 1px solid var(--line); background: linear-gradient(145deg, var(--panel-2), var(--panel)); }
.guide-card > span { color: var(--mint); font-size: .75rem; font-weight: 850; }
.guide-card h3 { margin: 1rem 0 .3rem; font-size: 1.35rem; }
.guide-source { margin: 0; color: #75909d; font-size: .72rem; }
.guide-card ul { margin: 1.3rem 0 0; padding-left: 1.15rem; color: var(--muted); }
.guide-card li { margin: .75rem 0; line-height: 1.5; }
.guide-card li::marker { color: var(--mint); }
.callout { margin-top: 1rem; padding: 1.2rem 1.4rem; border: 1px solid rgba(123, 224, 195, .35); background: var(--mint-dim); color: #cadbdc; line-height: 1.6; }
.callout strong { color: var(--mint); }

.worksheet-header { display: flex; justify-content: space-between; gap: 3rem; align-items: end; margin-bottom: 1.5rem; }
.worksheet-header p { margin-top: .8rem; }
.worksheet-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.worksheet-actions button { padding: .65rem .85rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--panel); cursor: pointer; font-size: .78rem; font-weight: 750; }
.worksheet-actions button:hover { border-color: var(--mint); color: var(--mint); }
.worksheet-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 1rem; border: 1px solid var(--line); background: var(--panel); }
.worksheet-summary div { display: flex; flex-direction: column; padding: 1rem 1.2rem; border-right: 1px solid var(--line); }
.worksheet-summary div:last-child { border-right: 0; }
.worksheet-summary strong { color: var(--mint); font-size: 1.65rem; }
.worksheet-summary span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.worksheet-list { display: flex; flex-direction: column; gap: .75rem; }
.worksheet-item { padding: 1.2rem; border: 1px solid var(--line); background: var(--panel); }
.worksheet-item-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.worksheet-item-heading span { color: var(--mint); font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; }
.worksheet-item-heading h3 { margin: .35rem 0 0; }
.remove-item { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: .75rem; }
.worksheet-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.worksheet-fields label { display: flex; flex-direction: column; gap: .35rem; color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.worksheet-fields input, .worksheet-fields select, .worksheet-fields textarea { width: 100%; border: 1px solid var(--line); border-radius: .3rem; padding: .65rem; outline: 0; background: #091019; color: var(--text); font-size: .82rem; text-transform: none; letter-spacing: 0; }
.worksheet-fields textarea { min-height: 96px; resize: vertical; }
.worksheet-fields input:focus, .worksheet-fields select:focus, .worksheet-fields textarea:focus { border-color: var(--mint); }
.empty.large { display: flex; flex-direction: column; gap: .4rem; padding: 4rem; border: 1px dashed var(--line); text-align: center; }

.about-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 4rem; }
.about ol { display: flex; flex-direction: column; gap: .8rem; margin: 0; padding: 0; list-style: none; }
.about li { display: grid; grid-template-columns: 54px 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.about li > span { color: var(--mint); font-weight: 800; }
.about h3 { margin: 0; font-size: 1rem; }
.about li p { margin: .35rem 0 0; color: var(--muted); line-height: 1.6; }
.source-note { margin-top: 2rem; padding: 1.5rem; border: 1px solid var(--line); background: var(--panel); }
.source-note h3 { margin: 0; }
.source-note p { color: var(--muted); line-height: 1.7; }
.source-note a { color: var(--mint); font-weight: 750; }

footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 1.5rem; padding: 1.5rem; border-top: 1px solid var(--line); color: #748994; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }

@media (max-width: 1180px) {
  .explorer { grid-template-columns: minmax(240px, .85fr) minmax(280px, 1fr) minmax(330px, 1fr); }
  .flow { display: none; }
}

@media (max-width: 920px) {
  .site-header { position: static; align-items: flex-start; }
  .header-actions { flex-direction: column; align-items: stretch; }
  .search-box { width: 100%; }
  .view-tabs { top: 0; }
  .hero { grid-template-columns: 1fr; gap: 3rem; }
  .hero-stats { max-width: 620px; }
  .section-intro { grid-template-columns: 1fr; gap: 1rem; }
  .explorer { grid-template-columns: 1fr 1fr; }
  .detail-panel { position: static; grid-column: 1 / -1; max-height: none; }
  .guide-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
}

@media (max-width: 620px) {
  .site-header { flex-direction: column; }
  .header-actions { width: 100%; }
  .source-link { text-align: center; }
  main { padding-inline: .8rem; }
  .hero { min-height: auto; padding: 3rem 0; }
  .hero h1 { font-size: clamp(2.7rem, 14vw, 4.2rem); }
  .hero-stats div { min-height: 110px; padding: 1rem; }
  .hero-stats strong { font-size: 2rem; }
  .view-tabs { margin-inline: -.8rem; padding-inline: .8rem; }
  .explorer { grid-template-columns: 1fr; }
  .principle-column { min-height: auto; }
  .card-list { max-height: 500px; }
  .worksheet-header { align-items: start; flex-direction: column; gap: 1rem; }
  .worksheet-summary { grid-template-columns: 1fr 1fr; }
  .worksheet-summary div:nth-child(2) { border-right: 0; }
  .worksheet-summary div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .worksheet-fields { grid-template-columns: 1fr; }
  .matrix-legend { align-items: flex-start; flex-direction: column; gap: .5rem; }
}

@media print {
  .site-header, .hero, .view-tabs, .worksheet-actions, footer { display: none !important; }
  body, main { background: white; color: black; }
  main { width: 100%; padding: 0; }
  .view-panel { display: none !important; }
  #worksheet-view { display: block !important; padding: 0; }
  .worksheet-item, .worksheet-summary { break-inside: avoid; border-color: #aaa; background: white; }
  .worksheet-item-heading span, .worksheet-summary strong { color: #155d50; }
  .worksheet-fields input, .worksheet-fields select, .worksheet-fields textarea { border-color: #bbb; background: white; color: black; }
}
