.page-scratch {
    --night: #11170f;
    --muted: #f3e8d2;
}

.page-scratch .site-header {
    border-bottom-color: #b49a6b4d;
    background: #12190ff5;
}

.page-scratch .site-footer {
    background: linear-gradient(0deg, #10160fdb, transparent);
    color: var(--muted);
}

.scratch-stage { padding-block: clamp(.85rem, 3.1svh, 2.8rem) .75rem; }

.scratch-shell {
    --scratch-art-ratio: calc(940 / 1674);
    --scratch-art-height: clamp(9rem, min(54svh, calc(100svh - 20rem)), 40rem);
    display: grid;
    width: min(100%, 54rem);
    justify-items: center;
    gap: clamp(.45rem, 1.35svh, .95rem);
    text-shadow: 0 2px 12px #0d130c, 0 1px 3px #0d130c;
}

.scratch-shell .hero-heading { margin: 0; }
.scratch-shell .hero-heading > p { max-width: 42rem; }

.digit-options {
    display: flex;
    min-inline-size: 0;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(.875rem, 2.3vw, 1.5rem);
    margin: clamp(.375rem, 1.05svh, .875rem) 0 clamp(.375rem, 1.2svh, 1rem);
    padding: 0;
    border: 0;
}

.digit-options label { position: relative; }

.digit-options input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.digit-options label > span {
    display: grid;
    min-width: clamp(5rem, 16vw, 6.75rem);
    min-height: 48px;
    place-items: center;
    padding-inline: .65rem;
    border: 1px solid #d1a57991;
    border-radius: 99px;
    background: #252b1ff5;
    color: var(--ink);
    cursor: pointer;
    text-shadow: none;
}

.digit-options input:checked + span {
    border-color: #f6c782;
    background: #f6dba9;
    color: #2b2417;
    font-weight: 750;
}

.digit-options input:focus-visible + span {
    outline: 2px solid #ffdb9b;
    outline-offset: 3px;
}

.scratch-control {
    position: relative;
    isolation: isolate;
    container-type: inline-size;
    inline-size: min(100%, calc(var(--scratch-art-height) * var(--scratch-art-ratio)));
    aspect-ratio: var(--scratch-art-ratio);
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: .85rem;
    background: #29291a;
    box-shadow: 0 15px 48px #0c1309b3, 0 0 0 1px #d1ac706e;
    user-select: none;
    -webkit-touch-callout: none;
}

.scratch-control:not(:disabled) {
    cursor: crosshair;
    touch-action: none;
}

.scratch-artwork,
.scratch-control canvas {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    pointer-events: none;
}

.scratch-control:not(:disabled) .scratch-artwork {
    filter: brightness(.72) saturate(.8);
}

.scratch-control canvas { z-index: 2; }

.scratch-number {
    position: absolute;
    z-index: 1;
    inset-block-start: 40%;
    inset-inline-start: 50%;
    translate: -50% -50%;
    padding-inline-start: .08em;
    color: #fff0cc;
    font: 700 clamp(1.5rem, 5vw, 4.25rem)/1 Georgia, serif;
    font-size: 17.5cqw;
    font-variant-numeric: lining-nums tabular-nums;
    letter-spacing: .08em;
    text-shadow: 0 2px 5px #1c0a09, 0 0 10px #17100bd9;
    pointer-events: none;
}

.scratch-control:disabled .scratch-number { visibility: hidden; }

.scratch-actions {
    display: grid;
    min-block-size: 5rem;
    align-content: start;
    justify-items: center;
}

.scratch-status:not(:empty) { margin-block: .35rem; }
.scratch-actions .outline-button {
    min-height: 44px;
    background: #22291e;
}

.scratch-actions .outline-button:hover { background: #393b28; }

@media (min-width: 621px) and (max-height: 840px) {
    .scratch-stage { padding-block-start: .9rem; }

    .scratch-shell {
        --scratch-art-height: clamp(9rem, min(49svh, calc(100svh - 23.1rem)), 40rem);
        gap: clamp(.45rem, 1svh, .75rem);
    }
}

@media (max-width: 620px) {
    .scratch-shell { --scratch-art-height: clamp(9rem, min(50svh, calc(100svh - 21.5rem)), 34rem); }
}

@media (max-height: 680px) {
    .digit-options label > span { min-height: 44px; }
}

@media (max-height: 480px) and (orientation: landscape) {
    .scratch-stage { padding-block: .35rem; }
    .scratch-shell { --scratch-art-height: clamp(8rem, calc(100svh - 15.5rem), 16rem); }
    .scratch-shell h1 { font-size: clamp(1.8rem, 6.8svh, 2.55rem); }
    .scratch-shell .hero-heading > p { margin-block-start: .25rem; }
}
