/* CSS Variables */
:root {
    --primary-color: #7a1a98;
    --bg-dark: #0b0b12;
    --bg-panel: #121225;
    --text-primary: #e8e8ff;
    --neon-accent-1: #00f6ff;
    --neon-accent-2: #ffe600;
    --danger: #ff3b6b;
}

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

body {
    font-family: 'Arial', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero Screen */
.hero-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0b0b12 0%, #1a0b2e 25%, #2d1b69 50%, #1a0b2e 75%, #0b0b12 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.hero-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(122, 26, 152, 0.4) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(0, 246, 255, 0.3) 0%, transparent 50%);
    animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% { opacity: 0.7; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.02); }
}

.hero-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
    background: rgba(18, 18, 37, 0.3);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(122, 26, 152, 0.3);
    box-shadow: 0 20px 40px rgba(122, 26, 152, 0.2);
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: bold;
    background: linear-gradient(45deg, var(--primary-color), var(--neon-accent-1));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    animation: titlePulse 3s ease-in-out infinite alternate;
}

@keyframes titlePulse {
    0% { filter: drop-shadow(0 0 10px rgba(122, 26, 152, 0.8)); }
    100% { filter: drop-shadow(0 0 20px rgba(0, 246, 255, 0.8)); }
}

.hero-subtitle {
    font-size: 1.125rem;
    color: #cbd5e1;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-button {
    background: linear-gradient(45deg, var(--primary-color), var(--neon-accent-1));
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(122, 26, 152, 0.4);
    position: relative;
    overflow: hidden;
}

.hero-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 15px 35px rgba(122, 26, 152, 0.6);
}

.hero-button:active {
    transform: translateY(0) scale(0.98);
}

.controls-info {
    color: #9ca3af;
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Game Screen */
.game-screen {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Game HUD */
.game-hud {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

.balance-display {
    background: rgba(11, 11, 18, 0.5);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(122, 26, 152, 0.3);
    text-align: center;
}

.balance-label {
    color: #9ca3af;
    font-size: 0.875rem;
}

.balance-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--neon-accent-2);
    text-shadow: 0 0 10px rgba(255, 230, 0, 0.5);
}

/* Game Canvas */
#game-canvas {
    border: 1px solid rgba(122, 26, 152, 0.5);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(122, 26, 152, 0.25);
    background: var(--bg-dark);
    max-width: 90vw;
    max-height: 70vh;
}

/* Game Controls */
.game-controls {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    justify-content: space-between;
    z-index: 40;
    transition: bottom 0.3s ease;
}

.game-controls.shifted {
    bottom: 5rem;
}

.control-button {
    width: 4rem;
    height: 4rem;
    background: rgba(11, 11, 18, 0.5);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 246, 255, 0.5);
    border-radius: 50%;
    color: var(--neon-accent-1);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-button:active {
    transform: scale(0.95);
    background: rgba(0, 246, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 246, 255, 0.4);
}

/* Sticky CTA */
.sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(11, 11, 18, 0.7);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(122, 26, 152, 0.5);
    padding: 1rem;
    z-index: 30;
}

.cta-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 32rem;
    margin: 0 auto;
}

.cta-text {
    color: var(--neon-accent-2);
    font-weight: 600;
}

.cta-button {
    background: linear-gradient(45deg, var(--primary-color), var(--neon-accent-1));
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cta-button:hover {
    background: linear-gradient(45deg, #8b1fa9, #00d4dd);
    transform: translateY(-1px);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: rgba(11, 11, 18, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 2rem;
    max-width: 28rem;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(122, 26, 152, 0.5);
}

/* Success Modal */
.success-modal {
    animation: modalSuccess 0.5s ease-out;
}

@keyframes modalSuccess {
    0% {
        transform: scale(0.8) rotate(-5deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.success-title {
    font-size: 1.875rem;
    font-weight: bold;
    background: linear-gradient(45deg, var(--primary-color), var(--neon-accent-1));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    animation: successPulse 2s ease-in-out infinite alternate;
}

@keyframes successPulse {
    0% { filter: drop-shadow(0 0 10px rgba(122, 26, 152, 0.8)); }
    100% { filter: drop-shadow(0 0 25px rgba(0, 246, 255, 1)); }
}

.success-description {
    color: #cbd5e1;
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Primary CTA Button */
.primary-cta-button {
    display: block;
    width: 100%;
    background: linear-gradient(45deg, var(--primary-color), var(--neon-accent-1));
    background-size: 200% 200%;
    color: white;
    font-weight: bold;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.25rem;
    text-decoration: none;
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(122, 26, 152, 0.4);
    animation: ctaPulse 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

@keyframes ctaPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 25px rgba(122, 26, 152, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 15px 35px rgba(0, 246, 255, 0.6);
        background-position: 100% 50%;
    }
}

.primary-cta-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 20px 40px rgba(122, 26, 152, 0.7);
    background-position: 100% 50%;
}

.primary-cta-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.primary-cta-button:hover::before {
    transform: translateX(100%);
}

/* Secondary Buttons */
.secondary-buttons {
    display: flex;
    gap: 0.5rem;
}

.secondary-button {
    flex: 1;
    background: transparent;
    border: 1px solid #4b5563;
    color: #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.875rem;
}

.secondary-button:hover {
    background: rgba(75, 85, 99, 0.3);
    border-color: #6b7280;
}

/* Game Over Modal */
.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin-bottom: 1rem;
}

.game-stats {
    margin-bottom: 1.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
}

.stat-value {
    color: var(--neon-accent-1);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-button {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    text-align: center;
}

.modal-button.primary {
    background: linear-gradient(45deg, var(--primary-color), var(--neon-accent-1));
    color: white;
}

.modal-button.primary:hover {
    background: linear-gradient(45deg, #8b1fa9, #00d4dd);
    transform: translateY(-2px);
}

.modal-button.secondary {
    background: transparent;
    border: 1px solid #4b5563;
    color: #cbd5e1;
}

.modal-button.secondary:hover {
    background: rgba(75, 85, 99, 0.3);
}

/* Notification */
.notification {
    position: fixed;
    top: 6rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 18, 37, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(122, 26, 152, 0.5);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    z-index: 60;
    animation: notificationSlide 0.3s ease-out;
}

@keyframes notificationSlide {
    0% {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Confetti */
#confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--neon-accent-2);
    animation: confettiFall linear infinite;
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .hero-content {
        max-width: calc(100vw - 2rem);
        margin: 1rem;
    }
    
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .secondary-buttons {
        flex-direction: column;
    }
    
    .cta-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .cta-button {
        width: 100%;
    }
}

@media (max-height: 600px) {
    .game-hud {
        top: 0.5rem;
    }
    
    .balance-display {
        padding: 0.5rem;
    }
    
    .control-button {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }
}