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

:root {
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    --border-radius: 0.5rem;
}

body {
    font-family: system-ui;
}

#map {
    position: absolute;
    inset: 0;
}

.map-page {
    margin: 0;
    min-height: 100vh;
}

body:has(.profile-page) {
    background: url("bg.png") #222;
}

.profile-page {
    max-width: 1000px;
    margin: auto;
    padding: 1rem;

    > * {
        background-color: white;
        padding: 1rem;
        border-radius: var(--border-radius);
        box-shadow: var(--shadow);
        margin-bottom: 1rem;
    }

    h1 {
        margin-top: 0;
    }
}

.form-page {
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-form * {
    margin: 5px;
}

#error {
    color: red;
}

dialog {
    padding: 0;
    border-radius: var(--border-radius);
    border: none;

    &:focus-visible {
        outline: none;
    }

    &::backdrop {
        backdrop-filter: blur(5px);
    }

    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dialog-wrapper {
    border-radius: inherit;

    > :not(.close-button-wrapper) {
        padding-inline: 1rem;
        margin-bottom: 1rem;
    }

    > hr {
        padding: 0;
        max-width: 90%;
        margin: 0 auto;
    }
}

.loading-dialog {
    padding: 1rem;
    text-align: center;

    pre {
        margin: 0;
        font-weight: bold;
    }
}

#leaderboard-dialog {
    #leaderboard-title {
        margin-top: 0;
    }
}

.sport-dialog {
    ul {
        list-style: none;
        margin: 0;

        li {
            margin-bottom: 1rem;
        }
    }
}

.user-marker {
    font-size: 1.25rem;
    pointer-events: none;
}

#toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 1rem;
    margin: 0.5rem;
    padding: 0.5rem;
    backdrop-filter: blur(2px);
    border-radius: 0.5rem;
    background-color: rgba(0, 0, 0, 0.1);

    button {
        background-color: #fff;

        &:hover {
            background-color: #f4f4f4;
        }

        &:active {
            background-color: #efefef;
        }
    }
}

.flex-divider {
    flex: 1;
    min-width: 1rem;
}

.close-button-wrapper {
    display: flex;
    justify-content: right;
    border-radius: inherit;
    margin-bottom: 0.25rem;
}

button, select {
    cursor: pointer;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #efefef;

    &:hover {
        background-color: #e4e4e4;
    }

    &:active {
        background-color: #dfdfdf;
    }
}

.maplibregl-popup .maplibregl-popup-content {
    border-radius: var(--border-radius);
    padding: 1rem;

    h1 {
        font-size: 1.5em;
        margin-top: 0.66rem;
        word-break: break-word;
    }
}

.close-button,
.maplibregl-popup-close-button {
    font-size: 1.25rem;
    background-color: transparent;
    border: none;
    border-radius: 0;
    border-top-right-radius: inherit;
    border-bottom-left-radius: inherit;
    padding: 0;

    width: 1.5em;
    height: 1.5em;
    cursor: pointer;

    &:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    &:active {
        background-color: rgba(0, 0, 0, 0.10);
    }
}

.split {
    display: flex;
    gap: 1rem;

    & > * {
        flex: 1;
    }
}

#runs {
    justify-content: space-between;

    > div {
        max-width: 48%;
    }
}

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

    placement {
        font-weight: bold;
        font-size: 1.25em;
    }

    margin-bottom: 0.25rem;

    .title {
        word-break: break-all;
    }

    verb {
        font-weight: 500;
    }

    time {
        ms {
            font-size: 0.8em;
        }
    }
}

.popup-button {
    margin-top: 0.25rem;
}

.delete-button {
    background-color: #cc4040;
    color: #ffffff;
    &:hover {
        background-color: #cc2222;
    }

    &:active {
        background-color: #bb0000;
    }
}

.profile-time-list {
    list-style: none;
    padding-left: 0;
}

hr {
    border-color: #eee;
}

input {
    padding: 0.5rem;
}

#bottom-left-buttons {
    position: absolute;
    left: 1rem;
    bottom: 1rem;

    button {
        box-shadow: var(--shadow);
        background-color: #fff;

        &:hover {
            background-color: #f4f4f4;
        }

        &:active {
            background-color: #efefef;
        }
    }
}
