:root {
    --purple: #7650a8;
    --purple-dark: #4f347a;
    --purple-soft: #eee8f8;
    --green: #e1f2e2;
    --green-dark: #5c9b64;
    --ink: #263238;
    --muted: #707783;
    --border: #ddd7e6;
    --bg: #f5f3f7;
    --white: #fff;
    --shadow: 0 8px 26px rgba(50, 38, 70, .08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px clamp(14px, 4vw, 54px);
    background: rgba(255, 255, 255, .95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--purple);
    font-size: 22px;
    font-weight: 950;
    box-shadow: 0 6px 16px rgba(118, 80, 168, .24);
}

.brand-title {
    font-weight: 950;
    letter-spacing: -.03em;
}

.brand-subtitle {
    margin-top: 1px;
    color: var(--muted);
    font-size: 12px;
}

.container {
    width: min(1440px, calc(100% - 28px));
    margin: auto;
    padding: 26px 0 70px;
}

.hero {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 350px);
    gap: 28px;
    padding: 32px;
    margin-bottom: 18px;
    border-radius: 26px;
    color: #fff;
    background: linear-gradient(135deg, var(--purple-dark), var(--purple));
    box-shadow: var(--shadow);
}

.eyebrow {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .15em;
    opacity: .76;
}

.eyebrow.dark {
    color: var(--purple);
    opacity: 1;
}

.hero h1 {
    margin: 6px 0 8px;
    font-size: clamp(32px, 5vw, 50px);
    line-height: 1;
    letter-spacing: -.055em;
}

.hero p {
    max-width: 720px;
    margin: 0;
    color: rgba(255, 255, 255, .84);
    line-height: 1.55;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.hero-chips span {
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .11);
    font-size: 12px;
    font-weight: 800;
}

.progress-box {
    align-self: center;
    padding: 21px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .12);
}

.progress-number {
    font-size: 35px;
    line-height: 1;
    font-weight: 950;
}

.progress-number small {
    font-size: 18px;
    opacity: .6;
}

.progress-label {
    margin: 7px 0 13px;
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
}

.progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
}

.progress-value {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #fff;
    transition: width .25s ease;
}

.progress-percent {
    margin-top: 8px;
    text-align: right;
    color: rgba(255, 255, 255, .8);
    font-size: 11px;
    font-weight: 800;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 230px 230px;
    gap: 13px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow);
}

.toolbar label {
    display: block;
    margin: 0 0 6px 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

input[type="search"],
select {
    width: 100%;
    height: 45px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: #fff;
    color: var(--ink);
}

input[type="search"]:focus,
select:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(118, 80, 168, .12);
}

.ghost-button {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
}

.ghost-button:hover {
    color: var(--purple);
    border-color: #c7b6dc;
}

.summary-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px 24px;
    padding: 14px 3px 10px;
    color: var(--muted);
    font-size: 12px;
}

.summary-row strong {
    color: var(--ink);
}

.cookie-note {
    margin-left: auto;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.category-tab {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    transition: .16s ease;
}

.category-tab:hover {
    border-color: #c7b6dc;
    color: var(--purple);
    transform: translateY(-1px);
}

.category-tab.is-active {
    border-color: var(--purple);
    background: var(--purple);
    color: #fff;
}

.habitats {
    display: grid;
    gap: 18px;
}

.habitat-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 21px;
    background: #fff;
    box-shadow: var(--shadow);
}

