/* ============================================
   Ninja Shadow Strike - Stylesheet
   A ninja action game by Shivanya!
   ============================================ */

/* Fun fonts from Google */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700&display=swap');

/* ---- CSS Variables for easy color changes ---- */
:root {
    /* Sky and scene colors */
    --sky-top: #0a0a2e;
    --sky-mid: #1a1a4e;
    --sky-bottom: #2a1a3e;
    --moon-color: #f0e6d3;
    --star-color: #ffffff;
    --ground-color: #2a1a1a;
    --ground-light: #3a2a2a;

    /* Character colors */
    --ninja-body: #1a1a2e;
    --ninja-mask: #2a2a4e;
    --ninja-eyes: #00ffff;
    --ninja-katana: #c0c0c0;
    --ninja-katana-glow: #00ffff;

    --soldier-body: #8b2020;
    --soldier-head: #3a2020;
    --soldier-sword: #a0a0a0;

    --archer-body: #2a6b2a;
    --archer-head: #1a4a1a;
    --archer-bow: #8b6914;

    --guard-body: #2a4a8b;
    --guard-head: #3a3a6a;
    --guard-shield: #a0a0c0;

    /* UI colors */
    --heart-red: #E91E63;
    --score-gold: #FFD700;
    --combo-gold: #FFD700;
    --shuriken-cyan: #00ffff;
    --dash-purple: #bb86fc;
    --star-gold: #FFD700;

    /* HUD glass */
    --glass-bg: rgba(10, 10, 46, 0.7);
    --glass-border: rgba(255, 255, 255, 0.15);
}

/* ---- Reset and base styles ---- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-bottom) 100%);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

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

/* ============================================
   SCENE - Night sky background
   ============================================ */

/* The big glowing moon */
.moon {
    position: fixed;
    top: 8%;
    right: 15%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--moon-color) 60%, transparent 100%);
    box-shadow: 0 0 40px 15px rgba(240, 230, 211, 0.3),
                0 0 80px 30px rgba(240, 230, 211, 0.1);
    z-index: 0;
    animation: moonPulse 4s ease-in-out infinite alternate;
}

@keyframes moonPulse {
    from { box-shadow: 0 0 40px 15px rgba(240, 230, 211, 0.3), 0 0 80px 30px rgba(240, 230, 211, 0.1); }
    to   { box-shadow: 0 0 50px 20px rgba(240, 230, 211, 0.4), 0 0 100px 40px rgba(240, 230, 211, 0.15); }
}

/* Twinkling stars in the sky */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    z-index: 0;
    pointer-events: none;
}

.star-dot {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--star-color);
    border-radius: 50%;
    animation: twinkle 2s ease-in-out infinite alternate;
}

.star-dot:nth-child(1) { top: 5%; left: 10%; animation-delay: 0s; }
.star-dot:nth-child(2) { top: 12%; left: 30%; animation-delay: 0.5s; }
.star-dot:nth-child(3) { top: 8%; left: 55%; animation-delay: 1s; }
.star-dot:nth-child(4) { top: 20%; left: 75%; animation-delay: 0.3s; }
.star-dot:nth-child(5) { top: 15%; left: 90%; animation-delay: 0.8s; }
.star-dot:nth-child(6) { top: 25%; left: 20%; animation-delay: 1.2s; }
.star-dot:nth-child(7) { top: 3%; left: 45%; animation-delay: 0.6s; }
.star-dot:nth-child(8) { top: 18%; left: 65%; animation-delay: 0.9s; }

@keyframes twinkle {
    from { opacity: 0.3; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1.2); }
}

/* Temple silhouette in the background */
.temple {
    position: fixed;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 120px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.15;
}

/* Temple base */
.temple::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 60px;
    background: #1a0a2a;
    clip-path: polygon(5% 100%, 0% 0%, 100% 0%, 95% 100%);
}

