/* Scratch card: nine foil panels and the key of three-of-a-kind multiples. */

.dgs-scratch-wrap {
    --scratch-paper: linear-gradient(160deg, #ff7aa8 0%, #d0103a 55%, #7b2ff7 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(14px, 3vw, 28px);
    align-items: start;
    width: 100%;
    padding: clamp(8px, 2vw, 20px) 0;
}

.dgs-scratch-wrap--lemon {
    --scratch-paper: linear-gradient(160deg, #7be8c6 0%, #16a99c 55%, #1667c9 100%);
}

@media (min-width: 700px) {
    .dgs-scratch-wrap {
        grid-template-columns: minmax(0, 1.25fr) minmax(220px, 1fr);
        align-items: center;
    }
}

.dgs-scratch-card {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(6px, 1.6vw, 12px);
    width: min(100%, 460px);
    justify-self: center;
    padding: clamp(10px, 2.6vw, 18px);
    border-radius: var(--dgs-radius, 18px);
    background: var(--scratch-paper);
    box-shadow: 0 16px 30px rgba(10, 2, 24, .5), inset 0 2px 0 rgba(255, 255, 255, .35);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.dgs-scratch-cell {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 35%, #fffaf2 0%, #ffe9d1 100%);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6);
}

.dgs-scratch-face {
    position: absolute;
    inset: 12%;
    display: grid;
    place-items: center;
}

.dgs-scratch-sym {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 3px 2px rgba(30, 11, 51, .25));
}

.dgs-scratch-foil {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    transition: opacity 260ms ease-out;
}

.dgs-scratch-cell.is-open .dgs-scratch-foil {
    opacity: 0;
    pointer-events: none;
}

.dgs-scratch-cell.is-open .dgs-scratch-sym {
    animation: dgs-scratch-pop 240ms ease-out;
}

.dgs-scratch-cell.is-match {
    box-shadow: inset 0 0 0 3px var(--dgs-lime, #7cc520), 0 0 0 3px rgba(255, 255, 255, .85);
}

.dgs-scratch-cell.is-match .dgs-scratch-sym {
    transform: scale(1.08);
    transition: transform 240ms ease-out;
}

@keyframes dgs-scratch-pop {
    from { transform: scale(.95); opacity: .4; }
    to { transform: scale(1); opacity: 1; }
}

.dgs-scratch-side {
    display: grid;
    gap: 10px;
    justify-items: stretch;
    width: min(100%, 460px);
    justify-self: center;
    color: var(--dgs-on-night, #fff4e6);
}

.dgs-scratch-keytitle {
    margin: 0;
    font: 800 clamp(16px, 2.2vw, 19px)/1.2 var(--dgs-display, system-ui, sans-serif);
}

.dgs-scratch-key {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font: 500 15px/1.35 var(--dgs-body, system-ui, sans-serif);
}

.dgs-scratch-key li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px 5px 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .07);
}

.dgs-scratch-key b {
    color: var(--dgs-sun, #ff8a00);
    font-weight: 800;
}

.dgs-scratch-keyicon {
    flex: none;
    width: 30px;
    height: 30px;
    padding: 3px;
    border-radius: 9px;
    background: #fff4e6;
}

.dgs-scratch-reveal {
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid rgba(255, 244, 230, .7);
    border-radius: 999px;
    background: transparent;
    color: var(--dgs-on-night, #fff4e6);
    font: 700 15px/1 var(--dgs-body, system-ui, sans-serif);
    cursor: pointer;
    transition: transform 160ms ease-out, background-color 160ms ease-out;
}

.dgs-scratch-reveal:hover:not(:disabled) {
    background: rgba(255, 244, 230, .12);
}

.dgs-scratch-reveal:active:not(:disabled) {
    transform: scale(.97);
}

.dgs-scratch-reveal:focus-visible {
    outline: 3px solid var(--dgs-sun, #ff8a00);
    outline-offset: 2px;
}

.dgs-scratch-reveal:disabled {
    opacity: .4;
    cursor: default;
}

.dgs-scratch-wrap.is-up .dgs-scratch-card {
    animation: dgs-scratch-nod 420ms ease-out;
}

@keyframes dgs-scratch-nod {
    40% { transform: scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
    .dgs-scratch-foil,
    .dgs-scratch-cell.is-match .dgs-scratch-sym { transition: none; }
    .dgs-scratch-cell.is-open .dgs-scratch-sym,
    .dgs-scratch-wrap.is-up .dgs-scratch-card { animation: none; }
}
