@import url(card.css);
        /* 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: min(600px, 100vw - 32px);
    aspect-ratio: 3 / 2;
    height: auto; 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, var(--tile-size, 50px)); position: absolute; top: 0; left: 0; z-index: 1; transition: transform 0.15s ease-out; }
    .tile {
    width: var(--tile-size, 50px);
    height: var(--tile-size, 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 */
/* ========== BOSS RAID LINK WITH FLAME EFFECT ========== */
.nav-link.boss-raid-link {
    position: relative;
    background: linear-gradient(135deg, #ff3300, #ff6600, #ff3300);
    background-size: 200% 200%;
    color: white !important;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    animation: bossRaidGlow 2s ease-in-out infinite, gradientShift 3s ease infinite;
    overflow: hidden;
    border: none;
}

/* Gradient shifting animation */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Pulsing glow effect */
@keyframes bossRaidGlow {
    0%, 100% {
        box-shadow: 0 0 5px #ff3300, 0 0 10px #ff6600;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px #ff3300, 0 0 30px #ff6600, 0 0 40px #ff9900;
        transform: scale(1.02);
    }
}

/* Flame particles container */
.nav-link.boss-raid-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: bossRaidShine 2s ease-in-out infinite;
}

@keyframes bossRaidShine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* Fire embers floating */
.nav-link.boss-raid-link::after {
    content: '🔥';
    position: absolute;
    top: -15px;
    right: -10px;
    font-size: 1.2rem;
    animation: fireEmber 1.5s ease-in-out infinite;
    opacity: 0.8;
}

@keyframes fireEmber {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-5px) rotate(20deg);
        opacity: 1;
    }
}

/* Floating particles around the link */
.boss-raid-wrapper {
    position: relative;
    display: inline-block;
}

.boss-raid-wrapper .flame-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #ff6600, #ff3300);
    border-radius: 50%;
    pointer-events: none;
    animation: floatUp 1.5s linear infinite;
    opacity: 0;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-30px) translateX(10px);
        opacity: 0;
    }
}

/* ========== BATTLE IMPACT EFFECTS ========== */
@keyframes floatUp {
    0% { transform: translateY(0) scale(1.4) rotate(-3deg); opacity: 1; }
    30% { transform: translateY(-30px) scale(1.6) rotate(2deg); opacity: 1; }
    70% { transform: translateY(-70px) scale(1.2) rotate(-1deg); opacity: 0.7; }
    100% { transform: translateY(-110px) scale(0.7) rotate(0deg); opacity: 0; }
}

.floating-damage {
    position: absolute;
    font-weight: 900;
    font-size: 1.6rem;
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255,50,0,0.8), 2px 2px 0 rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 1000;
    animation: floatUp 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    white-space: nowrap;
    font-family: 'Impact', 'Arial Black', sans-serif;
}

.floating-damage.critical {
    color: #ffcc00;
    font-size: 2.2rem;
    text-shadow: 0 0 15px rgba(255,200,0,1), 2px 2px 0 rgba(0,0,0,0.9);
    animation: floatUpCrit 1.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes floatUpCrit {
    0% { transform: translateY(0) scale(2) rotate(-5deg); opacity: 1; }
    20% { transform: translateY(-20px) scale(2.4) rotate(3deg); opacity: 1; }
    100% { transform: translateY(-120px) scale(0.9) rotate(1deg); opacity: 0; }
}

.hit-shockwave {
    position: absolute;
    border-radius: 50%;
    border: 3px solid rgba(255,150,0,0.9);
    pointer-events: none;
    z-index: 999;
    transform: translate(-50%, -50%) scale(0);
    animation: shockwaveExpand 0.6s ease-out forwards;
}

@keyframes shockwaveExpand {
    0% { transform: translate(-50%,-50%) scale(0); opacity: 1; width: 20px; height: 20px; }
    100% { transform: translate(-50%,-50%) scale(1); opacity: 0; width: 200px; height: 200px; }
}

.hit-flash-overlay {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    pointer-events: none;
    z-index: 998;
    animation: hitFlash 0.4s ease-out forwards;
}

@keyframes hitFlash {
    0% { opacity: 0; }
    15% { opacity: 0.35; }
    100% { opacity: 0; }
}

.impact-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 997;
    animation: impactBurst 0.7s ease-out forwards;
}

@keyframes impactBurst {
    0% { transform: translate(-50%,-50%) scale(1) translate(0,0); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(0) translate(var(--dx), var(--dy)); opacity: 0; }
}

