/* Neon Serpent - Cyber Snake Styles */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}


@keyframes neonPulse {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.3;
    }
    50% { 
        transform: translate(-20px, -10px) rotate(1deg);
        opacity: 0.6;
    }
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.game-header {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
}


@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes buttonShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes powerupGlow {
    0%, 100% { 
        box-shadow: 
            0 0 25px rgba(0, 255, 255, 0.4),
            0 0 50px rgba(255, 0, 255, 0.3),
            inset 0 0 20px rgba(0, 255, 255, 0.1);
    }
    50% { 
        box-shadow: 
            0 0 35px rgba(0, 255, 255, 0.6),
            0 0 70px rgba(255, 0, 255, 0.5),
            inset 0 0 30px rgba(0, 255, 255, 0.2);
    }
}

@keyframes overlayFloat {
    0%, 100% { 
        transform: translateY(0px);
    }
    50% { 
        transform: translateY(-8px);
    }
}

@keyframes titlePulse {
    0%, 100% { 
        text-shadow: 
            0 0 25px #00ffff,
            0 0 50px rgba(0, 255, 255, 0.5),
            0 0 75px rgba(0, 255, 255, 0.3);
        transform: scale(1);
    }
    50% { 
        text-shadow: 
            0 0 35px #00ffff,
            0 0 70px rgba(0, 255, 255, 0.7),
            0 0 100px rgba(0, 255, 255, 0.5);
        transform: scale(1.02);
    }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo i {
    font-size: 2rem;
    color: #3b82f6;
}

.logo h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #f1f5f9;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.025em;
    margin: 0;
}

.logo span {
    color: #10b981;
}

.system-status {
    display: flex;
    gap: 2rem;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.status-label {
    font-size: 0.8rem;
    color: #888;
    font-weight: 400;
}

.status-value {
    font-size: 1rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    border: 1px solid;
}

.status-value.online {
    color: #10b981;
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.status-value.active {
    color: #3b82f6;
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

@keyframes mysticPulse {
    0%, 100% { 
        color: #d4af37;
        text-shadow: 0 0 20px #d4af37;
        transform: scale(1);
    }
    50% { 
        color: #ffd700;
        text-shadow: 0 0 30px #ffd700, 0 0 40px #d4af37;
        transform: scale(1.05);
    }
}

/* Stats Panel */
.stats-panel {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.stat-item {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    min-width: 100px;
    backdrop-filter: blur(8px);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: rgba(16, 185, 129, 0.5);
}


.stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f1f5f9;
    font-family: 'JetBrains Mono', monospace;
}

/* Game Area */
.game-area {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    flex: 1;
    align-items: center;
    min-height: 60vh;
}

#gameCanvas {
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 90vw;
    max-height: 70vh;
    width: auto;
    height: auto;
    touch-action: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

#gameCanvas:active {
    cursor: grabbing;
}

/* Game Overlays */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay-content {
    text-align: center;
    max-width: 500px;
    padding: 2.5rem;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.overlay-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.overlay-title i {
    font-size: 2rem;
    color: #3b82f6;
    margin-bottom: 1rem;
    display: block;
}

.overlay-title h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 1.5rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.025em;
}

.game-over-title i {
    color: #ff0080;
    animation: shake 0.5s ease-in-out infinite;
}

.game-over-title h2 {
    color: #ff0040;
    text-shadow: 0 0 25px #ff0040;
}

.overlay-text {
    margin-bottom: 2rem;
    line-height: 1.6;
    text-align: center;
}

/* Buttons */
.start-btn, .restart-btn, .menu-btn, .saga-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.5rem;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.saga-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.menu-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.start-btn:hover, .restart-btn:hover, .menu-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.saga-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.start-btn:active, .restart-btn:active, .menu-btn:active {
    transform: translateY(-2px) scale(1.02);
    transition: all 0.1s ease;
}

.game-over-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Power-up Notification */
.power-notification {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(16, 185, 129, 0.5);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 200;
    animation: notificationSlide 3s ease-out forwards;
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(16, 185, 129, 0.1);
}

.notification-icon {
    font-size: 1.5rem;
    animation: notificationGlow 1s ease-in-out infinite alternate;
}

.notification-text {
    color: #f1f5f9;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
}

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

@keyframes notificationGlow {
    0% {
        filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
    }
    100% {
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    }
}

/* Saga System Styles */
.saga-selector-content {
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

.saga-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.saga-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.saga-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(15, 23, 42, 0.4);
}

.saga-item.current {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.saga-item.unlocked:hover:not(.current) {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-1px);
}

.saga-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.saga-item.current .saga-number {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.saga-item.locked .saga-number {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.saga-info {
    flex: 1;
}

.saga-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.25rem;
}

.saga-description {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.saga-upgrades {
    font-size: 0.8rem;
    color: #10b981;
    margin-bottom: 0.25rem;
    font-weight: 500;
    line-height: 1.4;
}

.saga-requirement {
    font-size: 0.75rem;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
}

.saga-status {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.saga-item.current .saga-status {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.saga-item.unlocked:not(.current) .saga-status {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.saga-item.locked .saga-status {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

/* Saga Unlock Notification */
.saga-unlock-notification {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 200;
    animation: sagaUnlockSlide 4s ease-out forwards;
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 0 20px rgba(251, 191, 36, 0.3);
}

.saga-unlock-notification .notification-icon {
    font-size: 2rem;
    animation: sagaUnlockGlow 1s ease-in-out infinite alternate;
}

.saga-unlock-notification .notification-text {
    color: #fbbf24;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
}

@keyframes sagaUnlockSlide {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.9);
    }
    10%, 85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.95);
    }
}

@keyframes sagaUnlockGlow {
    0% {
        filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.5));
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.8));
        transform: scale(1.1);
    }
}

