@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a2e;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA/UlEQVR4AezUzRGCMBAF4KwNaA/ag/Z/swiLsIK4L8xmNj+oDNnlEocHQZT3sQdOYfnE5eC/FwCaD0FkQIypP+2g8UoGoPAIRAF4vt7BG1EAMAXEE1EA7tdzwBQ8EQUAxToek2gAegrAWCMaAErrWCK6gHoKAFkhugAU9mKBWAX0pgDUaMQqAGVAEFEgKoNrnCGv7QYg7wEuSMV4Ygm+45AKL/dtDUBuR4QeObM7NoDH7ZKenCtdBBlARLqYGOCyZQC3oRThZd6IP/nEYiGAulh3seHbZf3T7WsB/PqnGeJfAIAYA4L1sGwBDCvVN5qAOYE5gTkB8wnol05v/QEAAP//BJsfdAAAAAZJREFUAwB9UEpBSMbrFgAAAABJRU5ErkJggg==') 1 1, auto;
}

a, button, select, input, .pokemon-sprite, .dropdown-item, .bg-btn, .search-result-item {
    cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABD0lEQVR4AeyU2w3CMAxFGxaAHWAH2P8LdoAdYILgW6VVHnaJlRghlAoTajv28SXtbpIvTyEYLXYfCcBf78/J+7n//GWFIAFY9Svq/i7A+bgvaC0cGgVwFmBdOWoBzA5lFQCeCKu/ZAGAtDBWXqY5cmFsvsYJgE15w7sgqQlFgr8ZAgBr8ZqiyGEUWWtofyQA2IwGWL9lAHCX0yHpF0PcHq8k1vsGAKjp6MJabSHfVW8QEhcAIWzvjgFoqHKgngeOGycG4OLmvhyAVSGnoCS4SrngVVoOoNzens6B0ADycBREVzkBUYVxAIrt7akiACblrL1lWkECgMRbllZpuJMAGkrqtg6AocBQ4P8V+PRWeAMAAP//39PNEwAAAAZJREFUAwCncj1BWpjPVAAAAABJRU5ErkJggg==') 6 0, pointer;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 60px 20px 40px;
    position: relative;
    z-index: 1;
}

.page-header {
    text-align: center;
}

.page-header h1 {
    font-size: 46px;
    color: #f7f7f7;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5);
    letter-spacing: 3px;
}

.page-header p {
    font-size: 10px;
    color: #a0aec0;
    margin-top: 10px;
    letter-spacing: 1px;
}

/* Hall of Fame Display */
.hall-of-fame {
    border: 4px solid #2d3748;
    border-radius: 8px;
    padding: 30px 40px 16px;
    position: relative;
    box-shadow:
        0 0 0 2px #1a202c,
        0 0 20px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.2);
    width: 900px;
    transition: background 0.4s ease;
}

/* Backgrounds */

/* 1 - Gen 3 Hall of Fame: classic horizontal stripe pattern */
.hall-of-fame.bg-hall-of-fame {
    background:
        repeating-linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.08) 0px,
            rgba(0, 0, 0, 0.08) 2px,
            transparent 2px,
            transparent 4px
        ),
        linear-gradient(180deg, #4a5568 0%, #6b7a8d 50%, #4a5568 100%);
}


/* 3 - Night Sky: dark blue with subtle stars (diamond pattern) */
.hall-of-fame.bg-champion {
    background:
        radial-gradient(1px 1px at 20% 15%, rgba(255,255,255,0.7) 1px, transparent 0),
        radial-gradient(1px 1px at 60% 25%, rgba(255,255,255,0.5) 1px, transparent 0),
        radial-gradient(1px 1px at 80% 10%, rgba(255,255,255,0.6) 1px, transparent 0),
        radial-gradient(1px 1px at 35% 35%, rgba(255,255,255,0.4) 1px, transparent 0),
        radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.5) 1px, transparent 0),
        radial-gradient(1.5px 1.5px at 10% 50%, rgba(255,255,255,0.8) 1px, transparent 0),
        radial-gradient(1px 1px at 50% 5%, rgba(255,255,255,0.6) 1px, transparent 0),
        radial-gradient(1px 1px at 75% 55%, rgba(255,255,255,0.4) 1px, transparent 0),
        linear-gradient(180deg, #0c1445 0%, #162050 40%, #1a2a5e 70%, #243370 100%);
}

