/* Everything lives in existing padding/margins: no layout space, no click-blocking layer. */
.ambient-host{position:relative}
.ambient-rail{position:absolute;inset:-36px 4.2% auto;height:28px;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;pointer-events:none;font:9px/1.4 var(--mono);letter-spacing:.5px;color:#a4bbc3;user-select:none}
.ambient-rail--inset{top:5px}
.ambient-line{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:clip;opacity:0;max-width:66%}
.ambient-line.is-present{opacity:.62}
.ambient-stamp{margin-left:auto;white-space:nowrap;opacity:.28;font-size:8px;letter-spacing:1px}
.ambient-stamp:before{content:'[ ';color:#7798a8}.ambient-stamp:after{content:' ]';color:#7798a8}
.ambient-line.is-feedback{opacity:.5}
.ambient-rail .is-intercepted{color:#ff8170;opacity:.95}
.ambient-has-radar{padding-right:40px}
.ambient-radar{position:absolute;right:0;top:0;width:27px;height:27px;overflow:hidden;border:1px solid #8da5b948;border-radius:50%;background:#14232b;opacity:.42;isolation:isolate}
.ambient-radar .radar-grid{background:radial-gradient(circle,transparent 28%,#86a6b441 30% 32%,transparent 34% 61%,#86a6b438 63% 65%,transparent 67%),linear-gradient(90deg,transparent 49%,#91a8b23b 50%,transparent 52%),linear-gradient(0deg,transparent 49%,#91a8b23b 50%,transparent 52%)}
.ambient-radar .radar-sweep{background:conic-gradient(transparent 280deg,#96b9ca16 300deg,#adced767 357deg,transparent 360deg);animation:radar-sweep var(--ambient-radar-sweep,9s) steps(24) infinite;animation-play-state:paused}
.ambient-page-active .ambient-in-view .ambient-radar .radar-sweep{animation-play-state:running}
.ambient-blips{position:absolute;inset:0;z-index:3;opacity:0}
.ambient-blip{position:absolute;width:2px;height:2px;background:#a9d1df}
.ambient-blip:nth-child(2){background:#bd6156}
.ambient-blips.is-scanning{animation:ambient-contact-fade var(--ambient-radar-fade,.8s) linear both}
@keyframes ambient-contact-fade{from{opacity:1}to{opacity:0}}
.ambient-cursor-title{position:relative}
.ambient-cursor-title:after{content:'█';position:absolute;left:100%;top:0;margin-left:6px;color:#93adb7;opacity:.4;animation:ambient-caret 1.4s steps(1,end) infinite;animation-play-state:paused;font:9px var(--mono)}
.ambient-page-active .ambient-cursor-title.ambient-in-view:after{animation-play-state:running}
@keyframes ambient-caret{50%{opacity:0}}
.ambient-moth{position:absolute;top:-8px;width:44px;height:44px;display:grid;place-items:center;padding:0;border:0;background:transparent;color:#d54640;pointer-events:auto;touch-action:manipulation;z-index:1;animation:ambient-moth-path var(--moth-duration,11s) steps(10,end) infinite alternate;animation-play-state:running}
.ambient-moth[hidden]{display:none}
.ambient-moth-visual{display:grid;width:32px;aspect-ratio:36/29;pointer-events:none;animation:ambient-flutter var(--ambient-flutter,.72s) steps(1,end) infinite;animation-play-state:running}
.ambient-moth-visual canvas{grid-area:1/1;display:block;width:32px;height:auto;image-rendering:pixelated;pointer-events:none}
.ambient-moth-sprite{opacity:.95;animation:ambient-moth-signal 2.4s steps(1,end) infinite;animation-delay:var(--moth-glitch-offset);animation-play-state:running}
.ambient-moth-echo{opacity:.7;animation:ambient-moth-tear 1.3s steps(1,end) infinite;animation-delay:var(--moth-glitch-offset);animation-play-state:running}
.ambient-moth-echo--2{animation-duration:1.9s;animation-direction:reverse;opacity:.6}
.ambient-motion-paused .ambient-moth,.ambient-motion-paused .ambient-moth-visual,.ambient-motion-paused .ambient-moth-sprite,.ambient-motion-paused .ambient-moth-echo{animation-play-state:paused!important}
.ambient-moth:hover,.ambient-moth:focus-visible,.ambient-moth.is-perched{animation-play-state:paused!important}
.ambient-moth:focus-visible{outline:1px dashed #aa5b56;outline-offset:0}
.ambient-moth-fragments{position:absolute;inset:0;display:none;place-items:center;font:9px var(--mono)}
.ambient-moth-fragments i{position:absolute;font-style:normal;animation:ambient-fragment .6s steps(5,end) both}
.ambient-moth.is-terminated .ambient-moth-sprite{animation:ambient-moth-glitch .24s steps(1,end) both}
.ambient-moth.is-terminated .ambient-moth-fragments{display:grid}
.ambient-moth.is-terminated .ambient-moth-echo{display:none}
.ambient-has-moth .ambient-stamp{visibility:hidden}
.ambient-has-moth .ambient-line{max-width:max(0px,calc(var(--moth-x) - 12px))}
@keyframes ambient-moth-path{0%{opacity:1;transform:translate(0,3px)}10%{opacity:1}28%{transform:translate(18px,-3px)}52%{transform:translate(var(--moth-travel),2px)}60%,90%{opacity:1;transform:translate(var(--moth-travel),0)}100%{opacity:1;transform:translate(var(--moth-travel),0)}}
@keyframes ambient-flutter{0%,100%{transform:scaleX(1) rotate(-4deg)}35%{transform:scaleX(.4) rotate(4deg)}65%{transform:scaleX(.85) rotate(-2deg)}}
@keyframes ambient-moth-signal{0%,100%{translate:0 0;filter:drop-shadow(1px 0 #8cd4ca60);opacity:.95;clip-path:inset(0)}18%{translate:1px 0;filter:drop-shadow(-1px 0 #ef647d80);opacity:.9;clip-path:inset(0)}24%{translate:-2px 1px;filter:drop-shadow(2px 0 #8cd4ca90);opacity:.42;clip-path:polygon(0 0,100% 0,100% 36%,70% 36%,70% 46%,100% 46%,100% 100%,0 100%,0 72%,22% 72%,22% 60%,0 60%)}30%,56%{translate:0 0;filter:drop-shadow(-1px 0 #ef647d70);opacity:.95;clip-path:inset(0)}65%{translate:2px 0;filter:drop-shadow(-2px 0 #8cd4ca90);opacity:.55;clip-path:polygon(0 0,100% 0,100% 58%,78% 58%,78% 70%,100% 70%,100% 100%,0 100%,0 35%,28% 35%,28% 24%,0 24%)}71%,88%{translate:-1px 0;filter:drop-shadow(1px 0 #8cd4ca60);opacity:.95;clip-path:inset(0)}}
@keyframes ambient-moth-tear{0%,100%{clip-path:inset(16% 0 65%);translate:2px 0}24%{clip-path:inset(46% 0 40%);translate:-3px 0}47%{clip-path:inset(68% 0 18%);translate:2px 0}71%{clip-path:inset(32% 0 54%);translate:-2px 0}}
@keyframes ambient-moth-glitch{0%{transform:translateX(-3px);opacity:1}35%{transform:translateX(3px);opacity:.4}70%{transform:translateX(-2px);opacity:1}100%{opacity:0}}
@keyframes ambient-fragment{from{transform:translate(0);opacity:.75}to{transform:translate(var(--bit-x),var(--bit-y));opacity:0}}
@media(max-width:650px){.ambient-rail{left:5%;right:5%;font-size:8px;letter-spacing:.25px}.ambient-line{max-width:100%}.ambient-stamp{display:none}.ambient-rail--inset{top:0}.ambient-has-radar{padding-right:29px}.ambient-radar{width:22px;height:22px;top:2px}.ambient-cursor-title:after{font-size:8px;margin-left:3px}}
@media(prefers-reduced-motion:reduce){.ambient-rail .radar-sweep{animation:none!important}.ambient-cursor-title:after{animation-duration:2s}.ambient-blips{display:none!important}.ambient-moth{animation-duration:32s}.ambient-moth-visual{animation-duration:1.8s}.ambient-moth-sprite{animation-duration:3.6s}.ambient-moth-echo{animation-duration:2.6s}.ambient-moth-echo--2{animation-duration:3.2s}.ambient-moth.is-terminated .ambient-moth-sprite{opacity:0}.ambient-moth-fragments i{animation:ambient-contact-fade .6s linear both}.ambient-cursor-title:after{opacity:.3}}
@media print{.ambient-rail,.ambient-cursor-title:after{display:none!important}}

/* One fixed-height line inside each existing margin; never reflows original copy. */
.ambient-code-anchor{position:relative}
.ambient-code{position:absolute;top:calc(100% + 5px);left:0;width:100%;height:12px;overflow:hidden;white-space:nowrap;pointer-events:none;user-select:none;color:#a7c68c;opacity:.72;font:9px/12px var(--mono);font-weight:400;font-style:normal;letter-spacing:.25px;text-transform:none;text-align:left}
.ambient-code.is-intercepted{color:#ff8170;opacity:1;text-shadow:1px 0 #9b254b,-1px 0 #ffb77a;background:linear-gradient(90deg,#56271f80,transparent);box-shadow:inset 2px 0 #ff8170;padding-left:5px}
@media(max-width:650px){.ambient-code{font-size:8px;letter-spacing:0;top:calc(100% + 3px)}}
@media(prefers-reduced-motion:reduce){.ambient-code{opacity:.62}}
@media print{.ambient-code{display:none!important}}

/* Cursor belongs only to the decorative terminal text. */
.is-streaming:after{content:'_';display:inline;color:currentColor;animation:ambient-caret .8s steps(1,end) infinite;animation-play-state:paused}
.ambient-page-active .is-streaming:after{animation-play-state:running}
.is-streaming.is-intercepted:after{visibility:hidden}
@media(prefers-reduced-motion:reduce){.is-streaming:after{animation-duration:1.4s;opacity:.4}}

/* A few quiet live readouts in existing title margins. */
#main-title>.ambient-code,.ambient-code--subtle{opacity:.5;color:#9db382}
.dossier-panel-heading .ambient-code{top:calc(100% + 3px)}