/* Temple roof */
.temple::after {
    content: '';
    position: absolute;
    bottom: 55px;
    left: 0;
    width: 100%;
    height: 65px;
    background: #1a0a2a;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

/* Bamboo stalks on the sides */
.bamboo {
    position: fixed;
    bottom: 18%;
    width: 8px;
    height: 200px;
    background: linear-gradient(180deg, #1a3a1a 0%, #0a2a0a 100%);
    z-index: 0;
    opacity: 0.2;
    pointer-events: none;
}

.bamboo::before {
    content: '';
    position: absolute;
    top: -30px;
    left: -12px;
    width: 32px;
    height: 40px;
    background: #1a3a1a;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.bamboo-left { left: 5%; }
.bamboo-right { right: 5%; }

/* Cherry blossom petals floating down */
.cherry-petal {
    position: fixed;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #ffb7c5 40%, #ff69b4 100%);
    border-radius: 50% 0 50% 0;
    opacity: 0.6;
    z-index: 0;
    pointer-events: none;
    animation: petalFall linear infinite;
}

.cherry-petal:nth-child(1) { left: 10%; animation-duration: 8s; animation-delay: 0s; }
.cherry-petal:nth-child(2) { left: 25%; animation-duration: 10s; animation-delay: 2s; width: 6px; height: 6px; }
.cherry-petal:nth-child(3) { left: 40%; animation-duration: 9s; animation-delay: 4s; }
.cherry-petal:nth-child(4) { left: 60%; animation-duration: 11s; animation-delay: 1s; width: 7px; height: 7px; }
.cherry-petal:nth-child(5) { left: 75%; animation-duration: 7s; animation-delay: 3s; }
.cherry-petal:nth-child(6) { left: 90%; animation-duration: 12s; animation-delay: 5s; width: 5px; height: 5px; }

@keyframes petalFall {
    0%   { transform: translateY(-20px) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.6; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

/* ============================================
   HEADER - Top HUD bar
   ============================================ */

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

/* Back button to return to portal */
.back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.back-btn .material-symbols-rounded {
    font-size: 20px;
}

/* Game title in the header */
.game-title {
    font-family: 'Fredoka One', cursive;
    color: white;
    font-size: 1.1em;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-title .material-symbols-rounded {
    font-size: 22px;
    color: var(--ninja-eyes);
}

/* Mute button */
.mute-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.mute-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mute-btn .material-symbols-rounded {
    font-size: 22px;
}

/* ============================================
   STATS BAR - Hearts, wave, score, combo
   ============================================ */

.stats-bar {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9em;
    color: white;
}

/* Hearts display */
.hearts {
    display: flex;
    gap: 2px;
    align-items: center;
}

.hearts .material-symbols-rounded {
    font-size: 22px;
    color: var(--heart-red);
    filter: drop-shadow(0 0 3px rgba(233, 30, 99, 0.5));
}

.hearts .material-symbols-rounded.lost {
    opacity: 0.2;
    filter: none;
}

/* Wave and score displays */
.wave-display,
.score-display {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wave-display .material-symbols-rounded {
    font-size: 18px;
    color: var(--shuriken-cyan);
}

.score-display .material-symbols-rounded {
    font-size: 18px;
    color: var(--score-gold);
}

/* Combo indicator */
.combo-display {
    font-family: 'Fredoka One', cursive;
    color: var(--combo-gold);
    font-size: 1em;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s;
}

.combo-display.active {
    opacity: 1;
    animation: comboPulse 0.3s ease;
}

@keyframes comboPulse {
    0% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* Best score display */
.best-display {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 3px;
}

.best-display .material-symbols-rounded {
    font-size: 16px;
    color: var(--score-gold);
    opacity: 0.6;
}

/* ============================================
   ABILITY BAR - Shurikens and dash cooldown
   ============================================ */

.ability-bar {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 0.8em;
    color: white;
}

/* Shuriken ammo display */
.shuriken-ammo {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--shuriken-cyan);
}

.shuriken-ammo .material-symbols-rounded {
    font-size: 18px;
}

.ammo-dots {
    display: flex;
    gap: 3px;
}

.ammo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--shuriken-cyan);
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 0 4px rgba(0, 255, 255, 0.5);
}

.ammo-dot.used {
    opacity: 0.2;
    transform: scale(0.6);
    box-shadow: none;
}

/* Dash cooldown bar */
.dash-cooldown {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--dash-purple);
}

.dash-cooldown .material-symbols-rounded {
    font-size: 18px;
}

.cooldown-bar {
    width: 50px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.cooldown-fill {
    width: 100%;
    height: 100%;
    background: var(--dash-purple);
    border-radius: 3px;
    transition: width 0.1s linear;
    box-shadow: 0 0 4px rgba(187, 134, 252, 0.5);
}

/* ============================================
   GAME AREA - Where the action happens
   ============================================ */

.game-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Ground area */
.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 22%;
    background: linear-gradient(180deg, var(--ground-color) 0%, #1a0a0a 100%);
    border-top: 2px solid rgba(100, 60, 60, 0.4);
    z-index: 1;
}

/* Stone tile pattern on the ground */
.ground::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 58px,
        rgba(255, 255, 255, 0.03) 58px,
        rgba(255, 255, 255, 0.03) 60px
    );
}

/* ============================================
   PLAYER - CSS-only ninja character
   ============================================ */

.player {
    position: absolute;
    width: 40px;
    height: 56px;
    z-index: 50;
    transition: none;
}

/* Ninja body */
.player::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    width: 24px;
    height: 40px;
    background: var(--ninja-body);
    border-radius: 4px 4px 2px 2px;
    box-shadow: inset 0 0 6px rgba(0, 255, 255, 0.1);
}

/* Ninja head with mask and eyes */
.player::after {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    width: 20px;
    height: 18px;
    background: var(--ninja-mask);
    border-radius: 6px 6px 4px 4px;
    /* The glowing cyan eyes */
    box-shadow: inset -12px -5px 0 1px var(--ninja-eyes),
                inset -5px -5px 0 1px var(--ninja-eyes),
                0 0 8px rgba(0, 255, 255, 0.3);
}

/* Facing left - flip the ninja */
.player.facing-left {
    transform: scaleX(-1);
}

/* Player hurt flash */
.player.hurt::before,
.player.hurt::after {
    animation: hurtFlash 0.1s ease infinite;
}

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

/* Katana blade */
.katana {
    position: absolute;
    top: 12px;
    right: -18px;
    width: 22px;
    height: 4px;
    background: linear-gradient(90deg, #888, var(--ninja-katana));
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transform-origin: left center;
    z-index: 51;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.4);
}

/* Show katana during attack */
.player.attacking .katana {
    opacity: 1;
    animation: katanaSwing 0.25s ease-out;
}

@keyframes katanaSwing {
    0%   { transform: rotate(-60deg); }
    50%  { transform: rotate(40deg); }
    100% { transform: rotate(0deg); }
}

/* Flip katana to left when facing left */
.player.facing-left .katana {
    right: auto;
    left: -18px;
    transform-origin: right center;
}

/* Dash trail effect */
.player.dashing {
    filter: brightness(1.5) drop-shadow(0 0 10px rgba(187, 134, 252, 0.8));
}

.player.dashing::before {
    box-shadow: inset 0 0 10px rgba(187, 134, 252, 0.4);
}

/* ============================================
   ENEMIES - CSS-only enemy characters
   ============================================ */

.enemy {
    position: absolute;
    width: 36px;
    height: 50px;
    z-index: 10;
    transition: none;
}

/* --- Sword Soldier (Red) --- */
.enemy.soldier::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 6px;
    width: 24px;
    height: 34px;
    background: var(--soldier-body);
    border-radius: 3px 3px 2px 2px;
}

.enemy.soldier::after {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    width: 20px;
    height: 18px;
    background: var(--soldier-head);
    border-radius: 4px;
    /* Small eyes */
    box-shadow: inset -12px -5px 0 1px #ff6666,
                inset -5px -5px 0 1px #ff6666;
}

/* Soldier's sword */
.enemy.soldier .enemy-weapon {
    position: absolute;
    top: 14px;
    right: -10px;
    width: 14px;
    height: 3px;
    background: var(--soldier-sword);
    border-radius: 0 1px 1px 0;
    box-shadow: 0 0 3px rgba(160, 160, 160, 0.3);
}

/* --- Archer (Green) --- */
.enemy.archer::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 6px;
    width: 24px;
    height: 34px;
    background: var(--archer-body);
    border-radius: 3px 3px 2px 2px;
}

