/* kg.css — AIDC 智能体网络 hero (v4). Everything here is namespaced kg-*.
   Ink on paper: the chrome tokens paint the ground; the network never paints its own. */

:root {
  --kg-ease: cubic-bezier(.2, .8, .2, 1);
  --kg-sheet-w: min(440px, 38vw);
  --kg-shadow: 0 1px 1px color-mix(in srgb, var(--ink-strong) 4%, transparent),
               0 12px 28px -10px color-mix(in srgb, var(--ink-strong) 14%, transparent),
               0 32px 56px -20px color-mix(in srgb, var(--ink-strong) 16%, transparent);
}

/* ---------- stage ---------- */
.hero.kg-hero { display: block; min-height: 0; height: 150vh; overflow: visible; align-items: unset; }
.kg-sticky {
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
  display: flex; align-items: center;
}
body.kg-open .kg-sticky { z-index: 3; }
.kg-stage { position: absolute; inset: 0; z-index: 1; }
.kg-stage canvas { display: block; width: 100%; height: 100%; }
#labels { position: absolute; inset: 0; pointer-events: none; }
.kg-sticky .grid-bg { z-index: 0; }

/* ---------- type column (production copy, verbatim styling) ---------- */
.kg-copy { position: relative; z-index: 2; width: 100%; max-width: var(--w-max); margin: 0 auto; pointer-events: none; transition: opacity .3s var(--kg-ease); display: flex; justify-content: flex-end; }
.kg-text { width: 42%; max-width: 540px; min-width: 400px; }
.kg-copy h1 { font-size: clamp(1.9rem, 3.4vw, 3.05rem); line-height: 1.12; letter-spacing: -0.03em; white-space: nowrap; }
.kg-copy h1 .zh { display: block; font-size: .82em; font-weight: 700; margin-top: .22em; letter-spacing: 0; white-space: normal; }
.kg-copy .lede { max-width: 500px; font-size: 1.08rem; margin-top: 1.3rem; }
/* the brand slashes: the site's own hero glyph, kept as a quiet watermark at the right edge; it recedes on the plateau and behind the sheet */
.kg-sticky .hero-glyph { right: var(--pad-x); z-index: 0; opacity: .42; gap: clamp(20px, 2.2vw, 32px); transition: opacity .45s var(--kg-ease); }
.kg-sticky .hero-glyph i { width: clamp(38px, 4.4vw, 64px); height: clamp(160px, 21vw, 300px); }
.cta-band .hero-glyph { right: var(--pad-x); z-index: 0; opacity: .42; gap: clamp(20px, 2.2vw, 32px); }
.cta-band .hero-glyph i { width: clamp(38px, 4.4vw, 64px); height: clamp(160px, 21vw, 300px); }
body.kg-plateau .kg-sticky .hero-glyph, body.kg-open .kg-sticky .hero-glyph { opacity: .1; }
/* only interactive leaves take the pointer — the column's boxes span the whole wrap and must never shadow the plate */
.kg-copy > *, .kg-below > * { pointer-events: none; }
.kg-copy a, .kg-copy button, .kg-roster.show, .kg-hud.show { pointer-events: auto; }
.kg-copy .lede, .kg-copy .btn-row, .kg-status, .kg-hint { will-change: opacity, transform; }
body.kg-open .kg-copy { opacity: .07; }
body.kg-open .kg-copy a, body.kg-open .kg-copy button, body.kg-open .kg-roster, body.kg-open .kg-hud { pointer-events: none; }
.kg-status {
  margin-top: 1.6rem;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--mut-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
}
@media (max-width: 900px) { .kg-status { font-size: .62rem; letter-spacing: .1em; } }
.kg-status b { color: var(--ink-strong); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.kg-status b::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-strong); animation: kg-breathe 2.4s ease-in-out infinite; }
.kg-hint {
  margin-top: .55rem; font-size: .8rem; color: var(--mut);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: none; border: 0; padding: 0; font-family: inherit;
  transition: color .18s;
}
.kg-hint .arr { font-family: var(--font-mono); transition: transform .18s; }
.kg-hint:hover { color: var(--ink-strong); }
.kg-hint:hover .arr { transform: translateX(4px); }
.kg-hint b { font-weight: 600; color: var(--ink); }

