.telegram-header-cta {
    position: relative;
    isolation: isolate;
    align-items: center;
    justify-content: center;
    gap: calc(8px * var(--s));
    /* Match the filters: 1.25rem line + 1.25rem padding + two borders. */
    min-height: calc(2.5rem + 2px);
    padding: 0 1rem;
    overflow: hidden;
    border: 1px solid rgba(129, 140, 248, 0.32);
    border-radius: 0.5rem;
    background:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(99, 101, 241, 0.15) 25%,
            rgba(99, 102, 241, 0.3) 50%,
            rgba(99, 102, 241, 0.15) 75%,
            transparent 100%
        ) #363878;
    background-size: 200% 100%;
    animation: liveShimmer 7s ease-in-out infinite;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.25rem;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 180ms ease, background-color 180ms ease;
}

.telegram-header-cta svg {
    width: calc(17px * var(--s));
    height: calc(17px * var(--s));
    flex: 0 0 auto;
    fill: currentColor;
}

.telegram-header-cta:hover {
    border-color: rgba(129, 140, 248, 0.45);
    background-color: #3e4088;
}

.telegram-header-cta:active {
    background-color: #30326b;
}

@media (prefers-reduced-motion: reduce) {
    .telegram-header-cta {
        animation: none;
        background-position: 50% 0;
    }
}

.telegram-header-cta:focus-visible,
.telegram-live-cta:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 3px;
}

.balance-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    row-gap: 1.5rem;
}

.balance-header {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(12px * var(--s));
}

.balance-heading {
    min-width: 0;
}

.balance-chart {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
}

.staking-summary {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    gap: calc(8px * var(--s));
    min-height: calc(30px * var(--s));
    padding: 0 calc(12px * var(--s));
    margin: 0;
    border: 1px solid var(--border-glass);
    border-radius: 0.25rem;
    background: rgba(11, 14, 20, 0.5);
    color: #64748b;
    font-family: "Inter", sans-serif;
    font-size: calc(11px * var(--s));
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    cursor: default;
}

/* Optical alignment of Inter's visible glyphs inside the centered line box. */
.staking-summary > span {
    position: relative;
    top: calc(1px * var(--s));
}