.enemy.archer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    width: 20px;
    height: 18px;
    background: var(--archer-head);
    border-radius: 8px 8px 4px 4px;
    /* Hooded appearance with orange eyes */
    box-shadow: inset -12px -5px 0 1px #66ff66,
                inset -5px -5px 0 1px #66ff66;
}

/* Archer's bow */
.enemy.archer .enemy-weapon {
    position: absolute;
    top: 10px;
    right: -8px;
    width: 6px;
    height: 20px;
    border: 2px solid var(--archer-bow);
    border-left: none;
    border-radius: 0 10px 10px 0;
    background: transparent;
}

/* --- Shield Guard (Blue) --- */
.enemy.guard::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 6px;
    width: 24px;
    height: 34px;
    background: var(--guard-body);
    border-radius: 3px 3px 2px 2px;
}

.enemy.guard::after {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    width: 20px;
    height: 18px;
    background: var(--guard-head);
    border-radius: 2px 2px 4px 4px;
    /* Helmeted look with yellow eyes */
    box-shadow: inset -12px -5px 0 1px #6666ff,
                inset -5px -5px 0 1px #6666ff;
}

/* Guard's shield */
.enemy.guard .enemy-weapon {
    position: absolute;
    top: 8px;
    left: -6px;
    width: 10px;
    height: 24px;
    background: var(--guard-shield);
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 6px rgba(160, 160, 192, 0.3);
}

