/* Speed Test — Main styles
   Theme: deep navy + electric cyan + quantum blue
   Strict CSP: no inline styles anywhere */

/* ── Custom Properties ──────────────────────────────────────────────── */
:root {
    --st-bg:          #010810;
    --st-bg-card:     #050f1a;
    --st-bg-card-h:   #0a1828;
    --st-bg-card-b:   rgba(0, 212, 255, 0.07);
    --st-cyan:        #00d4ff;
    --st-cyan-dim:    rgba(0, 212, 255, 0.18);
    --st-blue:        #0066ff;
    --st-blue-dim:    rgba(0, 102, 255, 0.18);
    --st-green:       #00ff88;
    --st-green-dim:   rgba(0, 255, 136, 0.18);
    --st-amber:       #ff9900;
    --st-red:         #ff3366;
    --st-text:        #e8f4ff;
    --st-text-2:      #6a9ab8;
    --st-text-3:      #2e4a62;
    --st-border:      rgba(0, 212, 255, 0.12);
    --st-border-h:    rgba(0, 212, 255, 0.30);
    --st-glow-cyan:   0 0 20px rgba(0, 212, 255, 0.35), 0 0 40px rgba(0, 212, 255, 0.12);
    --st-glow-blue:   0 0 20px rgba(0, 102, 255, 0.35);
    --st-glow-green:  0 0 20px rgba(0, 255, 136, 0.35);
    --st-radius:      10px;
    --st-radius-lg:   16px;
}

/* ── Reset & Base ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Courier New', Courier, monospace;
    background: var(--st-bg);
    color: var(--st-text);
    min-height: 100vh;
    position: relative;
    z-index: 1;
    cursor: none;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--st-cyan);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

/* ── Page wrapper ───────────────────────────────────────────────────── */
.st-page-wrap {
    position: relative;
    z-index: 5;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.st-header {
    position: relative;
    z-index: 10;
    padding: 1.5rem 0 1.25rem;
    border-bottom: 1px solid var(--st-border);
    margin-bottom: 1.25rem;
}

.st-header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Logo + brand block (left side of header) */
.st-logo-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    padding-right: 1.5rem;
    border-right: 1px solid var(--st-border);
}

.st-logo-link {
    flex-shrink: 0;
}

.st-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--st-border);
    transition: border-color 0.3s ease;
}

.st-logo-img:hover {
    border-color: var(--st-cyan);
}

.st-brand-text {
    display: flex;
    flex-direction: column;
}

.st-brand-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--st-cyan);
    letter-spacing: 0.06em;
    text-shadow: var(--st-glow-cyan);
    line-height: 1.2;
}

.st-brand-sub {
    font-size: 0.65rem;
    color: var(--st-text-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.st-header-text {
    flex: 1;
}

.st-page-title {
    font-size: clamp(1.3rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--st-cyan);
    letter-spacing: 0.04em;
    text-shadow: var(--st-glow-cyan);
    line-height: 1.2;
}

.st-page-subtitle {
    font-size: 0.85rem;
    color: var(--st-text-2);
    margin-top: 0.25rem;
    letter-spacing: 0.06em;
}

.st-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.st-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid var(--st-border);
    background: var(--st-bg-card-b);
}

.st-badge-quic    { border-color: rgba(0, 212, 255, 0.4); color: var(--st-cyan); }
.st-badge-wt      { border-color: rgba(0, 102, 255, 0.4); color: var(--st-blue); }
.st-badge-pq      { border-color: rgba(0, 255, 136, 0.3); color: var(--st-green); }
.st-badge-native  { border-color: rgba(255, 153, 0, 0.3); color: var(--st-amber); }

/* ── Main Content (legacy, unused but kept for safety) ──────────────── */
.st-main {
    position: relative;
    z-index: 5;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

/* ── Status Bar ─────────────────────────────────────────────────────── */
.st-status-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
}

.st-conn-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    border: 1px solid currentColor;
    transition: all 0.3s ease;
}

.st-conn-indicator::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.st-conn-disconnected { color: var(--st-red); background: rgba(255, 51, 102, 0.08); }
.st-conn-connecting   { color: var(--st-cyan); background: var(--st-cyan-dim); animation: stConnBlink 0.8s step-start infinite; }
.st-conn-connected    { color: var(--st-green); background: var(--st-green-dim); }

@keyframes stConnBlink {
    50% { opacity: 0.4; }
}

.st-server-chip {
    color: var(--st-text-2);
    font-size: 0.74rem;
}

.st-feature-pills {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
}

.st-feature-pill {
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid;
}

.st-pill-ok   { color: var(--st-green); border-color: rgba(0,255,136,0.35); background: rgba(0,255,136,0.07); }
.st-pill-no   { color: var(--st-red);   border-color: rgba(255,51,102,0.35); background: rgba(255,51,102,0.07); }

/* ── Controls ───────────────────────────────────────────────────────── */
.st-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.st-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    border-radius: var(--st-radius);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid;
    transition: all 0.2s ease;
    background: transparent;
}

.st-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.st-btn-connect {
    color: var(--st-cyan);
    border-color: rgba(0, 212, 255, 0.5);
    background: rgba(0, 212, 255, 0.08);
}
.st-btn-connect:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.18);
    box-shadow: var(--st-glow-cyan);
}

.st-btn-run {
    color: var(--st-green);
    border-color: rgba(0, 255, 136, 0.5);
    background: rgba(0, 255, 136, 0.08);
}
.st-btn-run:hover:not(:disabled) {
    background: rgba(0, 255, 136, 0.18);
    box-shadow: var(--st-glow-green);
}

