/* Базовые переменные темы */
:root {
    --bg: rgb(28, 28, 30);
    --panel: rgb(44, 44, 46);
    --line: #1c1c1e;
    --text: #ebf2ff;
    --muted: #9db0d5;
}

/* Общие правила */
* {
    box-sizing: border-box;
}

/* Каркас страницы */
body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

/* Фоновый слой */
.bg-layer {
    position: fixed;
    inset: 0;
    background: rgb(28, 28, 30);
    z-index: -1;
}

/* Шапка и контейнеры */
.page-header {
    max-width: 1250px;
    margin: 0 auto;
    padding: 22px 20px 0;
}

.logo {
    display: inline-block;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.08em;
    font-size: 1.15rem;
}

.page-wrap {
    max-width: 1250px;
    margin: 0 auto;
    padding: 20px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    backdrop-filter: blur(5px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

/* Заголовки и обычный текст */
h1, h2, h3 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
}

p {
    color: var(--muted);
}

/* Верхняя панель с поиском */
.panel-top {
    display: flex;
    gap: 18px;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}

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

.controls input,
.controls select,
.controls button {
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgb(28, 28, 30);
    color: var(--text);
    padding: 8px 12px;
    font: inherit;
}

.controls button {
    background: rgb(220, 167, 40);
    color: #1a1307;
    border: 0;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.16s ease, transform 0.16s ease;
}

.controls button:hover {
    filter: brightness(0.9);
}

/* Таблица игроков */
.table-wrap {
    margin-top: 12px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: rgb(44, 44, 46);
}

thead th {
    text-align: left;
    font-weight: 700;
    color: #c5d4f3;
    border-bottom: 1px solid var(--line);
    background: rgb(70, 70, 74);
    padding: 10px 8px;
    line-height: 1.1;
}

thead a {
    color: inherit;
    text-decoration: none;
}

tbody td {
    padding: 8px 8px;
    line-height: 1.1;
}

.place-cup {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

tbody tr:nth-child(odd) {
    background: rgb(34, 34, 36);
}

tbody tr:nth-child(even) {
    background: rgb(40, 40, 42);
}

tbody tr:hover {
    background: rgba(220, 167, 40, 0.16);
}

/* Подсветка текущего посетителя */
.row-visitor {
    background: rgba(220, 167, 40, 0.24) !important;
    outline: 1px solid rgba(220, 167, 40, 0.5);
}

.visitor-note {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid #6e5823;
    background: rgba(220, 167, 40, 0.14);
    color: #f4e4bf;
    font-size: 0.92rem;
}

.visitor-sep {
    color: #c8a55a;
}

.visitor-link {
    color: #ffe2a5;
    font-weight: 700;
    text-decoration: none;
}

.visitor-link:hover {
    color: #fff1d2;
}

/* Иконка ранга и цифры на белой части */
.skill-inline {
    position: relative;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

.skill-inline img {
    height: 20px;
    width: auto;
    object-fit: contain;
    display: block;
}

.skill-inline > span {
    position: absolute;
    top: 48%;
    right: 3px;
    transform: translateY(-50%);
    width: 28px;
    text-align: center;
    font-family: "Roboto Mono", "Consolas", monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    letter-spacing: 0;
    color: #1d1d1f;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1;
}

/* Онлайн-статус и флаг рядом с ником */
.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    position: relative;
    left: -8px;
    border-radius: 50%;
    background: #2fd266;
    box-shadow: 0 0 6px rgba(47, 210, 102, 0.7);
    vertical-align: middle;
}

.online-dot.is-offline {
    opacity: 0;
}

.online-dot.is-online {
    opacity: 1;
}

.online-flag-img {
    display: inline-block;
    width: 18px;
    height: 14px;
    margin-left: -2px;
    object-fit: cover;
    border-radius: 2px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nick-cell {
    position: relative;
    white-space: nowrap;
}

.nick-presence {
    position: absolute;
    left: -22px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    pointer-events: none;
}

/* Отображение HS процентов */
.hs-inline {
    display: inline-flex;
    align-items: flex-start;
    gap: 1px;
}

.hs-value {
    line-height: 1.05;
}
.hs-percent {
    font-size: 0.62em;
    line-height: 1;
    color: #c9d8f1;
    position: relative;
    top: -0.45em;
}

/* Ссылки и бейджи */
.nick-link {
    color: #ffd084;
    font-weight: 700;
    text-decoration: none;
}

.steam-link-btn {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 7px;
    border: 1px solid #4f6688;
    background: linear-gradient(160deg, #2d3d56, #253349);
    color: #dbe7fb;
    font-size: 0.85rem;
}

.nick-link:hover {
    color: #ffe4b5;
}

.steam-missing-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 7px;
    border: 1px solid #5a6d8d;
    background: linear-gradient(160deg, #2f3b50, #283346);
    color: #d7e2f3;
    font-weight: 700;
    font-size: 0.84rem;
    text-transform: uppercase;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.pagination a {
    text-decoration: none;
    color: #071225;
    background: #bfd7ff;
    padding: 6px 9px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: filter 0.16s ease, transform 0.16s ease;
}

.pagination a:hover {
    filter: brightness(0.9);
}

.page-list {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.page-link {
    min-width: 30px;
    text-align: center;
    text-decoration: none;
    color: #d6e5ff;
    background: #1c1c1e;
    border: 1px solid rgb(28, 28, 30);
    padding: 5px 8px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: filter 0.16s ease, transform 0.16s ease;
}

.page-link:hover {
    filter: brightness(0.9);
}

.page-link.active {
    background: rgb(220, 167, 40);
    border-color: rgb(220, 167, 40);
    color: #1a1307;
}

.page-dots {
    color: #8ea3ca;
    padding: 0 4px;
}

.page-nav {
    text-decoration: none;
    color: #071225;
    background: #bfd7ff;
    padding: 6px 9px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
}

.page-jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}

.page-jump label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #b8c9e8;
}

.page-jump input {
    width: 64px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgb(28, 28, 30);
    color: var(--text);
    padding: 5px 7px;
    font: inherit;
    font-size: 0.9rem;
}

.page-jump button {
    border-radius: 8px;
    border: 0;
    background: rgb(220, 167, 40);
    color: #1a1307;
    padding: 6px 9px;
    font: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: filter 0.16s ease, transform 0.16s ease;
}

.page-jump button:hover {
    filter: brightness(0.9);
}

/* Профиль игрока */
.back-link {
    color: #c2d8ff;
    text-decoration: none;
    margin-bottom: 16px;
    display: inline-block;
}

.profile-legacy-wrap {
    display: block;
}

.profile-title {
    margin: 0 0 10px;
    font-size: 2rem;
    color: #e1b86e;
}

.profile-authid {
    color: #9bb0d3;
    font-size: 1rem;
    font-family: "Manrope", sans-serif;
    font-weight: 600;
    margin-left: 10px;
}

.profile-legacy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.profile-legacy-card {
    background: rgb(34, 34, 36);
    border: 1px solid #2c2c2e;
}

.profile-legacy-card h2 {
    color: #d9b067;
    font-size: 1.1rem;
    margin: 0;
    padding: 8px 10px;
}

.profile-avatar-wrap {
    padding: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.profile-avatar-img {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    border: 1px solid #2c2c2e;
    background: rgb(34, 34, 36);
}

.profile-avatar-fallback {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    border: 1px solid #25365f;
    background: linear-gradient(150deg, #13254a, #0b1734);
    color: #dbe8ff;
    font-family: "Space Grotesk", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-legacy-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
}

.profile-legacy-table td {
    border-top: 1px solid #151b26;
    padding: 6px 8px;
    color: #c7cedd;
    font-size: 1rem;
    vertical-align: middle;
}

.profile-legacy-table .skill-inline span {
    width: 28px;
    text-align: center;
    font-family: "Roboto Mono", "Consolas", monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    color: #1d1d1f;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1;
}

.wins-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.win-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
}

.win-badge-t {
    background: #e64553;
    color: #fff4f4;
}

.win-badge-ct {
    background: #2c7fff;
    color: #f0f7ff;
}

.online-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #1f8a43;
    background: linear-gradient(160deg, #1e9e4b, #15823d);
    color: #ecfff3;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: uppercase;
}

.profile-legacy-table td:first-child {
    color: #aab3c2;
    width: 43%;
}

.profile-player-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 10px 10px;
}

.profile-main-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.profile-main-nick {
    color: #e7edf8;
    font-size: 1.06rem;
    font-weight: 800;
    line-height: 1.1;
    word-break: break-word;
}

.profile-main-authid {
    color: #b7c6df;
    font-size: 0.88rem;
    line-height: 1.1;
    word-break: break-all;
}

.profile-main-city {
    color: #cfdbef;
    font-size: 0.9rem;
    line-height: 1.2;
    word-break: break-word;
}

.profile-main-steam {
    margin-top: 1px;
}

/* Адаптация под мобильные экраны */
@media (max-width: 980px) {
    .profile-legacy-grid {
        grid-template-columns: 1fr;
    }

    .profile-player-head {
        align-items: center;
    }

    .profile-main-info {
        width: 100%;
    }
}