/* Shield on the front side - flips with facing direction */
.enemy.facing-left .enemy-weapon {
    left: auto;
    right: -6px;
}

/* Enemy facing left */
.enemy.facing-left {
    transform: scaleX(-1);
}

/* Enemy death animation */
.enemy.dead {
    animation: enemyDeath 0.4s ease-out forwards;
    pointer-events: none;
}

@keyframes enemyDeath {
    0%   { opacity: 1; transform: scale(1); }
    50%  { opacity: 0.5; transform: scale(1.1); filter: brightness(2); }
    100% { opacity: 0; transform: scale(0.3) translateY(20px); }
}

/* Shield block flash */
.enemy.blocked {
    animation: shieldBlock 0.2s ease;
}

@keyframes shieldBlock {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(2); }
}

/* ============================================
   PROJECTILES - Shurikens and arrows
   ============================================ */

/* Shuriken - spinning 4-pointed star */
.shuriken {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--shuriken-cyan);
    clip-path: polygon(
        50% 0%, 60% 40%, 100% 50%, 60% 60%,
        50% 100%, 40% 60%, 0% 50%, 40% 40%
    );
    z-index: 30;
    animation: shurikenSpin 0.3s linear infinite;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    filter: drop-shadow(0 0 4px rgba(0, 255, 255, 0.8));
}

@keyframes shurikenSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Arrow projectile from archers */
.arrow {
    position: absolute;
    width: 18px;
    height: 3px;
    background: #8b6914;
    z-index: 25;
    border-radius: 1px;
}

