/*
 * Experimental full-screen character select.
 * Enabled by default on selection.html. Use ?layout=classic for the original
 * scroll layout; the user's existing overrides remain untouched.
 */

html.selection-experimental,
html.selection-experimental body {
    width: 100%;
    min-width: 1120px;
    height: 100%;
    min-height: 680px;
    margin: 0;
    overflow: hidden;
    background: #07100d;
}

html.selection-experimental body {
    color: #fff;
    font-family: 'Libre Franklin', Arial, sans-serif;
}

html.selection-experimental .background {
    width: 100vw;
    height: 100vh;
    min-width: 1120px;
    min-height: 680px;
    overflow: hidden;
    background-size: cover;
}

html.selection-experimental .background::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(3, 10, 10, 0.05) 0 35%, rgba(3, 10, 10, 0.44) 68%, rgba(1, 5, 6, 0.82) 100%),
        linear-gradient(90deg, rgba(1, 6, 7, 0.32), transparent 18% 82%, rgba(1, 6, 7, 0.32));
}

html.selection-experimental .selectionscroll,
html.selection-experimental .skillscroll {
    display: none;
}

html.selection-experimental .selectionpage {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: auto;
    height: auto;
    background: none;
}

.experimental-toolbar {
    display: none;
}

.selection-store-header {
    display: none;
}

html.selection-experimental .experimental-toolbar {
    position: absolute;
    right: 1.2vw;
    top: 1.6vh;
    z-index: 9600;
    width: min(22vw, 340px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 7px;
    background: rgba(8, 14, 17, 0.78);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.36);
}

html.selection-experimental .experimental-toolbar-label {
    grid-column: 1 / -1;
    padding: 0 6px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

html.selection-experimental .experimental-store-toggle,
html.selection-experimental .experimental-missions-toggle,
html.selection-experimental .experimental-controls-toggle,
html.selection-experimental .experimental-classic-link,
html.selection-experimental .experimental-news-toggle {
    min-height: 28px;
    box-sizing: border-box;
    padding: 6px 9px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    font: 800 10px 'Libre Franklin', Arial, sans-serif;
    line-height: 14px;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}

html.selection-experimental .experimental-store-toggle:hover,
html.selection-experimental .experimental-store-toggle.active,
html.selection-experimental .experimental-missions-toggle:hover,
html.selection-experimental .experimental-missions-toggle.active,
html.selection-experimental .experimental-controls-toggle:hover,
html.selection-experimental .experimental-classic-link:hover,
html.selection-experimental .experimental-news-toggle:hover,
html.selection-experimental body.experimental-controls-open .experimental-controls-toggle {
    color: #fff4a5;
    border-color: #ffe143;
    background: rgba(255, 225, 67, 0.12);
}

/* Player identity card */
html.selection-experimental .player-card {
    left: 1.2vw;
    top: 2.2vh;
    width: clamp(220px, 15vw, 275px);
    min-height: 148px;
    padding: 10px;
    align-items: flex-start;
    flex-direction: row;
    gap: 10px;
    color: #fff;
    text-align: center;
    background: rgba(18, 25, 27, 0.76);
    border: 2px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
}

html.selection-experimental .player-avatar {
    width: clamp(62px, 5vw, 84px);
    height: clamp(62px, 5vw, 84px);
    flex: 0 0 auto;
    margin: 2px 0 0;
    border: 2px solid #9d3dff;
    box-shadow: 0 0 0 2px #16052a, 0 0 20px rgba(110, 37, 255, 0.35);
    object-fit: cover;
}

html.selection-experimental .player-infoselection {
    min-width: 0;
    flex: 1;
}

html.selection-experimental .player-nameselection {
    font-size: clamp(14px, 1vw, 20px);
    font-weight: 900;
    text-transform: none;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html.selection-experimental .player-stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 5px;
    margin: 0;
    padding: 3px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-family: 'Libre Franklin', Arial, sans-serif;
    font-size: clamp(7px, 0.52vw, 9px);
    line-height: 1.1;
    text-transform: uppercase;
}

html.selection-experimental .player-stat span {
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.06em;
}

html.selection-experimental .player-stat strong {
    min-width: 0;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html.selection-experimental body.arena-mode-pokemon .player-stat[data-player-stat="streak"] strong {
    color: #ff6f80;
}

/* Override the legacy light Pokemon card skin for the experimental glass card. */
html.selection-experimental body.arena-mode-pokemon .player-card {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.72) !important;
    background:
        linear-gradient(145deg, rgba(20, 30, 34, 0.96), rgba(7, 13, 17, 0.94)) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 255, 255, 0.08) !important;
}

html.selection-experimental body.arena-mode-pokemon .player-nameselection,
html.selection-experimental body.arena-mode-pokemon .player-stat,
html.selection-experimental body.arena-mode-pokemon .player-stat strong {
    color: #fff !important;
}

html.selection-experimental body.arena-mode-pokemon .player-stat span {
    color: rgba(255, 255, 255, 0.58) !important;
}

html.selection-experimental body.arena-mode-pokemon .player-stat[data-player-stat="streak"].positive strong {
    color: #6dff9d !important;
}

html.selection-experimental body.arena-mode-pokemon .player-stat[data-player-stat="streak"].negative strong {
    color: #ff7182 !important;
}

/* Featured character and skill showcase */
html.selection-experimental .skillviewer,
html.selection-experimental .skillviewer.collapsed,
html.selection-experimental .skillviewer.raveling {
    --featured-accent: 87, 205, 225;
    --featured-accent-strong: #71e0ef;
    left: 50%;
    top: 1.5vh;
    bottom: auto;
    width: min(50vw, 860px);
    height: min(43vh, 450px);
    transform: translateX(-50%);
    opacity: 1;
    pointer-events: auto;
    transition: none;
}

html.selection-experimental body.arena-mode-pokemon .skillviewer {
    --featured-accent: 239, 61, 79;
    --featured-accent-strong: #ff586b;
}

html.selection-experimental .skillviewer::before,
html.selection-experimental body.arena-mode-pokemon .skillviewer::before,
html.selection-experimental body.arena-mode-pokemon .skillviewer::after {
    display: none;
}

html.selection-experimental .skillpage,
html.selection-experimental .skillviewer.collapsed .skillpage,
html.selection-experimental .skillviewer.raveling .skillpage {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    overflow: hidden;
    opacity: 1;
    clip-path: none;
    transform: none;
    transform-origin: center;
    background:
        radial-gradient(circle at 50% 30%, rgba(var(--featured-accent), 0.16), transparent 35%),
        linear-gradient(145deg, rgba(7, 14, 18, 0.97), rgba(19, 29, 34, 0.94) 58%, rgba(5, 10, 14, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(var(--featured-accent), 0.16) inset,
        0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

html.selection-experimental .skillpage::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 2%;
    width: 39%;
    height: 74%;
    z-index: 0;
    transform: translateX(-50%);
    border: 1px solid rgba(var(--featured-accent), 0.3);
    border-radius: 48% 48% 16% 16% / 28% 28% 12% 12%;
    background:
        radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.12), transparent 28%),
        radial-gradient(circle at 50% 46%, rgba(var(--featured-accent), 0.2), rgba(3, 8, 11, 0.86) 72%);
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.58),
        0 0 32px rgba(var(--featured-accent), 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

html.selection-experimental .skillpage::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 64%;
    z-index: 0;
    width: 34%;
    height: 11%;
    transform: translateX(-50%);
    border: 1px solid rgba(var(--featured-accent), 0.34);
    border-radius: 50%;
    background:
        radial-gradient(ellipse at center, rgba(255, 255, 255, 0.18) 0 5%, rgba(var(--featured-accent), 0.22) 28%, rgba(2, 6, 9, 0.76) 67%, rgba(0, 0, 0, 0) 72%);
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.55),
        0 0 22px rgba(var(--featured-accent), 0.2),
        0 0 0 5px rgba(var(--featured-accent), 0.035);
}

html.selection-experimental .skillviewer:not(.collapsed) .skillpage,
html.selection-experimental .skillviewer:not(.collapsed) .skill-card,
html.selection-experimental .skillviewer.raveling .skillpage,
html.selection-experimental .skillviewer.raveling .skill-card {
    animation: none;
}

html.selection-experimental .skill-card {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    top: 0;
    left: 0;
    padding: clamp(18px, 1.6vw, 28px);
    box-sizing: border-box;
    z-index: 1;
}

