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

@font-face {
    font-family: "Degular";
    font-weight: 800;
    src: url("/static/web/fonts/Degular-Bold.otf") format("opentype");
}

@font-face {
    font-family: "Degular";
    font-weight: 400;
    src: url("/static/web/fonts/Degular-Regular.otf") format("opentype");
}

@font-face {
    font-family: "Degular";
    font-weight: 900;
    src: url("/static/web/fonts/Degular-Black.otf") format("opentype");
}

html {
    /* === VARIABLES === */
    --primary-color: #2b2b2d;
    --secondary-color: #fbf3cd;
    --accent-color: #ffd500;
    --text-color: #ffffff;
    --error-color: #ff4d4d;

    font-family: "Degular", sans-serif;
}

/* ============================== */
/* === COMPONENTS === */
/* ============================== */

/* === BUTTON === */
.button {
    display: block;
    font-size: 1.6rem;
    padding: 0.2em 1em;
    min-width: 160px;
    text-align: center;
    background-color: var(--accent-color);
    color: var(--primary-color);
    font-weight: 800;
    border-radius: 0.2em;
    text-decoration: none;
    box-shadow: 1px 3px 0 0 var(--text-color);
    transition:
        transform 100ms,
        box-shadow 100ms;
}
.button:active {
    box-shadow: 0 0 0 0 var(--text-color);
    transform: translate(1px, 3px);
}

/* === LOGO === */
.logo {
    width: 80px;
    margin-bottom: 2em;
}

/* === HEADING === */
.heading__wrapper {
    perspective: 100px;
}
.heading--1 {
    font-size: clamp(2.88rem, -0.9rem + 18.75vw, 5.7rem);
    font-weight: 800;
    color: var(--text-color);
    transform: rotateX(20deg);
    text-align: center;
}

.heading--2 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-color);
}

.heading--3 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-color);
}

/* === PARAGRAPH === */
.paragraph--1 {
    font-size: 1.1rem;
    color: var(--text-color);
}

.paragraph--2 {
    font-size: 0.8rem;
    color: var(--text-color);
}

.paragraph--1 strong,
.paragraph--2 strong {
    font-weight: 800;
}

/* === LIST === */
.list {
    display: flex;
    flex-direction: column;
    gap: 1em;
}
.list__item {
    display: flex;
    gap: 1em;
}

.list__text {
    display: flex;
    flex-direction: column;
    gap: 0.2em;
}

.list__number {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
    min-width: 1em;
    height: 1em;
    color: var(--primary-color);
    background-color: var(--accent-color);
    text-align: center;
    border-radius: 0.1em;
    margin-top: 0.2em;
}

/* === INPUT === */
.input {
    font-family: inherit;
    font-weight: inherit;
    font-size: 1.1rem;
    border-radius: 0.2em;
    background: none;
}
.input--text,
.input--email {
    padding: 0.8em 1em;
    border: var(--text-color) 1px solid;
    text-align: center;
    width: 100%;
    color: var(--text-color);
}
.input--checkbox {
    accent-color: var(--accent-color);
}
.input::placeholder {
    color: var(--text-color);
    opacity: 0.3;
    font-weight: 800;
}
.input--error {
    border-color: var(--error-color);
}

.link {
    color: var(--text-color);
}

/* === LEADERBOARD === */
.leaderboard-item {
    --rank-cut-offset: 0.4em;
}

.leaderboard-item--first {
    position: relative;
}

.leaderboard-item--first::after,
.leaderboard-item--first::before {
    content: "";
    position: absolute;
    left: calc((var(--rank-width) - var(--rank-cut-offset)));
    transform: translateX(-50%);
    bottom: 100%;
    width: 1.6em;
    height: 1em;
    border-radius: 0.2em 0.2em 0 0;
}

.leaderboard-item--first::before {
    background-color: var(--accent-color);
}

