:root {
    --box-shadow-s: 0px 0px 1px rgba(3, 7, 18, 0.01), 0px 1px 4px rgba(3, 7, 18, 0.02), 0px 2px 9px rgba(3, 7, 18, 0.03), 0px 3px 15px rgba(3, 7, 18, 0.04), 0px 5px 24px rgba(3, 7, 18, 0.05);
    --box-shadow-m: 0px 1px 1px rgba(3, 7, 18, 0.02), 0px 5px 4px rgba(3, 7, 18, 0.03), 0px 12px 9px rgba(3, 7, 18, 0.05), 0px 20px 15px rgba(3, 7, 18, 0.06), 0px 32px 24px rgba(3, 7, 18, 0.08);


    --color-medium-grey: #999;
    --color-light-grey: #ddd;
    --color-lightest-grey: #f5f5f5;
    --color-green: #71bf49;
    --color-dark-green: #45a049;
    --color-peloton-blue: #5A6E8C;
    --color-white: #fff;

    --color-disabled-background: var(--color-medium-grey);
    --color-disabled-foreground: var(--color-light-grey);

    --font-size-xs: clamp(0.6944rem, 0.6577rem + 0.1836vw, 0.8rem);
    --font-size-s: clamp(0.8333rem, 0.7754rem + 0.2899vw, 1rem);
    --font-size-m: clamp(1rem, 0.913rem + 0.4348vw, 1.25rem);
    --font-size-l: clamp(1.2rem, 1.0739rem + 0.6304vw, 1.5625rem);
    --font-size-xl: clamp(1.44rem, 1.2615rem + 0.8924vw, 1.9531rem);

    --radius-s: 0.25rem;
    --radius-m: 0.5rem;

    --space-3xs: clamp(0.3125rem, 0.3125rem + 0vmin, 0.3125rem);
    --space-2xs: clamp(0.5625rem, 0.5408rem + 0.1087vmin, 0.625rem);
    --space-xs: clamp(0.875rem, 0.8533rem + 0.1087vmin, 0.9375rem);
    --space-s: clamp(1.125rem, 1.0815rem + 0.2174vmin, 1.25rem);
    --space-m: clamp(1.6875rem, 1.6223rem + 0.3261vmin, 1.875rem);
    --space-l: clamp(2.25rem, 2.163rem + 0.4348vmin, 2.5rem);
    --space-xl: clamp(3.375rem, 3.2446rem + 0.6522vmin, 3.75rem);
    --space-2xl: clamp(4.5rem, 4.3261rem + 0.8696vmin, 5rem);
    --space-3xl: clamp(6.75rem, 6.4891rem + 1.3043vmin, 7.5rem);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: var(--color-lightest-grey);
    display: flex;
    flex-direction: column;
    font-size: var(--font-size-m);
    gap: var(--space-s);
    min-height: 100dvh;
    padding-block: var(--space-s);
    padding-inline: var(--space-xs);
    width: 100%;
}

header {
    display: flex;
    width: 100%;
}

header svg {
    margin-inline: auto;
    max-width: var(--space-3xl);
}

main {
    background: white;
    border-radius: var(--radius-m);
    box-shadow: var(--box-shadow-s);
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
    margin-inline: auto;
    max-width: 28rem;
    padding: var(--space-xs);
    width: 100%;
}

footer {
    bottom: 0;
    display: flex;
    gap: var(--space-2xs);
    padding-block: var(--space-xs);
    position: fixed;
    width: calc(100% - var(--space-xs) * 2);
}

.player-setup {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xs);
}

.player-setup__item {
    display: flex;
    gap: var(--space-2xs);
}

input[type="text"] {
    border-radius: var(--radius-s);
    border: 1px solid var(--color-light-grey);
    font-size: var(--font-size-m);
    padding-block: 0.5em;
    padding-inline: 0.75em;
    width: 100%;
}

button {
    --background-color: var(--color-green);
    --foreground-color: var(--color-white);

    background-color: var(--background-color);
    border-radius: var(--radius-s);
    border: 2px solid var(--background-color);
    color: var(--foreground-color);
    cursor: pointer;
    font-size: var(--font-size-m);
    margin: 0;
    padding-block: 0.5em;
    padding-inline: 0.75em;
    transition: background-color 0.1s, border-color 0.1s;
    width: 100%;
}

button:hover {
    --background-color: var(--color-dark-green);
}

button[disabled] {
    --background-color: var(--color-disabled-background);
    --foreground-color: var(--color-disabled-foreground);

    cursor: not-allowed;
}

button.narrow {
    width: fit-content;
}

button.secondary {
    --background-color: #666;
}

button.secondary:hover {
    --background-color: #555;
}

button.outline {
    --background-color: transparent;
    --border-color: var(--color-green);
    --foreground-color: var(--color-green);

    border: 2px solid var(--border-color);
}

button.outline[disabled] {
    --border-color: var(--color-disabled-foreground);
    --foreground-color: var(--color-disabled-foreground);
}

section {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
}

section[hidden] {
    display: none;
}

section h2 {
    text-align: center;
}

table {
    border-collapse: collapse;
    font-size: var(--font-size-m);
    width: 100%;
}

table th:first-child {
    width: 6ch;
}

table th,
table td {
    padding: var(--space-3xs);
}

table th {
    padding-block-end: 0;
}

table tr.score-row td {
    border-block-end: 2px solid var(--color-light-grey);
    border-block-start: none;
    height: auto;
    padding-block: var(--space-2xs);
    text-align: center;
}

table td {
    border-block: 1px solid var(--color-light-grey);
    height: 52px;
    text-align: center;
}

table tr:last-child td {
    border-block-end: none;
}

table td.closed-out {
    color: var(--color-medium-grey);
    text-decoration: line-through;
}

table td svg {
    --size: var(--space-l);

    height: var(--size);
    width: var(--size);
}

.confetti-plus {
    position: absolute;
    z-index: 9999;
    font-size: 24px;
    font-weight: bold;
    color: var(--color-green);
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: confetti-burst 0.8s ease-out forwards;
}

@keyframes confetti-burst {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--x-end), var(--y-end)) rotate(var(--rot-end)) scale(0);
        opacity: 0;
    }
}