UNPKG

react-free-scratchcard

Version:

A customizable scratch card component for React with random rewards support

93 lines (82 loc) 1.73 kB
.scratch-container { position: relative; width: 100%; max-width: 350px; margin-left: auto; margin-right: auto; text-align: center; margin-top: 5rem; margin-bottom: 5rem; } .scratch-btn { position: absolute; top: -50px; left: 50%; transform: translateX(-50%); background: #bdaa7d; /* fixed */ color: white; border: none; padding: 12px 24px; border-radius: 30px; font-weight: bold; cursor: pointer; z-index: 10; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); transition: all 0.3s ease; } .scratch-btn:hover:not(:disabled) { background: #c69933; /* fixed */ transform: translateX(-50%) scale(1.05); } .scratch-btn:disabled { opacity: 0.8; } .scratch-btn.hidden { display: none; } .card-wrapper { position: relative; width: 100%; height: 340px; border-radius: 20px; overflow: hidden; background: linear-gradient(145deg, #ffffff, #f0f0f0); box-shadow: 0 16px 30px rgba(0, 0, 0, 0.2), inset 0 2px 6px rgba(255, 255, 255, 0.6), inset 0 -2px 6px rgba(0, 0, 0, 0.05); transition: all 0.3s ease; transform-style: rotateX(3deg) rotateY(-3deg) scale(1.02); perspective: 1000px; } .scratch-canvas, .prize-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; touch-action: none; } .prize-canvas { opacity: 0; transition: opacity 0.5s ease; } .prize-canvas.visible { opacity: 1; } .claim-btn { margin-top: 20px; background: #bdaa7d; /* fixed */ color: white; border: none; padding: 12px 24px; border-radius: 30px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); transition: all 0.3s ease; } .claim-btn:hover { background: #c69933; /* fixed */ transform: scale(1.05); }