html.selection-experimental .skill-header {
    display: grid;
    grid-template-columns: minmax(150px, 25%) minmax(180px, 25%);
    justify-content: space-between;
    gap: 0;
    height: 72%;
    margin: 0;
    align-items: start;
}

html.selection-experimental .character-info {
    display: contents;
}

html.selection-experimental .character-title-line {
    grid-column: 1;
    width: auto;
    min-height: 0;
    margin: 0;
    display: block;
    z-index: 2;
    padding: 16px 12px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-top-color: rgba(var(--featured-accent), 0.72);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(12, 20, 24, 0.84), rgba(3, 8, 11, 0.58));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

html.selection-experimental .character-name {
    max-width: 100%;
    color: #fff;
    font-size: clamp(22px, 1.8vw, 34px);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-transform: none;
    overflow: visible;
    text-shadow: -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000, 3px 3px 0 #000;
}

html.selection-experimental .character-role {
    margin-top: 22px;
    color: rgba(255, 255, 255, 0.84);
    font-size: clamp(12px, 1.05vw, 20px);
    text-align: center;
    text-transform: none;
    overflow: visible;
    white-space: normal;
    text-shadow: 0 2px 2px #000;
}

html.selection-experimental .character-portrait {
    position: absolute;
    left: 50%;
    top: -2%;
    z-index: 2;
    width: 42%;
    height: 77%;
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-radius: 48% 48% 14% 14% / 26% 26% 10% 10%;
    object-fit: cover;
    transform: translateX(-50%);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
    animation: character-portrait-idle-breathe-experimental var(--portrait-breathe-duration, 4200ms) ease-in-out infinite;
    animation-delay: var(--portrait-breathe-delay, 0ms);
}

@keyframes character-portrait-idle-breathe-experimental {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(var(--portrait-breathe-scale, 1.025)); }
}

/* A brief, snappier pop played once when a character is locked into a team slot --
   distinct from the ambient idle-breathe loop above, which keeps running underneath. */
html.selection-experimental .character-portrait.portrait-confirm-pop {
    animation-name: character-portrait-idle-breathe-experimental, character-portrait-confirm-pop-experimental;
    animation-duration: var(--portrait-breathe-duration, 4200ms), 420ms;
    animation-timing-function: ease-in-out, cubic-bezier(0.34, 1.56, 0.64, 1);
    animation-iteration-count: infinite, 1;
    animation-delay: var(--portrait-breathe-delay, 0ms), 0ms;
}

@keyframes character-portrait-confirm-pop-experimental {
    0% { transform: translateX(-50%) scale(1) rotate(0deg); }
    45% { transform: translateX(-50%) scale(1.14) rotate(-2deg); }
    75% { transform: translateX(-50%) scale(0.97) rotate(1.5deg); }
    100% { transform: translateX(-50%) scale(1) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
    html.selection-experimental .character-portrait,
    html.selection-experimental .character-portrait.portrait-confirm-pop {
        animation: none;
    }
}

html.selection-experimental .character-evolution-shadow {
    position: absolute;
    left: 50%;
    top: -1%;
    z-index: 1;
    width: 50%;
    height: 76%;
    object-fit: contain;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) scale(1.08);
    transform-origin: center 70%;
    filter: grayscale(1) brightness(0.22) contrast(1.25) blur(1px)
        drop-shadow(0 12px 15px rgba(0, 0, 0, 0.9));
    transition: opacity 180ms ease, transform 260ms ease;
}

html.selection-experimental .character-evolution-shadow.is-visible {
    opacity: 0.2;
}

html.selection-experimental .character-evolution-shadow.showing-base-shadow {
    opacity: 0.13;
    transform: translateX(-50%) scale(1.03);
}

html.selection-experimental .character-portrait.uses-featured-render {
    top: 0;
    width: 45%;
    height: 74%;
    border: 0;
    border-radius: 0;
    object-fit: contain;
    filter:
        drop-shadow(0 16px 14px rgba(0, 0, 0, 0.76))
        drop-shadow(0 0 8px rgba(var(--featured-accent), 0.18));
    box-shadow: none;
}

html.selection-experimental .character-portrait.form-swapping {
    animation: selection-form-swap 260ms ease-out;
}

@keyframes selection-form-swap {
    0% { opacity: 0.18; transform: translateX(-50%) scale(0.94); }
    100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

html.selection-experimental .character-form-toggle {
    position: absolute;
    left: 50%;
    top: 67.5%;
    z-index: 4;
    display: flex;
    gap: 3px;
    padding: 4px;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(3, 8, 11, 0.82);
    box-shadow: 0 7px 16px rgba(0, 0, 0, 0.42), 0 0 14px rgba(var(--featured-accent), 0.11);
    backdrop-filter: blur(8px);
}

html.selection-experimental .character-form-toggle[hidden] {
    display: none;
}

html.selection-experimental .character-form-button {
    min-width: 72px;
    padding: 5px 10px;
    border: 0;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.72);
    background: transparent;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

html.selection-experimental .character-form-button[hidden] {
    display: none;
}

html.selection-experimental .character-form-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

html.selection-experimental .character-form-button.is-active {
    color: #fff;
    background: rgba(var(--featured-accent), 0.64);
    box-shadow: 0 2px 9px rgba(var(--featured-accent), 0.28);
}

html.selection-experimental .character-portrait:not([src]),
html.selection-experimental .character-portrait[src=''] {
    opacity: 0;
}

html.selection-experimental .skill-images {
    grid-column: 2;
    position: relative;
    top: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 42px 0 0;
    display: grid;
    grid-template-columns: repeat(2, clamp(58px, 4.3vw, 82px));
    grid-auto-rows: clamp(58px, 4.3vw, 82px);
    justify-content: center;
    gap: clamp(8px, 0.7vw, 14px);
    overflow: visible;
    transform: none;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 14px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-top-color: rgba(var(--featured-accent), 0.72);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(12, 20, 24, 0.84), rgba(3, 8, 11, 0.58));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

html.selection-experimental .skill-images:has(.skill-image:nth-child(5)) {
    grid-template-columns: repeat(2, clamp(48px, 3.4vw, 64px));
    grid-auto-rows: clamp(48px, 3.4vw, 64px);
    gap: clamp(6px, 0.5vw, 10px);
    padding-top: 38px;
}

html.selection-experimental .skill-images:has(.skill-image:nth-child(7)) {
    grid-template-columns: repeat(2, clamp(44px, 2.7vw, 52px));
    grid-auto-rows: clamp(44px, 2.7vw, 52px);
    gap: clamp(4px, 0.35vw, 6px);
    padding-top: 36px;
    padding-bottom: 8px;
    max-height: calc(100% - 12px);
    overflow-x: hidden;
    overflow-y: auto;
}

html.selection-experimental .skill-images:has(.skill-image:nth-child(9)) {
    grid-template-columns: repeat(2, clamp(38px, 2.3vw, 44px));
    grid-auto-rows: clamp(38px, 2.3vw, 44px);
}

html.selection-experimental .skill-images::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

html.selection-experimental .skill-images::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(var(--featured-accent), 0.55);
}

html.selection-experimental .skill-images::before {
    content: 'Skills';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    color: #fff;
    font-size: clamp(18px, 1.45vw, 28px);
    font-style: italic;
    font-weight: 900;
    text-align: center;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
}

html.selection-experimental .skill-images > * {
    transform: none;
}

html.selection-experimental .skill-image {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 1px solid #fff;
    object-fit: cover;
    background: #080b10;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.46);
}

html.selection-experimental .skill-image.load-failed {
    opacity: 0.12;
    filter: grayscale(1);
}

html.selection-experimental .skill-image:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--featured-accent-strong);
}