.st-btn-latency {
    color: var(--st-blue);
    border-color: rgba(0, 102, 255, 0.5);
    background: rgba(0, 102, 255, 0.08);
}
.st-btn-latency:hover:not(:disabled) {
    background: rgba(0, 102, 255, 0.18);
    box-shadow: var(--st-glow-blue);
}

.st-btn-stop {
    color: var(--st-amber);
    border-color: rgba(255, 153, 0, 0.5);
    background: rgba(255, 153, 0, 0.08);
}
.st-btn-stop:hover:not(:disabled) {
    background: rgba(255, 153, 0, 0.18);
}

.st-btn-disconnect {
    color: var(--st-red);
    border-color: rgba(255, 51, 102, 0.5);
    background: rgba(255, 51, 102, 0.08);
}
.st-btn-disconnect:hover:not(:disabled) {
    background: rgba(255, 51, 102, 0.18);
}

/* ── Phase / Progress ───────────────────────────────────────────────── */
.st-phase-strip {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.2rem;
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
}

.st-phase-label {
    font-weight: 700;
    color: var(--st-cyan);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    min-width: 8rem;
}

.st-phase-detail {
    color: var(--st-text-2);
    font-size: 0.75rem;
    flex: 1;
}

.st-progress-track {
    flex: 1;
    height: 8px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    max-width: 300px;
    border: 1px solid rgba(0, 212, 255, 0.15);
}

.st-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--st-blue), var(--st-cyan));
    border-radius: 4px;
    transition: width 0.4s ease;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.8), 0 0 4px rgba(0, 212, 255, 0.5);
}

/* ── Metrics Grid ───────────────────────────────────────────────────── */
.st-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.st-metric-card {
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
    padding: 1.25rem 1.25rem 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.st-metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--st-cyan), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.st-metric-card:hover {
    border-color: var(--st-border-h);
    box-shadow: var(--st-glow-cyan);
}

.st-metric-card:hover::before {
    opacity: 1;
}

.st-card-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--st-text-2);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.st-metric-display {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.st-big-number {
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 700;
    color: var(--st-cyan);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
    transition: color 0.4s ease, text-shadow 0.4s ease;
}

.st-big-number.good    { color: var(--st-green); text-shadow: 0 0 30px rgba(0, 255, 136, 0.4); }
.st-big-number.fair    { color: var(--st-amber); text-shadow: none; }
.st-big-number.poor    { color: var(--st-red);   text-shadow: none; }

.st-big-unit {
    font-size: 0.8rem;
    color: var(--st-text-2);
    font-weight: 600;
    letter-spacing: 0.06em;
}

.st-metric-canvas {
    width: 100%;
    height: 80px;
    display: block;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
}

/* Quality indicator dot beneath each metric */
.st-quality-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--st-text-3);
    transition: background 0.4s ease, box-shadow 0.4s ease;
    margin-top: 0.5rem;
}

.st-quality-dot.excellent { background: var(--st-green); box-shadow: 0 0 8px var(--st-green); }
.st-quality-dot.good      { background: var(--st-cyan);  box-shadow: 0 0 8px var(--st-cyan); }
.st-quality-dot.fair      { background: var(--st-amber); }
.st-quality-dot.poor      { background: var(--st-red); }

/* ── Download / Upload cards — hero treatment ───────────────────────── */
#st-card-dl,
#st-card-ul {
    border-color: rgba(0, 255, 136, 0.2);
}
#st-card-dl:hover,
#st-card-ul:hover {
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: var(--st-glow-green);
}
#st-card-dl::before,
#st-card-ul::before {
    background: linear-gradient(90deg, transparent, var(--st-green), transparent);
}
#st-card-dl:hover::before,
#st-card-ul:hover::before {
    opacity: 1;
}
#st-card-dl .st-big-number,
#st-card-ul .st-big-number {
    font-size: clamp(2.8rem, 5.5vw, 4.2rem);
    color: var(--st-green);
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
}
#st-card-dl .st-big-unit,
#st-card-ul .st-big-unit {
    font-size: 1rem;
    color: var(--st-green);
    opacity: 0.75;
}
#st-card-dl .st-card-title,
#st-card-ul .st-card-title {
    color: var(--st-green);
}

/* ── Test Phase Colors ──────────────────────────────────────────────── */
.st-metric-card.st-active-phase {
    border-color: var(--st-cyan);
    box-shadow: var(--st-glow-cyan);
}

/* ── Network Fingerprint ────────────────────────────────────────────── */
.st-fingerprint {
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    animation: stFpReveal 0.5s ease forwards;
}

@keyframes stFpReveal {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.st-fingerprint-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--st-border);
}

.st-fingerprint-icon {
    font-size: 1.4rem;
}

.st-fingerprint-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--st-cyan);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.st-fingerprint-subtitle {
    font-size: 0.72rem;
    color: var(--st-text-2);
    margin-left: auto;
}

.st-fp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.st-fp-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    padding: 0.85rem 1rem;
}

.st-fp-item dt {
    font-size: 0.65rem;
    color: var(--st-text-3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.st-fp-item dd {
    font-size: 1rem;
    font-weight: 700;
    color: var(--st-text);
    font-variant-numeric: tabular-nums;
}

.st-fp-score {
    font-size: 2rem;
    color: var(--st-cyan);
    text-shadow: var(--st-glow-cyan);
}

/* ── Fingerprint speed hero row ─────────────────────────────────────── */
.st-fp-speeds {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--st-border);
}

.st-fp-speed-dl,
.st-fp-speed-ul {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: var(--st-radius);
    padding: 1.1rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    position: relative;
}

.st-fp-speed-ul {
    border-color: rgba(0, 102, 255, 0.25);
}

.st-fp-speed-icon {
    font-size: 1.1rem;
    margin-bottom: 0.15rem;
}

.st-fp-speed-val {
    font-size: clamp(2rem, 3.5vw, 3rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--st-green);
}

.st-fp-speed-ul .st-fp-speed-val {
    color: #4d9fff;
}

.st-fp-speed-lbl {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--st-text-3);
    margin-top: 0.3rem;
}

