@layer legacy {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  /* ═══════════════════════════════════════════
     TOKENS

     A financial-terminal palette, but built from the instrument it imitates
     rather than the usual black-plus-acid-green: the accent is amber phosphor.
     The product is about direction — winners/losers, supply/dependency — so
     gain and stress are a diverging pair, never the only signal (▲/▼ glyphs
     carry the same meaning for colourblind readers).
  ═══════════════════════════════════════════ */
  :root {
    --bg:       #0C1017;   /* ground — deep slate, faint blue cast */
    --surface:  #141A24;   /* panels */
    --surface2: #1B2330;   /* inputs, cards */
    --surface3: #222C3C;   /* raised / hover */
    --kg-border:   #232C3B;
    --kg-border2:  #334054;
    --kg-accent:   #F5A524;   /* amber phosphor — primary action + brand only */
    --kg-accent-h: #FFB84D;
    --on-accent:#0C1017;   /* text on amber: dark, never white (contrast) */
    --text:     #E6EAF2;
    --text-dim:   #A8B3C7; /* prominent secondary */
    --text-muted: #8A97AE; /* quietest — clears 4.5:1 on every surface */
    --green:    #35D0A5;   /* gain / supply */
    --red:      #F2555A;   /* stress / disruption */
    --font: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  }

  html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }

  /* Figures never reflow while streaming */
  .land-stat-num, .cost-chip, .pos-market, .graph-modal-meta,
  .live-round-header, .user-info { font-variant-numeric: tabular-nums; }

  :where(a, button, input, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--kg-accent);
    outline-offset: 2px;
    border-radius: 2px;
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* ═══════════════════════════════════════════
     LANDING PAGE
  ═══════════════════════════════════════════ */
  #landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    overflow-x: hidden;
    position: relative;
  }

  /* Grid dot pattern background */
  #landing::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
      radial-gradient(circle at 20% 20%, rgba(245,165,36,0.06) 0%, transparent 50%),
      radial-gradient(circle at 80% 60%, rgba(245,165,36,0.04) 0%, transparent 40%);
    pointer-events: none;
  }

  /* Dot grid overlay */
  #landing::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.055) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 75%, transparent 100%);
  }

  .land-nav {
    display: flex;
    align-items: center;
    padding: 22px 48px;
    border-bottom: 1px solid var(--kg-border);
    position: relative;
    z-index: 1;
  }
  .land-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
  }
  .land-logo-sub {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
  }
  .land-logo svg, .app-logo svg { color: var(--kg-accent); }
  .land-nav .lang-switcher { margin-left: auto; }

  .land-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 48px 60px;
    text-align: center;
    position: relative;
    z-index: 1;
  }

  .land-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--kg-accent);
    border: 1px solid rgba(245,165,36,0.3);
    padding: 5px 12px;
    margin-bottom: 24px;
  }
  .land-eyebrow-dot {
    width: 5px; height: 5px;
    background: var(--kg-accent);
    border-radius: 50%;
  }

  .land-title {
    font-size: clamp(36px, 5vw, 64px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1.5px;
    color: var(--text);
    max-width: 760px;
    margin-bottom: 20px;
  }
  .land-title span { color: var(--kg-accent); }

  .land-subtitle {
    font-size: 17px;
    color: var(--text-dim);
    max-width: 540px;
    line-height: 1.65;
    margin-bottom: 40px;
  }

  .land-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--kg-accent);
    color: var(--on-accent);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    letter-spacing: -0.2px;
    transition: background 0.15s;
    font-family: var(--font);
  }
  .land-cta:hover { background: var(--kg-accent-h); }
  .land-cta svg { transition: transform 0.15s; }
  .land-cta:hover svg { transform: translateX(3px); }

  /* Stats counters */
  .land-stats {
    display: flex; gap: 40px; margin-top: 36px;
  }
  .land-stat {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
  }
  .land-stat-num {
    font-size: 26px; font-weight: 700; color: var(--kg-accent);
    font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
  }
  .land-stat-label {
    font-size: 11px; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.06em; font-weight: 500;
  }

  .land-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    border-top: 1px solid var(--kg-border);
    border-bottom: 1px solid var(--kg-border);
    background: var(--kg-border);
    position: relative;
    z-index: 1;
  }

  .land-card {
    background: var(--bg);
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .land-card:hover { background: var(--surface); }
  .land-card-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--kg-border2);
    color: var(--kg-accent);
    margin-bottom: 4px;
  }
  .land-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
  }
  .land-card-desc {
    font-size: 13.5px;
    color: var(--text-dim);
    line-height: 1.6;
  }

  /* Value proposition */
  .land-value {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
    padding: 44px 48px 48px;
    max-width: 1060px; margin: 0 auto;
    position: relative; z-index: 1;
  }
  .land-value-item {
    display: flex; flex-direction: column; gap: 10px;
    padding: 24px 28px;
    border: 1px solid var(--kg-border);
    background: var(--surface);
  }
  .land-value-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    color: var(--kg-accent);
  }
  .land-value-title {
    font-size: 15px; font-weight: 700; color: var(--text);
    line-height: 1.3;
  }
  .land-value-desc {
    font-size: 13.5px; color: var(--text-dim); line-height: 1.65;
  }

  /* ═══════════════════════════════════════════
     APP SECTION
  ═══════════════════════════════════════════ */
  #app {
    display: none;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  #app.visible { display: flex; }

  /* Avoid landing-page flash when the user is returning to the app
     (e.g. after re-login via ?app=1 or the kg_return_to_app flag). */
  html.skip-landing #landing { display: none; }
  html.skip-landing #app { display: flex; }

  /* ── App Header ── */
  .app-header {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--kg-border);
    background: var(--surface);
    flex-shrink: 0;
  }

  .app-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 24px;
    height: 48px;
    border-right: 1px solid var(--kg-border);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
  }
  .app-logo:hover { background: var(--surface2); }

  .app-tabs {
    display: flex;
    height: 48px;
    flex: 1;
  }
  .tab {
    padding: 0 22px;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    border: none;
    background: transparent;
    border-right: 1px solid var(--kg-border);
    font-family: var(--font);
    transition: all 0.12s;
    white-space: nowrap;
  }
  .tab:hover { color: var(--text); background: var(--surface2); }
  .tab.active {
    color: var(--text);
    background: var(--bg);
    border-bottom: 2px solid var(--kg-accent);
  }

  .app-header .lang-switcher {
    margin-right: 20px;
    flex-shrink: 0;
  }

  .user-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    height: 48px;
    border-left: 1px solid var(--kg-border);
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
  }
  .user-info .user-name {
    color: var(--text);
    font-weight: 600;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .user-info .usage {
    display: flex;
    gap: 10px;
  }
  .user-info .usage span { font-variant-numeric: tabular-nums; }
  .user-info .usage .exhausted { color: var(--red); font-weight: 600; }
  .user-info .logout-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid var(--kg-border2);
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.12s;
  }
  .user-info .logout-btn:hover { color: var(--text); background: var(--bg); border-color: var(--text-muted); }

  /* ── Tab description ── */
  .tab-desc {
    padding: 8px 24px;
    font-size: 12.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--kg-border);
    background: var(--surface);
    line-height: 1.5;
    flex-shrink: 0;
  }

  /* ── Featured bar ── */
  .featured-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 24px;
    border-bottom: 1px solid var(--kg-border);
    background: var(--surface);
    flex-wrap: wrap;
    flex-shrink: 0;
  }
  .featured-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .company-chips { display: flex; flex-wrap: wrap; gap: 5px; }
  .company-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border: 1px solid var(--kg-border2);
    background: var(--surface2);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.12s;
    font-family: var(--font);
    white-space: nowrap;
  }
  .company-chip:hover { border-color: var(--kg-accent); color: var(--kg-accent); background: rgba(245,165,36,0.07); }
  .company-chip .chip-dot { width: 5px; height: 5px; background: var(--kg-accent); opacity: 0.7; }

  /* ── Main content ── */
  main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg);
  }

  .panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 20px 24px 24px;
    gap: 14px;
  }

  /* ── Input row ── */
  .input-row { display: flex; gap: 10px; align-items: flex-start; }
  .hint-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: -6px; margin-bottom: 2px; }
  .hint-chip {
    padding: 4px 10px; border: 1px solid var(--kg-border);
    background: var(--surface); font-size: 11.5px; color: var(--text-muted);
    cursor: pointer; transition: all 0.12s; font-family: var(--font);
    border-radius: 0; white-space: nowrap;
  }
  .hint-chip:hover { border-color: var(--kg-accent); color: var(--kg-accent); background: rgba(245,165,36,0.04); }
  textarea {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--kg-border2);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    resize: none;
    line-height: 1.55;
    outline: none;
    min-height: 80px;
    transition: border-color 0.12s;
    border-radius: 0;
  }
  textarea:focus { border-color: var(--kg-accent); }
  textarea::placeholder { color: var(--text-muted); }

  .side-controls { display: flex; flex-direction: column; gap: 7px; }

  button.run {
    padding: 10px 20px;
    border: none;
    background: var(--kg-accent);
    color: var(--on-accent);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, opacity 0.12s;
    font-family: var(--font);
    border-radius: 0;
  }
  button.run:hover { background: var(--kg-accent-h); }
  button.run:disabled { opacity: 0.4; cursor: not-allowed; }

  /* ── Show Graph / PDF buttons ── */
  button.show-graph {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--kg-border2);
    background: var(--surface2);
    color: var(--text-dim);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
    font-family: var(--font);
    white-space: nowrap;
    border-radius: 0;
  }
  button.show-graph:hover:not(:disabled) { border-color: var(--kg-accent); color: var(--kg-accent); background: rgba(245,165,36,0.07); }
  button.show-graph:disabled { opacity: 0.3; cursor: not-allowed; }

  /* ── Result area ── */
  .result-wrap {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--kg-border);
    background: var(--surface);
    padding: 20px 24px;
    border-radius: 0;
  }

  /* ── Status ── */
  .status-msg {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; color: var(--text-muted);
  }
  .spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--kg-border2);
    border-top-color: var(--kg-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite; flex-shrink: 0;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .error-msg { color: var(--red); font-size: 14px; }

  /* ── Markdown ── */
  .markdown { font-size: 14.5px; line-height: 1.75; color: var(--text); }
  .markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 1.4em 0 0.5em; font-weight: 600; line-height: 1.3; }
  .markdown h1 { font-size: 22px; }
  .markdown h2 { font-size: 17px; color: var(--kg-accent); }
  .markdown h3 { font-size: 14px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
  .markdown p { margin: 0.65em 0; }
  .markdown ul, .markdown ol { padding-left: 1.4em; margin: 0.6em 0; }
  .markdown li { margin: 0.3em 0; }
  .markdown strong { color: var(--text); font-weight: 600; }
  .markdown em { color: var(--kg-accent); }
  .markdown code {
    background: var(--surface2); border: 1px solid var(--kg-border2);
    padding: 1px 6px; font-size: 12.5px;
    font-family: "JetBrains Mono", "Fira Code", monospace; border-radius: 0;
  }
  .markdown pre {
    background: var(--surface2); border: 1px solid var(--kg-border2);
    padding: 14px 16px; overflow-x: auto; margin: 0.8em 0; border-radius: 0;
  }
  .markdown pre code { background: none; border: none; padding: 0; }
  .markdown blockquote { border-left: 3px solid var(--kg-accent); padding-left: 14px; color: var(--text-muted); margin: 0.8em 0; font-style: italic; }
  .markdown table { width: 100%; border-collapse: collapse; margin: 0.8em 0; font-size: 13.5px; }
  .markdown th, .markdown td { border: 1px solid var(--kg-border2); padding: 8px 12px; text-align: left; }
  .markdown th { background: var(--surface2); font-weight: 600; color: var(--text-dim); }
  .markdown tr:hover td { background: rgba(245,165,36,0.04); }
  .markdown a { color: var(--kg-accent); text-decoration: none; }
  .markdown a:hover { text-decoration: underline; }
  .markdown hr { border: none; border-top: 1px solid var(--kg-border); margin: 1.2em 0; }

  /* ── Section label ── */
  .section-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted); margin-bottom: 9px; font-weight: 600;
  }

  /* ── Simulation result cards ── */
  .sim-result { display: flex; flex-direction: column; gap: 22px; }
  .narrative-card { background: var(--surface2); border: 1px solid var(--kg-border); padding: 18px 20px; }
  .wl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .wl-card { padding: 14px 16px; border: 1px solid var(--kg-border); }
  .wl-card.winners { background: rgba(53,208,165,0.05); border-color: rgba(53,208,165,0.2); }
  .wl-card.losers  { background: rgba(242,85,90,0.05);  border-color: rgba(242,85,90,0.2); }
  .wl-title { font-size: 12px; font-weight: 600; margin-bottom: 10px; }
  .wl-card.winners .wl-title { color: var(--green); }
  .wl-card.losers  .wl-title { color: var(--red); }
  .wl-list { display: flex; flex-direction: column; gap: 7px; }
  .wl-item { font-size: 13px; line-height: 1.45; }
  .wl-item .entity { font-weight: 600; color: var(--text); }
  .wl-item .reason { color: var(--text-muted); font-size: 12px; }

  .rounds-section { display: flex; flex-direction: column; gap: 8px; }
  .round-block { background: var(--surface2); border: 1px solid var(--kg-border); overflow: hidden; }
  .round-header {
    padding: 10px 16px; background: rgba(245,165,36,0.06);
    font-size: 12.5px; font-weight: 600; color: var(--kg-accent);
    border-bottom: 1px solid var(--kg-border); cursor: pointer;
    display: flex; justify-content: space-between; align-items: center; user-select: none;
  }
  .round-header:hover { background: rgba(245,165,36,0.1); }
  .round-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
  .agent-action { padding: 10px 12px; border: 1px solid var(--kg-border); background: var(--surface); }
  .agent-name { font-size: 13px; font-weight: 600; color: var(--text); }
  .action-badge {
    display: inline-block; font-size: 10.5px; padding: 2px 7px;
    font-weight: 600; margin-left: 8px;
    background: rgba(245,165,36,0.12); color: var(--kg-accent); font-family: monospace;
    border-radius: 0;
  }
  .agent-reasoning { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }
  .cost-chip { font-size: 11.5px; color: var(--text-muted); text-align: right; padding-top: 4px; }

  /* ── Scenario result ── */
  .scen-result { display: flex; flex-direction: column; gap: 20px; }
  .scen-description { background: var(--surface2); border: 1px solid var(--kg-border); padding: 16px 18px; font-size: 13.5px; line-height: 1.6; color: var(--text); }
  .scen-wl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .scen-entity { background: var(--surface2); border: 1px solid var(--kg-border); padding: 10px 14px; }
  .scen-entity-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
  .scen-entity-name { font-weight: 600; font-size: 13px; color: var(--text); }
  .scen-score-bar { height: 3px; min-width: 24px; flex-shrink: 0; }
  .scen-winners .scen-score-bar { background: var(--green); }
  .scen-losers  .scen-score-bar { background: var(--red); }
  .scen-entity-effect { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
  .scen-wl-col-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 8px; }
  .scen-winners .scen-wl-col-label { color: var(--green); }
  .scen-losers  .scen-wl-col-label { color: var(--red); }
  .propagation-chain {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    background: var(--surface2); border: 1px solid var(--kg-border); padding: 14px 16px;
  }
  .prop-node {
    background: rgba(245,165,36,0.12); color: var(--kg-accent); font-size: 12px; font-weight: 600;
    padding: 3px 8px; font-family: monospace; border-radius: 0;
  }
  .prop-edge { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
  .prop-arrow { color: var(--text-muted); font-size: 12px; }

  /* ── Portfolio ── */
  .portfolio-summary { font-size: 13px; color: var(--text-muted); line-height: 1.55; padding: 12px 16px;
    background: var(--surface2); border: 1px solid var(--kg-border); margin-bottom: 10px; }
  .portfolio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .portfolio-col-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 8px; }
  .portfolio-col-label.long  { color: var(--green); }
  .portfolio-col-label.short { color: var(--red); }
  .position-card { background: var(--surface2); border: 1px solid var(--kg-border); padding: 12px 14px;
    display: flex; flex-direction: column; gap: 5px; margin-bottom: 7px; }
  .position-card.long  { border-left: 2px solid var(--green); }
  .position-card.short { border-left: 2px solid var(--red); }
  .pos-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .pos-ticker { font-weight: 700; font-size: 14px; font-family: monospace; color: var(--text); }
  .pos-name   { font-size: 12px; color: var(--text-muted); }
  .pos-badges { display: flex; gap: 5px; margin-left: auto; flex-wrap: wrap; }
  .pos-badge  { font-size: 10px; font-weight: 600; padding: 2px 6px; text-transform: uppercase; border-radius: 0; }
  .pos-badge.high   { background: rgba(53,208,165,0.12); color: var(--green); }
  .pos-badge.medium { background: rgba(245,165,36,0.12); color: var(--kg-accent); }
  .pos-badge.low    { background: rgba(255,255,255,.05); color: var(--text-muted); }
  .pos-market { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; font-family: monospace;
    background: var(--surface3); border: 1px solid var(--kg-border); padding: 4px 8px; }
  .pos-market-item { color: var(--text); }
  .pos-market-item span { color: var(--text-muted); }
  .pos-thesis { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
  .portfolio-risks { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; padding: 10px 14px;
    background: rgba(242,85,90,0.05); border: 1px solid rgba(242,85,90,0.15); margin-top: 10px; }

  /* ── Graph modal ── */
  .graph-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 24px;
  }
  .graph-modal {
    background: var(--surface); border: 1px solid var(--kg-border2);
    width: 100%; max-width: 1100px;
    height: 80vh; display: flex; flex-direction: column;
    box-shadow: 0 32px 80px rgba(0,0,0,0.45);
    overflow: hidden; border-radius: 0;
    transition: all 0.2s;
  }
  .graph-modal.fullscreen {
    max-width: 100%; height: 100vh;
  }
  .graph-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 20px; border-bottom: 1px solid var(--kg-border); flex-shrink: 0;
  }
  .graph-modal-title { font-size: 14px; font-weight: 600; }
  .graph-modal-meta { font-size: 11.5px; color: var(--text-muted); margin-left: 8px; }
  .graph-modal-close {
    width: 28px; height: 28px; border: 1px solid var(--kg-border2); border-radius: 0;
    background: var(--surface2); cursor: pointer; font-size: 14px; line-height: 1;
    color: var(--text-muted); transition: all 0.12s; font-family: var(--font);
  }
  .graph-modal-close:hover { border-color: var(--kg-accent); color: var(--text); }
  .graph-modal-fullscreen {
    width: 28px; height: 28px; border: 1px solid var(--kg-border2); border-radius: 0;
    background: var(--surface2); cursor: pointer; font-size: 14px; line-height: 1;
    color: var(--text-muted); transition: all 0.12s; font-family: var(--font);
    margin-right: 6px;
  }
  .graph-modal-fullscreen:hover { border-color: var(--kg-accent); color: var(--text); }
  .graph-spacing-control {
    display: flex; align-items: center; gap: 7px; margin-right: 12px;
  }
  .graph-spacing-control label {
    font-size: 11px; color: var(--text-muted); white-space: nowrap; user-select: none;
  }
  .graph-spacing-control input[type=range] {
    width: 90px; height: 3px; accent-color: var(--kg-accent); cursor: pointer;
  }
  .graph-canvas { flex: 1; position: relative; overflow: hidden; background: var(--bg); }
  .graph-canvas svg { width: 100%; height: 100%; }

  /* tooltip */
  .node-tooltip {
    position: absolute; pointer-events: none;
    background: var(--surface); border: 1px solid var(--kg-border2);
    padding: 10px 14px; font-size: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.42); max-width: 280px;
    line-height: 1.6; z-index: 10; border-radius: 0;
  }
  .node-tooltip .tt-name { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
  .node-tooltip .tt-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
  .node-tooltip .tt-props { margin-top: 6px; color: var(--text-muted); font-size: 11.5px; }

  /* legend */
  .graph-legend {
    position: absolute; top: 12px; right: 12px;
    background: var(--surface); border: 1px solid var(--kg-border2);
    padding: 10px 14px; font-size: 11.5px;
    display: flex; flex-direction: column; gap: 5px; border-radius: 0;
  }
  .legend-item {
    display: flex; align-items: center; gap: 7px;
    cursor: pointer; user-select: none; transition: opacity 0.15s;
  }
  .legend-item.hidden { opacity: 0.3; }
  .legend-item:hover { opacity: 0.8; }
  .legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
  .graph-hint { position: absolute; bottom: 10px; left: 12px; font-size: 11px; color: var(--text-muted); }

  /* ── Live simulation log ── */
  .live-log { display: flex; flex-direction: column; gap: 10px; }
  .live-status { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-muted); }
  .live-status .spinner { width: 13px; height: 13px; border-width: 2px; flex-shrink: 0; }
  .live-intel { background: var(--surface2); border: 1px solid var(--kg-border); padding: 14px 18px; }
  .live-intel-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted); font-weight: 600; margin-bottom: 8px;
  }
  .live-agents { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .live-agents-label { font-size: 11.5px; color: var(--text-muted); margin-right: 2px; }
  .live-agent-tag {
    font-size: 11px; padding: 3px 8px;
    background: rgba(245,165,36,0.1); color: var(--kg-accent);
    border: 1px solid rgba(245,165,36,0.2); font-weight: 500; border-radius: 0;
  }
  .live-round-header {
    font-size: 11.5px; font-weight: 700; color: var(--kg-accent);
    text-transform: uppercase; letter-spacing: 0.07em;
    padding: 6px 0 2px; border-bottom: 1px solid var(--kg-border);
  }
  .live-thinking { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
  .live-thinking .dot-pulse {
    width: 5px; height: 5px; background: var(--text-muted);
    animation: pulse 1s ease-in-out infinite; border-radius: 50%;
  }
  @keyframes pulse { 0%,100%{opacity:.3} 50%{opacity:1} }
  .live-action { padding: 9px 12px; border: 1px solid var(--kg-border); background: var(--surface2); }
  .live-action-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
  .live-action-name { font-size: 13px; font-weight: 600; }
  .live-action-badge {
    font-size: 10.5px; padding: 2px 7px; border-radius: 0;
    background: rgba(245,165,36,0.12); color: var(--kg-accent);
    font-weight: 600; font-family: monospace;
  }
  .live-action-reasoning { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

  /* ── Expand button ── */
  .expand-btn {
    width: 28px; height: 28px; border: 1px solid var(--kg-border2);
    background: var(--surface2); cursor: pointer; display: flex; align-items: center;
    justify-content: center; color: var(--text-muted); transition: all 0.12s;
    flex-shrink: 0; padding: 0; border-radius: 0;
  }
  .expand-btn:hover { border-color: var(--kg-accent); color: var(--kg-accent); background: rgba(245,165,36,0.07); }

  /* ── Expand overlay ── */
  .textarea-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 0;
  }
  .textarea-overlay-box {
    background: var(--surface); border: 1px solid var(--kg-border2);
    width: 100vw; height: 100vh;
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: 0;
  }
  .textarea-overlay-header {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 9px 14px; border-bottom: 1px solid var(--kg-border); flex-shrink: 0;
  }
  .textarea-overlay-close {
    width: 28px; height: 28px; border: 1px solid var(--kg-border2); border-radius: 0;
    background: var(--surface2); cursor: pointer; font-size: 14px;
    color: var(--text-muted); transition: all 0.12s; font-family: var(--font);
  }
  .textarea-overlay-close:hover { border-color: var(--kg-accent); color: var(--text); }

  /* ── Language switcher ── */
  .lang-switcher {
    display: flex;
    border: 1px solid var(--kg-border2);
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 0;
  }
  .lang-btn {
    padding: 5px 11px; font-size: 11.5px; font-weight: 600; cursor: pointer;
    border: none; background: transparent; color: var(--text-muted);
    font-family: var(--font); transition: all 0.12s; letter-spacing: 0.04em;
    border-radius: 0;
  }
  .lang-btn.active { background: var(--kg-accent); color: var(--on-accent); }
  .lang-btn:not(.active):hover { background: var(--surface2); color: var(--text); }

  /* ── Scrollbar ── */
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--kg-border2); border-radius: 0; }

  /* ═══════════════════════════════════════════
     THE SUBSTRATE

     The signature element. A real subgraph of the economy — fetched live, not
     faked — drifting behind the hero. The product's subject matter *is* the
     decoration, so the landing demonstrates the thing it sells instead of
     describing it. Masked to a soft ellipse so it never fights the headline.
  ═══════════════════════════════════════════ */
  #substrate {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease-out;
    -webkit-mask-image: radial-gradient(ellipse 46% 60% at 72% 46%, #000 30%, transparent 78%);
    mask-image: radial-gradient(ellipse 46% 60% at 72% 46%, #000 30%, transparent 78%);
  }
  #substrate.live { opacity: 1; }

  /* Lift the hero text above the substrate and keep it legible over the densest
     part of the graph. */
  .land-hero { position: relative; z-index: 1; }
  .land-title, .land-subtitle, .land-eyebrow { text-shadow: 0 2px 24px var(--bg); }

  /* Asymmetric hero: copy left, live graph right. Centred hero + centred stat
     row is the default every product ships; the split says something truer
     about this one — the text makes a claim, the graph is the evidence. */
  .land-hero {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 72px 48px 64px;
    min-height: 78vh;
  }
  .land-hero-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 560px;
  }
  .land-title { max-width: none; letter-spacing: -1.8px; }
  .land-subtitle { max-width: 480px; margin-bottom: 36px; }
  .land-stats { justify-content: flex-start; gap: 32px; flex-wrap: wrap; }
  .land-stat { align-items: flex-start; }
  /* The copy sits clear of the graph, so it needs no shadow scrim. */
  .land-title, .land-subtitle, .land-eyebrow { text-shadow: none; }

  @media (max-width: 900px) {
    .land-hero { padding: 56px 24px 48px; min-height: 0; }
    .land-hero-copy { max-width: 100%; }
    /* Graph recedes to a faint texture rather than crowding a narrow screen. */
    #substrate { opacity: 0; }
    #substrate.live { opacity: 0.35; }
    .land-cards, .land-value { grid-template-columns: 1fr; }
    .land-value { padding: 32px 24px; }
    .land-nav { padding: 18px 24px; }
  }

  /* Two lines, not four: the forced <br> plus a 560px measure was breaking the
     headline into a ragged stack. */
  .land-hero-copy { max-width: 620px; }
  .land-title { font-size: clamp(32px, 3.9vw, 54px); line-height: 1.08; }
  .land-subtitle { max-width: 520px; font-size: 16px; }

  /* ═══════════════════════════════════════════
     EMPTY RESULT STATE

     Was a ~570px box reading "Results will appear here." Now the panel shows
     the graph forming from whatever is typed — the system visibly understanding
     the input before committing to a 7-15 minute run.
  ═══════════════════════════════════════════ */
  .result-empty {
    position: relative;
    flex: 1;
    min-height: 260px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
  }
  .result-empty-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.9s ease-out;
    -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 46%, #000 35%, transparent 82%);
    mask-image: radial-gradient(ellipse 70% 70% at 50% 46%, #000 35%, transparent 82%);
  }
  .result-empty-canvas.live { opacity: 0.85; }
  .result-empty-caption {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 16px 18px;
  }
  .result-empty-title { font-size: 13px; color: var(--text-muted); }
  .result-empty-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
  }

  /* Caption pinned to the bottom edge so it never sits on top of the graph. */
  .result-empty { display: block; }
  .result-empty-caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, var(--surface) 40%, transparent);
    padding: 22px 18px 16px;
  }

  /* .result-wrap is display:block, so flex:1 on the child never applied and the
     canvas stayed at its min-height inside a much taller box. */
  .result-empty { height: 100%; }

  @media (max-width: 640px) {
    /* The strapline pushed the wordmark onto two lines in the nav. */
    .land-logo-sub { display: none; }
    .land-logo { font-size: 15px; }
    /* At this width the substrate is a few pixels of speckle that reads as a
       rendering artefact rather than a graph — better absent. */
    #substrate, #substrate.live { opacity: 0; }
    .land-stats { gap: 20px 28px; }
    .land-stat-num { font-size: 22px; }
  }

}