html.selection-experimental .skill-title-bar {
    position: absolute;
    left: 3%;
    right: 3%;
    bottom: 22%;
    min-height: 32px;
    margin: 0;
    padding: 5px 10px;
    box-sizing: border-box;
    background: linear-gradient(90deg, rgba(var(--featured-accent), 0.2), rgba(3, 8, 11, 0.86) 34% 66%, rgba(var(--featured-accent), 0.12));
    border-top: 1px solid rgba(var(--featured-accent), 0.48);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

html.selection-experimental .skill-name {
    color: #fff;
    font-weight: 900;
}

html.selection-experimental .energy-label,
html.selection-experimental .classes-label,
html.selection-experimental .cooldown-label,
html.selection-experimental .class-type,
html.selection-experimental .cooldown-value {
    color: rgba(255, 255, 255, 0.78);
}

html.selection-experimental .skill-description {
    position: absolute;
    left: 4%;
    right: 4%;
    bottom: 7%;
    height: 11%;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(11px, 0.76vw, 14px);
    line-height: 1.35;
    text-align: center;
    text-transform: none;
}

html.selection-experimental .skill-footer {
    position: absolute;
    left: 4%;
    right: 4%;
    bottom: 2%;
    color: #fff;
}

/* Roster banks */
html.selection-experimental .slot-list {
    position: absolute;
    left: 1.2vw;
    right: 1.2vw;
    top: auto;
    bottom: 2vh;
    z-index: 5;
    height: min(43vh, 420px);
    display: grid;
    grid-template-columns: repeat(5, minmax(52px, 1fr)) minmax(29vw, 2.5fr) repeat(5, minmax(52px, 1fr));
    grid-template-rows: repeat(3, 1fr);
    gap: clamp(5px, 0.55vw, 11px);
    align-items: stretch;
    margin: 0;
    padding: clamp(12px, 1vw, 20px);
    box-sizing: border-box;
    border: 0;
    background: none;
    isolation: isolate;
}

html.selection-experimental .slot-list::before,
html.selection-experimental .slot-list::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 0;
    width: calc((100% - 29vw) / 2);
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: rgba(7, 13, 16, 0.56);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

html.selection-experimental .slot-list::before {
    left: 0;
    clip-path: polygon(0 0, 94% 0, 100% 100%, 7% 100%);
}

html.selection-experimental .slot-list::after {
    right: 0;
    clip-path: polygon(6% 0, 100% 0, 93% 100%, 0 100%);
}

html.selection-experimental .slot-item {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    border: 2px solid rgba(103, 117, 112, 0.92);
    background: rgba(9, 14, 16, 0.76);
    transform: skew(-8deg);
    z-index: 1;
    box-shadow: 0 6px 13px rgba(0, 0, 0, 0.42);
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms ease-out,
        border-color 150ms ease-out;
}

html.selection-experimental .slot-item::before {
    background: linear-gradient(145deg, #162027, #080d11);
    color: rgba(255, 255, 255, 0.78);
    text-shadow: 0 2px 4px #000;
}

html.selection-experimental .slot-item:nth-child(-n+15):nth-child(5n+1) { grid-column: 1; }
html.selection-experimental .slot-item:nth-child(-n+15):nth-child(5n+2) { grid-column: 2; }
html.selection-experimental .slot-item:nth-child(-n+15):nth-child(5n+3) { grid-column: 3; }
html.selection-experimental .slot-item:nth-child(-n+15):nth-child(5n+4) { grid-column: 4; }
html.selection-experimental .slot-item:nth-child(-n+15):nth-child(5n) { grid-column: 5; }

html.selection-experimental .slot-item:nth-child(-n+5) { grid-row: 1; }
html.selection-experimental .slot-item:nth-child(n+6):nth-child(-n+10) { grid-row: 2; }
html.selection-experimental .slot-item:nth-child(n+11):nth-child(-n+15) { grid-row: 3; }

html.selection-experimental .slot-item:nth-child(n+16):nth-child(5n+1) { grid-column: 7; }
html.selection-experimental .slot-item:nth-child(n+16):nth-child(5n+2) { grid-column: 8; }
html.selection-experimental .slot-item:nth-child(n+16):nth-child(5n+3) { grid-column: 9; }
html.selection-experimental .slot-item:nth-child(n+16):nth-child(5n+4) { grid-column: 10; }
html.selection-experimental .slot-item:nth-child(n+16):nth-child(5n) { grid-column: 11; }

html.selection-experimental .slot-item:nth-child(n+16):nth-child(-n+20) { grid-row: 1; }
html.selection-experimental .slot-item:nth-child(n+21):nth-child(-n+25) { grid-row: 2; }
html.selection-experimental .slot-item:nth-child(n+26):nth-child(-n+30) { grid-row: 3; }

html.selection-experimental .slot-image {
    transform: scale(1.12) skew(8deg);
    object-fit: cover;
}

html.selection-experimental .slot-item:not(.slot-locked):hover {
    z-index: 3;
    transform: translateY(-6px) skew(-8deg) scale(1.05) rotate(var(--slot-tilt, 0deg));
    border-color: #ffe143;
    box-shadow:
        0 0 0 2px rgba(255, 225, 67, 0.42),
        0 12px 22px rgba(0, 0, 0, 0.55),
        -8px 0 18px 0 var(--slot-type-glow-a, transparent),
        8px 0 18px 0 var(--slot-type-glow-b, transparent);
}

html.selection-experimental .slot-item.keyboard-highlighted {
    z-index: 4;
    border-color: #ffe143;
    outline: 3px solid rgba(255, 225, 67, 0.46);
    outline-offset: 2px;
    box-shadow: 0 0 18px rgba(255, 225, 67, 0.58), 0 12px 22px rgba(0, 0, 0, 0.58);
}

html.selection-experimental .slot-item.slot-locked {
    opacity: 1;
}

html.selection-experimental .slot-item.slot-locked .slot-image {
    opacity: 1;
    filter: brightness(0.28) saturate(0.45) contrast(1.08);
}

html.selection-experimental .selection-roster-lock {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    display: grid;
    place-items: center;
    width: clamp(30px, 2.5vw, 46px);
    height: clamp(30px, 2.5vw, 46px);
    transform: translate(-50%, -50%) skew(8deg);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.78);
    box-shadow: 0 7px 16px rgba(0, 0, 0, 0.7), 0 0 13px rgba(255, 225, 67, 0.2);
    font-size: clamp(16px, 1.35vw, 25px);
    pointer-events: none;
}

html.selection-experimental .slot-item.slot-empty {
    opacity: 0.16;
}

/* Give the roster cards a raised, floating feel -- a deeper resting shadow plus
   a slow idle bob via the separate `translate` property (composes with the
   existing skew() transform on desktop, and with the mobile breakpoint's
   `transform: none` reset, instead of fighting either). Hover/keyboard focus
   cancel the animation outright so the existing lift-on-hover transform isn't
   fought by animation output, which always wins over a plain declaration
   regardless of selector specificity. Runs on mobile too -- it's a compositor-
   only translate animation, so it's cheap even on modest phones. */
html.selection-experimental .slot-item:not(.slot-empty) {
    box-shadow: 0 6px 13px rgba(0, 0, 0, 0.42), 0 20px 22px -14px rgba(0, 0, 0, 0.62);
    animation: roster-slot-float 3.4s ease-in-out infinite;
}

html.selection-experimental .slot-item:not(.slot-empty):hover,
html.selection-experimental .slot-item.keyboard-highlighted {
    animation: none;
    translate: 0 0;
}

html.selection-experimental .slot-item:nth-child(6n+1) { animation-delay: 0s; }
html.selection-experimental .slot-item:nth-child(6n+2) { animation-delay: 0.5s; }
html.selection-experimental .slot-item:nth-child(6n+3) { animation-delay: 1s; }
html.selection-experimental .slot-item:nth-child(6n+4) { animation-delay: 1.5s; }
html.selection-experimental .slot-item:nth-child(6n+5) { animation-delay: 2s; }
html.selection-experimental .slot-item:nth-child(6n) { animation-delay: 2.5s; }

@keyframes roster-slot-float {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -5px; }
}

@media (prefers-reduced-motion: reduce) {
    html.selection-experimental .slot-item:not(.slot-empty) {
        animation: none;
    }
}

/* Once the page-load entrance animation has played through naturally (see the
   `animationend` listener in script.js), permanently stop `selection-bubble-pop`
   (style.css) from being this element's active animation -- otherwise every
   later filled<->empty toggle below re-triggers its entrance keyframes. */
html.selection-experimental .selected-character-slot.slot-post-intro {
    animation: none;
}

/* Give the roster's punchy, floating feel to a character once they're on the
   team too, reusing the same keyframe/stagger pattern as .slot-item above. */
html.selection-experimental .selected-character-slot:has(.selected-slot-image) {
    animation: roster-slot-float 3.4s ease-in-out infinite;
    transition: border-color 150ms ease-out, box-shadow 180ms ease-out;
}

html.selection-experimental .selected-character-slot:nth-child(3n+1) { animation-delay: 0s; }
html.selection-experimental .selected-character-slot:nth-child(3n+2) { animation-delay: 0.7s; }
html.selection-experimental .selected-character-slot:nth-child(3n) { animation-delay: 1.4s; }

/* .selected-slot-confirm-burst (style.css) also drives `animation` on this
   same element for its 520ms snap-in pulse when a pick is confirmed -- on
   its own, equal specificity + later cascade order let the float rule above
   silently win and cancel the pulse. List both here so they run together
   instead of one clobbering the other. */
