/* ═══════════════════════════════════════════════════════
   CSS STYLING - Roboterplanet (Modern Edition)
   ═══════════════════════════════════════════════════════

   Struktur:
   1. Global Resets & Body Styling
   2. Animated Background (Stars)
   3. Game Container & Header
   4. Stats Bar
   5. Game Area & Spielfeld
   6. Spieler (Roboter & Katze)
   7. Hexen & Besen
   8. Kürbisse & Schatztruhe
   9. Partikel-Effekte
   10. Game Over Screen
   11. Audio Controls
   12. Mobile Responsive
*/

/* ═══════════════════════════════════════════════════════
   1. GLOBAL RESETS & BODY STYLING
   ═══════════════════════════════════════════════════════ */

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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   2. ANIMATED BACKGROUND (STARS)
   ═══════════════════════════════════════════════════════ */

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.stars {
    position: fixed;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite;
}

/* ═══════════════════════════════════════════════════════
   3. GAME CONTAINER & HEADER
   ═══════════════════════════════════════════════════════ */

.game-container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 20px;
    max-width: 900px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════
   4. STATS BAR
   ═══════════════════════════════════════════════════════ */

.stats-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
    text-align: center;
}

.stat {
    background: rgba(255, 255, 255, 0.08);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.stat:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 11px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #06ffa5;
}

/* ═══════════════════════════════════════════════════════
   5. GAME AREA & SPIELFELD
   ═══════════════════════════════════════════════════════ */

#gameArea {
    position: relative;
    width: min(90vw, 800px);
    height: min(60vh, 600px);
    background: url('/img/creepyforest.png?v=4.3') center/100% 100% no-repeat;
    background-size: cover;
    border: 3px solid rgba(255, 107, 53, 0.3);
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(139, 0, 255, 0.5), inset 0 0 100px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    margin: 0 auto 15px;
}

/* Fog effect */
.fog {
    position: absolute;
    width: 200%;
    height: 100%;
    background: radial-gradient(ellipse, rgba(100, 0, 150, 0.3) 0%, transparent 70%);
    animation: moveFog 20s infinite linear;
    pointer-events: none;
    z-index: 1;
}

@keyframes moveFog {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0%); }
}

/* Ghost particles */
.ghost-particle {
    position: absolute;
    background: rgba(200, 200, 255, 0.6);
    border-radius: 50%;
    animation: float 8s infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); opacity: 0.3; }
    50% { transform: translateY(-30px); opacity: 0.8; }
}

/* ═══════════════════════════════════════════════════════
   6. SPIELER (ROBOTER & KATZE)
   ═══════════════════════════════════════════════════════ */

/* Knight sprite (Player) */
#player {
    position: absolute;
    width: 100px;
    height: 100px;
    background: url('/img/knightelle.png?v=4.3') center/contain no-repeat;
    transition: left 0.2s ease, top 0.2s ease;
    filter: drop-shadow(0 0 15px rgba(0, 255, 255, 0.6));
    z-index: 10;
}

#player.robot-scared {
    animation: robotShake 0.3s infinite !important;
}

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

/* Black Cat (transformation) - NOW USING cat.png SPRITE */
.black-cat {
    position: absolute;
    width: 100px;
    height: 100px;
    background: url('/img/cat.png?v=4.3') center/contain no-repeat !important;
    filter: drop-shadow(0 0 15px #ff00ff);
    z-index: 10;
    transition: left 0.2s ease, top 0.2s ease;
}

/* Hide old CSS-drawn cat/robot parts */
#player .robot-head,
#player .antenna,
#player .antenna-ball,
#player .eye,
#player .eye-left,
#player .eye-right,
#player .eye-pupil,
#player .mouth,
#player .robot-body,
#player .robot-panel,
#player .robot-light,
#player .robot-arm,
#player .robot-arm-left,
#player .robot-arm-right,
#player .robot-leg,
#player .robot-leg-left,
#player .robot-leg-right,
#player .robot-foot,
.cat-body,
.cat-head,
.cat-ear,
.cat-ear-left,
.cat-ear-right,
.cat-eye,
.cat-eye-left,
.cat-eye-right,
.cat-tail {
    display: none;
}

/* ═══════════════════════════════════════════════════════
   7. HEXEN & BESEN
   ═══════════════════════════════════════════════════════ */

.witch {
    position: absolute;
    width: 100px;
    height: 100px;
    background: url('/img/witch2.png?v=4.3') center/contain no-repeat;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 15px rgba(255, 0, 255, 0.6));
    z-index: 5;
}

/* Hide old CSS witch parts */
.witch .witch-hat,
.witch .witch-hat-brim,
.witch .witch-head,
.witch .witch-eye,
.witch .witch-eye-left,
.witch .witch-eye-right,
.witch .witch-nose,
.witch .witch-mouth,
.witch .witch-body,
.witch .witch-cape,
.witch .witch-broom,
.witch .witch-broom-bristles {
    display: none;
}

/* ═══════════════════════════════════════════════════════
   8. KÜRBISSE & SCHATZTRUHE
   ═══════════════════════════════════════════════════════ */

.pumpkin {
    position: absolute;
    width: 40px;
    height: 40px;
    background: #ff8800;
    border-radius: 50%;
    border: 3px solid #cc6600;
    box-shadow: 0 0 15px rgba(255, 136, 0, 0.8);
    animation: pumpkinFloat 2s ease-in-out infinite;
    z-index: 3;
}

