:root {
    --bg: #071426;
    --bg-secondary: #0b1d36;
    --card: #10294b;
    --card-secondary: #16365d;
    --accent: #2684ff;
    --accent-secondary: #65adff;
    --text: #eff6ff;
    --muted: #91a9c9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: rgba(255,255,255,.075);
    --button-text: #ffffff;
    --shadow: rgba(0,0,0,.34);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    padding:
        max(14px, env(safe-area-inset-top))
        14px
        calc(94px + env(safe-area-inset-bottom));

    color: var(--text);

    background:
        radial-gradient(
            circle at 95% -5%,
            color-mix(
                in srgb,
                var(--accent) 27%,
                transparent
            ),
            transparent 34%
        ),
        radial-gradient(
            circle at -10% 45%,
            color-mix(
                in srgb,
                var(--accent-secondary) 9%,
                transparent
            ),
            transparent 32%
        ),
        linear-gradient(
            180deg,
            var(--bg),
            var(--bg-secondary)
        );

    background-attachment: fixed;

    font:
        15px/1.45
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    -webkit-appearance: none;
    appearance: none;
}

a {
    color: var(--accent-secondary);
}

.hidden {
    display: none !important;
}

.page-header,
.card,
.loading-card {
    border: 1px solid var(--border);
    box-shadow: 0 12px 30px var(--shadow);
}

.page-header {
    position: relative;
    overflow: hidden;
    margin-bottom: 14px;
    padding: 18px;
    border-radius: 22px;

    background:
        linear-gradient(
            140deg,
            var(--card-secondary),
            var(--card)
        );
}

.page-header::after {
    position: absolute;
    top: -65px;
    right: -55px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    content: "";
    opacity: .14;
    background: var(--accent);
}

.page-logo {
    position: relative;
    z-index: 1;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: .5px;
}

.page-description {
    position: relative;
    z-index: 1;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.subscription-badge {
    position: relative;
    z-index: 1;
    display: inline-flex;
    margin-top: 11px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
}

.subscription-badge.active {
    color: #a7f3d0;
    background: rgba(34,197,94,.15);
}

.subscription-badge.inactive {
    color: #fecaca;
    background: rgba(239,68,68,.15);
}

.subscription-details {
    position: relative;
    z-index: 1;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.card {
    margin-bottom: 12px;
    padding: 15px;
    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            var(--card),
            color-mix(
                in srgb,
                var(--card) 87%,
                black
            )
        );
}

.card-title {
    margin-bottom: 10px;
    font-size: 17px;
    font-weight: 760;
}

.card-value {
    font-size: 18px;
    font-weight: 760;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.small {
    font-size: 12px;
}

.spacer {
    height: 8px;
}

.button {
    display: flex;
    width: 100%;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: 9px;

    margin: 0 0 10px;
    padding: 13px 15px;

    color: var(--button-text);
    border: 0;
    border-radius: 15px;
    outline: none;

    font-weight: 720;
    cursor: pointer;

    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent-secondary)
        );

    box-shadow: 0 8px 20px var(--shadow);
    transition:
        transform .12s ease,
        opacity .12s ease;
}

.button:active {
    transform: scale(.985);
}

.button:disabled {
    opacity: .48;
    cursor: default;
}

.button.secondary {
    color: var(--text);
    border: 1px solid var(--border);
    background: rgba(255,255,255,.055);
    box-shadow: none;
}

.button.danger {
    color: #fecaca;
    border: 1px solid rgba(239,68,68,.24);
    background: rgba(239,68,68,.09);
    box-shadow: none;
}

.button.success {
    color: #d1fae5;
    border: 1px solid rgba(34,197,94,.24);
    background: rgba(34,197,94,.1);
    box-shadow: none;
}

.button.compact {
    min-height: 43px;
    padding: 10px 11px;
    font-size: 13px;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.button-grid .button {
    margin: 0;
}

.input,
.select {
    width: 100%;
    margin: 8px 0 12px;
    padding: 14px;

    color: var(--text);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 13px;
    outline: none;

    background: rgba(0,0,0,.18);
}

.input:focus,
.select:focus {
    border-color: var(--accent-secondary);
    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--accent) 17%,
            transparent
        );
}