html.selection-experimental .selected-character-slot.selected-slot-confirm-burst:has(.selected-slot-image) {
    animation: selected-slot-confirm-pulse 520ms ease-out, roster-slot-float 3.4s ease-in-out infinite;
}

html.selection-experimental .selected-character-slot:has(.selected-slot-image):hover,
html.selection-experimental .selected-character-slot.keyboard-highlighted {
    animation: none;
    translate: 0 -4px;
    z-index: 4;
    border-color: #ffe143;
    box-shadow: 0 0 0 2px rgba(255, 225, 67, 0.42), 0 12px 22px rgba(0, 0, 0, 0.55);
}

@media (prefers-reduced-motion: reduce) {
    html.selection-experimental .selected-character-slot {
        animation: none;
    }
}

/* Team and match controls occupy the center channel between roster banks. */
html.selection-experimental .selected-character-slot-list {
    position: absolute;
    left: 50%;
    bottom: 11vh;
    z-index: 8;
    gap: clamp(7px, 0.7vw, 14px);
    transform: translateX(-50%);
}

html.selection-experimental .selected-character-slot-list::before {
    content: 'Your Team';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    width: max-content;
    transform: translateX(-50%);
    color: #fff;
    font-size: clamp(24px, 2vw, 38px);
    font-weight: 900;
    line-height: 1;
    text-shadow: -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000, 3px 3px 0 #000;
}

html.selection-experimental .selected-character-slot {
    left: auto;
    bottom: auto;
    width: clamp(62px, 5.9vw, 112px);
    height: clamp(72px, 7.8vw, 148px);
    color: rgba(255, 255, 255, 0.8);
    border: 2px solid #ffe432;
    background: rgba(6, 11, 14, 0.8);
    transform: skew(-8deg);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.48);
    overflow: hidden;
}

html.selection-experimental .selected-character-slot.keyboard-highlighted {
    z-index: 4;
    border-color: #fff16b;
    outline: 3px solid rgba(255, 225, 67, 0.48);
    outline-offset: 3px;
    box-shadow: 0 0 20px rgba(255, 225, 67, 0.62), 0 10px 22px rgba(0, 0, 0, 0.58);
}

html.selection-experimental .selected-slot-image,
html.selection-experimental .selected-slot-placeholder-image {
    width: 112%;
    height: 100%;
    max-width: none;
    transform: skew(8deg);
    object-fit: cover;
}

html.selection-experimental .button-container {
    left: calc(50% - min(12.5vw, 215px));
    top: auto;
    bottom: 30vh;
    z-index: 7;
    width: min(25vw, 430px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    transform: none;
    animation: none !important;
}

html.selection-experimental .game-button {
    position: relative;
    min-height: clamp(38px, 4vh, 58px);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.72);
    background: rgba(18, 26, 29, 0.72);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
    font-size: 0;
    font-weight: 900;
    text-align: center;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
}

html.selection-experimental .game-button img {
    display: none;
}

html.selection-experimental .game-button::after {
    font-size: clamp(13px, 1.05vw, 20px);
}

html.selection-experimental .logout-button {
    display: none;
}

html.selection-experimental .quick-button::after { content: 'Quick Match'; }
html.selection-experimental .ladder-button::after { content: 'Ranked Match'; }
html.selection-experimental .private-button::after { content: 'Private Match'; }

html.selection-experimental .private-button {
    grid-column: 1 / -1;
}

html.selection-experimental .private-draft-note {
    display: none;
}

html.selection-experimental .game-button:not(:disabled):hover {
    color: #fffbd3;
    background: rgba(38, 69, 65, 0.9);
    border-color: #ffe143;
    transform: translateY(-2px);
}

html.selection-experimental .game-button.keyboard-highlighted {
    z-index: 2;
    color: #fffbd3;
    border-color: #ffe143;
    outline: 3px solid rgba(255, 225, 67, 0.46);
    outline-offset: 2px;
    background: rgba(38, 69, 65, 0.94);
    box-shadow: 0 0 18px rgba(255, 225, 67, 0.44), 0 8px 18px rgba(0, 0, 0, 0.5);
}

html.selection-experimental body.matchmaking-active .button-container {
    z-index: 7000;
}

html.selection-experimental .quick-button.matchmaking-searching::after,
html.selection-experimental .ladder-button.matchmaking-searching::after,
html.selection-experimental .private-button.matchmaking-searching::after {
    content: 'Cancel Search';
    color: #ffe166;
}

html.selection-experimental .selection-team-status {
    position: absolute;
    left: 50%;
    bottom: 6.8vh;
    z-index: 8;
    width: 29vw;
    margin: 0;
    color: #fff;
    font-size: clamp(11px, 0.82vw, 15px);
    text-align: center;
    text-transform: none;
    transform: translateX(-50%);
    text-shadow: 0 2px 3px #000;
}

/* Compact access to existing filters and settings. */
html.selection-experimental .roster-filter-panel {
    left: auto;
    right: 1.2vw;
    top: 30vh;
    width: min(22vw, 340px);
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 120px;
    color: #fff;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    background: rgba(8, 14, 17, 0.9);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
}

html.selection-experimental body.experimental-controls-open .roster-filter-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

html.selection-experimental .roster-filter-tabs {
    justify-content: flex-end;
}

