/**
 * dadjokes.css - Dad Jokes game styles
 */

/* ======== Base (overrides game-common.css) ======== */
body {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    overflow: hidden;
    touch-action: none;
}

/* ======== Keyframes ======== */
@keyframes wobble {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

@keyframes groanPop {
    0% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); opacity: 0; }
}

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

@keyframes bounceEmoji {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-30px) rotate(-10deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-20px) rotate(10deg); }
}

@keyframes vortexSpin {
    from { transform: rotate(0deg) scale(1); }
    to { transform: rotate(720deg) scale(3); }
}

@keyframes suckIn {
    0% { opacity: 1; }
    100% { opacity: 0; transform: scale(0) rotate(720deg); }
}

@keyframes bonusFloat {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-100px); opacity: 0; }
}

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

/* ======== Header (overrides game-common.css) ======== */
.header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1001;
}

.header h1 {
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.1s;
}

.header h1.pulse {
    animation: titlePulse 0.2s ease;
}

.header-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 10px 15px;
    font-size: 1rem;
    font-weight: bold;
    color: #ff6b6b;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s;
}

.header-btn:hover {
    transform: scale(1.05);
}

/* ======== Stats Bar (overrides game-common.css) ======== */
.stats {
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
}

.stats .score,
.stats .lives {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.stats .lives {
    font-size: 1.5rem;
    letter-spacing: 5px;
}

.stats .level {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.stats .level .dad-mode {
    color: gold;
    text-transform: uppercase;
}

/* ======== Game Area ======== */
.game-area {
    position: relative;
    width: 100%;
    height: calc(100vh - 160px);
    overflow: hidden;
}

/* ======== Player ======== */
.player {
    position: absolute;
    font-size: 3rem;
    transform: translate(-50%, -50%);
    transition: left 0.15s ease-out, top 0.15s ease-out;
    z-index: 50;
    pointer-events: none;
}

.player.hit {
    animation: flash 0.3s ease 3;
}

/* ======== Groan Effect ======== */
.groan-effect {
    position: absolute;
    font-size: 4rem;
    pointer-events: none;
    animation: groanPop 0.6s ease-out forwards;
    z-index: 60;
}

/* ======== Joke Bubbles ======== */
.joke-bubble {
    position: absolute;
    background: white;
    border-radius: 15px;
    padding: 10px 15px;
    max-width: 180px;
    font-size: 0.85rem;
    color: #333;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: wobble 0.5s ease-in-out infinite;
    z-index: 40;
    pointer-events: none;
}

/* Speech bubble pointers */
.joke-bubble::after {
    content: '';
    position: absolute;
    border: 10px solid transparent;
}

.joke-bubble.from-top::after {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: white;
}

.joke-bubble.from-left::after {
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: white;
}

.joke-bubble.from-right::after {
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: white;
}

.joke-bubble.sucking {
    animation: suckIn 0.5s ease-in forwards !important;
}

/* Joke Types */
.joke-bubble.groaner {
    background: #fffacd;
}

.joke-bubble.groaner.from-top::after {
    border-top-color: #fffacd;
}

.joke-bubble.groaner.from-left::after {
    border-left-color: #fffacd;
}

.joke-bubble.groaner.from-right::after {
    border-right-color: #fffacd;
}

.joke-bubble.zinger {
    background: #ffcccb;
}

.joke-bubble.zinger.from-top::after {
    border-top-color: #ffcccb;
}

.joke-bubble.zinger.from-left::after {
    border-left-color: #ffcccb;
}

.joke-bubble.zinger.from-right::after {
    border-right-color: #ffcccb;
}

/* ======== Overlays (overrides game-common.css) ======== */
.overlay {
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.overlay h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.overlay p {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 15px;
    max-width: 400px;
}

.overlay .controls {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-top: 10px;
}

.overlay button {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    border: none;
    padding: 15px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    border-radius: 30px;
    cursor: pointer;
    margin: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.overlay button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.overlay button.secondary {
    background: rgba(255, 255, 255, 0.2);
    font-size: 1rem;
    padding: 12px 25px;
}

/* ======== Game Over Screen ======== */
.killer-joke {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    max-width: 350px;
    text-align: center;
}

.killer-joke .question {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 10px;
}

.killer-joke .answer {
    font-size: 1rem;
    color: #ff6b6b;
    font-weight: bold;
}

.rank-display {
    color: gold;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 15px;
}

/* ======== Level Complete Screen ======== */
.level-countdown {
    font-size: 4rem;
    color: white;
    font-weight: bold;
    margin-top: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

/* ======== Easter Egg: Dad Laugh ======== */
.dad-laugh-overlay {
    background: rgba(0, 0, 0, 0.9);
}

.dad-laugh-overlay .got-you-text {
    font-size: 3rem;
    color: white;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

.dad-laugh-overlay .bouncing-emoji {
    font-size: 5rem;
    animation: bounceEmoji 0.5s ease infinite;
    margin-top: 20px;
}

/* ======== Easter Egg: Vortex ======== */
.vortex-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
}

.vortex-container.hidden {
    display: none;
}

.vortex-emoji {
    font-size: 5rem;
    animation: vortexSpin 1s ease-in-out;
}

.vortex-bonus {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: bold;
    color: gold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    animation: bonusFloat 1.5s ease-out forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

.vortex-bonus.show {
    opacity: 1;
}

/* ======== Power-Ups ======== */
.powerup {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    z-index: 45;
    pointer-events: none;
    animation: powerupPulse 1s ease-in-out infinite;
}

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

/* Shield effect on player */
.player.shielded {
    filter: drop-shadow(0 0 10px #4fc3f7) drop-shadow(0 0 20px #4fc3f7);
}

/* Slow-mo overlay */
.game-area.slowmo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(156, 39, 176, 0.1);
    pointer-events: none;
    z-index: 5;
}

/* Speed boost effect */
.player.speed-boost {
    filter: drop-shadow(5px 0 0 rgba(255, 235, 59, 0.5))
            drop-shadow(10px 0 0 rgba(255, 235, 59, 0.3));
}

/* Power-up popup */
.powerup-popup {
    position: absolute;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: powerupPopup 1s ease-out forwards;
    z-index: 70;
}

@keyframes powerupPopup {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-60px) scale(1.2); opacity: 0; }
}

/* ======== Screen Shake ======== */
@keyframes subtleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes intenseShake {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-5px, -3px); }
    40% { transform: translate(5px, 3px); }
    60% { transform: translate(-3px, 5px); }
    80% { transform: translate(3px, -5px); }
}

.game-area.low-health {
    animation: subtleShake 0.15s ease infinite;
}

.game-area.groan-overload {
    animation: intenseShake 0.5s ease;
}

/* ======== Groan Meter ======== */
.groan-meter-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 20px;
    background: rgba(0, 0, 0, 0.15);
}

.groan-meter-label {
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    min-width: 50px;
}

.groan-meter-bar {
    flex: 1;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
    max-width: 200px;
}

.groan-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4caf50, #ff9800, #f44336);
    transition: width 0.3s ease;
    border-radius: 6px;
}

