:root {
    --bg: #0d1118;
    --panel: rgba(24, 30, 36, 0.86);
    --panel-strong: #111720;
    --gold: #e6b800;
    --gold-light: #ffd966;
    --gold-soft: #ffdd7a;
    --gold-dark: #a67c00;
    --text: #fff7d6;
    --muted: #c6b985;
    --danger: #ff8166;
}

[hidden] { display: none !important; }

.ad-offer { margin: 16px 0; padding: 18px; border: 1px dashed #8b7951; border-radius: 16px; background: linear-gradient(120deg, #263440, #131c25); color: var(--text); text-align: left; font-family: system-ui, sans-serif; line-height: 1.5; }
.ad-label { display: inline-block; color: var(--gold-light); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.ad-offer h3 { margin: 6px 0; font-size: 1.05rem; }
.ad-image-link { display: block; width: 100%; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.ad-image-link:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.ad-illustration { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; object-position: center 45%; }
.ad-creative .ad-image-link { margin-bottom: 0; }
.ad-creative .ad-illustration { max-height: 180px; }
.ad-offer p { color: var(--muted); font-size: 0.85rem; }
.ad-offer button, #adDialog button { font-family: system-ui, sans-serif; letter-spacing: 0; font-size: 0.9rem; min-height: 44px; padding: 10px 14px; margin: 12px 0 0; box-shadow: none; }
.ad-offer button:focus-visible, #adDialog button:focus-visible { outline: 3px solid white; outline-offset: 3px; }
#endgameContent .ad-offer { grid-column: 1 / -1; margin: 0; }
body.ad-modal-open { overflow: hidden; }
#adDialog { box-sizing: border-box; width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 24px; overflow-y: auto; border: 1px solid #8b7951; border-radius: 22px; background: #111c27; color: var(--text); box-shadow: 0 24px 80px #0009; font-family: system-ui, sans-serif; line-height: 1.5; }
#adDialog::backdrop { background: #050b13d9; backdrop-filter: blur(6px); }
.ad-dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#adDialog #adClose { width: 44px; margin: 0; border: 1px solid #645b40; border-radius: 12px; background: transparent; color: var(--text); flex-shrink: 0; }
#adDialog h2 { font-size: 1.4rem; margin: 16px 0 6px; text-align: left; }
#adDialogReward { font-size: 0.9rem; color: var(--muted); }
.ad-offer .ad-sponsor { margin-top: 12px; padding-top: 12px; border-top: 1px solid #8b795144; color: var(--text); }
.ad-site-link { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 44px; color: var(--gold-light); font-size: 0.85rem; text-underline-offset: 4px; }
.ad-site-link:hover { color: white; }
.ad-site-link:focus-visible { outline: 3px solid white; outline-offset: 3px; border-radius: 4px; }
.ad-link-hint { color: var(--muted); font-size: 0.72rem; }
.ad-creative { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 22px; margin: 22px 0 16px; border: 1px solid #8b7951; border-radius: 16px; text-align: center; background: radial-gradient(ellipse at top, #34464b, #18242f 75%); }
.ad-brand { color: var(--gold-light); font-size: 1.1rem; font-weight: 800; letter-spacing: 0.08em; }
.ad-creative strong { max-width: 310px; font-size: 1.4rem; line-height: 1.3; }
.ad-creative p { color: var(--text); font-size: 0.87rem; }
.ad-facts { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.ad-facts span { border-radius: 8px; padding: 5px 9px; background: #ffd96615; color: var(--gold-light); font-size: 0.75rem; }
.ad-site-cta { width: 100%; justify-content: center; padding: 10px 14px; border-radius: 12px; background: var(--gold-light); color: #17202a; font-weight: 700; text-decoration: none; }
.ad-site-cta:hover { background: #ffe595; color: #17202a; }
#adStatus { min-height: 48px; font-size: 0.9rem; }
#adDialog .ad-footnote { margin-top: 16px; color: var(--muted); font-size: 0.75rem; }
@media (max-width: 420px) { #adDialog { padding: 18px; } .ad-creative { padding: 16px; gap: 12px; } }

#investmentForm select { width: 100%; padding: 12px 8px; border: 1px solid #82703d; border-radius: 10px; background: #0b1118; color: var(--text); font: inherit; font-size: 0.8rem; }
#investmentForm select:focus-visible { outline: 2px solid var(--gold-light); }
.investment-amount-row { display: flex; gap: 8px; align-items: center; }
.investment-amount-row input { min-width: 0; }
#investmentForm .investment-amount-row button { width: auto; margin: 0; padding: 10px; flex-shrink: 0; border-radius: 10px; box-shadow: none; }
#investmentAmountHint { font-size: 0.72rem; margin-top: 10px; }

#timedGames {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(255, 217, 102, 0.34);
    border-radius: 18px;
    background: linear-gradient(150deg, #263440, #111720 70%);
    font-family: system-ui, sans-serif;
    line-height: 1.5;
}
.timed-heading, .timed-arena-heading, .timed-rank-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
#timedGames h2 { margin: 2px 0 12px; text-align: left; }
.timed-eyebrow { font-size: 0.7rem; letter-spacing: 0.12em; color: var(--gold-light); }
.timed-help { color: var(--muted); font-size: 0.85rem; margin: 12px 0; }
.timed-reward { color: var(--gold-light); font-weight: 700; }
.timed-modes, .timed-upgrades, .timed-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.timed-mode, .timed-upgrade { padding: 12px; background: #0d151e; border: 1px solid #4c4936; border-radius: 12px; }
.timed-mode h3 { font-size: 1.2rem; margin: 0; }
.timed-mode-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.timed-mode .timed-eyebrow { font-size: 0.65rem; letter-spacing: 0; }
.timed-mode-actions { display: flex; gap: 8px; margin-top: 10px; }
#timedGames .timed-mode-actions button { min-height: 34px; margin: 0; padding: 8px; font-size: 0.8rem; border-radius: 9px; box-shadow: none; }
#timedGames .timed-secondary { color: var(--gold-light); background: transparent; border: 1px solid #4c4936; }
.timed-mode p, .timed-upgrade p { font-size: 0.8rem; overflow-wrap: anywhere; }
.timed-prizes { color: var(--gold-light); margin-top: 8px; }
#timedGames button { font-family: inherit; font-size: 0.9rem; padding: 11px 12px; letter-spacing: 0; }
#timedGames button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
#timedArena { position: relative; margin-top: 12px; padding: 16px; border: 1px solid var(--gold); border-radius: 14px; background: #101c26; }
#timedClock { font-size: clamp(1.15rem, 4vw, 2rem); font-variant-numeric: tabular-nums; color: var(--gold-light); }
#timedClock.is-ending { color: var(--danger); }
#timedProgress { width: 100%; height: 8px; accent-color: var(--gold); margin: 12px 0; }
.timed-stats { grid-template-columns: 1fr 1fr; text-align: center; margin: 12px 0; }
.timed-wallet { position: relative; }
#timedIncomePop { position: absolute; left: 65%; top: 16px; opacity: 0; pointer-events: none; font-size: 1.35rem; font-weight: 800; color: #92efb7; text-shadow: 0 2px 8px #000; }
#timedCountdown { position: absolute; inset: 0; z-index: 2; border-radius: inherit; background: #101c26ed; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--gold-light); text-align: center; padding: 20px; }
#timedCountdownNumber { font-size: 6rem; font-variant-numeric: tabular-nums; line-height: 1; }
.timed-dialog-content { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 18px; }
.timed-play-column { min-width: 0; }
#timedRankingPanel { min-width: 0; margin-top: 12px; padding: 14px; border: 1px solid #4c4936; border-radius: 12px; background: #0d151e; }
#timedRankingPanel .timed-rank-heading { margin-top: 0; gap: 10px; }
#timedRankingPanel .leaderboard-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 6px; padding: 8px; }
#timedAround .leaderboard-rank { background: #263440; color: var(--muted); }
.timed-rules { font-size: 0.8rem; margin-top: 16px; }
.timed-rules summary { cursor: pointer; color: var(--gold-light); }
.timed-stats p { font-size: 0.8rem; color: var(--muted); }
.timed-stats strong { display: block; color: var(--text); font-size: clamp(1rem, 3vw, 1.6rem); overflow-wrap: anywhere; }
#timedGames #timedClick { min-height: 70px; font-size: 1.35rem; margin: 10px 0 18px; touch-action: manipulation; }
.timed-upgrade { display: flex; flex-direction: column; gap: 7px; }
.timed-upgrade button { margin-top: auto; }
#timedResult { margin-top: 20px; padding: 20px; border: 1px solid var(--gold); border-radius: 12px; }
.timed-result-score { font-size: 1.7rem; font-weight: 800; margin: 8px 0; color: var(--gold-light); }
.timed-rank-heading { margin-top: 24px; }
#timedRankTabs { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; gap: 6px; }
#timedGames #timedRankTabs button { min-height: 36px; padding: 6px 8px; border-radius: 8px; white-space: nowrap; font-size: 0.8rem; }
#timedRankTabs button { margin: 0; background: #1a2630; color: var(--muted); box-shadow: none; border: 1px solid #4c4936; }
#timedRankTabs button.is-active { background: var(--gold); color: #151515; }
#timedRanking { margin-top: 12px; }
#timedRanking .leaderboard-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
.timed-history { margin-top: 18px; border-top: 1px solid #4c4936; padding-top: 16px; font-size: 0.85rem; }
.timed-history summary { cursor: pointer; color: var(--gold-light); }
.timed-modal-open { overflow: hidden; }
#timedDialog {
    position: fixed;
    margin: auto;
    width: min(1040px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #82703d;
    border-radius: 18px;
    background: #111b25;
    color: var(--text);
    box-shadow: 0 24px 80px #0009;
    scrollbar-gutter: stable;
}
#timedDialog::backdrop { background: #03070dcc; backdrop-filter: blur(4px); }
.timed-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#timedGames #timedDialogTitle { margin: 0; font-size: 1.15rem; }
#timedGames #timedClose { width: 36px; height: 36px; min-height: 36px; padding: 0; margin: 0; flex-shrink: 0; background: #263440; color: var(--text); border-radius: 9px; box-shadow: none; }
#timedHistory p { margin-top: 8px; }
#timedError { color: var(--danger); margin-top: 12px; }
@media (max-width: 850px) {
    .timed-dialog-content { grid-template-columns: 1fr; }
    #timedRankingPanel { grid-row: 1; }
    #timedRankingPanel .leaderboard-row { padding: 5px 8px; }
    #timedRankingPanel .timed-help { margin: 8px 0; }
}
@media (max-width: 600px) {
    #timedGames { padding: 16px; }
    .timed-heading { gap: 4px; margin-bottom: 8px; }
    .timed-reward { font-size: 0.85rem; }
    .timed-modes, .timed-upgrades { grid-template-columns: 1fr; }
    .timed-mode { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px; }
    .timed-mode-heading { justify-content: flex-start; }
    .timed-mode > p { grid-column: 1; }
    .timed-mode .timed-prizes { margin-top: 0; font-size: 0.7rem; }
    .timed-mode-actions { grid-column: 2; grid-row: 1 / 4; flex-direction: column; justify-content: center; gap: 5px; margin: 0; }
    #timedGames .timed-mode-actions button { padding: 6px 12px; }
    #timedDialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); padding: 12px; scrollbar-gutter: auto; }
    .timed-upgrade { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; }
    .timed-upgrade p { grid-column: 1; }
    .timed-upgrade button { grid-column: 2; grid-row: 1 / 4; align-self: center; margin: 0; }
    #timedArena { padding: 12px; }
    .timed-stats { gap: 6px; }
    #timedRanking .leaderboard-row { gap: 6px; }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    min-height: 100vh;
    padding: 24px;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 217, 102, 0.16), transparent 34%),
        linear-gradient(145deg, #1a2a3a 0%, var(--bg) 58%, #07090d 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-family: "Orbitron", system-ui, sans-serif;
}

h1 {
    margin-top: min(6vh, 42px);
    margin-bottom: 26px;
    color: var(--gold-light);
    font-size: clamp(2.2rem, 6vw, 4rem);
    font-weight: 800;
    letter-spacing: 0;
    text-align: center;
    text-shadow: 0 4px 0 var(--gold-dark), 0 0 28px rgba(255, 217, 102, 0.34);
}

form,
#game,
#leaderboard {
    width: min(100%, 380px);
    padding: 30px;
    border: 1px solid rgba(255, 217, 102, 0.34);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(37, 45, 52, 0.92), var(--panel));
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 245, 180, 0.12);
    animation: fadeIn 0.45s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    margin-bottom: 22px;
    color: var(--gold-light);
    font-size: 1.45rem;
    text-align: center;
    text-shadow: 0 0 18px rgba(255, 217, 102, 0.28);
}

label {
    display: block;
    margin: 16px 0 7px;
    color: var(--muted);
    font-size: 0.82rem;
}

input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid rgba(255, 217, 102, 0.38);
    border-radius: 12px;
    outline: none;
    color: var(--text);
    background: #0b1118;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.35);
    font: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder {
    color: rgba(255, 247, 214, 0.42);
}

input:focus {
    border-color: var(--gold-light);
    background: #0d151d;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(255, 217, 102, 0.12);
}

button {
    width: 100%;
    min-height: 52px;
    margin-top: 24px;
    margin-bottom: 18px;
    padding: 14px 18px;
    border: none;
    border-radius: 80px;
    color: #2c1a0a;
    background: radial-gradient(circle at 30% 10%, var(--gold-light), var(--gold));
    box-shadow: 0 9px 0 var(--gold-dark), 0 12px 24px rgba(0, 0, 0, 0.36);
    cursor: pointer;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: 0;
    transition: transform 0.07s linear, box-shadow 0.07s linear, filter 0.16s ease;
}

button:hover {
    filter: brightness(1.08);
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 5px 0 var(--gold-dark), 0 8px 18px rgba(0, 0, 0, 0.32);
}

button:disabled {
    cursor: default;
    color: rgba(255, 247, 214, 0.48);
    background: linear-gradient(180deg, rgba(255, 217, 102, 0.08), rgba(255, 217, 102, 0.02));
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.08);
    filter: none;
}

button:disabled:active {
    transform: none;
}

form p {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.6;
    text-align: center;
}

#form-login {
    display: none;
}

span.change-link {
    display: inline-block;
    color: var(--gold-light);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(255, 217, 102, 0.48);
    text-underline-offset: 4px;
    transition: color 0.18s ease, transform 0.18s ease;
}

span.change-link:hover {
    color: #fff2b0;
    transform: translateY(-1px);
}

#gameLayout {
    width: min(100%, 900px);
    display: none;
    grid-template-columns: minmax(0, 560px) minmax(260px, 300px);
    align-items: start;
    gap: 20px;
}

#game {
    width: min(100%, 560px);
    text-align: center;
    overflow: visible;
}

#leaderboard {
    width: 100%;
    padding: 22px;
    position: sticky;
    top: 18px;
}

.leaderboard-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.leaderboard-heading h2 {
    margin: 0;
    font-size: 1.1rem;
}

.leaderboard-caption {
    margin: 8px 0 14px;
    color: var(--muted);
    font-size: 0.75rem;
    text-align: center;
}

.leaderboard-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin: 0 0 14px;
}

.leaderboard-tabs button {
    min-height: 34px;
    margin: 0;
    padding: 6px 4px;
    border: 1px solid rgba(255, 217, 102, 0.22);
    border-radius: 9px;
    color: var(--gold-soft);
    background: rgba(255, 217, 102, 0.06);
    box-shadow: none;
    font-size: 0.75rem;
    line-height: 1.1;
}

.leaderboard-tabs button.is-active {
    color: #2c1a0a;
    background: radial-gradient(circle at 30% 10%, var(--gold-light), var(--gold));
    box-shadow: 0 3px 0 var(--gold-dark);
}

.leaderboard-list {
    display: grid;
    gap: 7px;
}

.leaderboard-row {
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(255, 217, 102, 0.16);
    border-radius: 10px;
    background: rgba(10, 15, 21, 0.46);
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    font-size: 0.75rem;
}

.leaderboard-row.is-current {
    border-color: rgba(255, 217, 102, 0.7);
    background: rgba(230, 184, 0, 0.12);
    box-shadow: 0 0 14px rgba(255, 217, 102, 0.12);
}

.leaderboard-rank {
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.leaderboard-rank.rank-1 { color: #ffe58a; }
.leaderboard-rank.rank-2 { color: #d9e2ec; }
.leaderboard-rank.rank-3 { color: #e5a66f; }

.leaderboard-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-score {
    color: var(--gold-light);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 700;
}

.leaderboard-divider {
    height: 1px;
    margin: 14px 8px;
    background: linear-gradient(90deg, transparent, rgba(255, 217, 102, 0.48), transparent);
}

.leaderboard-position {
    margin: 0 0 8px;
    color: var(--gold-soft);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

#gameData {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

#gameData p {
    color: var(--muted);
    font-size: 0.88rem;
}

#name,
#clickForce {
    color: var(--gold-light);
}

#countBox {
    position: relative;
    width: 100%;
    min-height: 86px;
    margin-top: 0;
    padding: 12px 22px;
    border: 1px solid rgba(255, 217, 102, 0.38);
    border-radius: 60px;
    background: var(--panel-strong);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

#stickyControls {
    position: sticky;
    top: 12px;
    z-index: 20;
    margin: 0 -10px 18px;
    padding: 10px;
    border: 1px solid rgba(255, 217, 102, 0.18);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(17, 23, 32, 0.96), rgba(17, 23, 32, 0.82));
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(10px);
}

#countBox::before {
    content: "₽";
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #2c1a0a;
    background: radial-gradient(circle at 30% 10%, var(--gold-light), var(--gold));
    box-shadow: 0 4px 0 var(--gold-dark), inset 0 1px 1px rgba(255, 255, 255, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    font-weight: 900;
}

#userCount {
    min-width: 72px;
    color: transparent;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    background-clip: text;
    -webkit-background-clip: text;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    text-shadow: 0 0 16px rgba(255, 217, 102, 0.28);
}

.count-rank-base {
    background-image: linear-gradient(135deg, #fff7d6, var(--gold-light));
}

.count-rank-k {
    background-image: linear-gradient(135deg, #ffe08a, #f0b429);
}

.count-rank-m {
    background-image: linear-gradient(135deg, #8fffd2, #20d6a4);
}

.count-rank-b {
    background-image: linear-gradient(135deg, #9ad7ff, #4b8dff);
}

.count-rank-t {
    background-image: linear-gradient(135deg, #f8a8ff, #b35cff);
}

.count-rank-qa {
    background-image: linear-gradient(135deg, #ffb36b, #ff5f6d);
}

.count-rank-qi {
    background-image: linear-gradient(135deg, #c4ff72, #57d957);
}

.count-rank-sx {
    background-image: linear-gradient(135deg, #7df9ff, #2f6bff);
}

.count-rank-sp {
    background-image: linear-gradient(135deg, #ffd1f3, #ff4fb8);
}

.count-rank-oc {
    background-image: linear-gradient(135deg, #fff0a6, #ff8a00);
}

.count-rank-no {
    background-image: linear-gradient(135deg, #d5c7ff, #6f5cff);
}

.count-rank-dc {
    background-image: linear-gradient(135deg, #ffffff, #ffd966 35%, #ff4f8b 70%, #7df9ff);
}

#clickMe {
    min-height: 68px;
    margin-top: 10px;
    margin-bottom: 6px;
    font-size: 1.65rem;
    text-transform: uppercase;
}

#clickForceUpgrade {
    margin-top: 10px;
    margin-bottom: 0;
    border: 1px solid rgba(255, 217, 102, 0.42);
    color: var(--gold-soft);
    background: linear-gradient(180deg, rgba(255, 217, 102, 0.12), rgba(255, 217, 102, 0.04));
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.08), 0 10px 20px rgba(0, 0, 0, 0.22);
    font-size: 0.78rem;
    line-height: 1.35;
}

#clickForceUpgrade:active {
    transform: translateY(2px);
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.08), 0 6px 14px rgba(0, 0, 0, 0.2);
}

#robots {
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 217, 102, 0.22);
}

#robots h2 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

#robotsIncome {
    margin-bottom: 16px;
    color: var(--gold-soft);
    font-size: 0.86rem;
}

#robotsList {
    display: grid;
    gap: 12px;
}

.robot-card {
    padding: 16px;
    border: 1px solid rgba(255, 217, 102, 0.24);
    border-radius: 16px;
    background: rgba(10, 15, 21, 0.54);
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.07);
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 14px;
    align-items: center;
    text-align: left;
}

.robot-visual {
    width: 88px;
    height: 104px;
    position: relative;
    display: grid;
    justify-items: center;
    align-items: end;
    filter: saturate(0.75);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.robot-card:hover .robot-visual {
    transform: translateY(-2px);
}

.robot-antenna {
    width: 4px;
    height: 14px;
    border-radius: 8px;
    background: rgba(255, 217, 102, 0.35);
    position: absolute;
    top: 0;
}

.robot-antenna::before {
    content: "";
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: rgba(255, 217, 102, 0.35);
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
}

.robot-head {
    width: 66px;
    height: 38px;
    border: 1px solid rgba(255, 217, 102, 0.28);
    border-radius: 16px 16px 10px 10px;
    background: linear-gradient(180deg, #30363d, #161d26);
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.robot-eye {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 217, 102, 0.42);
    box-shadow: 0 0 8px rgba(255, 217, 102, 0.2);
}

.robot-body {
    width: 78px;
    height: 54px;
    margin-top: -2px;
    border: 1px solid rgba(255, 217, 102, 0.24);
    border-radius: 12px 12px 20px 20px;
    background: linear-gradient(180deg, #202832, #10161e);
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.1);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 12px 10px;
}

.robot-body span {
    border-radius: 8px;
    background: rgba(255, 217, 102, 0.16);
}

.robot-level-0 {
    opacity: 0.55;
}

.robot-level-1,
.robot-level-2,
.robot-level-3,
.robot-level-4,
.robot-level-5 {
    filter: saturate(1);
}

.robot-level-1 .robot-head,
.robot-level-1 .robot-body,
.robot-level-2 .robot-head,
.robot-level-2 .robot-body,
.robot-level-3 .robot-head,
.robot-level-3 .robot-body,
.robot-level-4 .robot-head,
.robot-level-4 .robot-body,
.robot-level-5 .robot-head,
.robot-level-5 .robot-body {
    border-color: rgba(255, 217, 102, 0.55);
}

.robot-level-2 .robot-head,
.robot-level-3 .robot-head,
.robot-level-4 .robot-head,
.robot-level-5 .robot-head {
    background: linear-gradient(180deg, #4a3f21, #191d22);
}

.robot-level-3 .robot-body,
.robot-level-4 .robot-body,
.robot-level-5 .robot-body {
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.14), 0 0 18px rgba(255, 217, 102, 0.13);
}

.robot-level-4 {
    transform: scale(1.04);
}

.robot-level-5 {
    transform: scale(1.08);
}

.robot-level-5 .robot-head,
.robot-level-5 .robot-body {
    background: radial-gradient(circle at 30% 10%, rgba(255, 217, 102, 0.32), transparent 42%), linear-gradient(180deg, #5a471d, #171c22);
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.18), 0 0 24px rgba(255, 217, 102, 0.2);
}

.robot-level-1 .robot-body span:nth-child(1),
.robot-level-2 .robot-body span:nth-child(-n+2),
.robot-level-3 .robot-body span:nth-child(-n+3),
.robot-level-4 .robot-body span:nth-child(-n+4),
.robot-level-5 .robot-body span:nth-child(-n+5) {
    background: radial-gradient(circle at 30% 10%, var(--gold-light), var(--gold));
    box-shadow: 0 0 10px rgba(255, 217, 102, 0.32);
}

.robot-level-1 .robot-eye,
.robot-level-2 .robot-eye,
.robot-level-3 .robot-eye,
.robot-level-4 .robot-eye,
.robot-level-5 .robot-eye,
.robot-level-1 .robot-antenna,
.robot-level-2 .robot-antenna,
.robot-level-3 .robot-antenna,
.robot-level-4 .robot-antenna,
.robot-level-5 .robot-antenna,
.robot-level-1 .robot-antenna::before,
.robot-level-2 .robot-antenna::before,
.robot-level-3 .robot-antenna::before,
.robot-level-4 .robot-antenna::before,
.robot-level-5 .robot-antenna::before {
    background: var(--gold-light);
    box-shadow: 0 0 12px rgba(255, 217, 102, 0.45);
}

.robot-info {
    min-width: 0;
}

.robot-card h3 {
    margin-bottom: 8px;
    color: var(--gold-light);
    font-size: 1rem;
}

.robot-card p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.robot-card button {
    grid-column: 1 / -1;
    min-height: 44px;
    margin: 14px 0 0;
    padding: 11px 14px;
    font-size: 0.78rem;
    box-shadow: 0 6px 0 var(--gold-dark), 0 8px 16px rgba(0, 0, 0, 0.28);
}

.ranking-income-pop {
    display: inline-block;
    opacity: 0;
    pointer-events: none;
    padding: 4px 10px;
    border: 1px solid #d3ad53;
    border-radius: 10px;
    background: #292211;
    color: #ffe49b;
    font: 700 0.78rem/1.4 system-ui, sans-serif;
    text-shadow: none;
    box-shadow: 0 4px 14px #0005;
}
#rankingIncomePop { position: absolute; bottom: -10px; right: 14px; max-width: calc(100% - 28px); z-index: 2; }
.ranking-income-slot { min-height: 30px; margin-top: 5px; }
#timedRankingIncomePop { max-width: 100%; }

.auto-income-pop {
    position: fixed;
    z-index: 9998;
    color: var(--gold-light);
    font-family: "Orbitron", system-ui, sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    text-shadow: 0 0 14px rgba(255, 217, 102, 0.6);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: autoIncomePop 0.9s ease-out forwards;
}

@keyframes autoIncomePop {
    0% {
        opacity: 0;
        transform: translate(-50%, -20%) scale(0.86);
    }

    18% {
        opacity: 1;
        transform: translate(-50%, -55%) scale(1.08);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -145%) scale(1);
    }
}

.robot-card button:active {
    transform: translateY(3px);
    box-shadow: 0 3px 0 var(--gold-dark), 0 6px 14px rgba(0, 0, 0, 0.24);
}

.ruble-fly {
    position: fixed;
    z-index: 9999;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #2d2b0e;
    background: radial-gradient(circle at 30% 30%, var(--gold-light), #f4b400);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 200, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-family: "Segoe UI", Arial, monospace;
    font-size: 1.6rem;
    font-weight: bold;
    text-shadow: 0 1px 0 rgba(255, 245, 160, 0.8);
    transition: transform 0.45s cubic-bezier(0.25, 0.9, 0.4, 1.2);
    will-change: transform;
}

.ruble-fly::before {
    content: "₽";
    font-size: 1.7rem;
    font-weight: 900;
}

.ruble-fly::after {
    content: "";
    position: absolute;
    top: 5px;
    left: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 245, 180, 0.6);
    opacity: 0.8;
}

@media (max-width: 420px) {
    body {
        padding: 16px;
    }

    form,
    #game {
        padding: 22px;
    }

    .robot-card {
        padding: 14px;
        grid-template-columns: 78px 1fr;
        gap: 12px;
    }

    .robot-visual {
        width: 76px;
        height: 92px;
    }

    .robot-head {
        width: 58px;
    }

    .robot-body {
        width: 68px;
        height: 48px;
    }

    #userCount {
        font-size: 2.5rem;
    }

    #clickMe {
        font-size: 1.35rem;
    }
}

@media (max-width: 760px) {
    #gameLayout {
        grid-template-columns: minmax(0, 560px);
        justify-content: center;
    }

    #game,
    #leaderboard {
        width: 100%;
    }

    #leaderboard {
        position: static;
    }
}