/* ── CSS tooltip ────────────────────────────────────────────────────── */
[data-tip] {
    position: relative;
    cursor: help;
}
/* ── JS-driven tooltip ──────────────────────────────────────────────── */
#st-tooltip {
    position: fixed;
    z-index: 9999;
    background: rgba(0, 8, 24, 0.97);
    border: 1px solid rgba(0, 212, 255, 0.35);
    border-radius: 6px;
    padding: 0.45rem 0.8rem;
    font-size: 0.72rem;
    color: #a8c8e0;
    pointer-events: none;
    white-space: normal;
    max-width: 280px;
    line-height: 1.5;
    letter-spacing: 0.03em;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.85);
    opacity: 0;
    transition: opacity 0.15s ease;
}
#st-tooltip.st-tip-visible {
    opacity: 1;
}

.st-fp-share {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.st-fp-share-label {
    font-size: 0.72rem;
    color: var(--st-text-2);
    letter-spacing: 0.06em;
}

/* ── No WebTransport Fallback ───────────────────────────────────────── */
.st-no-wt {
    background: rgba(255, 51, 102, 0.06);
    border: 1px solid rgba(255, 51, 102, 0.35);
    border-radius: var(--st-radius-lg);
    padding: 2rem;
    text-align: center;
    margin: 2rem 0;
}

.st-no-wt-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.st-no-wt-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--st-red);
    margin-bottom: 0.75rem;
}

.st-no-wt-detail {
    font-size: 0.85rem;
    color: var(--st-text-2);
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* ── Connection Error Banner ────────────────────────────────────────── */
.st-error-banner {
    background: rgba(255, 51, 102, 0.06);
    border: 1px solid rgba(255, 51, 102, 0.35);
    border-radius: var(--st-radius);
    padding: 0.85rem 1.2rem;
    font-size: 0.82rem;
    color: var(--st-red);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

/* ── Advanced Info Panel ────────────────────────────────────────────── */
.st-advanced-panel {
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.st-advanced-title {
    font-size: 0.72rem;
    color: var(--st-text-2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--st-border);
}

.st-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.st-adv-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.st-adv-label {
    font-size: 0.62rem;
    color: var(--st-text-3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.st-adv-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--st-text);
    font-variant-numeric: tabular-nums;
}

.st-adv-value.highlight {
    color: var(--st-cyan);
}

/* ── Fingerprint stats row ──────────────────────────────────────────── */
.st-fp-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--st-border);
    font-size: 0.75rem;
}

.st-fp-stat {
    display: inline-flex;
    gap: 0.35rem;
    color: var(--st-text-2);
}

.st-fp-stat abbr {
    color: var(--st-text-3);
    text-decoration: none;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.st-fp-stat strong {
    color: var(--st-cyan);
    font-variant-numeric: tabular-nums;
}

/* ── How It Works ───────────────────────────────────────────────────── */
.st-about {
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.st-about-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--st-text-2);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--st-border);
}

.st-about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.st-quic-explainer-grid {
    grid-template-columns: 1fr;
}

.st-about-item {
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    padding: 1rem 1.1rem;
}

.st-about-item > strong {
    display: block;
    font-size: 0.8rem;
    color: var(--st-text);
    margin-bottom: 0.5rem;
    letter-spacing: 0.04em;
}

.st-about-item p {
    font-size: 0.75rem;
    color: var(--st-text-2);
    line-height: 1.6;
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.st-footer {
    position: relative;
    z-index: 5;
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--st-border);
    background: rgba(0, 8, 16, 0.8);
    text-align: center;
    font-size: 0.72rem;
    color: var(--st-text-3);
}

.st-footer a {
    color: var(--st-text-2);
}

/* ── Deep Test toggle ───────────────────────────────────────────────── */
.st-deep-test-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    background: var(--st-bg-card);
    font-size: 0.78rem;
    color: var(--st-text-2);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    user-select: none;
}

.st-deep-test-label:hover {
    border-color: var(--st-border-h);
    color: var(--st-text);
    background: var(--st-bg-card-h);
}

.st-deep-test-checkbox {
    width: 14px;
    height: 14px;
    accent-color: var(--st-cyan);
    cursor: pointer;
}

.st-deep-test-label:has(.st-deep-test-checkbox:checked) {
    border-color: var(--st-cyan);
    color: var(--st-cyan);
    background: var(--st-bg-card-b);
}

/* ── Route Analysis Section ─────────────────────────────────────────── */
.st-route-section {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
}

.st-route-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--st-text);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.st-route-subtitle {
    font-size: 0.72rem;
    color: var(--st-text-3);
    margin-bottom: 1.25rem;
}

/* ── Route tracing widget (animated dots shown while traceroute runs) ── */
.st-route-tracing {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1rem;
}
.st-route-tracing-text {
    font-size: 0.72rem;
    color: var(--st-cyan);
    letter-spacing: 0.04em;
}
.st-route-tracing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--st-cyan);
    animation: stTracingPulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}
.st-route-tracing-dot:nth-child(2) { animation-delay: 0.2s; }
.st-route-tracing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes stTracingPulse {
    0%, 100% { opacity: 0.15; }
    50%       { opacity: 1; }
}

