
        /* Prevent zoom on double‑tap for all elements */
html, body {
    touch-action: pan-x pan-y;  /* allows panning but prevents pinch‑zoom */
}
@keyframes evolutionGlow {
    0% { filter: brightness(1) drop-shadow(0 0 0 gold); }
    50% { filter: brightness(1.3) drop-shadow(0 0 20px gold); transform: scale(1.1); }
    100% { filter: brightness(1) drop-shadow(0 0 0 gold); transform: scale(1); }
}
.evolution-animate {
    animation: evolutionGlow 0.8s ease-in-out 3;
}

#evolution-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 20px;
}
#evolution-options-grid .starter-card {
    text-align: center;
    padding: 10px;
}
        /* ========== STARTER MODAL FIX FOR SMALL SCREENS ========== */
#trainer-starter-modal .modal {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;   /* Change from 'hidden' to 'auto' */
    padding: 20px; 
}

#trainer-starter-modal .modal .starter-grid {
     max-height: 40vh;
    overflow-y: auto;
    margin-top: 12px;
    margin-bottom: 12px;
}

#trainer-starter-modal .modal > div:last-child {
    margin-top: 16px;
    margin-bottom: 8px;
    position: sticky;
    bottom: 0;
    background: inherit; /* so it doesn't look weird when scrolling */
    padding-top: 8px;
}

/* Extra adjustments for very small screens (width ≤ 400px) */
@media (max-width: 400px) {
    #trainer-starter-modal .modal {
        padding: 15px;
        max-height: 95vh;   /* Use more screen space */
    }
    #trainer-starter-modal .starter-grid {
        max-height: 50vh;   /* Give more room for grid, less for button? Actually let's keep balanced */
        grid-template-columns: 1fr; /* Force single column to avoid tiny cards */
    }
    #trainer-starter-modal .starter-card {
        padding: 8px;
    }
    #trainer-starter-modal .starter-card img {
        width: 60px;
        height: 60px;
    }
    #confirm-trainer-starter {
        font-size: 0.9rem;
        padding: 10px;
    }
}

/* For zoomed browsers (simulate by using em or vw units) */
@media (max-height: 600px) {
    #trainer-starter-modal .modal {
        max-height: 85vh;
    }
    #trainer-starter-modal .starter-grid {
        max-height: 35vh;
    }
}
    /* ────────────── KEYFRAMES & ANIMATIONS ────────────── */
    @keyframes blinkShiny {
        0% { opacity: 1; transform: scale(1); background: #ffcc00; }
        50% { opacity: 0.7; transform: scale(1.05); background: #ffaa00; box-shadow: 0 0 8px gold; }
        100% { opacity: 1; transform: scale(1); background: #ffcc00; }
    }
    @keyframes shake {
        0% { transform: translate(1px, 1px) rotate(0deg); }
        10% { transform: translate(-1px, -2px) rotate(-1deg); }
        20% { transform: translate(-3px, 0px) rotate(1deg); }
        30% { transform: translate(3px, 2px) rotate(0deg); }
        40% { transform: translate(1px, -1px) rotate(1deg); }
        50% { transform: translate(-1px, 2px) rotate(-1deg); }
        60% { transform: translate(-3px, 1px) rotate(0deg); }
        70% { transform: translate(3px, 1px) rotate(-1deg); }
        80% { transform: translate(-1px, -1px) rotate(1deg); }
        90% { transform: translate(1px, 2px) rotate(0deg); }
        100% { transform: translate(1px, -2px) rotate(-1deg); }
    }
    @keyframes pulse {
        0% { transform: scale(1); opacity: 0.8; }
        50% { transform: scale(1.05); opacity: 1; }
        100% { transform: scale(1); opacity: 0.8; }
    }
    @keyframes bounceIn {
        0% { transform: scale(0.3); opacity: 0; }
        50% { transform: scale(1.05); }
        100% { transform: scale(1); opacity: 1; }
    }
    @keyframes sparkle {
        0% { box-shadow: 0 0 0 0 rgba(255,215,0,0.7); }
        70% { box-shadow: 0 0 0 15px rgba(255,215,0,0); }
        100% { box-shadow: 0 0 0 0 rgba(255,215,0,0); }
    }
    @keyframes slideIn {
        to { opacity: 1; transform: translateX(0); }
    }

    /* ────────────── RESET & BASE ────────────── */
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: 'Segoe UI', 'Inter', system-ui, sans-serif;
    }
    body {
        background: var(--bg);
        min-height: 100vh;
        color: var(--text-dark);
        transition: background 0.2s, color 0.2s;
    }
    .hidden { display: none !important; }

    /* ────────────── CSS VARIABLES (LIGHT THEME) ────────────── */
    :root {
        --bg: #f0f2f5;
        --card-bg: #ffffff;
        --primary: #3b4cca;
        --primary-dark: #00238f;
        --accent: #ffde00;
        --text-dark: #2d3748;
        --text-light: #5a6e8a;
        --border: #e2e8f0;
        --success: #48bb78;
        --danger: #f56565;
        --grass: #78cd54;
        --dirt: #c2b280;
        --water: #6390f0;
        --fire: #ff421c;
    }

    /* ────────────── DARK THEME OVERRIDES ────────────── */
    body.dark-theme {
        --bg: #1a1e2c;
        --card-bg: #2d2f3e;
        --primary: #6c5ce7;
        --primary-dark: #5a4ad1;
        --accent: #ff7675;
        --text-dark: #e2e8f0;
        --text-light: #a0aec0;
        --border: #3d4050;
        --success: #4cd964;
        --danger: #ff5e5e;
        --grass: #2d6a4f;
        --dirt: #7b5e3b;
        --water: #3b82f6;
        --fire: #f97316;
    }

    /* ────────────── GLOBAL COMPONENTS ────────────── */
    .btn {
        padding: 12px 20px;
        border: none;
        border-radius: 40px;
        cursor: pointer;
        font-weight: 600;
        transition: 0.2s;
    }
    .btn-primary { background: var(--primary); color: white; width: 100%; }
    .btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
    .btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-light); }
    .btn-danger { background: var(--danger); color: white; }
    .btn-danger:hover { background: #e53e3e; }
    .btn-success { background: var(--success); color: white; }
    .btn-small { padding: 4px 10px; font-size: 0.7rem; border-radius: 30px; }

    input {
        width: 100%;
        padding: 12px 16px;
        margin: 10px 0;
        border: 1px solid var(--border);
        border-radius: 16px;
        font-size: 0.95rem;
        transition: 0.2s;
    }
    input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(59,76,202,0.1);
    }

    .type-badge {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 16px;
        font-size: 0.7rem;
        font-weight: bold;
        margin: 0 2px;
        color: white;
        text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    }

    /* ────────────── NAVIGATION ────────────── */
    nav {
        background: var(--card-bg);
        padding: 12px 5%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 1000;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        border-bottom: 1px solid var(--border);
    }
    .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.5rem; color: var(--primary-dark); letter-spacing: -0.5px; }
    .logo img { height: 40px; width: auto; border-radius: 12px; }
    .nav-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
    .nav-link { background: none; border: none; cursor: pointer; font-weight: 500; padding: 6px 10px; border-radius: 40px; transition: 0.2s; color: var(--text-dark); font-size: 0.9rem; }
    .nav-link:hover { background: #eef2ff; color: var(--primary); }
    #logout-btn { background: #f1f5f9; color: var(--text-light); padding: 6px 12px; border-radius: 40px; }
    #user-display { background: #eef2ff; padding: 4px 10px; border-radius: 40px; font-size: 0.75rem; font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
    #coin-display { background: #fef9e3; color: #b45309; padding: 4px 12px; border-radius: 40px; font-weight: bold; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
    #level-display { background: #fef9e3; color: #b45309; padding: 4px 12px; border-radius: 40px; font-weight: bold; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
    #change-name-btn { background: none; border: none; cursor: pointer; font-size: 0.8rem; margin-left: 4px; color: var(--primary); }
    .volume-btn { background: rgba(255,255,255,0.8); border: none; border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 1.2rem; display: inline-flex; align-items: center; justify-content: center; margin-left: 8px; transition: 0.2s; }
    .volume-btn:hover { background: white; transform: scale(1.05); }
    #theme-toggle { background: var(--card-bg); border: 1px solid var(--border); border-radius: 40px; padding: 4px 12px; cursor: pointer; font-size: 0.9rem; }

    /* ────────────── AUTH SCREEN ────────────── */
   /* Auth Screen with Galaxy / Star Effect */
#auth-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #00238f, #790000);
    background-attachment: fixed;
}