.habitat-head {
    display: grid;
    grid-template-columns: 185px 1fr;
    gap: 19px;
    padding: 14px;
    background: linear-gradient(90deg, #f0ebf8, #fff);
    border-bottom: 1px solid var(--border);
}

.habitat-image {
    width: 185px;
    height: 125px;
    overflow: hidden;
    border-radius: 15px;
    background: #e9e7eb;
}

.habitat-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.habitat-meta {
    align-self: center;
}

.habitat-code {
    color: var(--purple);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .07em;
}

.habitat-title {
    margin: 4px 0 6px;
    font-size: 23px;
    line-height: 1.12;
    letter-spacing: -.025em;
}

.habitat-desc {
    max-width: 900px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.habitat-count {
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.resources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.resource-pill {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 5px 8px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #ded9e4;
    color: #59616a;
    font-size: 10px;
}

.resource-pill strong {
    color: var(--purple);
}

/*
 * Les cartes restent compactes, mais passent à 150 px minimum
 * afin que les informations supplémentaires restent lisibles.
 */
.pokemon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    padding: 12px;
}

.pokemon-card {
    position: relative;
    min-height: 245px;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fcfbfd;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    transition:
        transform .16s ease,
        box-shadow .16s ease,
        border-color .16s ease;
}

.pokemon-card:hover {
    transform: translateY(-2px);
    border-color: #c7b6dc;
    box-shadow: 0 8px 20px rgba(50, 38, 70, .11);
}

.pokemon-card:focus-visible {
    outline: 3px solid rgba(118, 80, 168, .28);
    outline-offset: 2px;
}

.pokemon-card.is-captured {
    border-color: #acd5b1;
    background: var(--green);
}

.pokemon-image-wrap {
    position: relative;
    height: 78px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 50% 43%,
            #fff 0,
            #f3eff6 74%
        );
}

.pokemon-sprite {
    width: 50px;
    height: 50px;
    display: block;
    background-repeat: no-repeat;
    background-position:
        var(--sprite-x, 0px)
        var(--sprite-y, 0px);
    image-rendering: auto;
}

.pokemon-fallback {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.missing-sprite {
    opacity: .3;
    border-radius: 50%;
    background: linear-gradient(135deg, #ddd, #eee);
}

.pokemon-info {
    display: block;
    padding: 7px 8px 9px;
}

.pokemon-number {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 850;
}

.pokemon-name {
    display: block;
    min-height: 29px;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 950;
    line-height: 1.15;
}

/* Informations PokéBip du Pokémon */
.pokemon-details {
    display: grid;
    gap: 4px;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid #e7e2eb;
}

.pokemon-detail {
    display: block;
    min-width: 0;
}

.pokemon-detail-label {
    display: block;
    margin-bottom: 1px;
    color: var(--purple);
    font-size: 7px;
    line-height: 1.1;
    font-weight: 950;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.pokemon-detail-value {
    display: block;
    overflow-wrap: anywhere;
    color: #59616a;
    font-size: 9px;
    line-height: 1.16;
    font-weight: 650;
}

.pokemon-detail.detail-rarity .pokemon-detail-value {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 999px;
    background: #efedf1;
    color: var(--muted);
    font-size: 8px;
    font-weight: 850;
}

.pokemon-detail.detail-rarity.rarity-commun .pokemon-detail-value {
    color: #4c7c53;
    background: #dff0df;
}

.pokemon-detail.detail-rarity.rarity-rare .pokemon-detail-value {
    color: #7b5c24;
    background: #f4ead1;
}

.pokemon-detail.detail-rarity.rarity-tres-rare .pokemon-detail-value {
    color: #82425a;
    background: #f2dbe4;
}

.check {
    position: absolute;
    right: 7px;
    top: 7px;
    z-index: 2;
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    color: transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    font-size: 14px;
    font-weight: 950;
}

.is-captured .check {
    color: #fff;
    background: var(--green-dark);
}

.is-captured .pokemon-sprite {
    opacity: .78;
    filter: saturate(.75);
}

.pokemon-card.is-captured .pokemon-image-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(225, 242, 226, .20);
    pointer-events: none;
}

.empty {
    padding: 45px 20px;
    border: 1px dashed var(--border);
    border-radius: 17px;
    color: var(--muted);
    text-align: center;
    background: #fff;
}

.global-empty {
    min-height: 160px;
    display: grid;
    place-items: center;
}

.setup-card {
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow);
}

.setup-card h1 {
    margin: 7px 0 8px;
    letter-spacing: -.035em;
}

.setup-card p {
    color: var(--muted);
}

.install-command {
    display: inline-block;
    padding: 12px 14px;
    border-radius: 10px;
    background: #242027;
    color: #fff;
    font: 600 13px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #eeeaf1;
}

.muted {
    color: var(--muted);
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 25px;
    }

    .toolbar {
        grid-template-columns: 1fr;
    }

    .cookie-note {
        width: 100%;
        margin-left: 0;
    }

    .habitat-head {
        grid-template-columns: 135px 1fr;
    }

    .habitat-image {
        width: 135px;
        height: 105px;
    }

    .pokemon-grid {
        grid-template-columns:
            repeat(auto-fill, minmax(145px, 1fr));
    }
}

@media (max-width: 520px) {
    .container {
        width: calc(100% - 14px);
        padding-top: 14px;
    }

    .topbar {
        padding: 9px 11px;
    }

    .brand-subtitle {
        display: none;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .hero {
        padding: 21px;
        border-radius: 21px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .habitat-head {
        grid-template-columns: 1fr;
    }

    .habitat-image {
        width: 100%;
        height: 165px;
    }

    .pokemon-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
        padding: 8px;
        gap: 7px;
    }

    .pokemon-card {
        min-height: 245px;
    }

    .pokemon-image-wrap {
        height: 76px;
    }

    .pokemon-name {
        min-height: 28px;
    }

    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 3px;
    }

    .category-tab {
        white-space: nowrap;
    }
}


/* PokéPoko - affichage par icônes des données Pokémon */
.pokemon-icon-row {
    display: block;
    min-width: 0;
}

.pokemon-icon-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    min-height: 24px;
}

.pokemon-info-icon {
    display: block;
    width: auto;
    max-width: 100%;
    height: 22px;
    object-fit: contain;
}

.pokemon-info-icon.icon-specialty {
    height: 23px;
}

.pokemon-info-icon.icon-time,
.pokemon-info-icon.icon-weather {
    height: 24px;
}

.pokemon-info-icon.icon-rarity {
    height: 20px;
}

.pokemon-info-icon.icon-zone {
    height: 25px;
}

/* Une icône "N'apparait pas..." reste visible mais atténuée. */
.pokemon-info-icon.is-disabled {
    opacity: .22;
    filter: grayscale(1);
}

.pokemon-icon-row + .pokemon-icon-row,
.pokemon-icon-row + .pokemon-detail,
.pokemon-detail + .pokemon-icon-row {
    margin-top: 3px;
}

@media (max-width: 520px) {
    .pokemon-info-icon {
        height: 20px;
    }

    .pokemon-info-icon.icon-time,
    .pokemon-info-icon.icon-weather {
        height: 22px;
    }

    .pokemon-info-icon.icon-zone {
        height: 23px;
    }
}