/* ── Route chain (vertical) ─────────────────────────────────────────── */
.st-route-chain {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

/* ── Single hop node ────────────────────────────────────────────────── */
.st-route-node {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: background 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.st-route-node:hover {
    background: var(--st-bg-card-h);
}

.st-route-node-timeout {
    opacity: 0.45;
}

.st-route-origin {
    background: rgba(0, 255, 136, 0.04);
    border: 1px solid rgba(0, 255, 136, 0.15);
}

.st-route-done-node {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(0, 212, 255, 0.04);
    border: 1px solid rgba(0, 212, 255, 0.15);
    width: 100%;
    box-sizing: border-box;
}

/* ── Dot ────────────────────────────────────────────────────────────── */
.st-route-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
    border: 2px solid currentColor;
    box-shadow: 0 0 6px currentColor;
}

/* ── Connector (vertical line between nodes) ────────────────────────── */
.st-route-connector {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 1.25rem; /* align with dot center */
    gap: 0;
}

.st-route-connector-line {
    width: 2px;
    min-height: 20px;
    background: var(--st-border);
    border-radius: 1px;
}

.st-route-connector-label {
    font-size: 0.65rem;
    font-variant-numeric: tabular-nums;
    margin-left: 0.4rem;
    opacity: 0.85;
    line-height: 1;
    padding: 1px 0;
}

/* ── Node info area ─────────────────────────────────────────────────── */
.st-route-node-info {
    flex: 1;
    min-width: 0;
}

.st-route-node-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.st-route-hop-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--st-text-3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    min-width: 2rem;
}

.st-route-hop-ip {
    font-size: 0.72rem;
    font-family: 'Courier New', monospace;
    color: var(--st-text-2);
    letter-spacing: 0.04em;
}

.st-route-hop-rtt {
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
    white-space: nowrap;
}

.st-route-node-loc {
    font-size: 0.68rem;
    color: var(--st-text-3);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Latency bar ────────────────────────────────────────────────────── */
.st-route-bar-wrap {
    margin-top: 0.35rem;
    height: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
    max-width: 320px;
}

.st-route-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
    max-width: 100%;
}

/* ── RTT colour classes ─────────────────────────────────────────────── */
/* Used on dot, bar-fill, hop-rtt, connector-label */
.st-rtt-good    { color: var(--st-green);  background: var(--st-green); }
.st-rtt-ok      { color: var(--st-cyan);   background: var(--st-cyan); }
.st-rtt-fair    { color: var(--st-amber);  background: var(--st-amber); }
.st-rtt-poor    { color: var(--st-red);    background: var(--st-red); }
.st-rtt-timeout { color: var(--st-text-3); background: var(--st-text-3); }

/* Dot uses border + box-shadow, not background fill */
.st-route-dot.st-rtt-good    { color: var(--st-green);  border-color: var(--st-green);  background: transparent; box-shadow: 0 0 6px var(--st-green); }
.st-route-dot.st-rtt-ok      { color: var(--st-cyan);   border-color: var(--st-cyan);   background: transparent; box-shadow: 0 0 6px var(--st-cyan); }
.st-route-dot.st-rtt-fair    { color: var(--st-amber);  border-color: var(--st-amber);  background: transparent; box-shadow: 0 0 6px var(--st-amber); }
.st-route-dot.st-rtt-poor    { color: var(--st-red);    border-color: var(--st-red);    background: transparent; box-shadow: 0 0 6px var(--st-red); }
.st-route-dot.st-rtt-timeout { color: var(--st-text-3); border-color: var(--st-text-3); background: transparent; box-shadow: none; }

/* ── Congestion suspect hop highlight ───────────────────────────────── */
.st-route-node-congestion {
    border-left: 2px solid rgba(255, 165, 0, 0.5);
    background: rgba(255, 165, 0, 0.04);
}

/* ── Probe method pills ─────────────────────────────────────────────── */
.st-route-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
}

.st-route-probe-pill {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    line-height: 1.4;
    opacity: 0.85;
}

