* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

@font-face {
    font-family: 'FlashFont';
    src: url('https://fonts.googleapis.com/css2?family=Bangers&display=swap');
    font-display: swap;
}

body {
    font-family: 'Bangers', 'Arial Black', sans-serif;
    background-color: #1a1a1a;
    color: white;
    overflow: hidden;
    touch-action: none;
    height: 100vh;
    width: 100vw;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 600px;
    margin: 0 auto;
    background-color: #000;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 10;
    transition: opacity 0.5s ease;
}

.hidden {
    display: none;
    opacity: 0;
    z-index: -1;
}

h1, h2 {
    color: #ffcc00;
    text-shadow: 0 0 5px #ff9900, 0 0 10px #ff6600;
    margin-bottom: 20px;
}

.game-logo {
    font-size: 3.5rem;
    letter-spacing: 2px;
    animation: pulse 2s infinite;
    background: linear-gradient(to right, #ff9900, #ffcc00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 2px 4px rgba(255, 153, 0, 0.8));
}

.subtitle {
    font-size: 1.5rem;
    margin-top: -10px;
    color: #ff6600;
    text-shadow: 0 0 3px #ff9900;
}

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

.flash-button {
    background: linear-gradient(to bottom, #ffcc00, #ff9900);
    border: 3px solid #ff6600;
    border-radius: 8px;
    color: #1a1a2e;
    font-family: 'Bangers', 'Arial Black', sans-serif;
    font-size: 1.2rem;
    padding: 10px 20px;
    margin: 10px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 4px 0 #cc5500, 0 5px 5px rgba(0, 0, 0, 0.5);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    outline: none;
}

.flash-button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #cc5500, 0 1px 2px rgba(0, 0, 0, 0.5);
}

.buttons-container {
    display: flex;
    flex-direction: column;
    margin-top: 20px;
}

.character-preview {
    margin-top: 30px;
    width: 100px;
    height: 100px;
    position: relative;
}

#blob-preview {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #00ccff, #0066cc);
    border-radius: 50%;
    position: relative;
    animation: blobFloat 2s infinite alternate ease-in-out;
    box-shadow: 0 0 15px #00ccff, inset 0 0 10px rgba(255, 255, 255, 0.8);
}

@keyframes blobFloat {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-20px) scale(1.05); }
}

#blob-preview::before, #blob-preview::after {
    content: '';
    position: absolute;
    background-color: white;
    border-radius: 50%;
    animation: blink 3s infinite;
}

#blob-preview::before {
    width: 20px;
    height: 20px;
    top: 20px;
    left: 15px;
}

#blob-preview::after {
    width: 20px;
    height: 20px;
    top: 20px;
    right: 15px;
}

@keyframes blink {
    0%, 85%, 90%, 100% { transform: scaleY(1); }
    87%, 93% { transform: scaleY(0.1); }
}

.instructions, .credits-content {
    text-align: left;
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.5;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ff9900;
    width: 90%;
    max-width: 400px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    max-width: 400px;
    width: 90%;
}

.level-button {
    width: 100%;
    height: 60px;
    font-size: 1.2rem;
    background-color: #333;
    border: 2px solid #666;
    border-radius: 8px;
    color: #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.level-button.unlocked {
    background: linear-gradient(to bottom, #2a5298, #1a3a70);
    border: 2px solid #3366cc;
    color: white;
    cursor: pointer;
}

.level-button.completed {
    background: linear-gradient(to bottom, #2a7d2a, #1a5c1a);
    border: 2px solid #33cc33;
}

.level-button.current {
    background: linear-gradient(to bottom, #cc7a00, #995c00);
    border: 2px solid #ffaa00;
    animation: glow 1.5s infinite alternate;
}

@keyframes glow {
    0% { box-shadow: 0 0 5px #ffaa00; }
    100% { box-shadow: 0 0 15px #ffcc00; }
}

.star-container {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 3px;
}

.level-star {
    color: #999;
    font-size: 12px;
}

.level-star.earned {
    color: #ffcc00;
    text-shadow: 0 0 3px #ff9900;
}

#game-screen {
    background-color: #000;
    padding: 0;
}

#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    z-index: 5;
}

.game-stats {
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    border: 1px solid #333;
}

#pause-button {
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #333;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#game-canvas-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    display: flex;
    z-index: 4;
}

#left-control, #right-control {
    flex: 1;
    height: 100%;
}

.level-stats, .victory-message {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ff9900;
    margin-bottom: 20px;
}

#loading-screen {
    background: #000;
    z-index: 100;
}

.loading-bar-container {
    width: 80%;
    max-width: 300px;
    height: 20px;
    background-color: #333;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px solid #666;
    overflow: hidden;
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #ff9900, #ffcc00);
    transition: width 0.3s;
}

#loading-text {
    font-size: 0.9rem;
    color: #ccc;
}

@media (max-height: 500px) {
    .game-logo {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .flash-button {
        padding: 8px 16px;
        font-size: 1rem;
        margin: 6px;
    }
    
    .character-preview {
        margin-top: 15px;
    }
    
    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
}

@media (min-height: 700px) {
    #game-container {
        margin-top: 5vh;
    }
}

