@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --bg-color: #0a0a0c;
    --card-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-red: #ff3e3e;
    --primary-yellow: #ffcc00;
    --text-main: #f0f0f0;
    --text-muted: #a0a0a0;
    --accent-glow: 0 0 20px rgba(255, 62, 62, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Glassmorphism Utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
}

.fade-in.appear {
    animation: fadeIn 0.8s ease forwards;
}

body.page-enter {
    animation: pageEnter 0.4s ease;
}

@keyframes pageEnter {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Layout */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
}

header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: var(--transition);
}

header.scrolled {
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(20px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--glass-border);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary-red);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo::before {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--primary-red);
    border-radius: 50%;
    box-shadow: var(--accent-glow);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 2rem;
    transition: var(--transition);
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8rem;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.header-action {
    display: flex;
    align-items: center;
}

.nav-links a:hover {
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Menu Toggle Button */
.menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
}

.menu-btn .bar {
    width: 100%;
    height: 2px;
    background-color: white;
    border-radius: 10px;
    transition: var(--transition);
}

.menu-btn.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-btn.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-btn.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 900px) {
    .menu-btn {
        display: flex;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(10, 10, 12, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        z-index: 1000;
        transform: none;
        left: auto;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.5rem;
    }

    .nav-container {
        padding: 0 1.5rem;
    }
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at top right, rgba(255, 62, 62, 0.1), transparent 40%),
        radial-gradient(circle at bottom left, rgba(255, 204, 0, 0.05), transparent 40%);
}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
    z-index: -1;
    filter: grayscale(0.5) contrast(1.2);
}

.hero-content {
    text-align: center;
    max-width: 800px;
    z-index: 10;
}

.hero h1 {
    font-size: clamp(2.5rem, 10vw, 5rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
    background: linear-gradient(180deg, #fff 0%, #888 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: clamp(1rem, 4vw, 1.25rem);
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    padding: 0 2rem;
}

.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--primary-red);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 800;
    text-transform: uppercase;
    transition: var(--transition);
    box-shadow: var(--accent-glow);
}

.btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 30px rgba(255, 62, 62, 0.5);
}

/* Section Styling */
section {
    padding: 8rem 0;
}

.section-title {
    margin-bottom: 4rem;
}

.section-title h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

.card {
    padding: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-red);
}

.card h3 {
    margin-bottom: 1rem;
    color: var(--primary-red);
}

/* Pokedex specific */
.pokedex-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.pokedex-section .search-input,
.pokedex-section .pokedex-select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    font-size: 0.95rem;
    min-width: 220px;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.pokedex-section .search-input {
    flex: 1 1 280px;
    max-width: 480px;
}
.pokedex-section select.pokedex-select {
    min-width: 180px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffffcc' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.2rem;
    cursor: pointer;
}
.pokedex-section .search-input:focus,
.pokedex-section select.pokedex-select:focus {
    outline: none;
    border-color: rgba(255, 62, 62, 0.9);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.pokedex-section .dex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}
.pokedex-section .dex-card {
    background: rgba(12, 12, 18, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-radius: 24px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.pokedex-section .dex-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 62, 62, 0.25);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.22);
}
.pokedex-section .dex-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
}
.pokedex-section .dex-card-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, max-content));
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.92rem;
}
.pokedex-section .dex-card-description {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    font-size: 0.95rem;
}
.pokedex-section .dex-sprite-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}
.pokedex-section .dex-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.82rem;
}
.pokedex-section .dex-sprite-cell {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pokedex-section .dex-sprite-cell img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}
.pokedex-section .dex-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pokedex-section .dex-card-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}
.pokedex-section .page-links a {
    min-width: 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.95rem 1.25rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.pokedex-section .page-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 62, 62, 0.4);
    transform: translateY(-1px);
}
.pokedex-section .page-links {
    justify-content: center;
}
.pokedex-select {
    color: white;
}
.pokedex-section .search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.dex-empty-state {
    padding: 2rem;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
}

.pokemon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pokemon-img {
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(255, 62, 62, 0.2));
}

.type-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin: 2px;
}

