:root {
    --pokemon-theme: #147367;
    --pokemon-theme-dark: #0d4f48;
    --pokemon-theme-soft: #d9f0eb;
    --pokemon-theme-shadow: #093932;
}

.game-pokemon-tool {
    padding-bottom: 3rem;
}

.pokemon-tool-container {
    max-width: 1200px;
}

.pokemon-intro,
.pokemon-game-select {
    margin-bottom: 1rem;
}

.pokemon-intro .tool-title {
    margin-bottom: 0.45rem;
}

.pokemon-intro .tool-description {
    margin-bottom: 0;
}

.pokemon-game-select__title {
    margin: 0 0 0.8rem;
    color: var(--text-dark);
    font-size: 1rem;
}

.pokemon-game-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.pokemon-game-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    min-height: 80px;
    padding: 0.65rem 0.8rem;
    border: 2px solid #d7e3e0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    transition:
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
}

.pokemon-game-option:hover {
    border-color: var(--teal-mid);
}

.pokemon-game-option.is-active {
    border-color: var(--teal-mid);
    background: #edf8f6;
    box-shadow: 0 0 0 3px rgba(20, 115, 103, 0.1);
}

.pokemon-game-option img {
    display: block;
    max-width: 150px;
    max-height: 48px;
    object-fit: contain;
}

.pokemon-workspace[hidden] {
    display: none;
}

.pokemon-mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.pokemon-game-select__divider {
    height: 1px;
    margin: 1rem 0 0;
    border: 0;
    background: linear-gradient(
        to right,
        transparent,
        rgba(15, 23, 42, 0.18) 12%,
        rgba(15, 23, 42, 0.18) 88%,
        transparent
    );
}

.pokemon-mode-button {
    min-height: 48px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    color: var(--text-dark);
    font: 700 0.98rem 'M PLUS Rounded 1c', sans-serif;
    cursor: pointer;
}

.pokemon-mode-button.is-active {
    border-color: var(--pokemon-theme);
    background: var(--pokemon-theme-soft);
    color: var(--pokemon-theme-dark);
    box-shadow: inset 0 0 0 1px var(--pokemon-theme);
}

.pokemon-preview-shell {
    padding: clamp(12px, 2.5vw, 28px);
    background: transparent;
}

.pokemon-preview-title {
    position: relative;
    margin: 0 0 1.4rem;
    padding-bottom: 0.6rem;
    background: linear-gradient(
        to right,
        transparent 0%,
        #0f172a 15%,
        #0f172a 85%,
        transparent 100%
    ) bottom / 100% 2.5px no-repeat;
    color: #0f172a;
    font: 900 italic 1.7rem 'M PLUS Rounded 1c', sans-serif;
    letter-spacing: -0.02em;
    text-align: center;
    cursor: pointer;
}

.pokemon-preview-title:focus-visible {
    outline: 2px solid #0f766e;
    outline-offset: 5px;
}

.pokemon-preview-title::after {
    display: inline-block;
    margin-left: 0.45rem;
    color: #0f766e;
    font-family: 'Font Awesome 6 Free';
    font-size: 0.62em;
    font-style: normal;
    font-weight: 900;
    vertical-align: 0.12em;
    content: '\f303';
    opacity: 0.8;
}

.pokemon-preview-title:hover::after {
    opacity: 1;
}

.pokemon-preview-shell.is-exporting .pokemon-preview-title::after {
    display: none;
    content: none;
    font-family: inherit;
}

.pokemon-card-grid {
    --pokemon-card-width: 1100;
    --pokemon-card-height: 458;
    --pokemon-card-depth: 8;
    display: grid;
    grid-template-columns: minmax(0, 1108px);
    align-items: start;
    justify-content: center;
    gap: clamp(18px, 2.4vw, 30px);
}

.pokemon-card-grid--pair {
    --pokemon-card-width: 390;
    grid-template-columns: repeat(3, minmax(0, 398px));
}

