/* ========================================
   Internet Connection Monitor - Styles
   ======================================== */

:root {
    /* Color Palette */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(17, 24, 39, 0.9);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.3);
    --accent-green-soft: rgba(16, 185, 129, 0.1);

    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.3);
    --accent-red-soft: rgba(239, 68, 68, 0.1);

    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.3);

    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.3);

    --accent-purple: #8b5cf6;

    --border-color: rgba(255, 255, 255, 0.05);
    --border-highlight: rgba(255, 255, 255, 0.1);

    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

body.light-theme {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 1);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(0, 0, 0, 0.15);
    
    --accent-green-glow: rgba(16, 185, 129, 0.15);
    --accent-red-glow: rgba(239, 68, 68, 0.15);
    --accent-amber-glow: rgba(245, 158, 11, 0.15);
    --accent-blue-glow: rgba(59, 130, 246, 0.15);
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ========================================
   Background Particles
   ======================================== */
.bg-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.15; }
    90% { opacity: 0.15; }
    100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}

/* ========================================
   App Container
   ======================================== */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    padding-top: calc(24px + env(safe-area-inset-top));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ========================================
   Header
   ======================================== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--radius-md);
    color: white;
    flex-shrink: 0;
}

.app-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.app-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-clock {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
}

.btn-clear {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-clear:hover {
    background: var(--accent-red-soft);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ========================================
   Status Card
   ======================================== */
.status-section {
    margin-bottom: 24px;
}

.status-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px 36px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-slow);
}

.status-card.connected {
    border-color: rgba(16, 185, 129, 0.3);
}

.status-card.disconnected {
    border-color: rgba(239, 68, 68, 0.4);
}

.status-glow {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

.status-card.connected .status-glow {
    background: radial-gradient(ellipse at 15% 50%, var(--accent-green-glow) 0%, transparent 60%);
    opacity: 1;
}

.status-card.disconnected .status-glow {
    background: radial-gradient(ellipse at 15% 50%, var(--accent-red-glow) 0%, transparent 60%);
    opacity: 1;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.status-icon-wrapper {
    position: relative;
    flex-shrink: 0;
}

.status-icon {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    transition: all var(--transition-slow);
}

.status-card.connected .status-icon {
    color: var(--accent-green);
    background: var(--accent-green-soft);
}

.status-card.disconnected .status-icon {
    color: var(--accent-red);
    background: var(--accent-red-soft);
}

.pulse-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all var(--transition-slow);
}

.status-card.connected .pulse-ring {
    border-color: var(--accent-green);
    animation: pulseRing 2s ease-out infinite;
}

.status-card.disconnected .pulse-ring {
    border-color: var(--accent-red);
    animation: pulseRingRed 1s ease-out infinite;
}

@keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes pulseRingRed {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

.icon-svg {
    transition: all var(--transition-normal);
}

.icon-svg.hidden {
    display: none;
}

.status-text-wrapper {
    flex: 1;
    min-width: 0;
}

.status-label {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    transition: color var(--transition-slow);
}

.status-card.connected .status-label {
    color: var(--accent-green);
}

.status-card.disconnected .status-label {
    color: var(--accent-red);
}

.status-detail {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.status-uptime {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.uptime-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.uptime-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ========================================
   Stats Grid
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    transform: translateY(-2px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}

.latency-icon {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
}

.disconnect-icon {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.downtime-icon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
}

.avg-icon {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-bar {
    margin-top: 12px;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width var(--transition-normal);
    width: 0%;
}

.latency-bar {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-amber), var(--accent-red));
}

/* ========================================
   Chart Section
   ======================================== */
.chart-section,
.timeline-section,
.log-section,
.diag-section,
.speed-test-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.diag-section {
    border-color: rgba(245, 158, 11, 0.25);
    animation: diagFadeIn 0.4s ease-out;
}

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

.diag-status-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    animation: diagPulse 1.5s ease-in-out infinite;
}

.diag-status-badge.running {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    animation: diagPulse 1.5s ease-in-out infinite;
}

.diag-status-badge.done {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    animation: none;
}

@keyframes diagPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.diag-result-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.diag-verdict {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.diag-verdict-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
}

.diag-verdict-text h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.diag-verdict-text p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.diag-tests {
    padding: 8px 0;
}

.diag-test-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    transition: background var(--transition-fast);
}

.diag-test-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.diag-test-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
    font-weight: 700;
}

