
body, html {
    margin: 0;
    overflow-y: hidden;
    font-family: Helvetica, serif;
}

header {
    height: 5rem;
    background: lightgoldenrodyellow;
    border-bottom: 1px solid goldenrod;

    display: flex; /* Enables flexbox */
    align-items: center; /* Vertically centers content */
    padding: 0;

    max-width: 1600px;
    margin: 0 auto 1rem auto;
}

header .game-name {
    font-size: 2rem;
    margin-left: 1rem;
}

button, input[type="submit"], input[type="reset"] {
    background: none;
    color: inherit;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    outline: inherit;
}

#board {
    width: fit-content;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 2px solid darkblue;
    gap: 1px;
    background-color: gray;
    margin-bottom: 20px;
}

#board .cell {
    height: 100px;
    width: 100px;
    text-align: center;
    align-content: center;
    box-sizing: border-box;
    background-color: white;
    font-weight: bold;
    font-size: 0;
    position: relative;
}

#board .cell:disabled {
    cursor: not-allowed;
}

#board .player-x {
    color: red;
    background-color: #ffe4e7;
    background-image: url("/x.svg");
}

#board .player-o {
    color: blue;
    background-color: #ebfbff;
    background-image: url("/o.svg");
}

#board.x-turn .cell:not(.player-o):not(.player-o):not(:disabled):hover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url('/x.svg') center/100% no-repeat;
    opacity: 0.4;
    pointer-events: none;
}

#board.o-turn .cell:not(.player-o):not(.player-o):not(:disabled):hover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url('/o.svg') center/100% no-repeat;
    opacity: 0.4;
    pointer-events: none;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    height: calc(100vh - 6rem);
    overflow: hidden;

    max-width: 1600px;
    margin: 0 auto;

    background: #f5f5f5;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2rem;
}

section#events {
    margin-top: 2rem;
}

/* Wide screen layout - side by side */
@media (min-width: 1024px) {
    .container {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 2rem;
        justify-content: stretch;
        align-items: start;
    }

    .game-container {
        align-items: center;
    }

    section#events {
        overflow-y: auto;
        height: calc(100% - 4rem);
        margin-right: 2rem;
    }
}

/* Narrow screen layout */
@media (max-width: 1023px) {
    body, html {
        height: 100%;
        margin: 0;
    }

    .container {
        display: flex;
        flex-direction: column;
    }

    .game-container {
        flex: 0 0 auto;
    }

    section#events {
        flex: 1 1 auto;
        overflow-y: auto;
        margin-left: 1rem;
        margin-right: 1rem;
        margin-bottom: 1rem;
    }
}

#events-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    justify-items: stretch;
}

.event {
    border: 1px solid green;
    border-left: 3px solid green;
    display: grid;
    grid-template-columns: 1fr;
    padding: 0.5rem;
    background: #e1ffdb;
    gap: 0.5rem;
}

.event.skipped {
    opacity: 0.3;
}

.event pre {
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

.event .event-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.event .key {
    text-align: left;
}

.event .value {
    text-align: right;
    overflow: hidden;
    text-wrap: nowrap;
    font-family: monospace;
}


