@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/unbounded-latin-ext-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/unbounded-latin-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/unbounded-latin-ext-700-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/unbounded-latin-700-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/manrope-latin-ext-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/manrope-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/manrope-latin-ext-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/manrope-latin-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/manrope-latin-ext-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/manrope-latin-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/manrope-latin-ext-700-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/manrope-latin-700-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-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');
}
: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 signal path. A wide "journey" strip shows the voice travelling left to right (phone → codec → packets → internet → jitter buffer → speaker). Under it, controls on the left and the call-quality readout on the right, then the two waveforms you can listen to. Teal = voice, red = lost, amber = late. */
:root {
  --bg: #eff3f1;
  --surface: #ffffff;
  --sunk: #e3eae7;
  --ink: #13201c;
  --muted: #5b6b66;
  --rule: #d0dad6;
  --accent: #0d8487;
  --on-accent: #ffffff;
  --voice: #0d8487;
  --lost: #d1495b;
  --late: #d98a07;
  --good: #23935a;
  --display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --sans: "Manrope", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1312; --surface: #141c1a; --sunk: #0a0f0e; --ink: #e2ebe8; --muted: #8aa09a; --rule: #25322f;
    --accent: #3cc6c8; --on-accent: #08100f; --voice: #3cc6c8; --lost: #ff6b7d; --late: #f2a93b; --good: #4fd18d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1312; --surface: #141c1a; --sunk: #0a0f0e; --ink: #e2ebe8; --muted: #8aa09a; --rule: #25322f;
  --accent: #3cc6c8; --on-accent: #08100f; --voice: #3cc6c8; --lost: #ff6b7d; --late: #f2a93b; --good: #4fd18d;
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font: 14.5px/1.5 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 40px;
}
button, input { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px 24px; }
h1 { margin: 0; font: 700 clamp(22px, 3vw, 30px)/1.05 var(--display); letter-spacing: -0.02em; text-wrap: balance; }
h1 span { color: var(--accent); }
.top p { margin: 6px 0 0; color: var(--muted); max-width: 64ch; }
.top-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--rule); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn svg { width: 14px; height: 14px; fill: currentColor; }
.label { font: 600 10.5px/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; }
.presets > .label { color: var(--accent); }
.presets .list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--rule); background: var(--bg); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.chip small { font-weight: 500; color: var(--muted); margin-left: 4px; }

.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.journey { padding: 0; overflow: hidden; }
.jscroll { overflow-x: auto; }
.journey canvas { display: block; width: 100%; min-width: 700px; height: 270px; }
.stages { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.stage { border: 0; border-right: 1px solid var(--rule); background: none; padding: 10px 10px 11px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stage:last-child { border-right: 0; }
.stage:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.stage[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.stage .n { font: 600 10.5px var(--mono); color: var(--accent); }
.stage b { font-size: 13px; line-height: 1.25; }
.stage span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.explain { border-top: 1px solid var(--rule); padding: 12px 16px 14px; display: flex; gap: 14px; align-items: flex-start; }
.explain h3 { margin: 0 0 4px; font: 700 15px/1.3 var(--sans); }
.explain p { margin: 0; max-width: 92ch; }
.explain p + p { margin-top: 6px; color: var(--muted); font-size: 13.5px; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 14px; }
.ctrls { display: flex; flex-direction: column; gap: 14px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { border: 1px solid var(--rule); background: var(--bg); border-radius: 8px; padding: 7px 8px; cursor: pointer; text-align: left; }
.seg button b { display: block; font-size: 13.5px; }
.seg button span { font: 11px var(--mono); color: var(--muted); }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.seg button[aria-pressed="true"] b { color: var(--accent); }
.ctl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; }
.ctl label { font-weight: 700; font-size: 13.5px; }
.ctl output { font: 600 12.5px var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.ctl input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 2px 0 0; }
.ctl small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; line-height: 1.35; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.check small { display: block; color: var(--muted); font-size: 12px; }

.quality { display: flex; flex-direction: column; gap: 14px; }
.mos { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: center; padding-bottom: 18px; }
.gauge { position: relative; width: 170px; height: 100px; }
.gauge svg { width: 170px; height: 100px; overflow: visible; }
.gauge .num { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font: 700 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.gauge .cap { position: absolute; left: 0; right: 0; bottom: -16px; text-align: center; font: 600 10px var(--mono); color: var(--muted); letter-spacing: 0.06em; }
.verdict b { display: block; font: 700 17px/1.25 var(--sans); }
.verdict p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; background: var(--sunk); font: 600 11px/26px var(--mono); }
.bar div { padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--on-accent); min-width: 0; transition: flex-basis 0.3s; }
.bar .b1 { background: color-mix(in srgb, var(--accent) 55%, var(--muted)); }
.bar .b2 { background: var(--accent); }
.bar .b3 { background: color-mix(in srgb, var(--late) 85%, var(--ink)); }
.legend { display: flex; justify-content: space-between; font: 11.5px var(--mono); color: var(--muted); margin-top: 4px; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat b { display: block; font: 700 18px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); line-height: 1.3; display: block; }
.stat.lost b { color: var(--lost); } .stat.late b { color: var(--late); }
.note { margin: 0; font-size: 12.5px; color: var(--muted); }
.warn { color: var(--lost); font-weight: 700; }

.waves { display: flex; flex-direction: column; gap: 10px; }
.wave-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: center; }
.wave-row .who b { display: block; font-size: 14px; }
.wave-row .who span { font-size: 12px; color: var(--muted); }
.wave-row canvas { width: 100%; height: 86px; display: block; background: var(--sunk); border-radius: 8px; cursor: pointer; }
.wave-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.key { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

@media (max-width: 980px) {
  .grid2 { grid-template-columns: 1fr; }
  .stages { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stage { border-bottom: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mos { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wave-row { grid-template-columns: 1fr; gap: 6px; }
  .seg { grid-template-columns: 1fr; }
}
.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}
