/* Responsive Design */

@media (max-width: 1024px) {
    .mode-panels {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .footer-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .navbar {
        padding: 0.75rem 1rem;
    }
    .logo {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .mode-panels {
        grid-template-columns: 1fr;
    }

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

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

    .footer-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

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

    .footer-bottom #cookiescript_badge,
    .footer-bottom #CookieScriptBadge {
        position: static !important;
        transform: none !important;
        margin: 0 auto !important;
    }

    .about-features {
        grid-template-columns: 1fr;
    }

    .about-hero h1 {
        font-size: 1.8rem;
    }

    .about-buttons {
        flex-direction: column;
        align-items: center;
    }

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

    .legal-page h1,
    .contact-page h1 {
        font-size: 1.8rem;
    }

    /* Base adjustments */
    body {
        padding-top: 100px; /* Navbar + breathing room with burger menu */
    }

    .container {
        padding: 1rem;
    }

    /* Navigation */
    .navbar {
        padding: 0.75rem 1rem;
    }

    /* Nav container and links handled by burger menu in navbar.css */

    .logo {
        font-size: 1.3rem;
    }

    /* Hero Section */
    .hero {
        padding: 2rem 0;
        margin-bottom: 2rem;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

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

    /* Game Cards Grid */
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .game-card {
        padding: 1.5rem;
    }

    .game-icon {
        font-size: 2.5rem;
    }

    .game-card h3 {
        font-size: 1.3rem;
    }

    /* Buttons */
    .btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.95rem;
    }

    .btn-large {
        padding: 0.9rem 1.5rem;
        font-size: 1rem;
    }

    /* Leaderboard */
    .leaderboard-section {
        padding: 1.5rem;
    }

    .leaderboard-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tab-btn {
        width: 100%;
        padding: 0.8rem;
    }

    /* Team mode + device filter: stay horizontal */
    .leaderboard-tabs.device-filter-tabs {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .device-filter-tabs .tab-btn {
        width: auto;
        flex: 1;
        padding: 0.6rem 0.5rem;
        justify-content: center;
    }

    /* Device tabs: hide text on mobile, show only icons */
    #device-tabs .tab-btn .device-label,
    #practice-device-tabs .tab-btn .device-label {
        display: none;
    }

    #device-tabs .tab-btn .gi svg,
    #practice-device-tabs .tab-btn .gi svg {
        width: 22px;
        height: 22px;
    }

    .leaderboard-table {
        font-size: 0.9rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.75rem 0.5rem;
    }

    /* Game Container */
    .game-container {
        padding-top: 65px;
    }

    .game-content {
        padding: 1rem;
        margin: 0.5rem auto;
    }

    .game-area {
        padding: 1.5rem;
        min-height: 350px;
    }

    .game-instruction {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }

    .result-display {
        font-size: 2.5rem;
        margin: 1.5rem 0;
    }

    .score-display {
        padding: 1rem;
        font-size: 0.95rem;
    }

    /* Reaction Time Game */
    .reaction-area {
        height: 350px;
        font-size: 1.3rem;
    }

    /* Typing Speed Test */
    .typing-text {
        font-size: 1rem;
        line-height: 1.8;
        padding: 1.5rem;
    }

    .typing-input {
        font-size: 1rem;
        padding: 0.8rem;
    }

    /* Number Memory */
    .number-display {
        font-size: 2.5rem;
        letter-spacing: 0.3rem;
        margin: 2rem 0;
    }

    .number-input {
        font-size: 1.5rem;
        padding: 0.8rem;
        width: 90%;
    }

    /* Sequence Memory */
    .sequence-grid {
        max-width: 320px;
        gap: 0.75rem;
        padding: 0.5rem;
    }

    .sequence-cell {
        min-height: 90px;
        border-width: 2px;
    }

    .level-display {
        font-size: 1.5rem;
    }

    /* Aim Trainer */
    .aim-area {
        height: 350px;
    }

    .aim-target {
        width: 55px;
        height: 55px;
    }

    .aim-target::before {
        width: 18px;
        height: 18px;
    }

    .aim-stats {
        flex-direction: row;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .aim-stat {
        flex: 1;
    }

    .aim-stat-label {
        font-size: 0.75rem;
    }

    .aim-stat-value {
        font-size: 1.5rem;
    }

    /* Math Test */
    .math-test-question {
        font-size: 2rem;
        margin: 1.5rem 0;
        min-height: 80px;
    }

    .math-test-answers {
        max-width: 100%;
        gap: 0.75rem;
    }

    .math-test-answers .btn {
        font-size: 1.4rem;
        padding: 0;
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: auto;
    }

    /* Color Test */
    .color-test-word {
        font-size: 3rem;
        margin: 2rem 0;
        min-height: 90px;
    }

    .color-test-buttons {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
        gap: 0.75rem;
    }

    .color-test-buttons .btn {
        font-size: 1rem;
        padding: 1rem;
        min-height: 60px;
    }

    /* Click Speed */
    .click-speed-display {
        flex-direction: row;
        gap: 1rem;
        padding: 0.75rem;
    }

    .click-speed-click-btn {
        font-size: 1.5rem;
        padding: 2rem 3rem;
    }

    /* Multitasking */
    .multitask-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .multitask-color-word {
        font-size: 2.5rem;
        min-height: 50px;
    }

    .multitask-color-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .multitask-target-word {
        font-size: 2rem;
    }

    .multitask-typed-text {
        font-size: 1.5rem;
        min-height: 50px;
    }

    .multitask-input {
        font-size: 1.1rem;
        padding: 0.8rem;
    }

    .multitask-target-area {
        height: 120px;
        max-width: 100%;
    }

    .multitask-target {
        width: 45px;
        height: 45px;
    }

    /* Pattern Recognition */
    .pattern-display {
        gap: 0.75rem;
        min-height: 100px;
    }

    .pattern-item {
        font-size: 3rem;
        width: 65px;
        height: 65px;
    }

    .pattern-options {
        max-width: 100%;
        gap: 0.75rem;
    }

    .pattern-option-btn {
        font-size: 2.5rem;
        padding: 1.5rem;
        min-height: 100px;
    }

    /* Forms */
    .auth-container {
        margin: 2rem auto;
        padding: 1.5rem;
        max-width: 90%;
    }

    .form-group input {
        padding: 0.7rem;
        font-size: 0.95rem;
    }

    /* Navbar - prevent overflow */
    .nav-right {
        margin-left: 0;
    }

    .dropdown-menu {
        min-width: 240px;
    }

    /* Chimp Test */
    .chimp-grid {
        width: 100%;
        height: 400px;
    }

    .chimp-number {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    /* Visual Memory */
    .visual-grid {
        max-width: 350px;
    }

    /* Verbal Memory */
    .verbal-word {
        font-size: 2rem;
        margin: 2rem 0;
        min-height: 60px;
    }

    .verbal-buttons {
        gap: 1rem;
        width: 100%;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }

    .verbal-buttons .btn {
        flex: 1;
        font-size: 1.1rem;
        padding: 0.8rem 1.5rem;
    }

    /* Practice/Ranked Header */
    .practice-header h1 {
        font-size: 1.8rem;
    }

    .practice-header p {
        font-size: 0.95rem;
    }

    /* Mode panels split — make halves full-size on mobile */
    .mode-panel-split {
        gap: 2rem;
    }

    .mode-panel-half {
        padding: 2rem 1.5rem;
    }

    .mode-panel-half .mode-panel-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .mode-panel-half h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .mode-panel-half p {
        font-size: 1rem;
        line-height: 1.5;
    }

    .mode-panel {
        padding: 2rem 1.5rem;
    }

    .mode-panel h2 {
        font-size: 1.5rem;
    }

    .mode-panel-icon {
        font-size: 2.5rem;
    }
}

/* Extra small devices (phones in portrait, less than 480px) */
@media (max-width: 480px) {
    body {
        padding-top: 95px;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .game-card {
        padding: 1.25rem;
    }

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

    .reaction-area {
        height: 300px;
        font-size: 1.1rem;
    }

    .aim-area {
        height: 300px;
    }

    .aim-target {
        width: 50px;
        height: 50px;
    }

    .sequence-grid {
        max-width: 280px;
    }

    .sequence-cell {
        min-height: 80px;
    }

    .result-display {
        font-size: 2rem;
    }

    .leaderboard-table {
        font-size: 0.8rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem 0.25rem;
    }

    /* Math Test */
    .math-test-question {
        font-size: 1.8rem;
        min-height: 70px;
    }

    .math-test-answers .btn {
        font-size: 1.3rem;
        padding: 0;
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: auto;
    }

    /* Color Test */
    .color-test-word {
        font-size: 2.5rem;
        min-height: 80px;
    }

    .color-test-buttons .btn {
        font-size: 0.9rem;
        padding: 0.8rem;
    }

    /* Click Speed */
    .click-speed-click-btn {
        font-size: 1.3rem;
        padding: 1.5rem 2rem;
    }

    /* Multitasking */
    .multitask-color-word {
        font-size: 2rem;
        min-height: 40px;
    }

    .multitask-color-btn {
        padding: 0.6rem;
        font-size: 0.75rem;
    }

    .multitask-target-word {
        font-size: 1.5rem;
    }

    .multitask-typed-text {
        font-size: 1.2rem;
        min-height: 40px;
    }

    .multitask-input {
        font-size: 1rem;
        padding: 0.7rem;
    }

    .multitask-target-area {
        height: 100px;
    }

    .multitask-target {
        width: 40px;
        height: 40px;
    }

    /* Pattern Recognition */
    .pattern-display {
        gap: 0.5rem;
        min-height: 80px;
    }

    .pattern-item {
        font-size: 2.5rem;
        width: 55px;
        height: 55px;
    }

    .pattern-options {
        gap: 0.5rem;
    }

    .pattern-option-btn {
        font-size: 2rem;
        padding: 1rem;
        min-height: 80px;
    }

    /* Chimp Test */
    .chimp-grid {
        width: 100%;
        height: 350px;
    }

    .chimp-number {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    /* Visual Memory */
    .visual-grid {
        max-width: 300px;
    }

    /* Verbal Memory */
    .verbal-word {
        font-size: 1.8rem;
        margin: 1.5rem 0;
    }

    .verbal-buttons {
        flex-direction: row;
        gap: 0.75rem;
    }

    .verbal-buttons .btn {
        min-width: auto;
        flex: 1;
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }

    /* Game area extra small */
    .game-area {
        padding: 1rem;
        min-height: 300px;
    }

    .game-area h2 {
        font-size: 1.8rem;
    }
}

/* Portrait orientation: circular click speed button */
@media (orientation: portrait) {
    .click-speed-click-btn {
        width: 99px;
        height: 99px;
        border-radius: 50%;
        padding: 0;
        font-size: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 1.5rem auto;
    }
    .click-speed-click-btn .cs-click-icon {
        display: block;
    }
    .click-speed-click-btn .cs-btn-text {
        display: none;
    }
    /* During countdown, show number instead of icon */
    .click-speed-click-btn.cs-countdown .cs-click-icon {
        display: none;
    }
    .click-speed-click-btn.cs-countdown .cs-countdown-num {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        font-weight: 700;
        color: #fff;
    }
}

/* Desktop/landscape: hide click icon, show text */
@media (orientation: landscape) {
    .click-speed-click-btn .cs-click-icon {
        display: none;
    }
    .click-speed-click-btn .cs-countdown-num {
        display: none;
    }
}

/* Hide countdown number when not in countdown state */
.click-speed-click-btn .cs-countdown-num {
    display: none;
}

/* Portrait lock: show overlay when phone/tablet is in landscape */
@media screen and (orientation: landscape) and (max-height: 500px) and (hover: none) {
    #portrait-lock-overlay {
        display: flex !important;
    }
}

