* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #f5f7fb 0%, #e8edf7 100%);
    color: #1f2937;
    padding: 40px;
}

/* Search bar */

.search {
    display: block;
    width: min(600px, 100%);
    margin: 0 auto 40px auto;
    padding: 16px 22px;
    font-size: 18px;
    border: 2px solid #d1d5db;
    border-radius: 999px;
    outline: none;
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search:focus {
    border-color: #ef4444;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.20);
    transform: translateY(-1px);
}

/* Pokemon overview */

#pokemonList {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 24px;
}

#pokemonList .pokemonCard {
    text-decoration: none;
    color: #1f2937;
    background: white;
    border-radius: 22px;
    padding: 22px 16px 16px 16px;
    text-align: center;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

#pokemonList .pokemonCard:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
    border-color: rgba(239, 68, 68, 0.35);
}

#pokemonList img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    image-rendering: auto;
    transition: transform 0.2s ease;
}

#pokemonList .pokemonCard:hover img {
    transform: scale(1.08);
}

#pokemonList p {
    margin: 14px 0 0 0;
    font-size: 16px;
    font-weight: 700;
}

/* Detail page */

h1 {
    text-align: center;
    font-size: clamp(36px, 6vw, 72px);
    margin: 10px 0 20px 0;
    letter-spacing: -1px;
}

h2 {
    text-align: center;
    font-size: 32px;
    margin: 20px 0 30px 0;
}

/* Likes */

#likesList {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 22px;
}

#likesList div {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 18px 14px 14px 14px;
    text-align: center;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#likesList label {
    position: absolute;
    top: 10px;
    right: 10px;

    min-width: 32px;
    height: 32px;
    padding: 0 9px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #dca9a9;
    color: white;

    font-size: 14px;
    font-weight: 800;

    border-radius: 999px;
    border: 3px solid white;

    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

#likesList div:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.13);
}

#likesList img {
    width: 76px;
    height: 76px;
    object-fit: contain;
}

#likesList p {
    margin: 12px 0 0 0;
    font-size: 15px;
    font-weight: 600;
}

/* Mobile */

@media (max-width: 600px) {
    body {
        padding: 24px 16px;
    }

    .search {
        font-size: 16px;
        padding: 14px 18px;
        margin-bottom: 28px;
    }

    #pokemonList {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 16px;
    }

    #pokemonList .pokemonCard {
        padding: 18px 12px 14px 12px;
        border-radius: 18px;
    }

    #pokemonList img {
        width: 80px;
        height: 80px;
    }

    #likesList {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 16px;
    }

    #likesList img {
        width: 64px;
        height: 64px;
    }
}

.backButton {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px 18px;
    background: white;
    color: #1f2937;
    text-decoration: none;
    font-weight: 700;
    border-radius: 999px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.backButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.13);
    border-color: rgba(239, 68, 68, 0.35);
}
.topBar {
    max-width: 900px;
    margin: 0 auto 40px auto;
    display: flex;
    gap: 16px;
    align-items: center;
}

.topBar .search {
    margin: 0;
    flex: 1;
}

.compareButton {
    padding: 16px 22px;
    border: none;
    border-radius: 999px;
    background: #ef4444;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
}

.compareButton:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.compareButton:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pokemonCard {
    position: relative;
}

.selectCircle {
    display: none;
    position: absolute;
    top: 14px;
    left: 14px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid #d1d5db;
    background: white;
}

.compareMode .selectCircle {
    display: block;
}

.pokemonCard.selected {
    border-color: #ef4444 !important;
    box-shadow: 0 16px 34px rgba(239, 68, 68, 0.22) !important;
}

.pokemonCard.selected .selectCircle {
    border-color: #ef4444;
    background: #ef4444;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.pokemonCard.selected .selectCircle::after {
    content: "✓";
    color: white;
    font-size: 22px;
    font-weight: 900;
}

@media (max-width: 700px) {
    .topBar {
        flex-direction: column;
        align-items: stretch;
    }

    .compareButton {
        width: 100%;
    }
}

/* Compare page - selected Pokémon */

.selectedPokemonList {
    max-width: 1000px;
    margin: 0 auto 40px auto;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
}

/* Shared Pokémon image style */

.pokemonMainImage,
.pokemonSmallImage {
    display: block;
    object-fit: contain;
    background: white;
    border-radius: 50%;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.12);
}

/* Detail page image */

.pokemonMainImage {
    width: min(220px, 60vw);
    height: auto;
    margin: 0 auto 40px auto;
    padding: 28px;
}

/* Compare page selected Pokémon image */

.pokemonSmallImage {
    width: 130px;
    height: 130px;
    margin: 0 auto;
    padding: 18px;
}

.emptyMessage {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin: 40px auto;
    max-width: 700px;
    background: white;
    padding: 24px;
    border-radius: 22px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.selectedPokemon {
    padding-left: 12px;
    padding-right: 12px;
    text-align: center;
    font-weight: bold;
}