:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --shadow: rgba(0, 0, 0, 0.5);
    --modal-overlay: rgba(0, 0, 0, 0.7);

    font-size: 16px;
}

[data-theme="light"] {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #212529;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --primary: #4361ee;
    --primary-hover: #3f37c9;
    --shadow: rgba(0, 0, 0, 0.08);
    --modal-overlay: rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}



.control-btn,
.lang-selector select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:hover,
.lang-selector select:hover {
    background: var(--border);
}

.control-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.control-btn.primary:hover {
    background: var(--primary-hover);
}

.control-btn.active {
    background: #332701;
    border-color: #ffc107;
    color: #ffc107;
}

[data-theme="light"] .control-btn.active {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.4);
}

.icon-moon {
    display: inline-block;
}

.icon-sun {
    display: none;
}

[data-theme="light"] .icon-moon {
    display: none;
}

[data-theme="light"] .icon-sun {
    display: inline-block;
}

.lang-selector {
    margin: 0;
}

.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 2rem 2rem 0 2rem;
}

.grid-scroll-wrapper {
    flex: 1;
    border-radius: 12px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.02);
    padding: 10px;
    background: var(--bg);
    display: flex;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

.main-container {
    padding: 0 2rem;
    max-width: 1200px;
    margin: 50px auto 0 auto;
    width: 100%;
}

.faq-accordion {
    margin: 2rem 0 3rem 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow);
}

.accordion-btn {
    width: 100%;
    background: var(--surface);
    border: none;
    padding: 1.2rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-btn:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .accordion-btn:hover {
    background: rgba(255, 255, 255, 0.02);
}

.accordion-icon {
    font-size: 0.9rem;
    transition: transform 0.3s;
}

.accordion-btn.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding: 0 1.5rem;
    color: var(--text-muted);
}

.accordion-content.open {
    max-height: 3000px;
    padding: 0 1.5rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border);
}

