/* Scratch card badge + overlay (js/scratchCard.js) */

/* Small ticket in the top corner: a new card is waiting. Opens the card on click. */
.sc-badge {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 8px 34px 9px 22px;
    border: 0;
    background: linear-gradient(to left, #ffd23f 0 22px, #ef3e5c 22px);
    color: #fff;
    font-family: Heebo, Assistant, Arial, sans-serif;
    direction: rtl;
    cursor: pointer;
    /* Notches on both sides, like a torn-off ticket */
    -webkit-mask: radial-gradient(circle 7px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
                  radial-gradient(circle 7px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
    mask: radial-gradient(circle 7px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
          radial-gradient(circle 7px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .14);
    transform: rotate(-4deg);
    animation: scBadgeIn .45s ease-out, scBadgeNudge 4s ease-in-out 1.5s infinite;
}

    .sc-badge::before {
        content: "";
        position: absolute;
        inset: 4px 12px 4px 30px;
        border: 1.5px dashed rgba(255, 255, 255, .6);
        border-radius: 3px;
        pointer-events: none;
    }

    .sc-badge::after {
        /* Star on the yellow stub */
        content: "°5";
        position: absolute;
        top: 50%;
        right: 4px;
        transform: translateY(-50%);
        color: #ef3e5c;
        font-size: 15px;
        line-height: 1;
    }

    .sc-badge:hover {
        background: linear-gradient(to left, #ffdc5e 0 22px, #f2556f 22px);
    }

    .sc-badge:focus-visible {
        outline: 3px solid #1d4ed8;
        outline-offset: 2px;
    }

.sc-badge-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}

.sc-badge-sub {
    font-size: .78rem;
    line-height: 1.1;
    color: #ffe9a8;
    white-space: nowrap;
}

@keyframes scBadgeIn {
    from { transform: translateY(-80px) rotate(-4deg); }
    to { transform: translateY(0) rotate(-4deg); }
}

@keyframes scBadgeNudge {
    0%, 86%, 100% { transform: rotate(-4deg); }
    90% { transform: rotate(3deg); }
    94% { transform: rotate(-7deg); }
}

/* Full-screen card */
.sc-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background-color: rgba(30, 64, 175, .93);
    background-image: radial-gradient(rgba(255, 255, 255, .12) 2px, transparent 2.5px);
    background-size: 24px 24px;
    opacity: 0;
    transition: opacity .25s ease;
    font-family: Heebo, Assistant, Arial, sans-serif;
    direction: rtl;
    overflow: hidden;
}

    .sc-overlay.is-visible {
        opacity: 1;
    }

.sc-confetti {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.sc-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    text-align: center;
    transform: translateY(24px);
    opacity: 0;
}

.sc-overlay.is-visible .sc-stage {
    animation: scRise .35s ease-out forwards;
}

@keyframes scRise {
    to { transform: translateY(0); opacity: 1; }
}

.sc-title {
    margin: 0;
    color: #ffd23f;
    font-size: clamp(1.4rem, 4.6vw, 2rem);
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 3px 0 #1e2a78;
}

.sc-sub {
    margin: 0 0 6px;
    color: #fff;
    font-size: clamp(.95rem, 3.4vw, 1.1rem);
}

/* The paper ticket around the scratch area */
.sc-ticket {
    position: relative;
    padding: 0 14px 14px;
    background: #ffd23f;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 0 #c99a00, 0 16px 34px rgba(0, 0, 0, .35);
    transform: rotate(-1.5deg);
}

    .sc-ticket::before,
    .sc-ticket::after {
        /* Punched holes on the sides */
        content: "";
        position: absolute;
        top: 22px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #2546b4;
        z-index: 1;
    }

    .sc-ticket::before { right: -8px; }
    .sc-ticket::after { left: -8px; }

    .sc-ticket.is-revealed {
        animation: scTicketPop .4s ease-out;
    }

@keyframes scTicketPop {
    0% { transform: rotate(-1.5deg); }
    50% { transform: rotate(1deg) scale(1.05); }
    100% { transform: rotate(-1.5deg); }
}

.sc-ticket-head {
    margin: 0 -14px 12px;
    padding: 10px 0 9px;
    border-bottom: 3px dashed #ffd23f;
    background: #ef3e5c;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.sc-card {
    position: relative;
    width: min(300px, calc(100vw - 76px));
    height: min(260px, calc(100vw - 96px));
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 0 0 4px #fff, 0 0 0 6px #ef3e5c;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.sc-prize {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    box-sizing: border-box;
}

.sc-prize-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62%;
    height: 58%;
}

.sc-prize-emoji {
    font-size: clamp(4rem, 20vw, 6rem);
    line-height: 1;
}

.sc-prize-img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    object-fit: contain;
}

.sc-prize-title {
    color: #1e3a8a;
    font-size: clamp(1.15rem, 4.4vw, 1.5rem);
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.sc-prize-bonus {
    color: #15803d;
    font-weight: 700;
    font-size: .95rem;
}

.sc-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    transition: opacity .5s ease;
}

    .sc-cover:active {
        cursor: grabbing;
    }

    .sc-cover.is-gone {
        opacity: 0;
        pointer-events: none;
    }

.sc-hint {
    margin: 4px 0 0;
    min-height: 1.4em;
    color: #fff;
    font-size: 1rem;
    transition: opacity .3s;
}

    .sc-hint.is-faded {
        opacity: 0;
    }

.sc-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.sc-reveal-btn {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .7);
    font: inherit;
    font-size: .9rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 6px 10px;
}

    .sc-reveal-btn:focus-visible,
    .sc-close-btn:focus-visible {
        outline: 3px solid #ffd23f;
        outline-offset: 3px;
    }

.sc-close-btn {
    display: none;
    border: 0;
    border-radius: 10px;
    padding: 11px 34px;
    background: #22c55e;
    color: #fff;
    font: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    box-shadow: 0 4px 0 #15803d;
    cursor: pointer;
}

    .sc-close-btn.is-shown {
        display: inline-block;
    }

    .sc-close-btn:active {
        transform: translateY(2px);
        box-shadow: 0 1px 0 #15803d;
    }

@media (prefers-reduced-motion: reduce) {
    .sc-badge { animation: none; }
    .sc-overlay.is-visible .sc-stage { animation: none; transform: none; opacity: 1; }
    .sc-ticket.is-revealed { animation: none; }
    .sc-ticket { transform: none; }
}
