:root {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #213241;
  --ink: #213241;
  --muted: #586a7b;
  --line: #b0bec8;
  --top: #f2f4f3;
  --left: #e6ebec;
  --right: #d7e0e5;
  --lit: #e1eaf2;
  --ring: #8ba9c6;
  --blue: #0052b3;
}

body { margin: 0; }
.fos-scene {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
}
.fos-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle, rgb(75 102 126 / 32%) .8px, transparent 1.15px) center / clamp(13px, 2.8vw, 20px) clamp(13px, 2.8vw, 20px);
  mask-image: radial-gradient(ellipse 50% 50%, #000 36%, rgb(0 0 0 / 72%) 62%, transparent);
}
.fos-scene > svg, #cloud svg { display: block; width: 100%; height: auto; }
.fos-scene > svg { overflow: visible; }

.fos-slab path { stroke: var(--ink); stroke-width: 1; stroke-linejoin: round; }
.fos-face-t { fill: var(--top); transition: fill 350ms ease; }
.fos-face-l { fill: var(--left); }
.fos-face-r { fill: var(--right); }
.fos-rim {
  fill: none;
  stroke: var(--ink);
  stroke-width: .7;
  stroke-dasharray: 1.5 3;
  opacity: .32;
  transition: stroke 350ms ease, opacity 350ms ease;
}
.fos-plate-label { fill: var(--muted); text-anchor: middle; font-size: 15px; font-weight: 600; letter-spacing: .06em; }
.fos-grid path { fill: none; stroke: var(--ink); stroke-width: .6; opacity: .07; }
.fos-tile path { stroke-width: .8; }

.fos-onto > .fos-slab .fos-face-t, .fos-app > .fos-slab .fos-face-t { fill: var(--lit); }
.fos-onto > .fos-rim, .fos-app > .fos-rim { stroke: var(--blue); opacity: .62; }
.fos-onto > .fos-plate-label, .fos-app > .fos-plate-label { fill: var(--blue); }
[data-beat="intake"] [data-source] > .fos-slab .fos-face-t { fill: var(--lit); }
[data-beat="intake"] [data-source] > .fos-rim { stroke: var(--blue); opacity: .8; }

.fos-stop { stop-color: #74a7d7; }
.fos-sweep, .intake-sweep { opacity: 0; }
[data-beat="relate"] .fos-sweep { animation: board-sweep 1100ms ease-out both; }
@keyframes board-sweep {
  0% { opacity: 0; }
  15%, 80% { opacity: .48; }
  100% { transform: translateX(450px); opacity: 0; }
}
[data-beat="intake"] [data-source] .intake-sweep { animation: intake-sweep 940ms ease-out both; }
@keyframes intake-sweep {
  0% { transform: translateX(-55px); opacity: 0; }
  18%, 77% { opacity: 1; }
  100% { transform: translateX(260px); opacity: 0; }
}

.fos-flow-line, .fos-flow-packet, .wire, .packet { fill: none; stroke-linecap: round; }
.fos-flow-line, .wire {
  stroke: var(--ring);
  stroke-width: 1.15;
  stroke-dasharray: 2 4;
  transition: stroke 280ms ease;
}
.fos-flow-packet, .packet {
  opacity: 0;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-dasharray: 13 100;
  stroke-dashoffset: 13;
}
[data-beat="intake"] [data-feed] .fos-flow-line,
[data-beat="delivery"] .fos-flows-apps .fos-flow-line { stroke: #5084bb; }
[data-beat="intake"] [data-feed] .fos-flow-packet {
  animation: travel 780ms linear calc(var(--i) * 44ms) both;
}
[data-beat="delivery"] .fos-flows-apps .fos-flow-packet {
  animation: travel 700ms linear calc((var(--i) - 4) * 44ms) both;
}
.edge[data-active] .wire { stroke: #487daf; stroke-width: 1.4; }
[data-beat="relate"] .edge[data-active] .packet {
  animation: travel 720ms linear var(--arrival) both;
}
@keyframes travel {
  0% { opacity: 0; stroke-dashoffset: 13; }
  12% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; stroke-dashoffset: -100; }
}

.fos-node-body, .fos-node-glow { transform-box: fill-box; }
.fos-node-body { transform-origin: center bottom; }
.fos-node-glow { transform-origin: center; opacity: 0; }
.fos-node-top { fill: var(--top); stroke: var(--muted); stroke-width: 1; transition: fill 300ms ease; }
.fos-node-side { fill: #b6cce0; stroke: var(--ink); stroke-width: 1; }
.fos-node-ring { fill: none; stroke: #6088b0; stroke-width: .8; }
.fos-icon :is(path, circle, ellipse) { fill: var(--top); stroke: var(--ink); stroke-width: .9; stroke-linejoin: round; }
.fos-icon .fos-icon-line { fill: none; }
.fos-icon .fos-face-l { fill: var(--left); }
.fos-icon .fos-face-r { fill: var(--right); }
.fos-scene:not([data-beat="intake"]) .fos-node[data-active] .fos-node-top {
  fill: #d7e8f7;
  transition-delay: var(--arrival);
}
[data-beat="relate"] .fos-node[data-active] .fos-node-body {
  animation: node-lift 440ms ease-out var(--arrival) both;
}
[data-beat="relate"] .fos-node[data-active] .fos-node-glow {
  animation: node-glow 510ms ease-out var(--arrival) both;
}
@keyframes node-lift { 42% { transform: translateY(-5px); } }
@keyframes node-glow {
  0% { opacity: 0; transform: scale(.75); }
  35% { opacity: .9; }
  100% { opacity: 0; transform: scale(1.25); }
}

.fos-pill rect { fill: #edf3f9; stroke: var(--ring); stroke-width: .8; }
.fos-pill text { text-anchor: middle; fill: #1c4164; font-size: 10px; font-weight: 600; }
.fos-pill-stem { fill: none; stroke: #5682b2; stroke-width: .9; stroke-dasharray: 1.5 2; }
.fos-pill-short { display: none; }
.fos-scene:not([data-beat="intake"]) .fos-pills [data-active] rect { fill: #d6e8fb; stroke: #3979b6; }
.fos-scene:not([data-beat="intake"]) .fos-pills [data-id="0"][data-active] rect { fill: var(--blue); stroke: var(--blue); }
.fos-scene:not([data-beat="intake"]) .fos-pills [data-id="0"][data-active] text { fill: #fff; }
.predicate, .ip-question { opacity: 0; transition: opacity 300ms ease; }
.predicate rect { fill: #f5f8f7; }
.predicate text { fill: #1b507c; font-size: 11px; }
.ip-question text { fill: #213c51; font-size: 12px; }
[data-beat="relate"] .edge[data-active] .predicate,
[data-beat="delivery"] .edge[data-active] .predicate,
[data-beat="ready"] .edge[data-active] .predicate,
[data-step="experience"][data-beat="ready"] .ip-question { opacity: 1; }

#cloud {
  position: absolute;
  left: 50%;
  top: 10.15%;
  width: 8.25%;
  transform: translateX(-50%);
  pointer-events: none;
}
[data-beat="ready"] #cloud svg { animation: acknowledge 660ms ease-in-out; }
@keyframes acknowledge { 38% { transform: translateY(-7%); } }
.fos-scene[data-paused] * { animation-play-state: paused !important; }

@container (max-width: 420px) {
  .fos-pill text { font-size: 13px; }
  .fos-plate-label { font-size: 22px; }
  .fos-pill-long { display: none; }
  .fos-pill-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .fos-scene *, .fos-scene *::before { transition: none !important; animation: none !important; }
}
