@import url('https://fonts.googleapis.com/css2?family=Onest:wght@100..900&display=swap');

* {
    font-family: 'Onest', Arial, sans-serif;
    box-sizing: border-box;
    color: #333333;
    caret-color: transparent;
}

body {
    margin: 0;
    background: #f6f7f8;
}

footer.container {
    background-color: white;
}

.season-rating-container {
    background-color: #f6f7f8;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.season-rating-column {
    width: 100%;
    max-width: 63.6rem;
    margin-top: 7.2rem;
    padding: 0;
}

.season-rating-page-head {
    width: 100%;
}

.season-rating-page-title {
    text-align: center;
    margin: 0 auto 1.45rem;
    width: 75%;
    font-size: 1.85rem;
    font-weight: 650;
    line-height: 1.08;
    letter-spacing: -.035em;
}

.season-rating-block {
    background-color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-radius: 15px;
    padding: 1.7rem 2rem 2rem;
    margin-bottom: 2rem;
}

.season-rating-head {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.10rem;
    padding-bottom: 0.70rem;
    border-bottom: 1px solid #eef0f2;
}

.season-rating-title {
    font-size: 1.15rem;
    font-weight: 800;
}

.ach-subtitle {
    color: #707884;
    font-size: 0.95rem;
    line-height: 1.45;
}

.season-rating-subtitle {
    font-size: 0.95rem;
    color: #6b7280;
}

.season-loading {
    color: #6b7280;
    font-size: 0.95rem;
    padding: 0.5rem 0;
}

/* === TABLE (div-based like questions) === */
.season-table {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0; /* без расстояний между строками */
}

.season-table-header,
.season-table-row {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr) 7rem 4rem;
    gap: 0.75rem;
    align-items: center;
}

.season-table-header {
    padding: 0.6rem 0.9rem;
    background: transparent;
    font-weight: 800;
    border-bottom: 1px solid #ececec;
}

.season-table-row {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #ececec;
}

.season-table-row:last-child {
    border-bottom: none;
}

.ach-head-top{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.season-rating-heading-copy {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.season-me-summary-host {
    margin-left: auto;
    min-width: 0;
}

.season-me-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.4rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid #eef0f2;
    border-radius: 11px;
    background: #ffffff;
    white-space: nowrap;
}

.season-me-summary__label {
    color: #707884;
    font-size: 0.82rem;
    font-weight: 650;
}

.season-me-summary__place {
    font-size: 0.9rem;
    font-weight: 800;
}

.season-me-summary__separator {
    color: #a0a7b0;
    font-size: 0.85rem;
    font-weight: 650;
}

.season-me-summary__score {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.88rem;
    font-weight: 700;
}

.season-me-summary .rank-badge {
    min-width: 0;
    padding: 0.22rem 0.6rem;
}

.ach-switch-link{
    font-size: 0.85rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.ach-switch-link:hover{
    text-decoration: underline;
}

.season-empty {
    padding: 0.75rem 0.5rem;
    color: #6b7280;
    font-size: 0.95rem;
}

.col-place {
    font-weight: 600;
    text-align: center;
}

.col-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.season-table-header .col-pct.pct-head{
    justify-content: center;
}

.season-pagination-bar {
    position: relative;
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.season-pagination {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.season-pagination-bar .questions-page-size {
    grid-column: 3;
    justify-self: end;
}

.page-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 12px;
    border: none;
    background: #f4f4f4;
    color: #9e9e9e;
    cursor: pointer;
    font-weight: 900;
}

.page-btn:disabled {
    opacity: 0.50;
    cursor: default;
}

.page-info {
    height: 2.2rem;
    padding: 6px 14px;
    border-radius: 12px;
    background: #f4f4f4;
    font-weight: 600;
}

.page-info,
.page-info span {
     color: #737474;
}

.season-table-row.me {
    background: #eff6ff;
    border-radius: 0;
}

.tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.tooltip-wrapper::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);

  background: #ffffff;
  color: #2b2b2b;
  font-size: 0.75rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  white-space: nowrap;

  box-shadow:
    0 6px 20px rgba(0,0,0,0.12),
    0 2px 6px rgba(0,0,0,0.08);

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease, transform 0.30s ease;
  z-index: 999;
  font-weight: 400;
}

.tooltip-wrapper:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition-delay: 200ms;
}

