#top-authors-btn[hidden], #top-authors-view[hidden],
#top-authors-view [hidden] { display: none !important; }
body.top-authors-open #app-container > .main-content > :not(#top-authors-view) { display: none !important; }
#top-authors-view {
    flex: 0 0 auto;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 24px 28px;
    box-sizing: border-box;
}
html.desktop-browser #top-authors-view {
    max-width: none;
    margin-left: 0;
    margin-right: auto;
    container-type: inline-size;
}
.top-author-entry { display: contents; }
.top-author-carousel { display: none; }
html.desktop-browser .top-author-entry { display: block; max-width: 984px; }
/* Сохраняем ширину рейтинга, лента занимает свободное место справа. */
@container (min-width: 1132px) {
    html.desktop-browser .top-author-entry {
        display: grid;
        grid-template-columns: 984px minmax(0, 1fr);
        align-items: center;
        gap: 16px;
        max-width: none;
    }
    html.desktop-browser .top-author-strip {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        min-width: 0;
        height: 88px;
        padding-bottom: 6px;
        box-sizing: border-box;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        user-select: none;
        cursor: grab;
    }
    html.desktop-browser .top-author-carousel {
        position: relative;
        display: block;
        min-width: 0;
        height: 88px;
    }
}
.top-author-strip::-webkit-scrollbar { display: none; }
.top-author-strip-nav {
    position: absolute;
    top: 41px;
    transform: translateY(-50%);
    z-index: 2;
    display: grid;
    place-items: center;
    width: 28px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(var(--fg-rgb), .3);
    border-radius: 8px;
    background: rgba(var(--bg-secondary-rgb), .94);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
    cursor: pointer;
}
.top-author-strip-prev { left: 4px; }
.top-author-strip-next { right: 4px; }
.top-author-strip-nav:hover { background: var(--bg-secondary); border-color: var(--text-secondary); }
.top-author-strip-nav:focus-visible { outline: 2px solid var(--text-secondary); outline-offset: 2px; }
.top-author-strip.is-dragging, .top-author-strip.is-dragging .top-author-character { cursor: grabbing; }
.top-author-character {
    position: relative;
    flex: 0 0 58px;
    width: 58px;
    height: 82px;
    padding: 0;
    border: 1px solid rgba(var(--fg-rgb), .16);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}
.top-author-character:hover { border-color: rgba(var(--fg-rgb), .6); }
.top-author-character:focus-visible { outline: 2px solid var(--text-secondary); outline-offset: -3px; }
.top-author-character img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.top-author-character-initial { font-size: 22px; }
.top-author-character-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 4px 5px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .8));
    color: #fff;
    font-size: 10px;
    line-height: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}
