/*
 * Страница сравнения героев (/compare, /compare/h/...).
 * Тёмная тема — основная; переопределения для светлой — в theme-light.css.
 */

#body section article:has(.ep_cmp) {
    border: 1px solid var(--ep-line);
    background: linear-gradient(180deg, rgba(16, 33, 66, .88) 0%, rgba(10, 22, 46, .92) 100%);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: var(--ep-text-inv);
}

.ep_cmp {
    --cmp-surface:    rgba(7, 16, 36, .52);
    --cmp-row-hover:  rgba(59, 130, 246, .10);
    --cmp-head-bg:    rgba(7, 16, 36, .75);
    --cmp-line:       rgba(126, 162, 230, .18);
    --cmp-muted:      var(--ep-muted-inv);
    --cmp-best:       #34d399;
    --cmp-best-bg:    rgba(52, 211, 153, .14);
    --cmp-bar-bg:     rgba(255, 255, 255, .09);
}

/* Шапка и панель управления ================================================ */

.ep_cmp_head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 18px;
    margin-bottom: 18px;
}

.ep_cmp_title_row {
    display: flex;
    align-items: center;
    gap: 10px;
}
#body section article:has(.ep_cmp) .ep_cmp_title_row h1 {
    margin: 0;
    color: #fff;
}
.ep_cmp_count {
    padding: 3px 10px;
    border: 1px solid var(--cmp-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    color: var(--cmp-muted);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ep_cmp_controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.ep_cmp_add {
    position: relative;
    width: 240px;
}
.ep_cmp_add .select2-container--default .select2-selection--single {
    height: 36px;
    border: 1px solid var(--cmp-line);
    border-radius: 8px;
    background: var(--cmp-surface);
    transition: border-color .15s, background-color .15s;
}
.ep_cmp_add .select2-container--default .select2-selection--single:hover,
.ep_cmp_add .select2-container--open .select2-selection--single {
    border-color: var(--ep-sky);
}
.ep_cmp_add .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 12px;
    line-height: 34px;
    color: #e8eefc;
    font-size: 14px;
}
.ep_cmp_add .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--cmp-muted); }
.ep_cmp_add .select2-container--default .select2-selection--single .select2-selection__arrow { height: 34px; }
.ep_cmp_add .select2-container--default .select2-selection--single .select2-selection__arrow b { border-top-color: #9fb0cf; }
.ep_cmp_add .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b { border-bottom-color: #9fb0cf; }
.ep_cmp_add .select2-dropdown {
    z-index: 600;
    overflow: hidden;
    border: 1px solid var(--ep-sky);
    border-radius: 8px;
    background: #0f1f3d;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
    font-size: 14px;
}
.ep_cmp_add .select2-dropdown .select2-search--dropdown { padding: 8px; }
.ep_cmp_add .select2-dropdown .select2-search--dropdown .select2-search__field {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--cmp-line);
    border-radius: 6px;
    outline: none;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 14px;
}
.ep_cmp_add .select2-dropdown .select2-results > .select2-results__options { max-height: 280px; }
.ep_cmp_add .select2-dropdown .select2-results__option { padding: 7px 12px; color: #cfd9ee; }
.ep_cmp_add .select2-dropdown .select2-results__option--highlighted[aria-selected] { background: var(--ep-accent); color: #fff; }
.ep_cmp_add .select2-dropdown .select2-results__option--highlighted .ep_s2_name { color: #fff; }
.ep_cmp_add .select2-dropdown .select2-results__option--highlighted .ep_s2_stars { color: #fde68a; }

.ep_cmp_limit {
    color: var(--cmp-muted);
    font-size: 13px;
}

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

.ep_cmp_btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--cmp-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: #dbe7ff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}
.ep_cmp_btn:hover { border-color: var(--ep-sky); background: rgba(59, 130, 246, .16); color: #fff; text-decoration: none; }
.ep_cmp_btn.is-done { border-color: var(--cmp-best); color: var(--cmp-best); }
.ep_cmp_btn--danger:hover { border-color: #f87171; background: rgba(239, 68, 68, .18); color: #fecaca; }
.ep_cmp_btn--primary { border-color: var(--ep-accent); background: var(--ep-accent); color: #fff; }
.ep_cmp_btn--primary:hover { border-color: var(--ep-accent-hi); background: var(--ep-accent-hi); color: #fff; }

/* Пустое состояние ========================================================= */

.ep_cmp_empty {
    padding: 44px 20px;
    border: 1px dashed var(--cmp-line);
    border-radius: 12px;
    background: var(--cmp-surface);
    text-align: center;
}
.ep_cmp_empty_ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: rgba(59, 130, 246, .14);
    color: var(--ep-sky);
}
.ep_cmp_empty h2 { margin: 0 0 8px; font-size: 20px; color: #fff; }
.ep_cmp_empty p  { max-width: 460px; margin: 0 auto 20px; color: var(--cmp-muted); font-size: 14px; line-height: 1.5; }

/* Таблица сравнения ======================================================== */

.ep_cmp_table_wrap {
    overflow-x: auto;
    border: 1px solid var(--cmp-line);
    border-radius: 12px;
    background: var(--cmp-surface);
    -webkit-overflow-scrolling: touch;
}

.ep_cmp_table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.35;
}

.ep_cmp_table thead th {
    padding: 12px 12px;
    border-bottom: 1px solid var(--cmp-line);
    background: var(--cmp-head-bg);
    color: var(--cmp-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
    user-select: none;
}
.ep_cmp_table thead th.ep_cmp_col_num,
.ep_cmp_table thead th.ep_cmp_col_stat { text-align: right; }
.ep_cmp_table thead th.is-sortable { cursor: pointer; transition: color .15s; }
.ep_cmp_table thead th.is-sortable:hover { color: #fff; }
.ep_cmp_table thead th.is-sortable::after {
    content: '⇅';
    margin-left: 5px;
    opacity: .35;
    font-size: 11px;
}
.ep_cmp_table thead th.is-asc::after  { content: '▲'; opacity: 1; color: var(--ep-sky); }
.ep_cmp_table thead th.is-desc::after { content: '▼'; opacity: 1; color: var(--ep-sky); }

.ep_cmp_th_ico {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    vertical-align: middle;
}
.ep_cmp_th_ico img { display: block; flex: 0 0 auto; }

.ep_cmp_table tbody tr {
    --e: #a052e6;
    border-bottom: 1px solid var(--cmp-line);
    transition: background-color .12s;
}
.ep_cmp_table tbody tr:last-child { border-bottom: 0; }
.ep_cmp_table tbody tr:hover { background: var(--cmp-row-hover); }

.ep_cmp_row--red    { --e: #e0352b; }
.ep_cmp_row--yellow { --e: #f0a52a; }
.ep_cmp_row--purple { --e: #a052e6; }
.ep_cmp_row--green  { --e: #3cb043; }
.ep_cmp_row--blue   { --e: #2f8be6; }

.ep_cmp_table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
}

/* Ячейка героя */
.ep_cmp_hero_link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}
.ep_cmp_hero_link:hover b { color: var(--ep-sky); }
.ep_cmp_avatar {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 2px solid var(--e);
    border-radius: 10px;
    overflow: hidden;
    background: #0a1428;
    box-shadow: 0 0 10px -3px var(--e);
}
.ep_cmp_avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.ep_cmp_hero_meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 130px;
}
.ep_cmp_hero_meta b {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
}
.ep_cmp_hero_meta small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--cmp-muted);
    font-size: 12px;
}
.ep_cmp_hero_meta small img { display: block; flex: 0 0 auto; }

/* Звёзды, класс, скорость */
.ep_cmp_cell_stars { text-align: right; white-space: nowrap; }
.ep_cmp_stars { color: #fbbf24; font-size: 13px; letter-spacing: 1px; }

.ep_cmp_cls {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.ep_cmp_cls img { display: block; flex: 0 0 auto; }
.ep_cmp_cell_speed { white-space: nowrap; }
.ep_cmp_muted { color: var(--cmp-muted); }

/* Статы с барами и выделением лидера */
.ep_cmp_cell_stat {
    min-width: 96px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.ep_cmp_stat_val {
    font-size: 15px;
    font-weight: 600;
    color: #e8eefc;
}
.ep_cmp_cell_stat.is-best .ep_cmp_stat_val {
    color: var(--cmp-best);
    font-weight: 700;
}
.ep_cmp_bar {
    height: 4px;
    margin-top: 5px;
    border-radius: 999px;
    background: var(--cmp-bar-bg);
    overflow: hidden;
}
.ep_cmp_bar i {
    display: block;
    height: 100%;
    margin-left: auto;
    border-radius: 999px;
    background: rgba(96, 165, 250, .7);
}
.ep_cmp_stat--att .ep_cmp_bar i   { background: #f87171; }
.ep_cmp_stat--def .ep_cmp_bar i   { background: #60a5fa; }
.ep_cmp_stat--hea .ep_cmp_bar i   { background: #4ade80; }
.ep_cmp_stat--power .ep_cmp_bar i { background: #fbbf24; }
.ep_cmp_cell_stat.is-best { background: var(--cmp-best-bg); }

/* Кнопка удаления строки */
.ep_cmp_cell_act { width: 40px; text-align: center; }
.ep_cmp_del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--cmp-muted);
    font-size: 13px;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}
.ep_cmp_del:hover { border-color: rgba(248, 113, 113, .45); background: rgba(239, 68, 68, .18); color: #fecaca; }

/* Сравнение особых навыков ================================================= */

.ep_cmp_skills { margin-top: 24px; }
.ep_cmp_sub_title {
    margin: 0 0 14px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}
.ep_cmp_skill_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.ep_cmp_skill_card {
    --e: #a052e6;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--cmp-line);
    border-top: 3px solid var(--e);
    border-radius: 12px;
    background: var(--cmp-surface);
}
.ep_cmp_skill_head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.ep_cmp_skill_ico {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 1px solid color-mix(in srgb, var(--e) 55%, transparent);
    border-radius: 10px;
    overflow: hidden;
    background: #0a1428;
}
.ep_cmp_skill_ico img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ep_cmp_skill_meta { min-width: 0; flex: 1 1 auto; }
.ep_cmp_skill_hero {
    display: block;
    color: var(--cmp-muted);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
}
.ep_cmp_skill_hero:hover { color: var(--ep-sky); }
.ep_cmp_skill_name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}
.ep_cmp_skill_tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}
.ep_cmp_skill_tags span {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    color: #cbd6ea;
    font-size: 11px;
}
.ep_cmp_skill_desc {
    color: #d6e1f5;
    font-size: 13px;
    line-height: 1.5;
}
.ep_cmp_skill_desc p { margin: 0 0 6px; }
.ep_cmp_skill_desc p:last-child { margin-bottom: 0; }
.ep_cmp_skill_desc ul { margin: 0; padding-left: 18px; }
.ep_cmp_skill_desc li { margin-bottom: 3px; }

@media screen and (max-width: 720px) {
    .ep_cmp_controls { width: 100%; margin-left: 0; }
    .ep_cmp_add { flex: 1 1 200px; width: auto; }
}
