html, body {
    min-height: 100vh;
    margin: 0;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(to bottom, #040033 0%, #2843ae 100%);
    align-items: center;
    justify-content: center;
}

#page-container {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
}

/* Navigation Bar styles */

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    margin: 0;
}

.navbar-brand {
    font-weight: bold;
    display: flex;
    align-items: center;
}

#navigation-container {
    margin: 0;
    width: 100%;
}

#user-container {
    display: flex;
    align-items: center;
    margin: 0 0 0 1vmax;
    gap: 8px;
    @media (min-width: 768px) {
        gap: 0;
    }
    padding: 0 8px 0 8px;
    background: none;
    border: none;
}

#navbar-left-group {
    height: auto;
}

#logo-img {
    width: 50px;
    height: 50px;
    padding: 3px;
    border-radius: 50%;
}

#profile-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

/* Home Content styles */

#content {
    margin: auto;
    padding: 0;
    width: 75%;
    height: auto;
    align-items: center;
    justify-content: center;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

#content-logo {
    padding: 20px;
    margin: 0;
    width: 200px;
    height: auto;
    border-radius: 50%;
}

#content-text {
    color: white;
    font-size: 20px;
    text-align: center;
}

#press-start-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

#press-start-gif {
    width: 350px;
    height: auto;
    margin: 0;
    padding: 0;
}

/* Login/Signup styles */

.form-body {
    display: flex;
}

.form-container {
    position: relative;
    margin: auto;
    padding: 10px;
    width: 450px;
    max-height: 90vh; 
    border-radius: 30px;
    background-color: white;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow-y: auto;
    box-sizing: border-box;
}

.form-container::-webkit-scrollbar {
    width: 8px;
}

.form-container::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 20px;
}

.form-container::-webkit-scrollbar-track {
    border-radius: 20px;
    margin: 30px 0;
}

#login-container {
    height: 510px;
}

#sign-up-container {
    height: 600px;
}

#form-logo {
    width: 120px;
    height: 120px;
    padding: 15px;
    border-radius: 50%;
}

#close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1001;
    font-size: 30px;
}

.form-container h2 {
    margin-top: 0;
    font-weight: bold;
}

.form-fields {
    margin-top: 25px;
}

.form-fields .text-input {
    width: 60%;
    padding: 10px 20px;
    border: 1px solid black;
    border-radius: 30px;
}

.form-fields .text-input:focus {
    border: 2px solid #1d00d9;
    outline: none;
}

.form-fields .submit-button {
    padding: 10px 20px;
    border-radius: 30px;
    background-color: #1d00d9;
    color: white;
    border: none;
}

.form-fields .submit-button:disabled {
    background-color: #999;
    cursor: not-allowed;
}

.pfp-selection {
    display: grid;
    grid-template-columns: repeat(4, 50px);
    justify-content: center;
    gap: 10px;
}

.pfp-label input {
    display: none;
}

.pfp-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.pfp-label input:checked + .pfp-option {
    border-color: #1d00d9;
}

/* Games/Leaderboards Page styles */

#games-content {
    margin: 0;
    width: 100%;
    height: auto;
    align-items: center;
    justify-content: center;
}

#games-content h1 {
    color: white;
    font-size: 50px;
    text-align: center;
    font-weight: bold;
    overflow: hidden;
}

#search-container {
    justify-content: center;
    margin-top: 0px;
}

#search-header {
    display: flex;
    gap: 15px;
    align-items: center;
    margin: 0 0 10px 0;
    padding: 10px;
}

#search-container input {
    max-width: 300px;
}

.sort-option {
    background-color: none;
}

.sort-option:hover {
    cursor: pointer;
}

.sort-option.selected, .sort-option.selected:hover {
    background-color: #c6c6c6;
}

.game-list {
    max-height: 70vh;
    height: 600px;
    overflow-y: auto;
    margin-left: 5px;
    margin-right: 5px;
}

.game-item, .game-item:focus, .game-item:active {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    width: 100%;
    font-size: 20px;
    @media (max-width: 768px) {
        font-size: 15px;
    }
    padding: 5px 10px 5px 10px;
    color: white;
    outline: none;
    text-align: left;
}

.game-item {
    background:#3f3f3f;
}

.game-item:hover {
    color: blue;
}

.game-info {
    display: flex;
    gap: 20px;
    @media (max-width: 768px) {
        gap: 10px;
    }
}

/* Leaderboards Modal styles */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    overflow-y: auto;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 9999;
    padding: 1rem;
}

.modal-box {
    margin: auto;
    background: white;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;

    border-radius: 12px;
    padding: 1rem;

    background: white;
    border-radius: 12px;
    padding: 20px;
    width: 450px;
    max-width: 90%;

    position: relative;
}

.modal-box::-webkit-scrollbar {
    width: 8px;
}

.modal-box::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 20px;
}

.modal-box::-webkit-scrollbar-track {
    border-radius: 20px;
    margin: 30px 0;
}

