/* Inter and Inter Display (SIL Open Font License 1.1, see static/fonts/OFL.txt).
   Local woff2 with Latin and Cyrillic: the panel never calls a font CDN. */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Display";
  src: url("/static/fonts/InterDisplay-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Display";
  src: url("/static/fonts/InterDisplay-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Display";
  src: url("/static/fonts/InterDisplay-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Display";
  src: url("/static/fonts/InterDisplay-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); font-feature-settings: "tnum" 1, "cv11" 1; transition: background .5s, color .5s; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 3px; border-radius: 4px; }

/* nylon background */
.nylon { position: fixed; inset: -40px; z-index: -1; overflow: hidden; }
.sheen { position: absolute; inset: 0; opacity: var(--sheen-op);
  background:
    linear-gradient(115deg, var(--sheen-1) 0%, var(--sheen-2) 18%, var(--sheen-4) 34%, var(--sheen-3) 50%, var(--sheen-1) 66%, var(--sheen-2) 82%, var(--sheen-4) 100%);
  background-size: 320% 320%; animation: shimmer 26s ease-in-out infinite alternate; transition: transform .8s cubic-bezier(.2,.8,.2,1); }
@keyframes shimmer { 0% { background-position: 0% 30%; } 100% { background-position: 100% 70%; } }
.folds { position: absolute; inset: 0; width: 100%; height: 100%; opacity: var(--folds-op); mix-blend-mode: var(--folds-blend); transition: transform 1.2s cubic-bezier(.2,.8,.2,1); }
#film { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#film ~ .folds { display: none; }
.glass { position: relative; box-shadow: var(--card-shadow); }
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 4;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), #8C78FF, #FF8DCB 35%, #7FE0C8 60%, #8CB8FF 75%, transparent 85%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s; }
.glass:hover::before { opacity: 1; }
.grain { position: absolute; inset: 0; opacity: var(--grain-op); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E"); }

/* live graph */
main { padding: 0 44px 60px; }
.live { display: grid; grid-template-columns: 1fr 240px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; backdrop-filter: blur(6px); }
.graph-wrap { position: relative; }
.graph { display: block; width: 100%; height: auto; }
.edge { fill: none; stroke: var(--edge); stroke-width: 1.5; transition: stroke .2s; }
.edge.is-hot { stroke: var(--ac); }
.edge.is-broken { stroke: var(--er-line); stroke-dasharray: 5 7; animation: dash 1.1s linear infinite; }
.edge.is-idle { stroke: var(--edge); stroke-dasharray: 2 6; }
@keyframes dash { to { stroke-dashoffset: -24; } }
.cut { fill: none; stroke: var(--er-line); stroke-width: 2.5; stroke-linecap: round; }
.node { cursor: pointer; outline: none; }
.node rect.box { fill: var(--node); stroke: var(--node-line); stroke-width: 1; transition: fill .2s; }
.node:hover rect.box, .node:focus-visible rect.box { fill: var(--sel); }
.node text { fill: var(--ink); font: 600 13.5px Inter, sans-serif; text-anchor: middle; pointer-events: none; }
.node .sub { fill: var(--mu); font: 500 10.5px Inter, sans-serif; }
.node .halo { fill: none; stroke: var(--ac); stroke-width: 1.5; opacity: 0; }
.node.is-hit .halo { animation: hit .55s cubic-bezier(.2,.8,.2,1); }
@keyframes hit { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.3); } }
.node.is-down rect.box { fill: var(--er-b); stroke: var(--er-line); stroke-width: 1.5; }
.node.is-down text { fill: var(--er-t); }
.node.is-down .halo { stroke: var(--er-line); animation: hit 1.6s ease-out infinite; }
.node.is-off rect.box { fill: transparent; stroke: var(--mu); stroke-dasharray: 3 4; }
.node.is-off text { fill: var(--mu); }
.pk.msg { fill: var(--msg); } .pk.btn { fill: var(--btn); } .pk.ai { fill: var(--ai); } .pk.task { fill: var(--task); }
.trail { fill: none; stroke-width: 2.5; stroke-linecap: round; opacity: .35; }
.pop { position: absolute; z-index: 3; min-width: 200px; background: var(--card-solid); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; box-shadow: 0 18px 40px -18px #1A153066; animation: popin .22s cubic-bezier(.2,.8,.2,1); }
.pop h4 { font-size: 14px; margin-bottom: 8px; }
.pop dl { display: grid; grid-template-columns: auto auto; gap: 4px 16px; }
.pop dt { color: var(--mu); } .pop dd { text-align: right; font-weight: 600; }
@keyframes popin { from { opacity: 0; transform: translateY(5px); } }
.legend { position: absolute; left: 18px; bottom: 12px; display: flex; gap: 16px; list-style: none; color: var(--mu); font-size: 12px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.k-msg { background: var(--msg); } .k-btn { background: var(--btn); } .k-ai { background: var(--ai); } .k-task { background: var(--task); }

.feed { list-style: none; border-left: 1px solid var(--line); padding: 12px 10px; overflow: hidden; }
.feed-col { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.feed-col .feed { border-left: 0; flex: 1; }
.feed-col > #live-fallback { padding: 10px; }
.feed li { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: center; padding: 8px 8px; border-radius: 8px; font-size: 13px; animation: slide .4s cubic-bezier(.2,.8,.2,1); }
.feed li:first-child { background: var(--sel); }
.feed i { width: 8px; height: 8px; border-radius: 2px; }
.feed time { color: var(--mu); font-size: 12px; }
@keyframes slide { from { opacity: 0; transform: translateY(-12px); } }

/* metrics */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
.m { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; height: 150px; overflow: hidden; backdrop-filter: blur(6px); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.m:hover { transform: translateY(-3px); }
.m h3 { font-size: 12px; font-weight: 600; color: var(--mu); letter-spacing: .01em; }
.m-big { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; font: 300 40px/1 "Inter Display", Inter, sans-serif; letter-spacing: -.04em; }
.m-big small { font: 500 12px Inter, sans-serif; letter-spacing: 0; color: var(--mu); }
.m-warn small { color: var(--wr-t); }
.chart { position: absolute; left: 0; right: 0; bottom: 10px; width: 100%; height: 50px; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .line.warn { stroke: var(--wr-t); }
.bars { position: absolute; left: 18px; right: 18px; bottom: 14px; display: flex; align-items: flex-end; gap: 4px; height: 46px; }
.bars i { flex: 1; background: var(--ink); opacity: .85; height: 4%; transition: height .8s cubic-bezier(.2,.8,.2,1); }
.bars i.is-bad { background: var(--er-line); opacity: 1; }
.meter { position: absolute; left: 18px; right: 18px; bottom: 22px; height: 10px; border: 1px solid var(--ink); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 5px); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }

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

/* ---------- utilities ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a.corner { color: var(--ink); }
code { font-family: ui-monospace, "SF Mono", "JetBrains Mono", "DejaVu Sans Mono", monospace; font-size: .92em; }
