:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
}

.logo i {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-links a {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--bg-card);
}

.nav-links a.active {
    color: var(--primary-light);
    background: rgba(79, 70, 229, 0.15);
}

.main {
    padding-top: 60px;
    min-height: 100vh;
}

.container {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
    min-height: calc(100vh - 60px);
}

.left-panel {
    flex: 0 0 400px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.panel-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.test-types {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.test-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.test-card:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.test-card.active {
    background: rgba(79, 70, 229, 0.1);
    border-color: var(--primary);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.card-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.card-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.card-meta {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 4px;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gauge-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
}

.gauge-box {
    width: 260px;
    height: 260px;
    margin: 0 auto;
}

.gauge-ring {
    position: relative;
    width: 100%;
    height: 100%;
}

.gauge-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--bg-hover);
    stroke-width: 14;
}

.gauge-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 14;
    stroke-linecap: round;
    stroke-dasharray: 534;
    stroke-dashoffset: 534;
    transition: stroke-dashoffset 0.3s;
}

.gauge-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.speed-value {
    font-size: 56px;
    font-weight: 800;
}

.speed-unit {
    font-size: 14px;
    color: var(--text-muted);
}

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

.progress-section {
    margin-top: 24px;
    padding: 0 20px;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

.start-btn {
    margin-top: 24px;
    padding: 16px 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.start-btn:hover {
    transform: translateY(-2px);
}

.start-btn.testing {
    background: linear-gradient(135deg, var(--danger), #f87171);
}

.result-section, .info-section, .node-section {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
}

.result-header, .info-header, .node-header {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border);
}

.result-item {
    background: var(--bg-card);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.result-item i {
    width: 44px;
    height: 44px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--primary-light);
}

.result-content {
    display: flex;
    flex-direction: column;
}

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

.result-value {
    font-size: 22px;
    font-weight: 700;
}

.rank-tip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(245, 158, 11, 0.1);
    border-top: 1px solid var(--border);
    color: var(--warning);
    font-size: 14px;
}

.result-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.btn-save, .btn-share {
    flex: 1;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-save:hover, .btn-share:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.info-list {
    padding: 8px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
}

.info-label {
    font-size: 13px;
    color: var(--text-muted);
}

.info-value {
    font-size: 13px;
    font-weight: 500;
}

.node-list {
    max-height: 200px;
    overflow-y: auto;
}

.node-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.node-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.node-item.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-light);
}

.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
    border-left: 3px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1200px) {
    .container { flex-direction: column; }
    .left-panel { flex: none; width: 100%; }
    .test-types { display: grid; grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .nav { padding: 0 16px; }
    .nav-links { display: none; }
    .container { padding: 16px; }
    .test-types { grid-template-columns: 1fr; }
    .gauge-box { width: 220px; height: 220px; }
    .speed-value { font-size: 48px; }
    .result-grid { grid-template-columns: 1fr; }
}