/* Arrow tip */
.arrow::after {
    content: '';
    position: absolute;
    right: -5px;
    top: -2px;
    width: 0;
    height: 0;
    border-left: 7px solid #666;
    border-top: 3.5px solid transparent;
    border-bottom: 3.5px solid transparent;
}

/* Arrow facing left */
.arrow.arrow-left {
    transform: scaleX(-1);
}

/* Kunai - fast piercing throwing knife */
.kunai {
    position: absolute;
    width: 20px;
    height: 4px;
    z-index: 30;
    pointer-events: none;
}

/* Kunai blade - triangular shape */
.kunai::before {
    content: '';
    position: absolute;
    right: 0;
    top: -2px;
    width: 0;
    height: 0;
    border-left: 12px solid #d4af37;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    filter: drop-shadow(0 0 3px rgba(212, 175, 55, 0.6));
}

/* Kunai handle */
.kunai::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 10px;
    height: 4px;
    background: #8b4513;
    border-radius: 1px;
}

/* Kunai facing left */
.kunai.kunai-left {
    transform: scaleX(-1);
}

/* Kunai ammo dots are gold colored */
.ammo-dot.kunai-dot {
    background: #d4af37;
    box-shadow: 0 0 4px rgba(212, 175, 55, 0.5);
}

.ammo-dot.kunai-dot.used {
    box-shadow: none;
}

/* Kunai ammo display icon color */
.kunai-ammo-display {
    color: #d4af37 !important;
}

/* Smoke cloud visual effect */
.smoke-cloud {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(128, 128, 128, 0.6) 0%, rgba(80, 80, 80, 0.3) 50%, transparent 70%);
    z-index: 40;
    pointer-events: none;
    animation: smokeExpand 1s ease-out forwards;
}

@keyframes smokeExpand {
    0%   { opacity: 0; transform: scale(0.2); }
    20%  { opacity: 0.8; transform: scale(0.8); }
    100% { opacity: 0; transform: scale(1.3); }
}

/* Stunned enemy visual - they turn gray and wobble */
.enemy.stunned::before {
    filter: grayscale(0.7) brightness(0.7);
}

.enemy.stunned::after {
    filter: grayscale(0.7) brightness(0.7);
}

.enemy.stunned {
    animation: stunWobble 0.3s ease-in-out infinite;
}

@keyframes stunWobble {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.enemy.stunned.facing-left {
    animation: stunWobbleLeft 0.3s ease-in-out infinite;
}

@keyframes stunWobbleLeft {
    0%, 100% { transform: scaleX(-1) rotate(-3deg); }
    50% { transform: scaleX(-1) rotate(3deg); }
}

/* Smoke cooldown bar is gray/purple */
.smoke-fill {
    background: #888;
    box-shadow: 0 0 4px rgba(128, 128, 128, 0.5);
}

.smoke-cd-display {
    color: #aaa !important;
}

/* ============================================
   SLASH PARTICLES - Katana attack effects
   ============================================ */

.slash-particle {
    position: absolute;
    width: 30px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--ninja-katana-glow), transparent);
    border-radius: 2px;
    z-index: 55;
    pointer-events: none;
    opacity: 0;
    animation: slashFade 0.3s ease-out forwards;
    transform-origin: center;
}

@keyframes slashFade {
    0%   { opacity: 0.9; transform: scaleX(0.5) rotate(var(--slash-angle, 0deg)); }
    50%  { opacity: 0.6; transform: scaleX(1.5) rotate(var(--slash-angle, 0deg)); }
    100% { opacity: 0; transform: scaleX(2) rotate(var(--slash-angle, 0deg)) translateX(var(--slash-dir, 20px)); }
}

/* Death explosion particles */
.death-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    z-index: 60;
    pointer-events: none;
    animation: deathBurst 0.6s ease-out forwards;
}

@keyframes deathBurst {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.2); }
}

/* Victory explosion particles */
.victory-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    z-index: 200;
    pointer-events: none;
    animation: victoryBurst 1s ease-out forwards;
}