#endgame {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 217, 102, 0.22);
}

#endgame h2 {
    margin-bottom: 14px;
    font-size: 1.2rem;
}

.endgame-panel,
.endgame-card {
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 217, 102, 0.24);
    border-radius: 16px;
    background: rgba(10, 15, 21, 0.56);
    box-shadow: inset 0 1px 0 rgba(255, 245, 180, 0.07);
    text-align: left;
}

.endgame-panel {
    display: grid;
    gap: 10px;
}

.endgame-panel h3,
.endgame-card h3 {
    margin-bottom: 8px;
    color: var(--gold-light);
    font-size: 1rem;
}

.endgame-panel p,
.endgame-card p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.endgame-panel button,
.endgame-card button {
    min-height: 42px;
    margin: 12px 0 0;
    padding: 10px 14px;
    font-size: 0.74rem;
    box-shadow: 0 5px 0 var(--gold-dark), 0 8px 16px rgba(0, 0, 0, 0.24);
}

.endgame-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.endgame-tabs button {
    min-height: 38px;
    margin: 0;
    padding: 8px;
    border: 1px solid rgba(255, 217, 102, 0.28);
    color: var(--gold-soft);
    background: rgba(255, 217, 102, 0.08);
    box-shadow: none;
    font-size: 0.68rem;
}

