:root {
    color-scheme: dark;
    --game-bg: #090b10;
    --game-panel: #13161d;
    --game-panel-raised: #191d27;
    --game-panel-deep: #0d1016;
    --game-border: rgba(255, 255, 255, .1);
    --game-blue: #4f86f7;
    --game-cyan: #67d8f4;
    --game-pink: #c86bdd;
    --game-red: #ff625b;
    --game-yellow: #ffc857;
    --game-text: #f6f7fb;
    --game-muted: #9ca3b2;
    --game-display: "Segoe UI Variable Display", "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-family: "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
    background: var(--game-bg);
}

body {
    min-width: 320px;
    margin: 0;
    color: #e9e7f7;
    background: var(--game-bg);
    -webkit-font-smoothing: antialiased;
}

*, *::before, *::after {
    box-sizing: border-box;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

.ui-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-style: normal;
    line-height: 1;
}

button, input, select, textarea {
    font: inherit;
}

a, button {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--game-yellow);
    outline-offset: 3px;
}

::selection {
    color: #1c1100;
    background: rgba(255, 214, 42, .92);
}

#blazor-error-ui {
    display: none;
    position: fixed;
    z-index: 1000;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    padding: 1rem;
    border: 1px solid #e96a6a;
    border-radius: 12px;
    color: white;
    background: #3c171d;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
}

#blazor-error-ui .reload { color: #fff; font-weight: 800; }
#blazor-error-ui .dismiss { float: right; color: #fff; cursor: pointer; }

/* Keep legacy content pages readable inside the new full-width shell. */
.site-content > :not(.landing) {
    width: calc(100% - 2rem);
    max-width: 1140px;
    margin-right: auto;
    margin-left: auto;
}

.site-content > :not(.landing):first-child {
    margin-top: clamp(2rem, 5vw, 4rem);
}

.site-content > :not(.landing):last-child {
    margin-bottom: clamp(3.5rem, 8vw, 6rem);
}

/* Shared leaderboard pages */
.ranking-page {
    max-width: 1100px !important;
    color: var(--game-text);
}

.ranking-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(1.75rem, 4vw, 2.7rem);
    border: 1px solid var(--game-border);
    border-radius: 28px;
    background: var(--game-panel);
    box-shadow: 0 26px 75px rgba(0, 0, 0, .28), inset 0 1px rgba(255, 255, 255, .05);
    text-align: left;
}

.ranking-hero::after {
    position: absolute;
    top: 50%;
    right: clamp(1.5rem, 5vw, 4rem);
    color: rgba(255, 200, 87, .075);
    content: "X  O";
    font-family: var(--game-display);
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 900;
    letter-spacing: -.12em;
    transform: translateY(-50%);
    pointer-events: none;
}

.ranking-hero > * { position: relative; z-index: 1; }

.ranking-eyebrow,
.ranking-board__heading > div > span,
.ranking-cta > div:first-child > span {
    color: var(--game-yellow);
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.ranking-hero h1 {
    margin: .65rem 0 .8rem;
    color: #fff;
    font-family: var(--game-display);
    max-width: 760px;
    font-size: clamp(2.5rem, 6vw, 4.25rem);
    letter-spacing: -.05em;
    line-height: .98;
}

.ranking-hero > p {
    max-width: 630px;
    margin: 0;
    color: #a7adba;
    font-size: clamp(.9rem, 2vw, 1.02rem);
    line-height: 1.7;
}

.ranking-tabs {
    display: inline-flex;
    gap: .35rem;
    margin-top: 1.75rem;
    padding: .3rem;
    border: 1px solid var(--game-border);
    border-radius: 14px;
    background: var(--game-panel-deep);
}

.ranking-tabs a {
    display: inline-flex;
    min-height: 2.55rem;
    align-items: center;
    gap: .5rem;
    padding: 0 .9rem;
    border-radius: 10px;
    color: #a0a7b6;
    font-size: .76rem;
    font-weight: 800;
    text-decoration: none;
}

.ranking-tabs a:hover { color: #e5e8f5; }

.ranking-tabs .ranking-tabs__active {
    color: #fff;
    background: #3c55a7;
    box-shadow: inset 0 1px rgba(255, 255, 255, .16);
}

.ranking-board {
    margin-top: 1.25rem;
    padding: clamp(1.1rem, 3vw, 1.8rem);
    border: 1px solid var(--game-border);
    border-radius: 26px;
    background: var(--game-panel-deep);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .24), inset 0 1px rgba(255, 255, 255, .04);
}

.ranking-board__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0 .35rem;
}

.ranking-board__heading h2 {
    margin: .25rem 0 0;
    color: #edf0f9;
    font-size: 1.35rem;
    letter-spacing: -.035em;
}