.crit-stamp {
    position: absolute;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 1.8rem;
    color: #fff;
    text-shadow: 0 0 20px #ffaa00, 3px 3px 0 #cc0000;
    pointer-events: none;
    z-index: 1001;
    animation: critStamp 1.2s ease-out forwards;
    white-space: nowrap;
}

/* Super Effective Stamp Style */
.super-effective-stamp {
    position: absolute;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 1.6rem;
    color: #fff;
    text-shadow: 0 0 20px #44ff88, 0 0 40px #008800, 3px 3px 0 #004400; /* Green Glow */
    pointer-events: none;
    z-index: 1001;
    animation: critStamp 1.2s ease-out forwards;
    white-space: nowrap;
}

@keyframes critStamp {
    0% { transform: translate(-50%,-50%) scale(3) rotate(-8deg); opacity: 0; }
    15% { transform: translate(-50%,-50%) scale(1.1) rotate(2deg); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(0.8) rotate(0deg); opacity: 0; }
}

.shake-effect-hard { animation: shakeHard 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes shakeHard {
    0% { transform: translate(0,0) rotate(0); }
    10% { transform: translate(-6px,-5px) rotate(-2deg); }
    20% { transform: translate(6px,5px) rotate(2deg); }
    100% { transform: translate(0,0) rotate(0); }
}



/* Drag and Drop Professional Styles */
.poke-card[draggable="true"] {
    cursor: grab;
    user-select: none;
}
.poke-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    border: 2px dashed var(--primary) !important;
    background: rgba(59, 76, 202, 0.05);
}
#team-list {
    min-height: 100px;
    transition: all 0.3s ease;
}

/* Terastal Crystalline Glow */


/* Badge for UI */
.badge-terastal {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.4);
}

/* Crystallized effect for the small card images */
.poke-card.is-terastal .poke-card-img-wrap img {
    filter: drop-shadow(0 0 5px #aa88ff);
    animation: tera-pulse 3s infinite alternate ease-in-out;
}

/* Specific styling for the TERA pin */
/* Corner badges on cards */
.poke-card-corner-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 800;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Specific glow for Terastal cards in collection */
.poke-card.is-terastal {
    border-color: #a29bfe !important;
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.3);
}

.poke-card.is-terastal .poke-card-img-wrap {
    background: radial-gradient(circle, #f3f0ff 0%, #e0d7ff 100%);
    position: relative;
}

/* Subtle sparkle animation for the card image */
.poke-card.is-terastal .poke-card-img-wrap img {
    filter: drop-shadow(0 0 4px #6c5ce7);
    animation: card-tera-sparkle 3s infinite alternate;
}

@keyframes card-tera-sparkle {
    from { filter: drop-shadow(0 0 2px #6c5ce7) brightness(1); }
    to { filter: drop-shadow(0 0 8px #a29bfe) brightness(1.1); }
}


/* --- Overwrite in <style> block --- */
.terastal-sprite {
    animation: teraGlowAnim 2s infinite alternate ease-in-out !important;
}

@keyframes teraGlowAnim {
    from { filter: var(--tera-filter-low) brightness(1); }
    to { filter: var(--tera-filter-high) brightness(1.3); }
}

/* Battle Sprite Sizing - Player Pokémon Larger */
#battle-area .player-side .btl-sprite {
    width: 180px !important;
    height: 180px !important;
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

#battle-area .enemy-side .btl-sprite {
    width: 130px !important;
    height: 130px !important;
}

/* Responsive sizing for mobile */
@media (max-width: 768px) {
    #battle-area .player-side .btl-sprite {
        width: 140px !important;
        height: 140px !important;
    }
    #battle-area .enemy-side .btl-sprite {
        width: 100px !important;
        height: 100px !important;
    }
}

/*gds gfdfg dfgd */

/* Subtle sway for player Pokémon */
.player-side .btl-sprite {
    animation: subtleSway 4s ease-in-out infinite;
}

@keyframes subtleSway {
    0%, 100% {
        transform: scale(1.1) rotate(0deg);
    }
    50% {
        transform: scale(1.12) rotate(2deg);
    }
}

/* Enemy Pokémon slight sway in opposite direction */
.enemy-side .btl-sprite {
    animation: subtleSwayEnemy 4s ease-in-out infinite;
}

@keyframes subtleSwayEnemy {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(-2deg);
    }
}

/* Tera Card Styling */
.poke-card.is-terastal {
    border: 2px solid #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(168, 85, 247, 0.05) 100%);
    position: relative;
    overflow: hidden;
}

.poke-card.is-terastal::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, transparent 70%);
    animation: teraPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes teraPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

/* Shiny Card Styling */
.poke-card.is-shiny {
    border: 2px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255, 215, 0, 0.08) 100%);
}

