/* ============================================
   ZOMBIE SLAYER! - Sunset Siege Theme!
   An arena beat-em-up where Shivanya fights
   zombie hordes in waves to defend the castle.
   Uses sprite sheet images for characters!
   ============================================ */

:root {
    /* Sunset sky colors */
    --sky-top: #3a1a4d;           /* Deep purple at top */
    --sky-mid: #8B3A3A;           /* Dark red in middle */
    --sky-horizon: #E85D04;       /* Bright orange at horizon */
    --sun-color: #FF6D00;         /* Setting sun */

    /* Ground colors */
    --ground-dark: #2a2418;       /* Dark stone */
    --ground-light: #3a3228;      /* Stone highlights */

    /* UI colors */
    --heart-red: #E91E63;         /* Health hearts */
    --treasure-gold: #FFD700;     /* Treasure coins */
    --sword-glow: #00FFFF;        /* Cyan sword glow! */
    --star-gold: #FFD700;         /* Star rating */

    /* Text */
    --text-light: #ffffff;
    --text-mid: #b8a89a;
    --text-dark: #2c1810;

    /* Accent */
    --accent-orange: #E85D04;
    --accent-red: #E91E63;

    /* Game sizing */
    --ground-height: 60px;
    --player-width: 120px;        /* Sprite frame width (scaled) */
    --player-height: 100px;       /* Sprite frame height (scaled) */
}

/* ====== RESET ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
    font-family: 'Nunito', sans-serif;
    color: var(--text-dark);
    /* Dramatic sunset sky gradient */
    background: linear-gradient(180deg,
        var(--sky-top) 0%,
        var(--sky-mid) 40%,
        var(--sky-horizon) 75%,
        #FFB74D 100%
    );
    -webkit-user-select: none;
    user-select: none;
}

/* Material Symbols base style - filled icons */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

/* ============================================
   SCENIC BACKGROUND - Sunset Sky!
   Setting sun, fog, and eerie atmosphere.
   ============================================ */
.scene {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* ====== THE SETTING SUN ====== */
.sun {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle,
        #FFD54F 0%,
        var(--sun-color) 40%,
        rgba(232, 93, 4, 0.5) 70%,
        transparent 100%
    );
    border-radius: 50%;
    box-shadow:
        0 0 60px rgba(255, 109, 0, 0.6),
        0 0 120px rgba(232, 93, 4, 0.3),
        0 0 200px rgba(255, 183, 77, 0.2);
    animation: sunPulse 4s ease-in-out infinite alternate;
}

@keyframes sunPulse {
    from { box-shadow: 0 0 60px rgba(255, 109, 0, 0.6), 0 0 120px rgba(232, 93, 4, 0.3); }
    to { box-shadow: 0 0 80px rgba(255, 109, 0, 0.8), 0 0 160px rgba(232, 93, 4, 0.5); }
}

/* ====== FOG PARTICLES ====== */
.fog {
    position: absolute;
    width: 100%;
    height: 80px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(200, 180, 160, 0.15) 20%,
        rgba(200, 180, 160, 0.25) 50%,
        rgba(200, 180, 160, 0.15) 80%,
        transparent 100%
    );
    animation: fogDrift var(--speed, 20s) linear infinite;
}

.fog-1 { bottom: 15%; --speed: 25s; opacity: 0.6; }
.fog-2 { bottom: 22%; --speed: 35s; opacity: 0.4; animation-delay: -10s; }
.fog-3 { bottom: 10%; --speed: 18s; opacity: 0.3; animation-delay: -5s; }

@keyframes fogDrift {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* ============================================
   CASTLE BACKGROUND
   Dark silhouette in the background.
   ============================================ */
.castle-bg {
    position: fixed;
    bottom: 10%;
    right: 5%;
    width: 200px;
    height: 180px;
    z-index: 1;
    pointer-events: none;
    transform-origin: bottom right;
    transform: scale(0.6);
    transition: transform 0.5s ease-out;
    opacity: 0.7;
}

/* Castle towers - tall dark rectangles */
.castle-tower {
    position: absolute;
    bottom: 0;
    width: 40px;
    background: #1a1020;
    border-radius: 4px 4px 0 0;
}

.tower-left {
    left: 10px;
    height: 160px;
}

.tower-right {
    right: 10px;
    height: 140px;
}

/* Tower tops - little battlements */
.castle-tower::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -4px;
    right: -4px;
    height: 12px;
    background:
        repeating-linear-gradient(
            90deg,
            #1a1020 0px, #1a1020 8px,
            transparent 8px, transparent 12px
        );
}