.col-score,
.col-pct {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    line-height: 1;
}

@media (max-width: 768px){
    .season-table-header,
    .season-table-row{
        grid-template-columns: 2.4rem 1fr 3rem;
    }
}

.rating-user-link {
    text-decoration: none;
}

.col-rank {
    text-align: center;
    font-weight: 600;
}
.rank-badge { display:inline-flex; justify-content:center; min-width:4.8rem; padding:.25rem 0.6rem; border-radius:999px; font-size:.72rem; font-weight:750; }
.rank-junior { color:#4f8a3c; background:#edf6df; }
.rank-middle { color:#9a7a18; background:#fff6c9; }
.rank-senior { color:#b66a18; background:#ffead0; }
.rank-lead { color:#bd4537; background:#ffe0d9; }
.rank-architect { color:#9e1c1c; background:#ffd4d4; }


/* ===== RATING AVATARS ===== */
.rating-user-link {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: inherit;
    text-decoration: none;
}

.rating-user-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rating-avatar {
    width: 2.1rem;
    height: 2.1rem;
    flex: 0 0 2.1rem;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}

/* ===== Pagination controls, visually identical to Questions ===== */
.questions-page-size { position: relative; }
.questions-page-size__pill {
    border: none; background: #f4f4f4; border-radius: 12px; padding: 0.55rem 0.9rem;
    cursor: pointer; display: inline-flex; align-items: center; gap: 0.15rem; font-family: inherit;
}
.questions-page-size__pill:focus, .questions-page-size__pill:focus-visible { outline: none; box-shadow: none; }
.questions-page-size__pill .label { color: #737474; font-weight: 650; }
.questions-page-size__pill .value { min-width: 1.25rem; text-align: center; font-weight: 700; color: #737474; }
.questions-page-size__pill .chev {
    display: inline-flex; align-items: center; justify-content: center; width: 1rem; height: 1rem; flex: 0 0 1rem;
    color: #6b7280; font-size: 0.85rem; font-weight: 900; line-height: 1; transform: rotate(0deg); transition: transform 0.18s ease;
}
.questions-page-size.is-open .questions-page-size__pill .chev { transform: rotate(-180deg); }
.questions-page-size__dropdown {
    position: absolute; bottom: calc(100% + 10px); right: 0; min-width: 150px; background: #ffffff;
    border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); padding: 0.5rem; z-index: 200; transform-origin: bottom right;
}
.questions-page-size__dropdown.hidden { display: none; }
.questions-page-size__item {
    width: 100%; border: none; background: transparent; padding: 0.55rem 0.7rem; border-radius: 10px;
    cursor: pointer; text-align: left; white-space: nowrap; font-family: inherit; font-size: 0.9rem; font-weight: 650;
}
.questions-page-size__item:hover { background: #f3f4f6; }
.questions-page-size__item.active { background: #eff6ff; color: #2563eb; }
.page-info--jumpable { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; min-width: 4.6rem; cursor: text; }
.page-jump-current { min-width: 1ch; text-align: right; }
.page-jump-input {
    width: 2.4rem; height: 1.55rem; padding: 0 0.25rem; border: none; border-radius: 7px; background-color: #ffffff;
    color: #333333; font-family: inherit; font-size: inherit; font-weight: 700; text-align: center; caret-color: auto;
}
.page-jump-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(37,99,235,0.2); }
.page-jump-current.hidden, .page-jump-input.hidden { display: none; }
.page-jump-separator, .page-jump-total { pointer-events: none; }
@media (max-width: 630px) {
    .season-pagination-bar { grid-template-columns: 1fr; gap: 0.9rem; }
    .season-pagination { grid-column: 1; grid-row: 1; }
    .season-pagination-bar .questions-page-size { grid-column: 1; grid-row: 2; justify-self: end; }
}

/* Pagination base: transparent in idle state; final icon skin lives in theme.css. */
.page-btn,
.page-info,
.questions-page-size__pill {
    background: transparent;
}
.page-btn:hover:not(:disabled),
.page-btn:focus-visible:not(:disabled),
.page-info:hover,
.page-info:focus-within,
.questions-page-size__pill:hover,
.questions-page-size__pill:focus-visible {
    background: #f3f4f6;
}


/* =========================================================
   V3 — pagination direction is determined by button ORDER.
   DOM order: first / previous / [page info] / next / last.
   This intentionally does NOT depend on JS classes or aria-label text.
   ========================================================= */

/* 1) FIRST: << */
body .page-btn:first-of-type::before {
    width: 22px !important;
    height: 18px !important;
    transform: none !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 24'%3E%3Cpath d='M12 6L6 12l6 6M21 6l-6 6 6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 24'%3E%3Cpath d='M12 6L6 12l6 6M21 6l-6 6 6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* 2) PREVIOUS: < */
body .page-btn:nth-of-type(2)::before {
    width: 18px !important;
    height: 18px !important;
    transform: none !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 6l-6 6 6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 6l-6 6 6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* 3) NEXT: > */
body .page-btn:nth-last-of-type(2)::before {
    width: 18px !important;
    height: 18px !important;
    transform: none !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l6 6-6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l6 6-6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* 4) LAST: >> */
body .page-btn:last-of-type::before {
    width: 22px !important;
    height: 18px !important;
    transform: none !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 24'%3E%3Cpath d='M7 6l6 6-6 6M16 6l6 6-6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 24'%3E%3Cpath d='M7 6l6 6-6 6M16 6l6 6-6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* all pagination controls: transparent until interaction */
body .page-btn,
body .page-info,
body .questions-page-size__pill {
    background-color: transparent !important;
    box-shadow: none !important;
}
body .page-btn:hover:not(:disabled),
body .page-btn:focus-visible:not(:disabled),
body .page-info:hover,
body .page-info:focus-within,
body .questions-page-size__pill:hover,
body .questions-page-size__pill:focus-visible {
    background-color: #f3f4f6 !important;
}
body.dark-theme .page-btn:hover:not(:disabled),
body.dark-theme .page-btn:focus-visible:not(:disabled),
body.dark-theme .page-info:hover,
body.dark-theme .page-info:focus-within,
body.dark-theme .questions-page-size__pill:hover,
body.dark-theme .questions-page-size__pill:focus-visible {
    background-color: #374151 !important;
}

/* ===== RESPONSIVE PASS ===== */
.season-rating-container {
    padding-left: clamp(1.25rem, 2.5vw, 2rem);
    padding-right: clamp(1.25rem, 2.5vw, 2rem);
}

@media (max-width: 768px) {
    .season-rating-column {
        margin-top: 6.5rem;
    }

    .ach-head-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .season-me-summary-host {
        width: 100%;
        margin-left: 0;
    }

    .season-me-summary {
        width: auto;
        max-width: 100%;
        min-width: 0;
        flex-wrap: wrap;
    }

    .season-rating-page-title {
        width: 100%;
    }

    .season-table-header .col-rank,
    .season-table-row .col-rank {
        display: none;
    }
}

@media (max-width: 600px) {
    .season-rating-block {
        padding: 1.25rem 1rem;
    }

    .season-me-summary {
        gap: 0.4rem;
        padding: 0.45rem 0.65rem;
    }

    .season-rating-title {
        font-size: 1.2rem;
    }

    .season-table-header,
    .season-table-row {
        grid-template-columns: 2rem minmax(0, 1fr) 2.75rem;
        gap: 0.45rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .rating-user-link {
        gap: 0.4rem;
        overflow: hidden;
    }

    .rating-user-link span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 420px) {
    .season-rating-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}


/* ===== SEASON RATING: MAIN + SIDE CARDS ===== */
.season-rating-column {
    max-width: 82rem;
}

.season-rating-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22rem;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 2rem;
}

.season-rating-layout .season-rating-block {
    margin-bottom: 0;
}

.season-rating-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.season-rating-side-card {
    width: 100%;
    padding: 1.25rem;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.season-rating-side-card--me {
    display: flex;
    align-items: center;
    min-height: 4.9rem;
}

.season-rating-side-card--me .season-me-summary-host {
    width: 100%;
    margin: 0;
}

.season-rating-side-card--me .season-me-summary {
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.season-side-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.season-side-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.season-side-subtitle {
    max-width: 19rem;
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.35;
}

/* Match the personal summary separator exactly: 0.70rem above, 0.72rem below. */
.season-rank-card .season-side-header {
    padding-bottom: 0.70rem;
    border-bottom: 1px solid #eef0f2;
}

.season-rank-card .rank-scale {
    margin-top: 0.72rem;
    padding-top: 0;
    border-top: 0;
    display: grid;
    gap: 0.42rem;
}

.season-rank-card .rank-scale__head,
.season-rank-card .rank-scale__row {
    display: grid;
    grid-template-columns: 1fr 5rem;
    column-gap: 0.75rem;
    align-items: center;
}

.season-rank-card .rank-scale__head {
    padding: 0 0 0.25rem;
    color: #6b7280;
    font-size: 0.76rem;
    font-weight: 700;
}

.season-rank-card .rank-scale__head > :last-child {
    text-align: center;
}

.season-rank-card .rank-scale__row {
    padding: 0.25rem 0;
    background: transparent;
    font-size: 0.73rem;
}

.season-rank-card .rank-scale__row .rank-badge {
    justify-self: start;
}

.season-rank-card .rank-scale__row b {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
}

@media (max-width: 1050px) {
    .season-rating-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .season-rating-side {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 1.25rem;
    }
}

@media (max-width: 700px) {
    .season-rating-side {
        grid-template-columns: minmax(0, 1fr);
    }

    .season-rating-side-card--me .season-me-summary {
        gap: 0.4rem;
        padding: 0;
        flex-wrap: wrap;
    }
}

/* ===== Season rating sidebar polish ===== */
.season-rating-column {
    max-width: 70rem;
}

.season-rating-layout {
    grid-template-columns: minmax(0, 1fr) 18.75rem;
    gap: 1.25rem;
}

.season-rating-side-card--me {
    min-height: 0;
    align-items: stretch;
}

.season-rating-side-card--me .season-me-summary {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.58rem;
    width: 100%;
    white-space: normal;
}

.season-me-summary__profile {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.season-me-summary__avatar {
    width: 2.65rem;
    height: 2.65rem;
    flex: 0 0 2.65rem;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    background: #f1f3f5;
}

.season-me-summary__username {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
    font-weight: 700;
}

.season-me-summary__scope {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.35;
}

.season-me-summary__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
    min-width: 0;
    margin-top: 0.12rem;
    padding-top: 0.72rem;
    border-top: 1px solid #eef0f2;
}

.season-me-summary__metric {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.28rem;
}

.season-me-summary__metric-label {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.35;
}

.season-me-summary__metric-value {
    min-height: 1.45rem;
    display: inline-flex;
    align-items: center;
    color: #333333;
    font-size: 0.95rem;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}

.season-rating-side-card--me .season-me-summary .rank-badge {
    min-width: 0;
    padding: 0.2rem 0.52rem;
    font-size: 0.72rem;
}

.season-rank-card .rank-scale__head,
.season-rank-card .rank-scale__row {
    grid-template-columns: minmax(0, 1fr) max-content;
}

.season-rank-card .rank-scale__head > :last-child,
.season-rank-card .rank-scale__row b {
    justify-self: end;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 1050px) {
    .season-rating-column {
        max-width: 63.6rem;
    }

    .season-rating-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 700px) {
    .season-me-summary__metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

body.dark-theme .season-me-summary__metrics {
    border-top-color: #374151;
}

body.dark-theme .season-rank-card .season-side-header {
    border-bottom-color: #374151;
}

body.dark-theme .season-rating-head {
    border-bottom-color: #374151;
}

body.dark-theme .season-me-summary__metric-label {
    color: #9ca3af;
}

body.dark-theme .season-me-summary__metric-value {
    color: #e5e7eb;
}

/* ===== DESKTOP STICKY SEASON SIDEBAR ===== */
.season-rating-container {
    padding-bottom: 5rem;
}

@media (min-width: 1051px) {
    .season-rating-layout {
        align-items: start;
    }

    .season-rating-side {
        position: sticky;
        top: 4.8rem; /* 3.55rem header + 1.25rem card gap */
        align-self: start;
        height: max-content;
    }
}

@media (max-width: 1050px) {
    .season-rating-side {
        position: static;
        top: auto;
        height: auto;
    }
}

/* Keep the personal rating card fully laid out while its user data is loading. */
.season-me-summary__pending {
    visibility: hidden;
}