.endgame-tabs button.is-active {
    color: #2c1a0a;
    background: radial-gradient(circle at 30% 10%, var(--gold-light), var(--gold));
    box-shadow: 0 4px 0 var(--gold-dark);
}

#endgameContent {
    display: grid;
    gap: 12px;
}

.endgame-card.is-unlocked {
    border-color: rgba(143, 255, 210, 0.42);
    background: rgba(18, 44, 36, 0.38);
}

.robot-card.is-locked {
    opacity: 0.66;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.inline-check input {
    width: auto;
}

.theme-gold_theme #game {
    border-color: rgba(255, 217, 102, 0.7);
    box-shadow: 0 26px 54px rgba(230, 184, 0, 0.18), inset 0 1px 0 rgba(255, 245, 180, 0.18);
}

.theme-neon_theme #countBox {
    border-color: rgba(125, 249, 255, 0.56);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 24px rgba(125, 249, 255, 0.22);
}

.theme-royal_theme #game {
    background: linear-gradient(180deg, rgba(56, 38, 66, 0.94), rgba(18, 18, 28, 0.9));
    border-color: rgba(248, 168, 255, 0.48);
}

@media (min-width: 560px) {
    #endgameContent {
        grid-template-columns: repeat(2, 1fr);
    }

    #investmentForm {
        grid-column: 1 / -1;
    }
}