.leaderboard-item--first::after {
    background-image: url("/static/web/icons/crown.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 75%;
}

.leaderboard-item--first .leaderboard-item__rank {
    background-image: url("/static/web/icons/tildas_pattern.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 120%;
}

.leaderboard-item__content {
    display: flex;
    align-items: stretch;
    background-color: var(--secondary-color);
    border-radius: 0.4em;
    overflow: hidden;
    height: 2em;
    width: 100%;
}

.leaderboard-item__rank {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    min-width: var(--rank-width);
    clip-path: polygon(
        0% 0%,
        100% 0%,
        100% calc(100% - var(--rank-cut-offset)),
        calc(100% - var(--rank-cut-offset)) 100%,
        0% 100%
    );
}

.leaderboard-item:not(.leaderboard-item--top) {
    --rank-width: 3em;
}

.leaderboard-item:not(.leaderboard-item--top) .leaderboard-item__rank {
    background-color: var(--primary-color);
    color: var(--accent-color);
    font-size: 1.4em;
}

.leaderboard-item--top {
    --rank-width: calc(2.2em + var(--rank-cut-offset));
}

.leaderboard-item--top .leaderboard-item__rank {
    padding-right: var(--rank-cut-offset);
    background-color: var(--accent-color);
    color: var(--primary-color);
    font-size: 2em;
}

.leaderboard-item__player {
    display: flex;
    align-items: center;
    flex: 1;
    overflow: hidden;
    padding-left: var(--padding-left);
}

.leaderboard-item:not(.leaderboard-item--top) .leaderboard-item__player {
    --padding-left: 1.4em;
}
.leaderboard-item--top .leaderboard-item__player {
    --padding-left: 0.4em;
}

.leaderboard-item__username,
.leaderboard-item__score {
    font-size: 1.1em;
    color: var(--primary-color);
}

.leaderboard-item__username {
    font-weight: 800;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.leaderboard-item__score {
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4em;
    background-color: var(--text-color);
    padding-inline: 2.2em 0.6em;
    min-width: 7em;
    clip-path: polygon(30% 0%, 100% 0%, 100% 100%, 0% 100%);
}

.leaderboard-item__trophy,
.leaderboard-item__avatar {
    width: 16px;
    height: 16px;
}

.leaderboard-item--small .leaderboard-item__trophy,
.leaderboard-item--small .leaderboard-item__avatar {
    width: 12px;
    height: 12px;
}

.leaderboard-item--small {
    font-size: 0.7em;
    width: 80%;
}

.leaderboard-item--active .leaderboard-item__rank {
    clip-path: none;
}
.leaderboard-item--active.leaderboard-item:not(.leaderboard-item--top)
    .leaderboard-item__rank {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

/* ============================== */
/* === LAYOUT === */
/* ============================== */

.container {
    position: relative;
    padding: 2em 1em;
    min-height: 100dvh;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container--login,
.container--tc,
.container--leaderboard,
.container--404 {
    background-image: url("/static/web/images/default_bg.webp");
}

.container--tc {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.container--gameover {
    background-image: url("/static/web/images/gameover_bg.jpg");
}
.container--landing {
    background-image: url("/static/web/images/landing_page_bg.webp");
}

/* ============================== */
/* === LANDING PAGE === */
/* ============================== */

@keyframes float {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0);
    }
}

.landing__character {
    height: 60dvh;
    margin-bottom: -4em;
    animation: float 4s ease-in-out infinite;
}

.landing__content {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    bottom: 0;
    width: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding-bottom: 6em;
}

.landing__content::before {
    content: "";
    position: absolute;
    height: calc(100% + 14em);
    width: 100%;
    bottom: 0;
    left: 0;
    background: linear-gradient(to top, #000000 30%, transparent);
    z-index: -1;
}

.landing__heading {
    margin-bottom: 1.4em;
}

/* ============================== */
/* === LOGIN PAGE === */
/* ============================== */

.login__form {
    width: 100%;
    margin-block: 1em;
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

.login__content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    justify-content: space-between;
}

.login__error {
    color: var(--error-color);
    min-height: 1.2em;
    visibility: hidden;
}

.login__error--visible {
    visibility: visible;
}

.login__buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-inline: auto;
    gap: 1em;
    margin-block: 0.4em 0.2em;
}

.login__checkbox {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin-top: 0.6em;
}

.login__checkbox__item {
    display: flex;
    align-items: center;
    gap: 0.4em;
}

/* ============================== */
/* === LEADERBOARD PAGE === */
/* ============================== */

.leaderboard__heading {
    font-size: 2.4rem;
    color: var(--text-color);
    margin-block: 0.6em;
    font-weight: 800;
}

.leaderboard__heading span {
    position: relative;
}
.leaderboard__heading span::after {
    content: "";
    position: absolute;
    bottom: calc(100% - 0.2em);
    left: 50%;
    width: 100%;
    aspect-ratio: 1 / 1;
    transform: translateX(-50%);
    mask-image: url("/static/web/icons/crown.svg");
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: bottom;
    background-color: var(--accent-color);
}

.leaderboard__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.leaderboard__table {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin-bottom: 2em;
    padding-top: 1.4em;
    overflow-y: scroll;
    max-height: 340px;
    padding-right: 10px;
    width: 100%;

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--primary-color);
}

/* Chrome / Safari / Edge */
.leaderboard__table::-webkit-scrollbar {
    width: 6px;
}

.leaderboard__table::-webkit-scrollbar-track {
    background: var(--primary-color);
    border-radius: 10em;
}

.leaderboard__table::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10em;
}

.leaderboard__table::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ============================== */
/* === GAMEOVER PAGE === */
/* ============================== */
.gameover__content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}
.gameover__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.6em;
    text-align: center;
    gap: 0.4em;
}
.gameover__result {
    margin-top: 1.2em;
    display: flex;
    gap: 1em;
    align-items: center;
}
.gameover__score {
    position: relative;
    padding: 0.2em 0.8em 0.2em 1.8em;
    font-weight: 800;
    font-size: 1.6rem;
    border-radius: 0.1em;
    display: grid;
}
.gameover__score span {
    grid-area: 1 / 1;
    display: block;
}
.gameover__score span:first-child {
    visibility: hidden;
}
.gameover__score--points {
    background-color: var(--text-color);
    color: var(--primary-color);
}
.gameover__score--limes {
    background-color: var(--primary-color);
    color: var(--accent-color);
}

