.scratch-page.show {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
        max(72px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: rgba(8, 15, 43, 0.4);
}

.scratch-card {
    width: min(100%, 410px);
    margin: auto;
    padding: clamp(16px, 5vw, 28px);
    color: #f1f5ff;
    background: rgba(18, 31, 71, 0.94);
    border-color: rgba(177, 203, 255, 0.36);
    box-shadow: 0 22px 60px rgba(6, 11, 36, 0.4);
}

.scratch-date {
    margin-bottom: 16px;
}

.scratch-date,
.scratch-hint,
.scratch-back {
    color: #bfcae7;
}

.scratch-area {
    isolation: isolate;
    width: 100%;
    height: auto;
    aspect-ratio: 20 / 11;
    border: 1px solid rgba(190, 209, 255, 0.35);
    background: #191937;
}

.scratch-area canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#scratch-canvas {
    z-index: 2;
    touch-action: none;
    cursor: crosshair;
    outline-offset: -3px;
}

#scratch-particles {
    z-index: 3;
    pointer-events: none;
}

.scratch-reveal {
    position: absolute;
    inset: 0;
    gap: 5px;
    padding: 10px 12px;
    background: radial-gradient(ellipse at 50% 5%, #44316c, #201d43 65%, #171c3a);
}

.scratch-fortune,
.scratch-desc {
    margin-bottom: 0;
}

.scratch-quote {
    color: #d7dbf3;
    font-size: 13px;
}

.scratch-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.scratch-actions button {
    min-height: 44px;
    margin: 0;
    padding: 0 13px;
    border: 1px solid rgba(188, 212, 255, 0.28);
    border-radius: 10px;
    color: #eff4ff;
    background: rgba(128, 165, 245, 0.14);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.scratch-actions button:hover {
    background: rgba(128, 165, 245, 0.28);
}

.scratch-back {
    display: inline-grid;
    place-items: center;
    min-height: 44px;
    margin-top: 3px;
}

.scratch-area.is-revealed #scratch-canvas {
    pointer-events: none;
    animation: scratch-cover-lift 480ms ease-out both;
}

.scratch-area.is-revealed .scratch-reveal {
    animation: scratch-fortune-glow 680ms ease-out both;
}

@keyframes scratch-cover-lift {
    to { opacity: 0; transform: translateY(-8%) scale(1.06); visibility: hidden; }
}

@keyframes scratch-fortune-glow {
    33% { filter: brightness(1.35); }
}

@media (prefers-reduced-motion: reduce) {
    .scratch-area.is-revealed #scratch-canvas {
        animation: none;
        visibility: hidden;
    }

    .scratch-area.is-revealed .scratch-reveal {
        animation: none;
    }
}