/* Shared palette: every theme colors the entire game, including modal games. */
:root {
    --bg: #101522; --panel: #1a2233; --panel-strong: #141c2b;
    --gold: #efb951; --gold-light: #ffce73; --gold-soft: #ffda96; --gold-dark: #8b6123;
    --text: #f0f3fa; --muted: #a5b0c6; --line: #ffffff12;
    --glow: #eab95812; --radius: 22px;
    color-scheme: dark;
}
body.theme-ocean_theme { --bg:#091b2a; --panel:#102c40; --panel-strong:#0b2334; --gold:#41c5dd; --gold-light:#87e8f6; --gold-soft:#b7f1ff; --gold-dark:#186078; --muted:#9ebfce; --glow:#41c5dd18; }
body.theme-sakura_theme { --bg:#241522; --panel:#392337; --panel-strong:#2e1b2d; --gold:#ed91b8; --gold-light:#ffc1dc; --gold-soft:#ffd5e7; --gold-dark:#91506c; --muted:#c8a9c0; --glow:#ed91b81b; }
body.theme-forest_theme { --bg:#0d211b; --panel:#18352c; --panel-strong:#112920; --gold:#65cc99; --gold-light:#a0efc5; --gold-soft:#b7f6d5; --gold-dark:#306e4e; --muted:#a1c0b2; --glow:#65cc9918; }
body.theme-sunset_theme { --bg:#28191d; --panel:#40292b; --panel-strong:#321e23; --gold:#f49870; --gold-light:#ffc4a3; --gold-soft:#ffd9b7; --gold-dark:#915239; --muted:#cfafa9; --glow:#f498701a; }
body.theme-cosmos_theme { --bg:#16132b; --panel:#28223f; --panel-strong:#1e1a33; --gold:#a895f6; --gold-light:#d0c3ff; --gold-soft:#e3d9ff; --gold-dark:#60509c; --muted:#b2aacd; --glow:#a895f61c; }
body.theme-gold_theme { --bg:#201b12; --panel:#322b1d; --panel-strong:#282116; --gold:#efc45d; --gold-light:#ffe4a0; --gold-dark:#937330; --muted:#c9bb9c; --glow:#efc45d1a; }
body.theme-neon_theme { --bg:#091c23; --panel:#132f38; --panel-strong:#0c232d; --gold:#5ceac6; --gold-light:#9bffe8; --gold-dark:#217a6c; --muted:#9ebbc4; --glow:#5ceac61a; }
body.theme-royal_theme { --bg:#21162e; --panel:#352444; --panel-strong:#291d36; --gold:#c993ed; --gold-light:#e7c0ff; --gold-dark:#81519d; --muted:#bfadcc; --glow:#c993ed1a; }
body {
    padding: 0 32px 48px; font-family: "Segoe UI", system-ui, sans-serif; line-height: 1.5;
    background: radial-gradient(ellipse at 12% 10%, var(--glow), transparent 48%), var(--bg);
}
button, input, select { font-family: inherit; }
button { border-radius: 12px; box-shadow: none; font-weight: 650; min-height: 44px; transition: background .18s, transform .15s, border-color .18s; }
button:active { transform: translateY(1px); box-shadow: none; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 4px; }
h1, h2 { text-shadow: none; letter-spacing: -.025em; }
h2 { color: var(--text); font-size: 1.2rem; }
.app-header { width: min(100%, 1180px); min-height: 96px; display:flex; align-items:center; justify-content:space-between; gap:24px; border-bottom:1px solid var(--line); margin-bottom:28px; }
.brand { display:flex; align-items:center; gap:12px; text-decoration:none; color:var(--text); font-size:1.3rem; font-weight:800; }
.brand-icon { display:grid; place-items:center; width:44px; height:44px; color:var(--bg); background:var(--gold-light); border-radius:14px; font-size:1.8rem; }
.brand small { display:block; color:var(--muted); font-size:.56rem; letter-spacing:.14em; font-weight:500; margin-top:2px; }
.header-tag { color:var(--muted); font-size:.78rem; }
#gameLayout { width:min(100%, 1180px); grid-template-columns:minmax(0, 1fr) 330px; gap:24px; }
.player-toolbar { grid-column:1/-1; display:flex; align-items:center; gap:18px; padding:4px 0 10px; min-width:0; }
.profile-avatar { width:72px; height:72px; flex-shrink:0; padding:0; margin:0; background:var(--panel); border:2px solid var(--line); border-radius:22px; position:relative; }
.profile-avatar::after { content:"✎"; position:absolute; right:-4px; bottom:-3px; background:var(--gold-light); color:var(--bg); border:3px solid var(--bg); border-radius:50%; width:26px; height:26px; font-size:15px; }
.profile-avatar svg { width:100%; height:100%; border-radius:inherit; }
.player-welcome { min-width:0; }
.player-welcome h1 { margin:0; text-align:left; font-size:1.8rem; line-height:1.3; color:var(--text); overflow-wrap:anywhere; }
.player-welcome p { color:var(--muted); font-size:.82rem; margin-top:4px; }
.eyebrow { color:var(--muted); font-size:.64rem; letter-spacing:.14em; font-weight:700; }
button.quiet-button { background:var(--panel); color:var(--text); border:1px solid var(--line); box-shadow:none; width:auto; margin:0; padding:10px 16px; font-size:.85rem; }
#openAppearance { margin-left:auto; white-space:nowrap; }
#logoutButton { white-space:nowrap; color:var(--muted); }
form, #game, #leaderboard, #timedGames, body.theme-royal_theme #game { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 12px 36px #00000014; }
body > form { margin:24px 0; width:min(100%, 420px); }
input, input:focus, #investmentForm select { background:var(--panel-strong); border-color:var(--line); box-shadow:none; }
input { user-select:text; }
input::placeholder { color:var(--muted); opacity:.7; }
#game { width:100%; padding:26px; }
#gameData { display:flex; justify-content:space-between; gap:12px; margin-bottom:16px; padding:0; background:transparent; border:0; }
#gameData p { color:var(--muted); font-size:.78rem; }
#gameData span { display:inline-block; margin-left:6px; font-weight:700; }
#stickyControls { position:relative; top:0; z-index:1; padding:24px; margin:0; border:1px solid var(--line); border-radius:18px; background:radial-gradient(ellipse at 50% 85%, var(--glow), transparent 70%), var(--panel-strong); box-shadow:none; backdrop-filter:none; }
.balance-label { display:block; text-align:center; }
#countBox, body.theme-neon_theme #countBox { min-height:78px; padding:4px; border:0; box-shadow:none; background:transparent; }
#countBox::before { display:none; }
#userCount { font-family:inherit; font-size:clamp(2.3rem, 5vw, 3.8rem); letter-spacing:-.06em; text-shadow:none; overflow-wrap:anywhere; min-width:0; }
#clickMe { position:relative; width:180px; height:180px; margin:12px auto 16px; border-radius:50%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0; color:#202333; background:radial-gradient(circle at 35% 25%, var(--gold-soft), var(--gold)); border:8px solid var(--gold-light); box-shadow:0 8px 0 var(--gold-dark), 0 0 0 12px var(--glow), 0 16px 35px #0003; text-transform:none; font-size:1.3rem; touch-action:manipulation; }
#clickMe:hover { transform:translateY(-2px); }
#clickMe:active { transform:translateY(5px) scale(.97); box-shadow:0 3px 0 var(--gold-dark), 0 0 0 15px var(--glow); }
.click-symbol { font-size:3.7rem; line-height:1.05; }
#clickMe small { font-size:.56rem; max-width:120px; font-weight:600; }
#clickForceUpgrade { margin:18px 0 6px; background:var(--glow); border-color:var(--line); box-shadow:none; border-radius:12px; font-size:.85rem; }
#robots, #endgame { margin-top:26px; padding-top:24px; border-top:1px solid var(--line); }
#robots h2, #endgame h2 { display:flex; justify-content:space-between; text-align:left; font-size:1.15rem; margin-bottom:8px; }
.section-icon { color:var(--gold-light); }
#robotsIncome { color:var(--muted); line-height:1.7; font-size:.76rem; }
.robot-card, .endgame-panel, .endgame-card { background:var(--panel-strong); border:1px solid var(--line); border-radius:16px; box-shadow:none; }
.robot-card { padding:18px; }
.robot-card h3 { color:var(--text); font-size:1rem; }
.robot-info p { color:var(--muted); line-height:1.55; }
.robot-card button, .endgame-panel button, .endgame-card button { box-shadow:none; border-radius:10px; font-size:.8rem; }
.endgame-tabs { grid-template-columns:repeat(3, 1fr); }
.endgame-tabs button { border-color:var(--line); color:var(--muted); background:var(--panel-strong); font-size:.73rem; border-radius:10px; }
.endgame-tabs button.is-active { box-shadow:none; background:var(--gold-light); color:#202333; }
#timedGames { padding:20px; }
#timedGames h2 { font-size:1.15rem; margin-bottom:4px; }
.timed-heading { margin-bottom:16px; }
.timed-reward { font-size:.78rem; border:1px solid var(--line); background:var(--glow); border-radius:20px; padding:6px 12px; }
.timed-mode, .timed-upgrade, #timedArena, #timedRankingPanel { background:var(--panel-strong); border-color:var(--line); }
.timed-mode { padding:16px; position:relative; overflow:hidden; }
.timed-mode::before { content:""; position:absolute; top:0; left:0; right:0; height:3px; background:var(--gold); opacity:.65; }
.timed-mode:nth-child(2)::before { opacity:.4; }
.timed-mode:nth-child(3)::before { opacity:.22; }
.timed-mode h3 { font-size:1.05rem; }
.timed-mode p { color:var(--muted); }
#timedGames .timed-secondary { border-color:var(--line); }
#timedDialog, #adDialog { background:var(--panel); border-color:var(--line); }
#timedCountdown { background:var(--panel-strong); }
#timedRankTabs button, #timedGames #timedClose { background:var(--panel-strong); border-color:var(--line); }
#timedRankTabs button.is-active { background:var(--gold-light); }
#leaderboard { padding:22px; top:20px; }
.leaderboard-heading { justify-content:flex-start; }
.leaderboard-caption { text-align:left; }
.leaderboard-tabs button { border-color:var(--line); border-radius:8px; background:var(--panel-strong); }
.leaderboard-tabs button.is-active { background:var(--gold-light); color:#202333; box-shadow:none; }
.leaderboard-row { background:transparent; border-color:var(--line); gap:8px; padding:10px 4px; }
.leaderboard-row.is-current { background:var(--glow); border-color:var(--gold-dark); }
.leaderboard-identity { display:flex; align-items:center; gap:9px; min-width:0; }
.leaderboard-player { display:flex; flex-direction:column; gap:4px; min-width:0; }
.leaderboard-name-line { display:flex; align-items:center; gap:4px; min-width:0; }
.verified-badge { display:inline-flex; width:18px; height:18px; flex:0 0 18px; color:#69b9ff; vertical-align:-2px; margin-left:6px; }
.verified-badge svg { display:block; width:100%; height:100%; }
.player-badges { display:inline-flex; flex-wrap:wrap; gap:4px; vertical-align:middle; margin-left:6px; }
.player-badge { display:inline-flex; align-items:center; justify-content:center; width:23px; height:23px; border:1px solid var(--badge-color); color:var(--badge-color); background:#1b2336; border-radius:7px; font-size:14px; }
.leaderboard-player .player-badges { margin-left:0; max-width:100%; }
.leaderboard-player .player-badge { width:20px; height:20px; font-size:12px; }
.leaderboard-identity .verified-badge { margin-left:-4px; }
#welcomeName .verified-badge { width:23px; height:23px; vertical-align:0; }
.leaderboard-avatar { width:34px; height:34px; flex-shrink:0; }
.leaderboard-avatar svg { display:block; width:100%; height:100%; border-radius:25%; }
.leaderboard-name { font-size:.8rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.leaderboard-score { font-size:.78rem; }
#playerProgression { grid-column:1/-1; min-width:0; padding:24px; border:1px solid var(--line); border-radius:var(--radius); background:radial-gradient(ellipse at top left, var(--glow), transparent 65%), var(--panel); }
.progression-overview { display:flex; align-items:center; gap:24px; }
.level-emblem { width:98px; height:108px; flex-shrink:0; display:flex; flex-direction:column; justify-content:center; align-items:center; color:var(--badge-color, var(--gold-light)); background:var(--panel-strong); clip-path:polygon(50% 0, 96% 22%, 96% 74%, 50% 100%, 4% 74%, 4% 22%); }
.level-emblem span { font-size:.56rem; letter-spacing:.12em; }
.level-emblem strong { font-size:2.35rem; line-height:1.2; font-variant-numeric:tabular-nums; }
.progression-main { flex:1; min-width:0; }
.progression-title { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; margin:4px 0 8px; }
#progressionTitle { font-size:1.18rem; margin:0; text-align:left; }
#levelProgressText { font-size:.84rem; color:var(--muted); margin-bottom:10px; }
#levelProgress { appearance:none; display:block; width:100%; height:9px; border:0; border-radius:20px; background:var(--panel-strong); accent-color:var(--gold-light); overflow:hidden; }
#levelProgress::-webkit-progress-bar { background:var(--panel-strong); }
#levelProgress::-webkit-progress-value { background:linear-gradient(90deg, var(--gold-dark), var(--gold-light)); border-radius:20px; transition:width .35s ease; }
#levelProgress::-moz-progress-bar { background:var(--gold-light); border-radius:20px; }
.progression-stats { display:flex; justify-content:space-between; flex-wrap:wrap; gap:4px 12px; margin-top:7px; font-size:.7rem; color:var(--muted); font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.level-badge { display:inline-flex; align-items:center; gap:6px; color:var(--badge-color); font-size:.74rem; font-weight:650; }
.level-badge-icon { display:inline-grid; place-items:center; width:26px; height:28px; flex-shrink:0; background:var(--panel-strong); border:1px solid var(--badge-color); border-radius:8px 8px 12px 12px; font-size:1rem; }
.level-badge.is-compact { font-size:.61rem; gap:4px; min-width:0; }
.level-badge.is-compact .level-badge-icon { width:17px; height:19px; font-size:.7rem; border-radius:5px 5px 8px 8px; }
.level-badge.is-compact > span:last-child { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
#levelRewards { margin-top:18px; padding-top:14px; border-top:1px solid var(--line); }
#levelRewards summary { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:7px; cursor:pointer; font-size:.83rem; min-height:32px; }
#levelRewards summary > span:first-child::before { content:"▸ "; color:var(--gold-light); }
#levelRewards[open] summary > span:first-child::before { content:"▾ "; }
#levelRewards summary:focus-visible { outline:2px solid var(--gold-light); outline-offset:4px; border-radius:5px; }
#badgeCount { color:var(--gold-light); margin-left:8px; }
#nextBadgeHint { color:var(--muted); font-size:.72rem; }
.progression-help { color:var(--muted); font-size:.77rem; margin:12px 0 16px; line-height:1.65; }
#levelRewardTrack { display:grid; grid-template-columns:repeat(7, minmax(0, 1fr)); gap:10px; }
.level-reward { background:var(--panel-strong); border:1px solid var(--line); padding:15px 8px 12px; border-radius:14px; text-align:center; min-width:0; }
.reward-medallion { display:grid; place-items:center; width:48px; height:55px; margin:0 auto 12px; color:var(--muted); background:var(--panel); clip-path:polygon(50% 0, 95% 23%, 88% 77%, 50% 100%, 12% 77%, 5% 23%); font-size:1.65rem; }
.level-reward.is-earned .reward-medallion { background:var(--badge-color); color:var(--panel-strong); }
.level-reward.is-earned { border-color:color-mix(in srgb, var(--badge-color) 35%, transparent); }
.level-reward.is-next { border-color:var(--gold-dark); }
.level-reward h3 { font-size:.77rem; min-height:2.9em; line-height:1.35; }
.level-reward p { font-size:.67rem; color:var(--muted); margin-top:4px; overflow-wrap:anywhere; }
.reward-status { display:block; font-size:.6rem; color:var(--muted); margin-top:12px; }
.is-earned .reward-status { color:var(--badge-color); }
#levelUpNotice { padding:12px 15px; margin-top:16px; background:var(--glow); border:1px solid var(--gold-dark); border-radius:12px; color:var(--gold-light); font-size:.88rem; }
@media (max-width:1000px) { #levelRewardTrack { grid-template-columns:repeat(4, minmax(0, 1fr)); } }
@media (max-width:600px) {
    #playerProgression { padding:16px; }
    .progression-overview { gap:12px; align-items:flex-start; }
    .level-emblem { width:65px; height:78px; }
    .level-emblem strong { font-size:1.8rem; }
    .level-emblem span { font-size:.45rem; }
    #progressionTitle { font-size:.98rem; }
    #levelRewardTrack { grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .progression-stats { font-size:.65rem; }
}
.leaderboard-divider, .timed-history { border-color:var(--line); }
.ad-offer { background:var(--panel-strong); border-color:var(--line); }
.ad-creative { background:var(--panel-strong); border-color:var(--line); }
#appearanceDialog { width:min(720px, calc(100% - 32px)); max-height:calc(100dvh - 32px); margin:auto; padding:28px; overflow:auto; border:1px solid var(--line); border-radius:24px; background:var(--panel); color:var(--text); box-shadow:0 30px 120px #0008; }
#appearanceDialog::backdrop { background:#080c16c9; backdrop-filter:blur(8px); }
body:has(#appearanceDialog[open]) { overflow:hidden; }
.appearance-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.appearance-heading h2 { text-align:left; margin:3px 0 0; font-size:1.65rem; }
.appearance-tabs { display:flex; gap:8px; padding:5px; background:var(--panel-strong); border-radius:13px; margin:22px 0 16px; }
.appearance-tabs button { margin:0; background:transparent; color:var(--muted); font-size:.85rem; }
.appearance-tabs button[aria-pressed="true"] { color:#202333; background:var(--gold-light); }
.appearance-help { color:var(--muted); font-size:.85rem; margin:0 0 18px; }
#themeChoices { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; }
button.theme-choice { display:flex; flex-direction:column; text-align:left; margin:0; padding:8px; border:2px solid transparent; border-radius:14px; background:var(--panel-strong); color:var(--text); box-shadow:none; }
.theme-choice[aria-pressed="true"] { border-color:var(--gold-light); }
.theme-choice:disabled { opacity:.65; }
.theme-choice strong { margin:8px 4px 0; font-size:.9rem; }
.theme-choice small { color:var(--muted); font-size:.64rem; font-weight:400; margin:2px 4px 6px; }
.theme-sample { width:100%; height:84px; border-radius:8px; background:var(--sample-bg); display:flex; gap:5px; align-items:flex-end; padding:10px; position:relative; overflow:hidden; }
.theme-sample i { width:24%; height:18px; border:1px solid var(--sample-accent); border-radius:4px; opacity:.4; }
.theme-sample b { position:absolute; top:9px; left:calc(50% - 18px); width:36px; height:36px; display:grid; place-items:center; font-size:1.5rem; border-radius:50%; background:var(--sample-accent); color:var(--sample-bg); }
.avatar-stage { display:flex; gap:24px; align-items:center; padding:20px; background:var(--panel-strong); border:1px solid var(--line); border-radius:18px; }
#avatarPreview { width:132px; height:132px; flex-shrink:0; }
#avatarPreview svg { width:100%; height:100%; border-radius:25%; }
.custom-avatar-image { display:block; width:100%; height:100%; object-fit:cover; border-radius:25%; }
.avatar-upload { margin-top:18px; }
.avatar-upload-actions { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.avatar-upload .appearance-help { font-size:.75rem; margin-bottom:0; }
.avatar-stage h3 { font-size:1.05rem; margin-bottom:5px; }
.avatar-stage p { color:var(--muted); font-size:.8rem; margin-bottom:12px; }
#avatarChoices fieldset { border:0; padding:0; margin:20px 0 0; min-width:0; }
#avatarChoices legend { font-size:.78rem; color:var(--muted); margin-bottom:8px; }
.avatar-options { display:flex; gap:7px; flex-wrap:wrap; }
.avatar-options button { display:inline-flex; align-items:center; gap:7px; min-height:40px; width:auto; margin:0; padding:8px 12px; background:var(--panel-strong); color:var(--text); border:1px solid var(--line); border-radius:10px; font-size:.78rem; }
.avatar-options button[aria-pressed="true"] { border-color:var(--gold-light); background:var(--glow); }
.color-dot { width:15px; height:15px; border-radius:50%; border:1px solid #ffffff40; }
.avatar-actions { display:flex; gap:12px; margin-top:24px; }
.avatar-actions button { flex:1; margin:0; font-size:.85rem; }
#appearanceStatus { min-height:24px; margin-top:14px; color:var(--gold-light); font-size:.82rem; }
@media (max-width:900px) {
    #gameLayout { grid-template-columns:minmax(0, 1fr) 290px; gap:16px; }
    body { padding:0 20px 32px; }
    #game { padding:18px; }
    #leaderboard { padding:16px; }
}
@media (max-width:760px) {
    #gameLayout { grid-template-columns:minmax(0, 1fr); }
    #leaderboard { position:static; }
    .header-tag { display:none; }
    .app-header { min-height:80px; margin-bottom:20px; }
    .player-welcome h1 { font-size:1.45rem; }
    .player-welcome p { font-size:.72rem; }
    .profile-avatar { width:58px; height:58px; border-radius:18px; }
    .player-toolbar { gap:12px; flex-wrap:wrap; }
    #openAppearance { padding:10px; font-size:.75rem; }
    #stickyControls { padding:18px; }
}
@media (max-width:480px) {
    body { padding:0 12px 24px; }
    #game, #timedGames { padding:14px; }
    .player-welcome { flex:1; }
    .player-welcome p { max-width:175px; }
    #openAppearance { width:100%; }
    #logoutButton { width:100%; }
    #appearanceDialog { padding:18px; width:calc(100% - 16px); max-height:calc(100dvh - 16px); }
    #themeChoices { grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .avatar-stage { flex-direction:column; gap:14px; text-align:center; }
    .avatar-actions { flex-direction:column; }
    .endgame-tabs { grid-template-columns:repeat(2, 1fr); }
}
@media (prefers-reduced-motion:reduce) {
    *, *::before, *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}