@keyframes victoryBurst {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.3); }
}

/* Dash trail particles */
.dash-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dash-purple);
    z-index: 45;
    pointer-events: none;
    opacity: 0.7;
    animation: dashTrail 0.4s ease-out forwards;
}

@keyframes dashTrail {
    0%   { opacity: 0.7; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.2); }
}

/* ============================================
   WAVE BANNER - Announces new waves
   ============================================ */

.wave-banner {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Fredoka One', cursive;
    font-size: 2.5em;
    color: white;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.6), 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 90;
    pointer-events: none;
    opacity: 0;
    white-space: nowrap;
}

.wave-banner.show {
    animation: waveBannerPop 2s ease-out forwards;
}

@keyframes waveBannerPop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    30%  { transform: translate(-50%, -50%) scale(1); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* ============================================
   OVERLAYS - Start, Game Over, Win screens
   ============================================ */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    background: rgba(10, 10, 46, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease;
}

.overlay.hidden {
    display: none;
}

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

.overlay-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    color: white;
    max-width: 420px;
    width: 90%;
    animation: slideUp 0.5s ease;
}

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

.overlay-box h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

.overlay-box p {
    margin-bottom: 12px;
    font-size: 1em;
    color: rgba(255, 255, 255, 0.8);
}

.overlay-box .material-symbols-rounded.title-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 10px;
    color: var(--ninja-eyes);
    filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.5));
}

/* Star rating display */
.stars-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 12px 0;
}

.stars-display .material-symbols-rounded {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.2);
    transition: color 0.3s, transform 0.3s;
}

.stars-display .material-symbols-rounded.earned {
    color: var(--star-gold);
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
    animation: starPop 0.4s ease backwards;
}

.stars-display .material-symbols-rounded.earned:nth-child(1) { animation-delay: 0.1s; }
.stars-display .material-symbols-rounded.earned:nth-child(2) { animation-delay: 0.3s; }
.stars-display .material-symbols-rounded.earned:nth-child(3) { animation-delay: 0.5s; }

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

/* Difficulty picker buttons */
.difficulty-picker {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 16px 0;
    flex-wrap: wrap;
}

.diff-btn {
    padding: 10px 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--ninja-eyes);
    transform: translateY(-3px);
}

.diff-btn .diff-label {
    font-size: 0.7em;
    font-family: 'Nunito', sans-serif;
    opacity: 0.7;
}

.diff-btn.easy { border-color: #4CAF50; }
.diff-btn.easy:hover { background: rgba(76, 175, 80, 0.3); }
.diff-btn.medium { border-color: #FF9800; }
.diff-btn.medium:hover { background: rgba(255, 152, 0, 0.3); }
.diff-btn.hard { border-color: #f44336; }
.diff-btn.hard:hover { background: rgba(244, 67, 54, 0.3); }

/* Controls help section */
.controls-help {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.8;
}

.controls-help span.key {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 1px 8px;
    border-radius: 4px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 2px;
}

/* High score on start screen */
.high-score-display {
    font-size: 0.85em;
    color: var(--score-gold);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.high-score-display .material-symbols-rounded {
    font-size: 18px;
}

/* Play again / restart buttons */
.play-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 28px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #00bcd4, #00897b);
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1em;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
    margin-top: 8px;
}

.play-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 188, 212, 0.6);
}

.play-btn .material-symbols-rounded {
    font-size: 22px;
}

/* Score display on game over */
.final-score {
    font-family: 'Fredoka One', cursive;
    font-size: 2em;
    color: var(--score-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    margin: 8px 0;
}

/* ============================================
   WEAPON BAR - Shows all weapons + key bindings
   ============================================ */

.weapon-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
}

/* Each weapon slot in the bar */
.weapon-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.15s;
    min-width: 56px;
}

/* Weapon icon */
.weapon-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.weapon-icon .material-symbols-rounded {
    font-size: 22px;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.15s;
}

