.puzzle {
    max-width: 960px;
    margin: 2rem auto;
    font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.puzzle .no-js {
    padding: 1rem;
    background: #fff4d6;
    border: 1px solid #f59e0b;
    border-radius: 10px;
}

/* THREE-COLUMN LAYOUT (collapses under 640px) */
.puzzle .game {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 320px) 1fr;
    gap: 16px;
    align-items: start;
}

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

.puzzle .left, .puzzle .right {
    display: grid;
    gap: 12px;
}

/* BOARD */
.puzzle .board {
    position: relative;
    width: 100%; /* fill the minmax track */
    max-width: 320px; /* keep the required max size */
    aspect-ratio: 1 / 1;
    background: #666;
    justify-self: center;
}

/* TILES */
.puzzle .tile {
    position: absolute;
    width: 33.3333%;
    height: 33.3333%;
    top: calc(var(--row) * 33.3333%);
    left: calc(var(--col) * 33.3333%);
    border: 0;
    padding: 0;
    background-image: var(--img-url);
    background-size: 300% 300%;
    background-position: var(--bg-x) var(--bg-y);
    background-repeat: no-repeat;
    box-shadow: 0 2px 6px rgba(2, 6, 23, .16);
    transition: top .18s ease, left .18s ease;
    cursor: pointer;
}

.puzzle .tile:focus {
    outline: 3px solid #ffdd00;
    outline-offset: 1px;
    background-color: transparent;
    z-index: 2;
}

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

.puzzle .tile::after {
    content: attr(data-n);
    position: absolute;
    inset: auto .4rem .35rem auto;
    padding: .1rem .35rem;
    font-weight: 700;
    font-size: .8rem;
    color: #0f172a;
    background: #ffffffcc;
    border-radius: .4rem;
    opacity: .7;
}

/* RIGHT COLUMN: move counter + controls */
.puzzle .counter {
    font-weight: 600;
    font-size: 1.2rem;
}

.puzzle .counter .solved {
    margin-left: .5rem;
    font-weight: 700;
}

.puzzle .controls {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.puzzle .btn {
    appearance: none;
    cursor: pointer;
}

.puzzle .btn:hover {
    background: #f8fafc;
}

/* LEFT COLUMN: preview */
.puzzle img.preview {
    max-width: 140px;
}

.puzzle .caption {
    font-size: .88889rem;
}

/* Modified */