:root {
    --text-size: 3.5vh;
    --black: #000000;
    --white: #FFFFFF;
    --color-light: #FAE1FA;
    --color-medium: #AA41C0;
    --color-dark: #6441C3;
    --color-alert: #FF0000;
    --color-highlight: #FF9B00;
}

body {
    user-select: none;
    display: flex;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: var(--color-light);
    flex-direction: column;
    cursor: default;
    font-family: Arial, Helvetica, sans-serif;
}

body::-webkit-scrollbar {
    display: none;
}

.card-container {
    display: flex;
    justify-content: center;
}

.main-page {
    transition: filter 0.3s ease-out;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    justify-content: center;
    align-items: center;
    display: grid;
    grid-template-rows: 1fr 1fr 1fr;
    gap: calc((100vh - (200vh / 3 + 25vh)) / 2);
}

.card {
    width: calc(500vh / 9);
    height: calc(100vh / 3);
    transform-style: preserve-3d;
    transition: transform 0.5s;
    position: relative;
    margin-bottom: 5px;
}

div::-webkit-scrollbar {
    display: none;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card .face {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    font-size: calc(var(--text-size) - 4pt);
    color: white;
    border-radius: 10px;
    overflow: scroll;
    align-items: center;
}

.card .front {
    background-color: var(--black);
}

.card .back {
    transform: rotateY(180deg);
}

.title {
    font-weight: bold;
    font-size: calc(var(--text-size) - 2pt);
    margin-top: 16px;
    margin-bottom: 8px;
    text-align: center;
}

.divider {
    position: relative;
    width: 90%;
    height: 2px;
    background-color: white;
    margin: 5px 0;
}

.description {
    position: relative;
    text-align: center;
    padding: 10px;
}

.number {
    color: var(--black);
    position: fixed;
    width: calc(var(--text-size) + 4px);
    height: calc(var(--text-size) + 4px);
    font-size: var(--text-size);
    font-weight: bold;
    bottom: 10px;
    right: 10px;
    padding: 5px;
    background-color: var(--color-highlight);
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-container {
    display: grid;
    gap: 10px;
    justify-content: center;
    align-items: center;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    background-color: var(--black);
    text-align: center;
    padding: 20px 5px;
    width: calc(500vh / 9 - 10px);
    height: calc(100vh / 4 - 50px);
}

.grid-item {
    background-color: var(--color-medium);
    border-radius: 5px;
    color: var(--white);
    font-size: var(--text-size);
    font-weight: bold;
    padding: 5px;
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    overflow: hidden;
}

#num-input {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: text;
}

#menu_button {
    background-color: var(--color-dark);
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}

#menu_button:hover {
    filter: brightness(65%);
}

#map_button {
    background-color: var(--color-dark);
    grid-column: 3 / 4;
    grid-row: 2 / 3;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}

#map_button:hover {
    filter: brightness(65%);
}

#num-output1 {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}

#num-output2 {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}

#num-button {
    background-color: var(--color-alert);
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    justify-content: center;
    align-items: center;
}

#num-button:hover {
    filter: brightness(65%);
}

.map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
}

.map_close {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px;
    background-color: var(--color-dark);
    color: var(--white);
    width: 90px;
    height: 30px;
    font-weight: bold;
    font-size: calc(var(--text-size) - 8pt);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 5px;
}

.map_close:hover {
    filter: brightness(65%);
}

.menu-container {
    position: absolute;
    display: none;
    gap: 10px;
    text-align: center;
    font-size: calc(var(--text-size) + 4pt);
    padding: 10px;
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
}

.menu-item {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--color-medium);
    color: var(--white);
    font-weight: bold;
    border-radius: 10px;
}

@keyframes slideIn {
    from {transform: translateY(100%);}
    to {transform: translateY(0);}
}

@keyframes slideOut {
    from {transform: translateY(0);}
    to {transform: translateY(100%);}
}

.blur-in {
    filter: blur(50px);
}

.blur-out {
    filter: blur(0px);
}

.menu-item:hover {
    filter: brightness(65%);
}

#menu_map {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

#menu_close {
    grid-column: 4 / 5;
    grid-row: 1 / 2;
    font-size: calc(var(--text-size) * 3);
    background-color: var(--color-alert);
}

#clap {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    font-size: calc(var(--text-size) * 2);
    background-color: var(--color-highlight); 
}

#curse_lib {
    grid-column: 1 / 3;
    grid-row: 3 / 5;
}

#duel_lib {
    grid-column: 1 / 3;
    grid-row: 5 / 7;
}

#rules {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

#compose {
    grid-column: 3 / 5;
    grid-row: 3 / 4;
}

#chonk {
    grid-column: 3 / 5;
    grid-row: 4 / 5;
}

#curse_search {
    grid-column: 3 / 4;
    grid-row: 5 / 6;
}

#duel_search {
    grid-column: 4 / 5;
    grid-row: 5 / 6;
}

#powerups {
    grid-column: 3 / 4;
    grid-row: 6 / 7;
}

#colorMode {
    grid-column: 4 / 5;
    grid-row: 6 / 7;
    background-color: var(--color-light);
}

.popup {
    position: absolute;
    top: 10%;
    left: 0%;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    font-family: Arial, sans-serif;
    text-align: center;
    color: #333;
    justify-content: center;
    align-items: center;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
}

.popup h1 {
    color: var(--color-dark);
    font-size: calc(var(--text-size) + 6pt);
    margin-bottom: 10px;
}

.popup p {
    font-size: calc(var(--text-size) - 2pt);
    line-height: 1.5;
}

.list {
    position: absolute;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: visible;
    overflow-x: hidden;
    background-color: var(--color-light);
    color: var(--color-dark);
}

.list div {
    margin: 10px;
}

.list div:hover {
    background-color: var(--color-highlight);
    color: var(--color-light);
}

@media screen and (max-width: 480px) {
    :root {
        --text-size: 7vw;
    }

    .main-page {
        gap: calc((100vh - (600vw / 5 + 25vh)) / 2);
    }

    .card {
        width: 100vw;
        height: calc(300vw / 5);
    }

    .grid-container {
        width: 100vw;
    }
}