/* ============================================
   NeonGlider - Core Styles
   ============================================ */

/* Base Styles */
:root {
    --color-primary: #4ade80;
    --color-secondary: #06b6d4;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --glass-bg: rgba(20, 20, 25, 0.85);
    --glass-border: rgba(255, 255, 255, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: #050505;
    font-family: 'Space Grotesk', sans-serif;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
}

/* Glass Morphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* Neon Text Effect */
.neon-text {
    text-shadow: 0 0 15px rgba(255,255,255,0.6);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

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

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Interactive Elements */
.interactive {
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s;
}

.interactive:active {
    transform: scale(0.96);
}

/* Tap Icon Animation */
.tap-icon {
    animation: tap 1.5s infinite;
}

@keyframes tap {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(0.9); opacity: 1; }
    100% { transform: scale(1); opacity: 0.5; }
}

/* Button Styles */
button {
    touch-action: manipulation;
    cursor: pointer;
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary);
}

/* Audio Toggle */
.audio-btn {
    pointer-events: auto;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.audio-btn:hover {
    opacity: 1;
}

.bar {
    width: 3px;
    background: white;
    animation: equalizer 1s infinite;
}

.paused .bar {
    animation-play-state: paused;
    height: 3px !important;
}

@keyframes equalizer {
    0% { height: 5px; }
    50% { height: 15px; }
    100% { height: 5px; }
}

/* ============================================
   Loading Screen
   ============================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: linear-gradient(135deg, #0f172a 0%, #022c22 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* ============================================
   Combo Display
   ============================================ */

.combo-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: all 0.2s ease-out;
    text-align: center;
}

.combo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.combo-count {
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 20px var(--color-primary), 0 0 40px var(--color-primary);
}

.combo-label {
    font-size: 14px;
    color: var(--color-primary);
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.combo-multi {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-warning);
    text-shadow: 0 0 10px var(--color-warning);
}

/* ============================================
   Ghost Indicator
   ============================================ */

.ghost-indicator {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    pointer-events: none;
}

.ghost-icon {
    font-size: 16px;
}

.ghost-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* ============================================
   Ship Selector
   ============================================ */

.ship-selector-details {
    text-align: left;
}

.ship-selector-details summary {
    list-style: none;
}

.ship-selector-details summary::-webkit-details-marker {
    display: none;
}

.ship-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.ship-option {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ship-option:hover:not(.locked) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.ship-option.selected {
    border-color: var(--color-primary);
    background: rgba(74, 222, 128, 0.1);
}

.ship-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.ship-preview {
    width: 60px;
    height: 40px;
    margin: 0 auto 4px;
}

.ship-name {
    font-size: 10px;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.ship-lock {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

/* ============================================
   Daily Challenge Button
   ============================================ */

.daily-challenge-btn {
    position: relative;
    overflow: hidden;
}

.daily-challenge-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

#dailyInfo {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.daily-date {
    color: rgba(255, 255, 255, 0.5);
}

.daily-best {
    color: var(--color-primary);
}

.daily-complete {
    color: var(--color-primary);
}

/* ============================================
   Leaderboard
   ============================================ */

.leaderboard-details summary {
    list-style: none;
}

.leaderboard-details summary::-webkit-details-marker {
    display: none;
}

.leaderboard-list {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-entry.player {
    background: rgba(74, 222, 128, 0.1);
    border-radius: 4px;
}

.leaderboard-entry .rank {
    width: 24px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
}

.leaderboard-entry .name {
    flex: 1;
    text-align: left;
    color: white;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.leaderboard-entry .score {
    font-weight: bold;
    color: var(--color-primary);
}

.no-scores {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

/* ============================================
   New High Score Badge
   ============================================ */

.new-high-score-badge {
    animation: celebrate 0.5s ease-out;
}

.new-high-score-badge.celebration {
    animation: celebrate 0.5s ease-out, pulse 1s infinite;
}

@keyframes celebrate {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ============================================
   Combo Stats
   ============================================ */

.combo-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.combo-stats .stat {
    text-align: center;
}

.combo-stats .stat-label {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.combo-stats .stat-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: var(--color-primary);
}

/* ============================================
   Reduced Motion Preferences
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .tap-icon {
        animation: none;
        opacity: 1;
    }
    
    .bar {
        animation: none;
        height: 10px;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: transparent;
        border-right-color: var(--color-primary);
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   Mobile Optimizations
   ============================================ */

@media (max-width: 480px) {
    .glass-panel {
        padding: 20px;
    }
    
    h1 {
        font-size: 2.5rem !important;
    }
    
    h2 {
        font-size: 2rem !important;
    }
    
    .ship-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #scoreDisplay {
        font-size: 2rem !important;
    }
    
    #levelDisplay {
        font-size: 1.25rem !important;
    }
}
