/* ========================================
   China Connectivity Test — Hacker Theme
   ======================================== */

:root {
    --bg-primary: #0a0e17;
    --bg-card: rgba(13, 19, 33, 0.85);
    --bg-card-hover: rgba(18, 26, 45, 0.95);
    --bg-terminal: #060a12;
    --border-glow: #00ff8855;
    --border-dim: rgba(0, 255, 136, 0.15);
    --text-primary: #e0e6f0;
    --text-secondary: #7a8ba8;
    --text-dim: #4a5568;
    --accent: #00ff88;
    --accent-dim: rgba(0, 255, 136, 0.2);
    --danger: #ff3b5c;
    --danger-dim: rgba(255, 59, 92, 0.15);
    --warning: #ffb800;
    --warning-dim: rgba(255, 184, 0, 0.15);
    --success: #00ff88;
    --info: #00d4ff;
    --info-dim: rgba(0, 212, 255, 0.15);
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Animated grid background */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(60px, 60px);
    }
}

/* CRT scanline effect */
.scanline {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px);
    pointer-events: none;
    z-index: 1;
}

.container {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* ── Site Notice Banner ── */
.site-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.steam-notice {
    background: linear-gradient(90deg, #1b2838, #2a475e);
    color: #c6d4df;
    border-bottom: 1px solid rgba(102, 192, 244, 0.3);
}

.notice-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.notice-link {
    color: #66c0f4;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px dashed #66c0f4;
    transition: color 0.2s;
}

.notice-link:hover {
    color: #fff;
}

.banner-close {
    background: none;
    border: none;
    color: #8f98a0;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
    padding: 0 4px;
    flex-shrink: 0;
}

.banner-close:hover {
    color: #fff;
}

/* ── Header ── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px 0 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glow);
    text-shadow: 0 0 20px var(--accent);
}

.title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.node-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px var(--accent);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* ── Input Card ── */
.input-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(16px);
    margin-bottom: 20px;
}

.input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.target-group {
    flex: 1;
    min-width: 200px;
}

.port-group {
    width: 100px;
}

.input-group input {
    background: var(--bg-terminal);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group input::placeholder {
    color: var(--text-dim);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim), inset 0 0 8px rgba(0, 255, 136, 0.05);
}

.btn-run {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent), #00cc6a);
    color: #0a0e17;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-run:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.4);
}

.btn-run:active {
    transform: translateY(0);
}

.btn-run:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(10, 14, 23, 0.3);
    border-top-color: #0a0e17;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Tabs ── */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 7px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.tab:hover {
    background: var(--accent-dim);
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent-dim);
    border-color: var(--border-glow);
    color: var(--accent);
    font-weight: 600;
}

/* ── Results ── */
.results-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-family: var(--font-mono);
    font-size: 48px;
    color: var(--accent);
    opacity: 0.3;
    margin-bottom: 16px;
    animation: blink 1.5s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.empty-hint {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 8px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-dim);
    background: rgba(0, 0, 0, 0.2);
}

.result-title {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.result-status {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
}

.status-ok {
    background: rgba(0, 255, 136, 0.15);
    color: var(--success);
}

.status-fail {
    background: var(--danger-dim);
    color: var(--danger);
}

.status-warn {
    background: var(--warning-dim);
    color: var(--warning);
}

.status-loading {
    background: var(--info-dim);
    color: var(--info);
    animation: pulse 1.5s infinite;
}

/* Terminal output */
.terminal-output {
    padding: 16px 18px;
    background: var(--bg-terminal);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
    border: none;
}

.terminal-output::-webkit-scrollbar {
    width: 6px;
}

.terminal-output::-webkit-scrollbar-track {
    background: transparent;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: var(--border-dim);
    border-radius: 3px;
}

/* Traceroute loading tip */
.traceroute-tip {
    padding: 16px 18px;
    background: rgba(27, 40, 56, 0.6);
    border-bottom: 1px solid var(--border-dim);
    font-size: 13px;
    color: var(--text-secondary);
}

.inline-tip {
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(27, 40, 56, 0.8), rgba(42, 71, 94, 0.5));
    border-radius: var(--radius-sm);
    border-left: 3px solid #66c0f4;
    font-size: 12px;
    line-height: 1.6;
}

.inline-tip a {
    color: #66c0f4;
    text-decoration: none;
    font-weight: 600;
}

.inline-tip a:hover {
    text-decoration: underline;
}

/* ── Info Slots (inline, per-result) ── */
.info-slot {
    display: none;
    padding: 14px 18px;
    font-size: 13px;
    border-top: 1px solid var(--border-dim);
    animation: fadeIn 0.6s ease;
}

.info-slot.active {
    display: block;
}

.notice-inline {
    background: linear-gradient(135deg, rgba(255, 59, 92, 0.08), rgba(255, 59, 92, 0.02));
    border-left: 3px solid var(--danger);
    color: var(--text-primary);
}

.notice-inline a {
    color: var(--danger);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed var(--danger);
}

.notice-inline a:hover {
    color: #ff6b85;
}

/* ── GFW Alert Overlay ── */
.gfw-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.solution-card {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 1px solid var(--danger);
    border-radius: 16px;
    padding: 36px;
    max-width: 460px;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 59, 92, 0.2);
}

.solution-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.solution-card h3 {
    font-size: 22px;
    color: var(--danger);
    margin-bottom: 12px;
}

.solution-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.7;
}

.solution-cta p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.vpn-btn {
    display: inline-block;
    padding: 14px 36px;
    background: linear-gradient(135deg, #ff3b5c, #ff6b85);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(255, 59, 92, 0.3);
}

.vpn-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 59, 92, 0.5);
}

.solution-url {
    display: block;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
}

.solution-close {
    display: block;
    margin: 24px auto 0;
    background: transparent;
    border: 1px solid var(--text-dim);
    border-radius: 6px;
    padding: 8px 20px;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.solution-close:hover {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

/* ── Footer ── */
.footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-dim);
    text-align: center;
}

.footer-partners {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.footer-partner-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s;
}

.footer-partner-item:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 255, 136, 0.1);
}

.footer-partner-item strong {
    color: var(--accent);
}

.footer-info {
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    margin-bottom: 6px;
}

.footer-copy {
    font-size: 11px;
    color: var(--text-dim);
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .header {
        padding: 20px 0 16px;
    }

    .title {
        font-size: 18px;
    }

    .subtitle {
        font-size: 11px;
    }

    .logo-icon {
        font-size: 22px;
        padding: 6px 10px;
    }

    .input-card {
        padding: 14px;
    }

    .input-row {
        flex-direction: column;
    }

    .target-group,
    .port-group {
        width: 100%;
        min-width: unset;
    }

    .btn-run {
        width: 100%;
        padding: 12px;
    }

    .tab-bar {
        gap: 2px;
    }

    .tab {
        padding: 6px 10px;
        font-size: 11px;
    }

    .terminal-output {
        font-size: 11px;
        padding: 12px;
    }

    .site-notice {
        font-size: 12px;
        flex-wrap: wrap;
    }

    .solution-card {
        padding: 24px 18px;
    }

    .solution-card h3 {
        font-size: 18px;
    }

    .vpn-btn {
        padding: 12px 24px;
        font-size: 14px;
    }

    .footer-partners {
        flex-direction: column;
    }
}