.accordion-content h1 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.accordion-content h2 {
    color: var(--text);
    font-size: 1.3rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.guide-steps {
    line-height: 1.6;
    font-size: 1rem;
}

.guide-steps ol {
    padding-left: 1.5rem;
    margin-top: 0;
}

.guide-steps li {
    margin-bottom: 0.5rem;
}

.pokemon-grid {
    display: grid;
    grid-template-columns: 80px repeat(21, 110px);
    grid-auto-rows: 110px;
    gap: 12px;
    width: max-content;
    min-height: 100%;
    padding-right: 20px;
    padding-bottom: 20px;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

.grid-header-row,
.grid-row {
    display: contents;
}

.grid-col-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px var(--shadow);
    padding: 0 5px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 5;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid-col-header span {
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-col-header img.type-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 6px;
    opacity: 0.7;
    filter: brightness(0.8);
}

[data-theme="dark"] .grid-col-header img.type-icon {
    filter: invert(1) brightness(0.9);
}

.grid-row-header {
    background: var(--primary);
    color: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    box-shadow: 4px 0 6px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: sticky;
    left: 0;
    padding: 5px;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.region-kanto {
    background: linear-gradient(135deg, #16a085, #2980b9, #c0392b);
}

.region-johto {
    background: linear-gradient(135deg, #d35400, #8e44ad);
}

.region-hoenn {
    background: linear-gradient(135deg, #c0392b, #2980b9, #27ae60);
}

.region-sinnoh {
    background: linear-gradient(135deg, #2c3e50, #3498db, #bdc3c7);
}

.region-unova {
    background: linear-gradient(135deg, #2c3e50, #000000, #ecf0f1);
    color: #ecf0f1;
}

.region-kalos {
    background: linear-gradient(135deg, #8e44ad, #e74c3c, #3498db);
}

.region-alola {
    background: linear-gradient(135deg, #f1c40f, #e67e22, #1abc9c);
}

.region-galar {
    background: linear-gradient(135deg, #1f2739, #b33939, #341f97);
}

.region-paldea {
    background: linear-gradient(135deg, #e15f41, #786fa6, #f3a683);
}
.region-forms {
    background: linear-gradient(135deg, #ff9f43, #ee5253, #5f27cd);
}

.gen-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.9;
    line-height: 1;
    margin-bottom: 2px;
}

.gen-number {
    font-size: 1.5rem;
    line-height: 1;
}

.region-badge {
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.grid-corner {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 10;
    background: var(--bg);
}

.grid-cell {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid-cell:hover {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 10px 20px var(--shadow), 0 0 15px var(--primary);
    z-index: 2;
}

.grid-cell .cell-content {
    font-size: 2rem;
    color: var(--border);
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.type-watermark {
    position: absolute;
    width: 65%;
    height: 65%;
    object-fit: contain;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .type-watermark {
    opacity: 0.15;
    filter: invert(1);
}

.grid-cell:hover .type-watermark {
    opacity: 0.25;
    transform: scale(1.1);
}

.grid-cell.filled {
    border-style: solid;
    border-width: 1px;
}

.grid-cell img.pokemon-img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    z-index: 2;
    animation: popIn 0.3s ease-out forwards;
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cell-name {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.65rem;
    text-align: center;
    padding: 3px 0;
    text-transform: capitalize;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.2s;
}

.grid-cell:hover .cell-name {
    opacity: 1;
}

.ultra-header {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    border: 1px double #ff9800;
}

.ultra-header span {
    color: #000;
    font-weight: 800;
}

[data-theme="dark"] .ultra-header {
    background: linear-gradient(135deg, #b8860b 0%, #d2691e 100%);
    border-color: #d2691e;
}

[data-theme="dark"] .ultra-header span {
    color: #fff;
}

.grid-cell.ultra-cell {
    border: 2px dashed #ff9800;
    background: rgba(255, 152, 0, 0.05);
}

.grid-cell.ultra-cell:hover {
    border-color: #f57c00;
    box-shadow: 0 8px 16px rgba(255, 152, 0, 0.2);
}

.grid-cell.ultra-cell.filled {
    border-style: solid;
    border-color: #ff9800;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.15), rgba(255, 193, 7, 0.15));
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-content.large {
    max-width: 800px;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.picker-subtitle {
    margin-top: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.search-bar {
    display: flex;
    position: relative;
    margin-bottom: 1.5rem;
}

.search-bar input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
}

.search-bar input:valid+.clear-btn {
    display: block;
}


.pokemon-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding: 10px 5px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.poke-option {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.poke-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow);
    border-color: var(--primary);
}

.poke-option img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 8px;
}

.poke-option span {
    font-size: 0.75rem;
    text-transform: capitalize;
    font-weight: 600;
    text-align: center;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.main-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1.5rem 2rem;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-left p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-right {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-right a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-right a:hover {
    color: var(--primary);
}

.footer-disclaimer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer-disclaimer p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.footer-disclaimer strong {
    color: var(--text);
    font-weight: 500;
}

.special-sections-container {
    padding: 2rem 0 0;
}

.special-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-top: 2rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.special-cells {
    display: grid;
    grid-template-columns: repeat(3, 110px);
    gap: 12px;
}

.team-cells {
    grid-template-columns: repeat(6, 110px);
}

.special-slot,
.team-slot {
    height: 110px;
    width: 110px;
    background: var(--surface);
    border: 2px dashed var(--border);
    position: relative;
    border-radius: 12px;
}

.cell-label {
    position: absolute;
    top: 5px;
    left: 0;
    width: 100%;
    font-size: 0.65rem;
    text-align: center;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    pointer-events: none;
    z-index: 1;
    padding: 0 4px;
    line-height: 1.1;
}

.team-group .cell-label {
    top: auto;
    bottom: 5px;
}

@media (max-width: 1100px) {
    .special-grid {
        grid-template-columns: 1fr;
    }

    .special-cells,
    .team-cells {
        grid-template-columns: repeat(auto-fill, 110px);
        justify-content: center;
    }
}


@media (max-width: 768px) {
    .main-content {
        padding: 1rem 5px 0 5px;
    }

    .grid-scroll-wrapper {
        padding: 5px;
    }

    .main-container,
    .footer-container {
        padding-left: 5px;
        padding-right: 5px;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .grid-row-header,
    .grid-corner {
        position: static;
        z-index: 1;
    }
}

.print-watermark {
    display: none;
}

@media print {

    .no-print,
    .main-header,
    .main-container,
    .main-footer,
    .modal,
    .modal-overlay {
        display: none !important;
    }

    @page {
        size: A4 landscape;
        margin: 20px;
    }

    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        height: auto !important;
        width: 100% !important;
        overflow: visible !important;
        display: block !important;
    }

    .grid-scroll-wrapper {
        box-shadow: none !important;
        overflow: visible !important;
        padding: 0 !important;
        background: none !important;
        width: 100% !important;
        display: block !important;
    }

    .pokemon-grid {
        gap: 2px !important;
        width: 100% !important;
        max-width: 100% !important;
        grid-template-columns: 1.5fr repeat(21, 1fr) !important;
        grid-auto-rows: auto !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    .grid-row-header {
        padding: 2px !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .gen-text {
        display: none !important;
    }

    .gen-number {
        font-size: 1.6vw !important;
        margin-top: 2px !important;
    }

    .region-badge {
        font-size: 0.75vw !important;
        padding: 1px 3px !important;
    }

    .grid-col-header {
        padding: 2px 1px !important;
        min-height: auto !important;
        justify-content: center !important;
    }

    .grid-col-header img.type-icon {
        width: 1.8vw !important;
        height: 1.8vw !important;
        margin-bottom: 2px !important;
        display: block !important;
    }

    .grid-col-header span {
        font-size: 0.8vw !important;
        -webkit-line-clamp: 1 !important;
        line-clamp: 1 !important;
    }

    .grid-cell {
        border-width: 1px !important;
        border-radius: 4px !important;
        aspect-ratio: 1 / 1 !important;
        padding: 0 !important;
    }

    .grid-cell .cell-content {
        font-size: 1.5vw !important;
    }

    .cell-name {
        display: none !important;
    }

    .print-watermark {
        display: block !important;
        text-align: center;
        width: 100%;
        margin-top: 15px;
        font-size: 1.2vw !important;
        color: #666 !important;
        font-weight: 700;
        letter-spacing: 1px;
    }
}