/* Reserve the scaled footprint, including the card's right/bottom depth. */
.pokemon-card-viewport {
    position: relative;
    width: 100%;
    min-width: 0;
    aspect-ratio:
        calc(var(--pokemon-card-width) + var(--pokemon-card-depth)) /
        calc(var(--pokemon-card-height) + var(--pokemon-card-depth));
    overflow: clip;
}

.pokemon-card-viewport > .pokemon-card,
.pokemon-card-viewport > .pokemon-card-add {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(var(--pokemon-card-width) * 1px);
    height: calc(var(--pokemon-card-height) * 1px);
    transform: scale(var(--pokemon-preview-scale, 1));
    transform-origin: top left;
}

.pokemon-card {
    position: relative;
    color: #1f2937;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    isolation: isolate;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: clamp(360px, 30vw, 458px);
    overflow: visible;
    border: 0;
    border-radius: 64px 0 64px 0;
    background: transparent;
    box-shadow: none;
}

.pokemon-card-depth {
    position: absolute;
    inset: 8px -8px -8px 8px;
    z-index: -1;
    border-radius: 64px 0 64px 0;
    background: linear-gradient(
        to right,
        color-mix(
            in srgb,
            var(--character-color, #64748b) 58%,
            #253746
        ),
        color-mix(
            in srgb,
            var(--pokemon-team-type-color,
                var(--pokemon-type-color, var(--character-color, #64748b))
            ) 58%,
            #253746
        )
    );
    pointer-events: none;
}

.pokemon-card-depth::before,
.pokemon-card-depth::after {
    position: absolute;
    display: block;
    content: '';
    pointer-events: none;
}

.pokemon-card-depth::before {
    top: -8px;
    right: 0;
    width: 9px;
    height: calc(100% - 64px);
    clip-path: polygon(0 0, 100% 8px, 100% 100%, 0 calc(100% - 8px));
    background: color-mix(
        in srgb,
        var(--pokemon-team-type-color,
            var(--pokemon-type-color, var(--character-color, #64748b))
        ) 48%,
        #253746
    );
}

.pokemon-card-depth::after {
    bottom: 0;
    left: -8px;
    width: calc(100% - 64px);
    height: 9px;
    clip-path: polygon(0 0, 8px 100%, 100% 100%, calc(100% - 8px) 0);
    background: linear-gradient(
        to right,
        color-mix(
            in srgb,
            var(--character-color, #64748b) 48%,
            #253746
        ),
        color-mix(
            in srgb,
            var(--pokemon-team-type-color,
                var(--pokemon-type-color, var(--character-color, #64748b))
            ) 48%,
            #253746
        )
    );
}

.pokemon-card::before {
    position: absolute;
    inset: 0;
    z-index: 0;
    box-sizing: border-box;
    border: 0;
    border-radius: 64px 0 64px 0;
    background:
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.28) 0 0.9px,
            transparent 1.3px
        ) 0 0 / 10px 18px,
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.28) 0 0.9px,
            transparent 1.3px
        ) 5px 9px / 10px 18px,
        linear-gradient(
            135deg,
            var(--character-color, #64748b),
            var(--pokemon-type-color, #7d91a0)
        );
    box-shadow: none;
    content: '';
    pointer-events: none;
}

.pokemon-card::after {
    position: absolute;
    inset: 20px;
    z-index: 1;
    border-radius: 48px 0 48px 0;
    background: #fff;
    content: '';
    pointer-events: none;
}

.pokemon-card-delete-button {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 30;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(15, 48, 64, 0.24);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: #42515a;
    box-shadow: 1px 1px 0 rgba(15, 48, 64, 0.35);
    cursor: pointer;
}

.pokemon-card-delete-button i {
    font-size: 0.9rem;
}

.pokemon-card-delete-button:hover {
    background: #fee2e2;
    color: #dc2626;
}

.pokemon-card--gym {
    display: block;
    width: min(100%, 1100px);
}

.pokemon-card--gym::before {
    background:
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.28) 0 0.9px,
            transparent 1.3px
        ) 0 0 / 10px 18px,
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.28) 0 0.9px,
            transparent 1.3px
        ) 5px 9px / 10px 18px,
        linear-gradient(
            135deg,
            color-mix(
                in srgb,
                var(--character-color, #64748b) 78%,
                white
            ) 0%,
            var(--character-color, #64748b) 24%,
            var(
                --pokemon-team-frame-dark-color,
                color-mix(
                    in srgb,
                    var(--character-color, #64748b) 68%,
                    #0f172a
                )
            ) 38% 46%,
            var(--pokemon-team-type-color,
                color-mix(
                    in srgb,
                    var(--character-color, #64748b) 68%,
                    #0f172a
                )
            ) 50% 100%
        );
}

.pokemon-card-character {
    position: absolute;
    top: 10px;
    bottom: auto;
    left: 10px;
    z-index: 9;
    width: 210px;
    height: 139px;
    overflow: visible;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.pokemon-card--gym .pokemon-card-character {
    top: 11.5%;
    left: 14px;
    width: 212.8px;
    height: auto;
    aspect-ratio: 210 / 139;
}

.pokemon-card--gym .pokemon-character-portrait {
    width: 285.7143%;
}

.pokemon-character-portrait {
    position: absolute;
    display: block;
    width: 600px;
    height: auto;
    aspect-ratio: 1915 / 1268;
    margin: 0;
    pointer-events: none;
}

.pokemon-card-team {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: 38% 38%;
    gap: 0;
    align-content: space-between;
    min-width: 0;
    padding: 6% 4% 5% 29%;
    background: transparent;
    pointer-events: none;
}

.pokemon-card-team > .pokemon-team-slot {
    grid-column: span 2;
}

.pokemon-card-team[data-team-size="2"],
.pokemon-card-team[data-team-size="3"] {
    grid-template-rows: 38%;
    align-content: center;
}

.pokemon-card-team[data-team-size="2"] > :nth-child(1),
.pokemon-card-team[data-team-size="4"] > :nth-child(odd) {
    grid-column: 2 / span 2;
}

.pokemon-card-team[data-team-size="2"] > :nth-child(2),
.pokemon-card-team[data-team-size="4"] > :nth-child(even) {
    grid-column: 4 / span 2;
}

.pokemon-card-team[data-team-size="5"] > :nth-child(4) {
    grid-column: 2 / span 2;
}

.pokemon-card-team[data-team-size="5"] > :nth-child(5) {
    grid-column: 4 / span 2;
}

.pokemon-team-slot {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    min-width: 0;
    min-height: 0;
    padding: 2px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #26343c;
    font-family: inherit;
    cursor: pointer;
    pointer-events: auto;
}

.pokemon-team-slot--gym {
    overflow: visible;
}

.pokemon-gym-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.pokemon-slot-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #fff;
    color: #344054;
    font: 23px/1 sans-serif;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
    transition:
        background 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
}

.pokemon-slot-remove:hover {
    background: #fee2e2;
    color: #b91c1c;
    transform: scale(1.08);
}

.pokemon-slot-remove:focus-visible {
    outline: 2px solid #0f766e;
    outline-offset: 2px;
}

.pokemon-gym-paint,
.pokemon-gym-artwork {
    position: absolute;
    inset: -15%;
    display: block;
    width: 130%;
    height: 130%;
    pointer-events: none;
}

.pokemon-gym-paint {
    z-index: 1;
}

.pokemon-gym-artwork {
    z-index: 2;
}

.pokemon-team-slot--empty {
    justify-self: center;
    width: min(100%, 176px);
    height: 100%;
    box-sizing: border-box;
    align-content: center;
    gap: 12px;
    padding: 18px 12px;
    border: 2px dashed color-mix(
        in srgb,
        var(--pokemon-theme) 62%,
        white
    );
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--pokemon-theme-dark);
    font-size: 0.95rem;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 4px 14px rgba(15, 48, 64, 0.08);
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        transform 0.16s ease;
}

.pokemon-team-slot--empty i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--pokemon-theme-soft);
    color: var(--pokemon-theme-dark);
    font-size: 1.1rem;
}

.pokemon-team-slot--empty:hover {
    border-color: var(--pokemon-theme-dark);
    background: #fff;
    transform: translateY(-2px);
}

.pokemon-team-slot--empty:hover i {
    background: var(--pokemon-theme);
    color: #fff;
}

.pokemon-team-slot--empty:focus-visible,
.pokemon-gym-select:focus-visible,
.pokemon-team-slot--add:focus-visible,
.pokemon-slot-remove:focus-visible {
    outline: 3px solid var(--pokemon-theme-dark);
    outline-offset: 3px;
}

.pokemon-team-slot--add {
    position: absolute;
    right: 30px;
    bottom: 26px;
    min-width: 78px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid rgba(13, 79, 72, 0.2);
    border-radius: 8px 8px 30px 8px;
    background: rgba(255, 255, 255, 0.94);
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--pokemon-theme-dark);
    font-size: 0.8rem;
    font-weight: 800;
    box-shadow: 0 5px 16px rgba(15, 48, 64, 0.14);
    cursor: pointer;
    transition:
        transform 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
}

.pokemon-team-slot--add i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 2px solid currentColor;
    border-radius: 50%;
    background: var(--pokemon-theme-soft);
    font-size: 1.1rem;
}

.pokemon-team-slot--add:hover {
    background: #fff;
    box-shadow: 0 7px 18px rgba(15, 48, 64, 0.2);
    transform: translateY(-2px);
}

.pokemon-team-slot--add:hover i {
    background: var(--pokemon-theme);
    color: #fff;
}

.pokemon-gym-names {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    max-width: 22%;
    pointer-events: none;
}

.pokemon-gym-name {
    display: block;
    width: max-content;
    padding: 0.22em 0.48em;
    background: color-mix(in srgb, var(--character-color) 70%, white);
    color: #fff;
    font: 600 1.18rem / 1.08 'Noto Sans JP', sans-serif;
    white-space: nowrap;
    text-align: left;
}

.pokemon-gym-name--condensed {
    transform: scaleX(var(--name-scale, 0.9));
    transform-origin: left center;
}

.pokemon-gym-name--character {
    background: color-mix(in srgb, var(--character-color) 52%, white);
    padding: 0.3em 0.56em;
    font-size: 1.5rem;
    box-shadow: inset 0 0 0 1px var(--name-border, transparent);
}

.pokemon-empty-character,
.pokemon-empty-pokemon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
    font-size: 0.88rem;
    font-weight: 800;
    text-align: center;
}

