/* The game itself: the board, its pencil drawings, and its squares */

.board {
    position: relative;
    width: min(100%, 330px);
    aspect-ratio: 1;
    margin: calc(var(--line) / 2) auto;
}

/* The drawings (js/tic-tac-toe.js): each stroke drawn as you watch, from one end to the other */
#drawing {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

#drawing path {
    fill: none;
    stroke: var(--pencil);
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.92;
}

#drawing path.ghost {
    opacity: 0.35;
}

#drawing path.grid {
    stroke: var(--grid, var(--pencil));
}

#drawing path.x {
    stroke: var(--x, var(--pencil));
}

#drawing path.o {
    stroke: var(--o, var(--pencil));
}

#drawing path.strike {
    stroke: var(--strike, var(--pencil));
}

#drawing path.draw {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation-name: pencil-draw;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

@keyframes pencil-draw {
    to {
        stroke-dashoffset: 0;
    }
}

/* A round's marks, rubbed out */
#drawing .erasing {
    animation: rub-out 0.35s ease-in forwards;
}

@keyframes rub-out {
    to {
        opacity: 0;
    }
}

/* The squares: buttons over the drawing (for the mouse, touch, the keyboard and screen readers) */
.cells {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.cell {
    padding: 0;
    background-color: transparent;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cell:hover:not(.taken):not([aria-disabled="true"]) {
    background-color: rgba(124, 156, 196, 0.1);
}

.cell[aria-disabled="true"] {
    cursor: default;
}

.cell:focus-visible {
    outline: 2px dashed #7c9cc4;
    outline-offset: -10px;
}

@media (prefers-reduced-motion: reduce) {
    #drawing path.draw {
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
    }
}
