:root {
    --bg-color: #05030a;
    --bg-gradient-start: #0B735F;
    --bg-gradient-end: #05030a;
    --card-bg: #15151b;
    --card-elevated: #181821;
    --accent-color: #0B735F;
    --accent-soft: rgba(11, 115, 95, 0.24);
    --text-main: #ffffff;
    --text-secondary: #8e8e93;
    --text-muted: #636366;
    --border-subtle: #262636;
    --success: #32d74b;
}

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

/* Загрузчик страницы */
.page-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-bg {
    position: absolute;
    inset: -30px;
    background: radial-gradient(circle at top, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 55%) no-repeat center / cover;
    z-index: -1;
    filter: blur(30px);
}

.loader-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
    z-index: 1;
}

.loader-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    display: block;
    object-fit: contain;
}

.loader-text {
    font-size: 42px;
    font-weight: 600;
    color: #fff;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Myriad Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(circle at top, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 55%);
    color: var(--text-main);
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.top-header {
    width: 100%;
    padding: 12px 0 6px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: linear-gradient(180deg, rgba(4, 0, 14, 0.9) 0%, rgba(4, 0, 14, 0.2) 100%);
}

.top-header-inner {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    height: 32px;
    width: 32px;
    display: block;
    object-fit: contain;
}

.brand-name {
    font-weight: 600;
    font-size: 18px;
    letter-spacing: 0.02em;
}

.top-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--accent-color);
    font-size: 11px;
    color: var(--text-secondary);
}

.app-pages {
    width: 100%;
    max-width: 480px;
    flex: 1;
}

.page {
    display: none;
    width: 100%;
    padding: 8px 16px 90px;
}

.page.active {
    display: block;
}

.page.app-container {
    padding: 8px 16px 90px;
}

.app-container {
    width: 100%;
    max-width: 480px;
    padding: 8px 16px 90px;
}

/* Карточка обмена */
.card {
    background: radial-gradient(circle at top left, rgba(11, 115, 95, 0.35) 0%, var(--card-bg) 55%);
    border-radius: 26px;
    padding: 18px 18px 16px;
    margin-bottom: 14px;
    box-shadow:
        0 24px 40px rgba(0, 0, 0, 0.85),
        0 0 0 1px rgba(255, 255, 255, 0.02);
}

.exchange-card {
    position: relative;
    overflow: hidden;
}

.label {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.highlight {
    color: var(--accent-color);
    font-weight: 500;
}

.fee {
    color: var(--success);
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(50, 215, 75, 0.12);
}

.input-group + .input-group {
    margin-top: 10px;
}

.input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

input {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 36px;
    font-weight: 600;
    width: 55%;
    outline: none;
}

input::placeholder {
    color: rgba(235, 235, 245, 0.3);
}

.currency-select {
    border: none;
    outline: none;
    background: rgba(12, 12, 24, 0.95);
    border-radius: 16px;
    padding: 8px 12px;
    min-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    color: #ffffff;
    cursor: pointer;
}

.currency-title {
    font-size: 15px;
    font-weight: 600;
}

.currency-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

.arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text-muted);
}

.currency-select {
    position: relative;
    padding-right: 22px;
}

.swap-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(84, 84, 88, 0.6) 50%, transparent 100%);
    margin: 16px 0 14px;
    position: relative;
}

.swap-divider .swap-button {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #1d1d26;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(11, 115, 95, 0.4);
    font-size: 16px;
    color: var(--text-secondary);
}

.rate-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-secondary);
}

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

.main-button {
    width: 100%;
    padding: 14px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-color));
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    margin-top: 14px;
    cursor: not-allowed;
    opacity: 0.4;
}

.main-button.disabled {
    pointer-events: none;
}

.main-button:not(.disabled):not(.support-btn) {
    cursor: pointer;
    opacity: 1;
}

.main-button.support-btn {
    cursor: pointer;
    opacity: 1;
}

/* Курс валют под карточкой */
.rates-strip {
    position: relative;
    overflow: hidden;
    padding: 6px 0 4px;
    margin-bottom: 14px;
}

.rates-track {
    display: flex;
    gap: 8px;
    width: max-content;
    animation: rates-scroll 25s linear infinite;
}

@keyframes rates-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.rate-pill {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 15, 24, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.rate-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(11, 115, 95, 0.2);
}

.rate-text {
    font-size: 11px;
    color: var(--text-secondary);
}

.rate-tag.usdt { background: rgba(52, 199, 89, 0.2); }
.rate-tag.aed { background: rgba(90, 200, 250, 0.16); }
.rate-tag.kzt { background: rgba(255, 204, 0, 0.18); }
.rate-tag.eur { background: rgba(10, 132, 255, 0.2); }
.rate-tag.try { background: rgba(255, 69, 58, 0.22); }

