#game-canvas-wrapper {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 18px auto 24px;
}

#game-canvas-area {
    --nono-hint-font: 14px;
    --nono-mark-font: 18px;
    position: relative;
    width: min(92vw, 540px);
    margin: 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    touch-action: manipulation;
}

#game-canvas-area.board-level-easy {
    --nono-hint-font: 21px;
    --nono-mark-font: 28px;
    width: min(70vw, 378px);
}

#game-canvas-area.board-level-medium {
    --nono-hint-font: 18px;
    --nono-mark-font: 24px;
    width: min(80vw, 432px);
}

#game-canvas-area.board-level-hard {
    --nono-hint-font: 15px;
    --nono-mark-font: 20px;
}

#game-canvas-area.board-level-expert {
    --nono-hint-font: 12px;
    --nono-mark-font: 17px;
}

.nonogram-shell {
    display: grid;
    gap: 2px;
    width: 100%;
    min-width: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.nono-corner,
.nono-hint,
.nono-cell {
    min-width: 0;
    min-height: 0;
}

.nono-corner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: clamp(8px, 2vw, 11px);
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
    text-transform: uppercase;
}

.nono-hint {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    overflow: visible;
    padding: 3px 6px 7px;
    border: 0;
    background: transparent;
    color: var(--pen-blue);
    font-family: "Comic Sans MS", "Trebuchet MS", cursive;
    font-size: var(--nono-hint-font);
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 1px 0 rgba(255, 252, 235, 0.48);
}

.nono-hint.hint-dense {
    gap: 2px;
}

.col-hint {
    flex-direction: column;
    align-items: center;
    justify-content: end;
    padding: 7px 4px 9px;
}

.col-hint.hint-dense {
    padding-top: 6px;
    padding-bottom: 7px;
}

.row-hint {
    flex-direction: row;
    align-items: center;
    justify-content: end;
    min-height: 0;
    padding: 3px 9px 4px 5px;
    white-space: nowrap;
}

.row-hint.hint-dense {
    padding-right: 7px;
    padding-left: 4px;
}

.hint-complete {
    opacity: 0.46;
    filter: saturate(0.7);
}

.nono-cell {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    isolation: isolate;
    display: grid;
    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    aspect-ratio: 1 / 1;
    background: transparent;
    color: var(--pen-blue);
    cursor: pointer;
    font-family: "Comic Sans MS", "Trebuchet MS", cursive;
    font-size: var(--nono-mark-font);
    font-weight: 900;
    line-height: 1;
    place-items: center;
    text-shadow: 0 1px 0 rgba(255, 252, 235, 0.48);
    transition: transform 0.12s ease;
}

.nono-cell:hover {
    transform: translateY(-1px);
}

.cell-filled {
    box-shadow: none;
}

.cell-marked {
    color: var(--pen-blue);
}

.cell-hinted::after {
    position: absolute;
    inset: 4px;
    z-index: 2;
    border: 2px solid rgba(245, 196, 46, 0.86);
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(255, 249, 199, 0.52);
    content: "";
    pointer-events: none;
}

.nonogram-tile-paper {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    transform: translate(var(--tile-shift-x, 0), var(--tile-shift-y, 0)) rotate(var(--tile-rotation, 0deg));
    transform-origin: 50% 50%;
}

.nono-hint span,
.nono-cell-mark {
    position: relative;
    z-index: 1;
}

.nono-hint span {
    display: block;
    max-width: 100%;
    min-width: 0;
}

.nono-hint .hint-double-digit {
    font-size: 0.78em;
    letter-spacing: 0;
}

.board-level-hard .nono-hint .hint-double-digit,
.board-level-expert .nono-hint .hint-double-digit {
    font-size: 0.72em;
}

.col-hint .hint-double-digit {
    line-height: 0.95;
}

.row-hint .hint-double-digit {
    min-width: 1.22em;
    text-align: center;
}

.nono-cell:focus-visible {
    outline: 3px solid rgba(52, 152, 219, 0.35);
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .controls-layer {
        --controls-grid-gap: 6px;
    }
}
