/* ===== FLUX SPEED - CYBERPUNK THEME ===== */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Rajdhani:wght@300;400;500;600;700&family=Orbitron:wght@400;700;900&display=swap');

:root {
    --bg-primary: #030810;
    --bg-secondary: #060e1a;
    --bg-card: #080f1c;
    --bg-card-hover: #0c1526;
    --cyan: #00f5ff;
    --cyan-dim: rgba(0, 245, 255, 0.15);
    --cyan-glow: rgba(0, 245, 255, 0.4);
    --purple: #9d00ff;
    --purple-bright: #bf40ff;
    --purple-dim: rgba(157, 0, 255, 0.18);
    --purple-glow: rgba(191, 64, 255, 0.45);
    --green: #00ff88;
    --green-dim: rgba(0, 255, 136, 0.15);
    --amber: #ffaa00;
    --red: #ff3355;
    --text-primary: #e0f0ff;
    --text-secondary: #7090b8;
    --text-dim: #3a5070;
    --border: rgba(0, 245, 255, 0.12);
    --border-bright: rgba(0, 245, 255, 0.35);
    --font-mono: 'Share Tech Mono', monospace;
    --font-display: 'Orbitron', monospace;
    --font-body: 'Rajdhani', sans-serif;
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --bg-primary: #eef2f7;
    --bg-secondary: #e4eaf1;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f7fb;
    --cyan: #0086a8;
    --cyan-dim: rgba(0, 134, 168, 0.10);
    --cyan-glow: rgba(0, 134, 168, 0.30);
    --purple: #7a1fd0;
    --purple-bright: #8a2be2;
    --purple-dim: rgba(122, 31, 208, 0.12);
    --purple-glow: rgba(138, 43, 226, 0.30);
    --green: #11a85a;
    --green-dim: rgba(17, 168, 90, 0.12);
    --amber: #c87f00;
    --red: #d52b48;
    --text-primary: #16222e;
    --text-secondary: #4a6076;
    --text-dim: #8aa0b4;
    --border: rgba(0, 134, 168, 0.20);
    --border-bright: rgba(0, 134, 168, 0.45);
}
/* Light theme tones down the heavy dark-only effects */
[data-theme="light"] .scanlines { display: none; }
[data-theme="light"] .grid-bg {
    background-image:
        linear-gradient(rgba(0,134,168,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,134,168,0.05) 1px, transparent 1px);
}
[data-theme="light"] body { background: var(--bg-primary); }

/* Smooth theme transition */
body, .header, .gauge-card, .info-card, .trace-section, .history-section,
.diagnostics-section, .bw-history-section, .control-bar, .footer,
.mtu-section, .dns-section, .webrtc-section, .diag-card {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== BACKGROUND ===== */
.scanlines {
    position: fixed; inset: 0; pointer-events: none; z-index: 1000;
    background: repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(0,0,0,0.07) 2px,rgba(0,0,0,0.07) 4px);
}
.grid-bg {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image:
        linear-gradient(rgba(0,245,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,245,255,0.025) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ===== HEADER ===== */
.header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(3,8,16,0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-bright);
    box-shadow: 0 0 30px rgba(0,245,255,0.07);
}
.header-inner {
    max-width: 1440px; margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon svg { filter: drop-shadow(0 0 8px var(--cyan)); animation: pulse-icon 3s ease-in-out infinite; }
@keyframes pulse-icon { 0%,100%{filter:drop-shadow(0 0 6px var(--cyan))}50%{filter:drop-shadow(0 0 18px var(--cyan))} }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-flux { font-family: var(--font-display); font-size: 22px; font-weight: 900; color: var(--cyan); letter-spacing: 4px; text-shadow: 0 0 20px var(--cyan-glow); }
.logo-speed { font-family: var(--font-display); font-size: 11px; font-weight: 400; color: var(--text-secondary); letter-spacing: 6px; }
.header-meta { display: flex; gap: 32px; align-items: center; }
.meta-item { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.meta-label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); letter-spacing: 2px; }
.meta-value { font-family: var(--font-mono); font-size: 13px; color: var(--cyan); letter-spacing: 1px; }

.header-actions { display: flex; gap: 8px; align-items: center; }
.header-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; border: 1px solid var(--border); color: var(--cyan);
    font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px;
    padding: 8px 12px; cursor: pointer; border-radius: 3px;
    transition: all 0.2s;
}
.header-btn:hover { border-color: var(--cyan); background: var(--cyan-dim); box-shadow: 0 0 14px var(--cyan-dim); }
.header-btn svg { display: block; }
.theme-toggle { padding: 8px; }
/* Show only the icon for the theme you can switch TO */
.theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: block; }

