* { margin: 0; padding: 0; box-sizing: border-box; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

body {
    font-family: 'Inter', sans-serif;
    background: #050505;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.screen.active { display: flex; }

/* Home Screen - Modern Launch UI */
#home-screen {
    position: relative;
    overflow: hidden;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.launch-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(10, 15, 30, 0.6) 50%, rgba(10, 15, 30, 0.9) 100%);
}

.logo-container {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 1s ease-out;
}

.game-logo {
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 900;
    letter-spacing: 0.15em;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(0, 217, 255, 0.8),
        0 0 30px rgba(0, 217, 255, 0.6),
        0 0 60px rgba(0, 217, 255, 0.4),
        0 0 100px rgba(0, 217, 255, 0.2);
    margin-bottom: 0.5rem;
    animation: glowPulse 3s ease-in-out infinite;
}

.tagline {
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 300;
}

.loading-container {
    margin-bottom: 2.5rem;
    text-align: center;
    animation: fadeIn 1.5s ease-out;
}

.progress-bar {
    width: clamp(200px, 50vw, 400px);
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(0, 217, 255, 0.3);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00d9ff, #00ff88, #00d9ff);
    background-size: 200% 100%;
    border-radius: 3px;
    animation: progressShimmer 2s linear infinite, loadProgress 2.5s ease-out forwards;
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.6);
}

.loading-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    animation: pulse 1.5s ease-in-out infinite;
}

.launch-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: fadeInUp 1s ease-out 0.5s both;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.difficulty-selector label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.difficulty-selector select {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    border: 2px solid rgba(0, 217, 255, 0.5);
    border-radius: 8px;
    background: rgba(0, 20, 40, 0.6);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.difficulty-selector select:hover,
.difficulty-selector select:focus {
    border-color: #00d9ff;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
    outline: none;
}

.difficulty-selector select option {
    background: #0a1525;
    color: #fff;
}

/* Launch Button with Glow Effects */
.launch-btn {
    position: relative;
    padding: 1rem 4rem;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(0, 136, 204, 0.3));
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 217, 255, 0.4);
}

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

.launch-btn:hover {
    transform: scale(1.05) translateY(-3px);
    border-color: #00d9ff;
    box-shadow: 
        0 10px 30px rgba(0, 217, 255, 0.4),
        0 0 50px rgba(0, 217, 255, 0.2),
        inset 0 0 20px rgba(0, 217, 255, 0.1);
}

.launch-btn:hover::before {
    left: 100%;
}

.launch-btn:active {
    transform: scale(0.98) translateY(0);
    box-shadow: 0 5px 15px rgba(0, 217, 255, 0.3);
}

.btn-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(0, 217, 255, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.4s ease;
}

.launch-btn:hover .btn-glow {
    width: 200px;
    height: 200px;
    opacity: 1;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes glowPulse {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(0, 217, 255, 0.8),
            0 0 30px rgba(0, 217, 255, 0.6),
            0 0 60px rgba(0, 217, 255, 0.4),
            0 0 100px rgba(0, 217, 255, 0.2);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(0, 217, 255, 1),
            0 0 40px rgba(0, 217, 255, 0.8),
            0 0 80px rgba(0, 217, 255, 0.6),
            0 0 120px rgba(0, 217, 255, 0.4);
    }
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes loadProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Buttons */
.btn {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn.primary {
    background: linear-gradient(135deg, #00d9ff, #0099cc);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 217, 255, 0.3);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.5);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn.small:hover {
    background: rgba(0, 217, 255, 0.25);
    border-color: rgba(0, 217, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn.small:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.2);
}

.btn.small.active {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.35) 0%, rgba(0, 136, 204, 0.4) 100%);
    border-color: #00d9ff;
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Game Screen */
#game-screen {
    display: none;
    justify-content: flex-start;
    padding: 0;
}

#game-screen.active { display: flex; }

.game-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 2rem;
    background: linear-gradient(180deg, rgba(15, 25, 45, 0.85) 0%, rgba(10, 20, 40, 0.75) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 217, 255, 0.15);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.game-info {
    display: grid;
    grid-template-columns: auto auto;
    gap: 0.5rem 1.5rem;
    align-items: center;
}

#level-info {
    color: #00d9ff;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.line-limit-container, .gold-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gold-label {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
}

#gold-display {
    color: #ffaa00;
    font-size: 0.9rem;
    font-weight: bold;
}

.line-limit-label {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
}

.line-limit-bar {
    width: 120px;
    height: 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.line-limit-fill {
    height: 100%;
    width: 100%;
    background: #00ff88;
    border-radius: 6px;
    transition: width 0.15s ease, background-color 0.3s ease;
    box-shadow: 0 0 8px currentColor;
}

#line-limit-info {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 35px;
}

#status-text {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    background: rgba(0, 217, 255, 0.15);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 217, 255, 0.3);
    grid-column: span 2;
    text-align: center;
}

.controls {
    display: flex;
    gap: 0.5rem;
}

#game-canvas {
    position: absolute;
    top: 60px;
    bottom: 70px;
    left: 0;
    width: 100%;
    cursor: crosshair;
    touch-action: none;
    touch-callout: none;
}

.drawing-tools {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(20, 35, 60, 0.8) 0%, rgba(15, 25, 45, 0.85) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 217, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    padding: 0.8rem;
    border-radius: 14px;
    z-index: 10;
}

/* Result Screen */
#result-screen {
    background: radial-gradient(circle at center, rgba(15, 25, 45, 0.95) 0%, rgba(10, 15, 30, 1) 100%);
    padding: 2rem;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

#result-screen h1 {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

#result-screen.success h1 { color: #00ff88; text-shadow: 0 0 30px rgba(0, 255, 136, 0.4); }
#result-screen.failure h1 { color: #ff4444; text-shadow: 0 0 30px rgba(255, 68, 68, 0.4); }

#result-message {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 3rem;
    letter-spacing: 0.05em;
}

.result-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    justify-content: center;
}

.result-stats p {
    font-size: 1.2rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

/* Mobile Compact Styles */
@media (max-width: 600px) {
    .game-logo { font-size: 2rem; letter-spacing: 0.1em; }
    .tagline { font-size: 0.8rem; letter-spacing: 0.15em; }
    .launch-overlay { padding: 1rem; }
    .logo-container { margin-bottom: 2rem; }
    .loading-container { margin-bottom: 1.5rem; }
    .progress-bar { width: 180px; }
    .launch-controls { gap: 1rem; }
    .difficulty-selector { flex-direction: column; gap: 0.5rem; }
    .launch-btn { padding: 0.8rem 2.5rem; font-size: 1rem; }
    .btn { padding: 0.6rem 1.2rem; font-size: 0.9rem; }
    .btn.primary { padding: 0.7rem 1.5rem; }
    
    .game-header {
        padding: 0.5rem 0.8rem;
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    .game-info { gap: 0.1rem; }
    #level-info { font-size: 1rem; }
    #status-text { font-size: 0.75rem; }
    .controls { gap: 0.3rem; }
    .btn.small {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .drawing-tools {
        bottom: 0.5rem;
        padding: 0.5rem;
        gap: 0.3rem;
    }

    #game-canvas {
        top: 50px;
        bottom: 55px;
    }
    .drawing-tools .btn.small {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
    
    #result-screen h1 { font-size: 2rem; }
    #result-message { font-size: 1rem; }
    .result-buttons { gap: 0.5rem; }
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse { animation: pulse 1.5s infinite; }

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 68, 68, 0.9);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: bold;
    z-index: 100;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
