/* Reset & Base Variables */
:root {
    --bg-main: #0B0F19;
    --card-bg: rgba(18, 26, 43, 0.75);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #4F46E5;
    --primary-hover: #6366F1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --accent-cyan: #06B6D4;
    --accent-emerald: #10B981;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --font-family: 'Outfit', 'Noto Sans SC', -apple-system, sans-serif;
    --font-code: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    padding: 20px;
}

/* Background Atmosphere */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

.bg-glow-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #4F46E5 0%, rgba(6, 182, 212, 0) 70%);
    top: -100px;
    left: -100px;
    animation: floatGlow 12s infinite alternate ease-in-out;
}

.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #06B6D4 0%, rgba(79, 70, 229, 0) 70%);
    bottom: -150px;
    right: -100px;
    animation: floatGlow 15s infinite alternate-reverse ease-in-out;
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
    pointer-events: none;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 30px) scale(1.1); }
    100% { transform: translate(-30px, 60px) scale(0.95); }
}

/* Container */
.container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 520px;
}

/* Glass Card */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 36px 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 30px 60px -12px rgba(79, 70, 229, 0.25);
}

/* Brand Badge */
.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

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

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Loader Box */
.loader-box {
    margin: 10px 0 28px;
}

.radar-spinner {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.radar-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.circle-1 { width: 90px; height: 90px; border-color: rgba(6, 186, 212, 0.25); }
.circle-2 { width: 65px; height: 65px; border-color: rgba(99, 102, 241, 0.4); }
.circle-3 { width: 40px; height: 40px; border-color: rgba(99, 102, 241, 0.6); }

.radar-sweep {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(6, 186, 212, 0.4) 0deg, transparent 90deg, transparent 360deg);
    animation: spinSweep 1.5s linear infinite;
}

.center-icon {
    position: relative;
    z-index: 2;
    color: var(--accent-cyan);
    animation: rotateIcon 4s linear infinite;
}

@keyframes spinSweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotateIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.status-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.status-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Node Info Box */
.node-info-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.node-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.node-label { color: var(--text-muted); }
.node-val { font-weight: 500; color: var(--text-primary); }
.node-val.highlight { color: var(--accent-cyan); }
.node-val.green { color: var(--accent-emerald); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #3B82F6 100%);
    color: #FFF;
    box-shadow: 0 8px 20px -4px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #60A5FA 100%);
    box-shadow: 0 12px 25px -4px rgba(99, 102, 241, 0.6);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
}

/* Card Footer */
.card-footer {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.tip-text {
    font-size: 12px;
    color: var(--text-muted);
}

.toggle-mode-btn {
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    transition: opacity 0.2s;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.toggle-mode-btn:hover {
    opacity: 0.8;
}

/* Modal Overlay & Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 16, 0.85);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    width: 100%;
    max-width: 840px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-title svg { stroke: var(--accent-cyan); }

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover { color: var(--text-primary); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.config-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.config-section h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.step-num {
    background: var(--primary);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
}

/* Inputs & Grids */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13px;
    color: var(--text-secondary);
}

.form-input {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px 14px;
    color: #FFF;
    font-size: 14px;
    font-family: var(--font-code);
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--primary-hover);
}

.targets-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

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

.target-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.target-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.tag-a { background: rgba(6, 186, 212, 0.15); color: var(--accent-cyan); border: 1px solid rgba(6, 186, 212, 0.3); }
.tag-b { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }

/* Tabs */
.tab-nav {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.04); }
.tab-btn.active { color: #FFF; background: var(--primary); }

.tab-pane {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.tab-pane.active { display: flex; }

.tab-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Code Container */
.code-container {
    position: relative;
    background: #090D16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    max-height: 280px;
    overflow-y: auto;
}

.code-container pre {
    margin: 0;
}

.code-container code {
    font-family: var(--font-code);
    font-size: 12.5px;
    color: #38BDF8;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #FFF;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-emerald);
    color: #000;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.test-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.test-result {
    font-size: 13px;
    color: var(--accent-cyan);
    font-family: var(--font-code);
}
