.paint-game, .paint-game * { box-sizing: border-box; }
.paint-game[hidden] { display: none; }
.paint-game {
    --red-ink: #972f39;
    --blue-ink: #245990;
    --border-ink: #273b46;
    --boundary-yellow: #ffdf00;
    --boundary-width: 6px;
    --grid-line: #b3c1c2;
    --hairline: #cbd6d5;
    margin-top: 12px;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 20px;
    background: #fff;
}
.paint-game .game-settings { gap: 8px 16px; }
.paint-game .game-settings label { gap: 8px; font-size: 16px; }
.paint-game select, .paint-game .game-actions button {
    min-height: 44px;
    padding: 4px 11px;
    border-color: #9aafae;
    border-radius: 5px;
    background: #fff;
}
.paint-game #paint-instruction {
    margin: 14px 0 12px;
    color: #3e5255;
    line-height: 1.45;
    font-size: 16px;
}
.paint-game .paint-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(138px, 174px);
    align-items: center;
    gap: clamp(14px, 2.8vw, 26px);
}
.paint-game .paint-field {
    min-width: 0;
    padding: 14px;
    background: #f1f5f4;
    border: 1px solid #dce5e2;
    border-radius: 6px;
}
.paint-game table {
    width: 100%;
    max-width: var(--board-width);
    margin: 0 auto;
    table-layout: fixed;
    border-spacing: 0;
    line-height: 1;
}
.paint-game th, .paint-game td { padding: 0; }
.paint-game th { font-weight: normal; }
.paint-game td {
    position: relative;
    background-color: white;
    box-shadow: inset 1px 0 var(--grid-line), inset 0 1px var(--grid-line);
}
.paint-game tbody tr:last-child td { border-bottom: 1px solid var(--grid-line); }
.paint-game tbody td:last-child { border-right: 1px solid var(--grid-line); }
.paint-game .paint-corner { background: transparent; box-shadow: none; }
.paint-game td[data-color="red"] {
    background-color: #ee9c98;
    background-image: repeating-linear-gradient(0deg, transparent 0 7px, #9c303719 7px 8px);
}
.paint-game td[data-color="blue"] {
    background-color: #8ebce1;
    background-image: repeating-linear-gradient(90deg, transparent 0 7px, #215b961a 7px 8px);
}
.paint-game td.edge-top::before, .paint-game td.edge-left::after {
    content: "";
    position: absolute;
    background: var(--boundary-yellow);
    pointer-events: none;
    z-index: 1;
}
.paint-game td.edge-top::before {
    top: 0; left: 0; right: 0;
    height: var(--boundary-width);
    transform: translateY(-50%);
}
.paint-game td.edge-left::after {
    top: 0; left: 0; bottom: 0;
    width: var(--boundary-width);
    transform: translateX(-50%);
}
.paint-game .paint-brush {
    --brush-ink: var(--red-ink);
    --brush-fill: #fff3f1;
    --brush-line: #ca777a;
    --brush-hover: #ffdedb;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    min-height: 0;
    padding: 3px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--brush-ink);
    font: 600 clamp(11px, 2vw, 15px)/1 system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    touch-action: manipulation;
}
.paint-game .paint-brush[data-axis="column"] {
    --brush-ink: var(--blue-ink);
    --brush-fill: #eff6ff;
    --brush-line: #7d9fc8;
    --brush-hover: #d8eaff;
}
.paint-game .paint-brush:not(:disabled):hover { background: transparent; }
.paint-game .brush-face {
    display: flex; align-items: center; justify-content: center;
    gap: 2px;
    width: 100%; height: 100%;
    background: var(--brush-fill);
    border: 1px solid var(--brush-line);
    border-radius: 5px;
}
.paint-game .paint-brush:hover:not(:disabled) .brush-face,
.paint-game .paint-brush:active:not(:disabled) .brush-face { background: var(--brush-hover); }
.paint-game .brush-icon { font-weight: 500; }
.paint-game .paint-brush[data-axis="column"] .brush-face { flex-direction: column; gap: 0; }
.paint-game .paint-brush[aria-disabled="true"] { color: #586763; cursor: default; }
.paint-game .paint-brush[aria-disabled="true"] .brush-face,
.paint-game .paint-brush[aria-disabled="true"]:hover .brush-face {
    border: 1px dashed #a2afad;
    background: #f5f7f6;
}
.paint-game .paint-brush:focus-visible { outline-offset: -2px; z-index: 2; }
.paint-game .paint-readout { padding: 0 0 0 6px; }
.paint-game .paint-stats { margin: 0; }
.paint-game .paint-stats dt { color: #45565b; font-size: 16px; line-height: 1.35; }
.paint-game .paint-stats dd { margin: 0; line-height: 1.13; font-variant-numeric: tabular-nums; }
.paint-game .paint-length dd { color: var(--border-ink); font-size: 54px; }
.paint-game .paint-count { margin-top: 15px; border-top: 1px solid var(--hairline); padding-top: 12px; }
.paint-game .paint-count dd { margin-top: 2px; color: #32494a; font-size: 27px; }
.paint-game #paint-total { color: #617273; font-size: 18px; }
.paint-game .paint-stats[data-complete="true"] .paint-count dt { color: #125d56; }
.paint-game .game-actions { gap: 6px; margin-top: 18px; }
.paint-game .game-actions button { font-size: 15px; }
.paint-game .game-actions button:disabled { background: #f1f3f2; border-color: #d5dcda; color: #757e7c; }
.paint-game .paint-sr {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
@media (max-width: 650px) {
    .paint-game { padding: 12px; }
    .paint-game .paint-workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .paint-game .paint-field { padding: 8px; }
    .paint-game .paint-readout {
        display: flex; align-items: center; justify-content: space-between;
        gap: 10px 18px; flex-wrap: wrap; padding: 0;
    }
    .paint-game .paint-stats { display: flex; align-items: start; gap: 20px; }
    .paint-game .paint-count { border: 0; margin: 0; padding: 0; }
    .paint-game .paint-stats dt { font-size: 14px; }
    .paint-game .paint-length dd { font-size: 34px; }
    .paint-game .paint-count dd { font-size: 25px; }
    .paint-game .game-actions { margin: 0; }
    .paint-game .game-actions button { padding-inline: 9px; }
}
@media (max-width: 380px) {
    .paint-game .paint-brush { padding: 2px; }
    .paint-game .game-settings { gap: 6px; }
    .paint-game .game-settings label { gap: 4px; font-size: 15px; }
    .paint-game select { padding-inline: 6px; }
}