.modal-box h3 {
    text-align: center;
    font-weight: bold;
}

.modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    font-size: 20px;
    cursor: pointer;
}

.modal-list {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

.modal-item {
    padding: 10px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.modal-item .leader-info {
    display: flex;
    align-items: center;
}

.modal-item .leader-info .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rank {
    width: 2em;
}

.leader-pfp {
    border-radius: 50%;
    width: 30px;
    height: 30px;
}

.modal-overlay.active {
    display: flex;
}

.modal-item:nth-child(even) {
    background-color: #3f3f3f;
}

.modal-item:nth-child(odd) {
    background-color: #838383;
}

.modal-item#first {
    background-color: #cdaf01;
    font-weight: bold;
}

.modal-item#second {
    background-color: silver;
    font-weight: bold;
}

.modal-item#third {
    background-color: #a76728;
    font-weight: bold;
}

/* Play Page styles */


#play-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    color: white;
}

#play-header #user-container {
    margin-left: 0px;
    justify-self: start;
    display: flex;
    align-items: center;
}

#play-header #user-container .navbar-text {
    max-width: 8vw;
    max-height: 20vw;
    white-space: normal;      
    word-wrap: break-word;   
    overflow-wrap: break-word;
    overflow: hidden;

    @media (max-width: 1500px) {
        font-size: 15px;
    }
    @media (max-width: 1200px) {
        font-size: 12px;
    }
    @media (max-width: 800px) {
        font-size: 10px;
    }
    @media (max-width: 400px) {
        font-size: 6px;
    }

}

#play-header #user-container .navbar-btn #profile-img {
    @media (max-width: 1000px) {
        width: 25px;
        height: 25px;
    }
    @media (max-width: 800px) {
        width: 20px;
        height: 20px;
    }
    @media (max-width: 400px) {
        width: 15px;
        height: 15px;
    }
}

#play-header h1 {
    margin: 0;
    font-size: 70px;
    max-width: 80vw;
    
    @media (max-width: 1500px) {
        font-size: 55px;
    }
    @media (max-width: 1200px) {
        max-width: 80vw;
        font-size: 45px;
    }
    @media (max-width: 1000px) {
        max-width: 80vw;
        font-size: 35px;
    }
    @media (max-width: 800px) {
        max-width: 70vw;
        font-size: 20px;
    }
    @media (max-width: 400px) {
        max-width: 50vw;
        font-size: 20px;
    }
    
    text-align: center;
    font-weight: bold;
    justify-self: center;
    overflow: hidden;
}

#play-header #close-button {
    position: relative;
    align-self: start;
    justify-self: end;
    display: flex;
    align-items: center;
    top: 0px;
    right: 0px;
    padding-top: 10px;
    padding-right: 10px;
    @media (max-width: 768px) {
        padding-top: 5px;
        padding-right: 5px;
    }
    z-index: 0;
    font-size: 30px;
}

#page-container::after {
    content: "";
    display: block;
    clear: both;
}

#controls-container {
    padding: 10px;
    float: left;
}

#game-container {
    position: relative;
    width: 80%;
    aspect-ratio: 16 / 9;

    margin: 3vh auto;

    display: flex;
    justify-content: center;
    align-items: center;

    max-height: 80vh;

    clear: left;
}

#game-canvas {
    width: 100%;
    height: 100%;

    display: block;
    background: #000;
    border: 2px solid white;
}

#game-over-popup {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 10;
}

.hidden {
  display: none;
}

#game-over-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    margin: 0;
    padding: 0;
    color: black;
    border-radius: 12px;
    text-align: center;
}

.hidden {
    display: none;
}

#game-over {
    margin: 0;
}

#final-score {
    margin: 0;
}

#game-over-popup button {
    cursor: pointer;
    border: none;
    border-radius: 5px;
    color: white;
    margin: 0;
    background-color: #007bff;
    transition: transform 0.2s ease;
}


#popup-content {
    background: white;
    border-radius: 12px;
    text-align: center;
    align-items: center;
}

#restart-btn, #exit-btn {
  cursor: pointer;
}

/* Account Settings Page styles */

#account-body {
    display: flex;
}

#account-container {
    position: relative;
    margin: auto;
    padding: 10px;
    width: 600px;
    height: 1200px;
    max-height: 90vh; 
    border-radius: 30px;
    background-color: white;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow-y: auto;
    box-sizing: border-box;
}

#account-container::-webkit-scrollbar {
    width: 8px;
}

#account-container::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 20px;
}

#account-container::-webkit-scrollbar-track {
    border-radius: 20px;
    margin: 30px 0;
}

#account-container h2 {
    margin-top: 0;
    font-weight: bold;
}

#account-container h4 {
    margin-top: 0;
    font-weight: bold;
}

#account-container #delete-button {
    padding: 10px 20px;
    border-radius: 30px;
    background-color: red;
    color: white;
    border: none;
}