/* Weapon name label */
.weapon-name {
    font-size: 0.6em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

/* Key binding badge */
.weapon-key {
    font-size: 0.55em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.12);
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

/* Ready state - weapon can be used */
.weapon-slot.ready {
    border-color: rgba(0, 255, 255, 0.3);
}

.weapon-slot.ready .weapon-icon .material-symbols-rounded {
    color: var(--ninja-eyes);
}

.weapon-slot.ready .weapon-name {
    color: rgba(255, 255, 255, 0.7);
}

/* Active state - weapon is currently being used */
.weapon-slot.active {
    border-color: var(--ninja-eyes);
    background: rgba(0, 255, 255, 0.15);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.weapon-slot.active .weapon-icon .material-symbols-rounded {
    color: white;
    filter: drop-shadow(0 0 4px rgba(0, 255, 255, 0.8));
}

.weapon-slot.active .weapon-name {
    color: white;
}

/* On cooldown state - weapon can't be used yet */
.weapon-slot.on-cooldown {
    border-color: rgba(255, 255, 255, 0.05);
    opacity: 0.4;
}

/* Color accents for specific weapons */
.weapon-slot[data-weapon="katana"].ready .weapon-icon .material-symbols-rounded,
.weapon-slot[data-weapon="katana"].active .weapon-icon .material-symbols-rounded {
    color: var(--shuriken-cyan);
}

.weapon-slot[data-weapon="shuriken"].ready .weapon-icon .material-symbols-rounded {
    color: var(--shuriken-cyan);
}

.weapon-slot[data-weapon="kunai"].ready .weapon-icon .material-symbols-rounded {
    color: #d4af37;
}

.weapon-slot[data-weapon="kunai"].active .weapon-icon .material-symbols-rounded {
    color: #d4af37;
    filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.8));
}

.weapon-slot[data-weapon="dash"].ready .weapon-icon .material-symbols-rounded {
    color: var(--dash-purple);
}

.weapon-slot[data-weapon="dash"].active .weapon-icon .material-symbols-rounded {
    color: var(--dash-purple);
    filter: drop-shadow(0 0 4px rgba(187, 134, 252, 0.8));
}

.weapon-slot[data-weapon="smoke"].ready .weapon-icon .material-symbols-rounded {
    color: #aaa;
}

/* ============================================
   MOBILE CONTROLS
   ============================================ */

.mobile-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    padding: 10px 16px 20px;
    pointer-events: none;
}

/* D-pad for movement */
.dpad {
    position: absolute;
    bottom: 20px;
    left: 16px;
    display: grid;
    grid-template-columns: 50px 50px 50px;
    grid-template-rows: 50px 50px 50px;
    gap: 2px;
    pointer-events: auto;
}

.dpad-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 1.2em;
    touch-action: none;
    cursor: pointer;
}

.dpad-btn:active,
.dpad-btn.active {
    background: rgba(0, 255, 255, 0.3);
    border-color: var(--ninja-eyes);
}

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

/* Empty grid cells */
.dpad-empty {
    pointer-events: none;
}

/* Up button in top-center */
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

/* Action buttons (slash, shuriken, kunai, dash, smoke) */
.action-buttons {
    position: absolute;
    bottom: 20px;
    right: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    pointer-events: auto;
}

.action-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    touch-action: none;
    cursor: pointer;
    font-size: 0.6em;
    font-weight: 700;
    gap: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.action-btn .material-symbols-rounded {
    font-size: 22px;
}

.action-btn.slash-btn {
    background: rgba(0, 255, 255, 0.15);
    border-color: var(--shuriken-cyan);
}

.action-btn.slash-btn:active {
    background: rgba(0, 255, 255, 0.4);
}

.action-btn.shuriken-btn {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.5);
}

.action-btn.shuriken-btn:active {
    background: rgba(0, 255, 255, 0.35);
}

