/* --- Spielfeld (übersteuert .game aus style_games.css) --- */
.game {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 420px;
    max-height: 680px;
    margin-top: 30px;

    background: var(--panel);
    border-radius: 12px;
    border: 1px solid #141c2c;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);

    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    cursor: crosshair;
}

.game.idle {
    cursor: default;
}

/* --- HUD: Score und Timer --- */
.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    z-index: 5;
    pointer-events: none;

    background: linear-gradient(180deg, rgba(2, 6, 12, 0.6) 0%, rgba(2, 6, 12, 0) 100%);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.hud-item.timer {
    align-items: flex-end;
}

.hud-item.streak {
    align-items: center;
    text-align: center;
}

.hud-label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.hud-value {
    color: var(--text);
    font-size: 1.8rem;
    font-weight: 800;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.hud-value.warning {
    color: #fbbf24;
}

.hud-value.danger {
    color: #ef4444;
    animation: pulseDanger 0.6s ease-in-out infinite alternate;
}

.hud-value.streak-value {
    color: var(--muted);
    transition: color 0.2s ease, transform 0.2s ease, text-shadow 0.2s ease;
}

.hud-value.streak-value.active {
    color: #fbbf24;
    transform: scale(1.1);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.55);
}

.hud-value.streak-value.hot {
    color: #ef4444;
    transform: scale(1.18);
    text-shadow: 0 0 14px rgba(239, 68, 68, 0.7);
    animation: streakBeat 0.45s ease-in-out infinite alternate;
}

@keyframes streakBeat {
    from { transform: scale(1.15); }
    to   { transform: scale(1.25); }
}

@keyframes pulseDanger {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

/* --- Overlay (Idle / Start) --- */
.game-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 24px;

    background: rgba(11, 18, 32, 0.55);
    backdrop-filter: blur(4px);
}

.game-overlay.hidden {
    display: none;
}

.game-overlay h2 {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    color: var(--text);
    margin: 0;
}

.game-overlay p {
    color: var(--muted);
    max-width: 420px;
    font-size: 0.95rem;
}

/* --- Fistus Köpfe --- */
.fistus {
    position: absolute;
    width: 90px;
    height: 90px;
    cursor: pointer;
    z-index: 3;

    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;

    transform: scale(0);
    transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fistus.show {
    transform: scale(1);
}

.fistus.hide {
    transform: scale(0);
    transition: transform 0.18s ease-in;
}

.fistus.caught {
    animation: caughtPop 0.28s ease-out forwards;
}

@keyframes caughtPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.25) rotate(-8deg); opacity: 0.9; }
    100% { transform: scale(0); opacity: 0; }
}

/* --- Score Pop-Effekt beim Treffer --- */
.score-pop {
    position: absolute;
    color: #38bdf8;
    font-weight: 900;
    font-size: 1.4rem;
    pointer-events: none;
    z-index: 6;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    animation: scoreFloat 0.7s ease-out forwards;
}

.score-pop.bonus {
    color: #fbbf24;
    font-size: 1.7rem;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.6), 0 2px 8px rgba(0, 0, 0, 0.8);
}

.score-pop.bonus-hot {
    color: #ef4444;
    font-size: 2rem;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.7), 0 2px 8px rgba(0, 0, 0, 0.8);
}

@keyframes scoreFloat {
    0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    20%  { transform: translate(-50%, -65%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -130%) scale(1); opacity: 0; }
}

/* --- Game Over Popup (am Killerkeks-Popup orientiert) --- */
.popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 12, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}

.popup-overlay.hidden {
    display: none;
}

.popup-content {
    background: var(--panel);
    border: 2px solid var(--accent);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 85%;
    max-width: 400px;
    box-shadow: 0 0 50px rgba(56, 189, 248, 0.3);
    animation: popupPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupPop {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.popup-content h2 {
    color: var(--accent);
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.popup-content .popup-subtitle {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 18px;
}

.popup-score {
    color: var(--text);
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 6px;
    text-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.popup-score-label {
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 24px;
}

.popup-content .popup-btn {
    padding: 12px 28px;
    background: var(--accent);
    color: #0b1220;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.popup-content .popup-btn:hover {
    transform: scale(1.05);
    background: #67d2fb;
}

/* --- Start-Button: aktiver State während Laufzeit --- */
.startgame.running {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Tablet --- */
@media (max-width: 1024px) {
    .game {
        height: 55vh;
        min-height: 400px;
    }
    .fistus {
        width: 82px;
        height: 82px;
    }
}

/* --- Mobile --- */
@media (max-width: 600px) {
    .game {
        height: 55vh;
        min-height: 320px;
        max-height: 580px;
        margin-top: 16px;
        margin-bottom: 50px;
    }

    .game-hud {
        padding: 10px 12px;
        gap: 8px;
    }
    .hud-label { font-size: 0.6rem; letter-spacing: 0.8px; }
    .hud-value { font-size: 1.3rem; }
    .hud-value.streak-value { font-size: 1.1rem; }
    .hud-value.streak-value.active,
    .hud-value.streak-value.hot { font-size: 1.2rem; }

    .fistus {
        width: 70px;
        height: 70px;
    }

    .popup-content {
        padding: 24px 18px;
    }
    .popup-content h2 { font-size: 1.35rem; }
    .popup-score { font-size: 2.4rem; }
}

/* --- Sehr enge Mobile-Screens --- */
@media (max-width: 400px) {
    .game {
        min-height: 300px;
    }
    .game-hud {
        padding: 8px 10px;
        gap: 6px;
    }
    .hud-value { font-size: 1.15rem; }
    .hud-value.streak-value { font-size: 1rem; }
    .fistus {
        width: 64px;
        height: 64px;
    }
}