html.selection-experimental .roster-filter-tab,
html.selection-experimental .roster-filter-select {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(18, 26, 29, 0.72);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

html.selection-experimental .roster-filter-tab.active {
    color: #fff3a1;
    background: rgba(0, 0, 0, 0.82);
}

html.selection-experimental .roster-filter-status {
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
}

html.selection-experimental .selection-ui-options-panel {
    right: 0;
    bottom: auto;
    top: 54px;
    color: #1b120b;
}

html.selection-experimental .selection-mode-controls {
    right: 1.2vw;
    bottom: auto;
    top: 17vh;
    z-index: 1500;
    width: min(22vw, 340px);
    align-items: flex-end;
    flex-direction: column;
}

html.selection-experimental .pokemon-arena-selection-logo {
    display: none;
}

html.selection-experimental .arena-mode-switch,
html.selection-experimental .draft-mode-check {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

html.selection-experimental .arena-mode-switch {
    width: 100%;
}

html.selection-experimental .arena-mode-button {
    flex: 1 1 0;
}

html.selection-experimental .sound-controller {
    left: 1.2vw;
    top: 23vh;
    bottom: auto;
    z-index: 20;
    border: 1px solid rgba(255, 255, 255, 0.42);
    background: rgba(5, 10, 12, 0.62);
}

html.selection-experimental .nextpage,
html.selection-experimental .lastpage {
    top: auto;
    bottom: 18vh;
    z-index: 12;
    width: clamp(28px, 2.6vw, 50px);
    height: auto;
    filter: brightness(0) invert(1) drop-shadow(0 3px 3px #000);
}

html.selection-experimental .lastpage {
    left: 0.4vw;
}

html.selection-experimental .nextpage {
    left: auto;
    right: 0.4vw;
}

html.selection-experimental .nextpage.keyboard-highlighted,
html.selection-experimental .lastpage.keyboard-highlighted {
    opacity: 1 !important;
    outline: 3px solid rgba(255, 225, 67, 0.72);
    outline-offset: 5px;
    border-radius: 5px;
    background: rgba(255, 225, 67, 0.18);
    filter: brightness(0) invert(1) drop-shadow(0 0 8px #ffe143);
}

html.selection-experimental .pokemon-ladder-incentive {
    display: none;
}

html.selection-experimental .selection-missions {
    left: 1.2vw;
    right: 1.2vw;
    top: auto;
    bottom: 2vh;
    z-index: 9200;
    width: auto;
    height: min(43vh, 420px);
    color: #fff;
    pointer-events: none;
}

html.selection-experimental .selection-missions:not(.collapsed) {
    pointer-events: auto;
}

html.selection-experimental .selection-missions-panel {
    position: absolute;
    inset: 0;
    width: auto;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 14px;
    background:
        radial-gradient(circle at 18% 0, rgba(255, 199, 62, 0.13), transparent 30%),
        linear-gradient(145deg, rgba(8, 15, 18, 0.985), rgba(20, 29, 33, 0.98));
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

html.selection-experimental .selection-store-header {
    height: 58px;
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
    align-items: center;
    gap: 16px;
    padding: 8px 14px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(1, 6, 8, 0.64);
}

html.selection-experimental .selection-store-heading {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

html.selection-experimental .selection-store-heading strong {
    color: #fff;
    font-size: 23px;
    line-height: 1;
}

html.selection-experimental .selection-store-eyebrow {
    color: #ffda58;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

html.selection-experimental .selection-store-tabs {
    display: flex;
    gap: 5px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

html.selection-experimental .selection-store-tab,
html.selection-experimental .selection-store-close {
    border: 1px solid transparent;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.72);
    background: transparent;
    padding: 7px 13px;
    font: 800 10px 'Libre Franklin', Arial, sans-serif;
    text-transform: uppercase;
    cursor: pointer;
}

html.selection-experimental .selection-store-tab:hover,
html.selection-experimental .selection-store-tab.active {
    color: #fff;
    border-color: rgba(255, 225, 67, 0.52);
    background: rgba(255, 225, 67, 0.16);
}

html.selection-experimental .selection-store-close {
    justify-self: end;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.32);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.07);
}

html.selection-experimental .selection-missions-list {
    height: calc(100% - 82px);
    max-height: none;
    display: block;
    overflow-y: auto;
    padding: 12px 14px 18px;
    box-sizing: border-box;
    scrollbar-color: rgba(255, 218, 88, 0.55) rgba(255, 255, 255, 0.04);
}

html.selection-experimental .selection-missions-status {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 4px;
    min-height: 14px;
    margin: 0;
    color: #ffd45e;
    font-size: 10px;
    text-align: center;
    pointer-events: none;
}

html.selection-experimental .selection-unlock-wallet {
    position: sticky;
    top: -12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: -12px -14px 12px;
    padding: 8px 14px;
    border: 0;
    border-bottom: 1px solid rgba(255, 218, 88, 0.3);
    color: #ffdf70;
    background: rgba(11, 16, 18, 0.96);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.22);
}

html.selection-experimental .selection-unlock-wallet strong,
html.selection-experimental .selection-unlock-wallet span {
    display: block;
    margin: 0;
}

html.selection-experimental .selection-unlock-wallet span {
    color: rgba(255, 255, 255, 0.68);
    text-align: right;
}

html.selection-experimental .selection-store-category-intro {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

html.selection-experimental .selection-store-category-intro strong {
    color: #fff;
    font-size: 15px;
}

html.selection-experimental .selection-store-category-intro span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
}

html.selection-experimental .selection-character-store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 8px;
}

html.selection-experimental .selection-store-character-card {
    min-width: 0;
    height: 76px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    column-gap: 9px;
    padding: 7px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
}

html.selection-experimental .selection-store-character-card.is-owned {
    border-color: rgba(83, 202, 151, 0.25);
}

html.selection-experimental .selection-store-character-image {
    grid-row: 1 / -1;
    width: 58px;
    height: 60px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 5px;
    background: #080d10;
}

html.selection-experimental .selection-store-character-details {
    min-width: 0;
    align-self: center;
}

html.selection-experimental .selection-store-character-details strong,
html.selection-experimental .selection-store-character-price {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html.selection-experimental .selection-store-character-details strong {
    color: #fff;
    font-size: 11px;
}

html.selection-experimental .selection-store-character-price {
    margin-top: 3px;
    color: #ffdb63;
    font-size: 9px;
}

html.selection-experimental .selection-store-character-action {
    min-width: 0;
    padding: 4px 7px;
    border: 1px solid rgba(255, 218, 88, 0.44);
    border-radius: 4px;
    color: #fff;
    background: rgba(255, 197, 42, 0.14);
    font: 800 8px 'Libre Franklin', Arial, sans-serif;
    text-transform: uppercase;
    cursor: pointer;
}

html.selection-experimental .selection-store-character-action:disabled {
    color: rgba(255, 255, 255, 0.38);
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.035);
    cursor: default;
}

html.selection-experimental [data-store-category='points'].selection-mission-card {
    max-width: 720px;
    margin: 0 auto;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.055);
}

html.selection-experimental .selection-skins-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 9px;
}

html.selection-experimental [data-store-category][hidden] {
    display: none;
}

html.selection-experimental .selection-skins-section .selection-section-title {
    grid-column: 1 / -1;
    color: #ffda58;
}

html.selection-experimental .selection-skins-section .selection-mission-card {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
}

html.selection-experimental .selection-mission-title,
html.selection-experimental .selection-mission-progress,
html.selection-experimental .selection-mission-reward,
html.selection-experimental .selection-mission-buy,
html.selection-experimental .selection-mission-requirements {
    color: inherit;
}

html.selection-experimental .selection-mission-requirements {
    margin: 4px 0 0;
    color: rgba(255, 220, 104, 0.82);
    font-size: 10px;
}

html.selection-experimental body.experimental-missions-open .selection-store-tabs,
html.selection-experimental body.experimental-missions-open .selection-unlock-wallet {
    display: none;
}

html.selection-experimental body.experimental-missions-open .selection-store-header {
    grid-template-columns: 1fr auto;
}

html.selection-experimental body.experimental-missions-open .selection-missions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    align-content: start;
    gap: 9px;
}

html.selection-experimental body.experimental-missions-open [data-store-category='missions'] {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
}

html.selection-experimental .selection-mission-action {
    border-color: rgba(255, 218, 88, 0.48);
    color: #fff;
    background: rgba(255, 197, 42, 0.16);
}

html.selection-experimental .roster-filter-tab.selection-missions-toggle {
    display: none;
}

html.selection-experimental body.experimental-store-open .slot-list,
html.selection-experimental body.experimental-store-open .selected-character-slot-list,
html.selection-experimental body.experimental-store-open .button-container,
html.selection-experimental body.experimental-store-open .selection-team-status,
html.selection-experimental body.experimental-store-open .nextpage,
html.selection-experimental body.experimental-store-open .lastpage {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

html.selection-experimental .selection-unlock-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9900;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(1, 5, 7, 0.56);
    backdrop-filter: blur(4px);
}

html.selection-experimental .selection-unlock-confirm-backdrop.hidden {
    display: none;
}

html.selection-experimental .selection-unlock-confirm {
    width: min(420px, 88vw);
    padding: 24px;
    box-sizing: border-box;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffe143;
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 0, rgba(255, 225, 67, 0.15), transparent 38%),
        linear-gradient(145deg, rgba(14, 23, 27, 0.99), rgba(4, 9, 12, 0.99));
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    text-align: center;
}

html.selection-experimental .selection-unlock-confirm-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border: 1px solid rgba(255, 225, 67, 0.55);
    border-radius: 50%;
    background: rgba(255, 225, 67, 0.1);
    font-size: 27px;
}

html.selection-experimental .selection-unlock-confirm h2 {
    margin: 0;
    color: #ffe266;
    font-size: 22px;
}

html.selection-experimental .selection-unlock-confirm-message {
    margin: 12px 0 20px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    line-height: 1.5;
}

html.selection-experimental .selection-unlock-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

html.selection-experimental .selection-unlock-confirm-actions button {
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 6px;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    font: 900 12px 'Libre Franklin', Arial, sans-serif;
    text-transform: uppercase;
    cursor: pointer;
}

html.selection-experimental .selection-unlock-confirm-yes {
    border-color: rgba(255, 225, 67, 0.65) !important;
    background: rgba(255, 196, 42, 0.2) !important;
}

html.selection-experimental .selection-unlock-confirm-actions button:hover {
    color: #fff7b4;
    transform: translateY(-1px);
}

html.selection-experimental .private-match-backdrop {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    z-index: 9800;
    width: 100vw;
    height: 100vh;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(1, 5, 7, 0.68);
    backdrop-filter: blur(5px);
}

html.selection-experimental .private-match-modal {
    position: relative;
    top: 0;
    left: 0;
    width: min(430px, 90vw);
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 25px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffe143;
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 0, rgba(255, 225, 67, 0.14), transparent 40%),
        linear-gradient(145deg, rgba(14, 23, 27, 0.99), rgba(4, 9, 12, 0.99));
    box-shadow: 0 25px 58px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

html.selection-experimental .private-match-title,
html.selection-experimental .private-match-input,
html.selection-experimental .private-match-error {
    grid-column: 1 / -1;
    position: static;
    width: auto;
    margin: 0;
    box-sizing: border-box;
}

html.selection-experimental .private-match-title {
    color: #fff;
    font-size: 19px;
    font-weight: 900;
}

html.selection-experimental .private-match-input {
    width: 100%;
    height: 40px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    font: 700 14px 'Libre Franklin', Arial, sans-serif;
}

html.selection-experimental .private-match-input:focus {
    border-color: #ffe143;
    outline: 2px solid rgba(255, 225, 67, 0.25);
}