/* ===== MAIN ===== */
.main { max-width: 1440px; margin: 0 auto; padding: 24px; position: relative; z-index: 1; }

/* ===== CONTROL BAR ===== */
.control-bar {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 28px; padding: 16px 20px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px;
    position: relative; overflow: hidden;
}
.control-bar::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan);
}

/* ===== BUTTONS ===== */
.btn-primary {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 24px; background: transparent;
    border: 1px solid var(--cyan); color: var(--cyan);
    font-family: var(--font-display); font-size: 12px; font-weight: 700;
    letter-spacing: 2px; cursor: pointer; position: relative; overflow: hidden;
    transition: all 0.2s;
    clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}
.btn-primary::before { content: ''; position: absolute; inset: 0; background: var(--cyan-dim); transform: translateX(-100%); transition: transform 0.2s; }
.btn-primary:hover::before { transform: translateX(0); }
.btn-primary:hover { box-shadow: 0 0 20px var(--cyan-glow); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-secondary {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 20px; background: transparent;
    border: 1px solid var(--text-dim); color: var(--text-secondary);
    font-family: var(--font-display); font-size: 12px; letter-spacing: 2px;
    cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-refresh {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; background: transparent;
    border: 1px solid var(--border); color: var(--text-secondary);
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px;
    cursor: pointer; transition: all 0.2s;
}
.btn-refresh:hover { border-color: var(--cyan); color: var(--cyan); }

.test-phase-display { display: flex; flex-direction: column; gap: 2px; margin-left: 8px; }
.phase-label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); letter-spacing: 2px; }
.phase-value { font-family: var(--font-mono); font-size: 14px; color: var(--amber); letter-spacing: 1px; min-width: 140px; }
.progress-bar-container { flex: 1; height: 4px; background: rgba(255,255,255,0.05); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--purple-bright)); border-radius: 2px; transition: width 0.3s ease; box-shadow: 0 0 8px var(--cyan-glow); }

/* ===== GAUGES ===== */
.gauges-section {
    display: grid; grid-template-columns: 1fr auto 1fr;
    margin-bottom: 24px; min-height: 380px;
}
.gauge-card {
    background: var(--bg-card); border: 1px solid var(--border);
    padding: 24px; position: relative; overflow: hidden; transition: border-color 0.3s;
}
.gauge-card:first-child { border-radius: 4px 0 0 4px; }
.gauge-card:last-child  { border-radius: 0 4px 4px 0; }
.gauge-card::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 0%, rgba(0,245,255,0.04) 0%, transparent 70%); pointer-events: none; }
.gauge-card::before { content: ''; position: absolute; top: 0; right: 0; width: 20px; height: 20px; border-top: 2px solid var(--cyan); border-right: 2px solid var(--cyan); opacity: 0.4; }
.gauge-card.active-dl { border-color: var(--cyan); box-shadow: 0 0 30px rgba(0,245,255,0.1); }
.gauge-card.active-ul { border-color: var(--purple-bright); box-shadow: 0 0 30px var(--purple-dim); }
@keyframes testing-pulse { 0%,100%{box-shadow:0 0 0 rgba(0,245,255,0)}50%{box-shadow:0 0 40px rgba(0,245,255,0.15)} }
.gauge-card.testing { animation: testing-pulse 2s ease-in-out infinite; }

.gauge-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.gauge-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 2px; }
.gauge-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: 4px; color: var(--cyan); flex: 1; }
.upload-title { color: var(--purple-bright); }
.gauge-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); transition: all 0.3s; }
.gauge-status-dot.active { background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 1s ease-in-out infinite; }
.upload-dot.active { background: var(--purple-bright); box-shadow: 0 0 8px var(--purple-bright); }
@keyframes blink { 0%,100%{opacity:1}50%{opacity:0.3} }

