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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
            color: #fff;
            min-height: 100vh;
            overflow-x: hidden;
        }

        .top-nav {
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 1000;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 22px;
            font-weight: bold;
            color: #00ff88;
            text-decoration: none;
            transition: all 0.3s ease;
        }

        .logo:hover {
            color: #00cc6a;
            transform: scale(1.05);
        }

        .logo-icon {
            width: 38px;
            height: 38px;
            background: linear-gradient(135deg, #00ff88, #00cc6a);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
        }

        .nav-buttons {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
        }

        .nav-btn {
            padding: 14px 26px;
            border: none;
            border-radius: 25px;
            font-weight: 600;
            font-size: 15px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            color: white;
        }

        .nav-btn.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .nav-btn:not(.active) {
            background: rgba(255, 255, 255, 0.1);
        }

        .nav-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 40px 20px;
            display: grid;
            grid-template-columns: 1fr 350px;
            gap: 30px;
        }

        .test-section {
            background: rgba(255, 255, 255, 0.03);
            border-radius: 20px;
            padding: 40px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .section-title {
            font-size: 36px;
            font-weight: 700;
            margin-bottom: 30px;
            background: linear-gradient(135deg, #00ff88, #00cc6a);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-align: center;
        }

        .stats-container {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            margin-bottom: 30px;
        }

        .stat-box {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
            border: 2px solid rgba(102, 126, 234, 0.3);
            border-radius: 15px;
            padding: 25px;
            text-align: center;
            transition: all 0.3s ease;
        }

        .stat-box:nth-child(1) {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
            border-color: rgba(102, 126, 234, 0.5);
        }

        .stat-box:nth-child(2) {
            background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 79, 18, 0.2));
            border-color: rgba(255, 107, 53, 0.5);
        }

        .stat-box:nth-child(3) {
            background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 204, 106, 0.2));
            border-color: rgba(0, 255, 136, 0.5);
        }

        .stat-box:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
        }

        .stat-label {
            font-size: 14px;
            color: rgba(255, 255, 255, 0.7);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 10px;
        }

        .stat-value {
            font-size: 48px;
            font-weight: 700;
            color: #fff;
        }

        .click-area {
            background: linear-gradient(135deg, #1e1e3f, #2a2a4a);
            border: 3px dashed rgba(0, 255, 136, 0.3);
            border-radius: 20px;
            min-height: 400px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .click-area:hover {
            border-color: rgba(0, 255, 136, 0.6);
            background: linear-gradient(135deg, #252547, #32325a);
            transform: scale(1.02);
        }

        .click-area.active {
            border-style: solid;
            border-color: #00ff88;
            background: linear-gradient(135deg, #2a2a5a, #3a3a6a);
        }

        .click-area.disabled {
            pointer-events: none;
            opacity: 0.5;
        }

        .click-instruction {
            font-size: 24px;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.8);
            text-transform: uppercase;
            letter-spacing: 2px;
            text-align: center;
            padding: 0 20px;
        }

        .click-icon {
            font-size: 80px;
            margin-bottom: 20px;
            opacity: 0.5;
        }

        .sidebar {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .time-selector {
            background: rgba(255, 255, 255, 0.03);
            border-radius: 20px;
            padding: 30px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .sidebar-title {
            font-size: 22px;
            font-weight: 700;
            margin-bottom: 20px;
            text-align: center;
            color: #00ff88;
        }

        .time-link {
            display: block;
            width: 100%;
            padding: 16px;
            margin-bottom: 12px;
            border: 2px solid rgba(255, 255, 255, 0.2);
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.05);
            color: #fff;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            text-decoration: none;
            text-align: center;
        }

        .time-link:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(0, 255, 136, 0.5);
            transform: translateX(5px);
        }

        .time-link.selected {
            background: linear-gradient(135deg, #ff6b35, #ff4f12);
            border-color: #ff6b35;
            box-shadow: 0 5px 20px rgba(255, 107, 53, 0.4);
        }

        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: transparent;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            animation: fadeIn 0.3s ease;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }

        .modal-overlay.show {
            display: flex;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .modal-content {
            background: linear-gradient(135deg, rgba(15, 15, 35, 0.98), rgba(26, 26, 46, 0.98));
            border: 3px solid rgba(0, 255, 136, 0.6);
            border-radius: 25px;
            padding: 40px;
            max-width: 600px;
            width: 90%;
            text-align: center;
            position: relative;
            animation: slideUp 0.4s ease;
            box-shadow: 0 20px 60px rgba(0, 255, 136, 0.5);
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }

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

        .modal-close {
            position: absolute;
            top: 15px;
            right: 15px;
            background: rgba(255, 255, 255, 0.15);
            border: 2px solid rgba(255, 255, 255, 0.4);
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            color: #fff;
            font-size: 24px;
            font-weight: bold;
        }

        .modal-close:hover {
            background: rgba(255, 77, 77, 0.4);
            border-color: #ff4d4d;
            transform: rotate(90deg);
        }

        .results-title {
            font-size: 28px;
            margin-bottom: 20px;
            color: #00ff88;
            font-weight: 700;
        }

        .results-cps {
            font-size: 80px;
            font-weight: 700;
            color: #fff;
            margin: 20px 0;
            text-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
        }

        .results-label {
            font-size: 20px;
            color: rgba(255, 255, 255, 0.9);
            margin-bottom: 30px;
            text-transform: uppercase;
            letter-spacing: 2px;
        }

        .results-details {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 20px;
            margin: 30px 0;
        }

        .result-detail {
            background: rgba(255, 255, 255, 0.1);
            padding: 20px;
            border-radius: 15px;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .result-detail-label {
            font-size: 13px;
            color: rgba(255, 255, 255, 0.7);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 8px;
        }

        .result-detail-value {
            font-size: 32px;
            font-weight: 700;
            color: #fff;
        }

        .restart-btn {
            margin-top: 25px;
            padding: 18px 50px;
            background: linear-gradient(135deg, #667eea, #764ba2);
            border: none;
            border-radius: 30px;
            color: white;
            font-size: 18px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .restart-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
        }

        .record-badge {
            background: linear-gradient(135deg, #ffd700, #ffed4e);
            color: #000;
            padding: 10px 20px;
            border-radius: 25px;
            font-size: 16px;
            font-weight: 700;
            display: inline-block;
            margin-top: 15px;
            animation: bounce 0.6s ease;
        }

        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        .best-score-display {
            margin-top: 20px;
            padding: 15px 30px;
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.25));
            border: 2px solid rgba(102, 126, 234, 0.5);
            border-radius: 20px;
            display: inline-block;
        }

        .best-score-display .best-label {
            font-size: 14px;
            color: rgba(255, 255, 255, 0.7);
            text-transform: uppercase;
            letter-spacing: 1.5px;
            margin-bottom: 5px;
        }

        .best-score-display .best-value {
            font-size: 28px;
            font-weight: 800;
            color: #00ff88;
            text-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
            letter-spacing: 1px;
        }

        .trending-section {
            background: rgba(255, 255, 255, 0.03);
            border-radius: 15px;
            padding: 20px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .trending-title {
            font-size: 19px;
            font-weight: 700;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .fire-icon {
            color: #ff6b35;
        }

        @media (max-width: 1024px) {
            .container {
                grid-template-columns: 1fr;
            }
            .nav-buttons {
                justify-content: center;
            }
            .stats-container {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        @media (max-width: 640px) {
            .nav-buttons {
                display: none;
            }
            .stats-container {
                grid-template-columns: 1fr;
            }
            .section-title {
                font-size: 28px;
            }
            .stat-value {
                font-size: 36px;
            }
            .click-area {
                min-height: 300px;
            }
            .results-details {
                grid-template-columns: 1fr;
            }
            .click-instruction {
                font-size: 18px;
            }
            .results-cps {
                font-size: 60px;
            }


            /* Layout adjustments: small stats boxes and maintain order for mobile */
            .stats-container {
                grid-template-columns: repeat(3, 1fr);
                margin-bottom: 15px;
                order: 0;
            }
            .stat-box {
                padding: 15px;
            }
            .stat-value {
                font-size: 28px;
            }
            .stat-label {
                font-size: 12px;
            }
            .click-area {
                min-height: 250px;
                order: 0;
            }
            .test-section {
                display: block;
            }
            .modal-content {
                padding: 30px 20px;
            }
        }

        .click-ripple {
            position: absolute;
            border-radius: 50%;
            background: rgba(0, 255, 136, 0.4);
            width: 50px;
            height: 50px;
            animation: ripple 0.6s ease-out;
            pointer-events: none;
        }

        @keyframes ripple {
            from {
                transform: scale(0);
                opacity: 1;
            }
            to {
                transform: scale(4);
                opacity: 0;
            }
        }

        @keyframes pulse {
            0%, 100% {
                box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7);
            }
            50% {
                box-shadow: 0 0 0 20px rgba(0, 255, 136, 0);
            }
        }

        .click-area.active {
            animation: pulse 1.5s infinite;
        }
    
        /* Mobile navigation hamburger */
        .hamburger {
            display: none;
        }

        @media (max-width: 768px) {
            .top-nav { position: relative; }

            .hamburger {
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                width: 36px;
                height: 28px;
                background: none;
                border-radius: 0;
                gap: 5px;
                cursor: pointer;
            }

            .hamburger span {
                display: block;
                width: 100%;
                height: 3px;
                background: #ffffff;
                border-radius: 2px;
            }

            .nav-buttons { display: none; }

            .nav-buttons.open {
                display: flex;
                flex-direction: column;
                position: absolute;
                top: 64px;
                right: 16px;
                padding: 12px;
                border-radius: 14px;
                background: rgba(0,0,0,0.9);
                border: 1px solid rgba(255,255,255,0.12);
                gap: 10px;
                z-index: 999;
            }
        }

/* Content Section (below the test area) */
        .content-section {
            max-width: 1400px;
            margin: 10px auto 60px;
            padding: 0 20px 40px;
        }

        .content-wrapper {
            display: grid;
            grid-template-columns: 1fr;
            gap: 18px;
        }

        .content-block {
            background: rgba(255, 255, 255, 0.03);
            border-radius: 18px;
            padding: 26px 28px;
            border: 1px solid rgba(255, 255, 255, 0.10);
        }

        .content-block h2,
        .content-block h3 {
            color: #00ff88;
            margin-bottom: 12px;
            line-height: 1.2;
        }

        .content-block h2 { font-size: 26px; }
        .content-block h3 { font-size: 20px; margin-top: 2px; }

        .content-block p {
            color: rgba(255, 255, 255, 0.88);
            line-height: 1.75;
            font-size: 16px;
            margin-bottom: 10px;
        }

        .content-block p:last-child { margin-bottom: 0; }
        /* Ensure result popup stays within viewport */
        .modal-content {
            box-sizing: border-box;
            max-height: calc(100vh - 32px);
            overflow-y: auto;
            -ms-overflow-style: none;
            scrollbar-width: none;
        }

        .modal-content::-webkit-scrollbar { width: 0; height: 0; }


/* --- Zain Shared Footer --- */
.site-footer{
  margin-top: 40px;
  padding: 24px 0;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.site-footer .footer-inner{
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  justify-content: space-between;
}
.site-footer .footer-brand{
  font-weight: 700;
  letter-spacing: 0.6px;
  color: rgba(255,255,255,0.9);
}
.site-footer .footer-links{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.site-footer .footer-links a{
  color: rgba(255,255,255,0.65);
  text-decoration: none;
}
.site-footer .footer-links a:hover{
  color: rgba(255,255,255,0.9);
}
.site-footer .footer-copy{
  color: rgba(255,255,255,0.55);
  font-size: 13px;
}
@media (max-width: 600px){
  .site-footer .footer-inner{
    justify-content: center;
    text-align: center;
  }
}

/* --- Manual Test Controls --- */
.time-btn.manual-extra, .time-link.manual-extra{
  display: none;
}
.time-btn.manual-stop-btn, .time-link.manual-stop-btn{
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
}


/* Header dropdown menus */
.nav-dropdown{
  position: relative;
  display: inline-block;
}
.nav-dropdown-toggle{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav-caret{
  font-size: 12px;
  line-height: 1;
}
.nav-dropdown-menu{
  display: none;
  position: absolute;
  top: 100%;
  margin-top: 0;
  left: 0;
  background: rgba(0,0,0,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 10px;
  min-width: 240px;
  z-index: 2000;
}
.nav-dropdown-menu a{
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin: 6px 0;
}
.nav-dropdown-menu a:hover{
  background: rgba(255,255,255,0.10);
}
.nav-dropdown.open .nav-dropdown-menu{
  display: block;
}
@media (min-width: 901px){
  .nav-dropdown:hover .nav-dropdown-menu{display:block;}
}

@media (max-width: 900px){
  .nav-buttons.open .nav-dropdown-menu{
    position: static;
    top: auto;
    left: auto;
    min-width: unset;
    width: 100%;
    margin-top: 8px;
  }
  .nav-dropdown{
    width: 100%;
  }
  .nav-dropdown-toggle{
    width: 100%;
    justify-content: space-between;
  }
}
