:root {
    --brand-yellow: #FAC515;
    --brand-yellow-glow: rgba(250, 197, 21, 0.4);
    --bg-dark: #0a0a0f;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(16px);
    --text-primary: #ffffff;
    --text-muted: #a0a0ab;
    --gradient-gold: linear-gradient(135deg, #FFDF73 0%, #FAC515 50%, #D49D00 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    background-image:
        radial-gradient(circle at 50% 0%, #201f30 0%, transparent 50%),
        radial-gradient(circle at 50% 100%, #1a1924 0%, transparent 50%);
}

.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--brand-yellow-glow) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    opacity: 0.3;
    animation: pulse-glow 6s infinite alternate;
}

@keyframes pulse-glow {
    0% {
        opacity: 0.2;
        transform: translate(-50%, -50%) scale(0.9);
    }

    100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 1rem;
}

.brand-logo {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    filter: drop-shadow(0 4px 12px rgba(250, 197, 21, 0.2));
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.game-board {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-header {
    text-align: center;
}

.pulsate-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    animation: text-pop 2s infinite ease-in-out;
}

@keyframes text-pop {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        color: var(--brand-yellow);
    }
}

.game-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Progress bar */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.progress-container span {
    font-size: 0.9rem;
    color: var(--brand-yellow);
    font-weight: 600;
}

.progress-bar {
    width: 60%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-gold);
    border-radius: 6px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--brand-yellow);
}

/* 3x3 Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    perspective: 1000px;
}

.scratch-card {
    aspect-ratio: 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.scratch-card.flipped {
    transform: rotateY(180deg);
    pointer-events: none;
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.card-front {
    background: linear-gradient(135deg, #2a2a35 0%, #1a1a24 100%);
    border: 1px solid var(--card-border);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.05);
    color: var(--brand-yellow);
}

.card-front::after {
    content: '?';
    font-size: 2.5rem;
    font-weight: 800;
    opacity: 0.7;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.scratch-card:hover .card-front::after {
    transform: scale(1.1);
    opacity: 1;
    color: #fff;
}

.scratch-card:hover .card-front {
    border-color: rgba(250, 197, 21, 0.5);
    box-shadow: 0 0 15px rgba(250, 197, 21, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.1);
}

.card-back {
    background: linear-gradient(135deg, rgba(250, 197, 21, 0.2) 0%, rgba(200, 150, 0, 0.1) 100%);
    border: 1px solid var(--brand-yellow);
    transform: rotateY(180deg);
    flex-direction: column;
    box-shadow: 0 0 20px rgba(250, 197, 21, 0.2);
}

.win-amount {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--brand-yellow);
    text-shadow: 0 2px 10px rgba(250, 197, 21, 0.5);
}

.win-text {
    font-size: 0.7rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

/* Modal styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(180deg, #1f1f2e 0%, #12121c 100%);
    border: 1px solid rgba(250, 197, 21, 0.3);
    border-radius: 32px;
    padding: 3rem;
    text-align: center;
    max-width: 90%;
    width: 480px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px inset rgba(255, 255, 255, 0.05);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg at 50% 50%, transparent 0%, rgba(250, 197, 21, 0.1) 50%, transparent 100%);
    animation: rotate-lights 10s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes rotate-lights {
    100% {
        transform: rotate(360deg);
    }
}

.modal-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 40%;
    background: radial-gradient(ellipse, rgba(250, 197, 21, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.badge {
    position: relative;
    z-index: 1;
    background: rgba(250, 197, 21, 0.15);
    color: var(--brand-yellow);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    display: inline-block;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(250, 197, 21, 0.3);
}

.modal-title {
    position: relative;
    z-index: 1;
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.modal-text {
    position: relative;
    z-index: 1;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.prize-amount {
    position: relative;
    z-index: 1;
    font-size: 4.5rem;
    font-weight: 900;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
    margin: 0.5rem 0;
    filter: drop-shadow(0 10px 20px rgba(250, 197, 21, 0.3));
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.modal-subtext {
    position: relative;
    z-index: 1;
    color: var(--brand-yellow);
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2rem;
}

.cta-button {
    position: relative;
    z-index: 1;
    background: var(--brand-yellow);
    color: #000;
    border: none;
    padding: 1.2rem 2.5rem;
    border-radius: 100px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(250, 197, 21, 0.3);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(250, 197, 21, 0.4);
}

.cta-button:active {
    transform: translateY(1px);
    box-shadow: 0 5px 10px rgba(250, 197, 21, 0.3);
}

.cta-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.cta-button:hover .cta-icon {
    transform: translateX(5px);
}

.cta-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8), transparent);
    transform: skewX(-20deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

.terms {
    position: relative;
    z-index: 1;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Distinct Try Again Styles */
.try-again-content {
    background: linear-gradient(180deg, #2a1b1b 0%, #170e0e 100%);
    border: 1px solid rgba(255, 107, 107, 0.3);
    box-shadow: 0 32px 64px rgba(201, 42, 42, 0.15), 0 0 0 1px inset rgba(255, 107, 107, 0.1);
    transform: scale(0.9) translateY(-20px);
    border-radius: 24px;
    padding: 2.5rem;
    width: 440px;
}

.try-again-content::before {
    display: none; /* No rotating light ray */
}

.try-again-icon {
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 10px rgba(255, 107, 107, 0.3));
}

.try-button {
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(201, 42, 42, 0.3);
    border: 1px solid rgba(255, 107, 107, 0.4);
}

.try-button:hover {
    box-shadow: 0 15px 30px rgba(201, 42, 42, 0.5);
    transform: translateY(-3px);
}

.try-button:active {
    box-shadow: 0 5px 10px rgba(201, 42, 42, 0.3);
}

.try-again-box {
    background: rgba(255, 107, 107, 0.1);
    border: 1px dashed rgba(255, 107, 107, 0.3);
    padding: 1rem;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.attempts-left {
    color: #ff6b6b;
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    .grid {
        gap: 0.5rem;
    }

    .modal-content {
        padding: 2rem;
        border-radius: 24px;
    }

    .prize-amount {
        font-size: 3.5rem;
    }

    .modal-title {
        font-size: 1.8rem;
    }

    .cta-button {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
}