:root {
    --control-size: clamp(46px, 3.6vw, 62px);
    --primary: rgb(32, 169, 254);
    --bg: #0b0f1a;
    --text: rgb(32, 169, 254);
    --panel: #0f1323;
    --border: #1c2236;
    --muted: #a6b0c3;
    --accent: rgb(32, 169, 254);
    --accent-faint: rgba(32, 169, 254, 0.14);
    --accent-strong: rgb(15, 131, 201);
    --base-font-size: clamp(16px, 1.05vw, 20px);
    --button-text: rgb(255, 255, 255);
    --button-text-on-light: rgb(32, 169, 254);
}

:root[data-theme="light"] {
    --bg: #f7f7f9;
    --text: rgb(32, 169, 254);
    --panel: #ffffff;
    --border: #d6dae3;
    --muted: #4e5566;
    --accent: rgb(32, 169, 254);
    --accent-faint: rgba(32, 169, 254, 0.18);
    --accent-strong: rgb(22, 137, 211);
}

* {
    box-sizing: border-box;
}

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

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: var(--base-font-size);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-gutter: stable both-edges;
    scrollbar-color: var(--accent) transparent;
}

body::-webkit-scrollbar {
    width: 20px;
}

body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
}

body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    border-radius: 999px;
}

@media (max-width: 900px) {
    :root {
        --control-size: 42px;
        --base-font-size: 15px;
    }

    .page-title {
        font-size: 1.1rem;
    }
}

.page-title {
    margin: 0;
    font-size: clamp(1.35rem, 1.4vw, 1.8rem);
    flex: 1;
    text-align: center;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}

.page-title--hidden {
    transform: scale(0.85);
    opacity: 0;
}

.text-muted {
    color: var(--muted);
}

:root[data-theme="light"] .menu-toggle,
:root[data-theme="light"] .theme-button,
:root[data-theme="light"] .account-button,
:root[data-theme="light"] .account-tab,
:root[data-theme="light"] .nav-link,
:root[data-theme="light"] .account-section__button--secondary {
    color: var(--button-text-on-light);
}

.custom-scrollbar {
    --thumb-height: 48px;
    --thumb-offset: 0px;

    position: fixed;
    top: 18px;
    bottom: 18px;
    right: 0;
    width: 20px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease;
    pointer-events: none;
    z-index: 9999;
}

.custom-scrollbar::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: var(--thumb-height);
    transform: translateY(var(--thumb-offset));
    border-radius: inherit;
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.custom-scrollbar--active {
    visibility: visible;
}

.custom-scrollbar--visible {
    opacity: 1;
}
