:root {
    --primary-color: #ff4757;
    --secondary-color: #2f3542;
    --text-color: #ffffff;
    --bg-gradient: linear-gradient(to bottom, #ec8e2a 0%, #FDF15E 50%, #ec8e2a 100%);
}

html {
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

body {
    margin: 0;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.info-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

h1 {
    margin-bottom: 30px;
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

.logo {
    max-width: 400px;
    width: 60vw;
    height: auto;
    margin-bottom: 30px;
}

.wheel-container {
    position: relative;
    width: min(90vw, 600px);
    height: min(90vw, 600px);
    margin: 0;
    border: 10px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2), inset 0 0 30px rgba(0,0,0,0.5);
    overflow: visible;
}

/* .wheel-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgb(255, 255, 200) 0%, rgba(255, 202, 56, 0.761) 50%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
} */

.rays {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200%;
    height: 200%;
    object-fit: contain;
    z-index: -1;
    pointer-events: none;
    animation: spin-rays 60s linear infinite;
}

@keyframes spin-rays {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.15, 0, 0.15, 1);
}

/* CSS Wheel Rendering */
#wheel-css {
    background: conic-gradient(
        #f1c40f 0deg 60deg,
        #e67e22 60deg 120deg,
        #e74c3c 120deg 180deg,
        #9b59b6 180deg 240deg,
        #3498db 240deg 300deg,
        #2ecc71 300deg 360deg
    );
    border: 5px solid #fff;
}

.segment {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    /* Rotate the label to the middle of the slice (30deg offset for 60deg slices) */
    transform: rotate(calc(var(--i) * 60deg + 30deg));
}

.segment span {
    display: inline-block;
    margin-top: 40px;
    font-weight: bold;
    font-size: 1.8rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    /* No longer need to counter skew */
}

.arrow {
    position: absolute;
    top: 47%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: auto;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}

/* Center Hub */
/* .wheel-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: #fff;
    border-radius: 50%;
    z-index: 11;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    pointer-events: none;
} */

#spin-btn {
    padding: 20px 40px;
    font-size: 1.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(to bottom, #ffe680 0%, #ffcc33 20%, #ff9900 50%, #ff8800 80%, #ffaa33 100%);
    border: 4px solid #e08000;
    border-radius: 60px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: none;
    position: relative;
    margin-top: 40px;
    animation: pulse 1.5s ease-in-out infinite;
}

#spin-btn::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 5%;
    right: 5%;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 50px;
    pointer-events: none;
}

#spin-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(to bottom, #ffee99 0%, #ffdd44 20%, #ffaa00 50%, #ff9900 80%, #ffbb44 100%);
}

#spin-btn:disabled {
    background: linear-gradient(to bottom, #ccc 0%, #aaa 50%, #999 100%);
    border-color: #888;
    color: #555;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 153, 0, 0.6);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px 10px rgba(255, 153, 0, 0);
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    justify-content: center;
    align-items: center;
    transition: background-color 0.4s ease, backdrop-filter 0.4s ease;
}

.modal.show {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(to bottom, #fff8e1, #ffe082);
    padding: 50px 40px;
    border: 4px solid #e08000;
    border-radius: 30px;
    width: 320px;
    max-width: 80vw;
    text-align: center;
    box-shadow: 
        0 0 0 8px #fff,
        0 0 40px rgba(255, 152, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
    transform: scale(0.5) translateY(40px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, transparent 100%);
    border-radius: 30px;
    pointer-events: none;
}

#winner-text {
    color: #333;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    margin: 0 0 25px 0;
    position: relative;
}

#close-modal {
    margin-top: 10px;
    padding: 14px 40px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(to bottom, #ffe680 0%, #ffcc33 20%, #ff9900 50%, #ff8800 80%, #ffaa33 100%);
    border: 3px solid #e08000;
    border-radius: 50px;
    color: #000;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}

#close-modal:hover {
    transform: scale(1.05);
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}

/* Login Screen */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    background: var(--bg-gradient);
}

.login-container {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 50px 40px;
    width: 380px;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    max-width: 200px;
    width: 50vw;
    height: auto;
    margin-bottom: 20px;
}

.login-title {
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 30px;
    font-weight: 600;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus {
    border-color: #ffcc33;
}

.login-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    min-height: 20px;
    text-align: center;
}

.login-btn {
    padding: 16px 32px;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(to bottom, #ffe680 0%, #ffcc33 20%, #ff9900 50%, #ff8800 80%, #ffaa33 100%);
    border: 3px solid #e08000;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.login-btn:hover {
    transform: scale(1.03);
    background: linear-gradient(to bottom, #ffee99 0%, #ffdd44 20%, #ffaa00 50%, #ff9900 80%, #ffbb44 100%);
}

.login-btn:disabled {
    background: linear-gradient(to bottom, #ccc 0%, #aaa 50%, #999 100%);
    border-color: #888;
    color: #555;
    cursor: not-allowed;
    transform: none;
}

/* Device Badge */
.device-badge {
    position: fixed;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 50;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-btn {
    background: rgba(255, 71, 87, 0.8);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 71, 87, 1);
}

.fullscreen-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Landscape layout for tablets */
@media (orientation: landscape) {
    body {
        padding: 70px;
        overflow: auto;
    }

    .container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
        align-items: center;
        justify-items: center;
        gap: 40px;
        width: 100%;
    }

    .wheel-container {
        grid-column: 1;
        grid-row: 1 / 3;
        width: min(60vh, 500px);
        height: min(60vh, 500px);
        margin: 0;
    }

    .info-panel {
        grid-column: 2;
        grid-row: 1;
        align-self: end;
        margin-bottom: 0;
    }

    #spin-btn {
        grid-column: 2;
        grid-row: 2;
        align-self: start;
        margin-top: 20px;
    }

    .logo {
        margin-bottom: 40px;
    }
}