.gauge-wrap { position: relative; display: flex; justify-content: center; align-items: center; margin-bottom: 20px; min-height: 200px; }
.gauge-wrap canvas { width: 300px; height: 200px; max-width: 100%; }
.gauge-value-display { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.speed-value { font-family: var(--font-display); font-size: 38px; font-weight: 900; color: var(--cyan); text-shadow: 0 0 20px var(--cyan-glow); display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.upload-speed { color: var(--purple-bright); text-shadow: 0 0 20px var(--purple-glow); }
.speed-unit { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); letter-spacing: 2px; }

.gauge-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.stat-item { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); letter-spacing: 1px; }
.stat-value { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); }

/* ===== CENTER DIVIDER ===== */
.gauge-divider {
    width: 180px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 16px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    padding: 20px 16px;
}
.divider-line { width: 1px; flex: 1; background: linear-gradient(to bottom, transparent, var(--border), transparent); min-height: 20px; }
.divider-icon svg { filter: drop-shadow(0 0 10px var(--cyan)); }
.ping-display, .jitter-display, .packetloss-display { text-align: center; width: 100%; }
.ping-label { display: block; font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); letter-spacing: 2px; margin-bottom: 2px; }
.ping-value { display: block; font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--green); text-shadow: 0 0 12px rgba(0,255,136,0.4); }
.ping-unit { font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); }

/* ===== HISTORY CHART ===== */
.history-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 20px; margin-bottom: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 4px; color: var(--cyan); }
.legend { display: flex; gap: 20px; font-family: var(--font-mono); font-size: 11px; }
.legend-dl { color: var(--cyan); }
.legend-ul { color: var(--purple-bright); }
#historyChart { width: 100%; height: 150px; display: block; }

/* ===== CONNECTION DIAGNOSTICS ===== */
.diagnostics-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 20px; margin-bottom: 24px; }
.diag-subtitle { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); letter-spacing: 2px; }
.diag-grid { display: grid; grid-template-columns: 1fr 1.2fr 2fr; gap: 16px; }
.diag-card { background: rgba(0,0,0,0.25); border: 1px solid var(--border); border-radius: 4px; padding: 16px; }
.diag-card-label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); letter-spacing: 2px; margin-bottom: 12px; }

