  :root {
    --paper: #f4ebe0; --card: #fbf6ef; --ink: #2a2622; --muted: #6f665c; --line: #e2d6c6; --line-2: #cdbfab;
    --green: #cfe5b8; --green-ink: #3d6b26; --red: #f3c9c2; --red-ink: #a8402f; --blue: #c9d8f6; --blue-ink: #2f4f9a;
    --amber: #f6e2b5; --purple: #e1d3f5;
    --req: #ef9f57; --res: #6fbf6f; --msg: #e6bf4f; --slow: #e0674f;
    --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font: 13px/1.6 var(--font); color: var(--ink); background: var(--paper); min-height: 100vh; }
  button { font: inherit; color: inherit; cursor: pointer; }

  .top { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; }
  .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
  .logo i { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--blue), var(--purple)); border: 1.5px solid var(--ink); display: inline-block; }
  .logo span { background: #dfe9c8; padding: 0 4px; }
  .top small { color: var(--muted); }

  .wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; padding: 0 22px 22px; max-width: 1400px; margin: 0 auto; }
  .card { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; }

  .scene-card { padding: 18px 20px 14px; display: flex; flex-direction: column; }
  .crumb { color: var(--muted); font-size: 12px; }
  .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
  h1 { font-size: 28px; letter-spacing: -.02em; margin: 2px 0 2px; }
  .sub { color: var(--muted); }
  .chips { display: flex; gap: 6px; flex-wrap: wrap; }
  .chip { border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 11px; background: var(--amber); }
  .chip.g { background: var(--green); } .chip.p { background: var(--purple); }

  .metrics { display: flex; gap: 8px; margin: 14px 0 0; flex-wrap: wrap; align-items: flex-start; }
  .metric { min-width: 120px; padding: 6px 10px 6px 12px; border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff9f2; position: relative; }
  .metric small { display: block; font-size: 9.5px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
  .metric b { font-size: 15px; transition: color .4s; }
  .metric.bad::before, .metric.good::before { content: ""; position: absolute; left: -1.5px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; }
  .metric.bad::before { background: var(--slow); } .metric.bad b { color: var(--red-ink); }
  .metric.good::before { background: var(--res); } .metric.good b { color: var(--green-ink); }
  .controls { margin-left: auto; display: flex; gap: 6px; }
  .btn-s { border: 1.5px solid var(--ink); background: #fff; border-radius: 7px; padding: 4px 10px; font-size: 12px; }
  .btn-s:hover { background: var(--amber); }

  .stage { position: relative; flex: none; height: clamp(360px, calc(100vh - 380px), 620px); margin-top: 8px; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--line);
    background: radial-gradient(ellipse at 50% 40%, #fbf5ec 0%, #f4eadc 70%, #efe3d2 100%); }
  .stage svg { width: 100%; height: 100%; display: block; }
  .stroke { stroke: var(--ink); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
  .node .body { transform-box: fill-box; transform-origin: 50% 100%; }
  .node { transition: opacity .5s; }
  .node.hidden { opacity: 0; pointer-events: none; }
  .node.enter .body { animation: drop .8s cubic-bezier(.3,1.5,.5,1) both; }
  .node.hit .body { animation: hit .35s ease-out; }
  .node.busy .body { animation: shake .45s ease-in-out infinite; }
  @keyframes drop { 0% { opacity: 0; transform: translateY(-28px) scale(.9); } 60% { opacity: 1; } 100% { transform: none; } }
  @keyframes hit { 40% { transform: translateY(-3px) scale(1.035); } }
  @keyframes shake { 25% { transform: translateX(-1.6px); } 75% { transform: translateX(1.6px); } }
  .plate { transition: opacity .6s; } .plate.hidden, .shadow.hidden { opacity: 0; }
  .shadow { transition: opacity .6s; }
  .ripple { fill-opacity: .18; stroke-width: 2; animation: ripple 1.1s ease-out forwards; transform-box: fill-box; transform-origin: center; }
  @keyframes ripple { from { transform: scale(.4); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
  .top-label { font: 700 12px var(--font); fill: var(--ink); text-anchor: middle; }
  .top-sub { font: 500 9.5px var(--font); fill: #5d554b; text-anchor: middle; }
  .pill rect, .flow-label rect { fill: #fffdf9; stroke: var(--ink); stroke-width: 1.4; }
  .pill text, .flow-label text { font: 500 11px var(--font); fill: var(--ink); text-anchor: middle; }
  .badge rect { stroke: var(--ink); stroke-width: 1.4; }
  .badge text { font: 700 11px var(--font); text-anchor: middle; }
  .badge, .flow-label { animation: fadeUp .5s ease both; }
  @keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
  .edge { fill: none; stroke: #bfb09b; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke .4s, stroke-width .4s; }
  .edge.on { stroke: var(--ink); stroke-width: 2.2; }
  .edge.dash { stroke-dasharray: 6 6; }
  .edge.draw { animation: drawIn .8s ease-out both; }
  @keyframes drawIn { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
  .x-mark { stroke: var(--red-ink); stroke-width: 4; stroke-linecap: round; }

  .callout { position: absolute; right: 14px; bottom: 12px; width: min(300px, 45%);
  }
  .callout.pos-bl { right: auto; left: 14px; } .callout.pos-tr { bottom: auto; top: 12px; } .callout.pos-tl { right: auto; left: 14px; bottom: auto; top: 12px; }
  .callout { background: #fff; border: 1.5px solid var(--ink); border-radius: 8px; padding: 10px 12px; box-shadow: 3px 3px 0 rgba(42,38,34,.15);
    opacity: 0; transform: translateY(10px); transition: opacity .5s .3s, transform .5s .3s; }
  .callout.on { opacity: 1; transform: none; }
  .callout h5 { font-size: 10px; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
  .callout ol { padding-left: 18px; }
  .callout li.hot { background: var(--red); border-radius: 3px; padding: 0 4px; margin-left: -4px; list-style-position: inside; }

  .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); padding: 8px 2px 4px; }
  .legend span { display: inline-flex; align-items: center; gap: 5px; }
  .legend i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--ink); display: inline-block; }

  .stepper { border-top: 1.5px solid var(--line); margin-top: 8px; padding-top: 10px; }
  .stepper-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
  .stepper ol { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: relative; }
  .stepper ol::before { content: ""; position: absolute; left: 4%; right: 4%; top: 13px; height: 1.5px; background: var(--line-2); }
  .stepper li { text-align: center; position: relative; }
  .stepper button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; font-size: 10.5px; color: var(--muted); }
  .stepper .dot { width: 27px; height: 27px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--card); display: grid; place-items: center; font-size: 11px; transition: all .3s; }
  .stepper li.done .dot { background: var(--green); border-color: var(--ink); color: var(--ink); }
  .stepper li.now .dot { background: var(--ink); color: #fff; border-color: var(--ink); transform: scale(1.12); }
  .stepper li.now button { color: var(--ink); font-weight: 700; }

  .side { display: flex; flex-direction: column; gap: 18px; }
  .panel { padding: 18px; display: flex; flex-direction: column; min-height: 470px; }
  .panel-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
  .tag { border: 1.5px solid currentColor; border-radius: 6px; padding: 1px 8px; font-size: 10px; font-weight: 700; letter-spacing: .06em; }
  .tag.PROBLEM { color: var(--red-ink); background: #fbe9e5; } .tag.TECHNIQUE { color: var(--blue-ink); background: #e8eefc; }
  .tag.SOLUTION { color: var(--green-ink); background: #eaf4df; } .tag.RECAP { color: #6a4fa0; background: #f0e9fb; }
  .panel h2 { font-size: 17px; margin: 10px 0 8px; line-height: 1.35; }
  .panel p { margin-bottom: 9px; color: #3d3730; }
  .panel b.k { background: #fff0c9; padding: 0 3px; border-radius: 3px; }
  .note { display: flex; gap: 10px; border: 1.5px solid var(--line-2); border-radius: 9px; padding: 10px; margin: 6px 0 10px; font-size: 12px; }
  .note.warn { background: #fbe9e5; border-color: #ecc2b8; } .note.tip { background: #edf5e3; border-color: #cfe2b9; }
  .note small { display: block; font-size: 9.5px; letter-spacing: .08em; font-weight: 700; color: var(--muted); }
  .changed h6 { font-size: 9.5px; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
  .changed li { list-style: none; font-size: 12px; display: flex; gap: 8px; }
  .changed li::before { content: "+"; font-weight: 700; color: var(--green-ink); }
  .changed li.minus::before { content: "−"; color: var(--red-ink); }
  .nav { margin-top: auto; display: flex; gap: 8px; padding-top: 12px; }
  .nav button { border: 1.5px solid var(--ink); border-radius: 8px; padding: 8px 12px; background: #fff; }
  .nav .next { flex: 1; background: var(--green); display: flex; justify-content: space-between; font-weight: 700; }
  .nav button:disabled { opacity: .4; cursor: default; }
  .keys { font-size: 10.5px; color: var(--muted); margin-top: 8px; }
  .keys kbd { border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; background: #fff; font: inherit; }
  .learn { padding: 16px 18px; }
  .learn h6 { font-size: 10px; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
  .learn li { list-style: none; display: flex; gap: 9px; font-size: 12px; margin-bottom: 5px; color: var(--muted); transition: color .3s; }
  .learn li i { width: 15px; height: 15px; flex: none; border: 1.5px solid var(--line-2); border-radius: 4px; margin-top: 2px; display: grid; place-items: center; font-style: normal; font-size: 10px; transition: all .3s; }
  .learn li.ok { color: var(--ink); } .learn li.ok i { background: var(--green); border-color: var(--ink); }
  .learn li.ok i::after { content: "✓"; }
  .text-in { animation: textIn .45s ease; }
  @keyframes textIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

  /* v3 additions: story pills, key idea, drill-in, Neo icons */
  .stepper ol.pills { display: flex; flex-wrap: wrap; gap: 6px; }
  .stepper ol.pills::before { display: none; }
  .pills button { flex-direction: row; gap: 6px; border: 1.5px solid var(--line-2); border-radius: 999px; padding: 3px 10px 3px 4px; background: #fff9f2; width: auto; font-size: 11px; color: var(--muted); }
  .pills button b { width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-size: 10px; color: var(--ink); }
  .pills li.fail button { border-style: dashed; border-color: #e3a497; }
  .pills li.done button { background: #eef5e4; border-color: #b9d69c; color: var(--ink); } .pills li.done button b { background: var(--green); }
  .pills li.now button { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; } .pills li.now button b { background: #fff; }
  .key { border: 1.5px solid #d9c98f; background: #fff7dc; border-left: 4px solid #e6bf4f; border-radius: 9px; padding: 9px 11px; margin: 4px 0 10px; font-size: 12px; }
  .key small { display: block; font-size: 9.5px; letter-spacing: .08em; font-weight: 700; color: #8a6d1d; }
  .code-mini { background: #2a2622; color: #f4ebe0; border-radius: 8px; padding: 8px 10px; font-size: 11px; margin: 4px 0 10px; white-space: pre-wrap; }
  .tag.FAILURE { color: var(--red-ink); background: #fbe9e5; } .tag.ZOOM-IN { color: #6a4fa0; background: #f0e9fb; } .tag.MACRO { color: var(--blue-ink); background: #e8eefc; }
  .world { transition: opacity .55s ease; }
  .world.away { opacity: 0; }
  .drill { position: absolute; inset: 0; opacity: 0; transform: scale(.35); pointer-events: none; transition: opacity .5s ease .25s, transform .75s cubic-bezier(.22,.85,.32,1) .15s; }
  .drill.on { opacity: 1; transform: none; }
  .drill svg { width: 100%; height: 100%; }
  .drill-head { position: absolute; left: 16px; top: 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); background: #fffdf9; border: 1.5px solid var(--line-2); border-radius: 999px; padding: 3px 12px; }
  .crumb-chip { position: absolute; left: 14px; top: 12px; font-size: 11px; background: #fffdf9; border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px 11px; transition: opacity .3s; }
  .neo-ic { animation: floatY 3.4s ease-in-out infinite; }
  @keyframes floatY { 50% { transform: translateY(-4px); } }
  .pulse-ring { fill: none; stroke-width: 2.5; animation: pring 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
  @keyframes pring { from { opacity: .8; transform: scale(.7); } to { opacity: 0; transform: scale(1.6); } }

  .aura { opacity: .32; transition: opacity .6s; transform-box: fill-box; transform-origin: 50% 50%; }
  .aura.hidden { opacity: 0; }
  .aura.on { animation: auraBreath 2.6s ease-in-out infinite; }
  .aura.err { animation: auraErr 1.4s ease-in-out infinite; }
  .aura.flash { animation: auraFlash .6s cubic-bezier(.22,1,.36,1) 1; }
  @keyframes auraBreath { 0%,100% { opacity: .45; transform: scale(1); } 50% { opacity: .9; transform: scale(1.12); } }
  @keyframes auraFlash { 35% { opacity: .95; transform: scale(1.22); } 100% { opacity: .38; transform: scale(1); } }
  @keyframes auraErr { 0%,100% { opacity: .3; } 50% { opacity: .85; } }
  .node.send .body { animation: bSend .6s cubic-bezier(.22,1,.36,1) 1; }
  .node.recv .body { animation: bRecv .6s cubic-bezier(.34,1.45,.64,1) 1; }
  .node.focus .body { animation: bFocus 2.6s ease-in-out infinite; }
  @keyframes bSend { 28% { transform: translateY(-5px) scale(1.03,.98); } 65% { transform: translateY(-1px); } }
  @keyframes bRecv { 30% { transform: translateY(4px) scale(1.04,.96); } 65% { transform: translateY(-2px); } }
  @keyframes bFocus { 50% { transform: translateY(-2.5px); } }
  @media (max-width: 980px) { .wrap { grid-template-columns: 1fr; } .scene-card { min-height: 0; } .stepper button span { display: none; } }
  @media (max-width: 640px) { .stage { height: 300px; } .callout { position: static; width: auto; margin: 8px 0 0; } .stage { overflow: hidden; } .callout:not(.on) { display: none; } .top small { display: none; } h1 { font-size: 23px; } .wrap, .top { padding-left: 12px; padding-right: 12px; } }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.embed header.top { display: none; }