/* Сетка сервисов */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.feature-card {
    background: var(--card-elevated);
    padding: 14px;
    border-radius: 18px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.feature-card h3 {
    font-size: 13px;
    margin: 8px 0 4px;
}

.feature-card p {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.feature-icon-row {
    display: flex;
    gap: 6px;
}

.service-pill {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: #111119;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.feature-icon-circle {
    width: 26px;
    height: 26px;
    border-radius: 14px;
    background: #111119;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.secondary-button {
    background: #1f1f28;
    color: #ffffff;
    border: 1px solid rgba(11, 115, 95, 0.3);
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.secondary-button:hover {
    border-color: var(--accent-color);
}

/* Apple Pay блок */
.apple-pay-card {
    position: relative;
    border-radius: 26px;
    padding: 18px 18px 16px;
    margin-bottom: 16px;
    overflow: hidden;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.09) 0%, rgba(21, 21, 27, 0.95) 45%, #05030a 100%);
    box-shadow:
        0 24px 40px rgba(0, 0, 0, 0.9),
        0 0 0 1px rgba(255, 255, 255, 0.03);
}

.apple-glow {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 140px;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.22) 0%, transparent 65%);
    opacity: 0.6;
    pointer-events: none;
}

.apple-content {
    position: relative;
}

.apple-logo-row {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.apple-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 16px;
    font-weight: 500;
}

.apple-logo-img {
    height: 28px;
    width: auto;
    display: block;
    object-fit: contain;
}

.apple-pay-card h2 {
    font-size: 16px;
    text-align: center;
    margin: 8px 0 6px;
}

.apple-pay-card p {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin: 0 0 12px;
}

.apple-button {
    display: block;
    width: 100%;
    padding: 11px;
    border-radius: 999px;
    border: none;
    background: #ffffff;
    color: #000000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.apple-note {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

/* Списки услуг и офисов */
.section-list {
    margin-bottom: 16px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px;
}

.list-card {
    background: var(--card-elevated);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.list-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
}

.list-item + .list-item {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.list-icon {
    width: 28px;
    height: 28px;
    border-radius: 14px;
    background: #111119;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.list-text {
    flex: 1;
}

.list-title {
    font-size: 13px;
    margin-bottom: 2px;
}

.list-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

.chevron {
    font-size: 18px;
    color: var(--accent-color);
}

/* Навигация внизу */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: rgba(13, 13, 20, 0.96);
    backdrop-filter: blur(18px);
    display: flex;
    justify-content: space-around;
    padding: 8px 12px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px 16px 0 0;
    z-index: 10;
}

.nav-item {
    flex: 1;
    max-width: 90px;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-secondary);
    font-size: 10px;
}

.nav-emoji {
    font-size: 18px;
}

.nav-label {
    font-size: 10px;
}

.nav-item.active {
    color: #ffffff;
}

.nav-item.active .nav-emoji {
    text-shadow: 0 0 12px rgba(11, 115, 95, 0.8);
}

/* Страницы: История, Профиль, Поддержка */
.page-header {
    margin-bottom: 16px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    background: var(--card-elevated);
    border-radius: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.history-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.history-amount {
    font-weight: 600;
}

.history-arrow {
    color: var(--accent-color);
    font-size: 14px;
}

.history-item-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state.hidden {
    display: none;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state p {
    margin: 0 0 4px;
    font-size: 16px;
}

.empty-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Профиль — по макету */
.profile-header {
    margin-bottom: 20px;
}

.profile-welcome {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    line-height: 1.25;
    color: var(--text-main);
}

.profile-discount {
    margin-bottom: 20px;
    padding: 18px 16px;
}

.profile-discount-text {
    margin: 0 0 4px;
    font-size: 15px;
    color: var(--text-main);
}

.profile-discount-accent {
    font-weight: 600;
    margin-bottom: 14px;
}

.profile-discount-tiers {
    display: flex;
    gap: 6px;
}

.profile-tier {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 11px;
    color: var(--text-secondary);
}

.profile-tier span:first-child {
    font-weight: 600;
    color: var(--text-secondary);
}

.profile-tier.active {
    background: var(--accent-color);
    color: #fff;
}

.profile-tier.active span {
    color: #fff;
}

.profile-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.profile-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--card-elevated);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.profile-list-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.profile-list-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.profile-list-item + .profile-list-item {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.profile-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(11, 115, 95, 0.35);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.profile-icon-referral { font-size: 16px; }
.profile-icon-info,
.profile-icon-faq { font-size: 20px; font-weight: 700; }
.profile-icon-star { font-size: 20px; }
.profile-icon-gear { font-size: 20px; }
.profile-icon-tg { font-size: 18px; }

.profile-list-label {
    flex: 1;
}

.profile-list-item .chevron {
    flex-shrink: 0;
}

.profile-list-item-single {
    background: var(--card-elevated);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.profile-list-item-single .profile-list-label {
    margin-left: 0;
}

.support-card .support-text {
    margin: 0 0 16px;
    font-size: 15px;
    color: var(--text-secondary);
}

.support-card .support-btn {
    margin-top: 0;
}

.support-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

@media (min-width: 480px) {
    .app-shell {
        padding-top: 6px;
    }

    .app-container {
        padding-bottom: 96px;
    }

    .page {
        padding-bottom: 96px;
    }
}