.pokemon-empty-character i,
.pokemon-empty-pokemon i {
    font-size: 2rem;
}

.pokemon-card--pair {
    width: min(100%, 390px);
    justify-self: center;
}

.pokemon-pair-character,
.pokemon-pair-pokemon {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    padding: 28px 20px 58px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.pokemon-pair-character {
    top: 11.5%;
    right: auto;
    bottom: auto;
    left: 5.1282%;
    z-index: 9;
    width: 48.7179%;
    height: auto;
    aspect-ratio: 210 / 139;
    overflow: visible;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.pokemon-pair-character .pokemon-character-portrait {
    width: 285.7143%;
    z-index: 1;
}

.pokemon-pair-pokemon {
    z-index: 3;
    display: block;
    padding: 0;
}

.pokemon-pair-pokemon:not(.has-pokemon) .pokemon-empty-pokemon {
    position: absolute;
    top: 68%;
    left: 64%;
    width: min(48%, 210px);
    height: 180px;
    transform: translate(-50%, -50%);
    border: 2px dashed rgba(13, 79, 72, 0.62);
    border-radius: 22px 10px 22px 10px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--pokemon-theme-dark);
    box-shadow: none;
    font-size: 1.05rem;
    font-weight: 700;
}

.pokemon-pair-pokemon:not(.has-pokemon) .pokemon-empty-pokemon i {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--pokemon-theme-soft);
    font-size: 1.1rem;
}

