/* Sokoban */

.sk-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    user-select: none;
}

.sk-hud {
    display: flex;
    gap: 1.1rem;
    font-weight: 600;
    color: var(--color-text-light);
    font-variant-numeric: tabular-nums;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}

/* The cell size is derived from the level's own width so a wide level shrinks
   to fit rather than overflowing. */
.sk-board {
    --sk-w: 8;
    --sk-h: 6;
    --sk-cell: min(calc((92vw) / var(--sk-w)), 46px);
    display: grid;
    grid-template-columns: repeat(var(--sk-w), var(--sk-cell));
    grid-template-rows: repeat(var(--sk-h), var(--sk-cell));
    gap: 2px;
    background: var(--color-border-light);
    padding: 4px;
    border-radius: var(--radius-md);
}

.sk-cell {
    background: #f6efdd;
    border-radius: 2px;
    position: relative;
}

.sk-cell.void {
    background: transparent;
}

.sk-cell.wall {
    background: #6d5335;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

/* Target squares read as a marker on the floor, not as an object. */
.sk-cell.target::before {
    content: '';
    position: absolute;
    inset: 34%;
    border-radius: 50%;
    background: var(--color-accent);
    opacity: 0.55;
}

.sk-cell.crate::after {
    content: '';
    position: absolute;
    inset: 10%;
    border-radius: 4px;
    background: #c98a3c;
    box-shadow: inset 0 0 0 3px #a86f2c, 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* A crate already home, so progress is countable at a glance. */
.sk-cell.crate.done::after {
    background: var(--color-success);
    box-shadow: inset 0 0 0 3px #3d8b40, 0 1px 2px rgba(0, 0, 0, 0.25);
}

.sk-cell.player::after {
    content: '';
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    background: var(--cat-speed);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.sk-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sk-pad-row { display: flex; gap: 4px; }

.sk-dir {
    width: 48px;
    height: 44px;
    font-size: 1.2rem;
    font-weight: 700;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card-bg);
    color: var(--color-text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sk-dir:hover { border-color: var(--color-primary-dark); }

.sk-actions,
.sk-levels {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sk-btn,
.sk-level {
    padding: 0.5rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card-bg);
    color: var(--color-text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sk-level { min-width: 2.4rem; }

.sk-btn:hover:not(:disabled),
.sk-level:hover { border-color: var(--color-primary-dark); }
.sk-btn:disabled { opacity: 0.45; cursor: default; }

.sk-level.active {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
}

.sk-dir:focus-visible,
.sk-btn:focus-visible,
.sk-level:focus-visible {
    outline: 3px solid var(--color-text);
    outline-offset: 2px;
}

.sk-feedback {
    min-height: 1.4em;
    margin: 0;
    font-weight: 600;
    color: var(--color-text-light);
    text-align: center;
}
