/* ==========================================================================
   Smooth Canvas Acceleration & Scratch Card UI (60 FPS Hardware-Accelerated)
   ========================================================================== */

/* GPU Compositing & Hardware Acceleration Layer */
.scratch-card-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 340px;
    margin: 12px auto;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(40, 116, 240, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    border: 1px solid #e5edff;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
}

.scratch-card-header {
    background: linear-gradient(135deg, #2874f0 0%, #0052cc 100%);
    color: #ffffff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.scratch-card-header .badge-coin {
    background: #ffe11b;
    color: #333333;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.scratch-card-body {
    position: relative;
    width: 100%;
    height: 170px;
    background: #fdfdfd;
    overflow: hidden;
    border-radius: 0 0 14px 14px;
}

/* Underlying Prize Content */
.scratch-prize {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px;
    text-align: center;
    background: radial-gradient(circle at center, #ffffff 0%, #f0f7ff 100%);
    z-index: 1;
}

.scratch-prize-icon {
    font-size: 32px;
    margin-bottom: 4px;
    animation: popBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scratch-prize-title {
    font-size: 17px;
    font-weight: 800;
    color: #1a73e8;
    margin: 0;
    line-height: 1.2;
}

.scratch-prize-desc {
    font-size: 12px;
    color: #555555;
    margin: 4px 0 8px;
}

.scratch-coupon-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eef5ff;
    border: 1.5px dashed #2874f0;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scratch-coupon-box:active {
    transform: scale(0.96);
}

.scratch-coupon-code {
    font-size: 13px;
    font-weight: 800;
    color: #2874f0;
    letter-spacing: 1px;
}

.scratch-coupon-copy {
    font-size: 10px;
    background: #2874f0;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Scratch Overlay Canvas (Ultra-Fast 60FPS Hardware Accelerated) */
.scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.scratch-canvas:active {
    cursor: grabbing;
}

.scratch-canvas.revealed {
    opacity: 0;
    pointer-events: none;
}

/* Hint / Pulse Animation on Canvas */
.scratch-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.scratch-hint.hidden {
    opacity: 0;
}

/* Shimmer Light Reflection Effect */
.scratch-shimmer {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        60deg,
        rgba(255, 255, 255, 0) 20%,
        rgba(255, 255, 255, 0.35) 25%,
        rgba(255, 255, 255, 0) 30%
    );
    transform: rotate(25deg);
    animation: shimmerMove 3.5s infinite linear;
    pointer-events: none;
    z-index: 4;
}

@keyframes shimmerMove {
    0% { transform: translateX(-100%) rotate(25deg); }
    100% { transform: translateX(100%) rotate(25deg); }
}

@keyframes popBounce {
    0% { transform: scale(0.3); opacity: 0; }
    60% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); }
}

/* Fullscreen Celebratory Confetti Canvas */
.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99999;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

/* Floating Reward Trigger Widget (Product / Home Page) */
.scratch-floating-banner {
    background: linear-gradient(135deg, #fff7d6 0%, #fff 100%);
    border: 1.5px solid #ffd54f;
    border-radius: 10px;
    padding: 10px 14px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 3px 10px rgba(255, 179, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.scratch-floating-banner:active {
    transform: scale(0.98);
}

.scratch-floating-banner .banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.scratch-floating-banner .banner-icon {
    font-size: 26px;
    animation: wiggleIcon 2s infinite ease-in-out;
}

.scratch-floating-banner .banner-title {
    font-size: 13px;
    font-weight: 700;
    color: #d97706;
    margin: 0;
    line-height: 1.2;
}

.scratch-floating-banner .banner-sub {
    font-size: 11px;
    color: #666;
    margin: 0;
}

.scratch-floating-banner .banner-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
    cursor: pointer;
    white-space: nowrap;
}

@keyframes wiggleIcon {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg) scale(1.08); }
    75% { transform: rotate(10deg) scale(1.08); }
}

/* Modal Popup Styles for Scratch Card */
.scratch-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 16px;
}

.scratch-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.scratch-modal-content {
    background: transparent;
    max-width: 360px;
    width: 100%;
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.scratch-modal-backdrop.open .scratch-modal-content {
    transform: scale(1);
}

.scratch-modal-close {
    position: absolute;
    top: -14px;
    right: 2px;
    background: #ffffff;
    color: #333333;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    z-index: 10;
}