/* Animated stars layer */
#auth-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, #fff, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 60% 70%, #ffdd88, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 80% 20%, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 10% 85%, #ffaa66, rgba(0,0,0,0)),
        radial-gradient(4px 4px at 95% 45%, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40% 15%, #ffcc99, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 70% 90%, #fff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 5% 50%, #ffdd99, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50% 50%, #fff, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 85% 10%, #ffcc88, rgba(0,0,0,0));
    background-size: 200px 200px;
    background-repeat: repeat;
    opacity: 0.6;
    animation: starMove 40s linear infinite;
    pointer-events: none;
}

/* Second layer of stars (larger, slower) */
#auth-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(4px 4px at 30% 40%, #ffdd88, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 75% 65%, #fff, rgba(0,0,0,0)),
        radial-gradient(5px 5px at 15% 20%, #ffaa66, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 90% 80%, #fff, rgba(0,0,0,0)),
        radial-gradient(6px 6px at 45% 95%, #ffcc99, rgba(0,0,0,0));
    background-size: 300px 300px;
    background-repeat: repeat;
    opacity: 0.4;
    animation: starMoveSlow 60s linear infinite;
    pointer-events: none;
}

/* Star movement animations */
@keyframes starMove {
    0% { background-position: 0 0; }
    100% { background-position: 200px 200px; }
}

@keyframes starMoveSlow {
    0% { background-position: 0 0; }
    100% { background-position: -300px 300px; }
}

/* Pulsing glow effect on the gradient */
#auth-screen {
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
    0% { filter: brightness(1) saturate(1); }
    50% { filter: brightness(1.1) saturate(1.2); }
    100% { filter: brightness(1) saturate(1); }
}

/* Keep the auth card on top */
.auth-card {
    position: relative;
    z-index: 10;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 24px;
    width: 360px;
    text-align: center;
    box-shadow: 0 20px 35px -10px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(2px);
}

/* Shooting star */
.shooting-star {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}
.shooting-star::before {
    content: '';
    position: absolute;
    top: 10%;
    left: -100px;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, #fff, transparent);
    border-radius: 50%;
    animation: shoot 8s linear infinite;
    opacity: 0;
}
@keyframes shoot {
    0% { transform: translateX(0) translateY(0); opacity: 0; }
    10% { opacity: 1; }
    20% { transform: translateX(120vw) translateY(20vh); opacity: 0; }
    100% { transform: translateX(120vw) translateY(20vh); opacity: 0; }
}
    .auth-card img { width: 280px; height: auto; margin-bottom: 10px; border-radius: 20px; }

    /* ────────────── MAP COMPONENTS ────────────── */
    .map-wrapper { width: 100%; overflow-x: auto; display: flex; justify-content: center; margin: 20px 0; }
    #map-viewport { width: 600px; height: 400px; border: 4px solid var(--primary); border-radius: 20px; overflow: hidden; position: relative; background: var(--dirt); box-shadow: 0 12px 24px rgba(0,0,0,0.1); flex-shrink: 0; }
    #map-grid { display: grid; grid-template-columns: repeat(50, 50px); position: absolute; top: 0; left: 0; z-index: 1; transition: transform 0.15s ease-out; }
    .tile { width: 50px; height: 50px; border: 1px solid rgba(0,0,0,0.05); }
    .tile.grass { background: var(--grass); }
    #player { position: absolute; width: 60px; height: 60px; top: 170px; left: 270px; z-index: 999; background-size: contain; background-repeat: no-repeat; background-position: center; pointer-events: none; filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2)); }
   .arrow-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px auto; width: fit-content; }
    .arrow-up-wrapper { display: contents; }
    .arrow-middle { display: contents; }
    .arrow-btn.diagonal { font-size: 1.3rem; opacity: 0.75; }
    .arrow-btn.diagonal:hover { opacity: 1; }
    /* Enhanced Arrow Buttons – Uiverse inspired */