.pokemon-pair-names {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    color: #4b5563;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    line-height: 1;
    pointer-events: none;
}

.pokemon-pair-name {
    display: block;
    width: max-content;
    padding: 5px 10px 7px;
    color: var(--name-text-color, #fff);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.05;
    text-align: right;
    white-space: nowrap;
}

.pokemon-pair-name--condensed {
    transform: scaleX(var(--name-scale, 0.9));
    transform-origin: right center;
}

.pokemon-pair-name--character {
    background: color-mix(
        in srgb,
        var(--name-color, #c97b7b) 58%,
        #fff
    );
    box-shadow: inset 0 0 0 1px var(--name-border, transparent);
}

.pokemon-pair-name--pokemon {
    background: color-mix(
        in srgb,
        var(--pokemon-type-color, #34cf5a) 58%,
        #fff
    );
    color: var(--pokemon-name-text-color, #fff);
    box-shadow: inset 0 0 0 1px var(--pokemon-name-border, transparent);
}

.pokemon-pair-artwork {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 6px rgba(0, 0, 0, 0.22));
    pointer-events: none;
}

.pokemon-pair-paint {
    position: absolute;
    inset: 20px;
    z-index: 1;
    display: block;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    pointer-events: none;
}

.pokemon-pair-artwork {
    z-index: 2;
}

.pokemon-card-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 0;
    height: clamp(360px, 30vw, 458px);
    box-sizing: border-box;
    padding: 20px;
    border: 3px dashed var(--pokemon-theme-dark);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.46);
    color: var(--pokemon-theme-dark);
    font: 800 1rem 'M PLUS Rounded 1c', sans-serif;
    cursor: pointer;
}

.pokemon-card-add:hover {
    border-color: var(--pokemon-theme-dark);
    background: rgba(255, 255, 255, 0.76);
}

.pokemon-card-add--gym {
    height: clamp(360px, 30vw, 458px);
}

.pokemon-card-add--pair {
    width: min(100%, 390px);
    height: clamp(360px, 30vw, 458px);
    justify-self: center;
}

.pokemon-card-add i {
    font-size: 2rem;
}

.pokemon-card-grid.is-exporting {
    box-sizing: border-box;
    gap: 32px;
    padding: 0;
}

.pokemon-preview-shell.is-exporting {
    width: max-content;
    max-width: none;
    padding: 40px;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(
            circle at 8% 4%,
            rgba(38, 198, 218, 0.18),
            transparent 30rem
        ),
        radial-gradient(
            circle at 92% 18%,
            rgba(99, 102, 241, 0.13),
            transparent 34rem
        ),
        linear-gradient(
            180deg,
            #f7fbff 0%,
            #f2faf8 55%,
            #f8fbff 100%
        );
}

.pokemon-preview-shell.is-exporting .pokemon-preview-title {
    overflow-wrap: anywhere;
}

.pokemon-card-grid.is-exporting .pokemon-card-add,
.pokemon-card-grid.is-exporting [data-editor-only] {
    display: none;
}

.pokemon-card-grid.is-exporting .pokemon-team-slot--empty,
.pokemon-card-grid.is-exporting .pokemon-pair-pokemon:not(.has-pokemon) {
    visibility: hidden;
}

.pokemon-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pokemon-picker-overlay.is-open {
    display: flex;
}

.pokemon-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 19, 24, 0.72);
}