/* ======== Combo Display ======== */
.combo-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 5px;
}

.combo-multiplier {
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.combo-multiplier.glowing {
    color: #ffeb3b;
    text-shadow: 0 0 10px #ffeb3b, 0 0 20px #ff9800;
    animation: comboGlow 0.5s ease infinite alternate;
}

@keyframes comboGlow {
    from { text-shadow: 0 0 10px #ffeb3b, 0 0 20px #ff9800; }
    to { text-shadow: 0 0 20px #ffeb3b, 0 0 40px #ff9800; }
}

.combo-streak {
    font-size: 1rem;
    color: #ff9800;
}

/* ======== Boss System ======== */
.boss-bubble {
    position: absolute;
    background: linear-gradient(135deg, #ff6b6b, #ff9a56);
    border-radius: 25px;
    padding: 25px 35px;
    max-width: 300px;
    font-size: 1.1rem;
    color: white;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.6);
    z-index: 45;
    pointer-events: none;
    animation: bossPulse 1s ease-in-out infinite;
}

@keyframes bossPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(255, 107, 107, 0.6); }
    50% { transform: scale(1.05); box-shadow: 0 0 50px rgba(255, 107, 107, 0.8); }
}

.boss-timer {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 0, 0, 0.8);
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 8px 20px;
    border-radius: 20px;
    z-index: 100;
}