/* roster index — takes the lede/CTA's place once the reader scrolls */
.kg-below { position: relative; }
.kg-roster { position: absolute; left: 0; right: 0; top: 0; opacity: 0; pointer-events: none; }
.kg-roster.show { pointer-events: auto; }
.kg-roster-row { display: flex; align-items: baseline; gap: 14px; padding: 4px 0; max-width: 520px; border-top: 1px solid var(--line-soft); opacity: 0; transform: translateY(6px); transition: opacity .32s var(--kg-ease), transform .32s var(--kg-ease); }
.kg-roster.show .kg-roster-row { opacity: 1; transform: none; }
.kg-roster-row .dp { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .16em; color: var(--mut-2); min-width: 92px; text-transform: uppercase; cursor: pointer; }
.kg-roster-row .dp:hover { color: var(--ink-strong); }
.kg-roster-row .nm { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.kg-roster-row .nm button { font: 500 .8rem/1.5 var(--font-display); color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: 0; transition: color .15s; }
.kg-roster-row .nm button:hover, .kg-roster-row .nm button.on { color: var(--ink-strong); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

/* ---------- agent labels ---------- */
.kg-lab {
  --mk: 5px; --ld: 10px; --op: 1; --lens: 1;
  position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible;   /* a real (1px) box: focus/scrollIntoView never try to "reveal" a 0×0 anchor */
  background: none; border: 0; padding: 0; margin: 0; pointer-events: none;
  opacity: calc(var(--op) * var(--lens));
  transition: opacity .25s var(--kg-ease);
  will-change: transform;
}
.kg-lab.lead { --mk: 6px; }
.kg-lab { --dy: 0px; --ldw: var(--ld); --lda: 0deg; }
.kg-lab .ld { position: absolute; top: 0; height: 1px; width: var(--ldw); background: var(--mut-2); transition: width .15s var(--kg-ease), opacity .18s var(--kg-ease); }
.kg-lab.r .ld { left: var(--mk); transform-origin: 0 50%; transform: rotate(var(--lda)); }
.kg-lab.l .ld { right: var(--mk); transform-origin: 100% 50%; transform: rotate(calc(-1 * var(--lda))); }
.kg-lab .tx {
  position: absolute; top: var(--dy); transform: translateY(calc(-50% + 3px));
  display: flex; flex-direction: column; align-items: flex-start;
  pointer-events: none; cursor: pointer; white-space: nowrap;
  padding: 4px 6px; margin: 0; border-radius: 4px;
  opacity: 0; transition: opacity .18s var(--kg-ease), transform .22s var(--kg-ease);
}
/* at rest an agent is only a point; the name surfaces on hover, focus, as a collaborator, or when a signal arrives */
.kg-lab.hov .tx, .kg-lab.on .tx, .kg-lab.rel .tx, .kg-lab.flash .tx, .kg-lab.trail .tx { opacity: 1; pointer-events: auto; transform: translateY(-50%); }
.kg-lab .ld { opacity: 0 !important; }
.kg-lab.hov .ld, .kg-lab.on .ld, .kg-lab.rel .ld, .kg-lab.flash .ld, .kg-lab.trail .ld { opacity: 1 !important; }
.kg-lab.r .tx { left: calc(var(--mk) + var(--ld)); }
.kg-lab.l .tx { right: calc(var(--mk) + var(--ld)); align-items: flex-end; text-align: right; }
.kg-lab .nm { font: 500 12.5px/1.2 var(--font-display); color: var(--ink); letter-spacing: 0; transition: color .12s var(--kg-ease); }
.kg-lab .en { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; color: var(--mut-2); margin-top: 2px; transition: opacity .12s; display: none; }
.kg-lab.hov .en, .kg-lab.on .en { display: block; }
.kg-lab .tg {
  font-size: 11.5px; line-height: 1.4; color: var(--mut); width: max-content; max-width: var(--tgw, 220px); white-space: normal; margin-top: 3px;
  display: none; animation: kg-in .16s var(--kg-ease);
}
.kg-lab.l .tg { text-align: right; }
.kg-lab.hov .nm, .kg-lab.on .nm, .kg-lab.rel .nm, .kg-lab.flash .nm { color: var(--ink-strong); }
.kg-lab.on .nm { font-weight: 600; }
.kg-lab.on .tg { display: block; }
.kg-lab.hov .tx, .kg-lab.on .tx { background: var(--bg); box-shadow: 0 0 0 4px var(--bg); border-radius: 4px; z-index: 1; }
.kg-lab.hov .ld, .kg-lab.on .ld { opacity: 1; background: var(--ink-strong); }
.kg-lab.on .ld { background: var(--signal); }
.kg-lab.far .ld { opacity: .35 !important; }
.kg-lab.lens-out { --lens: .4; }
.kg-lab.dot .tx { opacity: 0; pointer-events: none; }
.kg-lab.dot .ld { width: 5px; }
.kg-lab:focus-visible .tx { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus, #006bff); }
.kg-lab.flash .nm { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--signal); }
.kg-lab.trail .nm { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

.kg-ripple {
  position: absolute; left: -8px; top: -8px; width: 16px; height: 16px;
  border: 1px solid var(--signal); border-radius: 50%; pointer-events: none;
  animation: kg-ripple .48s ease-out forwards;
}
@keyframes kg-ripple { from { transform: translate3d(var(--x, 0), var(--y, 0), 0) scale(1); opacity: .6; } to { transform: translate3d(var(--x, 0), var(--y, 0), 0) scale(3.2); opacity: 0; } }
@keyframes kg-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* department captions */
.kg-cap {
  position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none;
  transition: opacity .3s var(--kg-ease);
}
.kg-cap > * { pointer-events: inherit; }
.kg-cap .en, .kg-cap .zh, .kg-cap .n { position: absolute; top: 0; transform: translateY(-50%); white-space: nowrap; }
.kg-cap { opacity: .75; }
.kg-cap .en { font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; color: var(--mut-2); left: 50%; transform: translate(-50%, -50%); top: -8px; cursor: pointer; }
.kg-cap .zh { font: 500 11px/1 var(--font-display); color: var(--mut); left: 50%; transform: translate(-50%, -50%); top: 8px; cursor: pointer; }
.kg-cap .n { display: none; }
.kg-cap.lens-on .zh, .kg-cap:hover .zh { color: var(--ink-strong); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

/* scene chips (satellites of the hovered / focused agent) */
.kg-scene {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; z-index: 40;
  font: 500 11px/1 var(--font-display); color: var(--ink); letter-spacing: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px;
  white-space: nowrap; cursor: pointer; opacity: 0; transition: opacity .16s var(--kg-ease), border-color .15s, color .15s;
  margin-top: -11px;
}
.kg-scene.r { margin-left: 9px; }
.kg-scene.l { translate: -100% 0; margin-left: -9px; }
.kg-scene:hover { border-color: var(--ink-strong); color: var(--ink-strong); }

/* ---------- collaboration HUD (bottom-left) ---------- */
.kg-hud {
  position: absolute; z-index: 3; left: 0; top: var(--kg-hud-top, calc(1.4rem + 168px)); width: 360px; max-width: 100%;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .32s var(--kg-ease), transform .32s var(--kg-ease);
}
.kg-hud.show { opacity: 1; transform: none; pointer-events: auto; }
.kg-hud.dim { opacity: .45; }
.kg-hud-cap { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; color: var(--mut-2); text-transform: uppercase; }
.kg-hud-cap .ttl { color: var(--ink); letter-spacing: .04em; text-transform: none; font: 500 12px/1 var(--font-display); }
.kg-hud-ctl { display: flex; align-items: center; gap: 2px; }
.kg-hud-ctl button { font-family: var(--font-mono); font-size: 11px; color: var(--mut-2); background: none; border: 0; padding: 2px 5px; cursor: pointer; border-radius: 4px; transition: color .15s; }
.kg-hud-ctl button:hover { color: var(--ink-strong); }
.kg-dots { display: flex; gap: 5px; margin-left: 6px; }
.kg-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--line); cursor: pointer; transition: background .2s; }
.kg-dots i.on { background: var(--ink-strong); }
.kg-hud-trg { font-size: 12.5px; color: var(--mut); margin: 8px 0 8px; line-height: 1.45; }
.kg-steps { display: flex; flex-direction: column; gap: 0; }
.kg-step { position: relative; padding: 3px 0 3px 12px; border-left: 2px solid transparent; opacity: .45; transition: opacity .25s var(--kg-ease), border-color .25s; cursor: pointer; }
.kg-step .ln { display: flex; align-items: baseline; gap: 6px; font-size: 13px; line-height: 1.3; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-step .ln > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.kg-step .ar-t { display: none; }
.kg-step.on .ar-t { display: block; }
.kg-step .ln b { font-weight: 500; color: var(--ink); }
.kg-step .ln .ar { font-family: var(--font-mono); color: var(--mut-2); font-size: 11px; }
.kg-step .ar-t { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .02em; color: var(--mut-2); margin-top: 2px; line-height: 1.4; }
.kg-step.done { opacity: .75; border-left-color: var(--line); }
.kg-step.on { opacity: 1; border-left-color: var(--signal); }
.kg-step.on .ln b { color: var(--ink-strong); font-weight: 600; }
.kg-rail { position: relative; height: 2px; background: var(--line-soft); margin-top: 10px; border-radius: 1px; overflow: hidden; }
.kg-rail i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); background: var(--ink-strong); transition: width .12s linear; }
.kg-hud-out { font: 500 12.5px/1.45 var(--font-display); color: var(--ink-strong); margin-top: 8px; min-height: 18px; }
.kg-hud.compact .kg-hud-trg, .kg-hud.compact .kg-step:not(.on) { display: none; }

/* ---------- ticker (bottom-right, one line) ---------- */
.kg-ticker {
  position: absolute; z-index: 3; right: var(--pad-x); bottom: 26px; width: 300px; height: 20px;
  opacity: 0; transition: opacity .4s var(--kg-ease); pointer-events: none;
}
.kg-ticker.show { opacity: 1; pointer-events: auto; }
.kg-ticker .tl {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  font-size: 12px; color: var(--mut); white-space: nowrap; cursor: pointer;
  opacity: 0; transform: translateY(4px); transition: opacity .24s var(--kg-ease), transform .24s var(--kg-ease);
}
.kg-ticker .tl.on { opacity: 1; transform: none; }
.kg-ticker .tl b { font-weight: 500; color: var(--ink); }
.kg-ticker .tl .mk { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-strong); flex: none; }
.kg-ticker .tl .ago { font-family: var(--font-mono); font-size: 10px; color: var(--mut-2); letter-spacing: .06em; }
.kg-ticker .tl:hover b { color: var(--ink-strong); }

