/* =========================================================================
   scenes.css — Scene view. Same tokens as styles.css; more cinematic.
   Grammar: HUD (top) · Surface = what the user sees (left) ·
            Backstage = what Cloudflare does (right) · Badges (overlay)
   ========================================================================= */

/* View switching: both views share one grid cell and crossfade */
.views { display: grid; position: relative; }
/* the hidden view must not set the height (network view is 860px tall on phones) */
.views > .view-off { position: absolute; inset: 0 0 auto 0; }
.view-head { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.view-head .card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-toggle { flex: none; padding: 2px; }
.view-toggle button { height: 24px; padding: 0 10px; font-size: var(--fs-12); }
.view-toggle .seg-thumb { top: 2px; bottom: 2px; left: 2px; }
.view-toggle [data-view="scene"][aria-checked="true"] { color: var(--accent); }
@media (max-width: 639px) { .view-head .card-title { display: none; } }
.views > .flow, .views > .scene-view { grid-area: 1 / 1; transition: opacity var(--d-3) var(--ease-out), visibility 0s linear var(--d-3), transform var(--d-3) var(--ease-out); }
.view-off { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.99); }
.views > .view-on { opacity: 1; visibility: visible; transition-delay: 0s; }
.architecture.is-scene .legend, .architecture.is-scene .step-chip + .legend { display: none; }

.scene-view {
  --px: 0; --py: 0;
  position: relative; height: clamp(500px, 54cqw, 600px); overflow: hidden; isolation: isolate;
  background:
    radial-gradient(ellipse 50% 60% at 30% 40%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(ellipse 40% 50% at 85% 60%, rgba(246,130,31,.07), transparent 70%),
    linear-gradient(180deg, #0a0b0e, #08090b);
}
.scene-view::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(rgba(255,255,255,.05) .8px, transparent .8px); background-size: 22px 22px; mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent); }
.sc-empty { display: grid; place-items: center; height: 100%; color: var(--text-3); }

/* HUD */
.sc-hud { position: absolute; left: 16px; right: 16px; top: 12px; z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: 12px; pointer-events: none; }
.sc-hud-title, .sc-edge { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 999px; background: rgba(12,13,16,.7); backdrop-filter: blur(10px); color: var(--text-3); font: 500 var(--fs-11)/1 var(--font-mono); letter-spacing: .04em; white-space: nowrap; }
.sc-hud-title b, .sc-edge b { color: var(--text); font-weight: 500; }
.sc-hud-title i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.sc-edge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sc-edge.is-lit { color: var(--orange-2); border-color: color-mix(in srgb, var(--orange) 45%, transparent); box-shadow: 0 0 24px -6px var(--orange); }
.sc-note { position: absolute; left: 16px; bottom: 10px; z-index: 6; color: var(--text-4); font: 500 var(--fs-11)/1 var(--font-mono); pointer-events: none; }

