/* 8-Bit Arcade Style CSS */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: linear-gradient(45deg, #1a1a2e, #16213e, #0f3460);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    overflow-x: hidden;
}

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

/* Retro scanlines effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 0, 0.03) 2px,
        rgba(0, 255, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1;
}

#app {
    position: relative;
    z-index: 2;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    padding-top: clamp(20px, 8vh, 80px);
    overflow: hidden;
    width: 100%;
}

/* Game Title */
.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: #00ff00;
    text-shadow: 
        0 0 10px #00ff00,
        0 0 20px #00ff00,
        0 0 30px #00ff00,
        4px 4px 0px #ff0080,
        8px 8px 0px #8000ff;
    margin-bottom: clamp(10px, 3vh, 30px);
    text-align: center;
    animation: titleGlow 2s ease-in-out infinite alternate;
    letter-spacing: clamp(2px, 1vw, 4px);
    transform: perspective(500px) rotateX(15deg);
}

.game-title a {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.game-title a:hover {
    color: #00ff00;
    text-shadow: 
        0 0 15px #00ff00,
        0 0 25px #00ff00,
        0 0 35px #00ff00,
        4px 4px 0px #ff0080,
        8px 8px 0px #8000ff;
    transform: scale(1.05);
}

@keyframes titleGlow {
    from {
        text-shadow: 
            0 0 10px #00ff00,
            0 0 20px #00ff00,
            0 0 30px #00ff00,
            4px 4px 0px #ff0080,
            8px 8px 0px #8000ff;
    }
    to {
        text-shadow: 
            0 0 20px #00ff00,
            0 0 30px #00ff00,
            0 0 40px #00ff00,
            4px 4px 0px #ff0080,
            8px 8px 0px #8000ff;
    }
}

/* Retro border around the game */
#game-container {
    position: relative;
    width: min(1152px, 85vw, calc(85vh * 1.7778));
    height: min(648px, calc(85vw * 0.5625), 85vh);
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 200px);
    border: 8px solid #00ff00;
    border-radius: 15px;
    box-shadow: 
        0 0 20px #00ff00,
        inset 0 0 20px rgba(0, 255, 0, 0.1);
    background: #000;
    padding: 0;
    animation: borderPulse 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
}

@keyframes borderPulse {
    0%, 100% { 
        box-shadow: 
            0 0 20px #00ff00,
            inset 0 0 20px rgba(0, 255, 0, 0.1);
    }
    50% { 
        box-shadow: 
            0 0 25px #00ff00,
            inset 0 0 20px rgba(0, 255, 0, 0.15);
    }
}

canvas {
    display: block;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    object-fit: contain;
}

/* Retro corner decorations */
#game-container::before,
#game-container::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #ff0080;
    z-index: 3;
}

#game-container::before {
    top: -15px;
    left: -15px;
    border-right: none;
    border-bottom: none;
}

#game-container::after {
    bottom: -15px;
    right: -15px;
    border-left: none;
    border-top: none;
}

/* Loading text */
.loading-text {
    position: relative;
    margin-top: 20px;
    color: #00ff00;
    font-size: clamp(0.6rem, 2vw, 0.8rem);
    text-align: center;
    animation: blink 1s infinite;
    z-index: 10;
}

/* Mute Button */
.mute-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 255, 0, 0.4);
    border-radius: 4px;
    color: rgba(0, 255, 0, 0.8);
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.3rem, 1vw, 0.5rem);
    padding: 4px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0.6;
}

.mute-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    color: #00ff00;
    border-color: rgba(0, 255, 0, 0.8);
    opacity: 1;
    transform: scale(1.02);
}

.mute-btn.muted {
    background: rgba(255, 0, 128, 0.7);
    border-color: rgba(255, 0, 128, 0.4);
    color: rgba(255, 255, 255, 0.9);
    opacity: 0.8;
}

.mute-btn.muted:hover {
    background: rgba(255, 0, 128, 0.9);
    border-color: rgba(255, 0, 128, 0.8);
    opacity: 1;
}

.mute-icon {
    font-size: 0.8em;
}

.mute-text {
    font-size: 0.6em;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Retro particles background */
.retro-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #00ff00;
    border-radius: 50%;
    animation: float 6s infinite linear;
    bottom: 0;
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    #app {
        padding: 5px;
    }
    
    .game-title {
        font-size: clamp(1.2rem, 5vw, 2.5rem);
        letter-spacing: clamp(1px, 0.5vw, 3px);
        margin-bottom: clamp(8px, 2vh, 20px);
    }
    
    #game-container {
        border-width: 4px;
        padding: 0;
        width: min(1152px, 95vw, calc(95vh * 1.7778));
        height: min(648px, calc(95vw * 0.5625), 95vh);
        max-width: calc(100vw - 10px);
        max-height: calc(100vh - 120px);
    }
    
    canvas {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    
    .loading-text {
        font-size: clamp(0.5rem, 3vw, 0.7rem);
        margin-top: 15px;
    }
    
    .mute-btn {
        bottom: 8px;
        right: 8px;
        padding: 3px 5px;
        font-size: clamp(0.25rem, 1.5vw, 0.4rem);
    }
}

@media (max-width: 480px) {
    #app {
        padding: 3px;
    }
    
    .game-title {
        font-size: clamp(1rem, 6vw, 2rem);
        margin-bottom: clamp(5px, 1.5vh, 15px);
    }
    
    #game-container {
        width: min(1152px, 98vw, calc(98vh * 1.7778));
        height: min(648px, calc(98vw * 0.5625), 98vh);
        max-width: calc(100vw - 6px);
        max-height: calc(100vh - 100px);
        border-width: 3px;
    }
    
    .loading-text {
        font-size: clamp(0.4rem, 4vw, 0.6rem);
        margin-top: 10px;
    }
    
    .mute-btn {
        bottom: 5px;
        right: 5px;
        padding: 2px 4px;
        font-size: clamp(0.2rem, 2.5vw, 0.35rem);
    }
}

@media (max-height: 800px) {
    .game-title {
        font-size: clamp(1rem, 3vw, 2rem);
        margin-bottom: clamp(5px, 2vh, 15px);
    }
    
    #game-container {
        max-height: calc(100vh - 120px);
    }
}

@media (max-height: 600px) {
    .game-title {
        font-size: clamp(0.8rem, 4vw, 1.5rem);
        margin-bottom: clamp(3px, 1vh, 10px);
    }
    
    #game-container {
        max-height: calc(100vh - 80px);
    }
    
    .loading-text {
        font-size: clamp(0.4rem, 3vw, 0.6rem);
        margin-top: 8px;
    }
}