.diag-test-status.pass {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.diag-test-status.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.diag-test-status.wait {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    animation: diagPulse 1s ease-in-out infinite;
}

.diag-test-status.warn {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.diag-test-label {
    flex: 1;
    font-size: 0.84rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.diag-test-result {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.diag-info {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.diag-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.diag-info-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.diag-info-value {
    font-size: 0.84rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Log entry diagnostics detail */
.log-diag-summary {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border-left: 3px solid var(--accent-amber);
}

.log-diag-summary .log-diag-title {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--accent-amber);
    margin-bottom: 4px;
}

.log-diag-summary .log-diag-cause {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.log-diag-tests-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.log-diag-tag {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.log-diag-tag.pass {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.log-diag-tag.fail {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-title svg {
    color: var(--text-muted);
}

.section-badge {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.log-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-clear-log {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-clear-log:hover {
    background: var(--accent-red-soft);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.3);
}


.chart-container {
    position: relative;
    height: 200px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 26, 0.7);
    border-radius: var(--radius-sm);
    transition: opacity var(--transition-normal);
}

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

.chart-overlay p {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ========================================
   Timeline
   ======================================== */
.timeline-bar-container {
    position: relative;
}

.timeline-bar {
    height: 32px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    position: relative;
}

.timeline-segment {
    height: 100%;
    transition: all var(--transition-fast);
    position: relative;
}

.timeline-segment.connected {
    background: var(--accent-green);
    opacity: 0.6;
}

.timeline-segment.disconnected {
    background: var(--accent-red);
    opacity: 0.8;
}

.timeline-segment:hover {
    opacity: 1;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ========================================
   Event Log
   ======================================== */
.log-container {
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.log-container::-webkit-scrollbar {
    width: 6px;
}

.log-container::-webkit-scrollbar-track {
    background: transparent;
}

.log-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.log-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 12px;
    color: var(--text-muted);
}

.log-empty svg {
    opacity: 0.3;
}

.log-empty p {
    font-size: 0.95rem;
    font-weight: 500;
}

.log-empty span {
    font-size: 0.8rem;
    opacity: 0.6;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    animation: logSlideIn 0.3s ease-out;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.03);
}

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

.log-entry + .log-entry {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.log-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.log-dot.down {
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red-glow);
}

.log-dot.up {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green-glow);
}

.log-content {
    flex: 1;
    min-width: 0;
}

.log-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.log-title.down {
    color: var(--accent-red);
}

.log-title.up {
    color: var(--accent-green);
}

.log-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.log-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    margin-top: 2px;
}

.log-duration {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 8px;
}

/* ========================================
   Footer
   ======================================== */
.app-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .app-container {
        padding: 16px 12px 32px;
    }

    .app-header {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .header-left {
        width: 100%;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .status-card {
        flex-direction: column;
        text-align: center;
        padding: 28px 24px;
        gap: 16px;
    }

    .status-uptime {
        align-items: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .chart-container {
        height: 160px;
    }
}

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

    .status-label {
        font-size: 1.2rem;
    }

    .uptime-value {
        font-size: 1.3rem;
    }

    .log-entry {
        padding: 12px 10px;
        gap: 10px;
    }

    .diag-verdict {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 16px;
    }

    .diag-test-row {
        padding: 8px 14px;
    }

    .diag-info {
        grid-template-columns: repeat(2, 1fr);
        padding: 12px 14px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .toast {
        left: 12px;
        right: 12px;
        top: calc(12px + env(safe-area-inset-top));
    }
}

/* ========================================
   Notification Toast
   ======================================== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    animation: toastIn 0.4s ease-out;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.toast.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.toast.out {
    animation: toastOut 0.3s ease-in forwards;
}

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

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

/* ========================================
   Speed Test Section
   ======================================== */
.speed-test-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 32px;
    align-items: center;
}

.speed-gauge-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.speed-gauge {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-ring {
    overflow: visible;
}

.gauge-ring-background {
    stroke: rgba(255, 255, 255, 0.05);
}

.gauge-ring-fill {
    stroke: #10b981; /* Netspeed Vibrant Green */
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 75px 75px;
    transition: stroke-dashoffset 120ms cubic-bezier(0.2, 0.8, 0.2, 1), stroke 0.3s ease;
    filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.6));
}

.speed-gauge.running .gauge-ring-fill {
    filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.85));
}

.gauge-ring-fill.uploading {
    stroke: #8b5cf6;
    filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.7));
}

.speed-gauge.completed .gauge-ring-fill,
.gauge-ring-fill.completed {
    stroke: #10b981;
    filter: drop-shadow(0 0 18px rgba(16, 185, 129, 0.9));
    animation: celebrateRingFill 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes celebrateRingFill {
    0% { transform: rotate(-90deg) scale(1); }
    50% { transform: rotate(-90deg) scale(1.06); }
    100% { transform: rotate(-90deg) scale(1); }
}

.gauge-content {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.speed-gauge.completed .gauge-value {
    color: var(--accent-green);
    text-shadow: 0 0 12px var(--accent-green-glow);
}

.gauge-unit {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.btn-speed-test {
    width: 100%;
    max-width: 200px;
    padding: 12px 24px;
    font-size: 0.88rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-speed-test:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.3);
}

.btn-speed-test:active:not(:disabled) {
    transform: translateY(0);
}

.btn-speed-test:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.speed-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.speed-metric-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.speed-metric-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-glow);
}

.metric-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.metric-icon.download {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.metric-icon.upload {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}

.metric-icon.ping {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.metric-icon.jitter {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-amber);
}

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Speed test card active states */
.speed-metric-card.active {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
    animation: activePulse 1.5s ease-in-out infinite;
}

.speed-metric-card.active-upload {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.05);
    animation: activePulseUpload 1.5s ease-in-out infinite;
}

@keyframes activePulse {
    0%, 100% { border-color: rgba(59, 130, 246, 0.3); }
    50% { border-color: var(--accent-blue); }
}

@keyframes activePulseUpload {
    0%, 100% { border-color: rgba(139, 92, 246, 0.3); }
    50% { border-color: var(--accent-purple); }
}

@media (max-width: 768px) {
    .speed-test-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 480px) {
    .speed-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ========================================
   SEO FAQ Section
   ======================================== */
.seo-faq-section { margin-top: 32px; background: rgba(30, 41, 59, 0.5); border-radius: 16px; padding: 24px; border: 1px solid rgba(148, 163, 184, 0.1); margin-bottom: 24px; }
.seo-faq-section h2 { font-size: 1.25rem; font-weight: 600; color: #fff; margin-bottom: 20px; text-align: center; }
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: rgba(15, 23, 42, 0.6); border-radius: 12px; overflow: hidden; border: 1px solid rgba(148, 163, 184, 0.05); }
.faq-question { width: 100%; text-align: left; background: none; border: none; padding: 16px 20px; color: #f8fafc; font-weight: 500; font-size: 0.95rem; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: background 0.2s; }
.faq-question:hover { background: rgba(255, 255, 255, 0.05); }
.faq-icon { font-size: 1.2rem; color: var(--accent-blue); transition: transform 0.3s; }
.faq-item.active .faq-icon { transform: rotate(45deg); color: var(--accent-purple); }
.faq-answer { padding: 0 20px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out, padding 0.3s ease; color: #94a3b8; font-size: 0.9rem; line-height: 1.6; }
.faq-item.active .faq-answer { padding: 0 20px 20px 20px; max-height: 500px; }

/* ========================================
   Smart Assistant
   ======================================== */
.assistant-cta { margin-top: 32px; background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%); border-radius: 16px; padding: 20px; display: flex; align-items: center; justify-content: space-between; border: 1px solid rgba(59, 130, 246, 0.3); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2); }
.assistant-icon { font-size: 2.5rem; margin-right: 16px; }
.assistant-text h3 { color: var(--text-primary); font-size: 1.1rem; margin: 0 0 4px 0; }
.assistant-text p { color: var(--text-secondary); font-size: 0.85rem; margin: 0; opacity: 0.9; }
.btn-assistant { background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%); color: white; border: none; padding: 12px 24px; border-radius: 12px; font-weight: 600; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; white-space: nowrap; margin-left: 16px; font-family: 'Inter', sans-serif;}
.btn-assistant:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3); }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 9999; opacity: 1; transition: opacity 0.3s; }
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content { background: var(--bg-primary); width: 95%; max-width: 650px; max-height: 90vh; border-radius: 24px; border: 1px solid var(--border-color); box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4); overflow: hidden; display: flex; flex-direction: column; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background: var(--bg-card); }
.modal-header h2 { margin: 0; font-size: 1.2rem; font-weight: 600; color: var(--text-primary); }
.btn-close-modal { background: none; border: none; color: var(--text-secondary); font-size: 2rem; cursor: pointer; padding: 0; line-height: 0.8; }
.btn-close-modal:hover { color: var(--text-primary); }
.modal-body { padding: 24px; overflow-y: auto; color: var(--text-primary); }
.assistant-welcome p { color: var(--text-secondary); margin-bottom: 16px; font-size: 0.95rem; line-height: 1.5; }
.package-input-group { background: var(--bg-card); border-radius: 12px; padding: 16px; margin-bottom: 24px; border: 1px solid var(--border-highlight); }
.package-input-group label { display: block; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 8px; font-weight: 500; }
.package-input-wrapper { display: flex; align-items: center; gap: 12px; }
.package-input-wrapper input { background: var(--bg-secondary); border: 1px solid var(--border-color); color: var(--text-primary); padding: 12px; border-radius: 8px; width: 120px; font-size: 1rem; outline: none; transition: border-color 0.2s; }
.package-input-wrapper input:focus { border-color: var(--accent-blue); }
.package-input-wrapper span { color: var(--text-muted); font-weight: 500; }
.assistant-features { list-style: none; padding: 0; margin: 0 0 24px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.assistant-features li { padding: 8px 0; color: var(--text-muted); font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.btn-primary { width: 100%; background: var(--accent-blue); color: white; border: none; padding: 14px; border-radius: 12px; font-weight: 600; font-size: 1rem; cursor: pointer; transition: background 0.2s; font-family: 'Inter', sans-serif;}
.btn-primary:hover { background: #2563eb; }
.loader-spinner { width: 40px; height: 40px; border: 4px solid var(--border-highlight); border-top-color: var(--accent-blue); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px auto; }
.assistant-running { text-align: center; }
.assistant-running p { color: var(--text-primary); font-weight: 500; margin-bottom: 24px; }
.analysis-progress { display: flex; flex-direction: column; gap: 12px; text-align: left; background: var(--bg-card); padding: 16px; border-radius: 12px; border: 1px solid var(--border-color); }
.progress-step { color: var(--text-muted); font-size: 0.9rem; display: flex; align-items: center; gap: 8px; transition: color 0.3s; }
.progress-step.active { color: var(--text-primary); font-weight: 500; }
.assistant-result { display: flex; flex-direction: column; }
.result-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.result-badge { padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; }
.result-badge.success { background: var(--accent-green-soft); color: var(--accent-green); border: 1px solid var(--accent-green-glow); }
.result-badge.warning { background: var(--accent-amber-glow); color: var(--accent-amber); border: 1px solid var(--accent-amber); }
.assistant-result h3 { margin: 0 0 12px 0; color: var(--text-primary); font-size: 1.1rem; }
.assistant-result p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.5; margin-bottom: 24px; }
.support-script { background: var(--bg-card); padding: 16px; border-radius: 12px; border: 1px solid var(--border-color); }
.support-script h4 { margin: 0 0 12px 0; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.script-box { background: var(--bg-secondary); padding: 16px; border-radius: 8px; color: var(--text-primary); font-size: 0.95rem; font-style: italic; line-height: 1.6; border-left: 4px solid var(--accent-blue); margin-bottom: 16px; user-select: all; border: 1px solid var(--border-color); }
.btn-copy { width: 100%; background: var(--border-color); color: var(--text-primary); border: none; padding: 12px; border-radius: 8px; font-weight: 500; cursor: pointer; transition: background 0.2s; font-family: 'Inter', sans-serif;}
.btn-copy:hover { background: var(--border-highlight); }
.btn-share-social { width: 100%; padding: 14px; border-radius: 12px; border: none; font-weight: 600; font-size: 1rem; cursor: pointer; transition: opacity 0.2s, transform 0.2s; font-family: 'Inter', sans-serif; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.btn-share-social:hover { opacity: 0.9; transform: translateY(-2px); }

@media (max-width: 600px) {
    .assistant-cta { flex-direction: column; text-align: center; }
    .assistant-icon { margin: 0 0 12px 0; }
    .btn-assistant { margin: 16px 0 0 0; width: 100%; }
}

.hidden { display: none !important; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ========================================
   Desktop Dashboard Layout (Grid)
   ======================================== */
@media (min-width: 900px) {
    .app-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "header header"
            "speed status"
            "speed assistant"
            "chart assistant"
            "chart diag"
            "logs logs"
            "guides guides"
            "faq faq"
            "footer footer";
        gap: 0 24px;
        align-items: start;
    }
    .app-header { grid-area: header; }
    #statusCard { grid-area: status; }
    .speed-test-section { grid-area: speed; height: 100%; }
    .chart-section { grid-area: chart; }
    .assistant-cta { grid-area: assistant; margin-top: 0; }
    #diagSection { grid-area: diag; }
    .log-section { grid-area: logs; }
    .seo-faq-section { grid-area: faq; margin-top: 24px; }
    .seo-guides-section { grid-area: guides; margin-top: 24px; }
    .app-footer { grid-area: footer; }
}
  
@media (max-width: 480px) { .hide-mobile { display: none; } } 