.arrow-btn {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.arrow-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(59, 76, 202, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.arrow-btn:active {
    transform: translateY(1px);
}

/* Dark mode adjustments */
body.dark-theme .arrow-btn {
    background: rgba(30, 35, 50, 0.8);
    backdrop-filter: blur(8px);
    border-color: rgba(255, 255, 255, 0.15);
    color: #a0aec0;
}

body.dark-theme .arrow-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(59, 76, 202, 0.6), 0 8px 20px rgba(59, 76, 202, 0.3);
}

/* Responsive: smaller on mobile */
@media (max-width: 600px) {
    .arrow-btn {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
        border-radius: 16px;
    }
}
    .arrow-btn:hover { background-color: var(--primary); color: white; transform: scale(1.05); }
    .arrow-btn:disabled { opacity: 0.5; transform: none; cursor: not-allowed; }

    /* ────────────── BATTLE AREA ────────────── */
    #battle-area {
        max-width: 700px;
        width: 95%;
        margin: 20px auto;
        background: linear-gradient(145deg, #87CEEB 0%, #c0e0ff 40%, #78c850 100%);
        border-radius: 24px;
        box-shadow: 0 12px 28px rgba(0,0,0,0.2);
        border: 1px solid rgba(255,255,255,0.3);
        overflow: hidden;
        position: relative;
    }
    #battle-area::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle at 20% 30%, rgba(255,255,200,0.2) 0%, rgba(0,0,0,0) 70%); pointer-events: none; }
    .battle-header { background: var(--primary-dark); color: white; text-align: center; padding: 12px; font-weight: bold; font-size: 1rem; position: relative; z-index: 2; }
    .battle-ui { padding: 20px; display: flex; flex-direction: column; gap: 20px; position: relative; z-index: 2; }
    .side { display: flex; align-items: center; gap: 15px; opacity: 0; transform: translateX(-100px); animation: slideIn 0.5s forwards; flex-wrap: wrap; }
    .enemy-side { justify-content: flex-end; transform: translateX(100px); animation-delay: 0.2s; }
    .player-side { transform: translateX(-100px); animation-delay: 0.4s; }
    .btl-sprite { width: 100px; height: 100px; object-fit: contain; cursor: pointer; transition: transform 0.2s; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)); }
    .btl-sprite:hover { transform: scale(1.05); }
    .stat-box { background: rgba(255,255,255,0.9); backdrop-filter: blur(4px); padding: 12px 16px; border-radius: 20px; width: 220px; border-left: 4px solid var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
    .hp-bar { background: #e2e8f0; height: 8px; border-radius: 10px; overflow: hidden; margin-top: 8px; }
    .hp-fill { height: 100%; background: var(--success); width: 100%; transition: width 0.3s; }
    #battle-log { background: rgba(0,0,0,0.7); color: #e0e0e0; padding: 12px; font-family: monospace; font-size: 0.8rem; height: 80px; overflow-y: auto; border-radius: 16px; margin: 10px 0; backdrop-filter: blur(4px); }
    #battle-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
    .move-btn {
        display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
        border: none; border-radius: 32px; cursor: pointer; font-weight: 600; color: white;
        text-shadow: 0 1px 1px rgba(0,0,0,0.2); transition: transform 0.2s, filter 0.2s;
        background: var(--type-color, #a0aec0);
    }
    .move-btn:hover { transform: translateY(-2px); filter: brightness(0.95); }
    .move-btn:active { transform: translateY(0); }
    .move-btn .move-icon { width: 32px; height: 32px; object-fit: contain; margin-right: 12px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2)); }
    .move-btn .move-name { flex: 1; text-align: left; text-transform: uppercase; font-size: 0.9rem; }
    .move-btn .move-power { font-size: 0.85rem; font-weight: bold; background: rgba(0,0,0,0.3); padding: 4px 8px; border-radius: 20px; margin-left: 8px; }
    .catch-area { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .catch-chance { font-size: 0.8rem; background: rgba(255,255,255,0.8); padding: 6px 12px; border-radius: 40px; font-weight: bold; }
    .catch-btn {
        background: #e33535; display: flex; align-items: center; gap: 8px; padding: 8px 20px;
        border-radius: 40px; color: white; font-weight: bold; border: none; cursor: pointer; transition: 0.2s;
    }
    .catch-btn i { font-size: 1.2rem; }
    .catch-btn:hover { background: #c22e2e; transform: scale(0.98); }
    .catch-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
    .shake-effect { animation: shake 0.5s; animation-iteration-count: 1; }
    .type-fire { background: #ff421c; }
    .type-water { background: #6390f0; }
    .type-grass { background: #78cd54; }
    .type-electric { background: #f8d030; color: #333; text-shadow: none; }
    .type-normal { background: #a8a878; }
    .type-psychic { background: #f85888; }
    .type-poison { background: #a040a0; }
    .type-ground { background: #e0c068; color: #333; }
    .type-flying { background: #a890f0; }
    .type-ice { background: #98d8d8; color: #333; }
    .type-dragon { background: #7038f8; }
    .type-dark { background: #705848; }
    .type-steel { background: #b8b8d0; color: #333; }
    .type-fairy { background: #ee99ac; }
    .type-fighting { background: #c03028; }
    .type-rock { background: #b8a038; }
    .type-bug { background: #a8b820; }
    .type-ghost { background: #705898; }

    /* ────────────── MODALS & OVERLAYS ────────────── */
    .overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center;
        z-index: 5000; backdrop-filter: blur(4px);
    }
    .modal {
        background: var(--card-bg); padding: 30px; border-radius: 32px; max-width: 500px;
        width: 90%; text-align: center; box-shadow: 0 25px 40px rgba(0,0,0,0.3);
    }
    .move-list { max-height: 400px; overflow-y: auto; margin: 16px 0; text-align: left; }

    /* ────────────── LISTS (TEAM / COLLECTION / POKEDEX) ────────────── */
    .list-container {
        max-width: 800px; width: 95%; margin: 30px auto; background: var(--card-bg);
        border-radius: 24px; padding: 20px; box-shadow: 0 8px 20px rgba(0,0,0,0.05);
        border: 1px solid var(--border);
    }
    .list-container h2 { margin-bottom: 20px; color: var(--primary-dark); border-left: 4px solid var(--primary); padding-left: 16px; font-size: 1.4rem; }
    .mon-item { display: flex; align-items: center; padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: 0.2s; flex-wrap: wrap; }
    .mon-item:hover { background: #f8fafc; transform: translateX(4px); }
    .mon-item img { width: 60px; height: 60px; object-fit: contain; margin-right: 20px; }
    .mon-info { flex: 1; }
    .mon-buttons { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
    .active-badge { background: var(--success); color: white; padding: 2px 8px; border-radius: 20px; font-size: 0.7rem; margin-left: 8px; }
    .move-badge {
        display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.7rem;
        font-weight: 600; margin: 2px 4px; color: white; text-shadow: 0 0 1px rgba(0,0,0,0.3);
    }

    /* ────────────── STARTER GRID ────────────── */
    .starter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; max-height: 60vh; overflow-y: auto; margin-top: 20px; }
    .starter-card { background: #f8fafc; border-radius: 24px; padding: 12px; cursor: pointer; transition: all 0.2s; border: 2px solid transparent; }
    .starter-card:hover { transform: translateY(-5px); box-shadow: 0 12px 20px rgba(0,0,0,0.1); border-color: var(--primary); }
    .starter-card img { width: 80px; height: 80px; object-fit: contain; }

    /* ────────────── ENCOUNTER PREVIEW ────────────── */
    #encounter-preview {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center;
        z-index: 6000; backdrop-filter: blur(8px);
    }
    .encounter-card {
        background: var(--card-bg); border-radius: 48px; padding: 40px; text-align: center;
        animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        position: relative; overflow: hidden;
    }
    .encounter-card.special { animation: sparkle 0.8s infinite, bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55); border: 3px solid gold; box-shadow: 0 0 20px rgba(255,215,0,0.5); }
    .encounter-sprite { width: 180px; height: 180px; object-fit: contain; filter: drop-shadow(0 10px 15px rgba(0,0,0,0.2)); }
    .encounter-name { font-size: 2rem; font-weight: bold; margin-top: 20px; color: var(--primary-dark); }
    .encounter-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 15px 0; }
    .special-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); color: #333; animation: pulse 1s infinite; }
    .generation-badge { background: #3b4cca; color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; }
    #preview-weaknesses .type-badge { margin: 2px; font-size: 0.7rem; }
    #preview-capture-status, #preview-encounter-count { font-weight: 500; }

    /* ────────────── BATTLE SUMMARY MODAL ────────────── */
    #battle-summary-modal .modal { background: var(--card-bg); border-radius: 32px; padding: 20px; }
    #summary-moves span { background: #f0f0f0; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; }

    /* ────────────── ABOUT STATS ────────────── */
    .about-stats { text-align: left; margin: 20px 0; padding: 15px; background: #f8fafc; border-radius: 16px; font-family: monospace; }
    .about-stats p { margin: 8px 0; }
    .stat-progress { width: 100%; height: 8px; background: #e2e8f0; border-radius: 10px; overflow: hidden; margin: 5px 0 10px 0; }
    .stat-progress-fill { height: 100%; background: var(--primary); transition: width 0.3s; border-radius: 10px; }
    .stat-progress-fill.warning { background: #f59e0b; }
    .stat-progress-fill.danger { background: var(--danger); }
    .about-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: bold; margin-left: 8px; }
    .about-badge.free { background: #eef2ff; color: var(--primary); }
    .about-badge.warning { background: #fef3c7; color: #f59e0b; }
    .about-badge.danger { background: #fee2e2; color: var(--danger); }

    /* ────────────── GAME FEATURES (ABOUT MODAL) ────────────── */
    .game-features {
        background: rgba(255,255,255,0.9); border-top: 1px solid var(--border);
        margin-top: 20px; padding: 20px; text-align: center;
    }
    .features-container { max-width: 900px; margin: 0 auto; }
    .features-container h3 { color: var(--primary-dark); font-size: 1.2rem; margin-bottom: 15px; }
    .features-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; margin-bottom: 20px; }
    .features-grid p { font-size: 0.85rem; color: var(--text-dark); background: #f8fafc; padding: 4px 12px; border-radius: 40px; margin: 0; }
    .support-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 0.9rem; }
    .support-section a { color: var(--primary); text-decoration: none; font-weight: bold; transition: 0.2s; }
    .support-section a:hover { text-decoration: underline; color: var(--primary-dark); }

    /* ────────────── RECORDS CARD GRID (POKÉDEX RECORDS) ────────────── */
   /* Records card grid – compact cards, responsive columns */
.records-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.records-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.records-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.records-card-img {
    background: #f8fafc;
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.records-card-img img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    image-rendering: pixelated;
}

.records-card-info {
    padding: 8px;
}

.records-card-name {
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--primary-dark);
    margin-bottom: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.records-card-types {
    display: flex;
    justify-content: center;
    gap: 3px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.records-card-types .type-badge {
    font-size: 0.55rem;
    padding: 1px 4px;
}

.records-card-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.55rem;
    color: var(--text-light);
    text-align: center;
    border-top: 1px solid var(--border);
    padding-top: 4px;
    margin-top: 4px;
}

.records-card-stats span {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Dark mode overrides */
body.dark-theme .records-card-img {
    background: #1e2230;
}

body.dark-theme .records-card-name {
    color: #e2e8f0;
}

body.dark-theme .records-card-stats {
    border-top-color: #3d4050;
}

/* On very small screens (max-width 480px), ensure 4 columns by reducing min width */
@media (max-width: 480px) {
    .records-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 8px;
    }
    .records-card-img img {
        width: 50px;
        height: 50px;
    }
    .records-card-name {
        font-size: 0.65rem;
    }
    .records-card-types .type-badge {
        font-size: 0.5rem;
        padding: 1px 3px;
    }
    .records-card-stats {
        font-size: 0.5rem;
    }
}

/* For screens between 320px and 400px, force 4 columns */
@media (max-width: 400px) {
    .records-card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

    /* ────────────── SHINY BADGE ────────────── */
    .shiny-badge {
        animation: blinkShiny 1.5s infinite ease-in-out;
        display: inline-block;
        padding: 2px 8px;
        border-radius: 20px;
        font-size: 0.7rem;
        font-weight: bold;
        margin-left: 8px;
        background: #ffcc00;
        color: #333;
    }

    /* ────────────── MISCELLANEOUS ────────────── */
    .guide-link {
        display: inline-flex; align-items: center; gap: 8px; background: var(--primary); color: white;
        padding: 6px 16px; border-radius: 40px; text-decoration: none; font-weight: 500; font-size: 0.85rem;
        transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    .guide-link:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
    #switch-pokemon-list button { width: 100%; justify-content: flex-start; }

    /* ────────────── FOOTER ────────────── */
    footer {
        text-align: center; padding: 16px; font-size: 0.8rem; color: var(--text-light);
        background: rgba(255,255,255,0.8); margin-top: 40px; border-top: 1px solid var(--border);
    }

    /* ────────────── DARK THEME SPECIFIC OVERRIDES (BATTLE, SUMMARY, USER DISPLAY) ────────────── */
    body.dark-theme #battle-area {
        background: linear-gradient(145deg, #1e2434 0%, #2a2f3e 40%, #1b3a2a 100%);
        border-color: #3d4050;
    }
    body.dark-theme .battle-header { background: #5a4ad1; color: #e2e8f0; }
    body.dark-theme .stat-box { background: rgba(30, 35, 50, 0.95); color: #e2e8f0; border-left-color: #6c5ce7; }
    body.dark-theme .player-side .stat-box { background: rgba(30, 35, 50, 0.95); color: #e2e8f0; border-left-color: #4cd964; }
    body.dark-theme .stat-box .mon-name, body.dark-theme .stat-box .mon-lvl,
    body.dark-theme .stat-box strong, body.dark-theme .stat-box small { color: #e2e8f0; }
    body.dark-theme .hp-bar { background: #3d4050; }
    body.dark-theme .hp-fill { background: #4cd964; }
    body.dark-theme .hp-fill.mid { background: #ff9f43; }
    body.dark-theme .hp-fill.low { background: #ff5e5e; }
    body.dark-theme #battle-log { background: rgba(0, 0, 0, 0.85); color: #cbd5e0; }
    body.dark-theme .catch-chance { background: rgba(30, 35, 50, 0.9); color: #e2e8f0; }
    body.dark-theme .catch-btn { filter: brightness(0.9); }
    body.dark-theme .move-btn { text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

    body.dark-theme #battle-summary-modal .modal { background: #2d2f3e; border-color: #3d4050; }
    body.dark-theme #summary-header { color: #e2e8f0; }
    body.dark-theme #summary-name { color: #e2e8f0; }
    body.dark-theme #summary-info { color: #a0aec0; }
    body.dark-theme #summary-details { background: #1e2230; border-color: #3d4050; color: #e2e8f0; }
    body.dark-theme #summary-details strong { color: #e2e8f0; }
    body.dark-theme #close-summary-btn { background: #6c5ce7; }
    body.dark-theme #close-summary-btn:hover { background: #5a4ad1; }

    body.dark-theme #user-display { background: #2d2f3e; color: #e2e8f0; border: 1px solid #3d4050; }
    body.dark-theme #user-display span { color: #e2e8f0; }
    body.dark-theme #user-display button { background: transparent !important; color: #a0aec0; }
    body.dark-theme #user-display button:hover { color: #6c5ce7; }

    body.dark-theme .records-card-img { background: #1e2230; }
    body.dark-theme .records-card-name { color: #e2e8f0; }
    body.dark-theme .records-card-stats { border-top-color: #3d4050; }

    /* ────────────── RESPONSIVE MEDIA QUERIES ────────────── */
    @media (max-width: 768px) {
        nav { flex-direction: column; align-items: stretch; text-align: center; }
        .logo { justify-content: center; }
        .nav-links { justify-content: center; gap: 8px; }
        .nav-link { font-size: 0.8rem; padding: 4px 8px; }
        #user-display { font-size: 0.7rem; margin: 0 4px; }
        .auth-card { width: 90%; padding: 30px; }
        .auth-card img { width: 200px; }
        #map-viewport { width: 500px; height: 333px; }
        .btl-sprite { width: 80px; height: 80px; }
        .stat-box { width: 180px; padding: 8px 12px; }
        .side { gap: 8px; }
        .move-btn { padding: 8px 10px; font-size: 0.75rem; }
        .catch-chance { font-size: 0.7rem; }
        .list-container { padding: 15px; }
        .mon-item img { width: 50px; height: 50px; margin-right: 12px; }
        .mon-info { font-size: 0.85rem; }
        .btn-small { padding: 3px 8px; font-size: 0.65rem; }
        .encounter-sprite { width: 120px; height: 120px; }
        .encounter-name { font-size: 1.5rem; }
        .encounter-card { padding: 30px; }
        .arrow-up, .arrow-down, .arrow-left, .arrow-right { width: 50px; padding: 8px; font-size: 1rem; }
    }
    @media (max-width: 600px) {
        .features-grid p { font-size: 0.75rem; padding: 3px 10px; }
        .support-section { font-size: 0.8rem; }
        .arrow-btn { width: 55px; height: 55px; font-size: 1.2rem; }
        .arrow-middle { gap: 12px; }
        #battle-moves { gap: 8px; }
        .move-btn { padding: 8px 12px; }
        .move-icon { width: 28px !important; height: 28px !important; image-rendering: crisp-edges; }
        .move-name { font-size: 0.75rem; }
        .move-power { font-size: 0.7rem; padding: 2px 6px; }
    }
    @media (max-width: 520px) {
        #map-viewport { width: 100%; height: auto; aspect-ratio: 600 / 400; }
        .btl-sprite { width: 60px; height: 60px; }
        .stat-box { width: 140px; font-size: 0.75rem; }
        .move-btn { font-size: 0.7rem; padding: 6px 8px; }
    }
    @media (max-width: 480px) {
        #battle-moves { gap: 6px; }
        .move-btn { padding: 6px 8px; gap: 4px; }
        .move-icon { width: 22px !important; height: 22px !important; margin-right: 4px; }
        .move-name { font-size: 0.65rem; line-height: 1.2; white-space: normal; word-break: break-word; }
        .move-power { font-size: 0.6rem; padding: 2px 5px; margin-left: 4px; }
    }
    @media (max-width: 400px) {
        #battle-moves { grid-template-columns: 1fr; }
    }

    /* ────────────── MOVE BUTTON OVERFLOW FIXES ────────────── */
    .move-btn { overflow: hidden; max-width: 100%; }
    .move-name { white-space: normal; word-break: break-word; overflow-wrap: break-word; flex-shrink: 1; min-width: 0; }
    .move-icon { flex-shrink: 0; }
    .move-power { flex-shrink: 0; white-space: nowrap; }

    /* ────────────── ADDITIONAL DARK THEME FIXES (DUPLICATED, KEPT FOR SAFETY) ────────────── */
    body.dark-theme #summary-details { background: #1e2230 !important; color: #e2e8f0 !important; }
    body.dark-theme #summary-details span, body.dark-theme #summary-details strong { color: #e2e8f0 !important; }

      /* Loading overlay with rotating Pokéball */
.loading-container {
    background: var(--card-bg);
    border-radius: 32px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 25px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 200px;
}

.pokeball-loader {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(to bottom, #ee1515 50%, #ffffff 50%);
    border: 3px solid #1a1a1a;
    position: relative;
    animation: spinBall 1s linear infinite;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.pokeball-loader::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: #1a1a1a;
    transform: translateY(-50%);
    z-index: 1;
}

.pokeball-loader::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #1a1a1a;
    z-index: 2;
}

@keyframes spinBall {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Dark mode adjustments */
body.dark-theme .loading-container {
    background: #2d2f3e;
    color: #e2e8f0;
}
body.dark-theme .pokeball-loader {
    border-color: #e2e8f0;
}
body.dark-theme .pokeball-loader::before,
body.dark-theme .pokeball-loader::after {
    border-color: #e2e8f0;
}
/* Fix info modal stats area in dark mode */
body.dark-theme #info-stats {
    background: #1e2230 !important;
    color: #e2e8f0 !important;
}

body.dark-theme #info-stats strong {
    color: #e2e8f0 !important;
}

body.dark-theme #info-desc {
    color: #cbd5e0 !important;
}

/* Also ensure the modal itself uses dark background */
body.dark-theme #info-overlay .modal {
    background: #2d2f3e;
    color: #e2e8f0;
}

#loading-spinner {
    display: block;
    margin: 0 auto;
    animation: spinBall 1s linear infinite;
}

/* ---------- CARD-STYLE SCROLLABLE NAVIGATION (FIXED) ---------- */
/* ---------- CARD-STYLE SCROLLABLE NAVIGATION (FIXED) ---------- */
.card-nav {
    background: transparent;
    padding: 12px 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden; /* prevent the whole nav from scrolling */
}

/* Header with logo and hamburger */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-dark);
    flex-shrink: 0; /* prevent logo from shrinking */
}
.logo img {
    height: 40px;
    width: auto;
    border-radius: 12px;
}

/* Hamburger button - always visible on the right */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
    flex-shrink: 0; /* prevent shrinking */
    margin-left: auto; /* push to the right */
}
.hamburger span {
    width: 100%;
    height: 3px;
    background: var(--text-dark);
    border-radius: 4px;
    transition: all 0.3s ease;
}
.hamburger.open span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
    opacity: 0;
}
.hamburger.open span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

/* Collapsible container */
.nav-collapsible {
    transition: max-height 0.4s ease-out, opacity 0.2s ease;
    overflow: hidden;
    width: 100%;
}

/* On desktop: always expanded, hamburger hidden */
@media (min-width: 769px) {
    .nav-collapsible {
        max-height: none !important;
        opacity: 1 !important;
    }
    .hamburger {
        display: none !important;
    }
}

/* On mobile: collapsible hidden by default, hamburger visible */
@media (max-width: 768px) {
    .nav-collapsible {
        max-height: 0;
        opacity: 0;
    }
    .nav-collapsible.open {
        max-height: 500px;
        opacity: 1;
    }
    .hamburger {
        display: flex;
    }
}

/* Each card */
.nav-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 8px 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto; /* allow horizontal scroll inside card if needed */
}
.nav-card:last-child {
    margin-bottom: 0;
}

/* Scrollable row inside card - ensures horizontal scrolling without expanding parent */
.nav-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: thin;
    padding: 6px 0;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap; /* force items to stay in one line */
}
.nav-row::-webkit-scrollbar {
    height: 4px;
}
.nav-row::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 4px;
}
.nav-row::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* Items inside rows - prevent wrapping */
.nav-link, .nav-item, .volume-btn, .btn-outline {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 40px;
    transition: 0.2s;
    color: var(--text-dark);
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.nav-link:hover, .nav-item:hover {
    background: #eef2ff;
    color: var(--primary);
}
.volume-btn {
    background: rgba(255,255,255,0.8);
    width: 36px;
    height: 36px;
    justify-content: center;
}
.volume-btn:hover {
    background: white;
    transform: scale(1.05);
}
#user-display {
    background: #eef2ff;
    padding: 4px 10px;
    border-radius: 40px;
    gap: 8px;
}
#level-display, #coin-display {
    background: #fef9e3;
    color: #b45309;
    padding: 4px 12px;
    border-radius: 40px;
    font-weight: bold;
    font-size: 0.85rem;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
#change-name-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    color: var(--primary);
}
.guide-link {
    background: var(--primary);
    color: white !important;
}
.guide-link:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Dark theme adjustments for cards */
.dark-theme .nav-card {
    background: var(--card-bg);
    border-color: var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.dark-theme .nav-link:hover,
.dark-theme .nav-item:hover {
    background: #2d2f3e;
    color: var(--primary);
}
.dark-theme #user-display {
    background: #2d2f3e;
    color: var(--text-dark);
}
.dark-theme #level-display,
.dark-theme #coin-display {
    background: #1e2230;
    color: #fbbf24;
}
.dark-theme .volume-btn {
    background: rgba(30,35,50,0.8);
}
.dark-theme .volume-btn:hover {
    background: var(--primary);
    color: white;
}

/* Responsive: smaller padding on mobile */
@media (max-width: 600px) {
    .nav-card {
        padding: 6px 10px;
    }
    .nav-link, .nav-item {
        padding: 4px 10px;
        font-size: 0.8rem;
    }
    .volume-btn {
        width: 32px;
        height: 32px;
    }
}
/* Fix info modal for mobile: make content scrollable and close button accessible */
#info-overlay .modal {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}
#info-overlay .modal > *:last-child {
    margin-top: auto;
    position: sticky;
    bottom: 0;
    background: var(--card-bg);
    padding-top: 10px;
    margin-bottom: 0;
}
/* Ensure the close button is always visible */
#info-overlay .modal .btn-primary {
    width: 100%;
    margin-top: 15px;
}
/* On very small screens, reduce padding */
@media (max-width: 480px) {
    #info-overlay .modal {
        padding: 15px;
    }
}
#info-overlay .modal {
    text-align: center;
}
#info-img {
    display: block;
    margin: 0 auto;
    width: 130px;
    height: auto;
}
@media (max-width: 480px) {
    #info-img {
        width: 100px;
    }
}
#zoom-in-btn, #zoom-out-btn {
    font-weight: bold;
    font-size: 1.2rem;
}

#player {
    position: absolute;
    width: 60px;
    height: auto;
    top: 170px;
    left: 270px;
    z-index: 999;
    pointer-events: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#player-sprite-img {
    width: 60px;
    height: 60px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    flex-shrink: 0;
}
#player-companion {
    position: absolute;
    bottom: 0px;
    right: -30px;
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.4));
    animation: companionBob 1.2s ease-in-out infinite;
}
@keyframes companionBob {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
}
#player-name-label {
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 8px;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 8px;
    white-space: nowrap;
    margin-top: 1px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
    line-height: 1.4;
    pointer-events: none;
}

/* ── COLLECTION FILTER BAR ── */
.coll-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 16px;
}
.coll-filter-bar label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-right: 4px;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 2px solid var(--border);
    background: transparent;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    color: var(--text-light);
    user-select: none;
}
.filter-chip input[type=checkbox] { display: none; }
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active-chip { border-color: currentColor; }
.filter-chip.chip-shiny.active-chip  { background: #fff9e6; color: #b7791f; border-color: #f6d860; }
.filter-chip.chip-atk.active-chip    { background: #fff5f5; color: #c53030; border-color: #ff6b6b; }
.filter-chip.chip-def.active-chip    { background: #ebf8ff; color: #2b6cb0; border-color: #4dabf7; }
.filter-chip.chip-spd.active-chip    { background: #f0fff4; color: #276749; border-color: #69db7c; }
.coll-count-badge {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
    white-space: nowrap;
}

/* ── ENHANCED POKEMON CARD ── */
.poke-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s, box-shadow 0.18s;
    position: relative;
}
.poke-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.poke-card.is-shiny { border-color: #ecc94b; background: linear-gradient(to bottom, #fffff0, var(--card-bg)); }
.poke-card.is-active { outline: 3px solid var(--primary); outline-offset: -1px; }
.poke-card-header {
    padding: 16px 16px 10px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.poke-card-img-wrap {
    background: #f8fafc;
    border-radius: 14px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: 0.15s;
}
body.dark-theme .poke-card-img-wrap { background: #1e2230; }
.poke-card-img-wrap:hover { transform: scale(1.07); }
.poke-card-img-wrap img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.poke-card-info { flex: 1; min-width: 0; }
.poke-card-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.poke-card-level {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}
.poke-card-types { display: flex; gap: 4px; flex-wrap: wrap; margin: 5px 0; }
.poke-card-bonus {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 5px;
}
.bonus-pill {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    color: white;
}
.bonus-pill.atk { background: #ff6b6b; }
.bonus-pill.def { background: #4dabf7; }
.bonus-pill.spd { background: #69db7c; color: #1a4731; }
.poke-card-xp { padding: 0 16px 10px; }
.poke-card-xp-bar {
    background: #e2e8f0;
    height: 5px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 3px;
}
.poke-card-xp-fill { height: 100%; background: var(--primary); border-radius: 10px; transition: width 0.3s; }
.poke-card-xp-text { font-size: 0.62rem; color: var(--text-light); }
.poke-card-moves {
    padding: 0 16px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.poke-card-move-pill {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    color: white;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
.poke-card-captured {
    padding: 0 16px 8px;
    font-size: 0.65rem;
    color: var(--text-light);
}
.poke-card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: auto;
}
.poke-card-corner-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 700;
}
.badge-shiny { background: #ffd700; color: #333; }
.badge-active { background: var(--success); color: white; }
/* Dark mode: fix shiny card background */
body.dark-theme .poke-card.is-shiny {
    background: linear-gradient(to bottom, #2a2a2a, var(--card-bg)) !important;
    border-color: #fbbf24;
}

/* Evolution modal enhancements */
#evolution-modal .modal {
    background: radial-gradient(circle at center, #2a2f3e 0%, #1a1e2c 100%);
    border: 3px solid gold;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
    animation: modalGlow 1.5s infinite alternate;
}
@keyframes modalGlow {
    from { box-shadow: 0 0 20px rgba(255,215,0,0.4); border-color: #ffd700; }
    to { box-shadow: 0 0 60px rgba(255,215,0,0.9); border-color: #ffaa00; }
}

#evo-sprite-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    margin: 30px 0;
}
#evo-old-sprite, #evo-new-sprite {
    width: 150px;
    height: 150px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px gold);
    transition: all 0.5s ease;
}
#evo-arrow {
    font-size: 3rem;
    animation: arrowPulse 0.6s infinite alternate;
    text-shadow: 0 0 10px gold;
}
@keyframes arrowPulse {
    from { transform: scale(1); opacity: 0.7; }
    to { transform: scale(1.3); opacity: 1; }
}

.evolution-animate {
    animation: evolutionFlash 0.2s infinite alternate;
}
@keyframes evolutionFlash {
    from { filter: brightness(1) drop-shadow(0 0 5px gold); transform: scale(1); }
    to { filter: brightness(2) drop-shadow(0 0 40px gold); transform: scale(1.15); }
}
.evo-final {
    animation: evolutionBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes evolutionBounce {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    70% { transform: scale(1.2) rotate(2deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
/* Dark mode: evolution modal background */
body.dark-theme #evolution-modal .modal,
body.dark-theme #evolution-confirm-modal .modal,
body.dark-theme #evolution-select-modal .modal {
    background: #1e1e2e !important;
    background-image: none !important;
    color: #e2e8f0;
    border-color: #3d4050;
}

/* Dark mode: evolution modal text */
body.dark-theme #evo-title,
body.dark-theme #evo-text,
body.dark-theme #confirm-old-name,
body.dark-theme #confirm-new-name,
body.dark-theme #confirm-requirements {
    color: #e2e8f0;
}

/* Dark mode: evolution modal buttons */
body.dark-theme #evo-continue-btn,
body.dark-theme #confirm-evolution-yes,
body.dark-theme #confirm-evolution-no {
    background: #3b4cca;
    color: white;
}
body.dark-theme #evo-continue-btn:hover,
body.dark-theme #confirm-evolution-yes:hover {
    background: #5a4ad1;
}
body.dark-theme #confirm-evolution-no {
    background: #4a5568;
}
@keyframes evolutionGlow {
    0% { filter: brightness(1) drop-shadow(0 0 0 gold); transform: scale(1); }
    50% { filter: brightness(1.5) drop-shadow(0 0 20px gold); transform: scale(1.1); }
    100% { filter: brightness(1) drop-shadow(0 0 0 gold); transform: scale(1); }
}
.evolution-animate {
    animation: evolutionGlow 0.8s ease-in-out 3;
}

#evo-sprite-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    margin: 20px 0;
}
#evo-old-sprite, #evo-new-sprite {
    width: 150px;
    height: 150px;
    object-fit: contain;
}
#evo-arrow {
    font-size: 3rem;
    margin: 0 10px;
}

body.dark-theme footer {
    background: rgba(30, 35, 50, 0.9);
    border-top-color: var(--border);
    color: var(--text-light);
}
body.dark-theme footer .support-section a {
    color: var(--primary);
}
body.dark-theme footer .support-section a:hover {
    color: var(--primary-dark);
}
/* Big centered support reminder */
/* Support Modal - Centered with backdrop */
.support-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInBackdrop 0.3s ease-out;
}
.support-modal-content {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 40px 50px;
    border-radius: 48px;
    text-align: center;
    max-width: 500px;
    width: 85%;
    box-shadow: 0 30px 50px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.3);
    position: relative;
    animation: modalPop 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.support-modal-content i {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
}
.support-modal-content h2 {
    font-size: 2rem;
    margin: 10px 0;
}
.support-modal-content p {
    font-size: 1rem;
    margin: 15px 0;
    opacity: 0.9;
}
.support-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(0,0,0,0.3);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.support-modal-close:hover {
    background: rgba(0,0,0,0.6);
    transform: scale(1.1);
}
.support-modal-button {
    background: white;
    color: var(--primary-dark);
    border: none;
    padding: 12px 24px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: 0.2s;
}
.support-modal-button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Shooting star */
.shooting-star {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}
.shooting-star::before {
    content: '';
    position: absolute;
    top: 10%;
    left: -100px;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, #fff, transparent);
    border-radius: 50%;
    animation: shoot 8s linear infinite;
    opacity: 0;
}
@keyframes shoot {
    0% { transform: translateX(0) translateY(0); opacity: 0; }
    10% { opacity: 1; }
    20% { transform: translateX(120vw) translateY(20vh); opacity: 0; }
    100% { transform: translateX(120vw) translateY(20vh); opacity: 0; }
}

.bonus-pill.form { background: #ffcccc; color: #b30000; }
.bonus-pill.form.def { background: #cce5ff; color: #003d66; }
.bonus-pill.form.spd { background: #ccffcc; color: #006600; }
.bonus-pill.wild { background: #ff6b6b; color: white; }
.bonus-pill.wild.def { background: #4dabf7; }
.bonus-pill.wild.spd { background: #69db7c; }

.poke-card-bonus span:first-child:has(~ .bonus-pill.form) {
    font-size: 0.5rem !important;
}
.bonus-pill.form {
    font-size: 0.5rem !important;
}

.bonus-pill.form, 
.bonus-pill.form.def, 
.bonus-pill.form.spd {
    background: #ffb347;
    color: #3e3000;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
     font-size: 0.5rem !important;

}


/* Wild pills (ATK/DEF/SPD) – make them smaller */
.bonus-pill.atk, .bonus-pill.def, .bonus-pill.spd {
    padding: 2px 6px !important;
     font-size: 0.5rem !important;
}

/* Form pills – orange theme */
/* .bonus-pill.form { background: #ffb347; color: #7a2e00; }
.bonus-pill.form.def { background: #ffa559; color: #5e2a00; }
.bonus-pill.form.spd { background: #ffc966; color: #6b3c00; } */

/* Optional: Shiny pill already inline-styled, but you can add a class if needed */