.ranking-period {
    display: inline-flex;
    min-height: 2.15rem;
    align-items: center;
    padding: 0 .85rem;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 999px;
    color: #7d87a3;
    background: rgba(255, 255, 255, .025);
    font-size: .68rem;
    font-weight: 750;
    white-space: nowrap;
}

.ranking-list {
    display: grid;
    gap: .45rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: ranking;
}

.ranking-list li {
    display: grid;
    min-width: 0;
    min-height: 4.6rem;
    align-items: center;
    grid-template-columns: 2.7rem 2.65rem minmax(0, 1fr) auto;
    gap: .8rem;
    padding: .6rem .85rem;
    border: 1px solid rgba(255, 255, 255, .045);
    border-radius: 16px;
    background: var(--game-panel-raised);
    transition: border-color .18s, background .18s;
}

.ranking-list li:hover {
    border-color: rgba(255, 255, 255, .16);
    background: #1e232e;
}

.ranking-list--groups li {
    grid-template-columns: 2.7rem 2.65rem minmax(0, 1fr) 5.2rem auto;
}

.ranking-list li:nth-child(1) {
    border-color: rgba(255, 200, 87, .34);
    background: #242119;
}

.ranking-list li:nth-child(2),
.ranking-list li:nth-child(3) { background: var(--game-panel-raised); }

.ranking-list__position {
    color: #707a98;
    font-size: .82rem;
    font-weight: 850;
    text-align: center;
}

.ranking-list__avatar {
    display: grid;
    width: 2.65rem;
    height: 2.65rem;
    place-items: center;
    border: 1px solid rgba(124, 144, 214, .32);
    border-radius: 50%;
    color: #dcecff;
    background: #202b51;
    font-size: .82rem;
    font-weight: 900;
}

.ranking-list__avatar--group {
    border-color: rgba(255, 62, 177, .3);
    color: #ffc3e7;
    background: #2a1f3a;
}

.ranking-list__name {
    overflow: hidden;
    color: #e7e9f4;
    font-size: .86rem;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.ranking-list__name:hover { color: var(--game-yellow); }

.ranking-list__name--link {
    text-decoration: underline;
    text-decoration-color: rgba(98, 230, 213, .28);
    text-decoration-thickness: 1px;
    text-underline-offset: .25rem;
}

.ranking-list__open-group {
    display: inline-flex;
    width: 100%;
    min-height: 2rem;
    align-items: center;
    justify-content: center;
    gap: .38rem;
    border: 1px solid rgba(84, 181, 234, .24);
    border-radius: 999px;
    color: #a9def8;
    background: rgba(45, 164, 224, .08);
    font-size: .64rem;
    font-weight: 850;
    text-decoration: none;
    transition: border-color .18s, color .18s, background .18s;
}

.ranking-list__open-group .ui-icon {
    color: #58bcea;
    font-size: .82rem;
}

.ranking-list__open-group:hover,
.ranking-list__open-group:focus-visible {
    border-color: rgba(84, 181, 234, .5);
    color: #eefaff;
    background: rgba(45, 164, 224, .16);
}

.ranking-list__open-placeholder { width: 100%; }

.ranking-list__score {
    min-width: 6rem;
    text-align: right;
}

.ranking-list__score strong,
.ranking-list__score small {
    display: block;
}

.ranking-list__score strong {
    color: #8eecff;
    font-size: .9rem;
}

.ranking-list__score small {
    margin-top: .1rem;
    color: #7b8395;
    font-size: .64rem;
}

.ranking-note {
    margin: 1rem .35rem 0;
    color: #7c8495;
    font-size: .72rem;
    line-height: 1.6;
    text-align: center;
}

.ranking-empty {
    padding: 3.5rem 1rem;
    color: #7c86a3;
    text-align: center;
}

.ranking-skeleton {
    display: grid;
    gap: .45rem;
}

.ranking-skeleton span {
    height: 4.6rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, .045);
    animation: ranking-shimmer 1.4s infinite;
}

.ranking-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 1.25rem;
    padding: clamp(1.4rem, 4vw, 2.2rem);
    border: 1px solid var(--game-border);
    border-radius: 24px;
    background: var(--game-panel);
}

.ranking-cta h2 {
    margin: .35rem 0 0;
    color: #eff1f8;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    letter-spacing: -.035em;
}

.ranking-cta > div:last-child {
    display: flex;
    flex: 0 0 auto;
    gap: .5rem;
}

