* { box-sizing: border-box; }
:root { font-family: Arial, sans-serif; color: #333; background: #16213e; }
body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(12px, 4vw, 48px);
    background-color: #16213e;
    background-image:
        linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)),
        url('https://i.ibb.co/LX5rD8WY/Design-sem-nome-3.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
main {
    width: min(100%, 1260px);
    padding: clamp(14px, 3vw, 32px);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
header { text-align: center; margin-bottom: 1.3rem; }
h1 { margin: 0; font-size: 1.65rem; }
header p { margin: .5rem 0 0; color: #555; }
.layout { display: grid; grid-template-columns: 180px minmax(0, 1fr) 228px; gap: 1rem; align-items: start; }
.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    background: #f0f0f0;
    border-radius: 5px;
    padding: .8rem;
    text-align: center;
    margin-bottom: .75rem;
}
.stats strong { color: #764ba2; margin-left: .2rem; font-variant-numeric: tabular-nums; }
.sidebar { display: grid; gap: .65rem; }
.panel { background: #323232; color: #ffffff; padding: .75rem; border-radius: 5px; }
h2 { font-size: 1rem; margin: 0 0 .6rem; }
.tools, .controls, .settings { display: grid; gap: .45rem; }
button, select { font: inherit; font-size: .9rem; border-radius: 5px; min-height: 40px; }
button {
    background: var(--button, #3856f8);
    color: var(--button-text, #ffffff);
    padding: .5rem;
    border: 0;
    transition: filter .15s;
}
button, select, input, summary { cursor: pointer; }
button:hover { filter: brightness(.88); }
button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px #f78dd4; }
button[data-brush="1"] { --button: #3856f8; }
button[data-brush="2"] { --button: #323232; }
button[data-brush="0"] { --button: #323232; }
#play { --button: #092bec; }
#reset { --button: #3856f8; }
#clear { --button: #f84825; --button-text: #000000; }
#load { --button: #3856f8; }
i { display: inline-block; width: .65rem; height: .65rem; border-radius: 2px; margin-right: .3rem; }
.live { background: #ff9e3d; }
.wall { background: #bfcadd; }
canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 5 / 3;
    outline: 3px solid #333;
    background: #191627;
    border-radius: 5px;
    touch-action: none;
    cursor: crosshair;
}
:focus-visible { outline: 3px solid #6739c3; outline-offset: 3px; }
label { display: grid; gap: .3rem; font-size: .9rem; }
select { min-width: 0; padding: .4rem; color: #ffffff; border: 1px solid #7589fa; background: #323232; }
.speed { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin-top: .25rem; }
input[type="range"] { min-width: 45px; flex: 1; accent-color: #764ba2; }
output { white-space: nowrap; }
.hint, details { color: #555; font-size: .9rem; line-height: 1.45; }
.hint { margin: .65rem 0 0; }
details { margin-top: .85rem; }
details p { margin: .4rem 0 0; }
@media (max-width: 900px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .drawing-column, .sidebar { display: grid; gap: .65rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
}

.credits {
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid #ddd;
    color: #555;
    font-size: .875rem;
    line-height: 1.5;
}
.credits p { margin: 0; }



.tools button,
.controls button,
#load {
    font-weight: 700;
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / 25%);
}

.tools button {
    --button: #3856f8;
}

.tools button[aria-pressed="true"] {
    --button: #f95e3e;
    --button-text: #000000;
    box-shadow: inset 0 0 0 2px #facf61,
                inset 0 -3px 0 rgb(0 0 0 / 25%);
}

#play {
    --button: #f8ba1b;
    --button-text: #000000;
}

#clear {
    --button: #f84825;
    --button-text: #000000;
}

main {
    background: transparent;
    box-shadow: none;
}

.layout {
    gap: clamp(14px, 2vw, 26px);
}

.drawing-column,
.board-column,
.sidebar {
    min-width: 0;
    padding: clamp(12px, 1.5vw, 18px);
    border: 2px solid #0f3460;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.drawing-column,
.sidebar {
    background: #323232;
    color: #fff;
}

.drawing-column header p {
    color: #fefcec;
}

.board-column {
    background: #fff;
}

.credits {
    padding: .85rem 1rem;
    border: 0;
    border-radius: 10px;
    background: #323232;
    color: #fefcec;
}

.layout button {
    min-height: 48px;
    padding: .65rem .85rem;
}

.tools,
.controls,
.settings {
    gap: .65rem;
}

@media (min-width: 901px) {
    .layout {
        align-items: stretch;
    }

    .drawing-column,
    .sidebar {
        display: flex;
        flex-direction: column;
    }

    .drawing-column {
        gap: 1rem;
    }

    .sidebar {
        justify-content: space-between;
        gap: 1rem;
    }
}

/* Molduras das três colunas */
.drawing-column,
.board-column,
.sidebar {
    border-color: #facf61;
}

/* Contadores acima do tabuleiro */
.board-column .stats {
    background: transparent;
    padding: 0;
}

.board-column .stats > span {
    background: #323232;
    color: #fff;
    border-radius: 5px;
    padding: .8rem .5rem;
}

.board-column .stats strong {
    color: #fff;
}

@media (min-width: 901px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    body {
        min-height: 0;
        padding-block: 12px;
    }

    main {
        height: calc(100dvh - 24px);
        padding-block: 0;
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        gap: 12px;
    }

    .layout {
        min-height: 0;
        align-items: stretch;
    }

    .drawing-column,
    .board-column,
    .sidebar {
        min-height: 0;
        overflow: auto;
        overscroll-behavior: contain;
    }

    .credits p + p {
    margin-top: .4rem;
}
}

@media (min-width: 901px) {
    main {
        width: min(100%, 1340px);
    }

    .board-column {
        padding: 12px;
    }

    .board-column canvas {
        width: 100%;
        height: auto;
    }
}