/* Tower windows - glowing orange */
.castle-tower::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 16px;
    background: rgba(255, 152, 0, 0.6);
    border-radius: 5px 5px 0 0;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.4);
}

/* Castle wall between towers */
.castle-wall {
    position: absolute;
    bottom: 0;
    left: 40px;
    right: 40px;
    height: 100px;
    background: #1a1020;
    border-radius: 3px 3px 0 0;
}

/* Wall battlements on top */
.castle-wall::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 12px;
    background:
        repeating-linear-gradient(
            90deg,
            #1a1020 0px, #1a1020 10px,
            transparent 10px, transparent 15px
        );
}

/* Castle gate - dark archway */
.castle-gate {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 45px;
    background: #0d0815;
    border-radius: 15px 15px 0 0;
    z-index: 2;
}

/* ============================================
   GAME CONTAINER
   ============================================ */
#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    padding: 8px;
    position: relative;
    z-index: 2;
}

/* ====== HUD (Head-Up Display) ====== */
#hud {
    width: 100%;
    max-width: 800px;
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 5;
}

/* Back button */
.back-btn {
    position: absolute;
    left: 8px;
    top: 8px;
    color: var(--text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

/* Mute button */
.mute-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: background 0.2s;
}

.mute-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

/* Game title in the HUD */
.hud-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-title h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.4em;
    color: var(--text-light);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hud-icon {
    font-size: 30px !important;
    color: var(--accent-orange);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Stats bar - dark frosted glass style */
.hud-stats {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    padding: 6px 20px;
    border-radius: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95em;
    font-weight: 700;
    color: var(--text-light);
}

.hud-item .material-symbols-rounded {
    font-size: 20px;
    color: var(--accent-orange);
}

/* Hearts display - special color */
.hearts-display .material-symbols-rounded {
    color: var(--heart-red) !important;
}

/* Wave display - special color */
.wave-display .material-symbols-rounded {
    color: var(--sword-glow) !important;
}

/* Wave progress bar */
.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 300px;
    margin-top: 2px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-orange), var(--treasure-gold));
    border-radius: 4px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.progress-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8em;
    font-weight: 700;
    color: var(--text-light);
    white-space: nowrap;
}

.progress-label .material-symbols-rounded {
    font-size: 18px;
    color: var(--accent-orange);
}

/* ============================================
   GAME AREA - The Arena Battlefield!
   Full arena where the player moves freely.
   ============================================ */
#game-area {
    flex: 1;
    position: relative;
    width: 100%;
    max-width: 800px;
    overflow: hidden;
    z-index: 3;
    border-radius: 12px;
    cursor: pointer;
}

/* ====== DARK STONE GROUND (static, no scrolling) ====== */
#ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--ground-height);
    background: var(--ground-dark);
    /* Static stone texture */
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 38px,
            rgba(255, 255, 255, 0.03) 38px,
            rgba(255, 255, 255, 0.03) 40px
        ),
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 28px,
            rgba(255, 255, 255, 0.02) 28px,
            rgba(255, 255, 255, 0.02) 30px
        );
    background-size: 40px 100%, 100% 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

/* Ground top edge glow */
#ground::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        transparent,
        rgba(232, 93, 4, 0.3),
        rgba(255, 183, 77, 0.2),
        transparent
    );
}

/* ============================================
   PLAYER CHARACTER - Sprite Based!
   Positioned with left/top for free movement.
   ============================================ */
#player {
    position: absolute;
    width: var(--player-width);
    height: var(--player-height);
    z-index: 10;
    /* Default: idle sprite */
    background-image: url('../images/player-idle.png');
    background-size: auto var(--player-height);
    background-repeat: no-repeat;
    background-position: 0 0;
    /* Slight glow around the player for visibility */
    filter: drop-shadow(0 0 4px rgba(0, 255, 255, 0.3));
    image-rendering: auto;
}

