:root {
    --panel: #ffffff;
    --ink: #710049;
    --muted: #666;
    --chip: #f0f1f5;
    --bg: #f6f7fb;
}

:root {
    --board-max: 500px;
    /* desktop default */
}

@media (max-width: 980px) {
    :root {
        --board-max: 420px;
        /* tablet */
    }
}

@media (max-width: 640px) {
    :root {
        --board-max: 340px;
        /* phone */
    }
}


@media (max-width: 420px) {
    :root {
        --board-max: 280px;
        /* small phone */
    }
}


.board-wrap {
    padding: 12px;
    max-width: var(--board-max);
    margin: 0 auto;
    /* center it when narrower than the column */
}

#speed {
    accent-color: #ff8da1;
}

input[type="checkbox"] {
    accent-color: #ff8da1;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    margin: 0 0 12px;
    font-size: 22px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 12px 0 16px;
}

button {
    padding: 8px 12px;
    border: 0;
    border-radius: 12px;
    background: hsl(310, 84%, 71%);
    box-shadow: 0 1px 3px rgba(204, 30, 30, 0.12);
    cursor: pointer;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.speed-label {
    width: 72px;
    display: inline-block;
    text-align: right;
}

.seg {
    display: inline-flex;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(83, 247, 19, 0.12);
}

.seg input {
    display: none;
}

.seg label {
    padding: 8px 10px;
    cursor: pointer;
    border-right: 1px solid #e9e9ef;
    font-size: 14px;
}

.seg label:last-child {
    border-right: 0;
}

.seg input:checked+label {
    background: #222;
    color: #f6c6c6;
}

.grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 380px;
    gap: 16px;
}

@media (max-width: 1100px) {
    .grid {
        grid-template-columns: 220px 1fr 360px;
    }
}

@media (max-width: 980px) {
    .grid {
        grid-template-columns: 1fr 360px;
    }

    .state {
        display: none;
    }
}

@media (max-width: 720px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    padding: 12px;
}

.board-wrap {
    padding: 12px;
}

#board {
    width: 100%;
    height: auto;
    display: block;
}

.kv {
    font-size: 13px;
    color: #444;
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #444;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 99px;
    display: inline-block;
    vertical-align: -1px;
    margin-right: 6px;
}

.pink {
    background: #ff8da1;
}

.redb {
    width: 10px;
    height: 10px;
    border: 2px solid #ff8da1;
    border-radius: 99px;
    display: inline-block;
    margin-right: 6px;
}

.info {
    margin-bottom: 8px;
}

#subinfo {
    margin-bottom: 0px;
    display: block;
}


/* state panel */
.state {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.state pre {
    margin: 0;
    margin-top: 10px;
    font-size: 16px;
    line-height: 48px;
    display: grid;
    grid-template-rows: repeat(8, 60px);
    align-items: center;
}

.state .rowline {
    display: flex;
    justify-content: space-between;
    padding: 0 6px;
    border-radius: 8px;
    display: flex;

}

.state .active {
    background: #ffe3e9;
}

.state .unset {
    color: #999;
}