/* =============================================
   Wheel of Fortune - Public Frontend Styles
   Premium Game UI Edition
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg-gradient-start: #0a0a1a;
    --bg-gradient-mid: #111133;
    --bg-gradient-end: #0d0d24;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-white: #ffffff;
    --text-light: #c8c8e0;
    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, 0.4);
    --gradient-1: linear-gradient(135deg, #6c63ff, #a855f7);
    --gradient-2: linear-gradient(135deg, #00c896, #6ee7b7);
    --gradient-3: linear-gradient(135deg, #f97316, #fbbf24);
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Animated Background Orbs ---- */
.bg-orbs {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-orbs .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: floatOrb 15s ease-in-out infinite;
}

.bg-orbs .orb:nth-child(1) {
    width: 400px;
    height: 400px;
    background: #6c63ff;
    top: -10%;
    left: -5%;
    animation-delay: 0s;
}

.bg-orbs .orb:nth-child(2) {
    width: 300px;
    height: 300px;
    background: #a855f7;
    top: 60%;
    right: -10%;
    animation-delay: -5s;
}

.bg-orbs .orb:nth-child(3) {
    width: 350px;
    height: 350px;
    background: #00c896;
    bottom: -15%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes floatOrb {

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

    33% {
        transform: translate(30px, -40px) scale(1.05);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.95);
    }
}

/* ---- Screens ---- */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

/* ---- Landing Page ---- */
#landing-screen {
    cursor: pointer;
}

.logo-container {
    text-align: center;
    animation: logoFloat 4s ease-in-out infinite;
}

.logo-container img {
    width: 40vw;
    max-width: 600px;
    min-width: 260px;
    height: auto;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.6));
    margin-bottom: 32px;
    transition: transform 0.3s ease;
}

.logo-container img:hover {
    transform: scale(1.05);
}

.logo-container h1 {
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.logo-container p {
    font-size: 16px;
    color: var(--text-light);
    font-weight: 300;
    opacity: 0.8;
}

.tap-hint {
    position: absolute;
    bottom: 60px;
    font-size: 14px;
    color: var(--text-light);
    opacity: 0.5;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes logoFloat {

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

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

@keyframes pulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.7;
    }
}

/* ---- Wheel Screen ---- */
.wheel-screen {
    gap: 20px;
    padding: 20px;
}

.stage-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.stage-badge {
    padding: 1.5vmin 3.5vmin;
    border-radius: 4vmin;
    font-size: max(14px, 2.5vmin);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.stage-1 .stage-badge {
    background: var(--gradient-1);
}

.stage-2 .stage-badge {
    background: var(--gradient-2);
    color: #0a0a1a;
}

.stage-3 .stage-badge {
    background: var(--gradient-3);
    color: #0a0a1a;
}

.stage-title {
    font-size: max(20px, 4vmin);
    font-weight: 700;
}

/* ---- Wheel Wrapper & Canvas ---- */
.wheel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.wheel-wrapper:active {
    cursor: grabbing;
}

canvas[id^="wheelCanvas"] {
    border-radius: 50%;
    box-shadow:
        0 0 40px rgba(108, 99, 255, 0.25),
        0 0 80px rgba(108, 99, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 0 0 2px rgba(255, 255, 255, 0.05);
    touch-action: none;
    -webkit-touch-callout: none;
}

canvas.dragging {
    cursor: grabbing;
}

/* ---- Pointer Indicator ---- */
.wheel-pointer {
    position: absolute;
    top: -2vmin;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    width: 0;
    height: 0;
    border-left: 3.5vmin solid transparent;
    border-right: 3.5vmin solid transparent;
    border-top: 7vmin solid #fff;
    filter: drop-shadow(0 0 10px rgba(108, 99, 255, 0.6)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    transition: filter 0.3s ease;
}

/* Pointer bounce animation on spin stop */
.wheel-pointer.bounce {
    animation: pointerBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wheel-pointer.glow-pulse {
    filter: drop-shadow(0 0 18px rgba(108, 99, 255, 0.9)) drop-shadow(0 0 30px rgba(168, 85, 247, 0.5)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

@keyframes pointerBounce {
    0% {
        transform: translateX(-50%) translateY(0);
    }
    25% {
        transform: translateX(-50%) translateY(6px);
    }
    50% {
        transform: translateX(-50%) translateY(-3px);
    }
    75% {
        transform: translateX(-50%) translateY(2px);
    }
    100% {
        transform: translateX(-50%) translateY(0);
    }
}

/* ---- Spin Button ---- */
.spin-btn {
    padding: 14px 48px;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    border: none;
    border-radius: 50px;
    background: var(--gradient-1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 24px var(--accent-glow);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.spin-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.spin-btn:hover::after {
    left: 100%;
}

.spin-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.spin-btn:active {
    transform: translateY(0) scale(0.98);
}

.spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.spin-btn:disabled::after {
    display: none;
}

/* ---- Result Modal ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    cursor: pointer;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: rgba(26, 26, 50, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: max(48px, 6vmin) max(40px, 5vmin);
    text-align: center;
    max-width: max(420px, 50vmin);
    width: 90%;
    transform: scale(0.8) translateY(30px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 40px var(--accent-glow);
}

.modal-overlay.show .modal-card {
    transform: scale(1) translateY(0);
}

.modal-emoji {
    font-size: max(56px, 8vmin);
    margin-bottom: 2vmin;
    display: block;
    animation: bounceIn 0.6s ease;
}

.modal-label {
    font-size: max(14px, 2vmin);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5vmin;
    display: block;
}

.stage-1-modal .modal-label {
    color: #a78bfa;
}

.stage-2-modal .modal-label {
    color: #6ee7b7;
}

.stage-3-modal .modal-label {
    color: #fbbf24;
}

.modal-result {
    font-size: max(32px, 5vmin);
    font-weight: 800;
    margin-bottom: 3vmin;
    line-height: 1.2;
}

.modal-hint {
    font-size: max(13px, 1.8vmin);
    color: var(--text-light);
    opacity: 0.6;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

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

/* ---- Confetti Canvas ---- */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .logo-container img {
        width: 70vw; /* slightly larger on mobile for text legibility, still smaller than before */
        max-width: 320px;
        height: auto;
    }

    .logo-container h1 {
        font-size: 28px;
    }

    .stage-title {
        font-size: 16px;
    }

    .spin-btn {
        padding: 12px 36px;
        font-size: 15px;
    }

    .modal-card {
        padding: 36px 28px;
    }

    .modal-result {
        font-size: 24px;
    }

    .modal-emoji {
        font-size: 44px;
    }
}

@media (max-height: 700px) {
    .logo-container img {
        width: 50vw;
        max-width: 250px;
        height: auto;
    }

    .logo-container h1 {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .tap-hint {
        bottom: 30px;
    }
}