/* General style */

:root {
    --light: ghostwhite;
    --dark: black;
    --light-accent: rgba(255, 140, 0, 0.25);
}

body {
    font-family: sans-serif;
    font-size: 1.3rem;
    line-height: 1.3rem;
    background-color: var(--light);
}

.button {
    border: 0;
    background: var(--dark);
    color: white;
    font-family: sans-serif;
    font-size: 1rem;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    padding: 0.5rem 0.5rem;
    margin: 0.25rem;
    cursor: pointer;
}

/* index style */

#startGame {
    width: 80%;
    max-width: 400px;
    margin: 1rem auto 0;
}

#startGame #container {
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

#startGame .line,
#startGame #actions {
    margin-top: 1.3rem;
    line-height: 1.3rem;
}

#startGame .line input {
    height: 1.3rem;
}

#startGame input[type=checkbox] {
    width: 1.3rem;

}

#startGame #actions {
    display: flex;
    justify-content: center;
}

/* scoreboard style */

#content-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

table {
    width: 80%;
    max-width: 300px;
    border: 2px solid black;
    border-spacing: 0;
}

table caption {
    margin-bottom: 0.5rem;
}

th {
    padding: 0.5rem;
    border-bottom: 2px solid black;
    font-weight: bold;
}

tbody th {
    border: none;
    font-weight: normal;
}

td {
    padding: 0.5rem;
    text-align: center;
}

tfoot td {
    border-top: 2px solid black;
    font-weight: bold;
}

table th:not(:nth-child(1)),
td:not(:nth-child(1)) {
    cursor: pointer;
}

button-counter::part(container) {
    border: 1px solid var(--dark);
    color: var(--dark);
}

button-counter::part(button) {
    background-color: var(--dark);
    color: white;
}

button-counter:not([data-value="0"])::part(container) {
    background-color: var(--light-accent);
}

button-counter[data-value="0"]::part(container) {
    background-color: var(--light);
}

#addTurn,
#finishGame {
    width: 80%;
    max-width: 300px;
    margin: 1em;
}

#addTurn fieldset {
    border: 1px solid black;
    margin: 0;
}

#addTurn .grid-container {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
    justify-items: center;
}

#addTurn #actions {
    display: flex;
    justify-content: space-between;
    border: 1px solid black;
    border-top: 0;
}

#addTurn #seekTurns {
    display: flex;
    outline: 1px solid black;
}

#addTurn input[type=submit] {
    background-color: var(--light);
    color: var(--dark);
    margin: 0;
    padding: 0.5rem 1rem;
}
#addTurn input[type=submit]:hover {
    background-color: var(--light-accent);
}

#addTurn #add {
    outline: 1px solid black;
    text-decoration: underline var(--dark);
}

#finishGame h2 {
    text-align: center;
    line-height: 2.5rem;
}

#finishGame table {
    width: 100%;
}

#finishGame #actions {
    margin-top: 1rem;
    display: flex;
    justify-content: space-evenly;
}

#finishGame input[type=submit]:hover {
    background-color: var(--light);
    color: var(--dark);
    outline: 2px solid black;
    text-decoration: underline var(--dark);
}

/* Use an horizontal layout for desktop */
@media (min-width: 768px) {
    #content-container {
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }

    table {
        margin-right: 2rem;
    }

    #addTurn,
    #finishGame {
        margin: 0;
    }
}