html {
    font-size: 10px;
}

@font-face {
    font-family: comicSans;
    src: url('comicSans.ttf');
}

body, table {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -o-user-select: none;
    user-select: none;
    margin: 0;
    position: relative;
    font-family: comicSans, 'Chalkboard SE', 'Comic Neue', sans-serif;
}

table {
    border-collapse: collapse;
}

td {
    padding: 0;

    position: relative;
    display: inline-block;

    border: 1px solid lightgray;
    margin: -1px 0 0 -1px;
    box-sizing: border-box;

    font-weight: bold;
    font-size: 3.5rem;
    text-align: center;
    vertical-align: middle;
    color: white;

    cursor: pointer;
    transition: background-color 0.15s ease, color 0.3s ease;
    line-height: 1;
}

tr {
    display: block;
}

td:not([data-player]):hover {
    background-color: rgba(135, 206, 250, 0.3);
}

td.placed-piece {
    animation: placePiece 0.2s ease-out;
}

@keyframes placePiece {
    0%   { transform: scale(1.35); }
    100% { transform: scale(1); }
}

#score-board {
    background: lightblue;
    position: fixed;
    z-index: 100;
    height: 6rem;
    top: 1rem;
    left: 1rem;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

#score-player-x, #score-player-o {
    font-size: 3.5rem;
    margin-right: 2rem;
}

#refresh {
    vertical-align: bottom;
    position: relative;
    top: 0.3rem;
    width: 5rem;
    cursor: pointer;
}

#refresh img {
    padding: 7px;
    width: 3.5rem;
    transition: transform 0.4s ease;
}

#refresh:hover img {
    transform: rotate(180deg);
}

#points-for-x, #points-for-o {
    font-weight: bold;
    display: inline-block;
}

#points-for-x.score-updated, #points-for-o.score-updated {
    animation: scoreUpdate 0.5s ease-out;
}

@keyframes scoreUpdate {
    0%   { transform: scale(1.6); color: #ff4500; }
    100% { transform: scale(1); }
}

.current-player {
    text-decoration: underline;
}

.line-lr, .line-tb, .line-tlbr, .line-trbl {
    border-bottom: 3px dotted red;
    position: absolute;
    animation: winLine 0.4s ease-in;
    pointer-events: none;
}

@keyframes winLine {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

.line-lr {
    top: 50%;
    left: -100%;
    right: -100%;
    height: 0;
    transform: translateY(-50%);
}

.line-tb {
    left: 50%;
    top: -100%;
    bottom: -100%;
    width: 0;
    border-left: 3px dotted red;
    border-bottom: none;
    transform: translateX(-50%);
}

.line-tlbr {
    top: 50%;
    left: 50%;
    width: 283%;
    height: 0;
    transform: translate(-50%, -50%) rotate(45deg);
    transform-origin: center;
}

.line-trbl {
    top: 50%;
    left: 50%;
    width: 283%;
    height: 0;
    transform: translate(-50%, -50%) rotate(-45deg);
    transform-origin: center;
}