.ranking-cta a {
    display: inline-flex;
    min-height: 2.8rem;
    align-items: center;
    justify-content: center;
    padding: 0 .9rem;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 12px;
    color: #c8cde0;
    font-size: .72rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.ranking-cta .ranking-cta__telegram {
    border-color: #fff176;
    color: #3b2300;
    background: var(--game-yellow);
    box-shadow: inset 0 1px rgba(255,255,255,.34), 0 3px 0 #95691f;
}

@keyframes ranking-shimmer { 50% { opacity: .52; } }

@media (max-width: 680px) {
    .ranking-hero { border-radius: 23px; }
    .ranking-hero::after { display: none; }
    .ranking-hero h1 { font-size: clamp(2.15rem, 11vw, 3.2rem); }
    .ranking-board { border-radius: 21px; }
    .ranking-list li { grid-template-columns: 2rem 2.45rem minmax(0, 1fr) auto; gap: .55rem; padding-inline: .55rem; }
    .ranking-list--groups li {
        min-height: 5.35rem;
        grid-template-columns: 2rem minmax(0, 1fr) auto;
        grid-template-areas:
            "rank name score"
            "rank open score";
        gap: .28rem .55rem;
    }
    .ranking-list--groups .ranking-list__position { grid-area: rank; }
    .ranking-list--groups .ranking-list__avatar { display: none; }
    .ranking-list--groups .ranking-list__name { grid-area: name; }
    .ranking-list--groups .ranking-list__open-group {
        width: fit-content;
        min-height: 1.75rem;
        grid-area: open;
        padding: 0 .65rem;
    }
    .ranking-list--groups .ranking-list__open-placeholder { grid-area: open; }
    .ranking-list--groups .ranking-list__score { grid-area: score; }
    .ranking-list__score { min-width: 4.2rem; }
    .ranking-list__score small { max-width: 5rem; }
    .ranking-list__open-group { min-height: 1.9rem; }
    .ranking-cta { align-items: stretch; flex-direction: column; }
    .ranking-cta > div:last-child { display: grid; }
}

@media (max-width: 390px) {
    .ranking-period { display: none; }
    .ranking-list__avatar { display: none; }
    .ranking-list li { grid-template-columns: 2rem minmax(0, 1fr) auto; }
    .ranking-list--groups li { grid-template-columns: 2rem minmax(0, 1fr) auto; }
}

/* Private purchase and gift pages */
.transaction-page {
    display: grid;
    max-width: 680px !important;
    min-height: 55vh;
    align-items: center;
}

.transaction-card {
    position: relative;
    overflow: hidden;
    padding: clamp(1.5rem, 5vw, 3.25rem);
    border: 1px solid var(--game-border);
    border-radius: 30px;
    background: var(--game-panel);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .34), inset 0 1px rgba(255, 255, 255, .05);
    text-align: center;
}

.transaction-icon {
    display: grid;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.25rem;
    place-items: center;
    border: 1px solid rgba(255, 214, 42, .42);
    border-radius: 18px;
    color: #ffd62a;
    background: #24202a;
    box-shadow: 0 15px 35px rgba(0, 0, 0, .2);
    font-size: 1.25rem;
}

.transaction-eyebrow {
    color: #55e8ff;
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.transaction-card h1 {
    margin: .65rem 0 .85rem;
    color: #fff;
    font-family: var(--game-display);
    font-size: clamp(2rem, 7vw, 3.65rem);
    letter-spacing: -.055em;
    line-height: 1.03;
}

.transaction-card > p:not(.transaction-notice) {
    max-width: 510px;
    margin: 0 auto;
    color: #8d96b3;
    font-size: .88rem;
    line-height: 1.7;
}

.transaction-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: .55rem;
    margin: 1.65rem 0 1rem;
}

.transaction-price s {
    color: #626b86;
    font-size: .85rem;
}

.transaction-price strong {
    color: #fff;
    font-size: 2rem;
    letter-spacing: -.045em;
}

.transaction-price span {
    color: #717a97;
    font-size: .7rem;
}

.transaction-primary,
.transaction-secondary {
    display: inline-flex;
    min-height: 3.15rem;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    padding: 0 1.3rem;
    border-radius: 14px;
    font-size: .82rem;
    font-weight: 850;
    text-decoration: none;
}

.transaction-primary {
    border: 1px solid #fff176;
    color: #3b2300;
    background: var(--game-yellow);
    box-shadow: inset 0 1px rgba(255,255,255,.34), 0 3px 0 #95691f, 0 14px 35px rgba(0, 0, 0, .2);
    cursor: pointer;
}

.transaction-secondary {
    margin-top: 1.4rem;
    border: 1px solid rgba(66, 145, 255, .34);
    color: #cce7ff;
    background: rgba(32, 89, 220, .13);
}

.transaction-notice {
    max-width: 480px;
    margin: 1.4rem auto 0;
    color: #66708d;
    font-size: .68rem;
    line-height: 1.6;
}

.transaction-notice .ui-icon { margin-right: .25rem; color: #7f88a7; }

/* Game-styled article and legacy content pages. */
.article-page {
    position: relative;
    overflow: hidden;
    max-width: 920px !important;
    padding: clamp(1.25rem, 4vw, 3rem);
    border: 1px solid var(--game-border);
    border-radius: 30px;
    background: var(--game-panel);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .3), inset 0 1px rgba(255,255,255,.04);
}

