:root {
    --primary-blue: #0A0F2C;
    --accent-green: #10B981;
    --white: #FFFFFF;
    --gold: #FFD700;
}

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

body {
    background-color: var(--primary-blue);
    color: var(--white);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.background-stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1E293B 0%, #0A0F2C 100%);
    z-index: -1;
}

.background-stars::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    box-shadow: 
        10vw 20vh 1px #fff,
        30vw 10vh 2px #fff,
        50vw 40vh 1px #fff,
        70vw 20vh 1px #fff,
        90vw 80vh 2px #fff,
        20vw 70vh 1px #fff,
        40vw 90vh 1px #fff,
        60vw 60vh 2px #fff,
        80vw 30vh 1px #fff,
        15vw 45vh 1px #fff,
        85vw 15vh 1px #fff;
    opacity: 0.5;
    animation: twinkle 5s infinite alternate;
}

@keyframes twinkle {
    from { opacity: 0.3; }
    to { opacity: 0.8; }
}

.container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 500px;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    margin-bottom: 0.5rem;
}

.attempts-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    color: #10B981;
}

.attempts-badge span {
    color: #fff;
}

.wheel-outer-container {
    position: relative;
    width: 320px;
    height: 320px;
}

.pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 50px;
    background: #FFD700;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    z-index: 20;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.wheel-rim {
    position: absolute;
    inset: -15px;
    border-radius: 50%;
    border: 8px solid #2D3748;
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 10px rgba(255,255,255,0.1);
    z-index: 5;
}

.light {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    left: 50%;
    top: 5px;
    transform-origin: 50% 165px;
    transform: translateX(-50%) rotate(calc(var(--i) * 30deg));
    box-shadow: 0 0 8px #fff, 0 0 15px #FFD700;
    animation: blink 1s infinite alternate calc(var(--i) * 0.1s);
}

@keyframes blink {
    from { opacity: 0.3; transform: translateX(-50%) rotate(calc(var(--i) * 30deg)) scale(0.8); }
    to { opacity: 1; transform: translateX(-50%) rotate(calc(var(--i) * 30deg)) scale(1.1); }
}

.wheel {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transition: transform 5s cubic-bezier(0.15, 0, 0.15, 1);
    background: #000;
    overflow: hidden;
}

.segment {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: var(--bg);
    transform: rotate(var(--r));
    /* Segmento exacto de 45 grados para rellenar la ruleta completa de 8 piezas (360/8) */
    clip-path: polygon(50% 50%, 50% 0%, 100% 0%);
}

.content {
    position: absolute;
    top: 0;
    left: 50%;
    height: 50%;
    width: 100px;
    margin-left: -50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 15px;
    transform-origin: 50% 100%;
    transform: rotate(22.5deg); /* Center content in the 45 deg slice */
}

.content span {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    white-space: nowrap;
    text-transform: uppercase;
    line-height: 1;
}

.content img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
    transition: transform 0.3s;
    margin-top: 5px;
}

.content:hover img {
    transform: scale(1.1);
}

.d-logo {
    font-size: 1.5rem;
    font-family: 'Outfit';
    font-weight: bold;
    font-style: italic;
    color: #fff;
    text-shadow: 0 0 10px #10B981;
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: #2D3748;
    border-radius: 50%;
    border: 4px solid #4A5568;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

.center-logo {
    font-size: 1.8rem;
    font-weight: 900;
    font-style: italic;
    color: #10B981;
}

#spin-btn {
    padding: 1rem 3rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3), inset 0 -4px 0 rgba(0,0,0,0.1);
    transition: all 0.2s;
}

#spin-btn:hover {
    transform: translateY(-2px);
    background: #059669;
    box-shadow: 0 15px 25px rgba(16, 185, 129, 0.4);
}

#spin-btn:active {
    transform: translateY(2px);
    box-shadow: 0 5px 10px rgba(16, 185, 129, 0.2);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #1E293B;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    border: 2px solid #10B981;
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.3);
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #10B981;
}

.modal-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.modal-content button {
    padding: 0.8rem 2rem;
    background: #10B981;
    border: none;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}
