@font-face {
    font-family: 'PixelFont';
    src: url('https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8T-267oIAQAu6jDQyK3nVivM.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Basis-Setup */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a2e;
    font-family: 'PixelFont', 'Press Start 2P', monospace;
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Buehne */
.hero-stage {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Himmel */
.layer-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 100%);
    z-index: 1;
}

/* Wolken */
[class^="layer-cloud-"] {
    position: absolute;
    background-repeat: no-repeat;
    background-size: contain;
    left: -700px;
    opacity: 0.5;
    z-index: 2;
}

.layer-cloud-1 {
    top: 30px;
    width: 300px;
    height: 96px;
    background-image: url('gfx/OG_Pixel_Wolke_Header01.png');
    animation: move-clouds 35s linear infinite;
}

.layer-cloud-2 {
    top: 80px;
    width: 360px;
    height: 120px;
    background-image: url('gfx/OG_Pixel_Wolke_Header02.png');
    animation: move-clouds 28s linear infinite;
    animation-delay: -10s;
}

.layer-cloud-3 {
    top: 15px;
    width: 516px;
    height: 93px;
    background-image: url('gfx/OG_Pixel_Wolke_Header03.png');
    animation: move-clouds 40s linear infinite;
    animation-delay: -20s;
}

.layer-cloud-4 {
    bottom: 193px;
    width: 660px;
    height: 174px;
    background-image: url('gfx/OG_Pixel_Wolke_Header04.png');
    animation: move-clouds 80s linear infinite;
    animation-delay: -5s;
}

.layer-cloud-5 {
    top: 100px;
    width: 381px;
    height: 84px;
    background-image: url('gfx/OG_Pixel_Wolke_Header05.png');
    animation: move-clouds 30s linear infinite;
    animation-delay: -15s;
}

/* Meer */
.layer-sea {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 193px;
    background: #2a5c8a;
    z-index: 2;
}

/* Deich */
.layer-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 546px;
    background: url('gfx/deich.png') repeat-x 0 bottom / 1776px 546px;
    z-index: 3;
    animation: scroll-terrain 12s linear infinite;
}

/* Objekt-Container */
.layer-objects-back {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
}

.layer-objects-front {
    position: absolute;
    inset: 0;
    z-index: 11;
    pointer-events: none;
}

/* Deich-Objekte */
.deich-object {
    position: absolute;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center bottom;
}

.deich-object.bank {
    width: 195px;
    height: 66px;
    bottom: 186px;
    background-image: url('gfx/OG_Pixel_Bank01.png');
}

.deich-object.schaf1,
.deich-object.schaf2,
.deich-object.schaf-black,
.deich-object.schaf-pink {
    background-size: contain;
}

/* Radfahrer */
.layer-cyclist {
    position: absolute;
    bottom: 186px;
    left: 75%;
    transform: translateX(-50%);
    transform-origin: 85% 100%;
    width: 150px;
    height: 159px;
    background: url('gfx/radfahrer_sprite.png') 0 0 / 1350px 159px;
    z-index: 10;
    animation: cycle-frames 0.6s steps(9) infinite;
}

/* Overlays */
.game-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
}

.start-overlay {
    background: rgba(0, 0, 0, 0.3);
    flex-direction: column;
}

.start-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.start-logo {
    position: relative;
    width: 500px;
    max-width: 80vw;
    overflow: visible;
}

.start-logo img {
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.5));
}

.overlay-text {
    color: #fff;
    font-family: 'PixelFont', 'Press Start 2P', monospace;
    font-size: 22px;
    text-align: center;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
    padding: 20px 40px;
    animation: overlay-pulse 1.5s ease-in-out infinite;
}


.game-over-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.game-over-title {
    font-size: 36px;
    color: #ff4444;
    margin-bottom: 20px;
}

.game-over-score {
    font-size: 24px;
    color: #f194af;
    margin-bottom: 28px;
}

.game-over-hint {
    font-size: 14px;
    color: #ccc;
    animation: overlay-pulse 1.5s ease-in-out infinite;
}

@keyframes overlay-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Score-Balken */
.score-bar {
    position: relative;
    display: flex;
    align-items: center;
    height: 80px;
    background: #16213e;
    border-top: 3px solid #0f3460;
    padding: 0 20px;
    padding-left: 280px;
    gap: 20px;
    flex-shrink: 0;
}

.score-bar-logo {
    position: absolute;
    left: 16px;
    bottom: 8px;
    height: 160px;
    flex-shrink: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

.score-bar-logo.visible {
    opacity: 1;
}

.score-bar-logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
    image-rendering: pixelated;
}

/* Glitzersterne auf dem Logo */
.sparkle {
    position: absolute;
    pointer-events: none;
    z-index: 201;
}

.sparkle.stern {
    width: 72px;
    height: 69px;
    background: url('gfx/stern_sprite.png') 0 0 / 144px 69px;
    animation: sparkle-stern 0.15s steps(2) 3, sparkle-fade 0.45s ease-out forwards;
}

.sparkle.sternchen {
    width: 60px;
    height: 63px;
    background: url('gfx/sternchen_sprite.png') 0 0 / 120px 63px;
    animation: sparkle-sternchen 0.12s steps(2) 4, sparkle-fade 0.48s ease-out forwards;
}

@keyframes sparkle-stern {
    from { background-position-x: 0; }
    to   { background-position-x: -144px; }
}

@keyframes sparkle-sternchen {
    from { background-position-x: 0; }
    to   { background-position-x: -120px; }
}

@keyframes sparkle-fade {
    0%   { opacity: 1; }
    70%  { opacity: 1; }
    100% { opacity: 0; }
}

.score-bar-info {
    display: flex;
    align-items: baseline;
    gap: 14px;
    font-family: 'PixelFont', 'Press Start 2P', monospace;
    margin-left: auto;
    padding-right: 10px;
}

.score-label {
    font-size: 14px;
    color: #f194af;
    letter-spacing: 2px;
}

.score-value {
    font-size: 32px;
    font-weight: bold;
    color: #f194af;
    min-width: 140px;
    text-align: right;
    text-shadow: 0 0 12px rgba(241, 148, 175, 0.4);
}

/* Animationen */
@keyframes scroll-terrain {
    from { background-position: 0 bottom; }
    to { background-position: 1776px bottom; }
}

@keyframes move-clouds {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100vw + 700px)); }
}

@keyframes cycle-frames {
    from { background-position-x: 0; }
    to { background-position-x: -1350px; }
}

/* Responsive */
@media (max-width: 768px) {
    .score-bar {
        height: 56px;
        padding-left: 180px;
    }

    .score-bar-logo {
        height: 110px;
    }

    .score-value {
        font-size: 28px;
    }

    .overlay-text {
        font-size: 22px;
    }

    .game-over-title {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .score-bar {
        height: 48px;
        padding-left: 130px;
    }

    .score-bar-logo {
        height: 80px;
    }

    .score-value {
        font-size: 24px;
    }

    .overlay-text {
        font-size: 18px;
    }

    .game-over-title {
        font-size: 28px;
    }
}