.st-route-probe-icmp {
    background: rgba(0, 255, 136, 0.12);
    color: var(--st-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.st-route-probe-udp {
    background: rgba(0, 212, 255, 0.12);
    color: var(--st-cyan);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.st-route-probe-tcp {
    background: rgba(180, 120, 255, 0.12);
    color: #b478ff;
    border: 1px solid rgba(180, 120, 255, 0.3);
}

/* ── Congestion badge ───────────────────────────────────────────────── */
.st-route-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-left: auto;
}

.st-route-badge-congestion {
    background: rgba(255, 165, 0, 0.15);
    color: var(--st-amber);
    border: 1px solid rgba(255, 165, 0, 0.35);
}

/* ── Loss badge ─────────────────────────────────────────────────────── */
.st-route-loss-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(255, 80, 80, 0.1);
    color: var(--st-red);
    border: 1px solid rgba(255, 80, 80, 0.3);
}

.st-route-loss-badge.st-rtt-fair {
    background: rgba(255, 165, 0, 0.1);
    color: var(--st-amber);
    border-color: rgba(255, 165, 0, 0.3);
}

/* ── Worst-case tick mark on RTT bar ────────────────────────────────── */
.st-route-bar-wrap { position: relative; }

.st-route-bar-tick {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(255, 165, 0, 0.7);
    border-radius: 1px;
}

/* ── Done node summary pills ────────────────────────────────────────── */
.st-route-done-mtu,
.st-route-done-congestion {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.st-route-done-filtered {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(120, 120, 120, 0.1);
    color: var(--st-text-3);
    border: 1px solid rgba(120, 120, 120, 0.2);
}

.st-route-done-mtu {
    background: rgba(0, 212, 255, 0.1);
    color: var(--st-cyan);
    border: 1px solid rgba(0, 212, 255, 0.25);
}

.st-route-done-congestion {
    background: rgba(255, 165, 0, 0.1);
    color: var(--st-amber);
    border: 1px solid rgba(255, 165, 0, 0.25);
}

/* ── Real-World Experience Section ──────────────────────────────────── */
.st-experience {
    max-width: 1400px;
    margin: 2rem auto 0;
    padding: 0 1.5rem;
}

.st-exp-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.st-exp-title {
    font-size: 1.25rem;
    color: var(--st-text);
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.st-exp-subtitle {
    font-size: 0.78rem;
    color: var(--st-text-2);
}

/* ── Experience Cards ── */
.st-exp-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.st-exp-card {
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s;
}

.st-exp-card:hover {
    border-color: var(--st-border-h);
}

.st-exp-card-top {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.st-exp-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.st-exp-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.st-exp-card-name {
    font-size: 0.78rem;
    color: var(--st-text-2);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Rating badge on the card */
.st-exp-rating {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    align-self: flex-start;
    border: 1px solid currentColor;
}

.st-exp-details {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.st-exp-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.73rem;
}

.st-exp-detail-key {
    color: var(--st-text-3);
    white-space: nowrap;
}

.st-exp-detail-val {
    color: var(--st-cyan);
    text-align: right;
    font-weight: 600;
}

.st-exp-card-subtitle {
    font-size: 0.7rem;
    color: var(--st-text-2);
    font-style: italic;
    margin-top: 0.2rem;
}

/* ── Protocol badge on each experience card ── */
.st-exp-proto-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 0.4rem;
    border: 1px solid;
    opacity: 0.75;
}
.st-exp-proto-udp  { color: var(--st-green); border-color: var(--st-green); background: rgba(0,255,136,0.07); }
.st-exp-proto-tcp  { color: var(--st-amber); border-color: var(--st-amber); background: rgba(255,153,0,0.07); }
.st-exp-proto-both { color: var(--st-cyan);  border-color: var(--st-cyan);  background: rgba(0,212,255,0.07); }

/* ── TCP comparison row inside each experience card ── */
.st-exp-tcp-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.68rem;
}
.st-exp-tcp-label {
    color: var(--st-text-3);
    white-space: nowrap;
    flex-shrink: 0;
}
.st-exp-tcp-rating {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    text-transform: uppercase;
    border: 1px solid;
    flex-shrink: 0;
}
.st-exp-tcp-detail {
    color: var(--st-text-2);
    font-style: italic;
}

/* ── Rating color classes ── */
.exp-excellent {
    color: var(--st-green);
    border-color: var(--st-green);
    background: rgba(0, 255, 136, 0.08);
}

.exp-good {
    color: var(--st-cyan);
    border-color: var(--st-cyan);
    background: rgba(0, 212, 255, 0.08);
}

.exp-fair {
    color: var(--st-amber);
    border-color: var(--st-amber);
    background: rgba(255, 153, 0, 0.08);
}

.exp-poor {
    color: var(--st-red);
    border-color: var(--st-red);
    background: rgba(255, 51, 102, 0.08);
}

/* ── Analysis blocks row (path + congestion + voip) ── */
.st-exp-analysis-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.st-analysis-block {
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    padding: 1rem;
}

.st-analysis-title {
    font-size: 0.78rem;
    color: var(--st-cyan);
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.st-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.75rem;
}

.st-analysis-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.st-analysis-label {
    font-size: 0.65rem;
    color: var(--st-text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.st-analysis-value {
    font-size: 0.8rem;
    color: var(--st-text);
    font-weight: 600;
}

/* ── Share section ── */
.st-share-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0 1.5rem;
}

.st-btn-share {
    background: transparent;
    border: 1px solid var(--st-blue);
    color: var(--st-cyan);
    font-family: inherit;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    padding: 0.55rem 1.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.st-btn-share:hover {
    background: rgba(0, 102, 255, 0.12);
    border-color: var(--st-cyan);
    box-shadow: 0 0 14px rgba(0, 212, 255, 0.22);
}

.st-share-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.st-share-hint {
    font-size: 0.72rem;
    color: var(--st-text-2);
}

.st-share-img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--st-border);
    box-shadow: 0 4px 24px rgba(0, 212, 255, 0.12);
}

/* Canvas is always hidden — only the <img> shows the result */
.st-share-canvas {
    display: none;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .st-main        { padding: 1rem; }
    .st-header      { padding: 1rem; }
    .st-header-inner { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .st-metrics-grid { grid-template-columns: 1fr; }
    .st-controls    { justify-content: center; }
    .st-btn         { font-size: 0.75rem; padding: 0.5rem 1rem; }
    .st-big-number  { font-size: 2rem; }
    #st-card-dl .st-big-number,
    #st-card-ul .st-big-number { font-size: 2.6rem; }
    .st-metric-canvas { height: 60px; }
    .st-status-bar  { font-size: 0.72rem; }
    .st-phase-strip { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .st-progress-track { max-width: 100%; }
    .st-fp-speeds   { grid-template-columns: 1fr; }
    [data-tip]::after { display: none; }
    [data-tip]::before { display: none; }
    .st-route-bar-wrap { max-width: 100%; }
    .st-route-hop-rtt { margin-left: 0; }
    .st-route-node-header { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
    .st-exp-cards { grid-template-columns: 1fr 1fr; }
    .st-exp-analysis-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .st-exp-cards { grid-template-columns: 1fr; }
}

/* ── What's Limiting You? ───────────────────────────────────────────── */
.st-diagnosis {
    max-width: var(--st-max-width);
    margin: 0 auto 2.5rem;
    padding: 0 var(--st-gutter);
}

.st-diag-header {
    margin-bottom: 1.25rem;
}

.st-diag-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--st-text);
    margin: 0 0 0.3rem;
}

.st-diag-subtitle {
    font-size: 0.85rem;
    color: var(--st-muted);
    margin: 0;
}

.st-diag-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.st-diag-item {
    position: relative;
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
    padding: 0.9rem 1.25rem 0.9rem 1.5rem;
    display: grid;
    grid-template-columns: 2rem 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 0.5rem;
    overflow: hidden;
}

.st-diag-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    border-radius: 2px 0 0 2px;
}

.st-diag-critical::before { background: var(--st-red); }
.st-diag-warn::before     { background: var(--st-amber); }
.st-diag-notice::before   { background: var(--st-cyan); }
.st-diag-ok::before       { background: var(--st-green); }

.st-diag-icon {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.1rem;
    line-height: 1.4;
}

.st-diag-title-text {
    grid-column: 2;
    grid-row: 1;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--st-text);
    line-height: 1.4;
}

.st-diag-cause {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.82rem;
    color: var(--st-muted);
    margin: 0.25rem 0 0;
    line-height: 1.5;
}

.st-diag-fix {
    grid-column: 2;
    grid-row: 3;
    font-size: 0.82rem;
    color: var(--st-cyan);
    margin: 0.2rem 0 0;
    line-height: 1.5;
}

.st-diag-fix:empty {
    display: none;
}

/* ── Compare Me ─────────────────────────────────────────────────────── */
.st-comparison {
    max-width: var(--st-max-width);
    margin: 0 auto 2.5rem;
    padding: 0 var(--st-gutter);
}

.st-cmp-header {
    margin-bottom: 1.25rem;
}

.st-cmp-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--st-text);
    margin: 0 0 0.3rem;
}