.gameover__score::before {
    position: absolute;
    content: "";
    background-repeat: no-repeat;
    background-position: center;
    top: 50%;
    transform: translateY(-50%);
    aspect-ratio: 1 / 1;
}
.gameover__score--points::before {
    left: 0.5em;
    width: 1em;
    background-image: url("/static/web/icons/trophy.svg");
}
.gameover__score--limes::before {
    width: 2em;
    left: -0.6em;
    background-image: url("/static/web/icons/lime.svg");
}
.gameover__table {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin-bottom: 1.6em;
    max-width: 100%;
    width: 100%;
    mask-image: linear-gradient(
        rgba(255, 255, 255, 0) 2%,
        rgba(255, 255, 255, 0.9) 30%,
        rgba(255, 255, 255, 1),
        rgba(255, 255, 255, 0.9) 70%,
        rgba(255, 255, 255, 0) 98%
    );
}
.gameover__table--top {
    mask-image: linear-gradient(
        rgba(255, 255, 255, 1),
        rgba(255, 255, 255, 0.9) 70%,
        rgba(255, 255, 255, 0) 98%
    );
}
.gameover__buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-inline: auto;
    gap: 1em;
}

/* ============================== */
/* === 404 PAGE === */
/* ============================== */

.container--404 {
    justify-content: center;
    align-items: center;
    gap: 1em;
}

@keyframes wobble {
    0%,
    100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-8deg);
    }
    75% {
        transform: rotate(8deg);
    }
}

.notfound__character {
    height: 40dvh;
    animation: wobble 3s ease-in-out infinite;
    transform: scaleX(-1);
}

.notfound__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}