/* ---------- the agent sheet ---------- */
.kg-sheet {
  outline: none;
  position: absolute; z-index: 5; right: 24px; top: 24px; bottom: 24px; width: var(--kg-sheet-w);
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md, 12px);
  box-shadow: var(--kg-shadow);
  opacity: 0; visibility: hidden; transform: translateX(24px);
  transition: opacity .2s ease-in, transform .2s ease-in, visibility .2s;
}
html[data-theme="dark"] .kg-sheet { background: #0b0b0b; }
.kg-sheet:focus, .kg-sheet:focus-visible { outline: none; box-shadow: var(--kg-shadow); }
.kg-sheet.show { opacity: 1; visibility: visible; transform: none; transition: opacity .32s var(--kg-ease), transform .32s var(--kg-ease), visibility 0s; }
.kg-sh { flex: none; padding: 18px 20px 0; border-bottom: 1px solid var(--line-soft); }
.kg-sh-top { display: flex; align-items: flex-start; gap: 12px; }
.kg-mark { width: 40px; height: 40px; object-fit: contain; flex: none; margin-top: 0; }
.kg-mark.lead { width: 40px; height: 40px; margin-top: 0; }
.kg-sheet.streaming .kg-mark { animation: kg-breathe 1s ease-in-out infinite; }
.kg-sh-ttl { flex: 1; min-width: 0; }
.kg-sh-ttl .nm { font: 700 22px/1.15 var(--font-display); letter-spacing: -.02em; color: var(--ink-strong); }
.kg-sh-ttl .en { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: var(--mut-2); margin-top: 3px; }
.kg-sh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--mut); }
.kg-sh-meta .lv { border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; font-size: 10px; letter-spacing: .1em; color: var(--mut-2); }
.kg-sh-meta .st { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.kg-sh-meta .st::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-strong); animation: kg-breathe 2.4s ease-in-out infinite; }
.kg-close {
  flex: none; width: 32px; height: 32px; margin: -6px -8px 0 0; border: 0; background: none; border-radius: 6px; cursor: pointer;
  color: var(--mut-2); font-family: var(--font-mono); font-size: 14px; line-height: 1; transition: color .15s, background .15s;
}
.kg-close:hover { color: var(--ink-strong); background: var(--bg-2); }
.kg-crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 0; }
.kg-crumbs:empty { display: none; }
.kg-crumbs button { font: 500 11px/1 var(--font-display); color: var(--mut); background: none; border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px 8px; cursor: pointer; transition: color .15s, border-color .15s; }
.kg-crumbs button:hover { color: var(--ink-strong); border-color: var(--line); }
.kg-tabs { position: relative; display: flex; gap: 22px; margin-top: 12px; }
.kg-tabs button { font: 500 12.5px/1 var(--font-display); color: var(--mut); background: none; border: 0; padding: 8px 0 10px; cursor: pointer; transition: color .15s; letter-spacing: 0; }
.kg-tabs button.on, .kg-tabs button:hover { color: var(--ink-strong); }
.kg-tabs .ul { position: absolute; bottom: -1px; height: 1px; background: var(--ink-strong); transition: left .18s var(--kg-ease), width .18s var(--kg-ease); }