.top-author-strip-retry {
    align-self: center;
    padding: 7px 10px;
    border: 1px solid rgba(var(--fg-rgb), .2);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.top-authors-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.top-authors-heading h2 { margin: 0; font-size: 22px; line-height: 1.3; }
#top-authors-back { flex: 0 0 36px; width: 36px; height: 36px; padding: 0; display: grid; place-items: center; }
.top-authors-periods {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid rgba(var(--fg-rgb), .12);
    border-radius: 12px;
    background: rgba(var(--fg-rgb), .03);
}
.top-authors-periods button {
    padding: 9px 18px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.top-authors-periods button[aria-pressed="true"] { color: var(--text-primary); background: rgba(var(--fg-rgb), .1); }
#top-authors-btn[aria-current="page"] { background: rgba(var(--fg-rgb), .08); }
.top-authors-list { display: flex; flex-direction: column; gap: 10px; }
.top-author-row {
    display: grid;
    grid-template-columns: 32px 56px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 88px;
    padding: 15px 18px;
    border: 1px solid rgba(var(--fg-rgb), .12);
    border-radius: 16px;
    background: rgba(var(--bg-secondary-rgb), .75);
    color: var(--text-primary);
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.top-author-row:hover { border-color: rgba(var(--fg-rgb), .3); background: var(--bg-secondary); }
.top-author-row[data-rank="1"] { --top-author-medal-rgb: 191, 156, 83; --top-author-medal-hover-rgb: 198, 166, 102; }
.top-author-row[data-rank="2"] { --top-author-medal-rgb: 157, 169, 184; --top-author-medal-hover-rgb: 168, 178, 192; }
.top-author-row[data-rank="3"] { --top-author-medal-rgb: 166, 115, 82; --top-author-medal-hover-rgb: 176, 130, 101; }
.top-author-row.top-author-row--podium {
    --top-author-medal-fill: rgb(var(--top-author-medal-rgb));
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-color: rgb(var(--top-author-medal-rgb));
}
.top-author-capsule {
    grid-column: 2;
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: inherit;
    align-items: center;
    align-self: center;
    justify-self: start;
    width: max-content;
    max-width: 100%;
    box-sizing: border-box;
    padding-right: 28px;
}
.top-author-row--podium {
    grid-template-columns: 32px minmax(0, 1fr) 48px 18px;
}
.top-author-surface { display: contents; gap: inherit; }
.top-author-surface > .top-author-arrow { grid-column: 4; grid-row: 1; }
.top-author-prize {
    grid-column: 3;
    grid-row: 1;
    display: block;
    width: 100%;
    height: 56px;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
}
/* Ширину задают счётчики; длинное имя сокращается в одну строку. */
.top-author-capsule .top-author-name {
    width: 0;
    min-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-author-capsule::before,
.top-author-frame {
    position: absolute;
    /* Стадион огибает аватарку слева и замыкается после счётчиков справа. */
    inset: -6px;
    border-radius: 9999px;
    pointer-events: none;
}
.top-author-capsule::before {
    content: "";
    /* Снаружи цвет медали; внутри общий фон .top-author-row, включая наведение. */
    box-shadow: 0 0 0 1100px var(--top-author-medal-fill);
    z-index: -1;
    transition: box-shadow .15s;
}
.top-author-frame { z-index: 1; }
.top-author-frame > svg {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.top-author-row.top-author-row--podium:hover {
    --top-author-medal-fill: rgb(var(--top-author-medal-hover-rgb));
    border-color: rgb(var(--top-author-medal-rgb));
}
.top-author-row:focus-visible, .top-authors-periods button:focus-visible {
    outline: 2px solid var(--text-secondary);
    outline-offset: 3px;
}
.top-author-rank { text-align: center; font-size: 17px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.top-author-row.top-author-row--podium .top-author-rank,
.top-author-row.top-author-row--podium .top-author-arrow { color: #17120e; }
.top-author-avatar {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(var(--fg-rgb), .08);
    font-size: 22px;
    font-weight: 600;
    position: relative;
}
.top-author-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.top-author-avatar-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}
.top-author-info { min-width: 0; }
.top-author-name { display: block; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.top-author-metrics { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 5px; }
.top-author-count { display: inline-flex; align-items: center; gap: 5px; color: var(--text-secondary); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.top-author-count svg { flex: 0 0 16px; }
.top-author-count-unit { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.top-author-arrow { color: var(--text-secondary); }
#top-authors-status { padding: 32px 0; color: var(--text-secondary); text-align: center; }
#top-authors-more, #top-authors-retry { display: block; margin: 20px auto 0; }
/* Только компьютерный сайт: фигурки поверх строк, от золота слева к бронзе справа. */
html.desktop-browser .top-author-row--podium {
    --top-author-prize-height: 136px;
    --top-author-prize-width: 90px;
    --top-author-prize-step: 110px;
    --top-author-prize-offset: 0;
    display: block;
    padding: 0;
    overflow: visible;
}
html.desktop-browser .top-author-row--podium[data-rank="1"] { --top-author-prize-offset: 2; }
html.desktop-browser .top-author-row--podium[data-rank="2"] { --top-author-prize-offset: 1; }
html.desktop-browser .top-author-surface {
    display: grid;
    grid-template-columns: inherit;
    gap: inherit;
    align-items: center;
    min-height: 86px;
    padding: 15px 18px;
    box-sizing: border-box;
    border-radius: inherit;
    isolation: isolate;
    overflow: hidden;
}
html.desktop-browser .top-author-prize {
    position: absolute;
    right: calc(40px + var(--top-author-prize-offset) * var(--top-author-prize-step));
    bottom: 10px;
    width: var(--top-author-prize-width);
    height: var(--top-author-prize-height);
    z-index: 2;
    pointer-events: auto;
}
html.desktop-browser .top-author-row--podium[data-rank="2"] .top-author-prize {
    transform: scale(.9);
    transform-origin: center bottom;
}
@media (max-width: 1199px) {
    html.desktop-browser .top-author-row--podium {
        --top-author-prize-height: 112px;
        --top-author-prize-width: 76px;
        --top-author-prize-step: 92px;
    }
}
/* На небольших экранах сохраняем ступеньку, оставляя место для счётчиков. */
@media (max-width: 1023px) {
    .top-author-row--podium {
        --top-author-prize-height: 104px;
        --top-author-prize-width: 64px;
        --top-author-prize-step: 20px;
        --top-author-prize-offset: 0;
        grid-template-columns: 32px minmax(0, 1fr) calc(var(--top-author-prize-width) + var(--top-author-prize-offset) * var(--top-author-prize-step)) 18px;
        display: block;
    }
    .top-author-row.top-author-row--podium { padding: 0; overflow: visible; }
    .top-author-row--podium[data-rank="1"] { --top-author-prize-offset: 2; }
    .top-author-row--podium[data-rank="2"] { --top-author-prize-offset: 1; }
    .top-author-surface {
        display: grid;
        grid-template-columns: inherit;
        align-items: center;
        min-height: 86px;
        padding: 15px 18px;
        box-sizing: border-box;
        border-radius: inherit;
        isolation: isolate;
        overflow: hidden;
    }
    .top-author-row--podium .top-author-prize {
        position: absolute;
        right: calc(52px + var(--top-author-prize-offset) * var(--top-author-prize-step));
        bottom: 6px;
        width: var(--top-author-prize-width);
        height: var(--top-author-prize-height);
        z-index: 2;
        pointer-events: auto;
    }
    .top-author-row--podium[data-rank="2"] .top-author-prize {
        transform: translateX(6px) scale(.9);
        transform-origin: center bottom;
    }
    .top-author-row--podium[data-rank="3"] .top-author-prize { transform: translateX(6px); }
}
@media (max-width: 600px) {
    #top-authors-view { padding: 16px 12px; }
    .top-authors-heading h2 { font-size: 20px; }
    .top-authors-periods { display: flex; }
    .top-authors-periods button { flex: 1; padding-inline: 10px; }
    .top-author-row { grid-template-columns: 25px 46px minmax(0, 1fr) 16px; gap: 10px; padding: 12px; min-height: 76px; border-radius: 14px; }
    .top-author-capsule { padding-right: 23px; }
    .top-author-capsule::before,
    .top-author-frame { inset: -5px; }
    .top-author-avatar { width: 46px; height: 46px; font-size: 19px; }
    .top-author-name { font-size: 15px; }
    .top-author-rank { font-size: 15px; }
    .top-author-metrics { column-gap: 10px; }
    .top-author-row--podium {
        --top-author-prize-height: 88px;
        --top-author-prize-width: 56px;
        --top-author-prize-step: 14px;
        grid-template-columns: 20px minmax(0, 1fr) calc(var(--top-author-prize-width) + var(--top-author-prize-offset) * var(--top-author-prize-step)) 12px;
        gap: 8px;
    }
    .top-author-surface { min-height: 74px; padding: 12px; }
    .top-author-row--podium .top-author-capsule { padding-right: 22px; }
    .top-author-row--podium .top-author-name { line-height: 18px; }
    .top-author-row--podium .top-author-metrics { gap: 2px 6px; margin-top: 2px; }
    .top-author-row--podium .top-author-count { gap: 4px; font-size: 12px; line-height: 14px; }
    .top-author-row--podium .top-author-count svg { flex-basis: 14px; width: 14px; height: 14px; }
    .top-author-row--podium .top-author-prize {
        right: calc(32px + var(--top-author-prize-offset) * var(--top-author-prize-step));
        bottom: 5px;
    }
}
@media (max-width: 360px) {
    .top-author-row { grid-template-columns: 20px 40px minmax(0, 1fr) 12px; gap: 6px; padding: 10px; }
    .top-author-capsule { padding-right: 20px; }
    .top-author-capsule::before,
    .top-author-frame { inset: -4px; }
    .top-author-avatar { width: 40px; height: 40px; }
    .top-author-count { gap: 4px; font-size: 12px; }
    .top-author-count svg { flex-basis: 14px; width: 14px; height: 14px; }
    .top-author-row--podium { grid-template-columns: 14px minmax(0, 1fr) calc(var(--top-author-prize-width) + var(--top-author-prize-offset) * var(--top-author-prize-step)) 12px; gap: 6px; }
    .top-author-surface { padding: 10px; }
    .top-author-row--podium .top-author-capsule { padding-right: 18px; }
    .top-author-row--podium .top-author-metrics { column-gap: 4px; }
    .top-author-row--podium .top-author-prize {
        right: calc(28px + var(--top-author-prize-offset) * var(--top-author-prize-step));
    }
}
@media (prefers-reduced-motion: reduce) { .top-author-row, .top-author-capsule::before { transition: none; } }
