body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #0f0f1a, #1a1a3e);
    color: #e6e6e6;
    min-height: 100vh;
    max-width: 1920px;
    margin: 0 auto;
    position: relative;
}

/* Переключатель языка */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 6px;
    padding: 2px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.lang-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #e6e6e6;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.8rem;
    min-width: 40px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Адаптивность для переключателя языка */
@media (max-width: 768px) {
    .language-switcher {
        top: 15px;
        right: 15px;
        padding: 1px;
    }
    
    .lang-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    .language-switcher {
        top: 10px;
        right: 10px;
    }
    
    .lang-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
        min-width: 30px;
    }
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #fff;
    font-size: 2.5rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

/* Стили для поиска по ID */
.search-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(30, 30, 50, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.search-box input {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(20, 20, 40, 0.8);
    color: #fff;
    font-size: 0.9rem;
    min-width: 120px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #64b5f6;
    box-shadow: 0 0 8px rgba(100, 181, 246, 0.3);
    background: rgba(20, 20, 40, 0.9);
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-box button {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: linear-gradient(135deg, #4CAF50, #45a049) !important;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.search-box button:hover {
    background: linear-gradient(135deg, #45a049, #4CAF50) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.search-box button:last-child {
    background: linear-gradient(135deg, #f44336, #d32f2f) !important;
}

.search-box button:last-child:hover {
    background: linear-gradient(135deg, #d32f2f, #f44336) !important;
}

.sort-buttons {
    margin: 15px auto;
    text-align: center;
    background: rgba(30, 30, 50, 0.6);
    padding: 10px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 1800px;
}

.sort-buttons button {
    margin: 0;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    min-width: 80px;
    flex-shrink: 0;
}

.sort-buttons button:hover {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.sort-buttons button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Компактная панель фильтров */
.compact-filters {
    background: rgba(30, 30, 50, 0.6);
    border-radius: 8px;
    padding: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 1800px;
    margin: 0 auto;
}

.filter-row {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group.full-width {
    flex: 1;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    margin-bottom: 2px;
}

/* Обновленные стили для кнопок фантазма */
.np-type-buttons {
    display: flex;
    gap: 4px;
    justify-content: flex-start;
}

.np-type-buttons button {
    width: 32px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(30, 30, 50, 0.6) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.np-type-buttons button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
}

.np-type-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    background: rgba(40, 40, 60, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.4);
}

.np-type-buttons button.active {
    border-color: #64b5f6;
    box-shadow: 0 0 12px rgba(100, 181, 246, 0.4);
    background: rgba(100, 181, 246, 0.15) !important;
}

/* Обновленные стили для кнопок пола */
.gender-buttons {
    display: flex;
    gap: 4px;
    justify-content: flex-start;
}

.gender-buttons button {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(142, 68, 173, 0.6) !important;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 60px;
}

.gender-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    background: rgba(155, 89, 182, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.4);
}

.gender-buttons button.active {
    border-color: #9b59b6;
    box-shadow: 0 0 12px rgba(155, 89, 182, 0.4);
    background: rgba(155, 89, 182, 0.3) !important;
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Обновленные стили для классов */
.class-icons-grid {
    display: flex;
    justify-content: center;
    gap: 2px;
    flex-wrap: wrap;
    background: rgba(20, 20, 40, 0.4);
    border-radius: 6px;
    padding: 8px;
}

.class-icons-grid button {
    background: rgba(30, 30, 50, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    padding: 3px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 50px;
    max-width: 60px;
}

.class-icons-grid button img {
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Адаптивные размеры иконок классов для больших экранов */
@media (min-width: 1200px) {
    .class-icons-grid button {
        min-width: 60px;
        max-width: 70px;
        padding: 4px;
}

    .class-icons-grid button img {
        width: 28px;
        height: 28px;
    }
    
    .class-icons-grid button span {
        font-size: 0.7rem;
    }
}

@media (min-width: 1600px) {
    .class-icons-grid button {
        min-width: 70px;
        max-width: 80px;
        padding: 5px;
    }
    
    .class-icons-grid button img {
        width: 32px;
        height: 32px;
    }
    
    .class-icons-grid button span {
        font-size: 0.75rem;
    }
}

@media (min-width: 1920px) {
    .class-icons-grid button {
        min-width: 80px;
        max-width: 90px;
        padding: 6px;
}

    .class-icons-grid button img {
        width: 36px;
        height: 36px;
    }
    
    .class-icons-grid button span {
        font-size: 0.8rem;
    }
}

.class-icons-grid button span {
    font-size: 0.6rem;
    color: #ffffff;
    text-align: center;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    padding: 1px;
    width: 100%;
    word-wrap: break-word;
}

.class-icons-grid button.active {
    border-color: #FF9800;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.5);
    background-color: rgba(255, 152, 0, 0.1);
}

/* Обновленные стили для CE атрибутов */
.ce-attribute-buttons {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    background: rgba(20, 20, 40, 0.4);
    border-radius: 6px;
    padding: 8px;
}

.ce-attribute-buttons button {
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(30, 30, 50, 0.6) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ce-attribute-buttons button img {
    display: block;
    border-radius: 3px;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.ce-attribute-buttons button:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    background: rgba(40, 40, 60, 0.8) !important;
}

.ce-attribute-buttons button.active {
    border-color: #64ffda;
    box-shadow: 0 0 12px rgba(100, 255, 218, 0.4);
    background: rgba(100, 255, 218, 0.15) !important;
}

.ce-attribute-buttons button:hover::after {
    content: attr(data-i18n);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
}

/* Стили для кнопок редкости */
.rarity-buttons {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    background: rgba(20, 20, 40, 0.4);
    border-radius: 6px;
    padding: 8px;
}

.rarity-buttons button {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(30, 30, 50, 0.6) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    min-width: 40px;
    color: #ffd700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    position: relative;
}

.rarity-buttons button:hover {
    transform: scale(1.05);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.3);
    background: rgba(40, 40, 60, 0.8) !important;
}

.rarity-buttons button.active {
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.15) !important;
    color: #fff;
}

.rarity-buttons button:hover::after {
    content: attr(data-i18n);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
}

/* Черная звезда для 0 редкости */
.rarity-stars .rarity-black {
    color: #222;
    text-shadow: 0 1px 2px #fff, 0 0 4px #444;
    font-weight: bold;
}

/* Бронзовая звезда для 1-2 редкости */
.rarity-stars .rarity-bronze {
    color: #cd7f32;
    text-shadow: 0 1px 2px #222, 0 0 4px #cd7f32;
    font-weight: bold;
}

/* Серебряная звезда для 3 редкости */
.rarity-stars .rarity-silver {
    color: #bfc7ce;
    text-shadow: 0 1px 2px #222, 0 0 4px #fff;
    font-weight: bold;
}

/* Золотая звезда для 4-5 редкости */
.rarity-stars .rarity-gold {
    color: #ffd700;
    text-shadow: 0 1px 2px #222, 0 0 4px #ffd700;
    font-weight: bold;
}

.character {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    padding: 4px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.character:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.2);
}

.character img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 6px;
    object-fit: cover;
    margin-bottom: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    /* Фильтры для улучшения качества */
    filter: brightness(1.05) contrast(1.1) saturate(1.1) sharpness(0.5);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.character:hover img {
    transform: scale(1.05) translateZ(0);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
    /* Улучшенные фильтры при наведении */
    filter: brightness(1.1) contrast(1.15) saturate(1.15) sharpness(0.8);
}

.character-info {
    width: 100%;
    padding: 2px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.9));
    border-radius: 4px;
    backdrop-filter: blur(8px);
}

.character-name {
    font-weight: 600;
    margin-bottom: 0;
    font-size: 0.75rem;
    color: #fff;
    text-align: center;
    padding: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    white-space: normal;
    overflow: visible;
    line-height: 1.2;
    word-wrap: break-word;
    hyphens: auto;
}

.servant-id {
    font-weight: 500;
    margin-bottom: 2px;
    font-size: 0.65rem;
    color: #ccc;
    text-align: center;
    padding: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1.1;
}

.np-cell {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 32px !important;
}

.np-icon {
    width: 32px !important;
    height: 32px !important;
    object-fit: contain !important;
    display: block !important;
    max-width: 32px !important;
    max-height: 32px !important;
}

.character-details-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1px;
    padding: 0;
    font-size: 0.65em;
    margin-top: 0;
}

.character-detail {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    padding: 0 2px;
    border-radius: 2px;
    white-space: nowrap;
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.ce-attributes {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 2px !important;
    justify-content: center !important;
    align-items: center !important;
    background: rgba(255, 255, 255, 0.15) !important;
    padding: 2px !important;
    border-radius: 4px !important;
    margin: 2px 0 0 0 !important;
    max-width: 100% !important;
}

.ce-attributes img {
    width: 20px !important;
    height: 20px !important;
    object-fit: contain !important;
    display: block !important;
    max-width: 20px !important;
    max-height: 20px !important;
    flex-shrink: 0 !important;
}

.gender-cell {
    padding: 0 2px;
    min-width: 50px;
    font-size: 0.75em;
    font-weight: 500;
    text-align: center;
}

.gender-cell[data-gender="Female"] {
    color: #ff69b4;
    border-color: #ff69b4;
    background: rgba(255, 105, 180, 0.1);
}

.gender-cell[data-gender="Male"] {
    color: #4169e1;
    border-color: #4169e1;
    background: rgba(65, 105, 225, 0.1);
}

.gender-cell[data-gender="Unknown"] {
    color: #808080;
    border-color: #808080;
    background: rgba(128, 128, 128, 0.1);
}

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px;
    max-width: 1800px;
    margin: 0 auto;
}

.filters-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 15px 0;
}

.filters-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.active-filters span {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.reset-button {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.reset-button:hover {
    background: linear-gradient(135deg, #c0392b, #e74c3c) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.reset-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#classFilterCount {
    background-color: rgba(255, 167, 38, 0.2);
    color: #ffd95b;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

#npFilterCount {
    background-color: rgba(100, 181, 246, 0.2);
    color: #90caf9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

#ceFilterCount {
    background-color: rgba(100, 255, 218, 0.2);
    color: #a7ffeb;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

#genderFilterCount {
    background-color: rgba(155, 89, 182, 0.2);
    color: #d8b5e6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.filter-section {
    padding: 15px;
    border-radius: 12px;
    background: rgba(30, 30, 50, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 1600px) {
    .character-list {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        max-width: 1600px;
    }
}

/* Дополнительные ограничения для очень больших экранов */
@media (min-width: 1920px) {
    .character-list {
        max-width: 1600px;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (min-width: 2560px) {
    .character-list {
        max-width: 1400px;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 1200px) {
    .character-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    body {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .search-box {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }
    
    .search-box input {
        min-width: 100px;
        font-size: 0.8rem;
    }
    
    .search-box button {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .character {
        padding: 3px;
    }
    
    .character img {
        margin-bottom: 1px;
    }
    
    .character-info {
        padding: 1px;
    }
    
    .np-icon {
        width: 28px !important;
        height: 28px !important;
        max-width: 28px !important;
        max-height: 28px !important;
    }
    
    .character-name {
        font-size: 0.7rem;
    }
    
    .servant-id {
        font-size: 0.6rem;
    }
    
    .character-details-container {
        font-size: 0.6em;
        gap: 1px;
    }
    
    .character-detail {
        padding: 0 1px;
    }
    
    .ce-attributes img {
        width: 18px !important;
        height: 18px !important;
        max-width: 18px !important;
        max-height: 18px !important;
    }
    
    .gender-cell {
        min-width: 45px;
        font-size: 0.7em;
    }
    
    .character-list {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    
    body {
        padding: 10px;
    }
    
    .np-type-buttons {
        flex-wrap: wrap;
    }
    
    .ce-attribute-buttons {
        gap: 10px;
    }
    
    .class-icons-grid {
        padding: 10px;
        gap: 0.3%;
    }
    
    .class-icons-grid button {
        padding: 3px;
    }
    
    .class-icons-grid button img {
        width: min(28px, 100%);
        height: min(28px, 100%);
    }

    .sort-buttons {
        padding: 8px;
        gap: 4px;
    }
    
    .sort-buttons button {
        padding: 5px 10px;
        font-size: 0.7rem;
        min-width: 70px;
    }
}

@media (max-width: 480px) {
    .search-box {
        padding: 8px;
        gap: 6px;
    }
    
    .search-box input {
        min-width: 80px;
        font-size: 0.75rem;
        padding: 6px 8px;
    }
    
    .search-box button {
        padding: 5px 10px;
        font-size: 0.7rem;
    }
    
    .character {
        padding: 2px;
    }
    
    .character img {
        margin-bottom: 1px;
    }
    
    .character-info {
        padding: 1px;
    }
    
    .np-icon {
        width: 24px !important;
        height: 24px !important;
        max-width: 24px !important;
        max-height: 24px !important;
    }
    
    .character-name {
        font-size: 0.65rem;
    }
    
    .servant-id {
        font-size: 0.55rem;
    }
    
    .character-details-container {
        font-size: 0.55em;
    }
    
    .ce-attributes img {
        width: 16px !important;
        height: 16px !important;
        max-width: 16px !important;
        max-height: 16px !important;
    }
    
    .gender-cell {
        min-width: 40px;
        font-size: 0.65em;
    }
    
    .character-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .character {
        padding: 8px;
    }
    
    .character-name {
        font-size: 0.85rem;
    }
    
    .character-details-container {
        font-size: 0.75rem;
    }

    .sort-buttons {
        padding: 6px;
        gap: 3px;
    }
    
    .sort-buttons button {
        padding: 4px 8px;
        font-size: 0.65rem;
        min-width: 60px;
    }

    .compact-filters {
        padding: 8px;
    }
    
    .filter-row {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .filter-label {
        font-size: 0.75rem;
    }
    
    .np-type-buttons button {
        width: 24px;
        height: 18px;
    }
    
    .gender-buttons button {
        padding: 2px 4px;
        font-size: 0.6rem;
        min-width: 40px;
    }
    
    .class-icons-grid {
        padding: 4px;
    }
    
    .class-icons-grid button {
        min-width: 40px;
        max-width: 50px;
    }
    
    .class-icons-grid button img {
        width: 16px;
        height: 16px;
    }
    
    .class-icons-grid button span {
        font-size: 0.5rem;
    }
    
    .ce-attribute-buttons {
        padding: 4px;
    }
    
    .ce-attribute-buttons button img {
        width: 28px;
        height: 28px;
    }
    
    .rarity-buttons {
        padding: 4px;
        gap: 2px;
    }
    
    .rarity-buttons button {
        padding: 3px 5px;
        font-size: 0.75rem;
        min-width: 30px;
    }
}

/* ===== МОБИЛЬНАЯ ОПТИМИЗАЦИЯ ===== */

/* Индикатор загрузки */
#mobile-loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 15px;
    z-index: 10000;
    display: none;
    backdrop-filter: blur(10px);
}

.loading-bar {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.loading-text {
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}

/* Lazy loading стили */
.lazy-loading {
    opacity: 0.7;
    transition: opacity 0.3s ease;
    background: #f0f0f0;
    border-radius: 8px;
}

.loaded {
    opacity: 1;
}

.error {
    opacity: 0.5;
    background: #ffebee;
}

/* Мобильная оптимизация */
.mobile-layout {
    font-size: 14px;
    padding: 10px;
}

.mobile-layout .character {
    margin: 8px;
}

.mobile-layout .character img {
    width: 80px;
    height: 120px;
}

/* Оптимизация для медленных соединений */
.slow-connection {
    image-rendering: pixelated;
}

.slow-connection .character img {
    image-rendering: optimizeSpeed;
}

/* Оптимизация производительности */
.character.visible {
    will-change: transform;
}

/* Улучшенная прокрутка */
.character-list {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Оптимизация для устройств с высоким DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .character img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Оптимизация для устройств с ограниченной памятью */
@media (max-width: 768px) {
    .character {
        contain: layout style paint;
    }
    
    .character img {
        contain: layout style paint;
    }
}

/* Анимации только при предпочтении пользователя */
@media (prefers-reduced-motion: reduce) {
    .character {
        transition: none;
    }
    
    .character img {
        transition: none;
    }
    
    .loading-progress {
        transition: none;
    }
}
