        /* ========================================
           CSS VARIABLES & THEMING
           ======================================== */
        :root {
            /* Dark Mode Colors (Default) */
            --bg-primary: #0a0e27;
            --bg-secondary: #141b3a;
            --bg-tertiary: #1e2749;
            --bg-glass: rgba(255, 255, 255, 0.05);
            --text-primary: #ffffff;
            --text-secondary: #a0a8c9;
            --text-muted: #6b7599;
            --accent-primary: #00d4ff;
            --accent-secondary: #7c3aed;
            --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --accent-glow: rgba(0, 212, 255, 0.3);
            --success: #10b981;
            --warning: #f59e0b;
            --error: #ef4444;
            --border-color: rgba(255, 255, 255, 0.1);
            --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
            --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
            --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
            --shadow-glow: 0 0 20px var(--accent-glow);
        }

        [data-theme="light"] {
            --bg-primary: #f5f7fa;
            --bg-secondary: #ffffff;
            --bg-tertiary: #e5e9f0;
            --bg-glass: rgba(0, 0, 0, 0.03);
            --text-primary: #1a202c;
            --text-secondary: #4a5568;
            --text-muted: #718096;
            --accent-primary: #0891b2;
            --accent-secondary: #7c3aed;
            --border-color: rgba(0, 0, 0, 0.1);
            --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
            --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
            --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
            --shadow-glow: 0 0 20px rgba(8, 145, 178, 0.2);
        }

        /* ========================================
           RESET & BASE STYLES
           ======================================== */
        html {
            scroll-behavior: smooth;
        }

        @media (prefers-reduced-motion: reduce) {
            html {
                scroll-behavior: auto;
            }
        }

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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.6;
            overflow-x: hidden;
            min-height: 100vh;
            transition: background 0.3s ease;
        }

        /* Background gradient overlay */
        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
                        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
            pointer-events: none;
            z-index: 0;
        }

        #app {
            position: relative;
            z-index: 1;
        }

        /* ========================================
           PARTICLE CANVAS BACKGROUND
           ======================================== */
        #particles-canvas {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 0;
            opacity: 0.3;
        }

        /* ========================================
           NAVIGATION BAR
           ======================================== */
        .navbar {
            position: sticky;
            top: 0;
            z-index: 100;
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border-bottom: 1px solid var(--border-color);
            padding: 1rem 2rem;
        }

        .navbar-content {
            max-width: 1400px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            font-size: 1.5rem;
            font-weight: 700;
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        /* Apple-inspired Segmented Control */
        .segmented-control {
            position: relative;
            display: inline-flex;
            background: rgba(118, 118, 128, 0.12);
            border-radius: 10px;
            padding: 2px;
            gap: 0;
            backdrop-filter: blur(10px);
            box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
        }

        .segmented-control-slider {
            position: absolute;
            background: var(--bg-secondary);
            border-radius: 8px;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow:
                0 3px 8px rgba(0, 0, 0, 0.12),
                0 1px 3px rgba(0, 0, 0, 0.08),
                inset 0 0 0 0.5px rgba(255, 255, 255, 0.1);
            z-index: 1;
            pointer-events: none;
        }

        .segment-btn {
            position: relative;
            z-index: 2;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            padding: 0.5rem 1.25rem;
            background: transparent;
            border: none;
            color: var(--text-secondary);
            font-size: 0.9375rem;
            font-weight: 500;
            cursor: pointer;
            transition: color 0.3s ease;
            white-space: nowrap;
            min-width: 110px;
        }

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

        .segment-btn.active {
            color: var(--accent-primary);
        }

        .segment-icon {
            font-size: 1.1rem;
            display: flex;
            align-items: center;
        }

        .segment-label {
            font-weight: 600;
        }

        /* Dark mode adjustments for segmented control */
        [data-theme="dark"] .segmented-control {
            background: rgba(118, 118, 128, 0.24);
        }

        [data-theme="dark"] .segmented-control-slider {
            background: rgba(255, 255, 255, 0.15);
            box-shadow:
                0 3px 8px rgba(0, 0, 0, 0.3),
                0 1px 3px rgba(0, 0, 0, 0.2),
                inset 0 0 0 0.5px rgba(255, 255, 255, 0.15);
        }

        [data-theme="dark"] .segment-btn.active {
            color: var(--accent-primary);
        }

        /* Light mode adjustments for segmented control */
        [data-theme="light"] .segmented-control-slider {
            background: rgba(255, 255, 255, 0.9);
            box-shadow:
                0 3px 8px rgba(0, 0, 0, 0.12),
                0 1px 3px rgba(0, 0, 0, 0.08),
                inset 0 0 0 0.5px rgba(0, 0, 0, 0.08);
        }

        .theme-toggle {
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            padding: 0.5rem 1rem;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 1.2rem;
        }

        .theme-toggle:hover {
            background: var(--bg-secondary);
            box-shadow: var(--shadow-sm);
        }

        /* ========================================
           CONTAINER & LAYOUT
           ======================================== */
        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 2rem;
        }

        .view {
            display: none;
            animation: fadeIn 0.5s ease;
        }

        .view.active {
            display: block;
        }

        /* ========================================
           HOME VIEW
           ======================================== */
        .hero {
            text-align: center;
            padding: 2rem 2rem;
            min-height: 80vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .hero-title {
            font-size: 3.5rem;
            font-weight: 800;
            margin-bottom: 1rem;
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: slideDown 0.8s ease;
        }

        .hero-subtitle {
            font-size: 1.25rem;
            color: var(--text-secondary);
            margin-bottom: 1.5rem;
            animation: slideUp 0.8s ease;
        }

        .connection-info {
            text-align: center;
            margin-bottom: 2rem;
            padding: 0.75rem 1.5rem;
            background: var(--card-bg);
            border-radius: 12px;
            border: 1px solid var(--border-color);
            display: inline-flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            animation: fadeIn 1s ease;
        }

        .connection-info-item {
            font-size: 0.95rem;
            color: var(--text-secondary);
            font-weight: 500;
            display: inline-flex;
            align-items: center;
        }

        .connection-info-item:not(:last-child)::after {
            content: "•";
            margin-left: 0.5rem;
            color: var(--text-secondary);
            opacity: 0.5;
        }

        .start-button {
            width: 200px;
            height: 200px;
            border-radius: 50%;
            background: var(--accent-gradient);
            border: none;
            color: white; /* Intentional: white text works on dark gradient in both themes */
            font-size: 2.5rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: var(--shadow-lg), var(--shadow-glow);
            animation: pulse 2s infinite;
            position: relative;
            overflow: hidden;
        }

        .start-button::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.3);
            transform: translate(-50%, -50%);
            transition: width 0.6s, height 0.6s;
        }

        .start-button:hover::before {
            width: 300px;
            height: 300px;
        }

        .start-button:hover {
            transform: scale(1.1);
            box-shadow: var(--shadow-lg), 0 0 40px var(--accent-glow);
        }

        .start-button:active {
            transform: scale(0.95);
        }

        .last-test-widget {
            margin-top: 3rem;
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 1.5rem;
            max-width: 600px;
            margin-left: auto;
            margin-right: auto;
        }

        .last-test-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .last-test-title {
            font-size: 0.875rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .last-test-time {
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        .last-test-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1rem;
        }

        .last-test-stat {
            text-align: center;
        }

        .last-test-stat-label {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-bottom: 0.25rem;
        }

        .last-test-stat-value {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--accent-primary);
        }

        .last-test-widget.hidden {
            display: none;
        }

        /* ========================================
           PRIVACY FEATURES SECTION
           ======================================== */
        .privacy-features {
            margin-top: 4rem;
            padding: 3rem 2rem;
            max-width: 1200px;
            margin-left: auto;
            margin-right: auto;
        }

        .privacy-header {
            text-align: center;
            margin-bottom: 3rem;
        }

        .privacy-title {
            font-size: 2.5rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 1rem;
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .privacy-subtitle {
            font-size: 1.125rem;
            color: var(--text-secondary);
            max-width: 600px;
            margin: 0 auto;
        }

        .privacy-guarantee {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 1rem;
            padding: 0.75rem 1.5rem;
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
            border: 2px solid #10b981;
            border-radius: 50px;
            color: #10b981;
            font-weight: 600;
            font-size: 0.95rem;
            animation: pulse 2s infinite;
        }

        .privacy-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 2rem;
            margin-top: 2rem;
        }

        .privacy-card {
            position: relative;
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 2rem;
            transition: all 0.3s ease;
            overflow: hidden;
        }

        .privacy-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: var(--accent-gradient);
            transform: scaleX(0);
            transition: transform 0.3s ease;
        }

        .privacy-card:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-lg);
            border-color: var(--accent-primary);
        }

        .privacy-card:hover::before {
            transform: scaleX(1);
        }

        .privacy-card-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
            filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
        }

        .privacy-card-title {
            font-size: 1.375rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 0.75rem;
        }

        .privacy-card-description {
            font-size: 1rem;
            color: var(--text-secondary);
            line-height: 1.6;
        }

        .privacy-card-highlight {
            display: inline-block;
            margin-top: 1rem;
            padding: 0.5rem 1rem;
            background: rgba(99, 102, 241, 0.1);
            border-radius: 8px;
            color: var(--accent-primary);
            font-size: 0.875rem;
            font-weight: 600;
        }

        @media (max-width: 768px) {
            .privacy-features {
                padding: 2rem 1rem;
            }

            .privacy-title {
                font-size: 2rem;
            }

            .privacy-subtitle {
                font-size: 1rem;
            }

            .privacy-cards {
                grid-template-columns: 1fr;
                gap: 1.5rem;
            }
        }

        /* ========================================
           TEST VIEW
           ======================================== */
        .test-container {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 3rem 2rem;
            gap: 3rem;
        }

        .speedometer-container {
            position: relative;
            width: 400px;
            height: 400px;
        }

        #speedometer-canvas {
            width: 100%;
            height: 100%;
        }

        .speed-display {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            z-index: 2; /* Keep text above expanding rings */
        }

        .speed-value {
            font-size: 4rem;
            font-weight: 800;
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            line-height: 1;
        }

        .speed-unit {
            font-size: 1.5rem;
            color: var(--text-secondary);
            margin-top: 0.5rem;
        }

        .test-status {
            font-size: 1.25rem;
            color: var(--text-secondary);
            margin-top: 1rem;
            font-weight: 500;
        }

        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1.5rem;
            width: 100%;
            max-width: 800px;
        }

        .metric-card {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 2rem;
            text-align: center;
            transition: all 0.3s ease;
            box-shadow: var(--shadow-md);
        }

        .metric-card:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-lg);
        }

        .metric-label {
            font-size: 0.875rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 0.5rem;
        }

        .metric-value {
            font-size: 2.5rem;
            font-weight: 700;
            color: var(--accent-primary);
        }

        .metric-unit {
            font-size: 1rem;
            color: var(--text-secondary);
            margin-left: 0.25rem;
        }

        .progress-bar {
            width: 100%;
            height: 8px;
            background: var(--bg-tertiary);
            border-radius: 4px;
            overflow: hidden;
            margin-top: 1rem;
        }

        .progress-fill {
            height: 100%;
            background: var(--accent-gradient);
            width: 0%;
            transition: width 0.3s ease;
            border-radius: 4px;
        }

        /* ========================================
           RESULTS VIEW
           ======================================== */
        .results-container {
            max-width: 1000px;
            margin: 0 auto;
            padding: 3rem 2rem;
        }

        .results-header {
            text-align: center;
            margin-bottom: 3rem;
        }

        .results-title {
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 1rem;
        }

        .results-timestamp {
            color: var(--text-secondary);
            font-size: 1rem;
        }

        /* Connection Quality Badge */
        .quality-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem 1.5rem;
            border-radius: 24px;
            font-weight: 600;
            font-size: 0.95rem;
            letter-spacing: 0.5px;
            box-shadow: var(--shadow-sm);
        }

        .quality-badge.excellent {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white; /* Intentional: white text works on dark gradient in both themes */
        }

        .quality-badge.good {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            color: white; /* Intentional: white text works on dark gradient in both themes */
        }

        .quality-badge.fair {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            color: white; /* Intentional: white text works on dark gradient in both themes */
        }

        .quality-badge.poor {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white; /* Intentional: white text works on dark gradient in both themes */
        }

        /* ========================================
           CERTIFICATE / BADGE
           ======================================== */
        .certificate-container {
            position: relative;
            background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
            border: 2px solid var(--accent-primary);
            border-radius: 16px;
            padding: 3rem 2rem;
            max-width: 600px;
            margin: 2rem auto;
            text-align: center;
            box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
        }

        .certificate-header {
            margin-bottom: 2rem;
        }

        .certificate-badge {
            font-size: 5rem;
            margin-bottom: 1rem;
            filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
        }

        .certificate-title {
            font-size: 2rem;
            font-weight: 700;
            background: linear-gradient(135deg, #fbbf24, #f59e0b);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 0.5rem;
        }

        .certificate-subtitle {
            font-size: 1rem;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 2px;
        }

        .certificate-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1.5rem;
            margin: 2rem 0;
            padding: 2rem;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 12px;
        }

        .certificate-stat {
            text-align: center;
        }

        .certificate-stat-value {
            font-size: 2rem;
            font-weight: 700;
            color: var(--accent-primary);
            margin-bottom: 0.25rem;
        }

        .certificate-stat-label {
            font-size: 0.75rem;
            color: var(--text-muted);
            text-transform: uppercase;
        }

        .certificate-footer {
            margin-top: 2rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--border-color);
        }

        .certificate-date {
            font-size: 0.875rem;
            color: var(--text-secondary);
            margin-bottom: 1rem;
        }

        .certificate-actions {
            display: flex;
            gap: 1rem;
            justify-content: center;
            margin-top: 1.5rem;
        }

        .results-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 2rem;
            margin-bottom: 3rem;
        }

        .result-card {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 2.5rem;
            text-align: center;
            box-shadow: var(--shadow-md);
            transition: all 0.3s ease;
        }

        .result-card:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-lg);
        }

        .result-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
        }

        .result-label {
            font-size: 1rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 0.5rem;
        }

        .result-value {
            font-size: 3rem;
            font-weight: 800;
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .result-unit {
            font-size: 1.25rem;
            color: var(--text-secondary);
        }

        .speed-statistics {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 2rem;
            margin-bottom: 3rem;
        }

        .statistics-title {
            font-size: 1.25rem;
            font-weight: 700;
            margin-bottom: 1.5rem;
            text-align: center;
            color: var(--text-primary);
        }

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

        .statistic-item {
            text-align: center;
        }

        .statistic-label {
            font-size: 0.875rem;
            color: var(--text-muted);
            margin-bottom: 0.5rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .statistic-value {
            font-size: 1.75rem;
            font-weight: 700;
            color: var(--accent-primary);
        }

        .consistency-indicator {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 0.25rem;
        }

        .consistency-bar {
            width: 100px;
            height: 8px;
            background: var(--bg-tertiary);
            border-radius: 4px;
            overflow: hidden;
            position: relative;
        }

        .consistency-fill {
            height: 100%;
            border-radius: 4px;
            transition: width 0.3s ease;
        }

        .consistency-fill.excellent {
            background: var(--success);
        }

        .consistency-fill.good {
            background: #10b981;
        }

        .consistency-fill.fair {
            background: var(--warning);
        }

        .consistency-fill.poor {
            background: var(--error);
        }

        .action-buttons {
            display: flex;
            gap: 1rem;
            justify-content: center;
            flex-wrap: wrap;
        }

        .btn {
            padding: 1rem 2rem;
            border-radius: 12px;
            border: none;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            position: relative;
            overflow: hidden;
        }

        .btn::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.5);
            transform: translate(-50%, -50%);
            transition: width 0.6s, height 0.6s;
        }

        .btn.ripple::after {
            width: 300px;
            height: 300px;
            opacity: 0;
            transition: width 0.6s, height 0.6s, opacity 0.6s;
        }

        .btn-primary {
            background: var(--accent-gradient);
            color: white; /* Intentional: white text works on dark gradient in both themes */
            box-shadow: var(--shadow-md);
        }

        .btn-primary:hover {
            transform: translateY(-2px) scale(1.02);
            box-shadow: var(--shadow-lg), var(--shadow-glow);
        }

        .btn-secondary {
            background: var(--bg-tertiary);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

        .btn-secondary:hover {
            background: var(--bg-secondary);
            transform: translateY(-2px) scale(1.02);
        }

        .btn:active {
            transform: scale(0.95) !important;
        }

        .btn:focus-visible {
            outline: 3px solid var(--accent-primary);
            outline-offset: 2px;
        }

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

        /* Enhanced press feedback */
        .btn-primary:active {
            background: linear-gradient(135deg, #5568d3 0%, #4a55b8 100%);
            box-shadow: var(--shadow-sm);
        }

        .btn-secondary:active {
            background: var(--bg-primary);
            border-color: var(--accent-primary);
        }

        /* Loading state */
        .btn.loading {
            position: relative;
            color: transparent;
            pointer-events: none;
        }

        .btn.loading::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 20px;
            height: 20px;
            margin: -10px 0 0 -10px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        /* Light mode spinner (visible on gradient backgrounds) */
        [data-theme="light"] .btn-primary .spinner {
            border: 3px solid rgba(255, 255, 255, 0.5);
            border-top-color: white;
        }

        /* ========================================
           HISTORY VIEW
           ======================================== */
        .history-container {
            padding: 2rem;
        }

        .history-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .history-title {
            font-size: 2rem;
            font-weight: 700;
        }

        .history-filters {
            display: flex;
            gap: 1rem;
        }

        .filter-select {
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            padding: 0.75rem 1rem;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.875rem;
        }

        .chart-container {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 2rem;
            margin-bottom: 2rem;
            box-shadow: var(--shadow-md);
        }

        .chart-canvas {
            width: 100%;
            height: 300px;
        }

        .history-list {
            display: grid;
            gap: 1rem;
        }

        .history-item {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 1.5rem;
            display: grid;
            grid-template-columns: 1fr auto auto;
            gap: 2rem;
            align-items: center;
            transition: all 0.3s ease;
        }

        .history-item:hover {
            transform: translateX(5px);
            box-shadow: var(--shadow-md);
        }

        .history-item-date {
            color: var(--text-secondary);
            font-size: 0.875rem;
        }

        .history-item-stats {
            display: flex;
            gap: 2rem;
        }

        .history-stat {
            text-align: center;
        }

        .history-stat-label {
            font-size: 0.75rem;
            color: var(--text-muted);
            text-transform: uppercase;
        }

        .history-stat-value {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--accent-primary);
        }

        .history-item-actions {
            display: flex;
            gap: 0.5rem;
        }

        .history-item-notes {
            grid-column: 1 / -1;
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 1px solid var(--border-color);
        }

        .notes-display {
            color: var(--text-secondary);
            font-size: 0.875rem;
            font-style: italic;
            padding: 0.75rem 1rem;
            background: var(--bg-secondary);
            border-radius: 8px;
            border-left: 3px solid var(--accent-primary);
            margin-bottom: 0.5rem;
            word-wrap: break-word;
        }

        .notes-display.empty {
            color: var(--text-muted);
            font-style: italic;
            background: transparent;
            border: none;
            padding: 0.5rem 0;
        }

        .notes-edit-container {
            display: flex;
            gap: 0.5rem;
            align-items: flex-start;
        }

        .notes-textarea {
            flex: 1;
            min-height: 60px;
            padding: 0.75rem;
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.875rem;
            resize: vertical;
            transition: all 0.3s ease;
        }

        .notes-textarea:focus {
            outline: none;
            border-color: var(--accent-primary);
            background: var(--bg-tertiary);
        }

        .btn-favorite {
            background: transparent;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            transition: transform 0.2s ease;
            padding: 0.25rem;
            color: var(--text-primary); /* Theme-aware: adapts to light/dark mode */
        }

        .btn-favorite:hover {
            transform: scale(1.2);
        }

        .btn-favorite.favorited {
            animation: favoritePopIn 0.3s ease;
        }

        @keyframes favoritePopIn {
            0% { transform: scale(1); }
            50% { transform: scale(1.3); }
            100% { transform: scale(1); }
        }

        .btn-icon {
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            width: 40px;
            height: 40px;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }

        .btn-icon:hover {
            background: var(--bg-secondary);
            transform: scale(1.1);
        }

        .comparison-view {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 2rem;
            margin-bottom: 2rem;
        }

        .comparison-view.hidden {
            display: none;
        }

        .comparison-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .comparison-title {
            font-size: 1.5rem;
            font-weight: 700;
        }

        .comparison-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
        }

        .comparison-card {
            background: var(--bg-secondary);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            padding: 1.5rem;
        }

        .comparison-card-header {
            text-align: center;
            margin-bottom: 1.5rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border-color);
        }

        .comparison-card-title {
            font-size: 0.875rem;
            color: var(--text-muted);
            margin-bottom: 0.5rem;
        }

        .comparison-card-date {
            font-size: 1rem;
            color: var(--text-primary);
            font-weight: 600;
        }

        .comparison-stats {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .comparison-stat-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.75rem;
            background: var(--bg-tertiary);
            border-radius: 8px;
        }

        .comparison-stat-label {
            font-size: 0.875rem;
            color: var(--text-secondary);
        }

        .comparison-stat-value {
            font-size: 1.125rem;
            font-weight: 700;
            color: var(--accent-primary);
        }

        .comparison-stat-value.winner {
            color: var(--success);
        }

        .comparison-stat-value.loser {
            color: var(--text-muted);
        }

        .test-checkbox {
            width: 20px;
            height: 20px;
            cursor: pointer;
            accent-color: var(--accent-primary);
        }

        /* Tooltip System */
        .tooltip {
            position: relative;
            display: inline-block;
        }

        .tooltip-text {
            visibility: hidden;
            opacity: 0;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            text-align: center;
            border-radius: 8px;
            padding: 0.5rem 0.75rem;
            position: absolute;
            z-index: 10000;
            bottom: 125%;
            left: 50%;
            transform: translateX(-50%);
            white-space: nowrap;
            font-size: 0.875rem;
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow-md);
            transition: opacity 0.3s, visibility 0.3s;
            pointer-events: none;
        }

        .tooltip-text::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: var(--bg-primary) transparent transparent transparent;
        }

        .tooltip:hover .tooltip-text,
        [data-tooltip]:hover::after {
            visibility: visible;
            opacity: 1;
        }

        /* Simple data-tooltip attribute approach */
        [data-tooltip] {
            position: relative;
            cursor: help;
        }

        [data-tooltip]::after {
            content: attr(data-tooltip);
            position: absolute;
            bottom: 125%;
            left: 50%;
            transform: translateX(-50%);
            background-color: var(--bg-primary);
            color: var(--text-primary);
            padding: 0.5rem 0.75rem;
            border-radius: 8px;
            font-size: 0.875rem;
            white-space: nowrap;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s, visibility 0.3s;
            z-index: 10000;
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow-md);
            pointer-events: none;
        }

        [data-tooltip]::before {
            content: '';
            position: absolute;
            bottom: 115%;
            left: 50%;
            transform: translateX(-50%);
            border-width: 5px;
            border-style: solid;
            border-color: var(--bg-primary) transparent transparent transparent;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s, visibility 0.3s;
            z-index: 10000;
            pointer-events: none;
        }

        [data-tooltip]:hover::after,
        [data-tooltip]:hover::before {
            opacity: 1;
            visibility: visible;
        }

        /* Custom Modal Dialog System */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10001;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s ease, visibility 0.3s ease;
        }

        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .modal-dialog {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 2rem;
            max-width: 500px;
            width: 90%;
            box-shadow: var(--shadow-lg);
            transform: scale(0.9);
            transition: transform 0.3s ease;
        }

        .modal-overlay.active .modal-dialog {
            transform: scale(1);
        }

        .modal-header {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1rem;
        }

        .modal-icon {
            font-size: 2rem;
        }

        .modal-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text-primary);
        }

        .modal-body {
            color: var(--text-secondary);
            margin-bottom: 2rem;
            line-height: 1.6;
        }

        .modal-actions {
            display: flex;
            gap: 1rem;
            justify-content: flex-end;
        }

        .modal-actions .btn {
            min-width: 100px;
        }

        /* Skeleton Loaders */
        .skeleton {
            background: linear-gradient(
                90deg,
                var(--bg-tertiary) 25%,
                var(--bg-secondary) 50%,
                var(--bg-tertiary) 75%
            );
            background-size: 200% 100%;
            animation: shimmer 1.5s infinite;
            border-radius: 8px;
        }

        @keyframes shimmer {
            0% {
                background-position: 200% 0;
            }
            100% {
                background-position: -200% 0;
            }
        }

        .skeleton-text {
            height: 1rem;
            margin-bottom: 0.5rem;
        }

        .skeleton-text:last-child {
            margin-bottom: 0;
        }

        .skeleton-title {
            height: 2rem;
            width: 60%;
            margin-bottom: 1rem;
        }

        .skeleton-card {
            background: var(--bg-glass);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 1.5rem;
            margin-bottom: 1rem;
        }

        .skeleton-circle {
            width: 40px;
            height: 40px;
            border-radius: 50%;
        }

        .skeleton-history-item {
            display: grid;
            grid-template-columns: auto 1fr auto;
            gap: 1rem;
            align-items: center;
            padding: 1.5rem;
            background: var(--bg-glass);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            margin-bottom: 1rem;
        }

        .empty-state {
            text-align: center;
            padding: 4rem 2rem;
        }

        .empty-state-icon {
            font-size: 4rem;
            opacity: 0.3;
            margin-bottom: 1rem;
        }

        .empty-state-text {
            color: var(--text-secondary);
            font-size: 1.25rem;
        }

        /* ========================================
           SETTINGS VIEW
           ======================================== */
        .settings-container {
            max-width: 800px;
            margin: 0 auto;
            padding: 2rem;
        }

        .settings-title {
            font-size: 2rem;
            font-weight: 700;
            margin-bottom: 2rem;
        }

        .settings-section {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 2rem;
            margin-bottom: 1.5rem;
            box-shadow: var(--shadow-md);
        }

        .settings-section-title {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 1.5rem;
            color: var(--accent-primary);
        }

        .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 0;
            border-bottom: 1px solid var(--border-color);
        }

        .setting-item:last-child {
            border-bottom: none;
        }

        .setting-label {
            flex: 1;
        }

        .setting-label-text {
            font-weight: 500;
            margin-bottom: 0.25rem;
        }

        .setting-description {
            font-size: 0.875rem;
            color: var(--text-muted);
        }

        .setting-control {
            display: flex;
            gap: 0.5rem;
        }

        .toggle-switch {
            position: relative;
            width: 60px;
            height: 32px;
            background: var(--bg-tertiary);
            border-radius: 16px;
            cursor: pointer;
            transition: background 0.3s ease;
            border: 1px solid var(--border-color);
        }

        .toggle-switch.active {
            background: var(--accent-primary);
        }

        .toggle-switch::after {
            content: '';
            position: absolute;
            top: 3px;
            left: 3px;
            width: 24px;
            height: 24px;
            background: white;
            border-radius: 50%;
            transition: transform 0.3s ease;
        }

        .toggle-switch.active::after {
            transform: translateX(28px);
        }

        .input-field {
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            padding: 0.75rem 1rem;
            border-radius: 8px;
            font-size: 0.875rem;
            width: 200px;
        }

        .input-field:focus {
            outline: none;
            border-color: var(--accent-primary);
            box-shadow: 0 0 0 3px var(--accent-glow);
        }

        /* ========================================
           ANIMATIONS
           ======================================== */
        @keyframes fadeIn {
            from {
                opacity: 0;
            }
            to {
                opacity: 1;
            }
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateY(-30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

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

        @keyframes pulse {
            0%, 100% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.05);
            }
        }

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

        @keyframes glow {
            0%, 100% {
                box-shadow: var(--shadow-lg), 0 0 20px var(--accent-glow);
            }
            50% {
                box-shadow: var(--shadow-lg), 0 0 40px var(--accent-glow);
            }
        }

        /* ========================================
           RESPONSIVE DESIGN
           ======================================== */
        @media (max-width: 768px) {
            .navbar {
                padding: 1rem;
            }

            .nav-menu {
                gap: 1rem;
                font-size: 0.875rem;
            }

            .hero-title {
                font-size: 2.5rem;
            }

            .hero-subtitle {
                font-size: 1rem;
            }

            .connection-info {
                padding: 0.75rem 1rem;
                flex-direction: column;
                gap: 0.35rem;
                width: 90%;
                max-width: 320px;
            }

            .connection-info-item {
                font-size: 0.85rem;
            }

            /* Remove bullet separators on mobile */
            .connection-info-item:not(:last-child)::after {
                content: none;
            }

            .start-button {
                width: 150px;
                height: 150px;
                font-size: 2rem;
            }

            .speedometer-container {
                width: 300px;
                height: 300px;
            }

            .speed-value {
                font-size: 3rem;
            }

            .metrics-grid {
                grid-template-columns: 1fr;
            }

            .results-grid {
                grid-template-columns: 1fr;
            }

            .history-item {
                grid-template-columns: 1fr;
                gap: 1rem;
            }

            .history-item-stats {
                flex-wrap: wrap;
            }

            .container {
                padding: 1rem;
            }
        }

        @media (max-width: 480px) {
            .hero-title {
                font-size: 2rem;
            }

            .action-buttons {
                flex-direction: column;
                width: 100%;
            }

            .btn {
                width: 100%;
                justify-content: center;
            }
        }

        /* ========================================
           UTILITY CLASSES
           ======================================== */
        .hidden {
            display: none !important;
        }

        .loading {
            animation: spin 1s linear infinite;
        }

        /* ========================================
           LOADING SPINNER & STATES
           ======================================== */
        .spinner {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid var(--bg-tertiary);
            border-top-color: var(--accent-primary);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        .spinner-large {
            width: 40px;
            height: 40px;
            border-width: 4px;
        }

        /* ========================================
           TOAST NOTIFICATIONS
           ======================================== */
        .toast-container {
            position: fixed;
            top: 80px;
            right: 20px;
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 1rem;
            max-width: 400px;
        }

        .toast {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 1rem 1.5rem;
            box-shadow: var(--shadow-lg);
            display: flex;
            align-items: center;
            gap: 1rem;
            animation: slideInRight 0.3s ease;
            min-width: 300px;
        }

        .toast.success {
            border-left: 4px solid var(--success);
        }

        .toast.error {
            border-left: 4px solid var(--error);
        }

        .toast.warning {
            border-left: 4px solid var(--warning);
        }

        .toast.info {
            border-left: 4px solid var(--accent-primary);
        }

        .toast-icon {
            font-size: 1.5rem;
            flex-shrink: 0;
        }

        .toast-content {
            flex: 1;
        }

        .toast-title {
            font-weight: 600;
            margin-bottom: 0.25rem;
            color: var(--text-primary);
        }

        .toast-message {
            font-size: 0.875rem;
            color: var(--text-secondary);
        }

        .toast-close {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 1.25rem;
            padding: 0;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
            transition: all 0.2s;
        }

        .toast-close:hover {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .toast-actions {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.75rem;
        }

        .toast-action-btn {
            padding: 0.4rem 0.8rem;
            font-size: 0.8rem;
            font-weight: 500;
            border: 1px solid var(--border-color);
            background: var(--bg-tertiary);
            color: var(--text-primary);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .toast-action-btn:hover {
            background: var(--accent-primary);
            color: white; /* Intentional: white text works on accent color in both themes */
            border-color: var(--accent-primary);
        }

        @keyframes slideInRight {
            from {
                transform: translateX(400px);
                opacity: 0;
            }
            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        @keyframes slideOutRight {
            from {
                transform: translateX(0);
                opacity: 1;
            }
            to {
                transform: translateX(400px);
                opacity: 0;
            }
        }

        .toast.removing {
            animation: slideOutRight 0.3s ease forwards;
        }

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

            .particles-canvas {
                display: none !important;
            }

            .speedometer-container.testing {
                animation: none !important;
            }

            .test-container.active::before,
            .test-container.active::after {
                display: none !important;
            }

            .start-button {
                animation: none !important;
            }
        }

        /* ========================================
           TEST MODE SELECTOR
           ======================================== */
        .test-mode-selector {
            display: flex;
            gap: 1rem;
            margin-bottom: 3rem;
            animation: slideUp 0.8s ease;
            animation-delay: 0.2s;
            animation-fill-mode: both;
        }

        .mode-btn {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 2px solid var(--border-color);
            border-radius: 16px;
            padding: 1.5rem 2rem;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
            min-width: 120px;
        }

        .mode-btn:hover {
            transform: translateY(-5px);
            border-color: var(--accent-primary);
            box-shadow: var(--shadow-md);
        }

        .mode-btn.active {
            border-color: var(--accent-primary);
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
            box-shadow: var(--shadow-glow);
        }

        .mode-icon {
            font-size: 2rem;
        }

        .mode-label {
            font-weight: 600;
            color: var(--text-primary);
            font-size: 1rem;
        }

        .mode-desc {
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        /* ========================================
           SERVER INFO CARD
           ======================================== */
        .server-info-card {
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 1.5rem;
            margin-bottom: 2rem;
            box-shadow: var(--shadow-md);
            animation: slideDown 0.5s ease;
        }

        .server-info-content {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .server-icon {
            font-size: 2rem;
            animation: pulse 2s infinite;
        }

        .server-details {
            flex: 1;
        }

        .server-name {
            font-weight: 600;
            color: var(--text-primary);
            font-size: 1rem;
        }

        .server-location {
            font-size: 0.875rem;
            color: var(--text-secondary);
        }

        .connection-status {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

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

        .status-dot.connecting {
            background: var(--warning);
            box-shadow: 0 0 10px var(--warning);
        }

        .status-dot.error {
            background: var(--error);
            box-shadow: 0 0 10px var(--error);
        }

        /* ========================================
           MOBILE HAMBURGER MENU
           ======================================== */
        .menu-toggle {
            display: none;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            width: 44px;
            height: 44px;
            border-radius: 8px;
            cursor: pointer;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 4px;
            transition: all 0.3s ease;
        }

        .menu-toggle span {
            width: 20px;
            height: 2px;
            background: var(--text-primary);
            transition: all 0.3s ease;
        }

        .menu-toggle.active span:nth-child(1) {
            transform: translateY(6px) rotate(45deg);
        }

        .menu-toggle.active span:nth-child(2) {
            opacity: 0;
        }

        .menu-toggle.active span:nth-child(3) {
            transform: translateY(-6px) rotate(-45deg);
        }

        .mobile-menu-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 98;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .mobile-menu-overlay.active {
            opacity: 1;
        }

        .mobile-menu {
            display: none;
            position: fixed;
            top: 0;
            right: -300px;
            width: 300px;
            height: 100%;
            background: var(--bg-secondary);
            border-left: 1px solid var(--border-color);
            z-index: 99;
            transition: right 0.3s ease;
            padding: 2rem;
            overflow-y: auto;
        }

        .mobile-menu.active {
            right: 0;
        }

        .mobile-menu-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .mobile-menu-close {
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            width: 44px;
            height: 44px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .mobile-nav-menu {
            list-style: none;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .mobile-nav-menu a {
            display: block;
            padding: 1rem;
            color: var(--text-secondary);
            text-decoration: none;
            font-weight: 500;
            border-radius: 8px;
            transition: all 0.3s ease;
        }

        .mobile-nav-menu a:hover,
        .mobile-nav-menu a.active {
            background: var(--bg-tertiary);
            color: var(--accent-primary);
        }

        /* Speed Zone Colors */
        .speed-slow { color: var(--warning) !important; }
        .speed-medium { color: var(--accent-primary) !important; }
        .speed-fast { color: var(--success) !important; }

        /* ========================================
           ACCESSIBILITY ENHANCEMENTS
           ======================================== */
        .btn:focus,
        .segment-btn:focus,
        .toggle-switch:focus,
        .input-field:focus,
        .mode-btn:focus {
            outline: 2px solid var(--accent-primary);
            outline-offset: 2px;
        }

        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border-width: 0;
        }

        /* ========================================
           RESPONSIVE UPDATES FOR NEW FEATURES
           ======================================== */
        @media (max-width: 768px) {
            .test-mode-selector {
                gap: 0.5rem;
            }

            .mode-btn {
                padding: 1rem 1.5rem;
                min-width: 90px;
            }

            .mode-icon {
                font-size: 1.5rem;
            }

            .mode-label {
                font-size: 0.875rem;
            }

            .segmented-control {
                display: none;
            }

            .menu-toggle {
                display: flex;
            }

            .mobile-menu-overlay,
            .mobile-menu {
                display: block;
            }

            .server-info-card {
                padding: 1rem;
            }

            .server-info-content {
                flex-wrap: wrap;
            }
        }

        @media (max-width: 480px) {
            .test-mode-selector {
                flex-direction: column;
                width: 100%;
            }

            .mode-btn {
                width: 100%;
                flex-direction: row;
                justify-content: space-between;
            }
        }

        /* ========================================
           PRINT STYLES
           ======================================== */
        @media print {
            /* Hide unnecessary elements */
            canvas,
            .particles-canvas,
            .nav-links,
            .toast-container,
            .modal-overlay,
            .btn,
            .btn-icon,
            .btn-secondary,
            .btn-primary,
            .history-item-actions,
            .history-filter,
            .test-mode-selector,
            .speedometer,
            .progress-bar,
            .settings-group input[type="checkbox"],
            .settings-group select,
            .comparison-header button {
                display: none !important;
            }

            /* Reset colors for print */
            * {
                background: white !important;
                color: black !important;
                box-shadow: none !important;
                border-color: #ccc !important;
            }

            body {
                margin: 0;
                padding: 20px;
            }

            .container {
                max-width: 100%;
                padding: 0;
            }

            /* Show only results content */
            .results-section,
            .history-item,
            .comparison-view,
            .stats-grid {
                page-break-inside: avoid;
                margin-bottom: 20px;
                border: 1px solid #333 !important;
                padding: 15px !important;
            }

            /* Results display */
            .results-title {
                font-size: 24px;
                font-weight: bold;
                margin-bottom: 15px;
            }

            .results-grid {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 15px;
            }

            .result-card {
                border: 1px solid #333 !important;
                padding: 10px;
            }

            .result-value {
                font-size: 28px;
                font-weight: bold;
            }

            .result-label {
                font-size: 14px;
                margin-top: 5px;
            }

            /* Server info */
            .server-info {
                margin-top: 20px;
                padding-top: 20px;
                border-top: 2px solid #333 !important;
            }

            /* Statistics */
            .stats-grid {
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                gap: 10px;
            }

            .stat-item {
                text-align: center;
                padding: 10px;
                border: 1px solid #ccc !important;
            }

            /* History list */
            .history-item {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 10px;
                margin-bottom: 10px;
            }

            .history-stat-value {
                font-weight: bold;
            }

            /* Comparison view */
            .comparison-cards {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 15px;
            }

            .comparison-card {
                border: 1px solid #333 !important;
                padding: 15px;
            }

            /* Print header */
            .view::before {
                content: "SpeedTest Results - Printed on " attr(data-print-date);
                display: block;
                font-size: 12px;
                color: #666 !important;
                margin-bottom: 20px;
                padding-bottom: 10px;
                border-bottom: 1px solid #ccc !important;
            }

            /* Page breaks */
            .view {
                page-break-after: always;
            }

            .view:last-child {
                page-break-after: auto;
            }

            /* URLs for links */
            a[href]:after {
                content: " (" attr(href) ")";
            }

            /* Hide chart canvas but show fallback */
            #history-chart {
                display: none;
            }
        }

        /* ========================================
           FOOTER SECTION
           ======================================== */
        .app-footer {
            margin-top: 6rem;
            background: var(--bg-glass);
            backdrop-filter: blur(20px);
            border-top: 1px solid var(--border-color);
            padding: 3rem 2rem 1.5rem;
        }

        .footer-top {
            max-width: 1200px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: 1.5fr 1fr 1fr 1fr;
            gap: 3rem;
            margin-bottom: 3rem;
        }

        .footer-brand {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .footer-logo {
            font-size: 1.5rem;
            font-weight: 700;
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 0.5rem;
        }

        .footer-subdomain {
            font-size: 0.875rem;
            color: var(--text-muted);
            font-style: italic;
        }

        .footer-tagline {
            font-size: 0.95rem;
            color: var(--text-secondary);
            line-height: 1.6;
            margin-bottom: 0.5rem;
        }

        .footer-note {
            font-size: 0.875rem;
            color: var(--text-muted);
            font-style: italic;
        }

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

        .footer-column-title {
            font-size: 0.875rem;
            font-weight: 700;
            color: var(--text-primary);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 1.25rem;
        }

        .footer-links {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .footer-link {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 0.9rem;
            transition: all 0.2s ease;
        }

        .footer-link:hover {
            color: var(--accent-primary);
            transform: translateX(5px);
        }

        .footer-link-icon {
            font-size: 1rem;
        }

        .footer-enterprise-badge {
            max-width: 1200px;
            margin: 0 auto 2rem;
            padding: 1.5rem 2rem;
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
            border: 1px solid var(--accent-primary);
            border-radius: 12px;
            text-align: center;
        }

        .footer-enterprise-text {
            font-size: 1rem;
            color: var(--text-primary);
            font-weight: 600;
        }

        .footer-enterprise-text strong {
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .footer-bottom {
            max-width: 1200px;
            margin: 0 auto;
            padding-top: 2rem;
            border-top: 1px solid var(--border-color);
            text-align: center;
        }

        .footer-copyright {
            font-size: 0.875rem;
            color: var(--text-muted);
            margin-bottom: 0.75rem;
        }

        .footer-tagline-bottom {
            font-size: 0.875rem;
            color: var(--text-secondary);
        }

        /* Responsive Footer */
        @media (max-width: 992px) {
            .footer-top {
                grid-template-columns: 1fr 1fr;
                gap: 2rem;
            }

            .footer-brand {
                grid-column: 1 / -1;
            }
        }

        @media (max-width: 640px) {
            .app-footer {
                padding: 2rem 1rem 1rem;
                margin-top: 3rem;
            }

            .footer-top {
                grid-template-columns: 1fr;
                gap: 2rem;
            }

            .footer-brand {
                grid-column: 1;
            }

            .footer-enterprise-badge {
                padding: 1rem 1.5rem;
            }

            .footer-enterprise-text {
                font-size: 0.9rem;
            }
        }