.st-cmp-subtitle {
    font-size: 0.85rem;
    color: var(--st-muted);
    margin: 0;
}

.st-cmp-count {
    font-variant-numeric: tabular-nums;
}

.st-cmp-medium-badge {
    display: inline-block;
    margin-left: 0.6rem;
    padding: 0.1rem 0.5rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0,200,255,0.1);
    color: var(--st-cyan);
    border: 1px solid rgba(0,200,255,0.25);
    vertical-align: middle;
}

.st-cmp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.st-cmp-item {
    background: var(--st-bg-card);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
    padding: 1rem 1.25rem;
}

.st-cmp-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.st-cmp-metric-name {
    font-size: 0.82rem;
    color: var(--st-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.st-cmp-item-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.st-cmp-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    border: 1px solid var(--st-border);
    background: transparent;
    color: var(--st-muted);
    font-size: 0.72rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s, color 0.2s;
    padding: 0;
    line-height: 1;
}
.st-cmp-info-btn:hover,
.st-cmp-info-btn:focus-visible {
    border-color: var(--st-cyan);
    color: var(--st-cyan);
    outline: none;
}

/* ── Floating tooltip ───────────────────────────────────── */
.st-cmp-tooltip {
    position: absolute;
    z-index: 200;
    min-width: 220px;
    max-width: 300px;
    background: var(--st-bg-card);
    border: 1px solid var(--st-cyan);
    border-radius: var(--st-radius-lg);
    padding: 0.85rem 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    pointer-events: auto;
}
.st-cmp-tooltip.hidden { display: none; }

.st-cmp-tooltip-close {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--st-muted);
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.1rem 0.3rem;
}
.st-cmp-tooltip-close:hover { color: var(--st-text); }

.st-cmp-tooltip-title {
    display: block;
    font-size: 0.82rem;
    color: var(--st-cyan);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    padding-right: 1.2rem;
}

.st-cmp-tooltip-text {
    font-size: 0.8rem;
    color: var(--st-muted);
    line-height: 1.5;
    margin: 0;
}

/* ── No-data notice ─────────────────────────────────────── */
.st-cmp-nodata-notice {
    font-size: 0.82rem;
    color: var(--st-muted);
    margin: 0.75rem 0 0;
    padding: 0.6rem 0.9rem;
    border-left: 3px solid var(--st-border);
    line-height: 1.5;
}

/* Dim cards when no data yet */
.st-cmp-grid.st-cmp-nodata .st-cmp-item {
    opacity: 0.55;
}

.st-cmp-pct {
    font-size: 1.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--st-cyan);
    transition: color 0.3s;
}

.st-cmp-pct.pct-top    { color: var(--st-green); }
.st-cmp-pct.pct-mid    { color: var(--st-cyan);  }
.st-cmp-pct.pct-low    { color: var(--st-amber); }
.st-cmp-pct.pct-bottom { color: var(--st-red);   }

.st-cmp-bar-track {
    height: 6px;
    background: var(--st-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.st-cmp-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--st-cyan);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
}

.st-cmp-caption {
    font-size: 0.79rem;
    color: var(--st-muted);
    margin: 0;
    line-height: 1.4;
}

.st-cmp-loading,
.st-cmp-error {
    font-size: 0.85rem;
    color: var(--st-muted);
    margin: 0.5rem 0 0;
}

.st-cmp-error {
    color: var(--st-red);
}

/* ── WebTransport Live Activity Panel ──────────────────────────────── */
.st-wt-panel {
    background: var(--st-bg-card);
    border: 1px solid rgba(0,102,255,0.25);
    border-radius: var(--st-radius);
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    overflow: hidden;
    transition: border-color 0.3s;
}
.st-wt-panel.wt-active {
    border-color: rgba(0,212,255,0.35);
    box-shadow: 0 0 18px rgba(0,212,255,0.06);
}

/* Top row: icon + title + session meta */
.st-wt-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}
.st-wt-icon {
    font-size: 0.9rem;
}
.st-wt-title {
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--st-cyan);
    font-size: 0.72rem;
}
.st-wt-meta {
    margin-left: auto;
    display: flex;
    gap: 1rem;
    color: var(--st-text-2);
    font-size: 0.72rem;
}
.st-wt-meta strong {
    color: var(--st-text);
}