/* 4 - Pokemon Center: clean tile floor with warm tones */
.hall-of-fame.bg-pokemon-center {
    background:
        repeating-conic-gradient(
            #f5e6d3 0% 25%, #eddcc8 0% 50%
        ) 0 0 / 40px 40px,
        linear-gradient(180deg, #f5e6d3 0%, #eddcc8 100%);
}

/* 4 - Pokeball: cute half pokeball on the right */
.hall-of-fame.bg-pokeball {
    background:
        radial-gradient(circle at 100% 50%, #fff 0%, #fff 55px, transparent 55px),
        radial-gradient(circle at 100% 50%, #1a1a1a 0%, #1a1a1a 70px, transparent 70px),
        radial-gradient(circle at 100% 50%, #f0f0f0 0%, #f0f0f0 120px, transparent 120px),
        linear-gradient(180deg,
            #ee4444 0%, #ee4444 48.5%,
            #1a1a1a 48.5%, #1a1a1a 51.5%,
            #f0f0f0 51.5%, #f0f0f0 100%),
        #fce4ec;
    background-size: 100% 100%;
    background-repeat: no-repeat;
}


/* 5 - Safari: pokeball close-up with mint and coral */
.hall-of-fame.bg-safari {
    background:
        /* pokeball button */
        radial-gradient(circle at 62% 52%, #f5f5f0 8px, transparent 8px),
        radial-gradient(circle at 62% 52%, #888 12px, transparent 12px),
        /* pokeball white ring */
        radial-gradient(circle at 62% 52%, #f5f5f0 22px, transparent 22px),
        /* pokeball dome */
        radial-gradient(circle at 62% 52%, #e8877c 120px, transparent 120px),
        /* center divider line */
        linear-gradient(180deg,
            transparent 48%, #888 48%, #888 52%, transparent 52%),
        /* top half coral, bottom half cream */
        linear-gradient(180deg,
            #b8d8c8 0%, #b8d8c8 48%,
            #888 48%, #888 52%,
            #d4e8d0 52%, #d4e8d0 100%);
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* 12 - Board: green bulletin board with corner pins */
.hall-of-fame.bg-board {
    background:
        /* corner screws/pins */
        radial-gradient(circle at 5% 6%, #a08868 4px, transparent 4px),
        radial-gradient(circle at 95% 6%, #a08868 4px, transparent 4px),
        radial-gradient(circle at 5% 94%, #a08868 4px, transparent 4px),
        radial-gradient(circle at 95% 94%, #a08868 4px, transparent 4px),
        /* screw highlights */
        radial-gradient(circle at 4.7% 5.6%, rgba(255,255,255,0.3) 2px, transparent 2px),
        radial-gradient(circle at 94.7% 5.6%, rgba(255,255,255,0.3) 2px, transparent 2px),
        radial-gradient(circle at 4.7% 93.6%, rgba(255,255,255,0.3) 2px, transparent 2px),
        radial-gradient(circle at 94.7% 93.6%, rgba(255,255,255,0.3) 2px, transparent 2px),
        /* inner lighter panel */
        linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 50%),
        /* green board */
        linear-gradient(180deg, #6aab6a 0%, #7dbe7d 4%, #8dcc8d 8%, #82c482 92%, #6aab6a 97%, #5a9a5a 100%);
}

/* 13 - Sky: bright blue sky with fluffy clouds */
.hall-of-fame.bg-sky {
    background:
        /* cloud 1 */
        radial-gradient(ellipse 50px 28px at 15% 25%, rgba(255,255,255,0.9) 50%, transparent 50%),
        radial-gradient(ellipse 35px 22px at 11% 27%, rgba(255,255,255,0.9) 50%, transparent 50%),
        radial-gradient(ellipse 40px 20px at 19% 29%, rgba(255,255,255,0.9) 50%, transparent 50%),
        /* cloud 2 */
        radial-gradient(ellipse 55px 30px at 55% 18%, rgba(255,255,255,0.85) 50%, transparent 50%),
        radial-gradient(ellipse 38px 24px at 50% 20%, rgba(255,255,255,0.85) 50%, transparent 50%),
        radial-gradient(ellipse 42px 22px at 60% 21%, rgba(255,255,255,0.85) 50%, transparent 50%),
        /* cloud 3 */
        radial-gradient(ellipse 45px 25px at 80% 40%, rgba(255,255,255,0.8) 50%, transparent 50%),
        radial-gradient(ellipse 32px 20px at 76% 42%, rgba(255,255,255,0.8) 50%, transparent 50%),
        radial-gradient(ellipse 35px 18px at 84% 43%, rgba(255,255,255,0.8) 50%, transparent 50%),
        /* cloud 4 */
        radial-gradient(ellipse 48px 26px at 30% 55%, rgba(255,255,255,0.85) 50%, transparent 50%),
        radial-gradient(ellipse 35px 20px at 26% 57%, rgba(255,255,255,0.85) 50%, transparent 50%),
        radial-gradient(ellipse 38px 19px at 35% 58%, rgba(255,255,255,0.85) 50%, transparent 50%),
        /* cloud 5 */
        radial-gradient(ellipse 52px 28px at 70% 70%, rgba(255,255,255,0.8) 50%, transparent 50%),
        radial-gradient(ellipse 36px 22px at 65% 72%, rgba(255,255,255,0.8) 50%, transparent 50%),
        radial-gradient(ellipse 40px 20px at 75% 73%, rgba(255,255,255,0.8) 50%, transparent 50%),
        /* cloud 6 */
        radial-gradient(ellipse 42px 24px at 12% 78%, rgba(255,255,255,0.75) 50%, transparent 50%),
        radial-gradient(ellipse 30px 18px at 8% 80%, rgba(255,255,255,0.75) 50%, transparent 50%),
        /* sky gradient */
        linear-gradient(180deg, #42a5e8 0%, #5cb8f0 30%, #7ccaf5 60%, #a0dcf8 100%);
}

/* 14 - Space: outer space with Earth and planets */
.hall-of-fame.bg-space {
    background:
        /* small stars */
        radial-gradient(1px 1px at 8% 12%, rgba(255,255,255,0.8) 1px, transparent 0),
        radial-gradient(1px 1px at 22% 8%, rgba(255,255,255,0.6) 1px, transparent 0),
        radial-gradient(1.5px 1.5px at 38% 22%, rgba(255,255,255,0.7) 1px, transparent 0),
        radial-gradient(1px 1px at 52% 15%, rgba(255,255,255,0.5) 1px, transparent 0),
        radial-gradient(1px 1px at 68% 28%, rgba(255,255,255,0.6) 1px, transparent 0),
        radial-gradient(1.5px 1.5px at 82% 18%, rgba(255,255,255,0.7) 1px, transparent 0),
        radial-gradient(1px 1px at 45% 42%, rgba(255,255,255,0.5) 1px, transparent 0),
        radial-gradient(1px 1px at 15% 55%, rgba(255,255,255,0.6) 1px, transparent 0),
        radial-gradient(1px 1px at 90% 45%, rgba(255,255,255,0.5) 1px, transparent 0),
        radial-gradient(1.5px 1.5px at 60% 62%, rgba(255,255,255,0.4) 1px, transparent 0),
        /* orange planet */
        radial-gradient(circle at 78% 35%, #c08050 14px, transparent 14px),
        radial-gradient(circle at 78% 35%, #d09060 12px, transparent 12px),
        /* small moon */
        radial-gradient(circle at 35% 20%, #9090a8 6px, transparent 6px),
        radial-gradient(circle at 35% 20%, #a0a0b8 5px, transparent 5px),
        /* Earth glow */
        radial-gradient(circle at 20% 95%, rgba(80, 160, 255, 0.15) 80px, transparent 120px),
        /* Earth */
        radial-gradient(circle at 20% 95%, #4090d0 70px, transparent 70px),
        radial-gradient(circle at 15% 90%, #50a0e0 40px, transparent 60px),
        radial-gradient(circle at 25% 98%, #308050 30px, transparent 50px),
        /* space gradient */
        linear-gradient(180deg, #1a1a3a 0%, #252550 30%, #303065 60%, #2a2a55 100%);
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* Scanline overlay for retro feel */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.08) 0px,
        rgba(0, 0, 0, 0.08) 1px,
        transparent 1px,
        transparent 3px
    );
}

.team-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 0px;
    margin-bottom: 16px;
}

.pokemon-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
    min-height: 140px;
    flex: 1 1 33.33%;
    max-width: 33.33%;
    transition: flex 0.25s ease, max-width 0.25s ease, min-width 0.25s ease, padding 0.25s ease;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.sprite-wrapper {
    image-rendering: pixelated;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
    position: relative;
}

.pokemon-sprite {
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
    filter: drop-shadow(2px 2px 0px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
    cursor: grab;
    -webkit-touch-callout: none;
}

.pokemon-sprite:hover {
    transform: scale(1.05);
}

.pokemon-slot.dragging {
    opacity: 0.4;
}

.pokemon-slot.empty-slot.collapsed {
    flex: 0 0 30px;
    max-width: 30px;
    min-width: 30px;
    padding: 12px 0;
    overflow: hidden;
}

.pokemon-slot.empty-slot.expanded {
    flex: 1 1 33.33%;
    max-width: 33.33%;
}

.pokemon-slot.drag-over {
    outline: 3px dashed #63b3ed;
    outline-offset: -3px;
    border-radius: 8px;
    background: rgba(99, 179, 237, 0.15);
}

/* Sprite popup search */
.sprite-popup {
    position: fixed;
    background: #1a202c;
    border: 2px solid #63b3ed;
    border-radius: 6px;
    padding: 0;
    z-index: 250;
    width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.sprite-popup-layout {
    display: flex;
    height: 320px;
}

.sprite-popup-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sprite-popup-header {
    display: flex;
    gap: 4px;
    padding: 6px 6px 4px;
}

.sprite-popup-header input {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.sprite-popup-shiny {
    font-size: 16px;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(246, 224, 94, 0.1);
    border: 1px solid rgba(246, 224, 94, 0.4);
    border-radius: 4px;
    color: #c4a83a;
    transition: all 0.2s;
    line-height: 1;
}

.sprite-popup-shiny:hover {
    border-color: #f6e05e;
    color: #f6e05e;
    background: rgba(246, 224, 94, 0.2);
}

.sprite-popup-shiny.active {
    background: rgba(246, 224, 94, 0.25);
    border-color: #f6e05e;
    color: #f6e05e;
    text-shadow: 0 0 6px rgba(246, 224, 94, 0.6);
}

.sprite-popup-delete {
    font-size: 12px;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(229, 62, 62, 0.15);
    border: 1px solid #e53e3e;
    border-radius: 4px;
    color: #e53e3e;
    transition: all 0.2s;
}

.sprite-popup-delete:hover {
    background: #e53e3e;
    color: #fff;
}

.sprite-popup input {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 6px 8px;
    background: #2d3748;
    border: 2px solid #4a5568;
    border-radius: 4px;
    color: #e2e8f0;
    outline: none;
    width: 100%;
}

.sprite-popup input:focus {
    border-color: #63b3ed;
}

.sprite-popup-gens {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: #151b2b;
    border-right: 1px solid #4a5568;
    width: 38px;
}

.sprite-gen-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #a0aec0;
    text-align: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sprite-gen-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #777;
    transition: all 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 0;
    width: 100%;
}

.sprite-gen-btn:last-child {
    border-bottom: none;
}

.sprite-gen-btn:hover {
    background: rgba(99, 179, 237, 0.15);
    color: #e2e8f0;
}

.sprite-gen-btn.active {
    background: rgba(99, 179, 237, 0.3);
    color: #63b3ed;
}

.sprite-popup-results {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sprite-popup-results .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 7px;
    color: #e2e8f0;
    text-transform: capitalize;
    border-radius: 3px;
}

.sprite-popup-results .dropdown-item:hover {
    background: #2d3748;
}

.sprite-popup-results .dropdown-item img {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
}

.sprite-popup-results::-webkit-scrollbar {
    width: 5px;
}

.sprite-popup-results::-webkit-scrollbar-track {
    background: #1a202c;
}

.sprite-popup-results::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

.sprite-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 240;
}

/* Confetti particles */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 6px;
    height: 6px;
    opacity: 0.9;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Title bar */
.title-bar {
    background: rgba(0, 0, 0, 0.6);
    padding: 18px 24px;
    text-align: center;
    border-radius: 4px;
    margin-top: 8px;
}

.title-text {
    font-size: 18px;
    color: #f7f7f7;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
    outline: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
    display: inline-block;
    min-width: 40px;
}

.title-text:focus {
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

/* Background selector */
.options-rows {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    padding: 0 10px;
}

.options-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.options-row label {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    text-align: center;
}

.gen-options {
    display: flex;
    gap: 8px;
}

.team-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 0 6px;
}

.team-heading {
    font-size: 20px;
    color: #e2e8f0;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
    margin: 0;
}

.gen-inline-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.gen-inline-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gen-options-inline {
    display: flex;
    gap: 6px;
}

/* Hide the gen row in options-rows on desktop (shown inline instead) */
.options-row:has(.gen-options) {
    display: none;
}

.bg-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.bg-selector label {
    font-size: 10px;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bg-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bg-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    width: 36px;
    height: 36px;
    border: 2px solid #4a5568;
    border-radius: 4px;
    cursor: pointer;
    color: #e2e8f0;
    transition: all 0.2s;
}

.bg-btn[data-bg="hall-of-fame"] { background: #6b7a8d; color: #fff; }

.bg-btn[data-bg="champion"] { background: #162050; color: #7fa3d4; }
.bg-btn[data-bg="pokemon-center"] { background: #f5e6d3; color: #4a3728; }
.bg-btn[data-bg="pokeball"] { background: linear-gradient(180deg, #ee4444 50%, #f0f0f0 50%); color: #1a1a1a; }
.bg-btn[data-bg="safari"] { background: linear-gradient(180deg, #e8877c 50%, #b8d8c8 50%); color: #fff; }
.bg-btn[data-bg="board"] { background: #7dbe7d; color: #2a5a2a; }
.bg-btn[data-bg="sky"] { background: #5cb8f0; color: #fff; }
.bg-btn[data-bg="space"] { background: #252550; color: #8888cc; }

.bg-btn:hover {
    border-color: #63b3ed;
    transform: scale(1.1);
}

.bg-btn.active {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.bg-btn.bg-dragging {
    opacity: 0.4;
}

.bg-btn.bg-drag-over {
    border-color: #63b3ed;
    transform: scale(1.15);
}

/* Editor panel - Gen 3 party screen style */
.editor-panel {
    background:
        repeating-linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.08) 0px,
            rgba(0, 0, 0, 0.08) 2px,
            transparent 2px,
            transparent 4px
        ),
        linear-gradient(180deg, #4a5568 0%, #6b7a8d 50%, #4a5568 100%);
    border: 3px solid #2d3748;
    border-radius: 8px;
    padding: 20px;
    width: 900px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 200;
}

/* Team header */
.team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 0 6px;
    flex-wrap: wrap;
    gap: 10px;
}


.editor-panel h2 {
    font-size: 13px;
    color: #e2e8f0;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

.randomize-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gen-label {
    font-size: 8px;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 2px;
}

.gen-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    width: 34px;
    height: 34px;
    background: #3a4a5e;
    border: 2px solid #5a6a7e;
    border-radius: 4px;
    color: #c0cad8;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.gen-btn:hover {
    background: #5a6a7e;
    color: #fff;
}

#randomize-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 8px 14px;
    background: #6b4c8a;
    border: 2px solid #8b6aae;
    border-radius: 14px;
    color: #fff;
    transition: all 0.2s;
    white-space: nowrap;
    margin-left: 4px;
}

#randomize-btn:hover {
    background: #8b6aae;
}

/* Party grid - 2 column layout */
.party-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.party-slot {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.party-slot-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.party-icon {
    width: 50px;
    height: 50px;
    image-rendering: pixelated;
    flex-shrink: 0;
    object-fit: contain;
    object-position: center;
    display: block;
}

.party-slot .search-combo {
    flex: 0 1 240px;
}

.party-slot .pokemon-search {
    font-size: 10px;
    padding: 8px 10px;
}

.shiny-toggle {
    font-size: 18px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s;
    line-height: 1;
}

.shiny-toggle:hover {
    border-color: #f6e05e;
    color: #f6e05e;
}

.shiny-toggle.active {
    background: rgba(246, 224, 94, 0.15);
    border-color: #f6e05e;
    color: #f6e05e;
    text-shadow: 0 0 6px rgba(246, 224, 94, 0.6);
}

.clear-slot-btn {
    font-size: 14px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s;
    line-height: 1;
}

.clear-slot-btn:hover {
    border-color: #e53e3e;
    color: #e53e3e;
}

/* Moves row */
.moves-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.move-combo {
    display: flex;
    align-items: center;
    gap: 4px;
}

.move-type-badge {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #fff;
    padding: 3px 4px;
    border-radius: 2px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
    flex-shrink: 0;
    min-width: 26px;
    text-align: center;
    line-height: 1.4;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.move-type-badge.has-type {
    border: none;
}

.move-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.move-input {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    color: #c0cad8;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.move-input:focus {
    border-color: #e8a040;
}

.move-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    text-transform: none;
    font-size: 6px;
}

.move-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 150px;
    overflow-y: auto;
    display: none;
    z-index: 310;
}

.move-dropdown.open {
    display: block;
}

.move-dropdown .move-item {
    padding: 6px 8px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #e2e8f0;
    text-transform: capitalize;
}

.move-dropdown .move-item:hover,
.move-dropdown .move-item.highlighted {
    background: #2d3748;
}

.move-dropdown::-webkit-scrollbar {
    width: 4px;
}

.move-dropdown::-webkit-scrollbar-track {
    background: #1a202c;
}

.move-dropdown::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

/* Item row */
.item-row {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.item-icon {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
    flex-shrink: 0;
    object-fit: contain;
    visibility: hidden;
}

.item-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.item-input {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    color: #c0cad8;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-input:focus {
    border-color: #63b3ed;
}

.item-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    text-transform: none;
    font-size: 7px;
}

.item-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 150px;
    overflow-y: auto;
    display: none;
    z-index: 310;
}

.item-dropdown.open {
    display: block;
}

.item-dropdown .item-option {
    padding: 6px 8px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #e2e8f0;
    text-transform: capitalize;
}

.item-dropdown .item-option:hover,
.item-dropdown .item-option.highlighted {
    background: #2d3748;
}

.item-dropdown::-webkit-scrollbar {
    width: 4px;
}

.item-dropdown::-webkit-scrollbar-track {
    background: #1a202c;
}

.item-dropdown::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

/* Ability input */
.ability-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.ability-input {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    color: #c0cad8;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ability-input:focus {
    border-color: #63b3ed;
}

.ability-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    text-transform: none;
    font-size: 7px;
}

.ability-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 150px;
    overflow-y: auto;
    display: none;
    z-index: 310;
}

.ability-dropdown.open {
    display: block;
}

.ability-dropdown .ability-option {
    padding: 6px 8px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #e2e8f0;
    text-transform: capitalize;
}

.ability-dropdown .ability-option:hover,
.ability-dropdown .ability-option.highlighted {
    background: #2d3748;
}

.ability-dropdown::-webkit-scrollbar {
    width: 4px;
}

.ability-dropdown::-webkit-scrollbar-track {
    background: #1a202c;
}

.ability-dropdown::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

/* Save section */
.save-section {
    margin-top: 18px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    padding-top: 16px;
}

.save-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.save-header label {
    font-size: 10px;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#save-team-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 10px 14px;
    background: #2d6a4f;
    border: 2px solid #40916c;
    border-radius: 6px;
    color: #fff;
    transition: all 0.2s;
    white-space: nowrap;
    width: 100%;
    display: block;
    margin-bottom: 16px;
}

#save-team-btn:hover {
    background: #40916c;
}

#ig-story-btn {
    display: none;
}

.saved-teams-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 180px;
    overflow-y: auto;
}

.saved-team-item {
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.saved-team-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    line-height: 1.8;
    color: #e2e8f0;
    flex: 1;
    min-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 4px 6px;
    outline: none;
    cursor: text;
    transition: border-color 0.2s;
}

.saved-team-name:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.saved-team-name:focus {
    border-color: #63b3ed;
    background: rgba(0, 0, 0, 0.3);
    text-overflow: clip;
}

.saved-team-item.dragging-saved {
    opacity: 0.4;
}

.saved-team-item.drag-over-saved {
    border-color: #63b3ed;
    background: rgba(99, 179, 237, 0.1);
}

.saved-team-drag {
    font-size: 10px;
    color: #666;
    cursor: grab;
    flex-shrink: 0;
    padding: 0 2px;
    user-select: none;
    transition: color 0.2s;
}

.saved-team-drag:hover {
    color: #a0aec0;
}

.saved-team-icons {
    display: flex;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.saved-team-icons img {
    width: 36px;
    height: 28px;
    image-rendering: pixelated;
    object-fit: contain;
}

.saved-team-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.saved-team-load,
.saved-team-delete {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 5px 10px;
    border-radius: 3px;
    border: 1px solid;
    color: #fff;
    transition: all 0.2s;
}

.saved-team-load {
    background: #2d5a87;
    border-color: #4a7ab0;
}

.saved-team-load:hover {
    background: #4a7ab0;
}

.saved-team-delete {
    background: #7a3030;
    border-color: #a04040;
}

.saved-team-delete:hover {
    background: #a04040;
}

.saved-teams-list::-webkit-scrollbar {
    width: 5px;
}

.saved-teams-list::-webkit-scrollbar-track {
    background: transparent;
}

.saved-teams-list::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

/* Shared search styles */
.search-combo {
    position: relative;
}

.pokemon-search {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #e2e8f0;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.pokemon-search:focus {
    border-color: #e8a040;
}

.pokemon-search::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 300;
}

.search-dropdown.open {
    display: block;
}

.search-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 8px;
    color: #e2e8f0;
    text-transform: capitalize;
}

.search-dropdown .dropdown-item:hover,
.search-dropdown .dropdown-item.highlighted {
    background: #2d3748;
}

.search-dropdown .dropdown-item img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

/* Scrollbar styling */
.search-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-dropdown::-webkit-scrollbar-track {
    background: #1a202c;
}

.search-dropdown::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}


/* Responsive - Tablet */
@media (max-width: 960px) {
    .container {
        padding: 30px 12px 30px;
        gap: 30px;
    }

    .hall-of-fame,
    .editor-panel {
        width: 95vw;
    }

    .page-header h1 {
        font-size: 32px;
    }
}

/* Responsive - Mobile */
@media (max-width: 600px) {
    .container {
        padding: 20px 8px 20px;
        gap: 20px;
    }

    .page-header h1 {
        font-size: 22px;
        letter-spacing: 1px;
    }

    .page-header p {
        font-size: 7px;
    }

    .hall-of-fame,
    .editor-panel {
        width: 98vw;
        border-radius: 6px;
    }

    .hall-of-fame {
        padding: 14px 12px 8px;
    }

    .editor-panel {
        padding: 12px 10px;
    }

    /* Sprite grid - keep 3 columns on mobile */
    .team-grid {
        gap: 4px 0px;
        margin-bottom: 8px;
    }

    .pokemon-slot {
        padding: 4px 2px;
        min-height: 70px;
        flex: 1 1 33.33%;
        max-width: 33.33%;
    }

    .sprite-wrapper,
    .pokemon-sprite {
        width: 28vw;
        height: 28vw;
        max-width: 120px;
        max-height: 120px;
    }

    /* Title bar */
    .title-bar {
        padding: 10px 12px;
        margin-top: 4px;
    }

    .title-text {
        font-size: 10px;
    }

    /* Options rows */
    .options-rows {
        gap: 12px;
        margin-bottom: 16px;
        padding: 0;
    }

    .options-row {
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }

    .options-row label {
        min-width: unset;
        text-align: center;
        font-size: 7px;
    }

    .bg-options {
        gap: 5px;
        justify-content: center;
    }

    .gen-options {
        gap: 5px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .bg-btn {
        font-size: 8px;
        width: 30px;
        height: 30px;
    }

    .team-heading-row {
        justify-content: center;
    }

    .gen-inline-group {
        display: none;
    }

    .options-row:has(.gen-options) {
        display: flex;
    }

    .team-heading {
        font-size: 10px;
        margin-bottom: 0;
    }

    #save-team-btn {
        font-size: 8px;
        padding: 9px 10px;
        margin-bottom: 10px;
    }

    #ig-story-btn {
        display: block;
        width: 100%;
        font-family: 'Press Start 2P', monospace;
        font-size: 8px;
        padding: 9px 10px;
        background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
        border: 2px solid #e6683c;
        border-radius: 6px;
        color: #fff;
        transition: all 0.2s;
        margin-bottom: 10px;
    }

    #ig-story-btn:hover {
        opacity: 0.85;
    }

    .editor-panel h2 {
        font-size: 10px;
    }

    .randomize-group {
        flex-wrap: wrap;
        gap: 4px;
    }

    .gen-btn {
        font-size: 6px;
        width: 26px;
        height: 26px;
    }

    #randomize-btn {
        font-size: 7px;
        padding: 6px 10px;
    }

    /* Party grid - single column on mobile */
    .party-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .party-slot {
        padding: 10px 12px;
        gap: 8px;
    }

    .party-slot-main {
        gap: 8px;
    }

    .party-icon {
        width: 36px;
        height: 36px;
    }

    .party-slot .search-combo {
        flex: 1;
    }

    .party-slot .pokemon-search {
        font-size: 9px;
        padding: 6px 8px;
    }

    .shiny-toggle,
    .clear-slot-btn {
        font-size: 14px;
        width: 30px;
        height: 30px;
    }

    /* Moves */
    .moves-row {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }

    .move-input {
        font-size: 7px;
        padding: 5px 4px;
    }

    .move-input::placeholder {
        font-size: 6px;
    }

    .move-type-badge {
        font-size: 5px;
        min-width: 20px;
        padding: 2px 2px;
    }

    .move-dropdown {
        max-height: 120px;
    }

    .move-dropdown .move-item {
        font-size: 7px;
        padding: 5px 6px;
    }

    /* Item */
    .item-input {
        font-size: 7px;
        padding: 5px 4px;
    }

    .item-input::placeholder {
        font-size: 6px;
    }

    .item-icon {
        width: 20px;
        height: 20px;
    }

    .item-input-wrap {
        max-width: none;
    }

    /* Ability */
    .ability-input {
        font-size: 7px;
        padding: 5px 4px;
    }

    .ability-input::placeholder {
        font-size: 6px;
    }

    /* Editor top bar */
    .editor-top-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    #save-team-btn {
        font-size: 8px;
        padding: 9px 10px;
    }

    /* Save section */
    .save-section {
        margin-top: 12px;
        padding-top: 10px;
    }

    .save-header label {
        font-size: 8px;
    }

    .saved-team-item {
        padding: 6px 8px;
        gap: 6px;
    }

    .saved-team-name {
        font-size: 7px;
        min-width: 60px;
    }

    .saved-team-icons img {
        width: 24px;
        height: 18px;
    }

    .saved-team-load,
    .saved-team-delete {
        font-size: 6px;
        padding: 3px 6px;
    }

    .saved-team-drag {
        font-size: 8px;
    }

    /* Search dropdown */
    .search-dropdown {
        max-height: 150px;
    }

    .search-dropdown .dropdown-item {
        font-size: 7px;
        padding: 5px 8px;
    }

    .search-dropdown .dropdown-item img {
        width: 24px;
        height: 24px;
    }

    /* Sprite popup */
    .sprite-popup {
        width: 85vw;
        max-width: 280px;
        left: 50% !important;
        transform: translateX(-50%);
    }

    .sprite-popup input {
        font-size: 9px;
    }

}
