:root {
    --bg-0: #12071e;
    --bg-1: #291044;
    --bg-2: #6f22ff;
    --panel: rgba(23, 10, 37, 0.72);
    --panel-strong: rgba(30, 12, 47, 0.92);
    --line: rgba(255, 255, 255, 0.16);
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.72);
    --soft: rgba(255, 255, 255, 0.1);
    --pink: #ff4e8f;
    --violet: #7b42ff;
    --glow: 0 18px 50px rgba(103, 31, 255, 0.35);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --safe-top: max(22px, env(safe-area-inset-top));
    --safe-bottom: max(22px, env(safe-area-inset-bottom));
}

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
    overscroll-behavior: none;
    touch-action: manipulation;
}

body {
    margin: 0;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 100% 10%, rgba(146, 58, 255, 0.5), transparent 20%),
        radial-gradient(circle at 0% 100%, rgba(255, 71, 153, 0.24), transparent 24%),
        linear-gradient(180deg, #2a0d49 0%, #13071f 42%, #0b0614 100%);
    -webkit-tap-highlight-color: transparent;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(9, 4, 16, 0.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.loading-overlay[hidden] {
    display: none;
}

.loading-overlay__card {
    width: min(100%, 320px);
    padding: 28px 22px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    box-shadow: var(--glow);
    text-align: center;
}

.loading-overlay__spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 999px;
    border: 4px solid rgba(255, 255, 255, 0.16);
    border-top-color: #ffffff;
    animation: webappSpin .9s linear infinite;
}

.loading-overlay__text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.loading-overlay__hint {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
}

.loading-overlay__spinner.is-hidden {
    display: none;
}

@keyframes webappSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

button,
a {
    font: inherit;
}

.shell {
    width: min(100%, 460px);
    margin: 0 auto;
    padding: var(--safe-top) 18px calc(112px + var(--safe-bottom));
}

.screen {
    display: none;
    animation: fadeIn .28s ease;
}

.screen.is-active {
    display: block;
}

.screen > * + * {
    margin-top: 16px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero,
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-head {
    display: block;
    margin-bottom: 16px;
}

.section-head h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1;
}

.section-head p {
    margin: 10px 0 0;
    width: 100%;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.brand-pill,
.telegram-pill,
.glass-card,
.primary-banner,
.bottom-nav {
    border: 1px solid var(--line);
    background: var(--panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--glow);
}

.brand-pill {
    flex: 1;
    min-height: 68px;
    padding: 12px 18px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 17px;
    font-weight: 800;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
}

.telegram-pill {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    color: var(--text);
    display: grid;
    place-items: center;
    font-size: 28px;
    cursor: pointer;
}

.glass-card {
    border-radius: var(--radius-lg);
}

.summary-card,
.traffic-card {
    padding: 18px;
}

.summary-card {
    display: grid;
    grid-template-columns: 52px 1fr 36px;
    gap: 14px;
    align-items: center;
}

.summary-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: linear-gradient(135deg, #ffffff, #a95cff);
    color: #35184d;
    display: grid;
    place-items: center;
    font-size: 26px;
    font-weight: 900;
}

.summary-card__content strong {
    display: block;
    font-size: 16px;
}

.summary-card__content span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.ghost-arrow {
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
}

.traffic-card__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
}

.traffic-bar {
    height: 12px;
    margin-top: 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.09);
    overflow: hidden;
}

.traffic-bar span {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--pink), var(--violet));
    transition: width .28s ease;
}

.primary-banner,
.action-button {
    min-height: 62px;
    width: 100%;
    border-radius: 22px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 800;
    cursor: pointer;
}

.home-actions {
    display: grid;
    gap: 12px;
}

.primary-banner {
    width: 100%;
    border: 0;
    background: linear-gradient(90deg, rgba(255,78,143,0.92), rgba(123,66,255,0.92));
}

.home-connect-btn {
    min-height: 88px;
    margin-top: 26px;
    border-radius: 24px;
    font-size: 20px;
    box-shadow: 0 24px 56px rgba(123, 66, 255, 0.38);
}

.apps-grid,
.stats-grid {
    display: grid;
    gap: 12px;
}

.app-spotlight {
    padding: 18px;
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 14px;
    align-items: center;
}

.app-spotlight__icon {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    object-fit: cover;
}

.app-spotlight__copy strong {
    display: block;
    font-size: 18px;
}

.app-spotlight__copy span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.action-stack {
    display: grid;
    gap: 12px;
    padding: 18px;
}

#installActions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#installActions #connectBtn {
    grid-column: 1 / -1;
}

.action-button {
    border: 0;
}

.action-button--gradient {
    background: linear-gradient(90deg, rgba(255,78,143,0.95), rgba(123,66,255,0.95));
}

.action-button--solid {
    background: rgba(255,255,255,0.12);
}

.action-button--ghost {
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.05);
}

.payment-consent {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.payment-consent input {
    margin: 2px 0 0;
    width: 18px;
    height: 18px;
    accent-color: var(--pink);
}

.manual-card,
.profile-facts,
.premium-status {
    padding: 18px;
}

.manual-card p {
    margin: 8px 0 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.copy-block {
    margin: 14px 0;
    padding: 14px;
    border-radius: 18px;
    background: rgba(0,0,0,0.24);
    color: #f5f0ff;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

.feature-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.fact-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    color: var(--muted);
    font-size: 13px;
}

.fact-row strong {
    color: var(--text);
    text-align: right;
}

.stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
    padding: 18px;
}

.stat-card span,
.stat-card small,
.mini-list {
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 20px;
}

.stat-card small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.45;
}