.boss-timer.hidden {
    display: none;
}

/* Active power-up indicator */
.active-powerups {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 5px;
    min-height: 30px;
    background: rgba(0, 0, 0, 0.1);
}

.active-powerup-icon {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 3px 10px;
    font-size: 0.9rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
}

.active-powerup-icon .timer {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ======== Responsive ======== */
@media (max-width: 600px) {
    .header h1 {
        font-size: 1.1rem;
    }

    .header-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .stats .score,
    .stats .lives,
    .stats .level {
        font-size: 1rem;
    }

    .stats .lives {
        font-size: 1.2rem;
        letter-spacing: 3px;
    }

    .player {
        font-size: 2.5rem;
    }

    .joke-bubble {
        max-width: 140px;
        font-size: 0.75rem;
        padding: 8px 12px;
    }

    .overlay h2 {
        font-size: 1.6rem;
    }

    .overlay p {
        font-size: 1rem;
    }

    .overlay button {
        padding: 12px 30px;
        font-size: 1.1rem;
    }

    .killer-joke {
        padding: 15px;
        max-width: 280px;
    }

    .killer-joke .question {
        font-size: 1rem;
    }

    .killer-joke .answer {
        font-size: 0.9rem;
    }
}

/* ======== Reduced Motion ======== */
@media (prefers-reduced-motion: reduce) {
    .joke-bubble {
        animation: none;
    }

    .player {
        transition: none;
    }
}

/* ======== Easter Egg: Crowned Player ======== */
.player.crowned::before {
    content: '\1F451';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
}

/* ======== Zinger Trail Effect ======== */
.joke-bubble.zinger {
    position: relative;
}

.joke-bubble.zinger::before {
    content: '';
    position: absolute;
    top: 0;
    left: -20px;
    width: 40px;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 150, 150, 0.6));
    filter: blur(5px);
    border-radius: 15px 0 0 15px;
    z-index: -1;
}

/* ======== Enhanced Hit Flash ======== */
.game-area.hit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 0, 0, 0.3) 100%);
    pointer-events: none;
    animation: hitFlashAnim 0.4s ease-out forwards;
    z-index: 80;
}

@keyframes hitFlashAnim {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

/* ======== Emoji Explosion Particles ======== */
.emoji-particle {
    position: absolute;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 100;
    animation: emojiExplode 0.8s ease-out forwards;
}

@keyframes emojiExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--end-x), var(--end-y)) scale(0.5);
        opacity: 0;
    }
}

/* ======== Level Celebration Particles ======== */
.level-celebration {
    position: absolute;
    font-size: 1.8rem;
    pointer-events: none;
    z-index: 90;
    animation: celebrationRise 2s ease-out forwards;
}

@keyframes celebrationRise {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translateY(-200px) scale(1.2);
        opacity: 0;
    }
}

/* ======== Mobile Optimization ======== */
@media (max-width: 400px) {
    .stats {
        flex-wrap: wrap;
        font-size: 0.85rem;
        gap: 5px;
    }

    .groan-meter-container {
        flex-wrap: wrap;
        justify-content: center;
        padding: 3px 10px;
    }

    .groan-meter-bar {
        max-width: 150px;
    }

    .active-powerups {
        flex-wrap: wrap;
        gap: 5px;
    }

    .combo-display {
        font-size: 0.95rem;
    }

    .boss-timer {
        font-size: 1rem;
        padding: 5px 15px;
    }
}

@media (max-width: 350px) {
    .stats {
        font-size: 0.75rem;
    }

    .level-display {
        display: none;
    }
}