html.selection-experimental .private-match-error {
    min-height: 17px;
    color: #ff7382;
}

html.selection-experimental .private-match-ok,
html.selection-experimental .private-match-cancel {
    position: static;
    width: 100%;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 6px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    font: 900 12px 'Libre Franklin', Arial, sans-serif;
    cursor: pointer;
}

html.selection-experimental .private-match-ok {
    border-color: rgba(255, 225, 67, 0.62);
    background: rgba(255, 196, 42, 0.2);
}

/* Matchmaking uses a true viewport modal instead of the legacy scroll coordinates. */
html.selection-experimental .searching-backdrop {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    z-index: 9850;
    width: 100vw;
    height: 100vh;
    padding: 24px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    background: rgba(1, 5, 7, 0.7);
    backdrop-filter: blur(5px);
}

html.selection-experimental .searching-backdrop.visible {
    display: flex;
}

html.selection-experimental .searchingscroll {
    position: relative;
    top: 0;
    left: 0;
    width: min(430px, 90vw);
    height: auto;
    min-height: 245px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 25px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffe143;
    border-radius: 15px;
    background:
        radial-gradient(circle at 50% 0, rgba(255, 225, 67, 0.15), transparent 42%),
        linear-gradient(145deg, rgba(14, 23, 27, 0.99), rgba(4, 9, 12, 0.99));
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

html.selection-experimental .searchingscroll::before,
html.selection-experimental body.arena-mode-pokemon .searchingscroll::before {
    content: 'Matchmaking';
    position: static;
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    color: #ffe266;
    background: none;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.16em;
    line-height: 1;
    text-transform: uppercase;
}

html.selection-experimental .searchingscroll::after,
html.selection-experimental body.arena-mode-pokemon .searchingscroll::after {
    display: none;
}

html.selection-experimental .searching {
    width: 100%;
    margin: 0;
    color: #fff;
    font-size: 19px;
    font-weight: 900;
    line-height: 1.25;
    text-align: center;
    text-transform: none;
    text-shadow: 0 3px 5px #000;
}

html.selection-experimental .sharingan {
    position: static;
    width: 66px;
    height: 66px;
    margin: 0;
    object-fit: contain;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.58));
}

html.selection-experimental .sasukesearch {
    display: none;
}

html.selection-experimental .cancel-button,
html.selection-experimental .cancel-button:disabled {
    position: static;
    width: min(220px, 100%) !important;
    min-height: 44px;
    height: auto;
    margin: 0 !important;
    padding: 9px 15px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 225, 67, 0.62) !important;
    border-radius: 6px;
    color: #fff;
    background: rgba(255, 196, 42, 0.18) !important;
    font: 900 12px 'Libre Franklin', Arial, sans-serif;
    line-height: 1.2;
    text-transform: uppercase;
    cursor: pointer;
}

html.selection-experimental .cancel-button:not(:disabled):hover {
    color: #fff7b4;
    background: rgba(255, 196, 42, 0.28) !important;
    transform: translateY(-1px);
}

html.selection-experimental .cancel-button:disabled {
    min-height: 0;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    pointer-events: none;
}