.pokemon-picker-panel {
    position: relative;
    width: min(680px, calc(100vw - 3rem));
    max-height: calc(100vh - 3rem);
    overflow: auto;
    padding: 1.4rem 1.5rem;
    box-sizing: border-box;
    border: 2px solid #1e293b;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

.pokemon-picker-panel.is-character-picker {
    width: min(540px, calc(100vw - 0.75rem));
    max-height: none;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.pokemon-picker-panel.is-pokemon-picker {
    width: min(980px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 1.1rem 1.25rem;
    overflow-x: hidden;
    border: 1px solid #d9e1e8;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.pokemon-picker-panel.is-pokemon-picker .pokemon-picker-close {
    position: absolute;
    top: 12px;
    right: 12px;
    float: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f2f4f7;
    color: #344054;
}

.game-pokemon-pokemon-picker {
    display: grid;
    gap: 1rem;
    color: #1f2937;
}

.pokemon-picker-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 48px;
    padding: 0 3rem 0.7rem 0;
    border-bottom: 2px solid #e5e7eb;
}

.pokemon-picker-heading h3 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    font-size: 1.35rem;
}

.pokemon-picker-heading h3 i {
    color: #e33545;
}

.pokemon-picker-heading > span {
    color: #667085;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.pokemon-picker-filters {
    display: grid;
    gap: 0.6rem;
}

.pokemon-filter-search,
.pokemon-filter-section {
    display: grid;
    gap: 0.5rem;
}

.pokemon-filter-search {
    width: 100%;
}

.pokemon-filter-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    justify-content: start;
    gap: 0.55rem;
}