.diag-score-card { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.diag-score-wrap { display: flex; align-items: baseline; gap: 2px; }
.diag-score { font-family: var(--font-display); font-size: 52px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.diag-score-max { font-family: var(--font-mono); font-size: 14px; color: var(--text-dim); }
.diag-grade { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: 3px; margin-top: 8px; }

.diag-bb-card { display: flex; flex-direction: column; }
.diag-bb-grade { font-family: var(--font-display); font-size: 40px; font-weight: 900; line-height: 1; margin-bottom: 12px; }
.diag-bb-rows { display: flex; flex-direction: column; gap: 6px; }
.diag-bb-row { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.diag-bb-row span:last-child { color: var(--text-primary); }
.diag-bb-added { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }
.diag-bb-added span:first-child { color: var(--text-dim); }
.diag-bb-added span:last-child { font-weight: 700; }

.diag-findings-card { display: flex; flex-direction: column; }
.diag-findings { display: flex; flex-direction: column; gap: 8px; }
.diag-finding { display: flex; align-items: flex-start; gap: 10px; font-family: var(--font-mono); font-size: 12px; line-height: 1.4; padding: 6px 0; border-bottom: 1px solid rgba(0,245,255,0.05); }
.diag-finding:last-child { border-bottom: none; }
.diag-icon { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: bold; }
.diag-ok   .diag-icon { background: rgba(0,255,136,0.15); color: var(--green); }
.diag-warn .diag-icon { background: rgba(255,170,0,0.15); color: var(--amber); }
.diag-bad  .diag-icon { background: rgba(255,51,85,0.15); color: var(--red); }
.diag-text { color: var(--text-secondary); }
.diag-ok   .diag-text { color: var(--text-primary); }

@media (max-width: 900px) {
    .diag-grid { grid-template-columns: 1fr; }
}

/* ===== NETWORK INFO — ENLARGED ===== */
.network-info-section { margin-bottom: 24px; }
.network-info-section .section-header { margin-bottom: 16px; }

.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; transition: border-color 0.2s; }
.info-card:hover { border-color: var(--border-bright); }

.info-card-header {
    display: flex; align-items: center; gap: 8px;
    padding: 13px 16px;
    background: rgba(0,245,255,0.04); border-bottom: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 11px; color: var(--cyan); letter-spacing: 2px;
}

.info-rows { padding: 4px 0; }

.info-row {
    display: flex; align-items: baseline;
    padding: 8px 16px; gap: 10px;
    border-bottom: 1px solid rgba(0,245,255,0.05);
    transition: background 0.15s;
}
.info-row:hover { background: rgba(0,245,255,0.04); }
.info-row:last-child { border-bottom: none; }

.info-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 1px;
    min-width: 88px;
    flex-shrink: 0;
    padding-top: 2px;
}

/* ---- THE KEY FIX: larger, brighter values ---- */
.info-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* Special highlight for important IPs */
.info-value.ip-addr {
    font-size: 14px;
    color: var(--cyan);
    letter-spacing: 0.5px;
}

.info-value.isp-name {
    font-size: 13px;
    color: #a0c8ff;
}

.small-text { font-size: 10px !important; line-height: 1.5; white-space: normal !important; }

.copy-btn {
    background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
    font-size: 13px; cursor: pointer; padding: 2px 7px; transition: all 0.2s;
    font-family: var(--font-mono); flex-shrink: 0; line-height: 1;
}
.copy-btn:hover { border-color: var(--cyan); color: var(--cyan); }

/* ===== EXTRA FEATURES SECTION ===== */
.extra-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* ===== MTU PANEL ===== */
.mtu-section, .dns-section, .webrtc-section {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 20px;
}

.mtu-bars { margin-top: 12px; }
.mtu-row {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 0; border-bottom: 1px solid rgba(0,245,255,0.05);
    font-family: var(--font-mono); font-size: 12px;
}
.mtu-row:last-child { border-bottom: none; }
.mtu-size { min-width: 55px; color: var(--text-secondary); font-size: 11px; }
.mtu-bar-wrap { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.mtu-bar { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.mtu-bar.pass { background: var(--green); box-shadow: 0 0 6px var(--green); }
.mtu-bar.fail { background: var(--red); }
.mtu-status { min-width: 36px; text-align: right; font-size: 11px; }
.mtu-status.pass { color: var(--green); }
.mtu-status.fail { color: var(--red); }
.mtu-status.testing { color: var(--amber); animation: blink 0.8s ease infinite; }
.mtu-result { margin-top: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.mtu-result span { color: var(--cyan); font-size: 14px; }

/* ===== DNS LEAK ===== */
.dns-resolvers { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.dns-resolver-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px; border: 1px solid var(--border); border-radius: 3px;
    font-family: var(--font-mono); font-size: 12px;
    transition: border-color 0.2s;
}
.dns-resolver-row.ok   { border-color: rgba(0,255,136,0.25); }
.dns-resolver-row.leak { border-color: rgba(255,51,85,0.4); background: rgba(255,51,85,0.05); }
.dns-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dns-dot.ok   { background: var(--green); box-shadow: 0 0 5px var(--green); }
.dns-dot.leak { background: var(--red);   box-shadow: 0 0 5px var(--red); }
.dns-dot.checking { background: var(--amber); animation: blink 0.7s ease infinite; }
.dns-ip { flex: 1; color: var(--text-primary); }
.dns-label { font-size: 10px; color: var(--text-dim); }
.dns-verdict {
    margin-top: 10px; padding: 8px 12px;
    font-family: var(--font-mono); font-size: 12px;
    border-radius: 3px;
}
.dns-verdict.secure { background: rgba(0,255,136,0.08); color: var(--green); border: 1px solid rgba(0,255,136,0.25); }
.dns-verdict.leaked { background: rgba(255,51,85,0.08); color: var(--red);   border: 1px solid rgba(255,51,85,0.3); }

/* ===== WEBRTC ===== */
.webrtc-ips { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.webrtc-ip-row {
    display: flex; align-items: baseline; gap: 10px;
    padding: 8px 12px; background: rgba(0,0,0,0.2);
    border: 1px solid var(--border); border-radius: 3px;
}
.webrtc-type {
    font-family: var(--font-mono); font-size: 9px; color: var(--text-dim);
    letter-spacing: 1px; min-width: 80px;
}
.webrtc-addr {
    font-family: var(--font-mono); font-size: 13px; color: var(--cyan);
    flex: 1;
}
.webrtc-addr.private { color: var(--amber); }
.webrtc-addr.public  { color: var(--green); }
.webrtc-note { margin-top: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); line-height: 1.5; }

/* ===== TRACE SECTION ===== */
.trace-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 20px; margin-bottom: 24px; }
.trace-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.trace-dir-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
.trace-dir-btn {
    background: transparent; border: none; color: var(--text-secondary);
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px;
    padding: 8px 12px; cursor: pointer; transition: all 0.2s;
}
.trace-dir-btn + .trace-dir-btn { border-left: 1px solid var(--border); }
.trace-dir-btn:hover { color: var(--cyan); }
.trace-dir-btn.active { background: var(--cyan-dim); color: var(--cyan); }
.trace-input {
    background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--text-primary); font-family: var(--font-mono); font-size: 12px;
    padding: 8px 14px; width: 280px; outline: none; transition: border-color 0.2s;
}
.trace-input:focus { border-color: var(--cyan); }
.trace-input::placeholder { color: var(--text-dim); }
.trace-info-bar {
    display: flex; gap: 24px; flex-wrap: wrap;
    padding: 8px 16px; background: rgba(0,0,0,0.3); border: 1px solid var(--border);
    margin: 16px 0; font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); letter-spacing: 1px;
}
.trace-info-item:first-child { color: var(--text-dim); }
.trace-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 2px; }
.trace-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
.trace-table thead tr { background: rgba(0,245,255,0.05); border-bottom: 1px solid var(--border-bright); }
.trace-table th { padding: 10px 16px; text-align: left; font-size: 9px; color: var(--cyan); letter-spacing: 2px; font-weight: 400; white-space: nowrap; }
.trace-table td { padding: 10px 16px; border-bottom: 1px solid rgba(0,245,255,0.04); color: var(--text-secondary); white-space: nowrap; }
.trace-table tbody tr:hover td { background: rgba(0,245,255,0.03); color: var(--text-primary); }
.trace-table tbody tr:last-child td { border-bottom: none; }
.trace-hop-num { color: var(--cyan); font-weight: bold; }
.trace-ip { color: var(--text-primary); }
.trace-host { color: var(--text-secondary); font-size: 11px; }
.latency-good { color: var(--green); }
.latency-ok   { color: var(--amber); }
.latency-bad  { color: var(--red); }
.latency-timeout { color: var(--text-dim); font-style: italic; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-size: 9px; letter-spacing: 1px; }
.status-ok      { color: var(--green);          border: 1px solid rgba(0,255,136,0.3); }
.status-timeout { color: var(--amber);           border: 1px solid rgba(255,170,0,0.3); }
.status-error   { color: var(--red);             border: 1px solid rgba(255,51,85,0.3); }
.status-probing { color: var(--cyan);            border: 1px solid var(--border); animation: blink 0.8s ease infinite; }
.trace-empty-row td { padding: 40px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; }
.trace-row-enter { animation: slideInRow 0.3s ease forwards; }
@keyframes slideInRow { from{opacity:0;transform:translateX(-10px)} to{opacity:1;transform:translateX(0)} }

