/* i'll do something with this later */
/* @import "https://www.nerdfonts.com/assets/css/webfont.css"; */


*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    background-color: #1e1e2e;
    color: #cdd6f4;
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

#container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#auth,
#games,
#prepare,
#tierlist-player,
#tierlist,
#loading,
#songless-player,
#songless-guesses {
    display: none;
    margin: auto;
}

#loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #1e1e2e;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

#auth,
#games {
    width: 15rem;
    background-color: #181825;
    border-radius: 5px;
    padding: 1rem;
    text-align: center;
}

#auth-form {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
}

#auth-form>input {
    margin: 0;
    border: none;
    outline: none;
    background-color: #181825;
    border-bottom: 3px solid #a6adc8;
    padding-bottom: 3px;
    color: #cdd6f4;
    text-align: center;
    transition: border-bottom-color 0.25s ease;
}

#auth-form>input:focus {
    border-bottom: 3px solid #cba6f7;
}

#auth-form>button {
    background-color: #313244;
    border: none;
    padding: 3px;
    color: #cdd6f4;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease;
}

#auth-form>button:hover {
    background-color: #cba6f7;
    color: #11111b;
}

.game {
    display: block;
    text-decoration: none;
    color: #cdd6f4;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.game:hover {
    background-color: #cba6f7;
    color: #11111b;
}

.game-desc {
    color: #a6adc8;
    transition: color 0.25s ease;
}

.game:hover .game-desc {
    color: #313244;
}

#prepare {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 1rem;
    width: 90%;
    max-width: 900px;
    padding: 1rem;
    justify-items: center;
}

#mode-select-container {
    grid-area: 1 / 1 / 2 / 3;
}

#source-list-container {
    grid-area: 2 / 1 / 3 / 2;
}

#to-rank-source-list-container {
    grid-area: 2 / 2 / 3 / 3;
}

#included-list-container {
    grid-area: 3 / 1 / 4 / 2;
}

#excluded-list-container {
    grid-area: 3 / 2 / 4 / 3;
}

#create-game {
    grid-area: 4 / 1 / 5 / 3;
}

#mode-select-container,
#source-list-container,
#to-rank-source-list-container,
#included-list-container,
#excluded-list-container {
    background-color: #181825;
    border-radius: 5px;
    padding: 1rem;
    width: 100%;
    max-width: 20rem;
}

#mode-select-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#source-list-container,
#to-rank-source-list-container,
#included-list-container,
#excluded-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 20rem;
}

#source-list,
#to-rank-source-list,
#included-list,
#excluded-list {
    overflow-y: scroll;
    overflow-x: hidden;
}

.game {
    background-color: #1e1e2e;
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-radius: 3px;
    gap: 0.25rem
}

.artist,
.album,
.song {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #1e1e2e;
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-radius: 3px;
    gap: 0.25rem
        /* idk why 3px here but 5px everywhere else, i can barely notice the difference yet it looks much better this way */
}

#included-list>.album>p,
#included-list>.song>p {
    max-width: 5rem;
}

.album>img,
.song>img {
    width: 5rem;
}

#clear-to-rank-source-list,
#create-game {
    visibility: hidden;
}

#tierlist {
    width: clamp(20rem, 95%, 75rem);
}

#ranks {
    background-color: #181825;
    padding: 1rem;
    width: 100%;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#ranks>div {
    width: 100%;
    background-color: #1e1e2e;
    display: flex;
    align-items: stretch;
}

#ranks>div>p {
    color: #11111b;
    min-width: 6rem;
    margin: 0;

    /* for fuck sake why i can use text element as container */
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-container {
    min-height: 6rem;
    display: flex;
    flex-wrap: wrap;
    align-items: start;
}

#ranking-elements {
    background-color: #181825;
    padding: 1rem;
    width: 100%;
    border-radius: 5px;
}

.ranking-element {
    height: 6rem;
    aspect-ratio: 1 / 1;
    position: relative;
    margin: 0;
    touch-action: none;
}

.ranking-element>img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.ranking-element>.name-wrap {
    position: absolute;
    display: block;
    width: 100%;
    bottom: 0;
    left: 0;
    z-index: 2;
    margin: 0;
    padding: 5px 0;
    text-indent: 5px;
    background: rgba(0, 0, 0, 0.5);
}

.ranking-element>.name-wrap>p {
    margin: 5px 0 0;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ranking-element>.name-wrap[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translate(-50%, -6px);
    background: #313244;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: normal;
    width: max-content;
    max-width: 180px;
    text-align: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, visibility .15s ease;
    pointer-events: none;
}

.ranking-element>.name-wrap[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

#tierlist-player {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #181825;
    padding: 1rem;
    width: 100%;
    height: 6rem;
    z-index: 3;
}

#tierlist-player-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    height: 100%;
}

#tierlist-player-controls>img {
    height: 100%;
}

#playlist {
    display: none;
    flex-direction: column;
    height: auto;
    max-height: 60vh;
    overflow-y: auto;
    position: absolute;
    top: 6rem;
    left: 0;
    width: 100%;
}

#playlist.visible {
    display: flex;
}

.playlist-song {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
    background-color: #1e1e2e;
    padding: 0.5rem;
}

#playlist .playlist-song:nth-child(even) {
    background-color: #181825;
}

.playlist-song>img {
    height: 100%;
}

#songless-player {
    flex-direction: column;
    min-width: 20rem;
    align-items: center;
}

#songless-player-autocomplete {
    position: relative;
    display: inline-block;
}

#songless-player-autocomplete-items {
    position: absolute;
    z-index: 2;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #181825;
    padding: 1rem;
    overflow: scroll;
    max-height: 10rem;
}

#songless-player-autocomplete-items>div {
    cursor: pointer;
}

#songless-player-autocomplete-items>div:hover {
    color: #cba6f7;
}

#songless-player-progress-display {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

#songless-player-duration {
    width: 1.5rem;
}

#songless-player-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #11111b;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

#songless-player-progress-fill {
    width: 0%;
    height: 100%;
    background-color: #cba6f7;
    z-index: 2;
    position: absolute;
}

#songless-player-progress-fill-max {
    width: 0%;
    height: 100%;
    background-color: #313244;
    position: absolute;
}

#songless-player-answer>div {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
    background-color: #1e1e2e;
    padding: 0.5rem;
}

#songless-player-answer>div>img {
    height: 100%;
}

#songless-guesses {
    min-height: 25rem;
    flex-direction: column;
    align-items: center;
}

@media (max-width: 700px) {
    #prepare {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto auto;
    }

    #mode-select-container {
        grid-area: 1 / 1 / 2 / 2;
    }

    #source-list-container {
        grid-area: 2 / 1 / 3 / 2;
    }

    #to-rank-source-list-container {
        grid-area: 3 / 1 / 4 / 2;
    }

    #included-list-container {
        grid-area: 4 / 1 / 5 / 2;
    }

    #excluded-list-container {
        grid-area: 5 / 1 / 6 / 2;
    }

    #create-game {
        grid-area: 6 / 1 / 7 / 2;
    }

    .ranking-element {
        height: 4rem;
    }

    .ranking-element>.name-wrap>p {
        font-size: 0.8rem;
    }

    #ranks>div>p {
        min-width: 4rem;
        font-size: 0.85rem;
    }

    .rank-container {
        min-height: 4rem;
    }

    #tierlist,
    #ranks,
    #ranking-elements {
        padding: 0.5rem;
    }

    #ranks {
        gap: 0.5rem;
    }
}