/* Flip sprite when facing left */
#player.facing-left {
    transform: scaleX(-1);
}

/* When player takes damage, flash red */
#player.hurt {
    filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.8)) brightness(1.5);
}

/* When player is dead, fade out */
#player.dead {
    opacity: 0;
    transition: opacity 0.3s;
}

/* ============================================
   ZOMBIE ENEMIES - Sprite Based!
   Positioned with left/top for arena movement.
   ============================================ */
.zombie {
    position: absolute;
    width: 80px;
    height: 100px;
    z-index: 8;
    background-size: auto 100%;
    background-repeat: no-repeat;
    background-position: 0 0;
    image-rendering: auto;
}

/* Zombie type 1 (male) */
.zombie.type-1 {
    background-image: url('../images/zombie-walk.png');
}

/* Zombie type 2 (female) */
.zombie.type-2 {
    background-image: url('../images/zombie2-walk.png');
}

/* Flip zombie when facing left (toward player) */
.zombie.facing-left {
    transform: scaleX(-1);
}

/* Dying zombie fades out */
.zombie.dying {
    transition: opacity 0.4s;
    opacity: 0;
}

/* ============================================
   TREASURES - Gold Coins!
   Positioned absolutely in the arena.
   ============================================ */
.treasure {
    position: absolute;
    width: 24px;
    height: 24px;
    z-index: 7;
    background: radial-gradient(circle at 35% 35%,
        #FFF176,
        var(--treasure-gold) 40%,
        #F9A825 80%
    );
    border-radius: 50%;
    box-shadow:
        0 0 8px rgba(255, 215, 0, 0.5),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    animation: coinBob 1s ease-in-out infinite alternate;
}

/* Dollar sign on coin */
.treasure::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border: 2px solid rgba(180, 130, 0, 0.6);
    border-radius: 50%;
}

@keyframes coinBob {
    from { transform: translateY(0px); }
    to { transform: translateY(-6px); }
}

/* Coin collect animation */
.treasure.collected {
    animation: coinCollect 0.3s ease-out forwards;
}

@keyframes coinCollect {
    to {
        transform: translateY(-30px) scale(0);
        opacity: 0;
    }
}

/* ============================================
   SLASH PARTICLES - Sword Attack Effect
   ============================================ */
.slash-particle {
    position: absolute;
    width: 40px;
    height: 4px;
    background: linear-gradient(90deg,
        transparent,
        var(--sword-glow),
        transparent
    );
    border-radius: 2px;
    z-index: 15;
    animation: slashFade 0.3s ease-out forwards;
    box-shadow: 0 0 8px var(--sword-glow);
}

@keyframes slashFade {
    0% {
        opacity: 1;
        transform: rotate(var(--angle, 0deg)) scaleX(0.5);
    }
    100% {
        opacity: 0;
        transform: rotate(var(--angle, 0deg)) scaleX(1.5) translateX(20px);
    }
}

/* ============================================
   WAVE BANNER - Shows between waves!
   Big centered text: "WAVE 3!"
   ============================================ */
#wave-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Fredoka One', cursive;
    font-size: 3em;
    color: var(--treasure-gold);
    text-shadow:
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 40px rgba(232, 93, 4, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 40;
    pointer-events: none;
    animation: waveBannerIn 0.5s ease-out;
}

#wave-banner.hidden {
    display: none;
}

@keyframes waveBannerIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    60% {
        transform: translate(-50%, -50%) scale(1.15);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes waveBannerOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

/* ============================================
   OVERLAY SCREENS
   Dark frosted glass style for sunset theme.
   ============================================ */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 16, 32, 0.88);
    backdrop-filter: blur(10px);
    z-index: 50;
    animation: fadeIn 0.4s ease-out;
}

.overlay.hidden { display: none; }

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