/* Pokemon Type Badges */
.type-tag {
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin: 2px;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.type-grass {
    background: #78C850;
}

.type-fire {
    background: #F08030;
}

.type-water {
    background: #6890F0;
}

.type-bug {
    background: #A8B820;
}

.type-normal {
    background: #A8A878;
}

.type-poison {
    background: #A040A0;
}

.type-electric {
    background: #F8D030;
}

.type-ground {
    background: #E0C068;
}

.type-fairy {
    background: #EE99AC;
}

.type-fighting {
    background: #C03028;
}

.type-psychic {
    background: #F85888;
}

.type-rock {
    background: #B8A038;
}

.type-ghost {
    background: #705898;
}

.type-ice {
    background: #98D8D8;
}

.type-dragon {
    background: #7038F8;
}

.type-dark {
    background: #705848;
}

.type-steel {
    background: #B8B8D0;
}

.type-flying {
    background: #A890F0;
}

/* Pokemon Graphical Type Icons */
.type-icon {
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    margin: 1px;
    border-radius: 4px;
}

/* Stat Bars */
.stat-container {
    width: 100%;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-label {
    width: 30px;
    font-weight: 700;
}

.stat-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease-out;
}

.stat-hp {
    background: #FF5959;
}

.stat-atk {
    background: #F5AC78;
}

.stat-def {
    background: #FAE078;
}

.stat-spa {
    background: #9DB7F5;
}

.stat-spd {
    background: #A7DB8D;
}

.stat-spe {
    background: #FA92B2;
}

footer {
    padding: 4rem 0;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Loader Animation */
.loader {
    width: 30px;
    height: 30px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Pokemon Detail Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: rgba(15, 23, 42, 0.9);
    border: var(--glass-border);
    border-radius: 28px;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 50px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

@keyframes modalScale {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 25px;
    right: 25px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 10;
}

.close-modal:hover {
    background: var(--primary-red);
    transform: rotate(90deg);
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 50px;
}

.modal-header-section {
    position: sticky;
    top: 0;
}

.modal-sprite-container {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 30px;
    padding: 40px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
}

.modal-sprite {
    width: 200px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
}

.modal-badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.special-badge {
    padding: 6px 15px;
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.badge-legendary {
    background: linear-gradient(135deg, #FFD700, #FDB931);
    color: #000;
}

.badge-mythical {
    background: linear-gradient(135deg, #D946EF, #701A75);
    color: #FFF;
}

.badge-pseudo {
    background: linear-gradient(135deg, #0EA5E9, #2563EB);
    color: #FFF;
}

.modal-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 30px;
}

.info-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.modal-stats-section h3,
.modal-moves-section h3 {
    margin-bottom: 25px;
    font-size: 1.6rem;
    font-weight: 800;
    color: white;
    border-left: 4px solid var(--primary-red);
    padding-left: 15px;
}

.modal-stat-row {
    margin-bottom: 18px;
}

.modal-stat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.modal-stat-bar-container {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.modal-stat-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.65, 0, 0.35, 1);
}

.modal-moves-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.move-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.move-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
    border-color: var(--primary-red);
}

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

.move-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.move-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
    text-transform: capitalize;
}

.move-type-badge {
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.move-stats {
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 10px;
}

.move-stat-item {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.move-stat-item b {
    color: white;
    font-weight: 700;
}

.move-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.total-stats-pill {
    background: var(--primary-red);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    display: inline-block;
    font-weight: 800;
    margin-top: 20px;
    box-shadow: 0 10px 20px rgba(255, 51, 51, 0.3);
}

@media (max-width: 850px) {
    .modal-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 30px;
    }

    .modal-sprite {
        width: 150px;
        height: 150px;
    }

    .modal-header-section {
        position: relative;
    }
}

/* --- Responsive Grid & Teambuilder Adjustments --- */
#team-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

#builder-view {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    #builder-view {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 991px) {
    #team-grid {
        grid-template-columns: 1fr !important;
    }

    #builder-view {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .section-title h2 {
        font-size: 2rem;
    }

    section {
        padding: 4rem 0;
    }

    .modal-content {
        padding: 20px !important;
        border-radius: 16px;
    }

    .modal-grid {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }

    .modal-header-section {
        position: relative !important;
    }

    .modal-sprite-container {
        padding: 20px;
        min-height: 180px;
    }

    .modal-sprite {
        width: 120px;
        height: 120px;
    }

    .stat-row {
        grid-template-columns: 50px 35px 1fr 45px 45px !important;
        gap: 8px !important;
    }

    .stat-label {
        font-size: 0.7rem !important;
    }

    .base-val {
        font-size: 0.7rem !important;
    }

    .actual-stat {
        font-size: 0.85rem !important;
    }

    .nav-links a {
        font-size: 1.2rem !important;
        letter-spacing: 2px;
    }

    .logo {
        font-size: 1rem !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .stat-row {
        grid-template-columns: 1fr 1fr !important;
        grid-template-areas:
            "label base"
            "slider slider"
            "ev iv";
        gap: 10px !important;
        padding-bottom: 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .stat-label {
        grid-area: label;
    }

    .base-val {
        grid-area: base;
        text-align: left !important;
    }

    .slider-wrap {
        grid-area: slider;
        height: 10px !important;
    }

    .ev-input {
        grid-area: ev;
        width: 100% !important;
    }

    .iv-input {
        grid-area: iv;
        width: 100% !important;
    }

    /* We'll hide the actual stat or reposition it */
    .actual-stat {
        position: absolute;
        right: 0;
        top: 0;
    }

    .pokemon-config {
        padding: 1.5rem !important;
    }

    .hero h1 {
        font-size: 2.5rem !important;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--primary-red);
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    z-index: 5000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--accent-glow);
}

.toast.active {
    transform: translateX(-50%) translateY(0);
}

.builds-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 8rem 2rem;
    box-sizing: border-box;
    overflow-x: hidden;
}

.search-wrapper {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 5rem;
    z-index: 100;
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 200px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.filter-select:focus {
    border-color: var(--primary-red);
    background: rgba(255, 255, 255, 0.06);
}

.filter-select option {
    background: #1a1a1a;
    color: white;
}

#build-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.2rem 2rem;
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

#build-search:focus {
    border-color: var(--primary-red);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: var(--accent-glow);
}

/* Build Card Wrapper */
.build-card-wrapper {
    cursor: pointer;
    transition: var(--transition);
}

.build-card-wrapper:hover {
    transform: translateY(-5px);
}

.build-card-wrapper.selected .pokemon-card-premium {
    border-color: var(--primary-red) !important;
    box-shadow: var(--accent-glow), 0 20px 40px rgba(0, 0, 0, 0.6) !important;
    background: rgba(255, 51, 51, 0.06) !important;
}

/* Synergy Section */
#synergy-container {
    margin-top: 5rem;
    padding-top: 5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
}

