@import url('https://fonts.googleapis.com/css2?family=Solitreo&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Macondo+Swash+Caps&display=swap');
@import url('https://fonts.googleapis.com/css2?family=TASA+Explorer:wght@400..800&display=swap');


/* ========================================================= */
/* |                    BASE STYLES                        | */
/* ========================================================= */

@media (min-width: 320px) {
    :root {   
        --base-color1: #ffffff;
        --base-color2: #000000;
        --nav-color1: #caf5a5;
        --nav-color2: #cbc9c9;
        --nav-color3: #b2b5b6;
        --button-color1: #6c757d;
        --button-color2: #20778f;
        --button-color3: #8049b3;
        --button-color4: #5360d6;
        --color-1: #05425d;
        --color-2: #600C8D;
        --color-3: #f0c78e;
        --color-4: #d4d2f3;
    }

    html {
        font-family: TASA Explorer, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        color: var(--text-color);
        height: 100%;
    }
    body {
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        min-height: 100%;
        min-width: 100%;
        background: linear-gradient(to bottom, #1a1a2e, #16213e);
    }

    /* ========================================================= */
    /* |                    HEADER STYLES                      | */
    /* ========================================================= */
    
    header {
        margin: 0 auto;
        padding-top: 2rem;
        width: 100%;
        background-color: var(--base-color2);
    }
    header p {
        margin: 0.5rem auto;
        padding-top: 1rem;
        width: 80%;
        color: var(--nav-color2);
        font-family: TASA Explorer, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        font-size: 1.25rem;
        font-weight: 400;
        text-align: center;
    }

    .user-header {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        padding: 1rem;
        margin: 0.5rem auto;
        width: 90%;
        background: linear-gradient(135deg, var(--color-1), var(--color-2));
        border-radius: 0.5rem;
        box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
        gap: 1rem;
        text-align: center;       
    } 
    .user-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }  
    .user-avatar {
        width: 4rem;
        height: 4rem;
        border-radius: 50%;
        border: 0.1rem solid var(--base-color1);
        object-fit: cover;
    }
    .user-gamertag {
        color: var(--base-color1);
        font-size: 1.25rem;
        font-weight: 400;
    }
    .user-gamertag strong {
        font-weight: 700;
        color: var(--nav-color1);
    }
    .user-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    .user-btn {
        padding: 0.5rem 1rem;
        border-radius: 0.5rem;
        text-decoration: none;
        font-weight: 600;
        font-size: 1rem;
        transition: all 0.3s ease;
        border: none;
        cursor: pointer;
    }
    .settings-btn {
        background-color: var(--button-color2);
        color: var(--base-color1);
    }
    .settings-btn:hover {
        background-color: var(--button-color4);
        transform: translateY(-2px);
    }
    .logout-btn {
        background-color: var(--button-color1);
        color: var(--base-color1);
    }
    .logout-btn:hover {
        background-color: #dc3545;
        transform: translateY(-2px);
    }

    /* ========================================================= */
    /* |                    MAIN GAME AREA                     | */
    /* ========================================================= */

    main {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem;
        width: 100%;
    }

    #game-stats {
        display: flex;
        justify-content: center;
        gap: 3rem;
        margin-bottom: 1rem;
        padding: 0.75rem 1.5rem;
        background-color: rgba(0, 0, 0, 0.7);
        border-radius: 0.5rem;
        box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3);
    }

    .stat-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .stat-label {
        color: #ffffff;
        font-size: 1.25rem;
        font-weight: 600;
    }

    .stat-value {
        color: var(--nav-color1);
        font-size: 1.25rem;
        font-weight: 700;
        min-width: 3rem;
        text-align: left;
    }

    #hoth-canvas {
        box-sizing: border-box;
        border: 0.1rem solid #4a4a4a;
        box-shadow: 0 0 1.25rem #000000;
        width: 90%;
        height: 100%;
        max-height: 45rem;
        max-width: 30rem;
        display: block;
        margin: 0 auto;
        image-rendering: pixelated;
        image-rendering: crisp-edges;
        overflow: hidden;
    }

    /* ========================================================= */
    /* |                    GAME CONTROLS                      | */
    /* ========================================================= */
    
    #hoth-controls {
        display: flex;
        flex-direction: column;
        margin: 1.5rem auto;
        justify-content: center;
        align-items: center;
        gap: 5rem;
        max-width: min(50rem, 100%);
    }

    #game-reset {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    #mobile-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 1rem;
        width: 100%;
    }

    .fire {
        order: 1;
    }

    #btn-left {
        order: 2;
        margin-left: 2rem;
    }

    #btn-right {
        order: 3;
    }

    .dpad-button {
        width: 4rem;
        height: 4rem;
        background-color: #444;
        color: white;
        border: 2px solid #666;
        border-radius: 0.5rem;
        font-size: 1.5rem;
        cursor: pointer;
        touch-action: manipulation;
        user-select: none;
        transition: all 0.2s ease;
    }
    .dpad-button:hover {
        background-color: #555;
    }
    .dpad-button:active {
        background-color: #333;
        transform: scale(0.95);
    }
    .dpad-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    /* ========================================================= */
    /* |                    FOOTER STYLES                      | */
    /* ========================================================= */

    footer {
        background-color: var(--base-color2);
        width: 100%;
        justify-items: center;
        margin-top: auto;
    }
    .foot-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 2rem 0;
    }

    /* ========================================================= */
    /* |                    BUTTON STYLES                      | */
    /* ========================================================= */
    
    .cta-button {
        display: inline-block;
        text-decoration: none;
        color: #ffffff;
        background-color: var(--button-color1);
        padding: 1rem 1.25rem;
        border-radius: .5rem;
        font-weight: 600;
        margin: 0;
        position: relative;
        overflow: hidden;
        z-index: 11;
        transition: color 0.5s ease-out;
        border: none;
        cursor: pointer;
    }
    .cta-button::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--button-color2);
        transform: translateX(-100%);
        transition: transform 0.5s ease;
        z-index: -11;
    }
    .cta-button:hover {
        color: white;
    }
    .cta-button:hover::before {
        transform: translateX(0);
    }
    .primary {
        background-color: var(--button-color2);   
    }
    .secondary {
        background-color: var(--button-color3);
    }
    .fire {
        background-color: red;
    }

    /* ========================================================= */
    /* |                    TYPOGRAPHY                         | */
    /* ========================================================= */

    h1 {
        font-family: Solitreo, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        font-size: 5rem;
        color: var(--color-2);
    }
    h2 {
        font-family: Macondo Swash Caps, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        font-size: 3rem;
        color: var(--nav-color2);
        text-align: center;  
    }
    h3 {
        font-family: Solitreo, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        font-size: 3rem;
        color: var(--color-2);
    }
    h4 {
        font-family: TASA Explorer;
        font-weight: 600;
        font-size: 1.25rem;
        font-style: oblique;
    }

    /* ========================================================= */
    /* |                    MODAL STYLES                       | */
    /* ========================================================= */
    
    .modal {
        display: none;
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        align-items: center;
        justify-content: center;
    }
    .modal.show {
        display: flex;
    }
    .modal-content {
        background-color: #fff;
        padding: 2rem;
        border-radius: 0.5rem;
        max-width: 25rem;
        width: 90%;
        box-shadow: 0 0.25rem 0.25rem rgba(0, 0, 0, 0.3);
        text-align: center;
    }
    .modal-message {
        margin-bottom: 1.25rem;
        font-size: 1rem;
        color: #333;
    }
    .modal-button {
        background-color: #007bff;
        color: white;
        border: none;
        padding: 0.75rem 2rem;
        border-radius: 0.25rem;
        cursor: pointer;
        font-size: 1rem;
    }
    .modal-button:hover {
        background-color: #0056b3;
    }
}


/* ========================================================= */
/* |                    DESKTOP STYLES                     | */
/* ========================================================= */

@media (min-width: 1023px) {
    #hoth-controls {
        flex-direction: row;
        gap: 5rem;
    }

    #game-reset {
        width: auto;
        text-align: center;
    }

    .play-again-btn {
        white-space: nowrap;
        align-self: center;
    }

    footer {
        background-color: var(--base-color2);
        width: 100%;
        justify-items: center;
    }
    .foot-container {
        display: flex;
        flex-direction: row;
        width: min(60rem, 100%);
        padding-top: 2rem;
        padding-bottom: 2rem;
        justify-content: center;
        align-items: center;
        gap: 1rem;
    } 
    .user-header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        padding: 1rem;
        margin: 0.5rem auto;
        width: 90%;
        background: linear-gradient(135deg, var(--color-1), var(--color-2));
        border-radius: 0.5rem;
        box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
        gap: 1rem;
    }
    .user-info {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
    .user-actions {
        justify-content: flex-end;
        width: auto;
    }
}