.article-page::before {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    color: rgba(255, 214, 42, .1);
    content: "X  O  X";
    font-family: var(--game-display);
    font-size: clamp(2rem, 7vw, 5rem);
    font-weight: 900;
    letter-spacing: .12em;
    pointer-events: none;
}

.legacy-stack {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--legacy-stack-gap, .5rem);
}

.legacy-stack--row {
    flex-direction: row;
    align-items: center;
}

.legacy-text {
    margin: 0;
    color: #c9ced9;
    line-height: 1.8;
}

.legacy-text--gutter { margin-bottom: .75rem; }
.legacy-text--center { text-align: center; }
.legacy-text--small { color: #a4aab7; font-size: .85rem; }
.legacy-text--primary { color: #79e9ff; }
.legacy-text--success { color: #35ffc0; }
.legacy-text--error { color: #ff8b96; }

h2.legacy-text,
h3.legacy-text {
    color: #fff;
    font-family: var(--game-display);
    line-height: 1.25;
}

h2.legacy-text { font-size: clamp(1.8rem, 4vw, 3.2rem); letter-spacing: -.04em; }
h3.legacy-text { font-size: clamp(1.15rem, 3vw, 1.45rem); }

.article-page > .legacy-text:first-child,
.article-page > .legacy-stack:first-child > .legacy-text:first-child {
    max-width: 760px;
    margin-bottom: 1rem;
    padding-right: clamp(0rem, 9vw, 5rem);
    color: #fff;
    line-height: 1.08;
    text-shadow: 0 3px 0 rgba(0, 0, 0, .4);
}

.legacy-card {
    padding: clamp(1rem, 3vw, 1.5rem) !important;
    border: 1px solid var(--game-border);
    border-radius: 20px;
    background: var(--game-panel-raised);
    box-shadow: inset 0 1px rgba(255,255,255,.06);
}

.legacy-card:nth-child(even) { border-color: var(--game-border); }
.legacy-link { color: #69e9ff; font-weight: 800; }
.legacy-link:hover { color: #ffd62a; }

.legacy-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.legacy-gallery__item { min-width: 0; text-align: center; }

.legacy-image {
    width: min(100%, 200px);
    height: auto;
    border: 1px solid rgba(86, 140, 255, .34);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(3, 0, 40, .38);
}

.legacy-benefit-icon {
    display: inline-grid;
    min-width: 2.3rem;
    height: 2.3rem;
    place-items: center;
    margin-right: .35rem;
    border: 1px solid rgba(255, 214, 42, .32);
    border-radius: 10px;
    color: #ffd62a;
    background: rgba(255, 214, 42, .1);
    font-size: .72rem;
    font-weight: 850;
}

.admin-tools {
    display: grid;
    max-width: 720px !important;
    gap: .8rem;
    padding: 1.2rem;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 18px;
    background: rgba(255, 255, 255, .025);
}

.admin-tools label { display: grid; gap: .35rem; color: #9aa3bd; font-size: .75rem; }
.admin-tools input { min-height: 2.65rem; padding: 0 .75rem; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; color: #fff; background: #0b1020; }
.admin-tools button,
.admin-button { min-height: 2.55rem; padding: 0 .8rem; border: 1px solid rgba(141,123,255,.25); border-radius: 10px; color: #ddd8ff; background: rgba(141,123,255,.1); cursor: pointer; }
.admin-tools__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .7rem; border-top: 1px solid rgba(255,255,255,.07); }
.admin-tools__remove { min-width: 2.55rem; }
.admin-tools__primary { color: #a99cff; }
.admin-tools__success { color: #62e6d5; }
.admin-tools__error { color: #ff8b96; }

@media (max-width: 560px) {
    .legacy-gallery { grid-template-columns: 1fr; }
}

.transaction-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .075);
}

.transaction-stats span,
.transaction-stats strong,
.transaction-stats small {
    display: block;
}

.transaction-stats strong { color: #eef0f8; font-size: 1.1rem; }
.transaction-stats small { margin-top: .2rem; color: #68718e; font-size: .65rem; }

.transaction-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.transaction-loading span {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    background: #8d7bff;
    animation: transaction-pulse .8s infinite alternate;
}

.transaction-loading span:nth-child(2) { animation-delay: .15s; }
.transaction-loading span:nth-child(3) { animation-delay: .3s; }

@keyframes transaction-pulse { to { opacity: .25; transform: translateY(-5px); } }

@media (max-width: 560px) {
    .transaction-card { border-radius: 22px; }
    .transaction-primary, .transaction-secondary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .ranking-skeleton span { animation: none; }
    .ranking-list li { transition: none; }
    .transaction-loading span { animation: none; }
}
