/* --- VARIABLES & THEME (CYBERPUNK) --- */
:root {
    /* Colors */
    --bg-color: #0D0D0D;
    --primary: #A500E1;
    /* Neon Purple */
    --primary-glow: rgba(165, 0, 225, 0.5);
    --auth-primary: #763AF5;

    --text-main: #FFFFFF;
    --text-secondary: #a0a0a0;

    --card-bg: rgba(20, 20, 20, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);

    --success: #00ff9d;
    --danger: #ff0055;

    /* Effects */
    --glass: blur(16px);
    --nav-height: 70px;
    --radius-l: 24px;
    --radius-m: 16px;
    --anim-speed: 0.3s;
}

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

body {
    background: #000 url('back_image.png') no-repeat top center;
    background-size: 480px auto;
    /* Fits width, natural height. Black below. */
    background-color: var(--tg-theme-bg, #0B0B0B);
    color: var(--tg-theme-text, #ffffff);
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding-bottom: 80px;
    /* Space for navbar */
    user-select: none;
    -webkit-user-select: none;
    overflow-x: hidden;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

/* === HOME HEADER === */
.home-header {
    padding: 24px 20px;
}

.user-profile-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 48px;
    height: 48px;
    background: #0045ff;
    /* Blue */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-texts {
    display: flex;
    flex-direction: column;
}

.user-name-text {
    font-weight: 700;
    font-size: 18px;
    color: #fff;
}

.text-caption {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* === PORTFOLIO SECTION === */
.portfolio-section {
    padding: 10px 20px 20px;
}

.portfolio-label {
    font-size: 16px;
    /* Updated */
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.portfolio-amount {
    font-size: 46px;
    /* Updated */
    font-weight: 300;
    /* Thin */
    margin-bottom: 4px;
    font-family: 'Montserrat', sans-serif;
}

.portfolio-change {
    font-size: 13px;
    color: #bbb;
}

/* === ACTION BUTTONS === */
.home-actions {
    display: flex;
    gap: 15px;
    /* Spacing between cards */
    padding: 0 20px 20px 20px;
    justify-content: space-between;
}

.action-card {
    flex: 1;
    /* Takes equal width */
    height: 110px;
    /* Fixed height ~100px */
    background: linear-gradient(135deg, rgba(30, 50, 90, 0.8), rgba(10, 20, 40, 0.9));
    /* Blueish Glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;

    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.action-card:active {
    transform: scale(0.96);
    background: linear-gradient(135deg, rgba(40, 60, 100, 0.9), rgba(20, 30, 60, 0.95));
}

.action-icon-svg {
    /* Default fallback */
    width: 32px;
    height: 32px;
    margin-bottom: 2px;
}

/* Specific Sizes */
.action-card[data-action="topup"] .action-icon-svg {
    width: 40px;
    height: 40px;
}

#btn-copy-trading .action-icon-svg {
    width: 40px;
    height: 40px;
}

.action-label {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    letter-spacing: 0.3px;
}

/* === BOTTOM NAV (Animated) === */
.bottom-nav-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 440px;
    height: 80px;
    background: #1A1B31;
    border-radius: 10px;
    /* Rectangular with radius */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 0 10px;
}

/* Container for items to sit on top */
.nav-items-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1002;
}

.nav-item {
    width: 60px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
}

/* User's Tactic: 30px Container */
.nav-icon-box {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1003;
    /* Icon container stays firmly on top */
}

.nav-icon-svg,
.nav-icon-svg-home {
    width: 28px;
    height: 28px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), filter 0.3s ease;
    opacity: 0.5;
}

.nav-item.active .nav-icon-svg,
.nav-item.active .nav-icon-svg-home {
    opacity: 1;
    transform: translateY(-32px);
    /* Icon lifts up */
    filter: brightness(2);
}

/* === NEW PER-ITEM BLUE CIRCLE === */
.nav-circle {
    position: absolute;
    top: 0;
    left: 50%;
    margin-left: -30px;
    /* Center 60px circle */
    width: 60px;
    height: 60px;
    background: #0660F9;
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(6, 96, 249, 0.6);
    z-index: 1001;

    /* Hidden State (Below) */
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none;
}

.nav-item.active .nav-circle {
    /* Active State (Lifted & Visible) */
    opacity: 1;
    transform: translateY(-22px) scale(1);
    /* Lowered by 3px to align with icon */
}

/* --- MODAL WIZARD --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 2000;
    /* Ensure on top of Bottom Nav (z:1000) */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #11101C;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    border-radius: 24px 24px 0 0;
    border: none;
    box-shadow: none;
    animation: slideUp 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.input-field {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 8px;
    /* Tech square */
    font-family: 'Inconsolata', monospace;
    font-size: 16px;
    outline: none;
    transition: all 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(165, 0, 225, 0.3);
    background: rgba(165, 0, 225, 0.05);
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    padding: 16px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    margin-top: 10px;
    cursor: pointer;
    box-shadow: 0 0 15px var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 0 5px var(--primary-glow);
}

.lang-btn {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    box-shadow: none;
}

.lang-btn:hover,
.lang-btn.active {
    border-color: #0660F9;
    /* background: #3479f1; */
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* === BOTTOM SHEET STYLES === */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

.modal-overlay.sheet-mode {
    align-items: flex-end;
    /* Align to bottom */
    padding: 0;
    backdrop-filter: blur(8px);
    /* Blurred background */
    background: rgba(0, 0, 0, 0.4);
    /* Dimmed bg */
    transition: opacity 0.3s ease;
}

.modal-overlay.sheet-mode.closing {
    opacity: 0;
    pointer-events: none;
}

.modal-content.sheet-content {
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    /* Rounded top */
    margin: 0;
    padding: 24px;
    transform: translateY(0);
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: none;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.modal-content.sheet-content.closing {
    animation: slideDown 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.close-modal-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: #fff;
}

.animate-enter {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.page {
    display: none;
    padding-bottom: 80px;
    /* padding-top: 20px; */

}

.page.active {
    display: block;
}

/* --- WIZARD GRID & LOGOS --- */
.exchange-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 10px;
}

.exchange-option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.exchange-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(165, 0, 225, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.exchange-option:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.exchange-option:hover::before {
    opacity: 1;
}

.exchange-option.selected {
    border-color: var(--primary);
    background: rgba(165, 0, 225, 0.15);
    box-shadow: 0 0 20px rgba(165, 0, 225, 0.4);
}

.exchange-logo {
    width: 36px;
    height: 36px;
    min-width: 36px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.1));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

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

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.slide-in {
    animation: slideIn 0.3s ease-out forwards;
}

/* Disabled State & Badges */
.exchange-option.disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
    position: relative;
    cursor: not-allowed;
}

.coming-soon-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    z-index: 10;
    font-family: 'Orbitron', sans-serif;
}

.exchange-option:hover .exchange-logo {
    transform: scale(1.1) rotate(0deg);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.exchange-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s;
    letter-spacing: 1px;
    z-index: 1;
}

.exchange-option.selected .exchange-name {
    color: #fff;
    text-shadow: 0 0 8px var(--primary);
}


/* --- SPLASH SCREEN (NEW DESIGN) --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 9999;
    overflow: hidden;
    user-select: none;
    cursor: pointer;
    transition: opacity 0.6s ease-out;
}

.splash-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.splash-glow-circle {
    width: 200px;
    height: 200px;
    margin-top: 10vh;
    border-radius: 50%;

    background: transparent;
    /* Bottom Inner Highlight (Blue #0660F9A1) */
    box-shadow: inset 0 -20px 20px 0 rgba(6, 96, 249, 0.63);
    border: 1px solid rgba(6, 96, 249, 0.3);

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.splash-logo-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 1.2;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.splash-bg {
    position: absolute;
    bottom: 0;
    left: 50%;
    /* Смещаем на 50% влево */
    transform: translateX(-50%);
    /* Центрируем точно по горизонтали */
    width: 100%;
    max-width: 480px;
    /* Устанавливаем максимальную ширину как у body */
    height: 100%;
    background: url('lamp.png') no-repeat center bottom;
    background-size: contain;
    /* Возвращаем contain, чтобы видеть всю картинку */
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
}

.splash-footer {
    position: absolute;
    bottom: 50px;
    width: 100%;
    text-align: center;
    z-index: 3;
}

.splash-hint {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 3px;
    animation: fadeIn 1.5s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 30px var(--primary);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 60px var(--primary);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 30px var(--primary);
        transform: scale(1);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* --- LIST ITEM REFINEMENTS --- */
.item-content {
    flex: 1;
    min-width: 0;
    /* prevent flex overflow */
    margin-right: 12px;
}

.item-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Max Button in Input Group */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-max {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(165, 0, 225, 0.2);
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(165, 0, 225, 0.3);
    font-family: 'Orbitron', sans-serif;
    transition: all 0.2s;
}

.btn-max:hover {
    background: var(--primary);
    color: #fff;
}

/* Page Transitions */
.page {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;

}

.page.active {
    opacity: 1;
}

.item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
}