.action-btn.dash-btn {
    background: rgba(187, 134, 252, 0.15);
    border-color: var(--dash-purple);
}

.action-btn.dash-btn:active {
    background: rgba(187, 134, 252, 0.4);
}

.action-btn.kunai-btn {
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
}

.action-btn.kunai-btn:active {
    background: rgba(212, 175, 55, 0.4);
}

.action-btn.smoke-btn {
    background: rgba(150, 150, 150, 0.15);
    border-color: #aaa;
}

.action-btn.smoke-btn:active {
    background: rgba(150, 150, 150, 0.4);
}

/* ============================================
   FOOTER - Credits
   ============================================ */

.game-footer {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 70;
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.3);
    white-space: nowrap;
}

/* ============================================
   RESPONSIVE - Mobile and tablet adjustments
   ============================================ */

/* Show mobile controls on touch devices, hide desktop weapon bar */
@media (pointer: coarse) {
    .mobile-controls {
        display: block;
    }
    .weapon-bar {
        display: none;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .game-title { font-size: 0.85em; }
    .stats-bar { font-size: 0.75em; padding: 4px 10px; }
    .hearts .material-symbols-rounded { font-size: 18px; }
    .ability-bar { font-size: 0.7em; gap: 8px; padding: 3px 8px; top: 82px; }
    .overlay-box { padding: 20px 24px; }
    .overlay-box h2 { font-size: 1.5em; }
    .wave-banner { font-size: 1.8em; }
    header { padding: 6px 10px; }
    .back-btn { font-size: 0.75em; padding: 4px 8px; }
    .moon { width: 50px; height: 50px; top: 10%; right: 10%; }

    .dpad {
        grid-template-columns: 42px 42px 42px;
        grid-template-rows: 42px 42px 42px;
    }
    .action-btn { width: 44px; height: 44px; font-size: 0.5em; }
    .action-btn .material-symbols-rounded { font-size: 18px; }
    .action-buttons { gap: 5px; }

    .weapon-slot { min-width: 44px; padding: 3px 6px; }
    .weapon-icon .material-symbols-rounded { font-size: 18px; }
    .weapon-name { font-size: 0.5em; }
    .weapon-key { font-size: 0.45em; padding: 1px 4px; }
    .weapon-bar { gap: 4px; padding: 4px 8px; bottom: 16px; }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .game-title { font-size: 1em; }
    .overlay-box { max-width: 380px; }
}

/* Large screens */
@media (min-width: 1025px) {
    .player { width: 48px; height: 64px; }
    .player::before { width: 28px; height: 46px; left: 10px; }
    .player::after { width: 24px; height: 22px; left: 12px; }
    .enemy { width: 42px; height: 56px; }
}

/* Landscape on small screens */
@media (max-height: 500px) {
    header { padding: 4px 10px; }
    .stats-bar { top: 38px; padding: 3px 10px; font-size: 0.75em; }
    .ability-bar { top: 68px; font-size: 0.7em; padding: 2px 10px; }
    .game-title { font-size: 0.8em; }
    .back-btn { padding: 3px 6px; font-size: 0.7em; }
    .overlay-box { padding: 16px 20px; }
    .overlay-box h2 { font-size: 1.3em; }
    .overlay-box .material-symbols-rounded.title-icon { font-size: 36px; }
    .controls-help { font-size: 0.7em; line-height: 1.5; }
    .wave-banner { font-size: 1.5em; }

    .dpad {
        grid-template-columns: 38px 38px 38px;
        grid-template-rows: 38px 38px 38px;
        bottom: 10px;
    }
    .action-btn { width: 40px; height: 40px; font-size: 0.45em; }
    .action-btn .material-symbols-rounded { font-size: 16px; }
    .action-buttons { bottom: 10px; gap: 4px; }
    .game-footer { display: none; }
    .weapon-bar { display: none; }
}