html.selection-experimental body.matchmaking-active .sound-controller {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (max-height: 780px) {
    html.selection-experimental .skillviewer,
    html.selection-experimental .skillviewer.collapsed,
    html.selection-experimental .skillviewer.raveling {
        height: 44vh;
    }

    html.selection-experimental .slot-list {
        height: 42vh;
    }

    html.selection-experimental .button-container {
        bottom: 31vh;
    }

    html.selection-experimental .skill-images:has(.skill-image:nth-child(7)) {
        grid-template-columns: repeat(2, 38px);
        grid-auto-rows: 38px;
        gap: 4px;
        padding-top: 30px;
        padding-bottom: 6px;
    }

    html.selection-experimental .skill-images:has(.skill-image:nth-child(9)) {
        grid-template-columns: repeat(2, 32px);
        grid-auto-rows: 32px;
    }
}

/* Phone portrait: stack the showcase, roster, team, and match controls. */
@media (max-width: 700px) {
    html.selection-experimental,
    html.selection-experimental body {
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: auto;
        touch-action: pan-y pinch-zoom;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    html.selection-experimental {
        overflow-y: scroll;
    }

    html.selection-experimental body {
        min-height: 1563px;
        overflow: visible;
    }

    html.selection-experimental body.custom-game-cursor,
    html.selection-experimental body.custom-game-cursor * {
        cursor: auto !important;
    }

    html.selection-experimental .background {
        width: 100%;
        min-width: 0;
        height: 1563px;
        min-height: 1563px;
        overflow: hidden;
        background-position: center top;
        background-attachment: scroll;
        touch-action: pan-y pinch-zoom;
    }

    html.selection-experimental .selectionpage {
        width: 100%;
        height: 1563px;
        animation: none !important;
        transform: none !important;
        touch-action: pan-y pinch-zoom;
        scroll-behavior: smooth;
    }

    html.selection-experimental .experimental-toolbar {
        left: 6px;
        right: 6px;
        top: 6px;
        width: auto;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        padding: 5px;
        border-radius: 9px;
        backdrop-filter: blur(10px);
    }

    html.selection-experimental .experimental-toolbar-label {
        display: none;
    }

    html.selection-experimental .experimental-store-toggle,
    html.selection-experimental .experimental-missions-toggle,
    html.selection-experimental .experimental-controls-toggle,
    html.selection-experimental .experimental-classic-link,
    html.selection-experimental .experimental-news-toggle {
        min-width: 0;
        min-height: 42px;
        display: grid;
        place-items: center;
        padding: 5px 3px;
        font-size: 8px;
        line-height: 1.1;
        text-align: center;
        touch-action: manipulation;
    }

    html.selection-experimental .player-card {
        left: 7px;
        top: 112px;
        width: 220px;
        min-height: 82px;
        height: 82px;
        display: flex;
        flex-direction: row;
        gap: 8px;
        padding: 7px;
        box-sizing: border-box;
        text-align: left;
    }

    html.selection-experimental .player-avatar {
        flex: 0 0 auto;
        width: 54px;
        height: 54px;
        margin: 0;
    }

    html.selection-experimental .player-nameselection {
        grid-column: 1 / -1;
        font-size: 12px;
        margin-bottom: 1px;
    }

    html.selection-experimental .player-infoselection {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 7px;
        align-content: start;
    }

    html.selection-experimental .player-stat {
        display: block;
        min-width: 0;
        padding: 1px 0;
        font-size: 6px;
    }

    html.selection-experimental .player-stat span,
    html.selection-experimental .player-stat strong {
        display: block;
        text-align: left;
    }

    html.selection-experimental .player-stat strong {
        margin-top: 1px;
        font-size: 6.5px;
    }

    html.selection-experimental .sound-controller {
        left: auto;
        right: 7px;
        top: 112px;
        bottom: auto;
        width: 150px;
        min-height: 72px;
        box-sizing: border-box;
    }

    html.selection-experimental .selection-mode-controls {
        left: 7px;
        right: 7px;
        top: 214px;
        bottom: auto;
        width: auto;
        min-height: 48px;
        align-items: stretch;
        flex-direction: row;
        gap: 6px;
    }

    html.selection-experimental .arena-mode-switch,
    html.selection-experimental .draft-mode-check-wrap {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }

    html.selection-experimental .arena-mode-button,
    html.selection-experimental .draft-mode-check {
        min-height: 42px;
        font-size: 8px;
        touch-action: manipulation;
    }

    html.selection-experimental .skillviewer,
    html.selection-experimental .skillviewer.collapsed,
    html.selection-experimental .skillviewer.raveling {
        left: 7px;
        right: 7px;
        top: 272px;
        width: auto;
        height: 330px;
        transform: none;
    }

    html.selection-experimental .skillpage {
        border-radius: 13px;
    }

    html.selection-experimental .skill-card {
        padding: 9px;
    }

    html.selection-experimental .skill-header {
        grid-template-columns: 88px 88px;
        height: 69%;
    }

    html.selection-experimental .character-title-line {
        padding: 9px 5px;
    }

    html.selection-experimental .character-name {
        font-size: 16px;
        text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    }

    html.selection-experimental .character-role {
        margin-top: 10px;
        font-size: 9px;
    }

    html.selection-experimental .character-portrait,
    html.selection-experimental .character-portrait.uses-featured-render {
        top: 1%;
        width: 49%;
        height: 67%;
    }

    html.selection-experimental .character-evolution-shadow {
        width: 55%;
        height: 68%;
    }

    html.selection-experimental .character-form-toggle {
        top: 60%;
        padding: 3px;
    }

    html.selection-experimental .character-form-button {
        min-width: 57px;
        min-height: 30px;
        padding: 5px 7px;
        font-size: 9px;
    }

    html.selection-experimental .skill-images,
    html.selection-experimental .skill-images:has(.skill-image:nth-child(7)),
    html.selection-experimental .skill-images:has(.skill-image:nth-child(9)) {
        grid-template-columns: repeat(2, 36px);
        grid-auto-rows: 36px;
        gap: 4px;
        max-height: 100%;
        padding: 28px 5px 5px;
    }

    html.selection-experimental .skill-images::before {
        font-size: 14px;
    }

    html.selection-experimental .skill-title-bar {
        left: 3%;
        right: 3%;
        bottom: 20%;
        min-height: 30px;
        padding: 4px 7px;
        font-size: 10px;
    }

    html.selection-experimental .skill-description {
        left: 4%;
        right: 4%;
        bottom: 6%;
        height: 11%;
        font-size: 9px;
        line-height: 1.25;
    }

    html.selection-experimental .skill-footer {
        bottom: 1%;
        font-size: 8px;
    }

    html.selection-experimental .slot-list {
        left: 7px;
        right: 7px;
        top: 614px;
        bottom: auto;
        width: auto;
        height: 548px;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-template-rows: repeat(6, 1fr);
        gap: 5px;
        padding: 7px;
        border: 1px solid rgba(255, 255, 255, 0.42);
        border-radius: 10px;
        background: rgba(5, 11, 14, 0.66);
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.36);
        touch-action: manipulation;
    }

    html.selection-experimental .slot-list::before,
    html.selection-experimental .slot-list::after {
        display: none;
    }

    html.selection-experimental .slot-list > .slot-item:nth-child(n) {
        grid-column: auto !important;
        grid-row: auto !important;
        width: auto;
        height: auto;
        transform: none;
        border-width: 1px;
        border-radius: 4px;
        touch-action: pan-y pinch-zoom;
    }

    html.selection-experimental .slot-image {
        transform: scale(1.06);
    }

    html.selection-experimental .selection-roster-lock {
        width: 30px;
        height: 30px;
        transform: translate(-50%, -50%);
        font-size: 15px;
    }

    html.selection-experimental .slot-item:not(.slot-locked):hover {
        transform: none;
    }

    html.selection-experimental .lastpage,
    html.selection-experimental .nextpage {
        top: 1171px;
        bottom: auto;
        width: 44px;
        height: 44px;
        padding: 8px;
        box-sizing: border-box;
        border-radius: 50%;
        background: rgba(5, 11, 14, 0.76);
        touch-action: manipulation;
    }

    html.selection-experimental .slot-item,
    html.selection-experimental .slot-image,
    html.selection-experimental .selected-character-slot,
    html.selection-experimental .selected-slot-image,
    html.selection-experimental .selected-slot-placeholder-image,
    html.selection-experimental .character-portrait,
    html.selection-experimental .character-evolution-shadow {
        touch-action: manipulation !important;
    }

    html.selection-experimental .lastpage { left: 8px; }
    html.selection-experimental .nextpage { right: 8px; }

    html.selection-experimental .selected-character-slot-list {
        left: 50%;
        top: 1220px;
        bottom: auto;
        gap: 8px;
    }

    html.selection-experimental .selected-character-slot-list::before {
        bottom: calc(100% + 7px);
        font-size: 22px;
    }

    html.selection-experimental .selected-character-slot {
        width: 91px;
        height: 103px;
        transform: none;
        border-radius: 5px;
        touch-action: manipulation;
    }

    html.selection-experimental .selected-slot-image,
    html.selection-experimental .selected-slot-placeholder-image {
        width: 100%;
        transform: none;
    }

    html.selection-experimental .button-container {
        left: 7px;
        right: 7px;
        top: 1358px;
        bottom: auto;
        width: auto;
        gap: 6px;
    }

    html.selection-experimental .game-button {
        min-height: 48px;
        touch-action: manipulation;
    }

    html.selection-experimental .game-button::after {
        font-size: 12px;
    }

    html.selection-experimental .selection-team-status {
        left: 12px;
        right: 12px;
        top: 1464px;
        bottom: auto;
        width: auto;
        min-height: 34px;
        font-size: 10px;
        transform: none;
    }

    html.selection-experimental .roster-filter-panel {
        position: fixed;
        left: 7px;
        right: 7px;
        top: 58px;
        width: auto;
        max-height: calc(100dvh - 66px);
        overflow-y: auto;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        grid-template-columns: 1fr;
        z-index: 9700;
    }

    html.selection-experimental .roster-filter-tabs {
        justify-content: flex-start;
    }

    html.selection-experimental .selection-ui-options-panel {
        position: static;
        width: 100%;
        margin-top: 8px;
        box-sizing: border-box;
    }

    html.selection-experimental .selection-missions {
        position: fixed;
        inset: 58px 6px 6px;
        width: auto;
        height: auto;
        z-index: 9800;
    }

    html.selection-experimental .selection-missions-list,
    html.selection-experimental .skill-images {
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        overscroll-behavior-y: contain;
    }

    html.selection-experimental .selection-store-header {
        height: auto;
        min-height: 96px;
        grid-template-columns: 1fr auto;
        gap: 7px;
        padding: 8px;
    }

    html.selection-experimental .selection-store-tabs {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: center;
    }

    html.selection-experimental .selection-store-tab,
    html.selection-experimental .selection-store-close {
        min-height: 38px;
        padding: 6px 10px;
        touch-action: manipulation;
    }

    html.selection-experimental .selection-missions-list {
        height: calc(100% - 116px);
        padding: 9px 9px 18px;
    }

    html.selection-experimental .selection-character-store-grid,
    html.selection-experimental body.experimental-missions-open .selection-missions-list,
    html.selection-experimental .selection-skins-section {
        grid-template-columns: 1fr;
    }

    html.selection-experimental .selection-unlock-confirm-backdrop,
    html.selection-experimental .private-match-backdrop {
        padding: 10px;
    }

    html.selection-experimental .searching-backdrop {
        padding: 12px;
    }

    html.selection-experimental .searchingscroll {
        width: 100%;
        min-height: 230px;
        gap: 13px;
        padding: 22px 17px;
    }

    html.selection-experimental .searching {
        font-size: 15px;
    }

    html.selection-experimental .sharingan {
        width: 58px;
        height: 58px;
    }

    html.selection-experimental .cancel-button {
        min-height: 48px;
        font-size: 12px;
        touch-action: manipulation;
    }
}

/* Compact landscape and small desktop windows: preserve both roster banks. */
@media (min-width: 701px) and (max-width: 1120px),
       (max-width: 950px) and (orientation: landscape),
       (max-width: 950px) and (max-height: 520px),
       (min-width: 1121px) and (max-height: 679px) {
    html.selection-experimental,
    html.selection-experimental body {
        width: 100%;
        min-width: 0;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    html.selection-experimental body.custom-game-cursor,
    html.selection-experimental body.custom-game-cursor * {
        cursor: auto !important;
    }

    html.selection-experimental .background,
    html.selection-experimental .selectionpage {
        width: 100%;
        min-width: 0;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
        background-position: center;
    }

    html.selection-experimental .selectionpage {
        animation: none !important;
        transform: none !important;
    }

    html.selection-experimental .experimental-toolbar {
        left: auto;
        right: 5px;
        top: 5px;
        width: 142px;
        grid-template-columns: 1fr 1fr;
        gap: 3px;
        padding: 4px;
    }

    html.selection-experimental .experimental-toolbar-label { display: none; }

    html.selection-experimental .experimental-store-toggle,
    html.selection-experimental .experimental-missions-toggle,
    html.selection-experimental .experimental-controls-toggle,
    html.selection-experimental .experimental-classic-link,
    html.selection-experimental .experimental-news-toggle {
        min-height: 28px;
        padding: 3px 2px;
        display: grid;
        place-items: center;
        font-size: 7px;
        line-height: 1;
        text-align: center;
        touch-action: manipulation;
    }

    html.selection-experimental .player-card {
        left: 5px;
        top: 5px;
        width: 196px;
        min-height: 104px;
        padding: 6px;
    }

    html.selection-experimental .player-avatar {
        width: 51px;
        height: 51px;
        margin: 0 0 4px;
    }

    html.selection-experimental .player-nameselection { font-size: 10px; }
    html.selection-experimental .player-stat { padding: 1px 0; font-size: 6px; }

    html.selection-experimental .sound-controller {
        left: 5px;
        top: 111px;
        bottom: auto;
        width: 132px;
        min-height: 49px;
        box-sizing: border-box;
    }

    html.selection-experimental .selection-mode-controls {
        left: auto;
        right: 5px;
        top: 108px;
        bottom: auto;
        width: 142px;
        align-items: stretch;
    }

    html.selection-experimental .arena-mode-button,
    html.selection-experimental .draft-mode-check {
        min-height: 28px;
        font-size: 7px;
        touch-action: manipulation;
    }

    html.selection-experimental .skillviewer,
    html.selection-experimental .skillviewer.collapsed,
    html.selection-experimental .skillviewer.raveling {
        left: 146px;
        right: 154px;
        top: 5px;
        width: auto;
        height: min(54vh, 700px);
        transform: none;
    }

    html.selection-experimental .skillpage { border-radius: 11px; }
    html.selection-experimental .skill-card { padding: 7px; }

    html.selection-experimental .skill-header {
        grid-template-columns: 102px 102px;
        height: 72%;
    }

    html.selection-experimental .character-title-line { padding: 8px 5px; }
    html.selection-experimental .character-name { font-size: 15px; }
    html.selection-experimental .character-role { margin-top: 8px; font-size: 8px; }

    html.selection-experimental .character-portrait,
    html.selection-experimental .character-portrait.uses-featured-render {
        top: 0;
        width: 47%;
        height: 67%;
    }

    html.selection-experimental .character-evolution-shadow {
        width: 52%;
        height: 67%;
    }

    html.selection-experimental .character-form-toggle {
        top: 58%;
        padding: 2px;
    }

    html.selection-experimental .character-form-button {
        min-width: 49px;
        min-height: 24px;
        padding: 3px 5px;
        font-size: 7px;
    }

    html.selection-experimental .skill-images,
    html.selection-experimental .skill-images:has(.skill-image:nth-child(7)),
    html.selection-experimental .skill-images:has(.skill-image:nth-child(9)) {
        grid-template-columns: repeat(2, 29px);
        grid-auto-rows: 29px;
        gap: 3px;
        max-height: 100%;
        padding: 23px 4px 4px;
    }

    html.selection-experimental .skill-images::before { font-size: 12px; }

    html.selection-experimental .skill-title-bar {
        bottom: 18%;
        min-height: 23px;
        padding: 3px 6px;
        font-size: 8px;
    }

    html.selection-experimental .skill-description {
        bottom: 4%;
        height: 11%;
        font-size: 7px;
        line-height: 1.15;
    }

    html.selection-experimental .skill-footer { display: none; }

    html.selection-experimental .slot-list {
        left: 5px;
        right: 5px;
        top: auto;
        bottom: 5px;
        width: auto;
        height: min(42vh, 550px);
        grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(200px, 2.6fr) repeat(5, minmax(0, 1fr));
        grid-template-rows: repeat(3, 1fr);
        gap: 3px;
        padding: 5px;
    }

    html.selection-experimental .slot-list::before,
    html.selection-experimental .slot-list::after {
        width: calc((100% - 200px) / 2);
        border-width: 1px;
    }

    html.selection-experimental .slot-item {
        border-width: 1px;
        transform: skew(-5deg);
        touch-action: manipulation;
    }

    html.selection-experimental .slot-image { transform: scale(1.08) skew(5deg); }

    html.selection-experimental .selection-roster-lock {
        width: 22px;
        height: 22px;
        transform: translate(-50%, -50%) skew(5deg);
        font-size: 11px;
    }

    html.selection-experimental .selected-character-slot-list {
        left: 50%;
        top: auto;
        bottom: 14px;
        gap: 4px;
    }

    html.selection-experimental .selected-character-slot-list::before {
        bottom: calc(100% + 4px);
        font-size: 14px;
        text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    }

    html.selection-experimental .selected-character-slot {
        width: 43px;
        height: 55px;
        border-width: 1px;
        touch-action: manipulation;
    }

    html.selection-experimental .button-container {
        left: calc(50% - 96px);
        right: auto;
        top: auto;
        bottom: 92px;
        width: 192px;
        gap: 3px;
    }

    html.selection-experimental .game-button {
        min-height: 26px;
        border-width: 1px;
        touch-action: manipulation;
    }

    html.selection-experimental .game-button::after { font-size: 8px; }

    html.selection-experimental .selection-team-status {
        left: 50%;
        top: auto;
        bottom: 152px;
        width: 194px;
        font-size: 7px;
    }

    html.selection-experimental .lastpage,
    html.selection-experimental .nextpage {
        top: auto;
        bottom: 58px;
        width: 29px;
        padding: 4px;
        border-radius: 50%;
        background: rgba(5, 11, 14, 0.72);
        touch-action: manipulation;
    }

    html.selection-experimental .lastpage { left: 1px; }
    html.selection-experimental .nextpage { right: 1px; }

    html.selection-experimental .roster-filter-panel {
        position: fixed;
        left: auto;
        right: 5px;
        top: 66px;
        width: min(360px, calc(100vw - 10px));
        max-height: calc(100dvh - 71px);
        overflow-y: auto;
        z-index: 9700;
    }

    html.selection-experimental .selection-missions {
        position: fixed;
        inset: 5px;
        width: auto;
        height: auto;
        z-index: 9800;
    }

    html.selection-experimental .selection-store-header {
        height: 48px;
        grid-template-columns: minmax(110px, 1fr) auto minmax(80px, 1fr);
        gap: 7px;
        padding: 5px 8px;
    }

    html.selection-experimental .selection-store-tab,
    html.selection-experimental .selection-store-close {
        min-height: 34px;
        padding: 4px 8px;
        touch-action: manipulation;
    }

    html.selection-experimental .selection-missions-list {
        height: calc(100% - 67px);
        padding: 7px 9px 16px;
    }

    html.selection-experimental .selection-character-store-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    html.selection-experimental .selection-unlock-confirm-backdrop,
    html.selection-experimental .private-match-backdrop {
        padding: 8px;
    }

    html.selection-experimental .searching-backdrop {
        padding: 8px;
    }

    html.selection-experimental .searchingscroll {
        width: min(360px, calc(100vw - 16px));
        min-height: 160px;
        gap: 8px;
        padding: 14px 18px;
    }

    html.selection-experimental .searchingscroll::before,
    html.selection-experimental body.arena-mode-pokemon .searchingscroll::before {
        font-size: 8px;
    }

    html.selection-experimental .searching {
        font-size: 13px;
    }

    html.selection-experimental .sharingan {
        width: 42px;
        height: 42px;
    }

    html.selection-experimental .cancel-button {
        min-height: 40px;
        padding: 7px 12px;
        font-size: 10px;
        touch-action: manipulation;
    }
}

/* Keep the minimized-PC layout readable without browser zoom or overlapping rails. */
@media (min-width: 701px) and (max-width: 1120px),
       (max-width: 950px) and (orientation: landscape),
       (max-width: 950px) and (max-height: 520px),
       (min-width: 1121px) and (max-height: 679px) {
    html.selection-experimental {
        --compact-left-rail: clamp(136px, 24vw, 196px);
        --compact-right-rail: 150px;
    }

    html.selection-experimental .player-card {
        width: var(--compact-left-rail);
        box-sizing: border-box;
    }

    html.selection-experimental .sound-controller {
        width: var(--compact-left-rail);
        box-sizing: border-box;
    }

    html.selection-experimental .experimental-toolbar {
        width: var(--compact-right-rail);
        box-sizing: border-box;
    }

    html.selection-experimental .selection-mode-controls {
        width: var(--compact-right-rail);
    }

    html.selection-experimental .skillviewer,
    html.selection-experimental .skillviewer.collapsed,
    html.selection-experimental .skillviewer.raveling {
        left: calc(var(--compact-left-rail) + 10px);
        right: calc(var(--compact-right-rail) + 8px);
        width: auto;
        height: min(46dvh, 700px);
    }

    html.selection-experimental .slot-list {
        height: min(33dvh, 550px);
    }

    html.selection-experimental .button-container {
        bottom: 103px;
    }
}

@media (max-width: 950px) {
    html.selection-experimental body.experimental-store-open .sound-controller,
    html.selection-experimental body.experimental-missions-open .sound-controller,
    html.selection-experimental body.experimental-controls-open .sound-controller {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.selection-experimental *,
    html.selection-experimental *::before,
    html.selection-experimental *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