.mini-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.mini-list__item {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
}

.mini-list__item strong {
    display: block;
    color: var(--text);
}

.mini-list__badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--text);
    background: rgba(255,255,255,0.08);
}

.mini-list__badge--manual {
    background: rgba(78, 214, 164, 0.16);
    color: #9df0ce;
}

.mini-list__badge--auto {
    background: rgba(100, 181, 246, 0.16);
    color: #b9dcff;
}

.mini-list__item span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}

.screen[data-screen="profile"] .glass-card {
    padding: 18px;
}

.screen[data-screen="profile"] .stat-card,
.screen[data-screen="profile"] .profile-facts {
    padding: 18px;
}

.premium-status strong {
    display: block;
    font-size: 16px;
}

.premium-status span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-line;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(calc(100% - 28px), 430px);
    padding: 8px;
    border-radius: 999px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    z-index: 20;
}

.bottom-nav__item {
    min-height: 64px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--muted);
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    cursor: pointer;
}

.bottom-nav__item span {
    font-size: 18px;
}

.bottom-nav__item small {
    font-size: 11px;
}

.bottom-nav__item.is-active {
    background: rgba(255,255,255,0.12);
    color: var(--text);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(104px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(20px);
    width: min(calc(100% - 28px), 390px);
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(16, 10, 28, 0.96);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.14);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
    z-index: 30;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 390px) {
    .section-head h1 {
        font-size: 30px;
    }

    .brand-pill {
        font-size: 15px;
    }
}


.consent-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 20px;
}

.consent-modal[hidden] {
    display: none;
}

.consent-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 4, 14, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.consent-modal__card {
    position: relative;
    width: min(100%, 420px);
    padding: 24px;
    border-radius: 28px;
    border: 1px solid var(--line);
    background: rgba(23, 10, 37, 0.96);
    box-shadow: 0 24px 56px rgba(7, 4, 14, 0.45);
}

.consent-modal__card h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
}

.consent-modal__card p {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.consent-modal__links {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.consent-modal__links a {
    display: block;
    padding: 14px 16px;
    border-radius: 18px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    font-weight: 700;
}

.consent-modal__actions {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}


.payment-history-card {
    padding: 18px;
}

.payment-history-list {
    margin-top: 14px;
}

.payment-history-list .mini-list__item {
    display: grid;
    gap: 8px;
}

.payment-history-list__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.payment-history-list__meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    flex-wrap: wrap;
}


.withdraw-form {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.form-field {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.form-field input {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    background: rgba(255,255,255,0.07);
    color: var(--text);
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    outline: none;
}

.form-field input:focus {
    border-color: rgba(255,255,255,0.32);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}



.bank-picker {
    position: relative;
    display: grid;
    gap: 8px;
}

.bank-picker__button,
.bank-picker__input {
    width: 100%;
    min-height: 52px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    background: rgba(255,255,255,0.07);
    color: var(--text);
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    text-align: left;
    outline: none;
}

.bank-picker__button {
    position: relative;
    cursor: pointer;
    font-weight: 700;
}

.bank-picker__button::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid rgba(255,255,255,0.70);
    border-bottom: 2px solid rgba(255,255,255,0.70);
    transform: translateY(-60%) rotate(45deg);
    transition: transform .18s ease;
}

.bank-picker.is-open .bank-picker__button::after {
    transform: translateY(-35%) rotate(225deg);
}

.bank-picker__button:focus,
.bank-picker__input:focus {
    border-color: rgba(255,255,255,0.32);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}

.bank-picker__panel {
    display: grid;
    gap: 8px;
}

.bank-picker__panel[hidden] {
    display: none;
}

.bank-picker__list {
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
    padding: 6px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    background: rgba(255,255,255,0.05);
}

.bank-picker__option {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 12px;
    background: rgba(255,255,255,0.07);
    color: var(--text);
    padding: 0 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.bank-picker__option:active,
.bank-picker__option:hover {
    background: rgba(255,255,255,0.13);
}

.bank-picker__empty {
    padding: 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.withdraw-form__note {
    min-height: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.withdraw-modal .consent-modal__card {
    max-height: calc(100vh - 36px);
    overflow: auto;
}


.withdrawal-history-card {
    padding: 18px;
}

.withdrawal-history-list {
    margin-top: 14px;
}

.withdrawal-history-list__item {
    display: grid;
    gap: 8px;
}

.withdrawal-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    background: rgba(255,255,255,0.10);
}

.withdrawal-status--paid {
    background: rgba(50, 214, 126, 0.22);
    color: #9bffc2;
}

.withdrawal-status--failed {
    background: rgba(255, 84, 112, 0.22);
    color: #ffb5c0;
}

.withdrawal-status--pending,
.withdrawal-status--processing {
    background: rgba(255, 194, 87, 0.20);
    color: #ffd99a;
}

.withdrawal-history-list__error {
    color: #ffb5c0;
    font-size: 12px;
    line-height: 1.4;
}