#synergy-container.appear,
#synergy-container.is-visible {
    opacity: 1;
    transform: none;
}

.synergy-header {
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

#builds-grid,
#synergy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.builds-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem 2rem;
    margin-bottom: 2rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.builds-loading__spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.builds-loading p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Premium Card Styles (Sync with Teambuilder) */
.pokemon-card-premium {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.4));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    position: relative;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: auto;
    overflow: hidden;
    min-width: 0;
}

.card-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.card-sprite-area {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.premium-sprite {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.build-card-species {
    font-size: 1rem;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.build-card-meta-row {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
}

.build-card-item {
    color: #eee;
    word-break: break-word;
}

.roles-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    max-width: 100%;
}

.role-badge {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-badge--more {
    background: rgba(255, 62, 62, 0.12);
    border-color: rgba(255, 62, 62, 0.25);
    color: var(--primary-red);
}

.format-badge {
    background: var(--primary-red);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.55rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tera-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tera-icon {
    height: 34px;
    object-fit: contain;
    vertical-align: middle;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.type-badges-row {
    display: flex;
    gap: 3px;
}

.move-pill {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 4px 8px;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 4px;
    transition: var(--transition);
    min-width: 0;
}

.move-pill > span:last-child {
    font-size: 0.68rem;
    line-height: 1.25;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.premium-sprite.mega-toggle {
    cursor: pointer;
}

.go-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 900;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(255, 62, 62, 0.35);
    background: rgba(255, 62, 62, 0.15);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: var(--transition);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.go-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.go-top-btn:hover {
    background: var(--primary-red);
    border-color: var(--primary-red);
    transform: translateY(-3px);
}

.move-pill-icons {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.move-cat-icon {
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.move-pill:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.move-pill span {
    font-size: 0.7rem;
    font-weight: 700;
    color: #eee;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.move-type-label {
    font-size: 0.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 4px;
    border-radius: 3px;
}

.stat-bar-mini {
    height: 5px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    flex: 1;
    overflow: hidden;
    margin: 0 8px;
}

.stat-fill-mini {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s ease-out;
}

@media (max-width: 1200px) {

    #builds-grid,
    #synergy-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

@media (max-width: 850px) {

    #builds-grid,
    #synergy-grid {
        grid-template-columns: 1fr !important;
    }

    .synergy-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .builds-container {
        padding: 6rem 1rem 2rem;
    }

    .search-wrapper {
        top: 4.5rem;
        padding: 0.75rem;
        border-radius: 14px;
    }

    .filter-row {
        gap: 0.6rem;
    }

    .filter-select {
        min-width: 140px;
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
    }

    #build-search {
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    #builds-grid,
    #synergy-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .pokemon-card-premium {
        padding: 12px;
    }

    .card-sprite-area {
        width: 80px;
        height: 80px;
    }

    .premium-sprite {
        width: 64px;
        height: 64px;
    }

    .synergy-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .modal-content {
        border-radius: 16px 16px 0 0;
        padding: 18px !important;
        max-height: 94vh;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 16px;
    }
}

/* Empty Slot */
.empty-slot-premium {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.01);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 400px;
    color: rgba(255, 255, 255, 0.1);
    gap: 12px;
}

/* Analysis Styles */
.type-badge {
    padding: 8px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 900;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease;
}

.type-badge:hover {
    transform: scale(1.05);
}

.type-score {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.5rem;
    opacity: 0.7;
}

/* Toggle & Shuffle Styles */
.toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    font-weight: 900;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-btn.active {
    background: var(--primary-red);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 51, 51, 0.3);
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

#shuffle-team {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 18px;
    font-size: 0.7rem;
    font-weight: 900;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

#shuffle-team:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

#shuffle-team:active {
    transform: translateY(0);
}

#rcmd-team {
    background: linear-gradient(135deg, #00b09b 0%, #96c93d 100%);
    border: none;
    padding: 10px 18px;
    font-size: 0.7rem;
    font-weight: 900;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 176, 155, 0.3);
}

#rcmd-team:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 176, 155, 0.4);
}

#rcmd-team:active {
    transform: translateY(0);
}

.shuffle-slot-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 0.75rem;
    z-index: 20;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(8px);
    opacity: 0.2;
}

.pokemon-card-premium:hover .shuffle-slot-btn {
    opacity: 1;
}

.shuffle-slot-btn:hover {
    background: var(--primary-red);
    transform: scale(1.15) rotate(180deg);
    box-shadow: 0 0 15px rgba(255, 62, 62, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.shuffle-slot-btn:active {
    transform: scale(0.95);
}

/* Added for responsive analysis grids */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}
@media (max-width: 900px) {
    .analysis-grid {
        grid-template-columns: 1fr;
    }
}

/* Team analysis type badges (shared by Builder + Builds) */
.type-badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.analysis-type-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.analysis-type-badge:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.analysis-type-badge img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.type-score-bubble {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--primary-red);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
}

.critical-weakness {
    border-color: var(--primary-red) !important;
    box-shadow: 0 0 15px rgba(255, 62, 62, 0.3), inset 0 0 10px rgba(255, 62, 62, 0.2) !important;
}

.critical-weakness img {
    filter: drop-shadow(0 0 5px var(--primary-red)) !important;
}

.synergy-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.synergy-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.synergy-icon img {
    width: 100%;
    height: 100%;
    max-width: 36px;
    max-height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.text-glow {
    text-shadow: 0 0 10px var(--glow-color);
}

.matchup-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    white-space: nowrap;
}

.matchup-chip.check {
    color: #81c784;
    border-color: rgba(76, 175, 80, 0.25);
    background: rgba(76, 175, 80, 0.08);
}

.matchup-chip.threat {
    color: #ffb74d;
    border-color: rgba(255, 152, 0, 0.25);
    background: rgba(255, 152, 0, 0.08);
}

.matchup-chip.gap {
    color: #ef5350;
    border-color: rgba(244, 67, 54, 0.25);
    background: rgba(244, 67, 54, 0.08);
}