.pokemon-picker-options {
    display: flex;
    flex-wrap: wrap;
    width: auto;
    align-items: center;
    justify-content: flex-start;
    flex-direction: column;
    gap: 0.6rem;
    padding-bottom: 1px;
}

.pokemon-filter-search > span,
.pokemon-filter-section h4 {
    margin: 0;
    color: #344054;
    font-size: 0.98rem;
    font-weight: 800;
}

.pokemon-filter-search input {
    width: 100%;
    min-height: 46px;
    padding: 0.65rem 0.85rem;
    box-sizing: border-box;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    color: #1d2939;
    font: inherit;
}

.pokemon-type-filter-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 0.55rem;
}

.pokemon-type-filter {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.25rem 0.15rem 0.35rem;
    border: 2px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #475467;
    font: inherit;
    font-size: 0.76rem;
    cursor: pointer;
}

.pokemon-type-filter img {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
}

.pokemon-type-filter.is-active {
    border-color: #f79009;
    background: #fffaeb;
    color: #1d2939;
}

.pokemon-region-filter-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.4rem;
}

.pokemon-region-filter {
    min-height: 42px;
    padding: 0.45rem 0.55rem;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
    background: #fff;
    color: #344054;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s ease;
}

.pokemon-region-filter:hover {
    border-color: #98a2b3;
    background: #f9fafb;
}

.pokemon-region-filter.is-active {
    border-color: var(--pokemon-theme);
    background: var(--pokemon-theme-soft);
    color: var(--pokemon-theme-dark);
    box-shadow: inset 0 0 0 1px var(--pokemon-theme);
}

#pokemonPickerBody.game-pokemon-character-picker .game-pokemon-live-icon {
    display: block;
    flex: 0 0 auto;
    padding: 4px;
    overflow: hidden;
    box-sizing: border-box;
    border: 3px solid var(--character-icon-color);
    background: var(--character-icon-color);
}

.game-pokemon-live-icon__crop {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
    border: 2px solid #fff;
    border-radius: 50%;
    background: color-mix(
        in srgb,
        var(--character-icon-color) 30%,
        #fff
    );
}

.game-pokemon-live-icon__image {
    position: absolute;
    display: block;
    max-width: none;
    max-height: none;
    margin: 0;
}

.pokemon-picker-panel.is-character-picker .pokemon-picker-close {
    width: 34px;
    height: 34px;
    border-radius: 0;
    background: transparent;
    color: #64748b;
}

.pokemon-picker-close {
    position: sticky;
    top: 0;
    z-index: 20;
    float: right;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #263238;
    color: #fff;
    cursor: pointer;
}