.overlay-box {
    background: linear-gradient(160deg, #2a1830, #1e1225);
    border: 2px solid rgba(232, 93, 4, 0.3);
    border-radius: 28px;
    padding: 36px 32px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(232, 93, 4, 0.1);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.overlay-icon {
    font-size: 72px !important;
    display: block;
    margin-bottom: 12px;
}

.start-icon {
    color: var(--accent-orange);
    filter: drop-shadow(0 3px 8px rgba(232, 93, 4, 0.4));
    animation: iconBounce 2s ease-in-out infinite;
}

.crown-icon {
    color: var(--treasure-gold);
    filter: drop-shadow(0 3px 8px rgba(255, 215, 0, 0.5));
    animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.overlay-box h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.9em;
    margin-bottom: 8px;
    color: var(--text-light);
}

.gameover-box h2 {
    color: var(--heart-red);
}

.win-box h2 {
    color: var(--treasure-gold);
}

.overlay-box p {
    color: var(--text-mid);
    margin-bottom: 8px;
}

.story-text {
    font-size: 0.95em;
    line-height: 1.5;
}

/* ====== CONTROLS HELP ====== */
.controls-help {
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.help-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--text-mid);
}

.help-row .material-symbols-rounded {
    font-size: 20px;
    color: var(--accent-orange);
}

/* ====== DIFFICULTY SELECTOR ====== */
.difficulty-selector {
    margin: 16px 0 8px;
}

.difficulty-label {
    font-family: 'Fredoka One', cursive;
    font-size: 1em;
    color: var(--text-light) !important;
    margin-bottom: 10px !important;
}

.difficulty-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.diff-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 18px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s;
}

.diff-btn .material-symbols-rounded {
    font-size: 28px;
}

.diff-btn:hover {
    background: rgba(232, 93, 4, 0.15);
    border-color: rgba(232, 93, 4, 0.3);
}

.diff-btn.active {
    background: linear-gradient(135deg, var(--accent-orange), #BF360C);
    border-color: rgba(232, 93, 4, 0.5);
    color: white;
    box-shadow: 0 4px 15px rgba(232, 93, 4, 0.4);
}

/* High score display on start screen */
.high-score-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: rgba(255, 215, 0, 0.15);
    border-radius: 20px;
    font-weight: 700;
    color: var(--treasure-gold);
    margin-bottom: 8px;
}

.high-score-box .material-symbols-rounded {
    font-size: 22px;
    color: var(--star-gold);
}

.high-score-box.hidden { display: none; }

/* ====== STARS DISPLAY ====== */
.stars-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.star-icon {
    font-size: 50px !important;
    color: rgba(255, 255, 255, 0.1);
    transition: color 0.3s, transform 0.5s;
}

.star-icon.earned {
    color: var(--star-gold);
    filter: drop-shadow(0 2px 8px rgba(255, 193, 7, 0.5));
    animation: starPop 0.5s ease-out backwards;
}

@keyframes starPop {
    0% { transform: scale(0) rotate(-45deg); }
    70% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0); }
}

/* Score summary */
.score-summary {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: var(--text-light);
}

.score-item .material-symbols-rounded {
    font-size: 22px;
    color: var(--accent-orange);
}

/* New best score badge */
.new-best {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--star-gold), #FF8F00);
    border-radius: 20px;
    font-family: 'Fredoka One', cursive;
    font-size: 1em;
    color: white;
    margin-bottom: 8px;
    animation: newBestPulse 1s ease-in-out infinite;
}

.new-best.hidden { display: none; }

.new-best .material-symbols-rounded {
    font-size: 22px;
}

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

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

/* ====== BUTTONS ====== */
.game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 18px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.15em;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
    margin-top: 8px;
}

.game-btn:hover { transform: translateY(-2px); }
.game-btn:active { transform: translateY(0); }

/* Orange gradient button - matches sunset theme */
.primary-btn {
    background: linear-gradient(135deg, var(--accent-orange), #BF360C);
    color: white;
    box-shadow: 0 4px 18px rgba(232, 93, 4, 0.4);
}

.primary-btn:hover {
    box-shadow: 0 6px 24px rgba(232, 93, 4, 0.6);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-mid);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ====== PARTICLES ====== */
#particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: particleBurst var(--duration) ease-out forwards;
}

