/* Nonogram */

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

.ng-hud {
    display: flex;
    gap: 1.25rem;
    font-weight: 600;
    color: var(--color-text-light);
    font-variant-numeric: tabular-nums;
}

/* One grid holds the clue gutters and the board, so the clue columns and the
   board columns cannot drift out of alignment. */
.ng-grid {
    --ng-cell: min(calc((92vw - 3rem) / (var(--ng-size) + 2.2)), 34px);
    display: grid;
    grid-template-columns: calc(var(--ng-cell) * 2.2) repeat(var(--ng-size), var(--ng-cell));
    background: var(--color-card-bg);
    border: 2px solid var(--color-text);
    border-radius: 4px;
    overflow: hidden;
}

.ng-corner { background: var(--color-bg-secondary); }

.ng-clue {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: var(--color-bg-secondary);
    color: var(--color-text);
    font-size: calc(var(--ng-cell) * 0.42);
    font-weight: 700;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.ng-col-clue {
    min-height: calc(var(--ng-cell) * var(--ng-colclue) * 0.62 + 4px);
    padding-bottom: 3px;
    text-align: center;
}

.ng-row-clue {
    align-items: center;
    justify-content: flex-end;
    padding-right: 5px;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.ng-cell {
    width: var(--ng-cell);
    height: var(--ng-cell);
    border: 1px solid var(--color-border);
    background: var(--color-card-bg);
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

/* Every fifth line gets a heavier rule, the standard aid for counting runs. */
.ng-b-right { border-right: 2px solid var(--color-text); }
.ng-b-bottom { border-bottom: 2px solid var(--color-text); }

.ng-cell.filled { background: var(--color-text); }

/* A cross for squares proved blank. Drawn with gradients so there is no extra
   markup inside every cell. */
.ng-cell.marked::after {
    content: '';
    position: absolute;
    inset: 22%;
    background:
        linear-gradient(to bottom right, transparent 44%, var(--color-accent) 44%, var(--color-accent) 56%, transparent 56%),
        linear-gradient(to bottom left, transparent 44%, var(--color-accent) 44%, var(--color-accent) 56%, transparent 56%);
}

.ng-cell:focus-visible {
    outline: 3px solid var(--color-primary-dark);
    outline-offset: -3px;
}

.ng-actions,
.ng-sizes {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ng-btn,
.ng-size {
    padding: 0.55rem 1.15rem;
    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;
}

.ng-btn:hover,
.ng-size:hover { border-color: var(--color-primary-dark); }

.ng-btn.active,
.ng-size.active {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
}

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

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