/* ─── IN-PAGE DEMOS — scripted replicas of the app's canvas ───
     Same treatment as the TrackDeck / ReviewDeck site demos: hand-built
     DOM replicas of the real UI, scoped tokens copied verbatim from the
     app source (universalFormat.js BASE_PIN_COLORS + nodeSystemRegistry
     category palettes), driven by a [ms,fn] timeline engine that only
     runs on-screen and freezes at its end-state under reduced motion. */
  .demo-wide {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
  }
  .demo-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background-color: #17191c;
    /* pin colors: app js/graph/universalFormat.js BASE_PIN_COLORS (verbatim) */
    --gd-exec: #ffffff;
    --gd-float: #a8ce6e;
    --gd-vector: #f0b428;
    --gd-object: #1b8bdc;
    --gd-string: #e91e8c;
    --gd-bool: #a52b2b;
  }
  .demo-chip {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 8;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.56rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    background: rgba(20, 22, 24, 0.85);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 9px;
    pointer-events: none;
    white-space: nowrap;
  }
  .demo-chip .dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
    animation: gd-pulse-dot 2.4s ease-in-out infinite;
  }
  @keyframes gd-pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
  }
  .demo-caption {
    margin-top: 1rem;
    color: var(--text-dim);
    font-size: 0.92rem;
  }

  /* Fixed 820x460 inner stage, scaled to fit its container by JS
     (--gd-scale). Everything inside shares one px coordinate space, so
     SVG wires and DOM nodes line up at every viewport size. */
  .gd-stagebox {
    position: absolute;
    left: 50%; top: 50%;
    width: 1100px; height: 619px;
    transform: translate(-50%, -50%) scale(var(--gd-scale, 1));
  }
  .gd-cam {
    position: absolute;
    inset: 0;
    transition: transform 1.1s cubic-bezier(0.35, 0.05, 0.2, 1);
  }

  /* App-window chrome (mini GraphDeck / mini Unreal) */
  .gd-app, .ue-app {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: #141618;
    border: 1px solid #33373b;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  }
  .gd-tb {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    background: #1b1e21;
    border-bottom: 1px solid #2b2f33;
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
  }
  .gd-tb .gd-logo { font-weight: 700; color: var(--text-bright); font-size: 11px; }
  .gd-tb .gd-logo span { color: var(--accent); }
  .gd-tb .gd-tabs { margin-left: 8px; display: flex; gap: 4px; }
  .gd-tb .gd-tab {
    padding: 2px 8px;
    border-radius: 4px;
    background: #24272a;
    border: 1px solid #2e3235;
    font-size: 10px;
    color: var(--text);
  }
  .gd-tb .gd-win { margin-left: auto; display: flex; gap: 6px; }
  .gd-tb .gd-win i {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #33373b;
    display: block;
  }
  .ue-app .gd-tb { background: #202020; border-bottom-color: #2a2a2a; }
  .ue-app .gd-tb .gd-tab { background: #2a2a2a; border-color: #333; }
  .gd-canvas {
    position: relative;
    flex: 1;
    background-color: #1a1d20;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
  }
  .ue-app .gd-canvas {
    background-color: #262626;
    background-image: linear-gradient(rgba(0,0,0,0.22) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.22) 1px, transparent 1px);
    background-size: 24px 24px;
  }

  /* Node replica. Category palettes copied verbatim from the app's
     nodeSystemRegistry.js (header / bar / body per category). Node text
     uses IBM Plex Sans - the app's actual canvas font. */
  .gd-node {
    position: absolute;
    min-width: 132px;
    background: var(--gd-body, #191919);
    border: 1px solid rgba(0, 0, 0, 0.65);
    border-radius: 7px;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.4);
    font-family: 'IBM Plex Sans', Arial, sans-serif;
    z-index: 2;
  }
  .gd-node-head {
    padding: 4px 10px 3px;
    font-size: 11.5px;
    font-weight: 600;
    color: #f0f0f0;
    background: linear-gradient(180deg, var(--gd-h) 0%, color-mix(in srgb, var(--gd-h) 72%, #000) 100%);
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .gd-node-head small { font-weight: 400; opacity: 0.75; font-size: 10px; }
  .gd-node-bar { height: 2px; background: var(--gd-bar); }
  .gd-ev   { --gd-h: #5c1212; --gd-bar: #c0383a; --gd-body: #1b1414; }
  .gd-fn   { --gd-h: #0e3d24; --gd-bar: #39b36a; --gd-body: #131a16; }
  .gd-set  { --gd-h: #0a2a3a; --gd-bar: #1b8bdc; --gd-body: #121820; }
  .gd-flow { --gd-h: #282828; --gd-bar: #555555; --gd-body: #191919; }
  .gd-math { --gd-h: #222222; --gd-bar: #666666; --gd-body: #181818; }
  .gd-ref  { --gd-h: #0e2d30; --gd-bar: #2db8a0; --gd-body: #121a1a; }
  .gd-get  { --gd-h: #1a1a1a; --gd-bar: #4a8a4a; --gd-body: #151515; }
  .gd-comp { --gd-h: #4a2008; --gd-bar: #c96a24; --gd-body: #1c1510; }
  .gd-pins {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 7px 8px;
  }
  .gd-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
  .gd-col.out { align-items: flex-end; }
  .gd-pin {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    color: #cfd2d4;
    white-space: nowrap;
  }
  .gd-col.out .gd-pin { flex-direction: row-reverse; }
  .gd-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    border: 1.5px solid var(--pc, #888);
    flex: 0 0 auto;
  }
  .gd-dot.fill { background: var(--pc, #888); }
  .gd-exec-pin {
    width: 10px; height: 10px;
    flex: 0 0 auto;
    background: var(--gd-exec);
    clip-path: polygon(0 0, 55% 0, 100% 50%, 55% 100%, 0 100%);
  }
  .gd-pin .f { --pc: var(--gd-float); }
  .gd-pin .v { --pc: var(--gd-vector); }
  .gd-pin .o { --pc: var(--gd-object); }
  .gd-pin .e { --pc: #006E4F; }
  .gd-pin .w { --pc: #8a8f94; }

  /* Wires: one SVG per canvas, paths in the same 820x460 px space.
     Draw-in via dashoffset. Curves are UE-style horizontal-handle cubics. */
  .gd-wires { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 1; }
  .gd-wire {
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-dasharray: 700;
    stroke-dashoffset: 700;
    transition: stroke-dashoffset 0.55s ease, opacity 0.45s ease;
  }
  .gd-wire.faded { opacity: 0.15; }
  .gd-wire.object { stroke: var(--gd-object); }
  .gd-wire.in { stroke-dashoffset: 0; }
  .gd-wire.exec { stroke: var(--gd-exec); stroke-width: 2.6; }
  .gd-wire.float { stroke: var(--gd-float); }
  .gd-wire.vector { stroke: var(--gd-vector); }

  /* Pop-in for demo elements */
  .gd-el {
    opacity: 0;
    transform: scale(0.93);
    transition: opacity 0.35s ease, transform 0.35s ease;
  }
  .gd-el.in { opacity: 1; transform: scale(1); }

  /* Prompt bar, validation chip, deploy button, toast */
  .gd-prompt {
    position: absolute;
    left: 14px; top: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: 70%;
    background: #202428;
    border: 1px solid #31363b;
    border-radius: 7px;
    padding: 6px 11px;
    font-size: 11.5px;
    color: var(--text);
    z-index: 5;
  }
  .gd-prompt .lbl {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .gd-prompt .caret {
    width: 1.5px; height: 13px;
    background: var(--accent);
    animation: gd-caret 1s steps(1) infinite;
  }
  @keyframes gd-caret { 50% { opacity: 0; } }
  .gd-valid {
    position: absolute;
    left: 14px; bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(63, 192, 63, 0.1);
    border: 1px solid rgba(63, 192, 63, 0.3);
    border-radius: 6px;
    padding: 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--float);
    z-index: 5;
  }
  .gd-deploy {
    position: absolute;
    right: 14px; bottom: 12px;
    background: var(--accent);
    color: #0d1013;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 11.5px;
    font-weight: 700;
    font-family: inherit;
    z-index: 5;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  .gd-deploy.pressed { transform: scale(0.94); box-shadow: 0 0 0 3px rgba(74, 158, 237, 0.3); }
  .gd-toast {
    position: absolute;
    right: 14px; top: 12px;
    background: #1d2a1d;
    border: 1px solid rgba(63, 192, 63, 0.4);
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 11px;
    color: #b9e6b9;
    z-index: 6;
  }

  /* Keyboard chip - pops fresh at each press location (cursor travels,
     the chip never does). */
  .gd-kbd {
    position: absolute;
    background: #26282b;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 9px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: var(--text);
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    z-index: 7;
  }
  .gd-kbd.show { opacity: 1; animation: gd-kbd-pop 0.22s ease-out; }
  @keyframes gd-kbd-pop {
    0% { opacity: 0; transform: translateY(4px) scale(0.9); }
    100% { opacity: 1; transform: none; }
  }
  .gd-marquee {
    position: absolute;
    border: 1px solid var(--accent);
    background: rgba(74, 158, 237, 0.12);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 4;
  }
  .gd-marquee.in { opacity: 1; }

  /* Lesson layer: veil + chalk (Kalam is the app's real board font) */
  /* Lives INSIDE .gd-cam (so per-element z-index beats it), which means
     it rides the camera transform - oversized so every glide keeps the
     whole viewport covered. */
  .gd-veil {
    position: absolute;
    inset: -700px;
    background: rgba(7, 9, 13, 0.55); /* app veil token */
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 3;
  }
  .gd-veil.on { opacity: 1; }
  .gd-node.lit { z-index: 4; }
  .gd-node.dimmed { opacity: 0.3; transition: opacity 0.5s ease; }
  .gd-chalk { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 6; }
  .gd-chalk .stroke {
    fill: none;
    stroke: #E9E4D8; /* app ink */
    stroke-width: 2.25; /* app strokeW */
    stroke-linecap: round;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 0.8s ease, opacity 0.4s ease;
  }
  .gd-chalk .stroke.mint { stroke: #82D4BC; }
  .gd-chalk .stroke.draw { stroke-dashoffset: 0; }
  .gd-chalk .stroke.gone { opacity: 0; }
  .gd-note {
    position: absolute;
    font-family: 'BoardHand', 'Kalam', 'Segoe Print', cursive; /* app fontHand */
    font-size: 17px; /* app textPx */
    line-height: 1.45;
    color: #E9E4D8;
    max-width: 240px;
    text-shadow: 0 0 5px rgba(7, 9, 13, 0.92), 0 0 5px rgba(7, 9, 13, 0.92), 0 0 5px rgba(7, 9, 13, 0.92);
    z-index: 6;
  }
  .gd-note.mint { color: #82D4BC; }
  .gd-note.amber { color: #F2B24C; }
  .gd-chalk .stroke.amber { stroke: #F2B24C; }
  .gd-chalk .stroke.echo { opacity: 0; }
  .gd-chalk .stroke.echo.draw { opacity: 0.3; } /* warning ring second pen pass */
  .gd-chalk .stroke.echo.gone { opacity: 0; }
  .gd-stepper {
    position: absolute;
    left: 0; right: 0; bottom: 18px;
    margin: 0 auto;
    width: max-content;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text);
    z-index: 7;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  }
  .gd-step-mid { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 150px; }
  .gd-step-count { font-size: 11.5px; color: var(--text-dim); }
  .gd-stepper.interactive { gap: 8px; }
  .gd-step-title { color: var(--text); font-size: 12.5px; font-weight: 500; margin: 0; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gd-step-btn {
    background: #22262c;
    border: 1px solid var(--border);
    color: var(--text);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
  }
  .gd-step-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
  .gd-accept span { cursor: pointer; }
  .gd-sketch {
    border-style: dashed;
    border-color: rgba(232, 228, 218, 0.7);
    background: rgba(20, 22, 24, 0.55);
    box-shadow: none;
  }
  .gd-sketch .gd-node-head {
    background: transparent;
    border-bottom: 1px dashed rgba(232, 228, 218, 0.4);
    font-family: 'Kalam', cursive;
    color: #e8e4da;
  }
  .gd-sketch.solid {
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.65);
    background: var(--gd-body, #191919);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.4);
    transition: all 0.4s ease;
  }
  .gd-sketch.solid .gd-node-head {
    background: linear-gradient(180deg, var(--gd-h) 0%, color-mix(in srgb, var(--gd-h) 72%, #000) 100%);
    border-bottom: none;
    font-family: 'IBM Plex Sans', Arial, sans-serif;
    color: #f0f0f0;
  }
  .gd-accept {
    position: absolute;
    display: inline-flex;
    gap: 6px;
    z-index: 7;
  }
  .gd-accept span {
    background: rgba(130, 212, 188, 0.16);
    border: 1px solid #82D4BC;
    color: #82D4BC;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
  .gd-accept span:hover { background: #82D4BC; color: #10141a; }

  /* Fake cursor (ported from the TrackDeck site demo engine) */
  .demo-cursor {
    position: absolute;
    left: 0; top: 0;
    width: 18px; height: 18px;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: left 0.7s cubic-bezier(0.3, 0.05, 0.25, 1), top 0.7s cubic-bezier(0.3, 0.05, 0.25, 1), opacity 0.25s ease;
  }
  .demo-cursor.on { opacity: 1; }
  .demo-cursor svg {
    display: block;
    width: 100%; height: 100%;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
    transition: transform 0.12s ease;
    transform-origin: 3px 3px;
  }
  .demo-cursor.down svg { transform: scale(0.82); }
  .demo-cursor .ring {
    position: absolute;
    left: -5px; top: -6px;
    width: 28px; height: 28px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.4);
  }
  .demo-cursor.down .ring { animation: gd-cursor-ring 0.5s ease-out; }
  @keyframes gd-cursor-ring {
    0% { opacity: 0.85; transform: scale(0.4); }
    100% { opacity: 0; transform: scale(1.2); }
  }

  /* Workflow section: steps beside the generate demo, sync-highlighted */
  .workflow-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 3rem;
    align-items: center;
    max-width: 1080px;
    margin: 0 auto;
  }
  .workflow-grid .demo-wide { margin: 0; }
  .step { transition: opacity 0.4s ease; }
  .workflow.demo-live .step { opacity: 0.45; }
  .workflow.demo-live .step.active { opacity: 1; }
  .workflow.demo-live .step.active .step-num {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px rgba(74, 158, 237, 0.35);
  }
  @media (max-width: 940px) {
    .workflow-grid { grid-template-columns: 1fr; gap: 2rem; }
  }
  .understand .demo-wide, .features .demo-wide { max-width: 1100px; margin: 2.2rem auto 0; }

  @media (prefers-reduced-motion: reduce) {
    .demo-chip .dot, .gd-prompt .caret { animation: none; }
    .gd-kbd.show { animation: none; }
  }

  /* ─── DEMO MODE PANES ───────────────────── */
  .demo-stage[data-mode] { display: none; }
  body[data-demo-mode="blueprint"] .demo-stage[data-mode="blueprint"],
  body[data-demo-mode="material"]  .demo-stage[data-mode="material"],
  body[data-demo-mode="widget"]    .demo-stage[data-mode="widget"] { display: block; }
  body:not([data-demo-mode]) .demo-stage[data-mode="blueprint"] { display: block; }

  /* Material node palettes (hero-mock aligned; structure shared with gd-) */
  .gm-tex    { --gd-h: #0e2d30; --gd-bar: #2db8a0; --gd-body: #121a1a; }
  .gm-param  { --gd-h: #0e3d24; --gd-bar: #39b36a; --gd-body: #131a16; }
  .gm-math   { --gd-h: #222222; --gd-bar: #666666; --gd-body: #181818; }
  .gm-result { --gd-h: #5c1212; --gd-bar: #c0383a; --gd-body: #1b1414; }
  .gd-pin .m { --pc: #b9b9b9; }
  .gd-wire.mat { stroke: #b9b9b9; stroke-width: 2; }

  /* Widget designer preview (mirrors the built WBP_HealthBar tree) */
  .wd-prev { position: absolute; }
  .wd-panel {
    background: #0a0a0a;
    border: 1px solid #2c2c2c;
    border-radius: 6px;
    padding: 12px 14px;
  }
  .wd-title { color: #eee; font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; font-size: 17px; margin-bottom: 8px; }
  .wd-bar { height: 16px; background: #1c1c1c; border: 1px solid #2c2c2c; border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
  .wd-bar i { display: block; height: 100%; background: var(--accent); transition: width 0.4s ease; }
  .wd-btns { display: flex; gap: 8px; }
  .wd-btns span {
    flex: 1;
    text-align: center;
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    border-radius: 4px;
    padding: 4px 0;
    font-size: 12px;
    color: #ddd;
    font-family: 'IBM Plex Sans', sans-serif;
  }
  .wd-caption { margin-top: 8px; font-size: 10px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
  .wd-send {
    position: absolute;
    right: 16px; bottom: 16px;
    background: var(--accent);
    color: #0d1013;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 11.5px;
    font-weight: 700;
    font-family: inherit;
    transition: transform 0.15s ease;
  }
  .wd-send.pressed { transform: scale(0.94); }

  /* Connector demo: mini content browser */
  .cn-grid {
    position: absolute;
    inset: 40px 16px 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    align-content: start;
  }
  .cn-path {
    position: absolute;
    left: 16px; top: 11px;
    display: flex;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-dim);
  }
  .cn-path i { font-style: normal; opacity: 0.5; }
  .cn-tile {
    aspect-ratio: 1 / 1.15;
    background: #202020;
    border: 1px solid #303030;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  .cn-tile i {
    width: 56%;
    aspect-ratio: 1;
    background: #2c2c2c;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: normal;
    font-weight: 800;
    font-size: 14px;
    color: #666;
  }
  .cn-tile span { font-size: 10px; color: #9a9a9a; font-family: 'JetBrains Mono', monospace; max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cn-tile.cn-new { border-color: var(--accent); box-shadow: 0 0 12px rgba(74, 158, 237, 0.25); }
  .cn-tile .cn-blueprint { background: #1b2f47; color: #6db3f2; }
  .cn-tile .cn-material { background: #0e3d24; color: #39b36a; }
  .cn-tile .cn-widget { background: #4a2008; color: #c96a24; }
  .gd-tb .gd-live { background: #3fc03f !important; box-shadow: 0 0 5px #3fc03f; }
  .connector-teaser .demo-wide { max-width: 1036px; margin: 2.2rem auto 0; text-align: left; }
  .stats-strip { max-width: 1100px; margin: 0 auto; padding: 0 2rem 3.5rem; }
  .section-label i { font-style: normal; opacity: 0.5; margin-right: 10px; }

  /* Zig-zag: demo offset to one side, info rail on the other */
  .features, .library { max-width: 1280px; }
  .zig-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 2.8rem;
    align-items: center;
  }
  .zig-grid.rail-left { grid-template-columns: 300px minmax(0, 1fr); }
  .zig-grid .demo-wide { margin: 0; max-width: none; }
  .zig-grid .demo-underbar { max-width: none; margin: 0.9rem 0 0; justify-content: flex-start; }
  .zig-rail { display: flex; flex-direction: column; gap: 1.5rem; }
  .rail-sub { color: var(--text-dim); line-height: 1.65; font-size: 0.95rem; margin: 0; }
  .rail-steps { display: flex; flex-direction: column; gap: 0.95rem; }
  .rail-step { display: flex; gap: 12px; align-items: flex-start; }
  .rail-step i {
    font-style: normal;
    width: 26px; height: 26px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--accent);
    background: var(--bg3);
  }
  .rail-step strong { display: block; font-size: 0.9rem; color: var(--text-bright); font-weight: 600; }
  .rail-step span { font-size: 0.8rem; color: var(--text-dim); }
  .rail-check { display: flex; flex-direction: column; gap: 0.65rem; }
  .rail-check div { display: flex; gap: 10px; align-items: baseline; font-size: 0.9rem; color: var(--text); }
  .rail-check div::before { content: '✓'; color: var(--float); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
  .rail-cta {
    align-self: flex-start;
    background: var(--accent);
    color: #0d1013;
    font-weight: 700;
    font-size: 0.88rem;
    border-radius: 8px;
    padding: 9px 16px;
    text-decoration: none;
  }
  .rail-note { font-size: 0.78rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
  @media (max-width: 1020px) {
    .zig-grid, .zig-grid.rail-left { grid-template-columns: 1fr; }
    .zig-grid .zig-rail { order: -1; }
  }
  .features-sub, .library-sub {
    max-width: 660px;
    margin: -1.2rem 0 2.2rem;
    color: var(--text-dim);
    line-height: 1.65;
  }
  .library {
    padding: 5rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
  }
  .library h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.02em;
    margin-bottom: 2.5rem;
  }
  .library .demo-wide { max-width: 1100px; margin: 0 auto; }
  .library .demo-underbar { max-width: 1100px; margin: 0.9rem auto 0; }
  .library .demo-caption a { color: var(--accent); text-decoration: none; }

  /* Mini app toolbar + library panel (Pro demo) */
  .gd-toolbar {
    display: flex;
    gap: 2px;
    padding: 4px 8px;
    background: #17191c;
    border-bottom: 1px solid #26292c;
    font-size: 10.5px;
    color: var(--text-dim);
    flex-shrink: 0;
  }
  .gd-toolbar span { padding: 2px 9px; border-radius: 4px; }
  .gd-toolbar .save { color: var(--text); background: #21252a; }
  .gd-libwrap { flex: 1; display: flex; min-height: 0; }
  .gd-libwrap .gd-canvas { flex: 1; }
  .gd-lib {
    width: 232px;
    flex-shrink: 0;
    background: #141618;
    border-right: 1px solid #26292c;
    padding: 10px 0;
    overflow: hidden;
  }
  .gd-lib-head { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-dim); padding: 0 12px 8px; }
  .gd-lib-search {
    margin: 0 10px 10px;
    background: #1b1e21;
    border: 1px solid #2b2f33;
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 10.5px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
  }
  .gd-lib-search .mag { color: var(--text-dim); }
  .gd-lib-search .ch-ph { font-size: 10px; }
  .gd-lib-folder { padding: 5px 12px 4px; color: var(--text-dim); font-size: 10.5px; }
  .gd-lib-entry {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px 4px 24px;
    font-size: 11px;
    color: var(--text);
    transition: opacity 0.3s ease, background 0.2s ease;
    white-space: nowrap;
  }
  .gd-lib-entry i { font-style: normal; color: #5a5f64; font-size: 10px; }
  .gd-lib-entry i.fav { color: var(--vector, #f0b428); }
  .gd-lib-entry .tagchip { margin-left: auto; font-size: 8.5px; font-family: 'JetBrains Mono', monospace; color: var(--text-dim); border: 1px solid var(--border); padding: 0 5px; border-radius: 6px; }
  .gd-lib-entry.active { background: rgba(74, 158, 237, 0.14); }
  .gd-lib-entry.dimmed { opacity: 0.25; }
  .gd-lib-entry.hit { background: color-mix(in srgb, var(--accent) 16%, transparent); }

  /* Demo underbar: caption left, mode pills right */
  .demo-underbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem 1.5rem;
    flex-wrap: wrap;
    margin-top: 0.9rem;
  }
  .demo-underbar .demo-caption { margin: 0; }
  .understand .demo-underbar, .features .demo-underbar { max-width: 1100px; margin: 0.9rem auto 0; }
  .connector-teaser .demo-underbar { max-width: 1036px; margin: 0.9rem auto 0; }
  /* Demo loop: fade out just before the cycle resets (no hard cut) */
  .demo-stage .gd-stagebox { transition: opacity 0.25s ease; }
  .demo-stage.gd-resetting .gd-stagebox { opacity: 0; }

  /* UMG hierarchy tree (connector widget pane) */
  .wd-tree {
    position: absolute;
    background: #141618;
    border: 1px solid #2c2f33;
    border-radius: 6px;
    padding: 9px 12px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 11.5px;
    color: #cfd2d4;
  }
  .wd-tree-title { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }
  .wd-tree-row { padding: 2.5px 0; white-space: nowrap; }
  .wd-tree-row.i1 { padding-left: 14px; }
  .wd-tree-row.i2 { padding-left: 28px; }
  .wd-tree-row.i3 { padding-left: 42px; }

  /* ─── BRING-YOUR-OWN-AI DEMO ────────────── */
  .ai-demo-picker { display: flex; gap: 8px; margin: 1.6rem 0 1rem; flex-wrap: wrap; }
  .ai-demo-picker button {
    flex: 1 1 0;
    min-width: 150px;
    text-align: left;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-dim);
    transition: border-color 0.2s ease, background 0.2s ease;
  }
  .ai-demo-picker button strong { display: block; color: var(--text); font-size: 0.92rem; margin-bottom: 2px; }
  .ai-demo-picker button span { font-size: 0.7rem; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.03em; }
  .ai-demo[data-path="mcp"] .ai-demo-picker button[data-path="mcp"],
  .ai-demo[data-path="copy"] .ai-demo-picker button[data-path="copy"],
  .ai-demo[data-path="gem"] .ai-demo-picker button[data-path="gem"],
  .ai-demo[data-path="api"] .ai-demo-picker button[data-path="api"] {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 9%, var(--bg3));
  }
  .ai-demo[data-path="mcp"] .ai-demo-picker button[data-path="mcp"] strong,
  .ai-demo[data-path="copy"] .ai-demo-picker button[data-path="copy"] strong,
  .ai-demo[data-path="gem"] .ai-demo-picker button[data-path="gem"] strong,
  .ai-demo[data-path="api"] .ai-demo-picker button[data-path="api"] strong { color: var(--accent); }
  .ai-demo .ai-detail { display: none; margin-top: 0.9rem; }
  .ai-demo[data-path="mcp"] .ai-detail[data-path="mcp"],
  .ai-demo[data-path="copy"] .ai-detail[data-path="copy"],
  .ai-demo[data-path="gem"] .ai-detail[data-path="gem"],
  .ai-demo[data-path="api"] .ai-detail[data-path="api"] { display: block; }
  .ai-demo .demo-stage { display: none; }
  body[data-demo-mode="blueprint"] .ai-demo[data-path="mcp"] .demo-stage[data-path="mcp"][data-dmode="blueprint"],
  body[data-demo-mode="material"] .ai-demo[data-path="mcp"] .demo-stage[data-path="mcp"][data-dmode="material"],
  body[data-demo-mode="widget"] .ai-demo[data-path="mcp"] .demo-stage[data-path="mcp"][data-dmode="widget"],
  body:not([data-demo-mode]) .ai-demo[data-path="mcp"] .demo-stage[data-path="mcp"][data-dmode="blueprint"],
  body[data-demo-mode="blueprint"] .ai-demo[data-path="copy"] .demo-stage[data-path="copy"][data-dmode="blueprint"],
  body[data-demo-mode="material"] .ai-demo[data-path="copy"] .demo-stage[data-path="copy"][data-dmode="material"],
  body[data-demo-mode="widget"] .ai-demo[data-path="copy"] .demo-stage[data-path="copy"][data-dmode="widget"],
  body:not([data-demo-mode]) .ai-demo[data-path="copy"] .demo-stage[data-path="copy"][data-dmode="blueprint"],
  body[data-demo-mode="blueprint"] .ai-demo[data-path="gem"] .demo-stage[data-path="gem"][data-dmode="blueprint"],
  body[data-demo-mode="material"] .ai-demo[data-path="gem"] .demo-stage[data-path="gem"][data-dmode="material"],
  body[data-demo-mode="widget"] .ai-demo[data-path="gem"] .demo-stage[data-path="gem"][data-dmode="widget"],
  body:not([data-demo-mode]) .ai-demo[data-path="gem"] .demo-stage[data-path="gem"][data-dmode="blueprint"],
  body[data-demo-mode="blueprint"] .ai-demo[data-path="api"] .demo-stage[data-path="api"][data-dmode="blueprint"],
  body[data-demo-mode="material"] .ai-demo[data-path="api"] .demo-stage[data-path="api"][data-dmode="material"],
  body[data-demo-mode="widget"] .ai-demo[data-path="api"] .demo-stage[data-path="api"][data-dmode="widget"],
  body:not([data-demo-mode]) .ai-demo[data-path="api"] .demo-stage[data-path="api"][data-dmode="blueprint"] { display: block; }

  /* Overlapping desktop windows with a focus swap (TrackDeck-site pattern):
     the focused window is bright and on top, the other dims behind. */
  .ai-stage .ai-win { transition: filter 0.45s ease; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55); }
  .ai-stage .wA { z-index: 3; }
  .ai-stage .wB { z-index: 2; filter: brightness(0.62) saturate(0.85); }
  .ai-stage.swap .wB { z-index: 4; filter: none; }
  .ai-stage.swap .wA { filter: brightness(0.62) saturate(0.85); }
  @media (prefers-reduced-motion: reduce) {
    .ai-stage .wA, .ai-stage .wB { filter: none; }
  }
  .gd-mcp-chip {
    margin-left: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: #3fc03f;
    border: 1px solid rgba(63, 192, 63, 0.35);
    border-radius: 10px;
    padding: 1px 7px;
    white-space: nowrap;
  }

  /* Chat-app replica (brand-tinted via variables) */
  .ch-app {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: var(--ch-bg);
    border: 1px solid var(--ch-border);
    border-radius: 9px;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
  }
  .ch-claude { --ch-bg: #262624; --ch-tb: #1e1d1b; --ch-accent: #d97757; --ch-user: #393937; --ch-border: #3d3c38; }
  .ch-gpt    { --ch-bg: #212121; --ch-tb: #181818; --ch-accent: #ececec; --ch-user: #303030; --ch-border: #3a3a3a; }
  .ch-gem    { --ch-bg: #1b1c1d; --ch-tb: #131314; --ch-accent: #8ab4f8; --ch-user: #28292a; --ch-border: #333537; }
  .ch-tb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--ch-tb);
    border-bottom: 1px solid var(--ch-border);
    font-size: 12px;
    color: #d5d7d9;
  }
  .ch-brand { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
  .ch-brand i { font-style: normal; color: var(--ch-accent); font-size: 13px; }
  .ch-gpt .ch-brand i { width: 11px; height: 11px; border: 2px solid #ececec; border-radius: 50%; }
  .ch-sub { font-size: 11px; font-weight: 600; background: linear-gradient(90deg, #4b90ff, #a366ff, #ff5e5e); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .ch-tb .gd-win { margin-left: auto; display: flex; gap: 6px; }
  .ch-tb .gd-win i { width: 8px; height: 8px; border-radius: 50%; background: #3a3d40; display: block; }
  .ch-body {
    flex: 1;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 12.5px;
    line-height: 1.45;
    color: #e6e6e6;
    overflow: hidden;
  }
  .ch-msg { max-width: 84%; }
  .ch-msg.user { align-self: flex-end; background: var(--ch-user); border-radius: 14px 14px 4px 14px; padding: 8px 12px; }
  .ch-msg.ai { align-self: flex-start; }
  .ch-fade { color: #8a8e92; font-style: italic; }
  .ch-tool {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ch-border);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 11px;
    color: #b9bcbe;
    font-family: 'JetBrains Mono', monospace;
  }
  .ch-tool i { font-style: normal; color: var(--ch-accent); }
  .ch-tool small { color: #8a8e92; }
  .ch-code {
    align-self: flex-start;
    width: 88%;
    background: #0d0f11;
    border: 1px solid var(--ch-border);
    border-radius: 8px;
    overflow: hidden;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
  }
  .ch-code-head { display: flex; justify-content: space-between; padding: 4px 10px; background: rgba(255, 255, 255, 0.05); color: #9a9ea2; font-size: 9.5px; }
  .ch-copy.hit { color: var(--ch-accent); font-weight: 700; }
  .ch-code pre { margin: 0; padding: 8px 10px; color: #c8cdd2; white-space: pre; overflow: hidden; }
  .ch-input {
    margin: 0 14px 14px;
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ch-border);
    border-radius: 22px;
    padding: 9px 14px;
    font-size: 12px;
    color: #e6e6e6;
  }
  .ch-ph { color: #8a8e92; }
  .ch-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
  .ch-send { margin-left: auto; color: var(--ch-accent); font-size: 13px; flex: 0 0 auto; }
  .ch-caret { width: 1.5px; height: 13px; background: #e6e6e6; animation: gd-caret 1s steps(1) infinite; flex: 0 0 auto; }
  /* Per-brand fidelity: Claude = warm surface, squared input, ✳ response marker;
     ChatGPT = grey pill input + white circular send; Gemini = pill input, gradient ✦. */
  .ch-claude .ch-input { border-radius: 12px; background: #30302e; }
  .ch-claude .ch-msg.user { border-radius: 12px; }
  .ch-claude .ch-msg.ai::before { content: '✳ '; color: var(--ch-accent); }
  .ch-gpt .ch-input { border-radius: 24px; background: #303030; }
  .ch-gpt .ch-send { width: 20px; height: 20px; border-radius: 50%; background: #ececec; color: #212121; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
  .ch-gem .ch-input { border-radius: 24px; background: #1e1f20; }
  .ch-gem .ch-msg.ai::before { content: '✦ '; color: var(--ch-accent); }

  /* MCP settings card (GraphDeck Settings → MCP Server replica) */
  .gdset {
    position: absolute;
    left: 50%; top: 130px;
    margin-left: -180px;
    width: 360px;
    background: #1d2023;
    border: 1px solid #33373b;
    border-radius: 10px;
    padding: 14px 16px;
    z-index: 5;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  }
  .gdset-head { font-size: 12px; font-weight: 700; color: var(--text-bright); margin-bottom: 10px; }
  .gdset-row { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text); }
  .gdset-toggle { width: 34px; height: 18px; border-radius: 10px; background: #2c3034; border: 1px solid var(--border); position: relative; transition: background 0.25s ease; }
  .gdset-toggle i { position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #8a8f94; transition: left 0.25s ease, background 0.25s ease; }
  .gdset-toggle.on { background: var(--accent); border-color: transparent; }
  .gdset-toggle.on i { left: 18px; background: #0d1013; }
  .gdset-sub { margin-top: 9px; font-family: 'JetBrains Mono', monospace; font-size: 9.5px; color: var(--text-dim); }
  .ch-tools-note { align-self: center; font-family: 'JetBrains Mono', monospace; font-size: 9.5px; color: #8a8e92; border: 1px solid var(--ch-border); border-radius: 12px; padding: 3px 10px; }

  /* Gemini Gem pane: browser chrome (the Gem flow opens gemini.google.com) */
  .br-chrome { background: #202124; border-bottom: 1px solid #333537; padding: 7px 10px 8px; display: flex; flex-direction: column; gap: 6px; }
  .br-top { display: flex; align-items: center; }
  .br-tab { display: inline-flex; align-items: center; gap: 6px; background: #35363a; border-radius: 8px 8px 0 0; padding: 4px 12px 5px; font-size: 10.5px; color: #dadce0; }
  .br-tab i { font-style: normal; color: #8ab4f8; }
  .br-top .gd-win { margin-left: auto; display: flex; gap: 6px; }
  .br-top .gd-win i { width: 8px; height: 8px; border-radius: 50%; background: #3a3d40; display: block; }
  .br-url { display: flex; align-items: center; gap: 7px; background: #35363a; border-radius: 14px; padding: 4px 12px; font-size: 10px; color: #bdc1c6; }
  .br-url i { font-style: normal; font-size: 9px; opacity: 0.7; }
  .ch-gem-head { display: flex; flex-direction: column; align-items: center; gap: 1px; margin: 4px 0 6px; align-self: center; text-align: center; }
  .ch-gem-head i { font-style: normal; font-size: 20px; background: linear-gradient(135deg, #4b90ff, #a366ff, #ff5e5e); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .ch-gem-head strong { font-size: 13.5px; color: #e8eaed; }
  .ch-gem-head span { font-size: 10px; color: #8a8e92; }

  /* Generate-dialog + waiting-overlay replicas (mirrors the real app UI) */
  .gdlg {
    position: absolute;
    /* margin-centered: .gd-el's pop-in overwrites transform, so translateX would be lost */
    left: 50%; top: 46px;
    margin-left: -215px;
    width: 430px;
    background: #1d2023;
    border: 1px solid #33373b;
    border-radius: 10px;
    padding: 14px 16px;
    z-index: 5;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  }
  .gdlg-head { font-size: 12px; font-weight: 700; color: var(--text-bright); margin-bottom: 9px; }
  .gdlg-input { min-height: 46px; background: #15181a; border: 1px solid #2c3034; border-radius: 7px; padding: 8px 10px; font-size: 11.5px; color: var(--text); }
  .gdlg-input .ch-caret { display: inline-block; vertical-align: text-bottom; background: var(--accent); }
  .gdlg-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
  .gdlg-scope { font-family: 'JetBrains Mono', monospace; font-size: 9.5px; color: var(--text-dim); border: 1px solid var(--border); padding: 3px 8px; border-radius: 5px; }
  .gdlg-btn { background: var(--accent); color: #0d1013; font-weight: 700; font-size: 11.5px; border: none; border-radius: 6px; padding: 6px 14px; font-family: inherit; transition: transform 0.15s ease; }
  .gdlg-btn.pressed { transform: scale(0.94); }
  .gwait {
    position: absolute;
    inset: 0;
    background: rgba(13, 15, 17, 0.8);
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
  }
  .gwait .m { font-size: 14px; color: var(--text-bright); font-weight: 600; margin: 0; }
  .gwait .s { font-size: 10.5px; font-family: 'JetBrains Mono', monospace; color: var(--text-dim); margin: 0; }
  .gwait-btns { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
  .gwait-btns span { border: 1px solid var(--border); border-radius: 6px; padding: 5px 11px; font-size: 11px; color: var(--text); background: #22262a; }
  .gwait-btns span.primary { background: var(--accent); color: #0d1013; font-weight: 700; border-color: transparent; }
  .gspin { width: 26px; height: 26px; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); border-radius: 50%; animation: gd-spin 0.9s linear infinite; margin-bottom: 8px; }
  @keyframes gd-spin { to { transform: rotate(360deg); } }


/* ─── UE-AUTHENTIC REPLICA STYLING ─────────────────────────────
   Researched against UE5: node anatomy, editor watermarks, toolbars,
   Content Browser chrome + per-type thumbnail stripes. Scoped to
   .ue-app so the SAME graph renders GD-styled in GraphDeck windows
   and UE-styled in Unreal windows. */
.ue-app .gd-canvas {
  background-color: #262626;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.4) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16) 1px, transparent 1px);
  background-size: 128px 128px, 128px 128px, 16px 16px, 16px 16px;
}
.ue-watermark {
  position: absolute;
  right: 16px; top: 10px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.055);
  pointer-events: none;
  z-index: 1;
  font-family: 'Segoe UI', Arial, sans-serif;
  white-space: nowrap;
}
.ue-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #1c1c1c;
  border-bottom: 1px solid #111;
  font-size: 10px;
  color: #b8b8b8;
  flex-shrink: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.ue-toolbar span { padding: 2px 8px; border-radius: 3px; display: inline-flex; gap: 5px; align-items: center; }
.ue-toolbar .ue-compile { background: #252525; }
.ue-toolbar .ue-compile i { font-style: normal; color: #4caf50; }
.ue-toolbar .ue-play { margin-left: auto; color: #4caf50; }
.ue-dg {
  position: absolute;
  right: 12px; top: 10px;
  display: flex;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  overflow: hidden;
  font-size: 9.5px;
  z-index: 5;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.ue-dg span { padding: 3px 10px; color: #9a9a9a; background: #222; }
.ue-dg span.on { background: #3d3d3d; color: #eee; }
/* UE node anatomy: translucent near-black body, horizontal-gradient header,
   category colors per UE (event crimson, callable fn royal blue, latent grey,
   material expressions muted green; pin colors already match UE). */
.ue-app .gd-node {
  background: rgba(17, 17, 17, 0.94);
  border-radius: 8px;
  border-color: rgba(0, 0, 0, 0.75);
  font-family: 'Segoe UI', Arial, sans-serif;
}
.ue-app .gd-node-head {
  border-radius: 7px 7px 0 0;
  font-weight: 600;
  background: linear-gradient(90deg, var(--ue-h, #3a3a3a) 0%, color-mix(in srgb, var(--ue-h, #3a3a3a) 40%, #121212) 100%);
}
.ue-app .gd-node-bar { display: none; }
.ue-app .gd-ev   { --ue-h: #7d1010; }
.ue-app .gd-fn   { --ue-h: #1e5dbb; }
.ue-app .gd-flow { --ue-h: #4a4a4a; }
.ue-app .gm-tex  { --ue-h: #255c5c; }
.ue-app .gm-math { --ue-h: #3c4f41; }
.ue-app .gd-ev .gd-node-head::before { content: '⚡'; margin-right: 5px; opacity: 0.9; }
.ue-app .gd-fn .gd-node-head::before { content: 'ƒ'; margin-right: 5px; opacity: 0.9; font-style: italic; }
.ue-app .gd-flow .gd-node-head::before { content: '⏱'; margin-right: 5px; opacity: 0.85; }
/* UMG Designer: dashed safe-frame around the widget preview */
.ue-app .wd-prev .wd-panel { outline: 1px dashed rgba(255, 255, 255, 0.18); outline-offset: 10px; }
/* Content Browser chrome */
.cn-path { align-items: center; gap: 7px; }
.cn-path em { width: 1px; height: 14px; background: #333; margin: 0 3px; }
.cn-add { background: #2a4d2e; color: #8fd694; border-radius: 4px; padding: 2px 9px; font-weight: 600; }
.cn-imp { background: #2a2a2a; border-radius: 4px; padding: 2px 9px; }
.cn-here { color: #ddd; }
.cn-count {
  position: absolute;
  left: 16px; bottom: 12px;
  font-size: 9.5px;
  color: #8a8a8a;
  font-family: 'Segoe UI', Arial, sans-serif;
}
/* Per-type thumbnail stripes (UE asset color coding) */
.cn-tile i { position: relative; }
.cn-tile i::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--cn-stripe, transparent);
}
.st-sm { --cn-stripe: #3fb3d4; }
.st-t  { --cn-stripe: #8a2a2a; }
.st-ns { --cn-stripe: #f0a05a; }
.st-s  { --cn-stripe: #e8c153; }
.cn-tile .cn-blueprint { --cn-stripe: #3b78e7; }
.cn-tile .cn-material  { --cn-stripe: #36a95c; }
.cn-tile .cn-widget    { --cn-stripe: #9a63e8; }

/* Compact modes strip (replaces the old full-page modes card grid) */
.modes-compact { max-width: 1100px; margin: 0 auto; padding: 0 2rem 3.5rem; }
.modes-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
}
.mc-lbl { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.7rem; margin-right: 4px; }
.mc-on {
  color: var(--text-bright);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 14px;
  padding: 3px 12px;
  font-size: 0.78rem;
}
.mc-off {
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 3px 12px;
  font-size: 0.78rem;
}
.modes-callout em { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.modes-callout a { color: var(--accent); text-decoration: none; font-size: 0.78rem; margin-left: 4px; }

/* ─── CONTENT BROWSER v2 (rebuilt against real UE screenshots) ── */
.cb-canvas { background-image: none !important; background-color: #161616 !important; }
.cb-canvas .gd-toast { bottom: 32px !important; }
.cb-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; font-family: 'Segoe UI', Arial, sans-serif; font-size: 10px; }
.cb-tab { display: flex; background: #050505; padding: 4px 6px 0; flex-shrink: 0; }
.cb-tab span.on { background: #1b1b1b; border-radius: 4px 4px 0 0; padding: 3px 12px; color: #ddd; font-size: 9.5px; }
.cb-top { display: flex; align-items: center; gap: 7px; padding: 5px 8px; background: #1b1b1b; border-bottom: 1px solid #101010; color: #aaa; flex-shrink: 0; }
.cn-add b { color: #6fce74; font-weight: 800; font-size: 10px; }
.cb-nav { color: #666; }
.cb-crumb { flex: 1; display: flex; align-items: center; gap: 6px; color: #9a9a9a; min-width: 0; overflow: hidden; white-space: nowrap; }
.cb-crumb i { font-style: normal; opacity: 0.5; }
.cb-set { color: #8a8a8a; white-space: nowrap; }
.cb-body { flex: 1; display: flex; min-height: 0; background: #161616; }
.cb-side { width: 122px; flex-shrink: 0; display: flex; flex-direction: column; background: #1c1c1c; border-right: 1px solid #101010; padding: 4px 0; color: #9a9a9a; overflow: hidden; }
.cb-side-sec { padding: 4px 8px; color: #bbb; font-weight: 600; white-space: nowrap; }
.cb-coll { margin-top: auto; border-top: 1px solid #141414; }
.cb-folder { padding: 2.5px 8px 2.5px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-folder.f1 { padding-left: 26px; }
.cb-folder.f2 { padding-left: 36px; }
.cb-folder.sel { background: #25518c; color: #fff; }
.cb-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cb-filter { display: flex; align-items: center; gap: 7px; padding: 6px 8px; background: #1b1b1b; border-bottom: 1px solid #101010; color: #8a8a8a; flex-shrink: 0; }
.cb-search { flex: 1; display: flex; align-items: center; gap: 6px; background: #0d0d0d; border: 1px solid #000; border-radius: 12px; padding: 3px 10px; color: #777; }
.cb-search i { font-style: normal; }
.cb-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; padding: 10px; align-content: start; overflow: hidden; }
.cb-grid .cn-tile {
  aspect-ratio: auto;
  background: #232323;
  border: 1px solid #2c2c2c;
  border-radius: 3px;
  padding: 0;
  gap: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  box-shadow: none;
}
.cb-grid .cn-tile i { width: 100%; aspect-ratio: 1.3; background: #2e2e2e; border-radius: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.cb-grid .cn-tile span { font-size: 8.5px; color: #cfcfcf; padding: 3px 6px 0; max-width: none; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-grid .cn-tile small { font-size: 7.5px; color: #7a7a7a; padding: 1px 6px 4px; text-align: left; }
.cb-grid .cn-tile.cn-new { border-color: #2c2c2c; }
.cb-grid .cn-new span { background: #1a6dd0; color: #fff; padding-top: 3px; }
.cb-grid .cn-new small { background: #1a6dd0; color: #cfe3ff; }
.cb-status { display: flex; padding: 4px 10px; background: #151515; border-top: 1px solid #0d0d0d; color: #8a8a8a; font-size: 9px; flex-shrink: 0; }

/* Round-trip v2: zoomable canvas camera + drag-select marquee */
.trip-cam { position: absolute; inset: 0; transform-origin: 0 0; transition: transform 1s cubic-bezier(0.35, 0.05, 0.2, 1); }
.trip-marquee { width: 0; height: 0; transition: width 0.95s ease, height 0.95s ease, opacity 0.2s ease; }
.trip-marquee.drag { width: var(--mw); height: var(--mh); }
.drag-anchor { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Gen demo: Alt+Tab to Unreal - CB window comes to front, GD dims behind */
.gen-ue {
  left: 105px; top: 40px;
  width: 890px; height: 550px;
  z-index: 6;
}
.gen-ue .cb-grid { grid-template-columns: repeat(4, 1fr); }
.gen-gd { transition: filter 0.45s ease; }
.demo-stage.ue-front .gen-gd { filter: brightness(0.55) saturate(0.8); }

/* Lesson invite state */
.lesson-hint { font-size: 19px; text-align: center; line-height: 1.5; }
.gd-stepper.attract { animation: gd-stepper-pulse 1.7s ease-in-out infinite; }
@keyframes gd-stepper-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 22%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .gd-stepper.attract { animation: none; }
}

/* Lesson hint: chalk card plate so it reads over the full graph */
.lesson-hint {
  background: rgba(10, 11, 12, 0.85);
  border: 1px dashed rgba(232, 228, 218, 0.35);
  border-radius: 12px;
  padding: 14px 24px;
}

/* Lesson invite title card (replaces the floating hint note) */
.lesson-card {
  position: absolute;
  left: 0; right: 0; top: 31%;
  margin: 0 auto;
  width: max-content;
  max-width: 72%;
  text-align: center;
  z-index: 7;
  font-family: 'BoardHand', 'Kalam', 'Segoe Print', cursive;
  color: #E9E4D8;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
  background: rgba(13, 16, 21, 0.66); /* app card backing */
  border: 1px solid rgba(233, 228, 216, 0.12); /* app backLine */
  border-radius: 12px;
  padding: 20px 34px;
}
.lesson-card strong { font-size: 34px; font-weight: 700; line-height: 1.2; } /* app sceneTitlePx */
.lesson-card span { font-size: 16px; color: rgba(233, 228, 216, 0.78); }
.lesson-card em { font-style: normal; font-size: 17.5px; color: #82D4BC; }

/* Invite card: staggered write-in when it appears */
.lesson-card strong, .lesson-card span, .lesson-card em {
  opacity: 0;
  transform: translateY(9px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.lesson-card.in strong { opacity: 1; transform: none; transition-delay: 0.1s; }
.lesson-card.in span { opacity: 1; transform: none; transition-delay: 0.5s; }
.lesson-card.in em { opacity: 1; transform: none; transition-delay: 0.95s; }
@media (prefers-reduced-motion: reduce) {
  .lesson-card strong, .lesson-card span, .lesson-card em { transition: none; opacity: 1; transform: none; }
}

/* Board-tool breadth: flow traces + numbered badges (group rects and pin
   rings reuse the .stroke chalk draw) */
.gd-chalk .trace {
  fill: none;
  stroke: #82D4BC;
  stroke-width: 4.5; /* app traceW: THE highlighted path, not another wire */
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.gd-chalk .trace.draw { opacity: 0.85; }
.gd-chalk .trace.gone { opacity: 0; }
.gd-chalk .trace-pulse {
  fill: none;
  stroke: #DFF6EC;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 28 572;
  stroke-dashoffset: 600;
  opacity: 0;
}
.gd-chalk .trace-pulse.draw { opacity: 0.95; animation: gd-trace-pulse 3.2s linear infinite; }
.gd-chalk .trace-pulse.gone { opacity: 0; }
@keyframes gd-trace-pulse { from { stroke-dashoffset: 600; } to { stroke-dashoffset: 0; } }
.gd-chalk .gd-num circle {
  fill: rgba(13, 16, 21, 0.66); /* app backing */
  stroke: #E9E4D8;
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.gd-chalk .gd-num text {
  fill: #E9E4D8;
  font-family: 'BoardHand', 'Kalam', 'Segoe Print', cursive;
  font-size: 19px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.gd-chalk .gd-num.draw circle, .gd-chalk .gd-num.draw text { opacity: 1; }
.gd-chalk .gd-num.gone circle, .gd-chalk .gd-num.gone text { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .gd-chalk .trace.draw { animation: none; }
}

/* Hand wobble: approximates boardChalk's roughen() (amp 1.35 / wave 34) */
.gd-chalk .wob { filter: url(#chalkWob); }

/* Chalk grain: porous stroke texture (approximates the renderer's
   per-segment width noise). Strokes only - text stays clean like the app. */
.gd-chalk .stroke { filter: url(#chalkGrain); }
.gd-chalk .gd-num circle { filter: url(#chalkGrain); }

/* Library v2: full graphs per entry, scaled into the canvas */
.lib-g { position: absolute; inset: 0; }
.lib-cam { position: absolute; inset: 0; transform: scale(0.62); transform-origin: 0 0; }
.lib-g .gd-valid { left: 14px; bottom: 12px; }
.mm-box { height: 140px; background: #101418; border: 1px solid #2c2c2c; border-radius: 4px; margin-bottom: 4px; background-image: radial-gradient(circle, rgba(130, 212, 188, 0.35) 2px, transparent 2px), linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px); background-size: 100% 100%, 24px 24px, 24px 24px; background-position: 62% 38%, 0 0, 0 0; background-repeat: no-repeat, repeat, repeat; }

  a.mc-on { text-decoration: none; }
  a.mc-on:hover { filter: brightness(1.25); }