.particle.sparkle {
    border-radius: 2px;
    transform: rotate(45deg);
}

@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0) rotate(var(--rot, 180deg));
        opacity: 0;
    }
}

/* ============================================
   MOBILE D-PAD CONTROLS
   Direction pad on left, attack button on right.
   Only shown on touch devices.
   ============================================ */
.mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    pointer-events: none;
    padding: 16px;
}

.mobile-controls.hidden {
    display: none;
}

/* D-pad container - grid layout */
.dpad {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: grid;
    grid-template-areas:
        ".    up   ."
        "left .    right"
        ".    down .";
    grid-template-columns: 52px 52px 52px;
    grid-template-rows: 52px 52px 52px;
    gap: 4px;
    pointer-events: auto;
}

.dpad-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    color: white;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.dpad-btn:active {
    background: rgba(232, 93, 4, 0.5);
    border-color: rgba(232, 93, 4, 0.6);
}

.dpad-btn .material-symbols-rounded {
    font-size: 26px;
}

.dpad-up    { grid-area: up; }
.dpad-left  { grid-area: left; }
.dpad-right { grid-area: right; }
.dpad-down  { grid-area: down; }

/* Attack button - big circle on the right */
.mobile-attack-btn {
    position: fixed;
    bottom: 40px;
    right: 20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(0, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    color: var(--sword-glow);
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
}

.mobile-attack-btn:active {
    background: rgba(0, 255, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.mobile-attack-btn .material-symbols-rounded {
    font-size: 36px;
}

/* ============================================
   HERO CREDIT BADGE
   ============================================ */
.created-by {
    text-align: center;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2em;
    margin: 12px auto;
    padding: 10px 28px;
    color: #fff;
    background: linear-gradient(135deg, #E91E63, #FF4081, #F50057);
    border-radius: 30px;
    display: block;
    width: fit-content;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 4;
    position: relative;
    animation: createdByGlow 2s ease-in-out infinite alternate;
}

@keyframes createdByGlow {
    from { box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4); }
    to   { box-shadow: 0 4px 25px rgba(233, 30, 99, 0.7), 0 0 40px rgba(255, 64, 129, 0.3); }
}

/* ============================================
   RESPONSIVE DESIGN
   Works on phones, tablets, and big screens!
   ============================================ */

/* Mobile phones */
@media (max-width: 480px) {
    :root {
        --ground-height: 45px;
        --player-width: 85px;
        --player-height: 70px;
    }
    #hud { padding: 4px 8px; }
    .hud-title h1 { font-size: 1em; }
    .hud-stats { gap: 10px; font-size: 0.85em; padding: 4px 12px; }
    .overlay-box { padding: 24px 20px; }
    .overlay-box h2 { font-size: 1.4em; }
    .zombie { width: 55px; height: 70px; }
    .treasure { width: 18px; height: 18px; }
    .sun { width: 80px; height: 80px; }
    .progress-bar-container { max-width: 200px; }
    #wave-banner { font-size: 2em; }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
    :root {
        --ground-height: 50px;
        --player-width: 100px;
        --player-height: 85px;
    }
    .zombie { width: 70px; height: 85px; }
}

/* Large tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --ground-height: 55px;
        --player-width: 110px;
        --player-height: 90px;
    }
    .zombie { width: 75px; height: 90px; }
}

/* Desktop */
@media (min-width: 1025px) {
    :root {
        --ground-height: 60px;
        --player-width: 120px;
        --player-height: 100px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --ground-height: 40px;
        --player-width: 75px;
        --player-height: 65px;
    }
    #hud { padding: 2px 8px; }
    .hud-title h1 { font-size: 0.9em; }
    .hud-stats { padding: 3px 10px; }
    .zombie { width: 50px; height: 65px; }
    .progress-bar-container { max-width: 180px; }
    #wave-banner { font-size: 2em; }
    .dpad { bottom: 10px; left: 10px; }
    .dpad-btn { width: 42px; height: 42px; }
    .dpad { grid-template-columns: 42px 42px 42px; grid-template-rows: 42px 42px 42px; }
    .mobile-attack-btn { width: 60px; height: 60px; bottom: 20px; right: 10px; }
}