/* Stage layout */
.sc-stage { position: absolute; inset: 48px 16px 30px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(230px, 1fr); gap: 18px; perspective: 1400px; }
.sc-surface-col { position: relative; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sc-surface-wrap { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; transform: rotateY(calc(var(--px) * 3deg)) rotateX(calc(var(--py) * -2deg)); transform-style: preserve-3d; transition: transform .8s var(--ease-out); }
.sc-caption { color: var(--text-4); font: 500 var(--fs-11)/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.sc-back { position: relative; min-height: 0; display: flex; flex-direction: column; border: 1px solid color-mix(in srgb, var(--orange) 26%, transparent); border-radius: 18px; background: linear-gradient(180deg, rgba(246,130,31,.06), rgba(246,130,31,.015)), rgba(12,13,16,.6); box-shadow: inset 0 0 60px rgba(246,130,31,.04); transform: translate(calc(var(--px) * -6px), calc(var(--py) * -4px)); transition: transform .8s var(--ease-out), border-color var(--d-3), box-shadow var(--d-3); }
.sc-back.is-entered { border-color: color-mix(in srgb, var(--orange) 45%, transparent); box-shadow: inset 0 0 60px rgba(246,130,31,.06), 0 0 40px -18px var(--orange); }
.sc-back-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.sc-back-head b { font-size: var(--fs-12); font-weight: 600; }
.sc-back-head small { color: var(--orange-2); font: 500 var(--fs-11)/1 var(--font-mono); }
.sc-back-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px rgba(246,130,31,.18); }

/* Zones */
.sc-zone { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.sc-zone:empty { display: none; }
.sc-zone.is-overflow { justify-content: flex-end; }
.z-back { flex: 1; padding: 4px 12px 12px; }

/* Devices */
.sc-device { position: relative; display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--line-2); background: #0e0f13; box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,255,255,.06); overflow: hidden; }
.sc-phone { width: min(300px, 100%); height: 100%; max-height: 540px; border-radius: 34px; padding: 10px 10px 12px; border-width: 6px; border-color: #1d1e24; background: linear-gradient(180deg, #111218, #0b0c10); }
.sc-phone-status { display: flex; justify-content: space-between; align-items: center; padding: 2px 14px 6px; color: var(--text-2); font: 600 var(--fs-11)/1 var(--font-sans); }
.sc-island { width: 74px; height: 20px; border-radius: 12px; background: #000; }
.sc-app-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-bottom: 1px solid var(--line); }
.sc-app-head b { display: block; font-size: var(--fs-13); font-weight: 600; }
.sc-app-head small { display: flex; align-items: center; gap: 5px; color: var(--green); font-size: var(--fs-11); }
.sc-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.sc-avatar svg, .sk-ico svg, .sk-tile svg, .sc-url svg, .sc-sandbox-label svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sc-phone .z-main { flex: 1; padding: 12px 6px; justify-content: flex-end; }
.sc-phone .z-top { padding: 10px 6px 0; }
.sc-phone-input { display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 0; height: 36px; padding: 0 6px 0 14px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--text-4); font-size: var(--fs-12); }
.sc-phone-input i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #0b0b0d; font-style: normal; font-weight: 700; }
.sc-phone.is-call { background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--accent) 22%, #0b0c10), #0b0c10 70%); }
.sc-phone.is-call .sc-app-head { flex-direction: column; text-align: center; border: 0; padding-top: 18px; }
.sc-phone.is-call .sc-avatar { width: 64px; height: 64px; }
.sc-phone.is-call .sc-avatar svg { width: 28px; height: 28px; }
.sc-rec { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: ping 1.4s infinite; }
.sc-call-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 6px 2px; }
.sc-call-controls i { display: grid; place-items: center; height: 34px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--text-3); font: normal 500 var(--fs-11)/1 var(--font-sans); }
.sc-call-controls i.end { background: var(--red); color: #fff; }

.sc-window { width: 100%; height: 100%; border-radius: 14px; }
.sc-window-bar { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border-bottom: 1px solid var(--line); background: #121318; }
.sc-dots { display: flex; gap: 6px; }
.sc-dots i { width: 10px; height: 10px; border-radius: 50%; background: #2a2b31; }
.sc-dots i:first-child { background: #ff5f57; } .sc-dots i:nth-child(2) { background: #febc2e; } .sc-dots i:nth-child(3) { background: #28c840; }
.sc-url { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 7px; background: #0b0c0f; color: var(--text-3); font: 500 var(--fs-11)/1 var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-url svg { width: 12px; height: 12px; color: var(--green); }
.sc-window-title { color: var(--text-3); font-size: var(--fs-12); white-space: nowrap; }
.sc-window-body { flex: 1; min-height: 0; display: grid; gap: 12px; padding: 14px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top" "main" "bottom"; }
.layout-split .sc-window-body { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); grid-template-areas: "top top" "main side" "bottom bottom"; }
.layout-split-left .sc-window-body { grid-template-columns: minmax(150px, .8fr) minmax(0, 1.6fr); grid-template-areas: "top top" "side main" "bottom bottom"; }
.layout-ide .sc-window-body { grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); }
.z-top { grid-area: top; flex-direction: row; flex-wrap: wrap; align-items: center; }
.z-main { grid-area: main; } .z-side { grid-area: side; } .z-bottom { grid-area: bottom; }
.layout-split .sc-zone.z-side:empty, .layout-split-left .sc-zone.z-side:empty { display: flex; }
.sc-sandbox { position: relative; width: 100%; height: 100%; padding: 14px; border: 1.5px dashed color-mix(in srgb, var(--purple) 55%, transparent); border-radius: 20px; background: rgba(167,139,250,.04); }
.sc-sandbox-label { position: absolute; left: 18px; top: 0; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: #120f19; border: 1px solid color-mix(in srgb, var(--purple) 50%, transparent); color: var(--purple); font: 500 var(--fs-11)/1.4 var(--font-mono); z-index: 2; }

/* ---------------------------------------------------------- primitives */
.sk-ico { display: grid; place-items: center; flex: none; color: currentColor; }
.sk-tag { flex: none; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--text-2); font: 500 var(--fs-11)/1.4 var(--font-mono); white-space: nowrap; }
.sk-tag.tone-accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: color-mix(in srgb, var(--accent) 40%, white); }
.sk-tag.tone-warn { background: rgba(245,196,81,.15); color: var(--yellow); }
.tone-ok { --t: var(--green); } .tone-warn, .tone-wait { --t: var(--yellow); } .tone-block { --t: var(--red); } .tone-info, .tone-none { --t: var(--text-3); } .tone-accent { --t: var(--accent); }
b.tone-ok { color: var(--green); } b.tone-warn { color: var(--yellow); } b.tone-block { color: var(--red); }
mark { padding: 0 2px; border-radius: 3px; color: inherit; background: linear-gradient(color-mix(in srgb, var(--yellow) 35%, transparent), color-mix(in srgb, var(--yellow) 35%, transparent)) no-repeat 0 0 / 0% 100%; animation: mark-in .7s var(--ease-out) .5s forwards; }
@keyframes mark-in { to { background-size: 100% 100%; } }
.sk-stamped { position: relative; }

.sk-msg { position: relative; max-width: 86%; flex: none; }
.sk-msg-name { margin-bottom: 4px; color: var(--text-3); font: 500 var(--fs-11)/1 var(--font-mono); }
.sk-msg-body { padding: 9px 12px; border-radius: 16px; font-size: var(--fs-13); line-height: 1.45; }
.sk-msg.from-user { align-self: flex-end; text-align: left; }
.sk-msg.from-user .sk-msg-name { text-align: right; }
.sk-msg.from-user .sk-msg-body { border-bottom-right-radius: 5px; background: var(--blue); color: #fff; }
.sk-msg.from-agent .sk-msg-body { border-bottom-left-radius: 5px; background: var(--panel-3); border: 1px solid var(--line-2); }
.sk-msg.from-system { align-self: center; max-width: 92%; }
.sk-msg.from-system .sk-msg-body { background: rgba(245,84,91,.08); border: 1px dashed rgba(245,84,91,.4); color: #ffc9cc; font-size: var(--fs-12); text-align: center; }
.sc-window .sk-msg.from-user .sk-msg-body { background: color-mix(in srgb, var(--blue) 85%, #000); }
.sk-msg.tone-threat .sk-msg-body { background: linear-gradient(135deg, #5a1d22, #3a1418); border: 1px solid rgba(245,84,91,.5); }
.is-typing::after, .is-streaming::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: currentColor; animation: caret .8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.tk { opacity: 0; transition: opacity .25s var(--ease-out); }
.tk.on { opacity: 1; }
.sk-cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin: 0 1px; padding: 0 4px; border-radius: 5px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: color-mix(in srgb, var(--accent) 40%, white); font: 600 11px/1 var(--font-mono); vertical-align: 1px; }
.sk-pii { background: rgba(245,84,91,.3); color: #fff; text-decoration: underline wavy var(--red); animation: none; }

.sk-input { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; height: 40px; padding: 0 6px 0 12px; border: 1px solid var(--line-2); border-radius: 11px; background: #0b0c0f; color: var(--text-3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 7%, transparent); }
.sk-input-text { flex: 1; min-width: 0; color: var(--text); font-size: var(--fs-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-input-btn { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 8px; background: var(--panel-3); color: var(--text-2); font: 500 var(--fs-11)/1 var(--font-mono); }

.sk-chip { display: inline-flex; align-self: flex-start; align-items: center; gap: 7px; max-width: 100%; min-height: 30px; padding: 5px 11px; border: 1px solid color-mix(in srgb, var(--t) 40%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--t) 10%, #0e0f13); color: color-mix(in srgb, var(--t) 50%, var(--text)); font-size: var(--fs-12); font-weight: 500; flex: none; }
.sk-chip .sk-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-chip.is-mono { font-family: var(--font-mono); font-size: var(--fs-11); }
.sk-chip .sk-ico { color: var(--t); }

.sk-card, .sk-list, .sk-steps, .sk-gate, .sk-meter, .sk-traffic, .sk-table, .sk-timer { flex: none; border: 1px solid var(--line-2); border-radius: 12px; background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01)), #101116; box-shadow: var(--shadow-1); overflow: hidden; transition: max-height var(--d-4) var(--ease-out), opacity var(--d-3); max-height: 420px; }
.is-collapsed { max-height: 34px !important; opacity: .7; }
.sk-card-head { display: flex; align-items: center; gap: 10px; padding: 9px 11px; }
.sk-tile { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--t, var(--accent)) 14%, transparent); color: var(--t, var(--accent)); }
.sk-card.tone-none .sk-tile { --t: var(--accent); }
.sk-card-title { flex: 1; min-width: 0; }
.sk-card-title b { display: block; font-size: var(--fs-13); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-card-title small { display: block; color: var(--text-3); font-size: var(--fs-11); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-rows { padding: 0 11px 9px; display: grid; gap: 4px; }
.sk-row { display: flex; justify-content: space-between; gap: 10px; padding-top: 5px; border-top: 1px dashed var(--line); font-size: var(--fs-12); }
.sk-row span { color: var(--text-3); white-space: nowrap; }
.sk-row b { font-weight: 500; text-align: right; font-family: var(--font-mono); font-size: var(--fs-11); }
.sk-card.tone-ok { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.sk-card.style-slack .sk-tile { --t: #e0a3ff; }
.sk-card.style-slack .sk-row { flex-direction: column; gap: 2px; }
.sk-card.style-slack .sk-row b { text-align: left; font-family: var(--font-sans); font-size: var(--fs-12); color: var(--text); }

.sk-list-title { display: flex; align-items: center; gap: 7px; padding: 9px 11px 6px; color: var(--text-3); font: 500 var(--fs-11)/1 var(--font-mono); letter-spacing: .05em; text-transform: uppercase; }
.sk-items { display: flex; flex-direction: column; gap: 6px; padding: 0 8px 8px; }
.sk-list-title + .sk-items { padding-top: 0; }
.sk-list:not(:has(.sk-list-title)) .sk-items { padding-top: 8px; }
.sk-item { position: relative; display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.02); transition: border-color var(--d-3), background var(--d-3), box-shadow var(--d-3); }
.sk-item-text { flex: 1; min-width: 0; }
.sk-item-text b { display: block; font-size: var(--fs-12); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-item-text small { display: block; margin-top: 1px; color: var(--text-3); font-size: var(--fs-11); line-height: 1.4; }
.sk-item .sk-ico { width: 24px; height: 24px; border-radius: 7px; background: rgba(255,255,255,.05); color: var(--accent); }
.sk-item.is-cited { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.sk-bar { display: block; height: 3px; margin-top: 6px; border-radius: 2px; background: rgba(255,255,255,.07); overflow: hidden; }
.sk-bar i { display: block; height: 100%; transform: scaleX(0); transform-origin: left; background: var(--pink); border-radius: inherit; }
.sk-item.is-done { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.sk-item.is-done .sk-bar i { background: var(--green); }
.style-docs .sk-item { border-left: 2px solid color-mix(in srgb, var(--blue) 60%, transparent); }
.style-files .sk-item { padding: 6px 8px; }
.style-files .sk-item::before { content: ""; flex: none; width: 18px; height: 22px; border-radius: 3px; background: linear-gradient(135deg, transparent 70%, rgba(255,255,255,.15) 70%), color-mix(in srgb, var(--blue) 30%, #1b1d24); }
.style-chips .sk-items { flex-direction: row; flex-wrap: wrap; }
.style-chips .sk-item { flex: 1 1 auto; }
.style-agents .sk-item .sk-ico { color: var(--pink); background: rgba(244,114,182,.12); border-radius: 50%; }
.style-mail .sk-item:first-child { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.style-tickets .sk-item { border-left: 3px solid var(--blue); }
.style-tickets .sk-item:first-child .sk-tag { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.style-thumbs .sk-items { display: grid; grid-template-columns: 1fr 1fr; }
.style-thumbs .sk-item { flex-direction: column; align-items: stretch; padding: 6px; }
.style-thumbs .sk-item::before { content: ""; display: block; height: 42px; border-radius: 6px; background: linear-gradient(180deg, #f9b16e, #e86a5a 55%, #3b2a4a); }
.style-thumbs .sk-item:nth-child(2)::before { height: 30px; } .style-thumbs .sk-item:nth-child(3)::before { height: 50px; }
.style-pages .sk-item { flex-direction: column; align-items: stretch; }
.style-pages .sk-item-text b { color: var(--blue); font-family: var(--font-mono); font-size: var(--fs-11); font-weight: 500; }
.style-pages .sk-item-text small { color: var(--text-2); font-size: var(--fs-12); }
.style-queries .sk-items { flex-direction: row; flex-wrap: wrap; }
.style-queries .sk-item { padding: 4px 9px; border-radius: 999px; }
.style-queries .sk-item-text b { font-family: var(--font-mono); font-size: var(--fs-11); font-weight: 500; }
.sk-tags { display: flex; gap: 6px; margin-top: 7px; }

.sk-steps-row { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 4px 11px 11px; }
.sk-step { display: flex; align-items: center; gap: 9px; color: var(--text-3); font-size: var(--fs-12); transition: color var(--d-3); }
.sk-step i { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-3); transition: background var(--d-3), border-color var(--d-3), box-shadow var(--d-3); }
.sk-step.is-active { color: var(--text); } .sk-step.is-active i { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); animation: ping 1.1s infinite; color: var(--accent); }
.sk-step.is-done { color: var(--text); } .sk-step.is-done i { border-color: var(--green); background: var(--green); }
.sk-step.is-retry { color: var(--yellow); } .sk-step.is-retry i { border-color: var(--yellow); }
.sk-step.is-retry span::after { content: " · failed, retrying ↻"; color: var(--yellow); }
.sk-step.is-done.was-retried span::after { content: " · ↻ 1 retry"; color: var(--text-3); font-family: var(--font-mono); font-size: var(--fs-11); }
.sk-step.is-wait { color: var(--yellow); } .sk-step.is-wait i { border-color: var(--yellow); background: rgba(245,196,81,.2); }
.orient-h .sk-steps-row { flex-direction: row; justify-content: space-between; padding: 12px 14px 34px; }
.orient-h .sk-step { flex-direction: column; gap: 6px; flex: 1; text-align: center; font-size: var(--fs-11); position: relative; }
.orient-h .sk-step:not(:last-of-type)::after { content: ""; position: absolute; top: 7px; left: calc(50% + 12px); right: calc(-50% + 12px); height: 1.5px; background: var(--line-2); }
.orient-h .sk-step.is-done::after { background: var(--green); }
.sk-token { position: absolute; left: 0; bottom: 8px; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: #0b0b0d; font: 600 var(--fs-11)/1.3 var(--font-mono); white-space: nowrap; opacity: 0; transition: transform .9s var(--ease-in-out), opacity var(--d-3), background var(--d-3); }
.sk-token.is-on { opacity: 1; } .sk-token.is-wait { background: var(--yellow); }

.sk-term { flex: none; display: flex; flex-direction: column; min-height: 0; max-height: 100%; border: 1px solid var(--line-2); border-radius: 10px; background: #07080a; overflow: hidden; }
.z-bottom .sk-term, .z-main .sk-term { flex: 1 1 auto; }
.sk-term-head { display: flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-bottom: 1px solid var(--line); background: #0d0e12; }
.sk-term-head i { width: 7px; height: 7px; border-radius: 50%; background: #2a2b31; }
.sk-term-head span { margin-left: 6px; color: var(--text-3); font: 500 var(--fs-11)/1 var(--font-mono); }
.sk-term-body { flex: 1; min-height: 0; overflow: hidden; padding: 8px 10px; font: 500 var(--fs-11)/1.65 var(--font-mono); color: var(--text-2); }
.sk-line { white-space: pre-wrap; word-break: break-word; }
.sk-line.tone-dim { color: var(--text-4); } .sk-line.tone-ok { color: var(--green); } .sk-line.tone-block { color: var(--red); } .sk-line.tone-warn { color: var(--yellow); }
.sk-line.tone-add { color: #8ff0bd; background: rgba(62,207,142,.08); } .sk-line.tone-del { color: #ff9ea2; background: rgba(245,84,91,.08); text-decoration: line-through; text-decoration-color: rgba(245,84,91,.5); }

.sk-table { display: grid; }
.sk-tr { display: grid; grid-template-columns: 1.3fr repeat(calc(var(--cols, 4) - 2), 1fr) 52px; gap: 8px; padding: 7px 11px; border-top: 1px solid var(--line); font-size: var(--fs-12); align-items: center; }
.sk-th { border-top: 0; color: var(--text-3); font: 500 var(--fs-11)/1 var(--font-mono); text-transform: uppercase; letter-spacing: .05em; }
.sk-tr span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sk-meter { padding: 9px 11px; }
.sk-meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-12); color: var(--text-2); }
.sk-meter-top b { font: 600 var(--fs-16)/1 var(--font-mono); color: var(--t); }
.sk-meter-bar { height: 5px; margin: 7px 0 5px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.sk-meter-bar i { display: block; height: 100%; transform: scaleX(0); transform-origin: left; background: var(--t); border-radius: inherit; }
.sk-meter small { color: var(--text-3); font-size: var(--fs-11); }

.sk-gate { display: flex; align-items: center; gap: 10px; padding: 9px 11px; }
.sk-door { position: relative; flex: none; display: flex; width: 30px; height: 30px; border-radius: 7px; overflow: hidden; background: color-mix(in srgb, var(--green) 25%, transparent); }
.sk-door i { flex: 1; background: #2b2d35; transition: transform .7s var(--ease-out), background var(--d-3); }
.sk-gate.is-open.is-acted .sk-door i:first-child { transform: translateX(-100%); }
.sk-gate.is-open.is-acted .sk-door i:last-child { transform: translateX(100%); }
.sk-gate.is-open .sk-tag { background: rgba(62,207,142,.15); color: var(--green); }
.sk-gate.is-block { border-color: rgba(245,84,91,.5); background: rgba(245,84,91,.07); }
.sk-gate.is-block .sk-door { background: rgba(245,84,91,.3); }
.sk-gate.is-block.is-acted .sk-door i { background: var(--red); }
.sk-gate.is-block .sk-tag { background: var(--red); color: #200405; font-weight: 600; }

.sk-lane { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 14px; align-items: center; padding: 6px 0; }
.sk-lane-nodes { display: flex; align-items: center; min-width: 0; }
.sk-lane-prov { display: flex; flex-direction: column; gap: 10px; }
.sk-node { position: relative; flex: 1 1 0; min-width: 0; padding: 10px 8px; border: 1px solid var(--line-2); border-radius: 11px; background: #101116; text-align: center; transition: border-color var(--d-3), background var(--d-3), box-shadow var(--d-3), opacity var(--d-3); }
.sk-node b { display: block; font-size: var(--fs-12); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-node small { display: block; color: var(--text-4); font-size: var(--fs-11); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-node em { display: block; min-height: 15px; margin-top: 3px; font: normal 500 var(--fs-11)/1.4 var(--font-mono); color: var(--t, var(--text-3)); }
.sk-wire { flex: 0 0 14px; height: 2px; background: var(--line-2); transition: background var(--d-3), box-shadow var(--d-3); }
.sk-wire.is-on { background: var(--accent); box-shadow: 0 0 8px var(--accent); } .sk-wire.is-block { background: var(--red); }
.sk-wire.is-standby { background: repeating-linear-gradient(90deg, var(--text-4) 0 3px, transparent 3px 6px); }
.sk-node.is-pass { --t: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); background: rgba(62,207,142,.06); }
.sk-node.is-miss { --t: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 45%, transparent); }
.sk-node.is-active { --t: var(--accent); border-color: var(--accent); box-shadow: 0 0 24px -6px var(--accent); }
.sk-node.is-block { --t: var(--red); border-color: var(--red); background: rgba(245,84,91,.1); box-shadow: 0 0 24px -6px var(--red); }
.sk-node.is-standby { --t: var(--text-3); border-style: dashed; opacity: .75; }
.is-provider { text-align: left; padding-left: 12px; }
.is-provider .sk-wire.to-prov { position: absolute; right: 100%; top: 50%; width: 14px; }

.sk-stamp { position: absolute; right: 8px; top: 50%; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 2px solid var(--t); border-radius: 8px; background: rgba(8,9,11,.9); color: var(--t); font: 700 var(--fs-12)/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; transform: translateY(-50%) rotate(-4deg); box-shadow: 0 0 30px -6px var(--t); pointer-events: none; }
.sk-stamp span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--t); color: #0b0b0d; font-size: 11px; }
.sk-msg .sk-stamp { top: auto; bottom: -12px; right: -4px; transform: rotate(-4deg); }
.is-dimmed > :not(.sk-stamp):not(.sk-swarm) { opacity: .38; filter: grayscale(.8); transition: opacity var(--d-4), filter var(--d-4); }
.is-dimmed .sk-msg-body { text-decoration: line-through; text-decoration-color: rgba(245,84,91,.7); }
.sk-scan { position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; background: linear-gradient(180deg, transparent 35%, color-mix(in srgb, var(--t) 45%, transparent) 50%, transparent 65%); }

.sk-timer .sk-timer-clock { padding: 0 11px; font: 600 28px/1.1 var(--font-mono); letter-spacing: -.02em; color: var(--yellow); font-variant-numeric: tabular-nums; }
.sk-timer.is-stopped .sk-timer-clock { color: var(--text-3); }
.sk-timer-cpu { padding: 4px 11px 10px; color: var(--text-3); font-size: var(--fs-11); }
.sk-timer-cpu b { color: var(--green); font-family: var(--font-mono); }
.sk-breath { width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); animation: breath 2.4s var(--ease-in-out) infinite; }
.sk-timer.is-stopped .sk-breath { animation: none; background: var(--green); }
@keyframes breath { 50% { transform: scale(.55); opacity: .5; } }

.sk-cluster { position: relative; flex: 1 1 auto; min-height: 210px; border: 1px solid var(--line); border-radius: 12px; background: radial-gradient(circle at 50% 50%, rgba(91,156,255,.07), transparent 70%), #0b0c10; overflow: hidden; }
.sk-cluster-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.sk-cluster-lines line { stroke: var(--accent); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .7; transition: stroke-dashoffset .8s var(--ease-out); }
.sk-cluster-lines line.on { stroke-dashoffset: 0; }
.sk-cluster-axis { position: absolute; left: 10px; bottom: 8px; color: var(--text-4); font: 500 var(--fs-11)/1 var(--font-mono); }
.sk-pt, .sk-q { position: absolute; }
.sk-pt i, .sk-q i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); }
.sk-pt span, .sk-q span { position: absolute; left: 9px; top: -8px; color: var(--text-3); font-size: var(--fs-11); white-space: nowrap; }
.sk-pt.is-hit i { background: var(--blue); box-shadow: 0 0 0 4px rgba(91,156,255,.2); }
.sk-pt.is-hit span { color: var(--text); }
.sk-q i { left: -7px; top: -7px; width: 14px; height: 14px; background: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 20px var(--accent); }
.sk-q span { color: var(--accent); font-family: var(--font-mono); font-weight: 600; top: -20px; left: -30px; }

.sk-grid { flex: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.sk-prod { position: relative; padding: 8px; border: 1px solid var(--line-2); border-radius: 11px; background: #101116; }
.sk-prod-img { position: relative; height: 54px; margin-bottom: 7px; border-radius: 8px; background: radial-gradient(circle at 70% 30%, hsl(var(--h) 70% 60% / .55), transparent 60%), linear-gradient(135deg, hsl(var(--h) 40% 22%), hsl(var(--h) 30% 12%)); overflow: hidden; }
.sk-prod-img i { position: absolute; left: 18%; right: 14%; bottom: 10px; height: 18px; border-radius: 12px 16px 4px 4px; background: hsl(var(--h) 60% 70% / .85); box-shadow: 0 6px 0 -3px #0005; }
.sk-prod b { display: block; font-size: var(--fs-12); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-prod-meta { display: flex; justify-content: space-between; margin-top: 3px; font: 500 var(--fs-11)/1.2 var(--font-mono); }
.sk-prod-meta em { font-style: normal; color: var(--green); } .sk-prod.tone-warn .sk-prod-meta em { color: var(--yellow); }
.sk-rank { position: absolute; left: 12px; top: 12px; z-index: 1; padding: 1px 6px; border-radius: 6px; background: rgba(0,0,0,.6); font: 600 var(--fs-11)/1.4 var(--font-mono); }

.sk-page { position: relative; flex: none; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #f4f1ea; color: #1a1a1a; }
.sk-page-kicker { color: #b4441f; font: 700 var(--fs-11)/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.sk-page h4 { margin: 6px 0 2px; font: 700 18px/1.2 Georgia, "Times New Roman", serif; }
.sk-page small { color: #6b665c; font-size: var(--fs-11); }
.sk-page-lines { display: grid; gap: 7px; margin-top: 12px; }
.sk-page-lines i { height: 7px; border-radius: 4px; background: #d8d2c6; }
.sk-page-lines i:nth-child(3n) { width: 82%; } .sk-page-lines i:nth-child(4n) { width: 64%; }
.sk-page-ribbon:empty { display: none; }
.sk-page-ribbon { position: absolute; right: 10px; top: 10px; padding: 3px 9px; border-radius: 999px; background: #1f7a4d; color: #fff; font: 600 var(--fs-11)/1.3 var(--font-mono); }
.sk-page.is-served .sk-page-lines i { background: linear-gradient(90deg, #cfe9d9, #d8d2c6); }

.sk-art { position: relative; flex: 1 1 auto; min-height: 180px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); background: #15161b; }
.sk-art-canvas { position: absolute; inset: 0; overflow: hidden; }
.sk-art .sky { position: absolute; inset: 0; background: linear-gradient(180deg, #2d2350 0%, #b0566b 45%, #f6a35c 70%, #ffd59a 100%); }
.sk-art .sun { position: absolute; left: 62%; bottom: 26%; width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle, #fff6d8, #ffc66b 55%, transparent 72%); filter: blur(1px); }
.sk-art .hill { position: absolute; left: -10%; right: -10%; border-radius: 50% 50% 0 0; }
.sk-art .h1 { bottom: 10%; height: 34%; background: #6a3a52; } .sk-art .h2 { bottom: -6%; height: 30%; background: #3a2236; left: 30%; }
.sk-art .cafe { position: absolute; left: 12%; bottom: 8%; width: 38%; height: 46%; background: #2a1c2a; border-radius: 4px 4px 0 0; }
.sk-art .cafe i { position: absolute; display: block; }
.sk-art .roof { left: -6%; right: -6%; top: -10px; height: 12px; background: #1c1220; border-radius: 3px; }
.sk-art .awning { left: 4%; right: 4%; top: 22%; height: 12%; background: repeating-linear-gradient(90deg, #e9e2d0 0 10px, #c0473c 10px 20px); border-radius: 0 0 6px 6px; }
.sk-art .win { top: 40%; width: 26%; height: 28%; background: linear-gradient(180deg, #ffd27a, #f09a4a); box-shadow: 0 0 18px #ffb35c; border-radius: 2px; }
.sk-art .w1 { left: 8%; } .sk-art .w2 { right: 8%; }
.sk-art .door { left: 40%; width: 20%; bottom: 0; height: 40%; background: #ffcf7a; box-shadow: 0 0 14px #ffb35c; }
.sk-art .sign { left: 10%; right: 10%; top: 4%; color: #ffd9a0; font: 700 11px/1 var(--font-mono); letter-spacing: .14em; text-align: center; }
.sk-art .lamp { right: -12%; bottom: 0; width: 3px; height: 70%; background: #1c1220; }
.sk-art .bike { position: absolute; right: 16%; bottom: 8%; width: 26%; fill: none; stroke: #1a0f1a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sk-art .steam { position: absolute; left: 30%; bottom: 56%; } .sk-art .steam i { display: block; width: 2px; height: 14px; margin: 2px; border-radius: 2px; background: rgba(255,255,255,.4); animation: steam 2.4s ease-in-out infinite; } .sk-art .steam i + i { animation-delay: .6s; }
@keyframes steam { 50% { transform: translateY(-6px) scaleY(1.3); opacity: .2; } }
.sk-art-noise { position: absolute; inset: 0; background-image: repeating-radial-gradient(circle at 17% 32%, rgba(255,255,255,.12) 0 1px, transparent 1px 3px), repeating-radial-gradient(circle at 73% 61%, rgba(0,0,0,.25) 0 1px, transparent 1px 4px); mix-blend-mode: overlay; pointer-events: none; }
.sk-art-hud { position: absolute; left: 10px; bottom: 8px; display: flex; gap: 6px; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; font: 500 var(--fs-11)/1.3 var(--font-mono); }
.sk-art.is-done .sk-art-hud span { visibility: hidden; } .sk-art.is-done .sk-art-hud::before { content: "rendered ✓"; color: var(--green); }

.sk-wave { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.sk-wave-bars { display: flex; align-items: center; gap: 3px; height: 48px; }
.sk-wave-bars i { width: 3px; height: calc(var(--h) * 46px); border-radius: 2px; background: var(--text-4); transform: scaleY(.2); transition: background var(--d-3); }
.sk-wave.is-active .sk-wave-bars i { animation: wave 1s var(--ease-in-out) infinite alternate; animation-delay: calc(var(--i) * -63ms); }
.sk-wave.who-caller.is-active i { background: var(--blue); } .sk-wave.who-agent.is-active i { background: var(--accent); }
.sk-wave-label { color: var(--text-3); font: 500 var(--fs-11)/1 var(--font-mono); }
.sk-wave:not(.is-active) .sk-wave-label { opacity: .5; }
@keyframes wave { from { transform: scaleY(.15); } to { transform: scaleY(1); } }

.sk-swarm { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; --stop: 60px; }
.sk-shield { position: absolute; left: 66px; top: 8%; bottom: 8%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 0; border-left: 2px solid var(--red); box-shadow: 0 0 22px var(--red); color: var(--red); }
.sk-shield .sk-ico { padding: 4px; border-radius: 50%; background: #1d0b0d; border: 1px solid var(--red); }
.sk-shield b { padding: 2px 6px; border-radius: 4px; background: var(--red); color: #200405; font: 700 var(--fs-11)/1.3 var(--font-mono); white-space: nowrap; }
.sk-botdot { position: absolute; left: 0; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #2a1215; color: #ff9ea2; border: 1px solid rgba(245,84,91,.6); }
.sk-botdot svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; }
.sk-botdot.is-hit { left: 40px; opacity: .8; }

.sk-traffic .sk-item { padding: 5px 9px; }
.sk-traffic .sk-item-text b { font-weight: 500; color: var(--text-2); font-size: var(--fs-11); font-family: var(--font-mono); }
.sk-ok { color: var(--green); font-weight: 700; }
.sk-live { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: ping 1.4s infinite; color: var(--green); }

/* --------------------------------------------------------------- badges */
.sc-badges { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.sc-pin { position: absolute; left: 0; top: 0; will-change: transform; transition: opacity var(--d-2); }
.sc-badge { position: absolute; right: 0; top: 0; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 1px solid var(--p); border-radius: 999px; background: color-mix(in srgb, var(--p) 22%, #0b0c0f); color: color-mix(in srgb, var(--p) 25%, white); font: 700 var(--fs-11)/1 var(--font-mono); letter-spacing: .03em; white-space: nowrap; pointer-events: auto; cursor: help; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 6px 18px -6px rgba(0,0,0,.8); transition: box-shadow var(--d-3), opacity var(--d-3), filter var(--d-3); }
.sc-badge i { font-style: normal; color: var(--red); }
.sc-pin.is-live .sc-badge { box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 22%, transparent), 0 0 22px -2px var(--p); }
.sc-pin.is-live .sc-badge::after { content: ""; position: absolute; inset: -5px; border-radius: inherit; border: 1px solid var(--p); opacity: 0; animation: badge-ring 1.8s var(--ease-out) infinite; }
.sc-pin:not(.is-live) .sc-badge { filter: saturate(.75); opacity: .82; }
.sc-pin.tone-block { --p: var(--red); }
.sc-pin.tone-warn .sc-badge, .sc-pin.tone-wait .sc-badge { border-style: dashed; }
.sc-badge:hover, .sc-badge:focus-visible { opacity: 1; filter: none; z-index: 2; box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 30%, transparent), 0 0 26px -2px var(--p); outline: none; }
@keyframes badge-ring { 0% { opacity: .8; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.5); } }

.sc-tip { position: absolute; left: 0; top: 0; z-index: 8; width: 240px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--p) 45%, var(--line-2)); border-radius: 10px; background: rgba(14,15,19,.96); backdrop-filter: blur(12px); box-shadow: var(--shadow-3); pointer-events: none; }
.sc-tip div { display: flex; align-items: center; gap: 8px; }
.sc-tip div b { padding: 2px 6px; border-radius: 5px; background: color-mix(in srgb, var(--p) 22%, transparent); color: var(--p); font: 700 var(--fs-11)/1.3 var(--font-mono); }
.sc-tip strong { font-size: var(--fs-13); }
.sc-tip span { display: block; margin-top: 6px; color: var(--text); font-size: var(--fs-13); }
.sc-tip small { display: block; margin-top: 4px; color: var(--text-3); font: 500 var(--fs-11)/1.4 var(--font-mono); }

/* Trace lines (fixed overlay across the page) + traced rail cards */
.trace-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 15; pointer-events: none; overflow: visible; }
.trace-link path { fill: none; stroke: var(--p); stroke-width: 1.25; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .75; filter: drop-shadow(0 0 4px var(--p)); animation: trace-draw .7s var(--ease-out) forwards; }
.trace-link circle { fill: var(--p); filter: drop-shadow(0 0 6px var(--p)); }
@keyframes trace-draw { to { stroke-dashoffset: 0; } }
.product.is-traced, .product.is-hovered { border-color: color-mix(in srgb, var(--p) 70%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 16%, transparent); }

/* Attack + outcome moods */
.scene-view.is-attack .sc-hud-title i { background: var(--red); box-shadow: 0 0 10px var(--red); }
.scene-view.is-blocked .sc-back { border-color: rgba(245,84,91,.45); box-shadow: inset 0 0 60px rgba(245,84,91,.06); }
.scene-view.is-paused * { animation-play-state: paused !important; }

/* Responsive: stack surface above backstage */
@container (max-width: 760px) {
  .scene-view { height: auto; min-height: 860px; }
  .sc-stage { position: relative; inset: auto; margin: 48px 12px 34px; grid-template-columns: minmax(0, 1fr); grid-template-rows: 520px auto; }
  .sc-back { min-height: 280px; transform: none; }
  .sc-surface-wrap { transform: none; }
  .layout-split .sc-window-body, .layout-split-left .sc-window-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "side" "bottom"; grid-template-rows: auto minmax(0, 1fr) auto auto; }
  .sk-lane { grid-template-columns: minmax(0, 1fr); }
  .sk-lane-nodes { flex-wrap: wrap; gap: 6px; } .sk-lane-nodes .sk-wire { display: none; } .sk-node { flex: 1 1 40%; }
  .sk-lane-prov { flex-direction: row; } .is-provider .sk-wire.to-prov { display: none; }
  .sc-window-title { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-surface-wrap, .sc-back { transform: none !important; }
  .tk { opacity: 1; }
  mark { background-size: 100% 100%; animation: none; }
}
