/*
 * Fred's terminal, the live view (lane t22-fredterm2, 8 Oct 2026; js/v21_fredterm_live.js 1.0.0). The stage is its own
 * night screen on every theme (fixed colours inside it, chosen for contrast on the dark glass); the feed uses the
 * desk's own tokens. No inline styles. Reduced motion: nothing spins, pulses or flies.
 */
.ft-live { display: grid; gap: 14px; min-width: 0; }

/* ------------------------------------------------------------------ the stage */
.ftl-stage {
  position: relative; overflow: hidden; border-radius: 18px; isolation: isolate; min-height: 220px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(34, 211, 238, .10), transparent 70%),
    radial-gradient(ellipse at 50% 120%, #10284a 0%, #0a1528 55%, #050a14 100%);
  border: 1px solid rgba(94, 234, 212, .22);
  box-shadow: 0 18px 50px rgba(2, 8, 23, .45), inset 0 0 60px rgba(34, 211, 238, .06);
  color: #e2f3ff;
}
.ftl-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
.ftl-svg { display: block; width: 100%; height: auto; }
.ftl-gridline { stroke: rgba(148, 197, 255, .07); stroke-width: 1; }
.ftl-orbit { fill: none; stroke: rgba(94, 234, 212, .18); stroke-width: 1; }
.ftl-orbit.is-dash { stroke-dasharray: 2 9; stroke: rgba(167, 139, 250, .35); }
.ftl-spin-slow { transform-box: view-box; transform-origin: 340px 190px; animation: ftl-spin 60s linear infinite; }
.ftl-sweep { transform-box: view-box; transform-origin: 340px 190px; animation: ftl-spin 7s linear infinite; }
.ftl-sweep-p { fill: url(#ftl-glow); opacity: .35; }
@keyframes ftl-spin { to { transform: rotate(360deg); } }

.ftl-link { stroke: rgba(94, 234, 212, .22); stroke-width: 1.2; stroke-dasharray: 3 6; animation: ftl-flow 1.6s linear infinite; }
.ftl-link.is-late { stroke: rgba(251, 191, 36, .45); animation-duration: 3.2s; }
.ftl-link.is-stopped, .ftl-link.is-missing { stroke: rgba(248, 113, 113, .45); animation: none; stroke-dasharray: 2 8; }
.ftl-link.is-unknown { stroke: rgba(148, 163, 184, .3); animation: none; }
.ftl-link.is-hot { stroke: rgba(165, 243, 252, .95); stroke-width: 2.2; }
@keyframes ftl-flow { to { stroke-dashoffset: -18; } }

.ftl-node { cursor: default; }
.ftl-halo-n { fill: rgba(52, 211, 153, .10); stroke: none; }
.ftl-track { fill: rgba(5, 12, 24, .9); stroke: rgba(255, 255, 255, .10); stroke-width: 3; }
.ftl-ring { fill: none; stroke: #34d399; stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .9s linear, stroke .4s; }
.ftl-dot { fill: #34d399; filter: drop-shadow(0 0 6px rgba(52, 211, 153, .9)); transition: fill .4s; }
.ftl-label { fill: #e2f3ff; font: 700 11px/1 system-ui, "Segoe UI", sans-serif; letter-spacing: .02em; paint-order: stroke; stroke: rgba(5, 10, 20, .85); stroke-width: 3px; }
.ftl-age { fill: rgba(186, 230, 253, .75); font: 500 9.5px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; paint-order: stroke; stroke: rgba(5, 10, 20, .85); stroke-width: 3px; }
.ftl-node.is-near .ftl-ring { stroke: #fbbf24; }
.ftl-node.is-late .ftl-ring, .ftl-node.is-late .ftl-dot { stroke: #fbbf24; fill: #fbbf24; }
.ftl-node.is-late .ftl-ring { fill: none; }
.ftl-node.is-late .ftl-halo-n { fill: rgba(251, 191, 36, .14); }
.ftl-node.is-stopped .ftl-dot, .ftl-node.is-missing .ftl-dot { fill: #f87171; filter: drop-shadow(0 0 8px rgba(248, 113, 113, .9)); }
.ftl-node.is-stopped .ftl-ring, .ftl-node.is-missing .ftl-ring { stroke: #f87171; }
.ftl-node.is-stopped .ftl-halo-n, .ftl-node.is-missing .ftl-halo-n { fill: rgba(248, 113, 113, .16); animation: ftl-alarm 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.ftl-node.is-unknown .ftl-dot { fill: #94a3b8; filter: none; }
.ftl-node.is-unknown .ftl-ring { stroke: #94a3b8; }
@keyframes ftl-alarm { 50% { transform: scale(1.35); opacity: .35; } }
.ftl-node.is-firing .ftl-dot { animation: ftl-flash .7s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes ftl-flash { 0% { fill: #ecfeff; transform: scale(1.9); } 100% { transform: scale(1); } }
.ftl-ripple { fill: none; stroke: #67e8f9; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ftl-ripple 1.2s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes ftl-ripple { from { transform: scale(1); opacity: .95; } to { transform: scale(3.4); opacity: 0; } }
.ftl-spark { fill: #ecfeff; }
.ftl-spark.is-tail { fill: #22d3ee; opacity: .8; }

.ftl-halo { animation: ftl-breathe 3.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ftl-breathe { 50% { transform: scale(1.12); opacity: .75; } }
.ftl-core { filter: drop-shadow(0 0 18px rgba(34, 211, 238, .75)); }
.ftl-core-ring { transform-box: view-box; transform-origin: 340px 190px; animation: ftl-spin 14s linear infinite; }
.ftl-cring { fill: none; stroke: rgba(94, 234, 212, .55); stroke-width: 1.5; stroke-dasharray: 14 10 3 10; }
.ftl-cring.is-in { stroke: rgba(167, 139, 250, .6); stroke-dasharray: 2 6; }
.ftl-coreg.is-working .ftl-core-ring { animation-duration: 2.4s; }
.ftl-coreg.is-working .ftl-core { filter: drop-shadow(0 0 26px rgba(103, 232, 249, .95)); }
.ftl-coreg.is-hit .ftl-core { animation: ftl-hit .5s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes ftl-hit { 0% { transform: scale(1.14); } 100% { transform: scale(1); } }
.ftl-core-t { fill: #042f2e; font: 900 13px/1 system-ui, "Segoe UI", sans-serif; letter-spacing: .18em; }
.ftl-core-s { fill: #a5f3fc; font: 700 9.5px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .22em; paint-order: stroke; stroke: rgba(5, 10, 20, .85); stroke-width: 3px; }
.ftl-wave { fill: none; stroke: rgba(167, 139, 250, .85); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ftl-wave 1.5s cubic-bezier(.15, .6, .3, 1) forwards; }
@keyframes ftl-wave { from { transform: scale(1); opacity: .9; } to { transform: scale(7.5); opacity: 0; } }

.ftl-stage { display: flex; flex-direction: column; }
.ftl-svg { order: 2; margin: -6px 0 -4px; }
.ftl-hud {
  order: 1; position: relative; z-index: 3; display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 12px 12px 0;
  justify-content: space-between; align-items: flex-start;
}
.ftl-live {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 999px;
  background: rgba(2, 6, 23, .6); border: 1px solid rgba(248, 113, 113, .45);
  font: 800 11px/1 system-ui, "Segoe UI", sans-serif; letter-spacing: .16em; color: #fecaca;
}
.ftl-rec { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 10px #ef4444; animation: ftl-rec 1.2s steps(2, jump-none) infinite; }
@keyframes ftl-rec { 50% { opacity: .2; } }
.ftl-clock { font: 600 11px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; color: #e2f3ff; }
.ftl-stats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ftl-stat {
  display: grid; gap: 2px; min-width: 92px; padding: 6px 10px; border-radius: 10px; text-align: right;
  background: rgba(2, 6, 23, .58); border: 1px solid rgba(94, 234, 212, .22); backdrop-filter: blur(4px);
}
.ftl-lab { font: 700 9.5px/1.1 system-ui, "Segoe UI", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: rgba(186, 230, 253, .75); }
.ftl-num { font: 800 14px/1.1 ui-monospace, "Cascadia Mono", Consolas, monospace; color: #ecfeff; font-variant-numeric: tabular-nums; }
.ftl-stat.is-bad { border-color: rgba(248, 113, 113, .7); }
.ftl-stat.is-bad .ftl-num { color: #fca5a5; }
.ftl-stat.is-warn { border-color: rgba(251, 191, 36, .7); }
.ftl-legend {
  order: 3; position: relative; z-index: 3; padding: 0 12px 10px; display: flex; flex-wrap: wrap; gap: 4px 12px;
  font: 600 10px/1 system-ui, "Segoe UI", sans-serif; color: rgba(186, 230, 253, .8);
}
.ftl-key { display: inline-flex; align-items: center; gap: 5px; }
.ftl-key::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #34d399; }
.ftl-key.is-late::before { background: #fbbf24; }
.ftl-key.is-stopped::before { background: #f87171; }
.ftl-key.is-beat::before { background: #ecfeff; box-shadow: 0 0 8px #22d3ee; }

/* ------------------------------------------------------------------ the feed */
.ftl-feedbox { display: grid; gap: 8px; min-width: 0; }
.ftl-h { margin: 0; font-size: .875rem; color: var(--ink-2); }
.ftl-now {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border-radius: 12px; min-width: 0;
  border: 1px solid var(--glass-rim); background: var(--solid); font-weight: 700; font-size: .9375rem;
}
.ftl-now-t { overflow-wrap: anywhere; }
.ftl-now-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ink-3, var(--ink-2)); }
.ftl-now.is-working { border-color: color-mix(in srgb, var(--info) 55%, var(--glass-rim)); background: linear-gradient(90deg, color-mix(in srgb, var(--info) 12%, var(--solid)), var(--solid) 60%); }
.ftl-now.is-working .ftl-now-dot { background: var(--info); animation: ftl-rec 0.9s ease-in-out infinite; box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 20%, transparent); }
.ftl-now.is-idle .ftl-now-dot { background: var(--ok, #2e7d32); }
.ftl-feed { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-rows: max-content; gap: 4px; max-height: 320px; overflow: auto; overscroll-behavior: contain; }
.ftl-ev {
  display: grid; grid-template-columns: 64px 14px minmax(0, 1fr); align-items: baseline; gap: 6px; padding: 6px 8px;
  border-radius: 8px; font-size: .875rem;
}
.ftl-ev:nth-child(odd) { background: var(--glass-hover); }
.ftl-t { font-size: .75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ftl-ico { width: 8px; height: 8px; border-radius: 2px; background: color-mix(in srgb, var(--info) 60%, var(--ink-2)); transform: rotate(45deg); align-self: center; }
.ftl-step { overflow-wrap: anywhere; }
.ftl-ev.is-running { position: relative; overflow: hidden; font-weight: 700; background: color-mix(in srgb, var(--info) 10%, var(--solid)); }
.ftl-ev.is-running .ftl-ico { border-radius: 50%; background: none; border: 2px solid var(--info); border-right-color: transparent; transform: none; width: 10px; height: 10px; animation: ftl-spin .8s linear infinite; }
.ftl-ev.is-running::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--info) 18%, transparent) 50%, transparent 80%);
  transform: translateX(-100%); animation: ftl-shimmer 1.6s ease-in-out infinite;
}
@keyframes ftl-shimmer { to { transform: translateX(100%); } }
.ftl-ev.is-new { animation: ftl-in .55s cubic-bezier(.2, .8, .2, 1); }
@keyframes ftl-in { from { opacity: 0; transform: translateX(-14px); background: color-mix(in srgb, var(--info) 25%, var(--solid)); } }
.ftl-ev.is-say { display: block; padding: 8px 10px; border-left: 3px solid var(--info); background: color-mix(in srgb, var(--info) 6%, var(--solid)); }
.ftl-ev-h { display: flex; gap: 8px; align-items: baseline; }
.ftl-who { font-weight: 800; font-size: .8125rem; }
.ftl-say-t {
  margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .875rem; line-height: 1.35rem;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.ftl-ev.is-say.is-open .ftl-say-t { -webkit-line-clamp: unset; display: block; }
.ftl-more { margin-top: 4px; padding: 0; border: 0; background: none; color: var(--info); font: inherit; font-size: .8125rem; font-weight: 700; cursor: pointer; }
.ftl-more:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ftl-ev.is-empty { display: block; }
.ftl-feed-note { margin: 0; font-size: .75rem; }

/* ------------------------------------------------------------------ calm */
@media (prefers-reduced-motion: reduce) {
  .ftl-spin-slow, .ftl-sweep, .ftl-link, .ftl-halo, .ftl-core-ring, .ftl-rec, .ftl-node .ftl-halo-n,
  .ftl-ev.is-running .ftl-ico, .ftl-ev.is-running::after, .ftl-ev.is-new, .ftl-now-dot { animation: none !important; }
  .ftl-sweep { display: none; }
}
.ftl-stage.is-still .ftl-sweep { display: none; }
@media (forced-colors: active) {
  .ftl-stage { forced-color-adjust: none; }
  .ftl-ev, .ftl-now { border: 1px solid CanvasText; }
}

@media (max-width: 600px) {
  .ftl-stat { min-width: 0; padding: 5px 8px; }
  .ftl-num { font-size: 12px; }
  .ftl-label { font-size: 13px; }
  .ftl-age { font-size: 11px; }
}
