:root {
  color-scheme: dark;
  --ink: #eff5ff;
  --muted: #a8b8cf;
  --canvas: #07111f;
  --panel: #0d1c2e;
  --panel-strong: #10263c;
  --line: rgba(191, 215, 245, 0.17);
  --a: #79a8ff;
  --b: #4ed6b1;
  --warn: #ffc969;
  --error: #ff8e9c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
body { min-width: 320px; margin: 0; color: var(--ink); background: radial-gradient(circle at 16% -10%, #15355a 0, transparent 31rem), radial-gradient(circle at 90% 8%, #0c463d 0, transparent 30rem), var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #c9dbff; outline-offset: 3px; }
a { color: inherit; }
.shell { width: min(1200px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(3rem, 8vw, 7rem) 0 5rem; }
.hero { max-width: 840px; margin: 0 0 3.25rem; }
.eyebrow, .section-kicker { margin: 0 0 .65rem; color: var(--b); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { max-width: 770px; margin: 0; font-size: clamp(2.6rem, 7vw, 5.65rem); line-height: .98; letter-spacing: -.065em; }
h1 em { color: var(--b); font-family: Georgia, serif; font-weight: 500; }
.hero-copy { max-width: 660px; margin: 1.5rem 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.7; }
.membership { margin-top: 1.4rem; padding: .8rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(7,20,33,.65); }
.member-form, .member-active { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.member-form label { color: var(--muted); font-size: .75rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.member-form input { width: min(300px, 100%); }
.demo-badge { padding: .3rem .5rem; border: 1px solid rgba(255,194,92,.4); border-radius: 999px; color: #ffd691; font-size: .62rem; font-weight: 850; letter-spacing: .07em; }
.workspace, .results { padding: clamp(1.1rem, 3vw, 2.15rem); border: 1px solid var(--line); border-radius: 24px; background: rgba(9, 25, 43, .88); box-shadow: 0 25px 70px rgba(0, 0, 0, .2); }
.workspace-header, .results-header, .form-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.workspace-header { margin-bottom: 1.35rem; }
h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 2.2rem); letter-spacing: -.035em; }
.text-button { padding: .2rem 0; border: 0; color: var(--muted); background: transparent; font-size: .78rem; text-decoration: underline; text-underline-offset: .23em; }
.text-button:hover { color: var(--ink); }
.url-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.url-card { position: relative; display: grid; gap: .55rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: 18px; background: rgba(17, 39, 62, .68); }
.url-card-a { border-top: 3px solid var(--a); }
.url-card-b { border-top: 3px solid var(--b); }
.source-letter { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; color: #07111f; background: var(--a); font-size: .8rem; font-weight: 900; }
.url-card-b .source-letter { background: var(--b); }
.field-label { font-weight: 750; }
input { width: 100%; padding: .85rem .9rem; border: 1px solid rgba(191, 215, 245, .3); border-radius: 9px; color: var(--ink); background: #071421; }
input::placeholder { color: #7188a7; }
.field-hint { min-height: 2.3em; color: var(--muted); font-size: .73rem; line-height: 1.45; }
.extract-button, .secondary-button { padding: .62rem .78rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.04); font-size: .78rem; font-weight: 700; }
.extract-button:hover, .secondary-button:hover { border-color: rgba(205, 225, 255, .58); background: rgba(255,255,255,.08); }
.swap-button { position: absolute; z-index: 1; top: 50%; left: 50%; width: 2.35rem; height: 2.35rem; transform: translate(-50%, -50%); border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #162c45; font-size: 1.15rem; }
.swap-button:hover { background: #234263; }
.form-footer { align-items: end; margin-top: 1rem; }
.privacy-note { max-width: 620px; margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.55; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.7rem; padding: .75rem 1rem; border: 1px solid transparent; border-radius: 9px; color: #03130e; background: var(--b); font-weight: 850; white-space: nowrap; }
.primary-button:hover { background: #7ce9ca; }
.status-panel { margin: 1.25rem 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--muted); font-size: .9rem; }
.status-success { border-color: rgba(78, 214, 177, .5); color: #c5f9eb; }
.status-error { border-color: rgba(255, 142, 156, .5); color: #ffd3d9; }
.results { margin-top: 1.25rem; }
.export-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .5rem; }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: .7rem; margin: 1.65rem 0 1.2rem; }
.metric { min-width: 0; padding: .9rem; border: 1px solid var(--line); border-radius: 13px; background: rgba(6, 19, 33, .58); }
.metric-label, .metric small { display: block; color: var(--muted); font-size: .65rem; line-height: 1.4; }
.metric strong { display: block; margin: .22rem 0; font-size: 1.25rem; letter-spacing: -.04em; }
.tabs { display: flex; gap: .35rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tab { padding: .7rem .85rem; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: .8rem; font-weight: 750; }
.tab.is-active { border-bottom-color: var(--b); color: var(--ink); }
.analysis-note { margin-bottom: 1rem; padding: .8rem .9rem; border-left: 3px solid var(--warn); color: #f7deb1; background: rgba(255, 201, 105, .08); font-size: .78rem; line-height: 1.5; }
.change-list { display: grid; gap: .8rem; }
.change-block { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: rgba(6, 19, 33, .54); }
.change-title { margin: 0; padding: .7rem .9rem; border-bottom: 1px solid var(--line); font-size: .78rem; letter-spacing: .02em; }
.change-added .change-title { color: var(--b); }
.change-removed .change-title { color: #ffb1bc; }
.change-changed .change-title { color: #b7ccf9; }
.change-columns, .source-cards, .term-deltas { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.change-column { min-width: 0; padding: .85rem .9rem; background: #0b1b2e; }
.change-column p { margin: .55rem 0 0; color: #d6e2f3; font-size: .83rem; line-height: 1.6; white-space: pre-wrap; }
.change-source { display: inline-grid; width: 1.35rem; height: 1.35rem; place-items: center; border-radius: 50%; color: #06111e; background: var(--a); font-size: .68rem; font-weight: 900; }
.from-b .change-source { background: var(--b); }
.source-cards { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.source-card { min-width: 0; padding: 1rem; background: #0b1b2e; }
.source-card-header { display: flex; align-items: start; gap: .6rem; }
.source-card h3 { margin: .05rem 0 0; font-size: 1rem; line-height: 1.3; }
.source-badge { display: grid; flex: none; width: 1.55rem; height: 1.55rem; place-items: center; border-radius: 50%; color: #06111e; background: var(--a); font-size: .7rem; font-weight: 900; }
.source-b .source-badge { background: var(--b); }
.source-link { display: inline-block; max-width: 100%; margin-top: .75rem; color: #b9d0fc; font-size: .75rem; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.source-description { margin: .7rem 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.source-meta { display: flex; flex-wrap: wrap; gap: .35rem .7rem; padding: 0; color: var(--muted); font-size: .68rem; list-style: none; }
.source-meta li::before { content: "· "; color: var(--b); }
.source-text { max-height: 34rem; margin: .9rem 0; padding: .8rem; overflow: auto; border: 1px solid var(--line); border-radius: 8px; color: #dce8f8; background: #071421; font: .75rem/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.source-tools { display: flex; justify-content: end; }
.term-deltas { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.term-column { min-width: 0; padding: 1rem; background: #0b1b2e; }
.term-column h3 { margin: 0 0 .7rem; font-size: .88rem; }
.term-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.term-list li { display: flex; justify-content: space-between; gap: .7rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.term-list span { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.empty-state { color: var(--muted); font-size: .85rem; line-height: 1.55; }
.spinner { width: .9rem; height: .9rem; border: 2px solid rgba(3,19,14,.35); border-top-color: #03130e; border-radius: 50%; animation: spin .7s linear infinite; }
.noscript { width: min(900px, calc(100% - 2rem)); margin: 1rem auto; color: #ffd3d9; }
.kg-config { display: grid; grid-template-columns: minmax(220px,.75fr) 1.25fr; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(6,19,33,.58); }
.kg-config h3 { margin: .2rem 0 .6rem; }
.kg-config-fields { display: grid; gap: .65rem; }
.kg-config-fields label { display: grid; gap: .3rem; color: var(--muted); font-size: .68rem; }
.kg-actions { display: flex; justify-content: end; gap: .5rem; margin: .8rem 0; }
.kg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.kg-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #071421; }
.kg-card-combined { grid-column: 1 / -1; }
.kg-card-combined .kg-canvas-wrap { height: 560px; }
.kg-card-combined > header { background: linear-gradient(90deg, rgba(58,130,246,.12), rgba(52,211,153,.1)); }
.kg-card > header { display: flex; align-items: center; gap: .55rem; padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
.kg-meta { flex: 1; min-width: 0; color: var(--muted); font-size: .65rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kg-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; padding: .55rem .65rem; color: var(--muted); font-size: .65rem; }
.kg-tools input[type="search"] { flex: 1 1 150px; padding: .5rem; }
.kg-tools label { display: flex; align-items: center; gap: .2rem; }
.kg-canvas-wrap { position: relative; height: 430px; background: radial-gradient(circle at 50% 40%, #142c44, #06111e 70%); }
.kg-canvas-wrap canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.kg-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 1rem; color: var(--muted); text-align: center; pointer-events: none; }
.kg-detail { min-height: 92px; max-height: 170px; overflow: auto; padding: .75rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; line-height: 1.55; }
.kg-detail strong { color: var(--ink); }
.kg-detail ul { margin: .45rem 0 0; padding-left: 1.1rem; }
.kg-card.is-expanded { position: fixed; z-index: 20; inset: 1rem; display: grid; grid-template-rows: auto auto 1fr auto; box-shadow: 0 1rem 4rem #000; }
.kg-card.is-expanded .kg-canvas-wrap { height: auto; min-height: 50vh; }
.kg-grid:has(.kg-card.is-expanded)::before { content: ""; position: fixed; z-index: 19; inset: 0; background: rgba(0,0,0,.72); }
@keyframes spin { to { transform: rotate(1turn); } }
@media (max-width: 860px) { .metrics { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) {
  .shell { width: min(100% - 1rem, 1200px); padding-top: 2.5rem; }
  .workspace, .results { border-radius: 17px; }
  .url-grid, .change-columns, .source-cards, .term-deltas { grid-template-columns: 1fr; }
  .swap-button { top: 50%; left: auto; right: .65rem; transform: translateY(-50%) rotate(90deg); }
  .form-footer, .results-header { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .export-actions { justify-content: stretch; }
  .secondary-button { flex: 1; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .kg-config, .kg-grid { grid-template-columns: 1fr; }
  .kg-card-combined { grid-column: 1; }
  .kg-canvas-wrap { height: 360px; }
  .kg-card-combined .kg-canvas-wrap { height: 430px; }
  .kg-actions { display: grid; grid-template-columns: 1fr; }
}

.site-footer {
  max-width: 1200px;
  margin: 1.5rem auto 2rem;
  padding: 0 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted, #a8b8cf);
}
.site-footer nav { display: inline-flex; gap: 0.6rem; align-items: center; }
.site-footer a { color: var(--a, #79a8ff); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