.poke-card.is-shiny::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.15) 0%, transparent 70%);
    animation: shinySparkle 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shinySparkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

/* ULTRA RARE: Shiny + Tera Combined */
.poke-card.is-shiny.is-terastal {
    border: 3px solid #ffd700;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.5), 0 0 15px rgba(168, 85, 247, 0.4);
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255, 215, 0, 0.1) 50%, rgba(168, 85, 247, 0.1) 100%);
    animation: ultraRarePulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.poke-card.is-shiny.is-terastal::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, rgba(168, 85, 247, 0.2) 50%, transparent 80%);
    animation: ultraRareGlow 2.5s ease-in-out infinite;
    pointer-events: none;
}

.poke-card.is-shiny.is-terastal::after {
    content: '🌟✨';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1rem;
    opacity: 0.8;
    animation: starSpin 3s linear infinite;
    pointer-events: none;
}

@keyframes ultraRarePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), 0 0 10px rgba(168, 85, 247, 0.3); }
    50% { transform: scale(1.01); box-shadow: 0 0 35px rgba(255, 215, 0, 0.7), 0 0 20px rgba(168, 85, 247, 0.6); }
}

@keyframes ultraRareGlow {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.15); }
}

@keyframes starSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Corner badge for Tera */
.poke-card-corner-badge.badge-tera {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: 1px solid white;
}

/* Corner badge for Shiny+Tera combo */
.poke-card-corner-badge.badge-shiny-tera {
    background: linear-gradient(135deg, #ffd700, #6c5ce7);
    color: white;
    border: 1px solid #ffd700;
    animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 5px rgba(168, 85, 247, 0.8); }
}

/* Tera pill in bonus section */
.bonus-pill.tera {
    background: linear-gradient(135deg, #6c5ce7, #8b5cf6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ===== TEAM ICONS BAR ===== */
#battle-team-icons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 2px;
    margin-top: 5px;
}

.team-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.6);
    overflow: hidden;
    background: rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: filter 0.3s, border-color 0.3s, transform 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    position: relative;
    cursor: pointer;
}

.team-icon-wrap:hover {
    transform: scale(1.08);
    border-color: rgba(255,255,255,0.9);
}

.team-icon-wrap img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

/* Active pokemon gets a glowing white border */
.team-icon-wrap.is-active {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 2px 8px rgba(0,0,0,0.4);
    transform: scale(1.12);
}

/* Fainted pokemon turns gray with X overlay */
.team-icon-wrap.is-fainted {
    filter: grayscale(100%) brightness(0.5);
    border-color: rgba(255,255,255,0.2);
    box-shadow: none;
}

.team-icon-wrap.is-fainted::after {
    content: '✕';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 900;
    color: rgba(255,80,80,0.9);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Dark theme adjustments */
body.dark-theme .team-icon-wrap {
    background: rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.3);
}

body.dark-theme .team-icon-wrap.is-active {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 2px rgba(108,92,231,0.6);
}

/* ========== DATA SAVER MODE ========== */
/* Data Saver Mode - Reduces data usage */
body.data-saver-mode .btl-sprite,
body.data-saver-mode .encounter-sprite,
body.data-saver-mode .poke-card-img-wrap img {
    image-rendering: crisp-edges;
    filter: none !important;
}

/* Disable all battle effects */
body.data-saver-mode .floating-damage,
body.data-saver-mode .hit-shockwave,
body.data-saver-mode .hit-flash-overlay,
body.data-saver-mode .impact-particle,
body.data-saver-mode .crit-stamp,
body.data-saver-mode .super-effective-stamp {
    display: none !important;
}

/* Disable animations */
body.data-saver-mode .terastal-sprite,
body.data-saver-mode .evolution-animate,
body.data-saver-mode .shake-effect,
body.data-saver-mode .shake-effect-hard {
    animation: none !important;
}

/* Simplify damage numbers */
body.data-saver-mode .floating-damage {
    display: block !important;
    font-size: 0.9rem !important;
    background: rgba(0,0,0,0.7);
    padding: 2px 6px;
    border-radius: 4px;
    animation: none !important;
}

/* Disable background effects */
body.data-saver-mode .hit-flash-overlay {
    display: none !important;
}

/* Use lower quality images */
body.data-saver-mode img {
    image-rendering: pixelated;
}