.pokemon-shiny-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-width: 128px;
    min-height: 46px;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    background: #fff;
    color: #475569;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        color 0.15s ease;
}

.pokemon-shiny-toggle i {
    color: #98a2b3;
}

.pokemon-shiny-toggle.is-active {
    border-color: #f79009;
    background: #fffaeb;
    color: #93370d;
}

.pokemon-shiny-toggle.is-active i {
    color: #f79009;
}

.pokemon-list-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
    max-height: min(30vh, 300px);
    padding: 2px 4px 4px;
    overflow-x: hidden;
    overflow-y: auto;
}

.pokemon-list-option {
    min-width: 0;
    padding: 0.35rem 0.2rem 0.5rem;
    border: 2px solid transparent;
    border-radius: 14px;
    background: transparent;
    cursor: pointer;
}

.pokemon-list-option:hover,
.pokemon-list-option.is-selected {
    border-color: var(--pokemon-theme);
    background: var(--pokemon-theme-soft);
}

.pokemon-list-option--clear {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.4rem;
    color: #667085;
}

.pokemon-list-option--clear i {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    color: #98a2b3;
    font-size: 1.5rem;
}

.pokemon-list-option--clear:hover {
    border-color: #98a2b3;
    background: #f2f4f7;
}

.pokemon-list-option img {
    display: block;
    width: 58px;
    height: 58px;
    margin: auto;
    object-fit: contain;
}

.pokemon-list-option span {
    display: block;
    min-width: 0;
    overflow: hidden;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pokemon-list-note {
    grid-column: 1 / -1;
    margin: 0.4rem 0;
    color: #64748b;
    font-size: 0.78rem;
    text-align: center;
}

.pokemon-list-status {
    grid-column: 1 / -1;
    margin: 0;
    padding: 3rem 1rem;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
}

.pokemon-list-status--error {
    color: #b42318;
}

@media (max-width: 1100px) {
    .pokemon-card-grid--pair {
        grid-template-columns: repeat(2, minmax(0, 398px));
    }
}

@media (max-width: 760px) {
    .pokemon-game-option {
        width: calc(50% - 0.35rem);
        min-height: 66px;
        box-sizing: border-box;
    }

    .pokemon-game-option img {
        max-width: 100%;
        max-height: 40px;
    }

    .pokemon-card-grid--pair {
        grid-template-columns: repeat(2, minmax(0, 398px));
    }

    .pokemon-list-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.35rem;
    }

    .pokemon-type-filter-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .pokemon-region-filter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .pokemon-list-option img {
        width: clamp(46px, 14vw, 58px);
        height: clamp(46px, 14vw, 58px);
    }
}

@media (max-width: 440px) {
    .pokemon-list-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .pokemon-mode-button {
        padding-right: 0.35rem;
        padding-left: 0.35rem;
        font-size: 0.88rem;
    }

    .pokemon-type-filter-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 0.25rem;
    }

    .pokemon-type-filter img {
        width: 36px;
        height: 36px;
    }

    .pokemon-type-filter {
        font-size: 0.66rem;
    }

    .pokemon-region-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pokemon-filter-search-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.55rem;
    }

    .pokemon-picker-options {
        justify-content: flex-start;
        padding-bottom: 0;
    }

    .pokemon-shiny-toggle {
        min-width: 0;
        padding-right: 0.55rem;
        padding-left: 0.55rem;
    }

    .pokemon-picker-panel {
        width: calc(100vw - 2rem);
        max-height: calc(100vh - 3rem);
        padding: 1rem;
        border-radius: 0;
    }

    .pokemon-picker-panel.is-character-picker,
    .pokemon-picker-panel.is-pokemon-picker {
        width: calc(100vw - 2rem);
        padding: 1rem;
    }

    .pokemon-picker-panel.is-character-picker {
        width: calc(100vw - 0.75rem);
        padding: 0;
    }
}