/* ===== FOOTER ===== */
.footer { border-top: 1px solid var(--border); background: rgba(3,8,16,0.8); position: relative; z-index: 1; }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }
.footer-brand { color: var(--cyan); opacity: 0.6; }

/* ===== TOAST ===== */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--bg-card); border: 1px solid var(--cyan); color: var(--cyan);
    font-family: var(--font-mono); font-size: 12px; padding: 10px 20px;
    z-index: 9999; opacity: 0; transform: translateY(10px);
    transition: all 0.3s; pointer-events: none; box-shadow: 0 0 20px var(--cyan-dim);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== HELP MODAL ===== */
.help-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0, 6, 14, 0.78);
    backdrop-filter: blur(6px);
    display: none; align-items: flex-start; justify-content: center;
    padding: 40px 20px; overflow-y: auto;
}
.help-overlay.open { display: flex; animation: helpFade 0.2s ease; }
@keyframes helpFade { from { opacity: 0; } to { opacity: 1; } }

.help-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 6px;
    max-width: 820px; width: 100%;
    box-shadow: 0 0 50px rgba(0,0,0,0.5), 0 0 30px var(--cyan-dim);
    animation: helpSlide 0.25s ease;
    margin: auto;
}
@keyframes helpSlide { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.help-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--bg-card); border-radius: 6px 6px 0 0;
    z-index: 1;
}
.help-modal-title { display: flex; align-items: center; gap: 10px; color: var(--cyan);
    font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: 3px; }
