:root {
    --font-heading: 'Cinzel Decorative', serif;
    --font-body: 'Lato', sans-serif;
    --color-text: #e0e7ff;
    --color-heading: #ffffff;
    --color-primary: #a78bfa;
    --color-secondary: #f472b6;
    --color-bg-dark: #1e1b4b;
    --color-bg-light: #312e81;
    --shadow-color: rgba(167, 139, 250, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg-dark);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://offertabs.s3.amazonaws.com/offer/x2qpcq/69bebbd89d65c0.46762208.jpg');
    background-size: cover;
    background-position: center;
    filter: blur(8px) brightness(0.6);
    transform: scale(1.1);
    z-index: -2;
}

@keyframes sparkle {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

.sparkles {
    position: fixed;
    top: 100vh;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.sparkles::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 
        10vw 0 2px 0px #fff, 25vw -10vh 3px 1px #fff, 40vw 20vh 2px 0px #fff,
        55vw -20vh 3px 1px #fff, 70vw 10vh 2px 1px #fff, 85vw -30vh 3px 0px #fff,
        95vw 5vh 2px 1px #fff, 5vw 30vh 3px 1px #fff;
    animation: sparkle 20s linear infinite;
}

.container {
    max-width: 500px;
    width: 100%;
    padding: 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.main-header {
    margin-bottom: 2rem;
}

.title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-heading);
    letter-spacing: 2px;
    text-shadow: 0 0 15px var(--shadow-color);
}

.subtitle {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-top: -0.5rem;
    font-weight: 400;
    text-shadow: 0 0 10px var(--shadow-color);
}

.card {
    background: rgba(22, 19, 66, 0.4);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(17, 15, 48, 0.37);
    transition: all 0.3s ease;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--color-heading);
    margin-bottom: 0.75rem;
}

.card-description {
    color: var(--color-text);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text);
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--color-heading);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--shadow-color);
}

.form-group input::placeholder {
    color: rgba(224, 231, 255, 0.5);
}

.cta-button {
    width: 100%;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 20px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 30px var(--shadow-color);
}

.cta-button:disabled {
    background: #555;
    cursor: not-allowed;
    box-shadow: none;
}

.button-loader {
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s ease-in-out infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    color: #fca5a5;
    background-color: rgba(159, 18, 57, 0.3);
    border: 1px solid rgba(220, 38, 38, 0.5);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.scratch-card-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 1rem auto;
    border-radius: 50%;
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

#scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    touch-action: none;
}

.prize-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-heading);
    background: var(--color-bg-light);
    border-radius: 50%;
    padding: 2rem;
    z-index: 1;
}

.prize-details {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.prize-image {
    max-width: 150px;
    border-radius: 10px;
}

.prize-code-wrapper {
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 8px;
    width: 100%;
}

.prize-code-wrapper p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.code-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.code-box span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-heading);
    letter-spacing: 2px;
}

#copy-code-button {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

#copy-code-button:hover {
    background: rgba(255,255,255,0.1);
}

.prize-qr-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

#prize-qr-code {
    width: 180px;
    height: 180px;
    background: white;
    padding: 10px;
    border-radius: 8px;
}

.cta-button-secondary {
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    background: transparent;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.3s;
}
.cta-button-secondary:hover {
    background: var(--color-primary);
    color: white;
}

.expiration-text {
    font-style: italic;
    font-size: 0.9rem;
    opacity: 0.8;
}

.share-panel {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.share-title {
    font-family: var(--font-heading);
    color: var(--color-primary);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.share-description {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.share-url-wrapper {
    display: flex;
}

.share-url-wrapper input {
    flex-grow: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--color-text);
    padding: 0.6rem;
    font-size: 0.9rem;
}

.share-url-wrapper input:focus {
    outline: none;
}

#copy-link-button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background: var(--color-primary);
    border: none;
    color: white;
    padding: 0 1rem;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.2s;
}

#copy-link-button:hover {
    background: #c084fc;
}

.hidden {
    display: none !important;
}

#wbx-powered-by-slot {
    margin-top: 2rem;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    .title {
        font-size: 2rem;
    }
    .subtitle {
        font-size: 1.2rem;
    }
    .card {
        padding: 1.5rem;
    }
}