.kg-sb { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 20px; scrollbar-width: thin; }
.kg-sb::-webkit-scrollbar { width: 6px; }
.kg-sb::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.kg-view { display: none; }
.kg-view.on { display: block; animation: kg-in .22s var(--kg-ease); }
@keyframes kg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.kg-tagline { font: 500 15px/1.5 var(--font-display); color: var(--ink-strong); margin: 14px 0 14px; }
.kg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.kg-actions .btn { padding: 9px 14px; font-size: .8rem; }
.kg-actions .lnk { font-size: 12px; color: var(--mut); text-decoration: none; margin-left: auto; }
.kg-actions .lnk:hover { color: var(--ink-strong); }
.kg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kg-chips button {
  font: 400 12px/1.35 var(--font-display); color: var(--ink); text-align: left;
  background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 6px; padding: 6px 10px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.kg-chips button:hover { border-color: var(--ink-strong); color: var(--ink-strong); }
.kg-sec { margin-top: 20px; }
.kg-sec h5 { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--mut-2); font-weight: 500; margin: 0 0 8px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; }
.kg-sec h5 span { color: var(--mut-2); letter-spacing: .04em; }
.kg-sec p, .kg-sec li { font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.kg-sec ol, .kg-sec ul { margin: 0; padding-left: 0; list-style: none; }
.kg-duties li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line-soft); }
.kg-duties li:first-child { border-top: 0; }
.kg-duties li i { font-family: var(--font-mono); font-size: 10.5px; color: var(--mut-2); font-style: normal; padding-top: 3px; }
.kg-io { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kg-io .col > b { display: block; font: 500 11px/1 var(--font-display); color: var(--mut); margin-bottom: 6px; }
.kg-io .it { padding: 6px 0; border-top: 1px solid var(--line-soft); }
.kg-io .it b { font-weight: 500; color: var(--ink-strong); font-size: 12.5px; }
.kg-io .it .ty { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; color: var(--mut-2); border: 1px solid var(--line-soft); border-radius: 999px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }
.kg-io .it p { font-size: 12px; line-height: 1.5; color: var(--mut); margin: 3px 0 0; }
.kg-list li { position: relative; padding: 5px 0 5px 16px; }
.kg-list li::before { content: "—"; position: absolute; left: 0; color: var(--mut-2); font-family: var(--font-mono); font-size: 11px; top: 8px; }
.kg-list.kg-chk li::before { content: "✓"; }
.kg-list.kg-mis li { color: var(--mut); }
.kg-list.kg-mis li::before { content: "✗"; }
.kg-red li { border-left: 2px solid var(--signal); padding: 4px 0 4px 12px; margin: 6px 0; }
.kg-red li::before { display: none; }
.kg-collab .row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); cursor: pointer; transition: background .15s; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.kg-collab .row:hover { background: var(--bg-2); }
.kg-collab .row .mk { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-strong); flex: none; margin-top: 6px; }
.kg-collab .row b { display: block; font: 500 13px/1.3 var(--font-display); color: var(--ink-strong); }
.kg-collab .row p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--mut); }
.kg-know { display: flex; flex-wrap: wrap; gap: 6px; }
.kg-know span { font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; color: var(--ink); border: 1px solid var(--line-soft); border-radius: 4px; padding: 3px 8px; background: var(--bg-2); }
.kg-scenes .row { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.kg-scenes .row b { font: 500 13px/1.3 var(--font-display); color: var(--ink-strong); flex: none; }
.kg-scenes .row p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--mut); flex: 1; }
.kg-scenes .row button { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; color: var(--mut-2); background: none; border: 0; cursor: pointer; padding: 0; flex: none; }
.kg-scenes .row button:hover { color: var(--ink-strong); }
.kg-scenes .row.hl { background: var(--signal-soft); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; border-top-color: transparent; }
.kg-intro p { font-size: 13.5px; line-height: 1.7; }
.kg-foot { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; color: var(--mut-2); margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line-soft); }