/* Disable particle effects */
body.data-saver-mode .impact-particle,
body.data-saver-mode .hit-shockwave {
    display: none !important;
}

/* Disable music prompt animation */
body.data-saver-mode .music-prompt {
    animation: none !important;
}

/* Data Saver Mode - Music disabled indicator */
body.data-saver-mode #volume-toggle {
    opacity: 0.6;
    cursor: not-allowed;
}

body.data-saver-mode #volume-toggle:hover::after {
    content: " (Disabled in Data Saver)";
    font-size: 0.7rem;
    position: absolute;
    background: rgba(0,0,0,0.8);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Optional: Show a visual indicator that music is disabled */
body.data-saver-mode::after {
    content: "📱 Data Saver: Music OFF";
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: #2ecc71;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    z-index: 9999;
    pointer-events: none;
    font-weight: bold;
}

/* ========== DATA SAVER MODE ========== */
body.data-saver-mode {
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* Force pixelated rendering for all Pokemon images */
body.data-saver-mode img[src*="pokemon"],
body.data-saver-mode .btl-sprite,
body.data-saver-mode .encounter-sprite,
body.data-saver-mode .team-icon-wrap img,
body.data-saver-mode .poke-card-img-wrap img,
body.data-saver-mode #preview-sprite,
body.data-saver-mode #summary-sprite,
body.data-saver-mode #player-companion {
    image-rendering: pixelated !important;
    image-rendering: crisp-edges !important;
    filter: none !important;
}

/* Disable animations in data saver mode */
body.data-saver-mode .btl-sprite,
body.data-saver-mode .encounter-sprite,
body.data-saver-mode .terastal-sprite,
body.data-saver-mode .legendary-sprite,
body.data-saver-mode .mythical-sprite {
    animation: none !important;
    filter: none !important;
}

/* Disable battle effects */
body.data-saver-mode .hit-shockwave,
body.data-saver-mode .hit-flash-overlay,
body.data-saver-mode .impact-particle,
body.data-saver-mode .crit-stamp,
body.data-saver-mode .super-effective-stamp {
    display: none !important;
}

/* Simplify damage numbers */
body.data-saver-mode .floating-damage {
    animation: none !important;
    font-size: 1rem !important;
    background: rgba(0,0,0,0.7);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Disable companion animation */
body.data-saver-mode #player-companion {
    animation: none !important;
}

/* ========== MODERN POKEMON CARD - FIXED ASPECT RATIO (TRAINER CARD STYLE) ========== */
.poke-card.modern-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 100%;
    /* FIXED ASPECT RATIO - Like a trading card (3.5:2.5 ratio) */
    aspect-ratio: 7 / 5;
    min-width: 280px;
}