@keyframes pumpkinFloat {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 0 15px rgba(255, 136, 0, 0.8);
    }
    50% {
        transform: translateY(-5px);
        box-shadow: 0 0 30px rgba(255, 136, 0, 1);
    }
}

.pumpkin::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 14px;
    width: 10px;
    height: 10px;
    background: #228b22;
    border-radius: 2px;
}

.pumpkin-face {
    position: absolute;
    top: 10px;
    left: 8px;
    width: 24px;
    height: 20px;
}

.pumpkin-eye {
    position: absolute;
    top: 2px;
    width: 6px;
    height: 8px;
    background: #000;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.pumpkin-eye-left { left: 2px; }
.pumpkin-eye-right { right: 2px; }

.pumpkin-mouth {
    position: absolute;
    bottom: 2px;
    left: 4px;
    width: 16px;
    height: 8px;
    border-bottom: 3px solid #000;
    border-radius: 0 0 50% 50%;
}

/* Treasure Chest */
.treasure-chest {
    position: absolute;
    width: 60px;
    height: 50px;
    z-index: 3;
    transition: all 0.3s;
}

.treasure-chest:hover {
    transform: scale(1.1);
}

.chest-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 35px;
    background: #8b4513;
    border: 3px solid #654321;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.chest-lid {
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 20px;
    background: #8b4513;
    border: 3px solid #654321;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.chest-lock {
    position: absolute;
    top: 22px;
    left: 24px;
    width: 12px;
    height: 15px;
    background: #ffd700;
    border-radius: 3px;
    box-shadow: 0 0 10px #ffd700;
}

.chest-lock::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 2px;
    width: 8px;
    height: 8px;
    border: 2px solid #ffd700;
    border-radius: 50%;
    background: transparent;
}

/* ═══════════════════════════════════════════════════════
   9. SCORE & TIMER PANELS
   ═══════════════════════════════════════════════════════ */

.score-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid #ff8800;
    box-shadow: 0 0 15px rgba(255, 136, 0, 0.5);
    color: #ff8800;
    font-size: 1.2em;
    font-weight: bold;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.timer-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid #06ffa5;
    box-shadow: 0 0 15px rgba(6, 255, 165, 0.5);
    color: #06ffa5;
    font-size: 1.2em;
    font-weight: bold;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.cat-timer {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(138, 43, 226, 0.9);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #ff00ff;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
    color: #fff;
    font-size: 1.3em;
    font-weight: bold;
    z-index: 100;
    display: none;
    animation: catTimerPulse 0.5s infinite;
    backdrop-filter: blur(5px);
}

@keyframes catTimerPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

.warning {
    background: rgba(255, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    animation: warningPulse 1s infinite;
    backdrop-filter: blur(5px);
    text-align: center;
    margin: 10px auto;
    max-width: fit-content;
}

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

/* ═══════════════════════════════════════════════════════
   10. PARTICLE EFFECTS
   ═══════════════════════════════════════════════════════ */

@keyframes particle-fly {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0) rotate(360deg);
        opacity: 0;
    }
}

.particle {
    position: fixed;
    pointer-events: none;
    font-size: 20px;
    animation: particle-fly 1s ease-out forwards;
    z-index: 1000;
}

/* Screen Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-1deg); }
    75% { transform: translateX(10px) rotate(1deg); }
}

.shake {
    animation: shake 0.5s;
}

/* ═══════════════════════════════════════════════════════
   11. GAME OVER SCREEN
   ═══════════════════════════════════════════════════════ */

.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s;
    backdrop-filter: blur(10px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-screen.show {
    display: flex;
}

.game-over-title {
    font-size: 4em;
    color: #ff8800;
    text-shadow: 0 0 20px #ff8800, 0 0 40px #ff8800;
    margin-bottom: 20px;
    animation: gameOverPulse 1s infinite;
}

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

.game-over-message {
    font-size: 1.5em;
    color: #cc00cc;
    text-shadow: 0 0 10px #cc00cc;
    margin-bottom: 10px;
}

.final-score {
    font-size: 2.5em;
    color: #00ff00;
    text-shadow: 0 0 15px #00ff00;
    margin-bottom: 30px;
}

.restart-button {
    padding: 15px 40px;
    font-size: 1.3em;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    transition: all 0.3s;
    font-weight: bold;
}

.restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

.restart-button:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════
   12. AUDIO CONTROLS
   ═══════════════════════════════════════════════════════ */

.audio-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.audio-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.audio-btn:active {
    transform: scale(0.95);
}

.audio-btn.muted {
    opacity: 0.5;
    background: rgba(255, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════════════════
   13. INFO PANEL
   ═══════════════════════════════════════════════════════ */

.info-panel {
    margin-top: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 30px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.controls {
    font-size: 0.9em;
    opacity: 0.8;
    color: #06ffa5;
}

/* ═══════════════════════════════════════════════════════
   14. MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════ */

@media (max-width: 850px) {
    .game-container {
        padding: 20px;
    }

    #gameArea {
        width: 95vw;
        height: 70vh;
    }

    h1 {
        font-size: 1.8em;
    }

    .game-over-title {
        font-size: 2.5em;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat {
        padding: 10px;
    }

    .stat-value {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 15px;
        width: 95%;
    }

    h1 {
        font-size: 1.5em;
    }

    .audio-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}
