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

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2333;
    --bg-card-hover: #242d3d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #00d4ff;
    --accent-green: #00ff88;
    --accent-red: #ff6b6b;
    --accent-yellow: #ffaa00;
    --gradient-primary: linear-gradient(135deg, #00d4ff 0%, #00ff88 100%);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.logo-icon {
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.4));
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

nav {
    display: flex;
    gap: 28px;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
    position: relative;
}

nav a:hover,
nav a.active {
    color: var(--text-primary);
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 1px;
}

.admin-link {
    color: var(--accent-green) !important;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    padding: 16px;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu.active {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

/* Main Content */
main {
    padding: 32px 0 60px;
}

.speed-test-container {
    text-align: center;
}

.title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 32px;
}

/* Network Info */
.network-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 40px;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.info-icon {
    flex-shrink: 0;
}

.info-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.info-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Speedometer Gauge */
.gauge-wrapper {
    position: relative;
    max-width: 420px;
    margin: 0 auto 32px;
}

.speedometer {
    width: 100%;
    filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.15));
}

.gauge-bg {
    stroke: var(--bg-secondary);
}

.gauge-ticks line {
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.5;
}

.gauge-labels text {
    fill: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    text-anchor: middle;
}

.gauge-progress {
    transition: stroke-dashoffset 0.15s ease-out;
}

.gauge-needle {
    transition: transform 0.3s ease-out;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

.speed-value {
    fill: var(--text-primary);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.speed-unit {
    fill: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.test-status {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: -10px;
}

/* Start Button */
.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 18px 48px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bg-primary);
    background: var(--gradient-primary);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.3);
    margin: 16px 0 32px;
    letter-spacing: 0.5px;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.45);
}

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

.start-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 40px;
    display: none;
}

.progress-bar.active {
    display: block;
}

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

/* Results Cards */
.results {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.result-card {
    background: var(--bg-card);
    padding: 24px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.result-card:hover {
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.result-icon {
    width: 24px;
    height: 24px;
}

.download-icon { color: var(--accent-blue); }
.upload-icon { color: var(--accent-green); }
.ping-icon { color: var(--accent-yellow); }
.jitter-icon { color: var(--accent-red); }

.result-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.result-value {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.result-unit {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.result-quality {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

/* Share Results */
.share-results {
    margin-top: 24px;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.share-results h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--accent-green);
}

.share-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
}

/* Ad Containers */
.ad-container {
    margin: 24px 0;
    text-align: center;
}

.ad-placeholder {
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* About Section */
.about-section {
    margin: 60px 0;
    padding: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
}

.about-section h2 {
    font-size: 1.6rem;
    margin-bottom: 16px;
    text-align: center;
}

.about-section p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
    text-align: center;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.feature {
    text-align: center;
    padding: 24px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: all 0.3s;
}

.feature:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
}

.feature-icon {
    margin-bottom: 16px;
}

.feature h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.feature p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

/* FAQ Section */
.faq-section {
    margin: 60px 0;
}

.faq-section h2 {
    font-size: 1.6rem;
    margin-bottom: 24px;
    text-align: center;
}

.faq-item {
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 18px 20px;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.faq-question:hover {
    background: var(--bg-card-hover);
}

.faq-toggle {
    transition: transform 0.3s;
    flex-shrink: 0;
}

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s;
}

.faq-answer.active {
    padding: 0 20px 18px;
    max-height: 300px;
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Footer */
footer {
    padding: 40px 0 24px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 32px;
}

.footer-section h4 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.footer-section p,
.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    display: block;
    margin: 6px 0;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: var(--accent-blue);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 4px 0;
}

.footer-note a {
    color: var(--accent-blue);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card {
    animation: fadeIn 0.4s ease-out;
}

/* ========================= */
/* MOBILE RESPONSIVE         */
/* ========================= */

@media (max-width: 1024px) {
    .network-info {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .results {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    header {
        padding: 12px 0;
    }
    
    nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }
    
    .network-info {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 28px;
    }
    
    .info-card {
        padding: 12px;
    }
    
    .info-icon {
        width: 20px;
        height: 20px;
    }
    
    .info-label {
        font-size: 0.7rem;
    }
    
    .info-value {
        font-size: 0.8rem;
    }
    
    .gauge-wrapper {
        max-width: 320px;
        margin-bottom: 24px;
    }
    
    .speed-value {
        font-size: 2.5rem;
    }
    
    .speed-unit {
        font-size: 0.85rem;
    }
    
    .start-btn {
        padding: 16px 40px;
        font-size: 1rem;
        margin: 12px 0 24px;
    }
    
    .results {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 24px;
    }
    
    .result-card {
        padding: 18px 12px;
    }
    
    .result-value {
        font-size: 1.8rem;
    }
    
    .result-label {
        font-size: 0.8rem;
    }
    
    .about-section {
        margin: 40px 0;
        padding: 24px;
    }
    
    .about-section h2,
    .faq-section h2 {
        font-size: 1.3rem;
    }
    
    .features {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .feature {
        padding: 20px 12px;
    }
    
    .feature-icon {
        width: 36px;
        height: 36px;
    }
    
    .faq-question {
        padding: 14px 16px;
        font-size: 0.95rem;
    }
    
    .faq-answer p {
        font-size: 0.9rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .share-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .title {
        font-size: 1.3rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .network-info {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .info-card {
        padding: 10px 12px;
    }
    
    .gauge-wrapper {
        max-width: 280px;
    }
    
    .speedometer {
        filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.1));
    }
    
    .speed-value {
        font-size: 2rem;
    }
    
    .speed-unit {
        font-size: 0.75rem;
    }
    
    .gauge-labels text {
        font-size: 9px;
    }
    
    .start-btn {
        padding: 14px 32px;
        font-size: 0.95rem;
    }
    
    .results {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .result-card {
        padding: 14px 10px;
    }
    
    .result-header {
        flex-direction: column;
        gap: 4px;
    }
    
    .result-icon {
        width: 20px;
        height: 20px;
    }
    
    .result-label {
        font-size: 0.75rem;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
    
    .result-unit {
        font-size: 0.75rem;
    }
    
    .result-quality {
        font-size: 0.7rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .about-section {
        padding: 20px 16px;
    }
    
    .share-results {
        padding: 16px;
    }
    
    .share-results h3 {
        font-size: 1rem;
    }
}