/* Make each card take FULL width of its container */
#team-list, #coll-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.poke-card.modern-card {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Card container - fills the fixed aspect ratio */
.card-landscape {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* LEFT SIDE - Artwork (Fixed proportion, not scrolling) */
.card-artwork {
    flex: 0 0 35%;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-right: 2px solid var(--border);
    overflow: hidden;
}

.dark-theme .card-artwork {
    background: linear-gradient(135deg, #1e2230 0%, #2d2f3e 100%);
}

.artwork-container {
    text-align: center;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.artwork-img {
    width: min(100%, 100px);
    height: auto;
    max-height: 100px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
}

.poke-card.modern-card:hover .artwork-img {
    transform: scale(1.05);
}

.artwork-types {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 6px;
    flex-wrap: wrap;
}

.artwork-types .type-badge {
    font-size: 0.55rem;
    padding: 1px 5px;
}

/* Badges positioned absolutely */
.special-badge-shiny,
.special-badge-tera,
.special-badge-combo,
.active-badge-modern {
    position: absolute;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.5rem;
    font-weight: 800;
    z-index: 10;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.special-badge-shiny {
    top: 5px;
    right: 5px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #333;
}

.special-badge-tera {
    top: 5px;
    right: 5px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.special-badge-combo {
    top: 5px;
    right: 5px;
    background: linear-gradient(135deg, #ffd700, #6c5ce7);
    color: white;
    font-size: 0.45rem;
}

.active-badge-modern {
    top: 5px;
    left: 5px;
    right: auto;
    background: var(--success);
    color: white;
}

/* RIGHT SIDE - Details (Fills remaining space, scrolls if needed) */
.card-details {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for details */
.card-details::-webkit-scrollbar {
    width: 3px;
}

.card-details::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 3px;
}

.card-details::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

/* Header */
.details-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 3px;
    flex-shrink: 0;
}

.pokemon-name {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}

.pokemon-name h3 {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0;
}

.pokemon-id {
    font-size: 0.55rem;
    color: var(--text-light);
}

.pokemon-level {
    display: flex;
    align-items: center;
    gap: 3px;
}

.level-badge {
    background: var(--primary);
    color: white;
    padding: 1px 6px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 700;
}

.shiny-icon, .tera-icon {
    font-size: 0.7rem;
}

/* Stats Container - Compact badges */
.stats-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.stat-line {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
}

.stat-label {
    font-weight: 800;
    color: var(--text-light);
    font-size: 0.5rem;
    background: rgba(0,0,0,0.05);
    padding: 1px 4px;
    border-radius: 8px;
}

.stat-badge {
    padding: 1px 4px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.5rem;
    white-space: nowrap;
}

.stat-badge.atk { background: #ff6b6b; color: white; }
.stat-badge.def { background: #4dabf7; color: white; }
.stat-badge.spd { background: #69db7c; color: #1a4731; }
.stat-badge.form { background: #ffb347; color: #3e3000; }
.stat-badge.total { background: linear-gradient(135deg, #a855f7, #6c5ce7); color: white; }

/* Progress Bars - Compact */
.progress-bars {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.hp-bar-container, .xp-bar-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 100px;
}

.bar-label {
    min-width: 20px;
    font-weight: 700;
    color: var(--text-light);
    font-size: 0.55rem;
}

.bar-track {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.xp-fill-modern {
    background: linear-gradient(90deg, #a855f7, #6c5ce7);
}

.bar-value {
    min-width: 40px;
    text-align: right;
    font-size: 0.5rem;
    color: var(--text-light);
}

/* Moves Section */
.moves-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    background: rgba(0,0,0,0.02);
    border-radius: 6px;
    padding: 3px 6px;
    flex-shrink: 0;
}

.moves-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-light);
}

.moves-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 1;
}

.modern-move-pill {
    padding: 1px 5px;
    border-radius: 12px;
    font-size: 0.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    cursor: help;
    transition: transform 0.2s;
    white-space: nowrap;
}

.modern-move-pill:hover {
    transform: scale(1.02);
}

.no-moves {
    font-size: 0.5rem;
    color: var(--text-light);
    font-style: italic;
}

/* Capture Details */
.capture-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.5rem;
    color: var(--text-light);
    padding: 2px 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.capture-details span {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
    flex-shrink: 0;
}

.action-btn {
    padding: 3px 8px;
    border: none;
    border-radius: 16px;
    font-size: 0.55rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.action-btn i {
    font-size: 0.55rem;
}

.evolve-btn {
    background: linear-gradient(135deg, #f6ad55, #ed8936);
    color: white;
}

.evolve-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(246,173,85,0.4);
}

.moves-btn {
    background: var(--primary);
    color: white;
}

.moves-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.active-btn {
    background: var(--success);
    color: white;
}

.active-btn:hover:not(:disabled) {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.active-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.move-btn {
    background: var(--warning);
    color: white;
}

.move-btn:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.add-btn {
    background: var(--primary);
    color: white;
}

.add-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.release-btn {
    background: var(--danger);
    color: white;
}

.release-btn:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(0);
}

/* Shiny/Tera animations */
@keyframes shinyPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(255,215,0,0.3); border-color: #ffd700; }
    50% { box-shadow: 0 0 20px rgba(255,215,0,0.5); border-color: #ffcc00; }
}

@keyframes teraGlow {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

@keyframes iconPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Dark mode adjustments */
.dark-theme .stat-label {
    background: rgba(255,255,255,0.1);
}

.dark-theme .action-btn {
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* RESPONSIVE - Maintains aspect ratio on all screens */
@media (max-width: 768px) {
    .poke-card.modern-card {
        aspect-ratio: 7 / 5;
        min-width: 260px;
    }
    
    .artwork-img {
        width: min(100%, 80px);
        max-height: 80px;
    }
    
    .pokemon-name h3 {
        font-size: 0.75rem;
    }
    
    .level-badge {
        font-size: 0.55rem;
        padding: 1px 5px;
    }
    
    .stat-badge {
        font-size: 0.45rem;
        padding: 1px 3px;
    }
    
    .modern-move-pill {
        font-size: 0.45rem;
        padding: 1px 4px;
    }
    
    .action-btn {
        padding: 2px 6px;
        font-size: 0.5rem;
    }
    
    .hp-bar-container, .xp-bar-container {
        min-width: 80px;
    }
    
    .bar-label {
        font-size: 0.5rem;
        min-width: 18px;
    }
    
    .bar-value {
        font-size: 0.45rem;
        min-width: 35px;
    }
}

@media (max-width: 640px) {
    .poke-card.modern-card {
        aspect-ratio: auto;
        min-height: 280px;
    }
    
    .card-landscape {
        flex-direction: column;
        height: auto;
    }
    
    .card-artwork {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 2px solid var(--border);
        padding: 10px;
    }
    
    .artwork-img {
        width: 80px;
        height: 80px;
    }
    
    .card-details {
        overflow-y: visible;
        max-height: none;
    }
    
    .progress-bars {
        flex-direction: column;
        gap: 4px;
    }
    
    .hp-bar-container, .xp-bar-container {
        width: 100%;
    }
    
    .action-buttons {
        justify-content: center;
    }
}

/* Ultra-wide screens - card maintains aspect ratio */
@media (min-width: 1200px) {
    .poke-card.modern-card {
        aspect-ratio: 7 / 5;
    }
    
    .artwork-img {
        width: min(100%, 110px);
        max-height: 110px;
    }
    
    .pokemon-name h3 {
        font-size: 0.95rem;
    }
    
    .stat-badge {
        font-size: 0.55rem;
    }
    
    .modern-move-pill {
        font-size: 0.55rem;
    }
}

/* Force cards to maintain aspect ratio in their container */
.list-container {
    max-width: 1000px;
    width: 95%;
    margin: 30px auto;
}

#team-list, #coll-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ========== MODAL SCROLLING FIXES FOR MOBILE ========== */
/* Switch Pokémon Modal - Mobile optimizations */
#switch-pokemon-modal .modal,
#pre-battle-select-modal .modal {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--card-bg);
    border-radius: 24px;
}

#switch-pokemon-list,
#pre-battle-select-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for modals */
#switch-pokemon-list::-webkit-scrollbar,
#pre-battle-select-list::-webkit-scrollbar {
    width: 4px;
}

#switch-pokemon-list::-webkit-scrollbar-track,
#pre-battle-select-list::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 4px;
}

#switch-pokemon-list::-webkit-scrollbar-thumb,
#pre-battle-select-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* Mobile specific modal adjustments */
@media (max-width: 640px) {
    #switch-pokemon-modal .modal,
    #pre-battle-select-modal .modal {
        max-height: 90vh;
        width: 95%;
        margin: 0 auto;
        border-radius: 20px;
    }
    
    #switch-pokemon-list button,
    #pre-battle-select-list button {
        padding: 10px !important;
        margin: 6px 0 !important;
    }
    
    #switch-pokemon-list img,
    #pre-battle-select-list img {
        width: 40px !important;
        height: 40px !important;
    }
    
    .instruction {
        font-size: 0.65rem !important;
        padding: 6px 10px !important;
    }
}

/* ========== POKEDEX RECORDS - CAUGHT STATUS ========== */
.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;
    position: relative;
}

.records-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

/* Not caught card styling */
.records-card-not-caught {
    opacity: 0.85;
    border-color: #6b7280;
}

.records-card-not-caught .records-card-name {
    color: #6b7280;
}

.records-card-img {
    background: #f8fafc;
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.records-card-img img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    image-rendering: pixelated;
    transition: filter 0.3s;
}

/* Silhouette effect for not caught */
.records-card-not-caught .records-card-img img {
    filter: brightness(0) contrast(0) drop-shadow(0 0 3px rgba(0,0,0,0.3));
    opacity: 0.8;
}

/* Dark mode silhouette */
.dark-theme .records-card-not-caught .records-card-img img {
    filter: brightness(0) contrast(0) drop-shadow(0 0 3px rgba(255,255,255,0.2));
    opacity: 0.6;
}

.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-not-caught .records-card-name {
    color: #6b7280;
}

.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;
}

.records-card-badge {
    text-align: center;
    margin-top: 6px;
    font-size: 0.55rem;
    font-weight: bold;
}

.records-caught-badge {
    background: var(--success);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}

.records-not-caught-badge {
    background: #6b7280;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}

/* Dark mode adjustments */
.dark-theme .records-card-img {
    background: #1e2230;
}

.dark-theme .records-card-not-caught .records-card-name {
    color: #9ca3af;
}

.dark-theme .records-card-not-caught {
    border-color: #4a5568;
}

@import url(card.css);