.config-header,
.server-header,
.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tag {
    flex: none;
    padding: 4px 8px;
    color: var(--muted);
    border-radius: 999px;
    background: rgba(255,255,255,.065);
    font-size: 11px;
}

.tag.online {
    color: #a7f3d0;
    background: rgba(34,197,94,.13);
}

.tag.offline {
    color: #cbd5e1;
    background: rgba(148,163,184,.11);
}

.traffic {
    margin: 10px 0;
    color: var(--muted);
    font-size: 12px;
}

/*
 * Шкала нагрузки сервера полностью повторяет старого бота:
 *
 * ▓▓▓░░░░░░░ 30%
 *
 * JavaScript создаёт ровно десять символов.
 * Количество заполненных символов:
 * Math.floor(процент / 10)
 */
.server-load-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 12px 0 5px;
    overflow: hidden;
}

.server-load-bar {
    flex: none;

    color: var(--accent-secondary);

    font-family:
        "DejaVu Sans Mono",
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;

    font-size: 17px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;

    text-shadow:
        0 0 10px
        color-mix(
            in srgb,
            var(--accent) 60%,
            transparent
        );
}

.server-load-percent {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.server-free {
    margin-top: 7px;
}

.server-description {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.code-box {
    margin: 10px 0;
    padding: 11px;

    overflow-wrap: anywhere;

    color: var(--muted);
    border-radius: 12px;
    background: rgba(0,0,0,.19);

    font:
        12px/1.45
        "SFMono-Regular",
        Consolas,
        monospace;
}

.link-list {
    display: grid;
    gap: 11px;
}

.link-item {
    display: block;
    padding: 12px;

    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 13px;

    text-decoration: none;
    background: rgba(255,255,255,.045);
}

.navigation {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;

    display: grid;
    grid-template-columns: repeat(5, 1fr);

    padding:
        7px 7px
        calc(7px + env(safe-area-inset-bottom));

    border-top: 1px solid var(--border);

    background:
        color-mix(
            in srgb,
            var(--bg) 91%,
            transparent
        );

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.navigation-item {
    min-width: 0;
    padding: 6px 2px;

    color: var(--muted);
    border: 0;
    border-radius: 12px;

    text-align: center;
    font-size: 10px;
    cursor: pointer;
    background: transparent;
}

.navigation-item.active {
    color: var(--accent-secondary);
    background: rgba(255,255,255,.055);
}

.navigation-icon {
    display: block;
    margin-bottom: 1px;
    font-size: 19px;
}

.modal {
    position: fixed;
    z-index: 100;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 18px;

    background: rgba(0,0,0,.72);

    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.modal.open {
    display: flex;
}

.modal-dialog {
    width: min(100%, 380px);
    max-height: 90vh;
    overflow: auto;

    padding: 17px;

    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card);

    box-shadow: 0 20px 60px rgba(0,0,0,.55);
}

.qr-image {
    display: block;
    width: min(100%, 310px);
    margin: 12px auto 16px;
    padding: 10px;

    border-radius: 15px;
    background: white;
}

.toast {
    position: fixed;
    z-index: 200;
    right: 16px;
    bottom: calc(90px + env(safe-area-inset-bottom));
    left: 16px;

    display: none;

    max-width: 430px;
    margin: auto;
    padding: 12px 14px;

    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;

    text-align: center;
    background: var(--card);
    box-shadow: 0 15px 40px rgba(0,0,0,.5);
}

.toast.visible {
    display: block;
}

.toast.error {
    color: #fecaca;
    border-color: rgba(239,68,68,.3);
}

.loading-card {
    margin-top: 20vh;
    padding: 30px;
    border-radius: 22px;
    text-align: center;

    background:
        linear-gradient(
            145deg,
            var(--card-secondary),
            var(--card)
        );
}

.loading-logo {
    font-size: 42px;
}

.loading-title {
    margin-top: 8px;
    font-size: 22px;
    font-weight: 800;
}

.loading-text {
    margin-top: 5px;
    color: var(--muted);
}

.error-card {
    color: #fecaca;
}

@media (min-width: 650px) {
    body {
        width: 620px;
        margin: auto;
    }

    .navigation {
        width: 620px;
        margin: auto;
        border-right: 1px solid var(--border);
        border-left: 1px solid var(--border);
        border-radius: 18px 18px 0 0;
    }
}