/* Power-up Description Popup */
.power-description {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(16, 185, 129, 0.6);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    z-index: 150;
    animation: descriptionSlide 2.5s ease-out forwards;
    box-shadow: 
        0 8px 12px -2px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(16, 185, 129, 0.1);
}

.description-text {
    color: #10b981;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

@keyframes descriptionSlide {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-15px) scale(0.95);
    }
    15%, 80% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px) scale(0.98);
    }
}

/* Footer */
.game-footer {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1.5rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    color: #94a3b8;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
}

.footer-left i, .footer-right i {
    color: #3b82f6;
    margin: 0 0.5rem;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.3); }
    50% { box-shadow: 0 0 30px rgba(0, 255, 255, 0.6); }
}

@keyframes neonGlow {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-container {
        max-width: 100%;
        padding: 0.75rem;
    }
    
    #gameCanvas {
        max-width: 85vw;
        max-height: 65vh;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 0.5rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .stats-panel {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .stat-item {
        flex: 1;
        min-width: 120px;
    }
    
    #gameCanvas {
        max-width: 95vw;
        max-height: 60vh;
    }
    
    .game-area {
        min-height: 50vh;
    }
    
    .overlay-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .saga-selector-content {
        max-height: 70vh;
    }
    
    .saga-list {
        max-height: 300px;
    }
    
    .menu-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .overlay-title h2 {
        font-size: 1.8rem;
    }
    
    .game-over-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .powerups-panel {
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 0.25rem;
    }
    
    .stats-panel {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    #gameCanvas {
        max-width: 98vw;
        max-height: 55vh;
    }
    
    .powerups-panel {
        padding: 0.75rem;
    }
    
    .powerup-item {
        padding: 0.6rem;
        gap: 0.75rem;
    }
    
    .overlay-content {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .saga-item {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .saga-info {
        order: 1;
    }
    
    .saga-number {
        order: 0;
    }
    
    .saga-status {
        order: 2;
    }
    
    .overlay-title h2 {
        font-size: 1.4rem;
    }
    
    .start-btn, .restart-btn, .menu-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Touch Device Hints */
@media (hover: none) and (pointer: coarse) {
    /* Add swipe hint for touch devices */
    .game-area::after {
        content: '👆 Swipe to move, tap to pause';
        display: block;
        text-align: center;
        color: #00ffff;
        font-size: 0.9rem;
        margin-top: 1rem;
        animation: neonPulse 2s infinite;
        text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    }
    
    .controls-info .control-item {
        opacity: 0.5;
        font-size: 0.8rem;
    }
}

@keyframes cyberPulse {
    0%, 100% {
        opacity: 1;
        transform: translateY(0);
    }
    50% {
        opacity: 0.7;
        transform: translateY(-3px);
    }
}

/* Controls Info Styling */
.controls-info {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(50, 205, 50, 0.1) 0%, rgba(34, 139, 34, 0.05) 100%);
    border: 1px solid rgba(50, 205, 50, 0.3);
    border-radius: 15px;
}

.control-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.control-item:hover {
    background: rgba(16, 185, 129, 0.1);
    transform: translateX(2px);
}

.control-item i {
    color: #10b981;
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}