.help-close {
    background: transparent; border: none; color: var(--text-secondary);
    font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; transition: color 0.2s;
}
.help-close:hover { color: var(--cyan); }

.help-modal-body { padding: 20px 24px; }
.help-intro {
    font-family: var(--font-body); font-size: 15px; color: var(--text-secondary);
    line-height: 1.6; margin-bottom: 20px;
    padding: 12px 16px; border-left: 3px solid var(--cyan); background: var(--cyan-dim); border-radius: 0 4px 4px 0;
}
.help-section { margin-bottom: 22px; }
.help-section h3 {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display); font-size: 13px; font-weight: 700;
    letter-spacing: 2px; color: var(--text-primary); margin-bottom: 8px;
}
.help-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 4px;
    background: var(--cyan-dim); color: var(--cyan);
    font-family: var(--font-mono); font-size: 11px; flex-shrink: 0;
}
.help-section p {
    font-family: var(--font-body); font-size: 14px; color: var(--text-secondary);
    line-height: 1.6; margin-bottom: 8px;
}
.help-section ul { list-style: none; padding: 0; margin: 8px 0 0; }
.help-section li {
    font-family: var(--font-body); font-size: 14px; color: var(--text-secondary);
    line-height: 1.55; padding: 5px 0 5px 18px; position: relative;
}
.help-section li::before {
    content: '▸'; position: absolute; left: 0; color: var(--cyan); font-size: 12px;
}
.help-section strong { color: var(--text-primary); font-weight: 600; }
.help-section em { color: var(--cyan); font-style: normal; }
.help-section code {
    font-family: var(--font-mono); font-size: 12px;
    background: var(--bg-secondary); color: var(--cyan);
    padding: 2px 6px; border-radius: 3px; border: 1px solid var(--border);
}

.help-grade-table {
    margin-top: 12px; display: flex; flex-direction: column; gap: 6px;
    font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary);
}
.help-grade-table > div { display: flex; align-items: center; gap: 10px; }
.help-grade {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 48px; padding: 3px 8px; border-radius: 3px;
    font-weight: bold; font-size: 11px; flex-shrink: 0;
}
.help-grade-a { background: var(--green-dim); color: var(--green); }
.help-grade-b { background: rgba(255,170,0,0.15); color: var(--amber); }
.help-grade-f { background: rgba(255,51,85,0.15); color: var(--red); }

.help-modal-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-top: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); letter-spacing: 1px;
    position: sticky; bottom: 0; background: var(--bg-card); border-radius: 0 0 6px 6px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .info-grid { grid-template-columns: repeat(2, 1fr); }
    .extra-features-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
    .gauges-section { grid-template-columns: 1fr; }
    .gauge-divider { width: 100%; flex-direction: row; padding: 16px; border: 1px solid var(--border); border-radius: 4px; }
    .divider-line { height: 1px; width: 100%; flex: 1; min-height: unset; }
}
@media (max-width: 768px) {
    .info-grid { grid-template-columns: 1fr; }
    .extra-features-grid { grid-template-columns: 1fr; }
    .header-meta { gap: 12px; }
    .header-meta .meta-item { display: none; }
    .header-btn span { display: none; }
    .header-btn { padding: 8px; }
}

/* ===== BANDWIDTH HISTORY ===== */
.bw-history-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 24px;
}

.bw-history-count {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.bw-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

.bw-history-list::-webkit-scrollbar { width: 4px; }
.bw-history-list::-webkit-scrollbar-track { background: transparent; }
.bw-history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.bw-empty {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    padding: 24px 0;
    letter-spacing: 1px;
}

.bw-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 3px;
    transition: border-color 0.15s;
}
.bw-row:hover { border-color: var(--border-bright); }

.bw-row-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    min-width: 0;
}

.bw-row-num {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--cyan);
    letter-spacing: 2px;
}

.bw-row-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bw-row-ping {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--green);
}

.bw-row-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.bw-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bw-bar-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    width: 12px;
    flex-shrink: 0;
}

.bw-bar-track {
    flex: 1;
    height: 5px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}

.bw-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.bw-bar-value {
    font-family: var(--font-mono);
    font-size: 12px;
    min-width: 90px;
    text-align: right;
    flex-shrink: 0;
}

/* ===== TRACE DIRECTION LABEL ===== */
.trace-direction {
    color: var(--cyan) !important;
    font-weight: bold;
    letter-spacing: 1px;
}