/* Protocol stack row */
.st-wt-stack-row {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    row-gap: 0.3rem;
}
.st-wt-stack-pill {
    padding: 0.18rem 0.55rem;
    border-radius: 4px;
    border: 1px solid rgba(0,212,255,0.15);
    color: var(--st-text-2);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    background: rgba(0,212,255,0.04);
    transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.st-wt-stack-pill.wt-layer-active {
    color: var(--st-cyan);
    border-color: rgba(0,212,255,0.45);
    background: rgba(0,212,255,0.10);
    box-shadow: 0 0 8px rgba(0,212,255,0.2);
}
.st-wt-stack-pill.wt-layer-wt.wt-layer-active {
    color: var(--st-blue);
    border-color: rgba(0,102,255,0.6);
    background: rgba(0,102,255,0.12);
    box-shadow: 0 0 8px rgba(0,102,255,0.25);
}
.st-wt-stack-arrow {
    color: var(--st-text-3);
    padding: 0 0.3rem;
    font-size: 0.7rem;
}

/* Live activity area */
.st-wt-activity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2rem;
    flex-wrap: wrap;
}
.st-wt-act-phase {
    font-weight: 600;
    color: var(--st-text-2);
    font-size: 0.74rem;
    min-width: 5rem;
    letter-spacing: 0.04em;
}
.st-wt-act-phase.wt-phase-dl { color: var(--st-cyan); }
.st-wt-act-phase.wt-phase-ul { color: var(--st-blue); }
.st-wt-act-phase.wt-phase-rtt,
.st-wt-act-phase.wt-phase-loss { color: var(--st-green); }

/* Stream lanes */
.st-wt-streams {
    display: flex;
    gap: 3px;
    align-items: center;
}
.st-wt-stream-lane {
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,212,255,0.2);
    background: rgba(0,212,255,0.04);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
/* Download streams: 4 wider lanes */
.st-wt-stream-lane.lane-dl {
    width: 48px;
}
/* Upload streams: 16 narrow lanes */
.st-wt-stream-lane.lane-ul {
    width: 14px;
}
/* Flowing data animation */
.st-wt-stream-lane::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,212,255,0.6), transparent);
    animation: wtStreamScan 1.4s linear infinite;
}
.st-wt-stream-lane.lane-ul::after {
    background: linear-gradient(90deg, transparent, rgba(0,102,255,0.7), transparent);
    animation-duration: 0.9s;
}
/* Lane active — currently streaming (scan running, brighter border) */
.st-wt-stream-lane.lane-active {
    border-color: rgba(0,212,255,0.6);
    background: rgba(0,212,255,0.08);
}
.st-wt-stream-lane.lane-active.lane-ul {
    border-color: rgba(0,102,255,0.6);
    background: rgba(0,102,255,0.08);
}
/* Lane done — stream completed (solid fill, stop scan animation) */
.st-wt-stream-lane.lane-done {
    background: rgba(0,212,255,0.28);
    border-color: rgba(0,212,255,0.5);
    transition: background 0.2s, border-color 0.2s;
}
.st-wt-stream-lane.lane-done.lane-ul {
    background: rgba(0,102,255,0.32);
    border-color: rgba(0,102,255,0.5);
}
.st-wt-stream-lane.lane-done::after {
    display: none;
}
/* Stagger stream lane animations */
.st-wt-stream-lane:nth-child(1)::after  { animation-delay: 0s; }
.st-wt-stream-lane:nth-child(2)::after  { animation-delay: 0.18s; }
.st-wt-stream-lane:nth-child(3)::after  { animation-delay: 0.36s; }
.st-wt-stream-lane:nth-child(4)::after  { animation-delay: 0.54s; }
.st-wt-stream-lane:nth-child(5)::after  { animation-delay: 0.07s; }
.st-wt-stream-lane:nth-child(6)::after  { animation-delay: 0.14s; }
.st-wt-stream-lane:nth-child(7)::after  { animation-delay: 0.21s; }
.st-wt-stream-lane:nth-child(8)::after  { animation-delay: 0.28s; }
.st-wt-stream-lane:nth-child(9)::after  { animation-delay: 0.35s; }
.st-wt-stream-lane:nth-child(10)::after { animation-delay: 0.42s; }
.st-wt-stream-lane:nth-child(11)::after { animation-delay: 0.49s; }
.st-wt-stream-lane:nth-child(12)::after { animation-delay: 0.56s; }
.st-wt-stream-lane:nth-child(13)::after { animation-delay: 0.63s; }
.st-wt-stream-lane:nth-child(14)::after { animation-delay: 0.70s; }
.st-wt-stream-lane:nth-child(15)::after { animation-delay: 0.77s; }
.st-wt-stream-lane:nth-child(16)::after { animation-delay: 0.84s; }

@keyframes wtStreamScan {
    from { left: -100%; }
    to   { left:  100%; }
}

/* Datagram pulser */
.st-wt-dg-pulse {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.st-wt-dg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--st-green);
    box-shadow: 0 0 6px var(--st-green);
    animation: wtDgPulse 0.6s ease-out;
}
@keyframes wtDgPulse {
    0%   { transform: scale(1.8); opacity: 1; }
    100% { transform: scale(1);   opacity: 0.6; }
}
.st-wt-dg-count {
    color: var(--st-green);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.st-wt-dg-rtt {
    color: var(--st-text-2);
    font-variant-numeric: tabular-nums;
}

/* Act detail (bytes / timing) */
.st-wt-act-detail {
    color: var(--st-text-2);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
    font-size: 0.73rem;
}

@media (max-width: 640px) {
    .st-wt-meta { display: none; }
    .st-wt-stream-lane.lane-dl { width: 32px; }
    .st-wt-act-detail { display: none; }
}

.st-about-quic-explainer {
    border-top: 1px solid rgba(0,212,255,0.12);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}
.st-about-item-highlight {
    background: rgba(0,212,255,0.04);
    border: 1px solid rgba(0,212,255,0.18);
    border-radius: var(--st-radius);
    padding: 0.85rem 1rem;
}
.st-about-item-highlight > strong {
    color: var(--st-cyan);
}

/* ── TCP Test Button ──────────────────────────────────────────────────── */
.st-btn-tcp {
    color: #c084fc;
    border-color: rgba(192, 132, 252, 0.5);
    background: rgba(192, 132, 252, 0.08);
}
.st-btn-tcp:hover:not(:disabled) {
    background: rgba(192, 132, 252, 0.18);
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.35);
}

