/* Retro Flappy Bird CSS */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    font-family: 'Press Start 2P', cursive;
    background-color: #000;
    color: #fff;
    /* Remove flex centering and full viewport height */
    /* display: flex; */
    /* justify-content: center; */
    /* align-items: center; */
    /* height: 100vh; */
}

/* Main wrapper to control vertical layout */
.main-wrapper {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Game container fills available width, but game-area flexes vertically */
.game-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.game-area {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 200px;
    max-height: 600px;
    height: auto;
    background-color: #70c5ce;
    border: 4px solid #fff;
    overflow: hidden;
}

.bird {
    position: absolute;
    width: 40px;
    height: 30px;
    background-color: #ffff00;
    border-radius: 50% 50% 20% 20%;
    left: 50px;
    top: 250px;
    z-index: 10;
    box-shadow: 0 0 0 3px #ff6600;
}

.bird::before {
    content: "";
    position: absolute;
    width: 15px;
    height: 10px;
    background-color: #ff6600;
    border-radius: 50% 50% 20% 20%;
    right: -5px;
    top: 10px;
}

.bird::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #000;
    border-radius: 50%;
    right: 8px;
    top: 8px;
}

/* Bird wing */
.bird::before {
    content: "";
    position: absolute;
    width: 15px;
    height: 10px;
    background-color: #ff6600;
    border-radius: 50% 50% 20% 20%;
    right: -5px;
    top: 10px;
    animation: flap 0.2s infinite alternate;
}

@keyframes flap {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(3px);
    }
}

.pipe {
    position: absolute;
    width: 60px;
    background-color: #73bf2e;
    border: 3px solid #000;
}

.pipe-top {
    top: 0;
    border-bottom: none;
}

.pipe-bottom {
    bottom: 0;
    border-top: none;
}

.pipe-cap {
    position: absolute;
    width: 66px;
    height: 20px;
    background-color: #73bf2e;
    border: 3px solid #000;
    left: -3px;
}

.pipe-top .pipe-cap {
    bottom: 0;
}

.pipe-bottom .pipe-cap {
    top: 0;
}

.score-display {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 40px;
    z-index: 20;
    text-shadow: 2px 2px 0 #000;
}

.game-message {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    text-align: center;
    font-size: 24px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 20px;
    z-index: 30;
    text-shadow: 2px 2px 0 #000;
}

.controls {
    margin-top: 0;
    margin-bottom: 8px;
    text-align: center;
}

.restart-button {
    font-family: 'Press Start 2P', cursive;
    background-color: #ff6600;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border: 3px solid #fff;
}

.restart-button:hover {
    background-color: #ff8800;
}

.hidden {
    display: none;
}

/* Retro scanlines effect */
.game-area::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 15;
}

.cloud {
    position: absolute;
    top: 40px;
    width: 120px;
    height: 40px;
    background: #fff;
    border-radius: 60px;
    opacity: 0.5;
    z-index: 2;
}
.cloud-1 { left: 0; top: 40px; }
.cloud-2 { left: 150px; top: 80px; }
.cloud-3 { left: 300px; top: 60px; }

.ground {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 40px;
    background: repeating-linear-gradient(
        -45deg,
        #b5651d,
        #b5651d 10px,
        #8b4513 10px,
        #8b4513 20px
    );
    z-index: 20;
    background-position: 0 0;
}

.credits {
    position: static;
    margin-bottom: 8px;
    text-align: center;
    font-size: 12px;
    color: #fff;
    opacity: 0.7;
    font-family: 'Press Start 2P', cursive;
    z-index: 100;
    pointer-events: none;
}

/* Responsive for mobile */
@media (max-width: 600px) {
    html, body {
        height: 100%;
        min-height: 100%;
        padding: 0;
        margin: 0;
    }
    .main-wrapper {
        height: 100dvh;      /* Use dynamic viewport height */
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
    }
    .game-container {
        max-width: 100vw;
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
    }
    .game-area {
        flex: 1 1 auto;
        min-height: 0;       /* Allow shrinking */
        max-height: none;
        height: auto;
    }
    .controls {
        flex-shrink: 0;
        margin-bottom: 4px;
    }
    .credits {
        flex-shrink: 0;
        margin-bottom: 4px;
    }
}