/* ledger */
.kg-ledger .big { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.kg-ledger .big b { font: 600 28px/1 var(--font-display); letter-spacing: -.02em; color: var(--ink-strong); }
.kg-ledger .big span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--mut-2); }
.kg-ledger .row { display: grid; grid-template-columns: 96px 30px 1fr 30px; align-items: center; gap: 10px; height: 26px; }
.kg-ledger .row .k { font-size: 12px; color: var(--ink); }
.kg-ledger .row .w { font-family: var(--font-mono); font-size: 10px; color: var(--mut-2); letter-spacing: .06em; }
.kg-ledger .row .v { font-family: var(--font-mono); font-size: 12px; color: var(--ink-strong); text-align: right; }
.kg-ledger .tr { position: relative; height: 1px; background: var(--line); }
.kg-ledger .tr i { position: absolute; top: 50%; width: 1px; height: 7px; transform: translate(-50%, -50%); }
.kg-ledger .tr .th { left: var(--t); background: transparent; border-left: 1px solid var(--mut-2); }
.kg-ledger .tr .sc { left: 0; width: 6px; background: var(--ink-strong); transition: left .42s var(--kg-ease); }
.kg-ledger.in .tr .sc { left: var(--v); }

/* chat */
.kg-chat { display: flex; flex-direction: column; height: 100%; min-height: 100%; }
.kg-thread { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 14px 0 10px; }
.kg-m { max-width: 100%; }
.kg-m .ts { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; color: var(--mut-2); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.kg-m .ts .lane { border: 1px solid var(--line-soft); border-radius: 999px; padding: 0 6px; }
.kg-m.a .bd { border-left: 2px solid var(--line); padding-left: 12px; font-size: 13.5px; line-height: 1.65; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.kg-m.u { align-self: flex-end; max-width: 82%; }
.kg-m.u .ts { justify-content: flex-end; }
.kg-m.u .bd { background: var(--bg-2); border-radius: 6px; padding: 8px 12px; font-size: 13.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.kg-m .cr { display: inline-block; width: 1px; height: 14px; background: var(--ink-strong); vertical-align: -2px; margin-left: 1px; animation: kg-caret 1.1s steps(2, start) infinite; }
@keyframes kg-caret { to { visibility: hidden; } }
.kg-m .think { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; color: var(--mut-2); }
.kg-sep { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--mut-2); text-align: center; }
.kg-composer { flex: none; position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; }
.kg-composer .chips { margin-bottom: 8px; }
.kg-composer .box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 8px 8px 12px; background: var(--bg); transition: border-color .15s; }
.kg-composer .box:focus-within { border-color: var(--ink-strong); }
.kg-composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: none; font: 400 13.5px/1.5 var(--font-body, inherit); color: var(--ink);
  max-height: 96px; min-height: 22px; padding: 0;
}
.kg-composer textarea::placeholder { color: var(--mut-2); }
.kg-composer .send {
  flex: none; height: 28px; min-width: 28px; padding: 0 10px; border-radius: 6px; border: 0; cursor: pointer;
  background: var(--ink-strong); color: var(--bg); font-family: var(--font-mono); font-size: 12px; transition: background .2s, color .2s;
}
.kg-composer .send:disabled { background: var(--bg-3); color: var(--mut-2); cursor: default; }
.kg-composer .send.stop { background: var(--signal); }
.kg-lane { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; color: var(--mut-2); margin-top: 6px; text-transform: uppercase; }
.kg-lane b { font-weight: 500; color: var(--mut); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .kg-lab .en { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .kg-lab, .kg-sheet, .kg-hud, .kg-ticker .tl, .kg-view.on, .kg-roster-row, .kg-ledger .tr .sc { transition: none; animation: none; }
  .kg-status b::before, .kg-sh-meta .st::before, .kg-mark { animation: none; }
}


/* =====================================================================
   Layout presets — same data and interactions, different compositions.
   ?layout=a  居中海报：标语居中在上，大脑全幅居中在下
   ?layout=b  左脑右文（默认）：大脑放大，标语右侧
   ?layout=c  左文右脑：标语左侧，大脑在右侧出血
   ?layout=d  海报：大脑当背景铺满，标语压在左下
   ===================================================================== */

/* ---- A · centred ---- */
body[data-layout="a"] .kg-sticky { align-items: flex-start; }
body[data-layout="a"] .kg-copy { justify-content: center; padding-top: clamp(28px, 4.5vh, 56px); padding-bottom: 0; }
body[data-layout="a"] .kg-text { width: auto; max-width: 900px; min-width: 0; text-align: center; }
body[data-layout="a"] .kg-copy .kicker { justify-content: center; }
body[data-layout="a"] .kg-copy h1 { font-size: clamp(2.6rem, 5vw, 4.6rem); letter-spacing: -0.035em; line-height: 1.04; }
body[data-layout="a"] .kg-copy h1 .zh { display: block; font-size: .56em; margin-top: .3em; font-weight: 600; color: var(--mut); letter-spacing: .02em; }
body[data-layout="a"] .kg-copy .lede { max-width: 560px; margin: .9rem auto 0; font-size: 1rem; line-height: 1.6; }
body[data-layout="a"] .kg-below { display: flex; flex-direction: column; align-items: center; }
body[data-layout="a"] .kg-copy .btn-row { justify-content: center; margin-top: 1.1rem; }
body[data-layout="a"] .kg-copy .btn-row .btn { padding: 9px 16px; font-size: .84rem; }
body[data-layout="a"] .kg-status { justify-content: center; margin-top: .9rem; }
body[data-layout="a"] .kg-hint, body[data-layout="a"] .kg-status { display: none; }
body[data-layout="a"] .kg-sticky .hero-glyph { display: none; }
body[data-layout="a"] .kg-roster, body[data-layout="a"] .kg-hud { left: 50%; transform: translateX(-50%); width: 520px; text-align: left; }
body[data-layout="a"] .kg-roster-row { max-width: none; }

/* ---- B · brain left, bigger ---- */
body[data-layout="b"] .kg-text { width: 40%; max-width: 520px; }
body[data-layout="b"] .kg-copy h1 { font-size: clamp(2rem, 3.6vw, 3.3rem); }

/* ---- C · type left, brain bleeds right ---- */
body[data-layout="c"] .kg-copy { justify-content: flex-start; }
body[data-layout="c"] .kg-text { width: 44%; max-width: 600px; }
body[data-layout="c"] .kg-copy h1 { font-size: clamp(2.4rem, 4.6vw, 4.4rem); letter-spacing: -0.035em; }
html[lang="en"] body[data-layout="c"] .kg-copy h1 { font-size: clamp(2rem, 3.4vw, 3.3rem); }
body[data-layout="c"] .kg-copy h1 .zh { font-size: .72em; }
body[data-layout="c"] .kg-sticky .hero-glyph { right: auto; left: calc(var(--pad-x) + clamp(80px, 12vw, 180px) + 192px); right: auto; top: 50%; bottom: auto; transform: translateY(-54%); opacity: .42; gap: clamp(26px, 3vw, 46px); }
body[data-layout="c"] .kg-sticky .hero-glyph i { width: clamp(54px, 6.4vw, 104px); height: clamp(220px, 30vw, 430px); }
body[data-layout="c"] .kg-sheet { right: auto; left: 24px; transform: translateX(-24px); }
body[data-layout="c"] .kg-sheet.show { transform: none; }
body[data-layout="c"] .kg-ticker { right: auto; left: var(--pad-x); }
body[data-layout="c"] .kg-ticker .tl { justify-content: flex-start; }

/* ---- D · poster: brain as ground, type bottom-left ---- */
body[data-layout="d"] .kg-sticky { align-items: flex-end; }
body[data-layout="d"] .kg-copy { justify-content: flex-start; padding-bottom: clamp(40px, 6vh, 72px); }
body[data-layout="d"] .kg-text { width: 52%; max-width: 760px; }
body[data-layout="d"] .kg-copy h1 { font-size: clamp(2.8rem, 5.6vw, 5.2rem); letter-spacing: -0.04em; line-height: 1.02; }
body[data-layout="d"] .kg-copy h1 .zh { font-size: .5em; font-weight: 600; margin-top: .3em; color: var(--ink); }
body[data-layout="d"] .kg-copy .lede { max-width: 560px; margin-top: 1rem; }
body[data-layout="d"] .kg-copy .btn-row { margin-top: 1.4rem; }
body[data-layout="d"] .kg-status { margin-top: 1rem; }
body[data-layout="d"] .kg-hint { display: none; }
body[data-layout="d"] .kg-sticky .hero-glyph { top: 14%; right: var(--pad-x); transform: none; opacity: .28; }
body[data-layout="d"] .kg-sticky .hero-glyph i { width: clamp(30px, 3.2vw, 46px); height: clamp(120px, 15vw, 220px); }
body[data-layout="d"] .kg-cap { opacity: .55; }
body[data-layout="d"] .kg-ticker { bottom: auto; top: 22px; }

/* C: title gives way to the position roster while the brain completes its turn. */
@media (min-width: 901px) {
  body[data-layout="c"] .hero.kg-hero { height: 200vh; }
  body[data-layout="c"] .kg-text { position: relative; }
  body[data-layout="c"] .kg-roster { top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: 1fr 1fr; gap: 22px 24px; }
  body[data-layout="c"] .kg-roster-row { display: block; padding-top: 12px; transition: none; }
  body[data-layout="c"] .kg-roster-row .dp { display: block; font: 500 14px/1.5 var(--font-display); color: var(--ink-strong); letter-spacing: 0; }
  body[data-layout="c"] .kg-roster-row .nm { margin-top: 8px; gap: 5px 12px; }
  body[data-layout="c"] .kg-roster-row .nm button { font-size: 13px; color: var(--mut); }
  body[data-layout="c"] .kg-roster:not(.show) button { pointer-events: none; }
  body[data-layout="c"] .kg-roster .kg-hud { top: calc(100% + 24px); }
}

@media (min-width: 901px) {
  body[data-layout="c"] .hero.kg-hero { height: calc(200vh - 2 * var(--nav-h)); position: relative; }
  .kg-pages { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
  body[data-layout="c"] .kg-pages > .kg-copy { height: calc(100vh - var(--nav-h)); display: flex; align-items: center; }
  body[data-layout="c"] .kg-second-page .kg-roster { position: relative; top: auto; transform: none; }
  body[data-layout="c"] .kg-second-page .kg-roster-row { opacity: 1; transform: none; }
}

.kg-roster-heading { margin-bottom: 30px; }
.kg-roster-heading h2 { font-size: clamp(1.8rem, 3vw, 2.8rem); line-height: 1.2; letter-spacing: -.03em; margin: 0; }
.kg-roster-heading p { color: var(--mut); font-size: 1rem; line-height: 1.6; margin: 12px 0 0; }

.kg-dept-zh { display: inline-block; margin-left: 10px; color: var(--mut); font-size: 12px; }
.kg-copy-en { display: none; }
html[lang="en"] .kg-dept-zh, html[lang="en"] .kg-copy-zh { display: none; }
html[lang="en"] .kg-copy-en { display: inline; }
@media (min-width: 901px) {
  body[data-layout="c"] .kg-roster { gap: 32px 24px; }
  body[data-layout="c"] .kg-roster-row .nm { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; margin-top: 14px; }
  body[data-layout="c"] .kg-roster-row .nm button { text-align: left; white-space: nowrap; }
  body[data-layout="c"] .kg-roster-row .dp { font-size: 12px; letter-spacing: .06em; }
}

.kg-roster-heading .accent { color: var(--signal); }

.kg-hud[hidden], .kg-ticker[hidden] { display: none; }

.kg-sh-meta .st { color: #16834a; }
.kg-sh-meta .st::before { background: #16834a; }

@media (min-width: 901px) {
  body.kg-chat-locate .kg-copy, body.kg-chat-locate .kg-sticky .hero-glyph { visibility: hidden; }
}

/* ---- mobile last so it outranks every layout preset above ---- */
@media (max-width: 900px) {
  /* copy first, then the network as a self-contained plate; every rule outranks the layout presets */
  body[data-layout] .hero.kg-hero, .hero.kg-hero { height: auto; min-height: 0; }
  body[data-layout] .kg-sticky, .kg-sticky { position: relative; top: auto; height: auto; min-height: 0; display: flex; flex-direction: column; overflow: visible; align-items: stretch; }
  body[data-layout] .kg-copy, .kg-copy { order: 1; display: block; padding: clamp(28px, 7vw, 48px) var(--pad-x) 0 !important; max-width: none; margin: 0; justify-content: flex-start; }
  body[data-layout] .kg-text, .kg-text { width: 100%; max-width: none; min-width: 0; text-align: left; }
  body[data-layout] .kg-copy .kicker { white-space: nowrap; font-size: .62rem; letter-spacing: .14em; justify-content: flex-start; }
  body[data-layout] .kg-copy h1, .kg-copy h1 { font-size: clamp(2rem, 9.2vw, 2.6rem); line-height: 1.08; letter-spacing: -0.03em; white-space: normal; }
  body[data-layout] .kg-copy h1 .zh { display: block; font-size: .8em; margin-top: .18em; color: var(--ink-strong); }
  body[data-layout] .kg-copy .lede, .kg-copy .lede { max-width: none; font-size: 1rem; line-height: 1.7; margin-top: .9rem; }
  body[data-layout] .kg-below { display: block; }
  body[data-layout] .kg-copy .btn-row { margin-top: 1.3rem; flex-direction: row; flex-wrap: wrap; gap: .6rem; justify-content: flex-start; }
  body[data-layout] .kg-copy .btn-row .btn { width: auto; flex: 1 1 auto; justify-content: center; padding: 11px 16px; font-size: .88rem; }
  body[data-layout] .kg-status, .kg-status { display: flex; margin-top: 1rem; font-size: .6rem; letter-spacing: .1em; gap: 4px 8px; }
  body[data-layout] .kg-hint, .kg-hint { display: inline-flex; margin-top: .5rem; font-size: .78rem; }
  .kg-hint .hover-only { display: none; }
  body[data-layout] .kg-sticky .hero-glyph, .kg-sticky .hero-glyph { display: none; }
  body[data-layout] .kg-stage, .kg-stage { order: 2; position: relative; height: 44vh; min-height: 300px; max-height: 400px; margin-top: 0; }
  body[data-layout] .kg-sheet, .kg-sheet { order: 3; }
  .kg-roster, .kg-hud, .kg-ticker { display: none !important; }
  .kg-cap { display: block; opacity: .7; }
  @media (max-width: 600px) { .kg-cap { display: none !important; } }
  .kg-cap .en { font-size: 9px; }
  .kg-cap .zh { font-size: 10px; }
  /* on touch there is no hover: department leads carry a name tag, everyone else stays a point until tapped */
  .kg-lab { display: none; }
  .kg-lab.lead, .kg-lab.on, .kg-lab.hov, .kg-lab.rel { display: block; }
  .kg-lab .tx { opacity: 1; pointer-events: auto; transform: translateY(-50%); }
  .kg-lab .ld { opacity: 1 !important; }
  .kg-lab .nm { font-size: 11px; }
  .kg-lab .en, .kg-lab .tg { display: none !important; }
  .kg-lab.dot .tx { opacity: 0; pointer-events: none; }
  .kg-scene { display: none !important; }
  .kg-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-height: 82vh; height: auto;
    border-radius: 12px 12px 0 0; transform: translateY(24px);
  }
  .kg-sheet.show { transform: none; }
  .kg-sh { padding: 14px 16px 0; }
  .kg-sb { padding: 4px 16px 16px; }
  .kg-sh-ttl .nm { font-size: 19px; }
  body.kg-open .kg-copy { opacity: 1; }
  body.kg-open .kg-copy a, body.kg-open .kg-copy button { pointer-events: auto; }
}

/* ---- mobile tools (department chips + names toggle) ---- */
.kg-mtools { display: none; }
@media (max-width: 900px) {
  .kg-mtools { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px var(--pad-x) 18px; order: 2; }
  .kg-mchip {
    font: 500 12px/1 var(--font-display); color: var(--ink); background: var(--bg);
    border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
  }
  .kg-mchip.on { color: var(--bg); background: var(--ink-strong); border-color: var(--ink-strong); }
  .kg-mchip--names { margin-left: auto; }
  body.kg-names .kg-lab { display: block; }
  body[data-layout] .kg-stage, .kg-stage { margin-bottom: 0; }
  .kg-lab.on .tg { display: block !important; max-width: 200px; }
}