.staking-value {
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

.staking-summary > span[aria-hidden="true"] {
    color: #475569;
}

.live-cta-row {
    position: relative;
    min-height: calc(50px * var(--s));
}

.telegram-live-cta {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(7px * var(--s));
    min-height: calc(32px * var(--s));
    padding: 0 calc(13px * var(--s));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0.25rem;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    font-size: calc(11px * var(--s));
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.telegram-live-cta svg {
    width: calc(14px * var(--s));
    height: calc(14px * var(--s));
    flex: 0 0 auto;
    fill: currentColor;
}

.telegram-live-cta:hover {
    border-color: rgba(99, 102, 241, 0.45);
    color: #a5b4fc;
    background-color: rgba(99, 102, 241, 0.2);
}

@media (max-width: 639px) {
    .balance-panel {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 16px;
    }

    .staking-summary {
        grid-column: 1;
        grid-row: 3;
        min-height: 28px;
        font-size: 11px;
    }

    .telegram-live-cta {
        min-height: 30px;
        padding: 0 10px;
        font-size: 9px;
    }
}


/* The site's glass bar (_site_bar.html): held at the top at every width, as the phones' bar
   always was. Its row is the page's column: the same width and side gutters. */
.site-bar {
    position: sticky;
    z-index: 9999;
    top: 0;
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(20, 24, 35, 0.6);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.site-bar-inner {
    display: flex;
    align-items: center;
    gap: 2.25rem;
    max-width: calc(1440px * var(--s));
    height: calc(80px * var(--s));
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-brand {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: calc(8px * var(--s));
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.site-brand-logo {
    width: calc(42px * var(--s));
    height: calc(42px * var(--s));
    flex: none;
}

.site-bar-word {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    margin: 0;
    color: #fff;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.site-bar-bot { color: #818cf8; }

.site-bar-poly {
    display: inline-flex;
    align-items: center;
    height: calc(21px * var(--s));
    margin-left: 0.25rem;
    padding: 0 0.5rem;
    border: 1px solid #334155;
    border-radius: 0.25rem;
    background: rgba(15, 23, 42, 0.7);
    color: #94a3b8;
    font-size: 0.825rem;
    letter-spacing: -0.02em;
}

.site-bar-end {
    display: flex;
    flex: none;
    align-items: center;
    gap: 1.25rem;
    margin-left: auto;
}

/* The language: two short codes, the current one white, as the tabs mark theirs. */
.site-lang {
    display: flex;
    gap: 0.125rem;
}

.site-lang a {
    padding: 0.5rem 0.5rem;
    border-radius: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 200ms ease;
}

.site-lang a:hover,
.site-lang a[aria-current="page"] {
    color: #fff;
}

.site-lang a:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

.site-bar-cta {
    display: inline-flex;
    flex: none;
}

/* Phones say it short, in one line («Подписка»); the full words stay in its aria-label. */
.site-bar-cta-short { display: none; }

/* The site's sections (_site_tabs.html: predictions, matches, tournaments): text tabs beside
   the wordmark, as on the league pages; the current one white. */
.site-tabs {
    display: flex;
    gap: 0.25rem;
}

/* In size, nearer the wordmark's (1.65rem) than the controls' text, so the row reads as one. */
.site-tabs a {
    padding: 0.5rem 0.85rem;
    border-radius: 0.5rem;
    color: #94a3b8;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-decoration: none;
    white-space: nowrap;
    transition: color 200ms ease;
}

.site-tabs a:hover,
.site-tabs a[aria-current="page"] {
    color: #fff;
}

.site-tabs a:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

/* The tabs stay in the bar from 640 px: narrower screens tighten its spacing, then (under
   768 px) keep only the eye of the wordmark. Phones show the tabs as the page's first row. */
.site-tabs-row { display: none; }

@media (min-width: 640px) and (max-width: 859px) {
    .site-bar-inner { gap: 1.25rem; }
    .site-bar-end { gap: 0.75rem; }
    .site-bar .site-tabs a { padding-inline: 0.5rem; }
    .site-lang a { padding-inline: 0.375rem; }
}

@media (min-width: 640px) and (max-width: 767px) {
    .site-bar-word {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

@media (min-width: 1024px) {
    .site-bar-inner { padding: 0 2rem; }
}

/* The language has moved into the bar; the footer keeps it only on phones. */
@media (min-width: 640px) {
    .site-footer { display: none; }
}

/* Phones: the bar is the wordmark and the button (the language stays at the page's foot). */
@media (max-width: 639px) {
    .site-bar-inner { gap: 12px; height: 70px; padding: 0 16px; }
    .site-bar-end { flex: 0 1 auto; min-width: 0; }
    .site-bar-word { font-size: 1.5rem; }
    .site-bar-poly { height: 20px; font-size: 0.6875rem; letter-spacing: 0.04em; }
    .site-bar .site-lang,
    .site-bar .site-tabs { display: none; }
    .site-bar-cta {
        min-height: 38px;
        padding: 0 11px;
        border-radius: 8px;
        font-size: 11px;
        letter-spacing: 0.02em;
    }
    .site-bar-cta-full { display: none; }
    .site-bar-cta-short { display: inline; }
    /* The tabs hang under the bar as its second row: its glass, the full width, no gap (the
       page's 2rem top padding and 16px gutters taken back); they scroll away, the bar stays. */
    .site-tabs-row {
        display: block;
        margin: -2rem -16px 1.5rem;
        padding: 0 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(20, 24, 35, 0.6);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
    .site-tabs-row .site-tabs { justify-content: center; }
    .site-tabs a { padding: 0.6rem 0.85rem; font-size: 16px; }
}


/* Narrow phones: the button's icon and the tabs give up some room; under 360 px the wordmark
   too. The bar keeps the page's 16 px gutters. */
@media (max-width: 374px) {
    .site-bar-cta svg { display: none; }
    .site-tabs a { padding: 0.6rem 0.5rem; font-size: 15px; }
}

@media (max-width: 359px) {
    .site-bar-word { font-size: 1.3rem; }
    .site-bar .site-brand { gap: 6px; }
    .site-bar .site-brand-logo { width: 34px; height: 34px; }
}

/* The dashboard's filters (index.html), centred under the bar: the month or the tournament
   is the title, its menu switching it; the tournament's stages and phases are segments in the
   league pages' rail, the current one lit. */
.dash-pick {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* The title centres by its words; the menu's chevron hangs beside them (room kept for it). */
.dash-title {
    position: relative;
    max-width: calc(100% - 3.5rem);
}

.dash-title-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    cursor: pointer;
    max-width: 100%;
}

/* A long tournament wraps, its lines balanced, rather than leave the screen. */
.dash-title-trigger span { min-width: 0; text-wrap: balance; }

.dash-title-trigger .dd-chevron {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    width: 1.25rem;
    height: 1.25rem;
    margin: auto 0;
    color: #64748b;
    transition: transform 200ms ease, color 200ms ease;
}

.dash-title-trigger:hover .dd-chevron,
.dash-title.dd-open .dd-chevron { color: #a5b4fc; }

.dash-title-trigger:focus-visible,
.dash-rail a:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

/* The title's menus: the dashboard's glass menu, centred under the title, the current choice
   lit as the segments are. */
.dash-title .dropdown-menu {
    left: 50%;
    width: 18rem;
    max-height: min(60vh, calc(420px * var(--s)));
    margin-left: -9rem;
    padding: 0.375rem;
    border-radius: 0.75rem;
    text-align: left;
}

.dash-title .dropdown-option {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: #94a3b8;
    font-weight: 500;
}

.dash-title .dropdown-option:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.dash-title .dropdown-option.selected {
    background: rgba(99, 102, 241, 0.16);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.28);
    color: #fff;
}

/* The months: a calendar per year, latest first; months without maps dim, not choosable. */
.dash-title .dash-months {
    width: 17rem;
    margin-left: -8.5rem;
}

/* The year heads its months and chooses the whole year. */
.dash-title .dash-months-year {
    color: #e2e8f0;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
}

.dash-title .dash-months-grid + .dash-months-year { margin-top: 0.5rem; }

.dash-months-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.dash-title .dash-months-grid > * {
    padding: 0.5rem 0;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    text-align: center;
}

.dash-months-grid > span {
    color: #334155;
    cursor: default;
}

.dash-rail {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    max-width: 100%;
    padding: 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0.75rem;
    background: rgba(5, 6, 10, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Segments: links, the current one a plain label (lit). «Дата · Турнир» is a rail too. */
.dash-rail > a,
.dash-rail > span {
    padding: 0.55rem 1rem;
    border-radius: 0.5rem;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 200ms ease;
}

.dash-rail a:hover { color: #fff; }

.dash-rail > [aria-current] {
    cursor: default;
    background: rgba(99, 102, 241, 0.16);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.28);
    color: #fff;
}

/* The sliding highlight (index.html's railThumb): one pill under the segments that moves to
   the chosen one; the current segment then keeps only its white text. */
.dash-rail-thumb {
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    border-radius: 0.5rem;
    background: rgba(99, 102, 241, 0.16);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.28);
    pointer-events: none;
    transition: transform 300ms cubic-bezier(.22, 1, .36, 1), width 300ms cubic-bezier(.22, 1, .36, 1),
                height 300ms cubic-bezier(.22, 1, .36, 1), opacity 200ms ease;
}

.dash-rail.has-thumb > [aria-current] {
    background: none;
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .dash-rail-thumb { transition: none; }
}

/* The phases are the stage's subdivision: a step smaller. */
.dash-rail--sub > :not(.dash-rail-thumb) {
    padding: 0.4rem 0.8rem;
    font-size: 0.8125rem;
}

@media (max-width: 639px) {
    .dash-pick { margin-bottom: 1.5rem; }
    .dash-title-trigger { font-size: 1.25rem; }
    .dash-title-trigger .dd-chevron { width: 1.125rem; height: 1.125rem; }
    .dash-title .dropdown-menu { width: 16rem; margin-left: -8rem; }
    .dash-title .dash-months { width: 16rem; margin-left: -8rem; }
    .dash-rail > :not(.dash-rail-thumb) { padding: 0.5rem; font-size: 13px; }
    .dash-rail--sub > :not(.dash-rail-thumb) { padding: 0.4rem 0.5rem; font-size: 12px; }
}

/* A view loading without a reload (index.html's dashNavigate): the old one dims if the load
   takes longer than a blink, the new one comes back to full in the same fade. */
#dash-main { transition: opacity 200ms ease; }
#dash-main.is-loading { opacity: 0.45; }

@media (prefers-reduced-motion: reduce) {
    #dash-main { transition: none; }
}
