@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/ibm-plex-mono-latin-ext-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/ibm-plex-mono-latin-ext-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/ibm-plex-mono-latin-ext-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/ibm-plex-mono-latin-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans Condensed';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/ibm-plex-sans-condensed-latin-ext-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans Condensed';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/ibm-plex-sans-condensed-latin-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans Condensed';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/ibm-plex-sans-condensed-latin-ext-700-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans Condensed';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/ibm-plex-sans-condensed-latin-700-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/ibm-plex-sans-latin-ext-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2');
}
:root{padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}body{margin:0;font:14px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}img{max-width:100%}[hidden]{display:none!important}

/* Layout: a protocol bench. The ladder diagram is the page: three device cards head three lanes (Alice, SIP server, Bob) and every message is drawn between them. A side rail holds the message inspector and guided tours. Message colours encode SIP classes: requests ink, 1xx grey, 2xx green, errors red, RTP amber. */
:root {
  --bg: #edf0f4;
  --surface: #ffffff;
  --sunk: #e2e6ed;
  --ink: #172031;
  --muted: #5a6578;
  --rule: #cfd5df;
  --accent: #2a55c9;
  --on-accent: #ffffff;
  --ok: #14804f;
  --on-ok: #ffffff;
  --err: #c43a2f;
  --prov: #778296;
  --rtp: #a66c00;
  --hl: #fff0b8;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --cond: "IBM Plex Sans Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f131a; --surface: #171c25; --sunk: #0b0e13; --ink: #e4e8ef; --muted: #8f99ab; --rule: #2a3241;
    --accent: #84a1ff; --on-accent: #0f131a; --ok: #47c48c; --on-ok: #0b1410; --err: #ff7b6c; --prov: #8a95a9; --rtp: #e6ab3e; --hl: #3b3313;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f131a; --surface: #171c25; --sunk: #0b0e13; --ink: #e4e8ef; --muted: #8f99ab; --rule: #2a3241;
  --accent: #84a1ff; --on-accent: #0f131a; --ok: #47c48c; --on-ok: #0b1410; --err: #ff7b6c; --prov: #8a95a9; --rtp: #e6ab3e; --hl: #3b3313;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--sans);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 14px;
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { height: 100%; max-width: 1440px; margin: 0 auto; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
.top { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: flex-end; justify-content: space-between; }
h1 { margin: 0; font: 700 28px/1 var(--cond); letter-spacing: -0.01em; text-wrap: balance; }
h1 span { color: var(--accent); }
.top p { margin: 5px 0 0; color: var(--muted); max-width: 62ch; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); font-size: 13px; cursor: pointer; user-select: none; }
.chip input { margin: 0; accent-color: var(--accent); }
.chip:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.chip:has(input:disabled) { opacity: 0.5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.btn { border: 1px solid var(--rule); background: var(--surface); border-radius: 6px; padding: 6px 11px; font: 600 12.5px/1.2 var(--sans); cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.go { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.btn.stop { color: var(--err); border-color: color-mix(in srgb, var(--err) 55%, var(--rule)); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.round { border-radius: 999px; }

.lab { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 16px; min-height: 0; }
.board { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.side { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; overflow-y: auto; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.label { font: 500 10.5px/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.narr { background: var(--surface); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.narr-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.narr-btns { display: flex; gap: 6px; }
.narr p { margin: 0; font-size: 14.5px; max-width: 80ch; }

.ladder { flex: 1; min-height: 0; overflow: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 0 12px 12px; }
.devices { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; background: var(--surface); padding: 12px 0 10px; border-bottom: 1px solid var(--rule); }
.dev { background: var(--bg); border: 1px solid var(--rule); border-radius: 8px; padding: 9px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dev-head { display: flex; justify-content: space-between; align-items: baseline; gap: 2px 8px; flex-wrap: wrap; }
.dev-name { font: 700 16px/1.1 var(--cond); }
.dev-ip { font: 11px/1.3 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.screen { background: var(--sunk); border-radius: 6px; padding: 7px 9px; min-height: 52px; }
.screen .st { display: block; font: 600 14.5px/1.25 var(--cond); }
.screen .sub { display: block; font: 11px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.screen.ring .st { color: var(--accent); animation: pulse 1s ease-in-out infinite; }
.screen.live .st { color: var(--ok); }
.screen.err .st { color: var(--err); }
.screen.off .st { color: var(--muted); }
@keyframes pulse { 50% { opacity: 0.45; } }
.keys { display: flex; flex-wrap: wrap; gap: 6px; }
.keys .btn { flex: 1 1 auto; }
.loc { display: flex; flex-direction: column; gap: 4px; font: 11px/1.35 var(--mono); }
.loc div { display: flex; flex-wrap: wrap; gap: 0 6px; overflow-wrap: anywhere; }
.loc b { font-weight: 600; }
.loc .gone { color: var(--muted); text-decoration: line-through; }

.rows {
  position: relative; min-height: 120px; padding: 8px 0 20px;
  background-image: linear-gradient(var(--rule), var(--rule)), linear-gradient(var(--rule), var(--rule)), linear-gradient(var(--rule), var(--rule)), linear-gradient(var(--rule), var(--rule));
  background-size: 1px 100%; background-repeat: no-repeat;
  background-position: 12.5% 0, 37.5% 0, 62.5% 0, 87.5% 0;
}
.empty { text-align: center; color: var(--muted); padding: 12px 8px 0; }
.empty span { background: var(--surface); padding: 2px 8px; }
.row { position: relative; height: 40px; scroll-margin-top: 200px; }
.row.sel { background: color-mix(in srgb, var(--accent) 11%, transparent); border-radius: 4px; }
.ts { position: absolute; left: 2px; top: 22px; font: 500 10px/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.req { --c: var(--ink); } .prov { --c: var(--prov); } .ok { --c: var(--ok); } .err { --c: var(--err); }
.arrow { position: absolute; top: 3px; height: 34px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--c); }
.arrow .lbl { position: absolute; left: 0; right: 0; top: 2px; text-align: center; font: 500 12px/1.2 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.arrow .lbl i { font-style: normal; font-size: 9.5px; border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; margin-left: 5px; vertical-align: 1px; opacity: 0.75; }
.arrow .line { position: absolute; left: 0; right: 0; top: 21px; height: 2px; background: currentColor; transform-origin: left center; }
.arrow[data-dir="l"] .line { transform-origin: right center; }
.arrow .line::after { content: ""; position: absolute; top: -4px; right: -1px; border-left: 9px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.arrow[data-dir="l"] .line::after { right: auto; left: -1px; border-left: 0; border-right: 9px solid currentColor; }
.anim .line { animation: draw var(--dur) linear both; }
.anim .lbl { animation: fade var(--dur) ease-out both; }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.row.act { height: 30px; }
.actlbl { position: absolute; top: 5px; transform: translateX(-50%); max-width: 25%; text-align: center; font: 12px/1.3 var(--sans); color: var(--muted); background: var(--surface); border: 1px dashed var(--rule); border-radius: 999px; padding: 1px 9px; }
.row.div { height: 34px; }
.row.div span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--surface); padding: 2px 10px; font: 500 10.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; white-space: nowrap; }
.row.media { height: 72px; cursor: pointer; }
.mline { position: absolute; height: 3px; color: var(--rtp); }
.mline.a2b { top: 21px; } .mline.b2a { top: 47px; }
.mline::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, currentColor 0 7px, transparent 7px 13px); }
.media.live .mline.flow::before { animation: rtpR 0.7s linear infinite; }
.media.live .mline.b2a.flow::before { animation-name: rtpL; }
@keyframes rtpR { to { background-position: 13px 0; } }
@keyframes rtpL { to { background-position: -13px 0; } }
.mline.lost { color: var(--err); }
.mline.lost::before { right: 58%; }
.mline.lost::after { content: "✕"; position: absolute; top: -9px; left: 42%; font: 700 14px/1 var(--sans); color: var(--err); }
.mline.b2a.lost::before { left: 58%; right: 0; }
.mline.b2a.lost::after { left: auto; right: 42%; }
.mline.silent { color: var(--muted); }
.mline.silent::before { opacity: 0.35; }
.mlbl { position: absolute; top: -15px; font: 500 10.5px/1 var(--mono); white-space: nowrap; }
.a2b .mlbl { left: 0; } .b2a .mlbl { right: 0; }
.mnote { position: absolute; bottom: 1px; transform: translateX(-50%); background: var(--surface); padding: 0 8px; font: 10.5px/1.3 var(--mono); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.tours { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tour { text-align: left; padding: 7px 9px; border: 1px solid var(--rule); border-radius: 6px; background: var(--bg); cursor: pointer; }
.tour:hover { border-color: var(--muted); }
.tour[aria-pressed="true"] { border-color: var(--accent); }
.tour b { display: block; font: 600 13px/1.3 var(--sans); }
.tour span { display: block; font-size: 11.5px; line-height: 1.35; color: var(--muted); }

.insp-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pill { font: 600 10.5px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; border: 1px solid currentColor; color: var(--c, var(--accent)); }
.insp h2 { margin: 0; font: 700 22px/1.1 var(--cond); color: var(--c, var(--ink)); overflow-wrap: anywhere; }
.route { font: 12px var(--mono); color: var(--muted); margin-top: -4px; }
.explain p { margin: 0 0 8px; }
.explain p:last-child { margin-bottom: 0; }
.explain .warn { color: var(--err); }
.raw { margin: 0; background: var(--sunk); border-radius: 6px; padding: 10px 12px; font: 12px/1.6 var(--mono); white-space: pre; overflow-x: auto; }
.ln { display: block; padding: 0 6px; margin: 0 -6px; border-radius: 3px; cursor: pointer; }
.ln:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ln.hl { background: var(--hl); }
.ln.on { outline: 1px solid var(--accent); }
.hn { color: var(--accent); }
.tip { margin: 0; font-size: 13px; color: var(--muted); min-height: 2.6em; }
.tip b { color: var(--ink); font-family: var(--mono); font-weight: 600; }
.ph { color: var(--muted); }

@media (max-width: 920px) {
  html, body { height: auto; }
  .app { height: auto; }
  .lab { grid-template-columns: 1fr; }
  .ladder { flex: none; height: 78vh; min-height: 480px; }
  .side { overflow: visible; }
  .insp { order: -1; }
}
@media (max-width: 1100px) {
  .keys .btn { padding: 6px 7px; font-size: 12px; }
}
@media (max-width: 520px) {
  .ladder { padding: 0 6px 10px; }
  .dev-name { font-size: 13px; }
  .dev-ip, .loc { font-size: 9.5px; }
  .screen { padding: 5px 6px; }
  .screen .sub { font-size: 10px; }
  .keys { gap: 4px; }
  .keys .btn { padding: 5px 3px; font-size: 11px; }
  .mlbl, .mnote { font-size: 9.5px; }
  .devices { gap: 6px; }
  .dev { padding: 7px; }
  .screen .st { font-size: 13px; }
  .keys .btn { padding: 6px 6px; font-size: 12px; }
  .tours { grid-template-columns: 1fr; }
  .arrow .lbl { font-size: 11px; padding: 0 4px; }
  .arrow .lbl i { display: none; }
}
/* ---------- compact layout: give the ladder the space ---------- */
body { padding-block: 10px; }
.app { gap: 10px; }
h1 { font-size: 24px; }
.top p { margin-top: 3px; font-size: 13.5px; }
.narr { padding: 8px 12px; gap: 4px; }
.narr p { font-size: 14px; }
.side .narr p { font-size: 14.5px; }
.side .narr { flex: none; }
.devices { gap: 8px; padding: 8px 0 8px; }
.dev { padding: 7px 9px; gap: 5px; }
.dev-head { flex-wrap: nowrap; min-width: 0; }
.dev-name { font-size: 15px; white-space: nowrap; }
.dev-ip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: 10.5px; }
.screen { background: none; padding: 0; min-height: 0; border-radius: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 1px 7px; }
.screen .st { display: block; order: 0; font-size: 13.5px; }
.screen .eq { order: 1; height: 12px; margin-top: 0; }
.screen .sub { order: 2; flex-basis: 100%; font-size: 10.5px; line-height: 1.3; }
.keys { gap: 4px; }
.keys .btn { flex: 0 1 auto; padding: 4px 8px; font-size: 11.5px; border-radius: 5px; }
.loc { gap: 2px; font-size: 10.5px; line-height: 1.3; }
.loc .label { display: none; }
.row { height: 34px; }
.arrow { top: 2px; height: 30px; }
.arrow .lbl { top: 1px; }
.arrow .line { top: 19px; }
.arrow .pkt { top: 14px; }
.ts { top: 18px; }
.row.act { height: 26px; }
.actlbl { top: 3px; }
.row.media { height: 62px; }
.mline.a2b { top: 19px; } .mline.b2a { top: 41px; }
@media (max-height: 820px) and (min-width: 921px) { .top p { display: none; } }

/* guided tours strip: always visible */
.app { grid-template-rows: auto auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.tourbar { min-width: 0; }
.tourbar { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 7px 10px; }
.tourbar > .label { color: var(--accent); white-space: nowrap; }
.tourbar .tours { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.tourbar .tour { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px; background: var(--bg); font: 600 12.5px/1.2 var(--sans); white-space: nowrap; }
.tourbar .tour .n { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--sunk); color: var(--muted); font: 600 10.5px/1 var(--mono); }
.tourbar .tour:hover .n { background: var(--accent); color: var(--on-accent); }
.tourbar .tour[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); color: var(--accent); }
.tourbar .tour[aria-pressed="true"] .n { background: var(--accent); color: var(--on-accent); }
@media (max-width: 520px) {
  .tourbar .tours { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
}

/* theme switch */
.theme-btn { display: inline-flex; align-items: center; gap: 6px; }
.theme-btn svg { width: 15px; height: 15px; fill: currentColor; stroke: currentColor; transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.3s; }
.theme-btn .sun { display: none; }
.is-dark .theme-btn .moon { display: none; }
.is-dark .theme-btn .sun { display: block; color: var(--rtp); }
.theme-btn.spin svg { animation: spin 0.55s cubic-bezier(0.3, 1.3, 0.5, 1); }
@keyframes spin { from { transform: rotate(-120deg) scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.theming, .theming *, .theming *::before, .theming *::after { transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, fill 0.4s ease !important; }

/* ---------- motion ---------- */
/* logo: a packet hopping down a tiny ladder */
.logo { position: relative; display: inline-block; width: 30px; height: 24px; margin-right: 10px; vertical-align: -1px; }
.logo i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--rule); border-radius: 1px; }
.logo i:nth-child(1) { left: 2px; } .logo i:nth-child(2) { left: 14px; } .logo i:nth-child(3) { left: 26px; }
.logo b { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: hop 3.2s ease-in-out infinite; }
@keyframes hop {
  0% { left: 0; top: 0; } 22% { left: 23px; top: 5px; } 30% { left: 23px; top: 5px; }
  52% { left: 0; top: 11px; } 60% { left: 0; top: 11px; } 82% { left: 23px; top: 17px; } 100% { left: 0; top: 0; opacity: 0; }
}

/* signalling packet riding each arrow */
.arrow .pkt { position: absolute; top: 16px; left: 0; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--c); opacity: 0; pointer-events: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent), 0 0 14px 3px color-mix(in srgb, var(--c) 55%, transparent); }
.anim .arrow[data-dir="r"] .pkt { animation: pktR var(--dur) linear both; }
.anim .arrow[data-dir="l"] .pkt { animation: pktL var(--dur) linear both; }
@keyframes pktR { 0% { left: 0; opacity: 0; transform: scale(0.4); } 10% { opacity: 1; transform: scale(1); } 90% { left: 100%; opacity: 1; transform: scale(1); } 100% { left: 100%; opacity: 0; transform: scale(2); } }
@keyframes pktL { 0% { left: 100%; opacity: 0; transform: scale(0.4); } 10% { opacity: 1; transform: scale(1); } 90% { left: 0; opacity: 1; transform: scale(1); } 100% { left: 0; opacity: 0; transform: scale(2); } }

/* a device lights up when a message lands on it */
.dev { position: relative; }
.dev.hit { animation: hit 0.65s ease-out; }
@keyframes hit { 0% { border-color: var(--hit); box-shadow: 0 0 0 0 color-mix(in srgb, var(--hit) 50%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.screen.bump { animation: bump 0.4s ease-out; }
@keyframes bump { 0% { transform: scale(0.96); } 60% { transform: scale(1.015); } 100% { transform: none; } }

/* handset icon + ringing ripples */
.ico { width: 15px; height: 15px; fill: currentColor; color: var(--muted); margin-right: 5px; vertical-align: -2px; transform-origin: 50% 60%; }
.dev.ringing .ico { color: var(--accent); animation: wiggle 1s ease-in-out infinite; }
.dev.waiting .ico { color: var(--accent); animation: blink 1.2s ease-in-out infinite; }
.dev.oncall .ico { color: var(--ok); }
@keyframes wiggle { 0%, 50%, 100% { transform: rotate(0); } 8%, 24%, 40% { transform: rotate(-18deg); } 16%, 32% { transform: rotate(18deg); } }
@keyframes blink { 50% { opacity: 0.3; } }
.dev.ringing { border-color: var(--accent); }
.dev.ringing::before, .dev.ringing::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; border: 2px solid var(--accent); pointer-events: none; animation: ripple 1.8s ease-out infinite; }
.dev.ringing::after { animation-delay: 0.9s; }
@keyframes ripple { from { transform: scale(1); opacity: 0.75; } to { transform: scale(1.05, 1.14); opacity: 0; } }

/* voice meter: what this phone is hearing */
.eq { display: none; align-items: center; gap: 2px; height: 16px; margin-top: 5px; }
.screen.live .eq { display: flex; }
.eq i { width: 3px; height: 3px; border-radius: 2px; background: var(--muted); opacity: 0.5; }
.eq.voice i, .eq.music i { opacity: 1; animation: eq 0.8s ease-in-out infinite alternate; }
.eq.voice i { background: var(--ok); }
.eq.music i { background: var(--rtp); animation-duration: 1.5s; }
.eq.lost i { background: var(--err); opacity: 0.8; }
.eq i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.6s; }
.eq i:nth-child(3) { animation-delay: -0.55s; animation-duration: 0.95s; }
.eq i:nth-child(4) { animation-delay: -0.1s; animation-duration: 0.7s; }
.eq i:nth-child(5) { animation-delay: -0.7s; animation-duration: 0.85s; }
.eq i:nth-child(6) { animation-delay: -0.25s; animation-duration: 0.65s; }
.eq i:nth-child(7) { animation-delay: -0.45s; animation-duration: 1s; }
.eq i:nth-child(8) { animation-delay: -0.15s; animation-duration: 0.75s; }
.eq i:nth-child(9) { animation-delay: -0.6s; animation-duration: 0.9s; }
@keyframes eq { from { height: 3px; } to { height: 12px; } }

/* RTP: individual packets flying between the phones */
.mline.flow::before { opacity: 0.35; }
.mline .pk { position: absolute; top: -3px; left: 0; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; opacity: 0; }
.media.live .mline.flow.a2b .pk { animation: pkA 1.5s linear infinite; }
.media.live .mline.flow.b2a .pk { animation: pkB 1.5s linear infinite; }
.media.live .mline.lost.a2b .pk { animation: pkLostA 1.5s linear infinite; }
.media.live .mline.lost.b2a .pk { animation: pkLostB 1.5s linear infinite; }
.media.live .mline.music .pk { animation-duration: 2.6s; }
.mline .pk:nth-of-type(2) { animation-delay: -0.5s !important; }
.mline .pk:nth-of-type(3) { animation-delay: -1s !important; }
@keyframes pkA { 0% { left: 0; opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes pkB { 0% { left: 100%; opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { left: 0; opacity: 0; } }
@keyframes pkLostA { 0% { left: 0; opacity: 0; transform: scale(1); } 8% { opacity: 1; } 68% { left: 42%; opacity: 1; transform: scale(1); } 100% { left: 42%; opacity: 0; transform: scale(2.8); } }
@keyframes pkLostB { 0% { left: 100%; opacity: 0; transform: scale(1); } 8% { opacity: 1; } 68% { left: 58%; opacity: 1; transform: scale(1); } 100% { left: 58%; opacity: 0; transform: scale(2.8); } }
.media.live .mline.lost::after { animation: xpulse 1.5s ease-out infinite; }
@keyframes xpulse { 0%, 60% { transform: scale(1); } 75% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* small entrances */
.row.act.pop .actlbl { animation: pop 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
@keyframes pop { from { transform: translateX(-50%) scale(0.5); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.row.media.enter { animation: grow 0.45s ease-out both; }
@keyframes grow { from { opacity: 0; transform: scaleY(0.3); } to { opacity: 1; transform: none; } }
.raw.in .ln { animation: lnIn 0.32s ease-out both; animation-delay: calc(var(--i) * 14ms); }
@keyframes lnIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.swap { animation: swap 0.3s ease-out both; }
@keyframes swap { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.loc div.flash { animation: locf 1.4s ease-out; border-radius: 3px; }
@keyframes locf { from { background: var(--hl); } to { background: transparent; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .dev.ringing::before, .dev.ringing::after { display: none; }
}
.aiv-home{position:fixed;z-index:9999;right:max(10px,env(safe-area-inset-right,0px));bottom:max(10px,env(safe-area-inset-bottom,0px));font:500 11px/1 ui-monospace,Menlo,Consolas,monospace;color:#74f79a;background:#040805cc;border:1px solid #173a22;padding:5px 7px;text-decoration:none;opacity:.75}.aiv-home:hover,.aiv-home:focus-visible{opacity:1}