/* ── TCP Badge ────────────────────────────────────────────────────────── */
.st-badge-tcp {
    border-color: rgba(192, 132, 252, 0.45);
    color: #c084fc;
}

/* ── QUIC vs TCP Comparison Section ──────────────────────────────────── */
.st-proto-comparison {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(1, 10, 22, 0.7);
    border: 1px solid rgba(192, 132, 252, 0.2);
    border-radius: var(--st-radius);
}

.st-proto-header {
    margin-bottom: 1.25rem;
}

.st-proto-title {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 700;
    color: #c084fc;
    margin: 0 0 0.3rem;
    letter-spacing: -0.01em;
}

.st-proto-subtitle {
    font-size: 0.8rem;
    color: var(--st-text-2);
    margin: 0;
}

/* TCP progress bar (same track/fill pattern as phase strip) */
.st-tcp-run-progress {
    margin-bottom: 1rem;
}

.st-tcp-phase-label {
    display: block;
    font-size: 0.78rem;
    color: #c084fc;
    margin-bottom: 0.4rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ── Comparison table ─────────────────────────────────────────────────── */
.st-proto-table {
    width: 100%;
    border-collapse: collapse;
}

.st-proto-col-header {
    display: grid;
    grid-template-columns: 1.6fr 1.2fr 1.2fr 0.9fr;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.25rem;
    align-items: center;
}

.st-proto-col-metric {
    font-size: 0.7rem;
    color: var(--st-text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.st-proto-col-quic,
.st-proto-col-tcp {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.st-proto-col-sub {
    font-size: 0.65rem;
    color: var(--st-text-3);
    letter-spacing: 0.04em;
}

.st-proto-col-delta {
    font-size: 0.7rem;
    color: var(--st-text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: right;
}

.st-proto-row {
    display: grid;
    grid-template-columns: 1.6fr 1.2fr 1.2fr 0.9fr;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    align-items: center;
    transition: background 0.15s;
}

.st-proto-row:last-child {
    border-bottom: none;
}

.st-proto-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.st-proto-metric {
    font-size: 0.82rem;
    color: var(--st-text-2);
    font-weight: 500;
}

.st-proto-val {
    font-size: 0.88rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.st-proto-quic-val {
    color: var(--st-cyan);
}

.st-proto-tcp-val {
    color: #86efac; /* soft green for TCP */
}

.st-proto-tcp-na-cell {
    color: var(--st-text-3);
    font-size: 0.78rem;
    font-weight: 400;
}

.st-proto-tcp-na-hint {
    font-size: 0.68rem;
    color: var(--st-text-3);
}

.st-proto-delta {
    font-size: 0.78rem;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--st-text-3);
}

.st-proto-delta-good {
    color: var(--st-green);
}

.st-proto-delta-warn {
    color: var(--st-amber);
}

.st-proto-delta-na {
    color: var(--st-text-3);
}

/* ── Insight box ──────────────────────────────────────────────────────── */
.st-proto-insight {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    background: rgba(192, 132, 252, 0.06);
    border: 1px solid rgba(192, 132, 252, 0.2);
    border-radius: var(--st-radius);
}

.st-proto-insight-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.st-proto-insight-text {
    font-size: 0.82rem;
    color: var(--st-text);
    line-height: 1.55;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .st-proto-col-header,
    .st-proto-row {
        grid-template-columns: 1.4fr 1fr 1fr 0.7fr;
        gap: 0.35rem;
        padding: 0.5rem 0.5rem;
    }
    .st-proto-val { font-size: 0.78rem; }
    .st-proto-metric { font-size: 0.72rem; }
    .st-proto-col-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Location Picker ─────────────────────────────────────────────────── */
.st-location-bar {
    margin: 0 auto 12px;
    max-width: 960px;
    padding: 0 16px;
}

.st-location-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.st-loc-label {
    font-size: 0.72rem;
    color: var(--st-text-2);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    padding-right: 4px;
}

.st-loc-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--st-border);
    background: transparent;
    color: var(--st-text-2);
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
    white-space: nowrap;
}

.st-loc-btn:hover:not(.st-loc-btn-offline) {
    border-color: var(--st-cyan-dim);
    color: var(--st-text);
    background: rgba(0, 212, 255, 0.06);
}

.st-loc-btn-active {
    border-color: var(--st-cyan);
    color: var(--st-cyan);
    background: rgba(0, 212, 255, 0.10);
}

.st-loc-btn-offline {
    opacity: 0.4;
    cursor: not-allowed;
}

.st-loc-flag {
    font-size: 1rem;
    line-height: 1;
}

.st-loc-name {
    font-weight: 500;
}

.st-loc-dist {
    font-size: 0.68rem;
    color: var(--st-text-3);
    padding-left: 2px;
}

.st-loc-btn-active .st-loc-dist {
    color: rgba(0, 212, 255, 0.55);
}

.st-loc-offline-tag {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 51, 102, 0.15);
    color: var(--st-red);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 2px;
}
