:root {
    --bg-black: #050505;
    --bg-card: rgba(25, 25, 25, 0.7);
    --bg-accent: #3b82f6;
    --bg-accent-soft: rgba(59, 130, 246, 0.15);

    --text-main: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);

    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    --border: rgba(255, 255, 255, 0.08);
    --radius-xl: 24px;
    --radius-lg: 16px;

    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --blur: blur(20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-black);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    line-height: 1.5;
    font-size: 15px;
    height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Particle Background Canvas */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
}

/* Loader Screen */
.loader-screen {
    position: fixed;
    inset: 0;
    background: #000;
    background-image: radial-gradient(circle at center, #1a1a1a 0%, #000 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loader-visual {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shield-logo {
    width: 64px;
    height: 64px;
    color: var(--bg-accent);
    z-index: 2;
    filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.5));
    animation: shieldPulse 3s infinite ease-in-out;
}

.shield-ring {
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-top-color: var(--bg-accent);
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

.shield-ring::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 12px;
    width: 8px;
    height: 8px;
    background: var(--bg-accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--bg-accent);
}

.shield-ring-2 {
    position: absolute;
    inset: 15px;
    border: 2px solid transparent;
    border-bottom-color: rgba(59, 130, 246, 0.5);
    border-radius: 50%;
    animation: spin 3s linear infinite reverse;
}

.loader-text-wrapper {
    text-align: center;
}

.loader-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(to right, #fff, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards 0.3s;
}

.loader-subtitle {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 4px;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards 0.5s;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shieldPulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.5));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.8));
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Content */
.main-content {
    padding: 20px 16px;
    animation: fadeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-width: 500px;
    margin: 0 auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.user-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--bg-accent), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.user-meta h2 {
    font-size: 17px;
    font-weight: 600;
}

.status-indicator {
    font-size: 13px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
}

.referral-badge {
    padding: 6px 12px;
    background: var(--bg-accent-soft);
    border: 1px solid rgba(59, 130, 246, 0.1);
    border-radius: 100px;
    color: var(--bg-accent);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
}

/* Referral Page Styles */
.title-with-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
}

.title-with-icon svg {
    color: var(--warning);
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.3));
}

.section-title-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.section-title-with-icon h3 {
    margin-bottom: 0 !important;
}

.section-title-with-icon svg {
    color: var(--bg-accent);
}

.section-header .section-title-with-icon svg {
    color: var(--text-dim);
}

.referral-card {
    position: relative;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.8) 0%, rgba(20, 20, 20, 0.8) 100%);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-radius: var(--radius-xl);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

/* Premium Card */
.premium-card {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.tariff-info .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tariff-info h3 {
    font-size: 20px;
    font-weight: 700;
    margin-top: 2px;
}

.state-badge {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.state-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.state-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.state-badge.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
}

.stat-value {
    display: block;
    font-weight: 600;
}

.card-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    font-size: 13px;
    color: var(--text-dim);
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

.action-btn {
    border-radius: var(--radius-lg);
    border: none;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn.primary {
    background: var(--bg-accent);
    color: white;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.action-btn.primary:not(:disabled):active {
    transform: scale(0.96);
    background: #2563eb;
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--border);
}

.action-btn.secondary:not(:disabled):active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.1);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Servers Section */
.servers-section {
    margin-bottom: 100px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dim);
}

.section-header .count {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.servers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.server-node {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s;
}

.server-node:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.05);
}

.server-flag {
    font-size: 22px;
    width: 32px;
    text-align: center;
}

.server-meta {
    flex: 1;
}

.server-title {
    font-weight: 600;
    font-size: 15px;
    display: block;
}

.server-country {
    font-size: 12px;
    color: var(--text-dim);
}

.server-load-group {
    text-align: right;
}

.load-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 4px;
    display: block;
}

.load-track {
    width: 48px;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.load-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
}

/* Tab Bar - Premium Design */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0 10px;
    z-index: 1000;
}

/* Tab indicator positions for 4 tabs */
[data-view="home"].active~.tab-indicator {
    left: 12.5%;
}

[data-view="referral"].active~.tab-indicator {
    left: 37.5%;
}

[data-view="ncoin"].active~.tab-indicator {
    left: 62.5%;
}

[data-view="instruction"].active~.tab-indicator {
    left: 87.5%;
}

/* NCoin Specific Styles */
.ncoin-premium-card {
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 32px 24px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.ncoin-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.15), transparent 70%);
    animation: ncoinGlowPulse 4s infinite ease-in-out;
}

@keyframes ncoinGlowPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.diamond-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diamond-animated {
    width: 100px;
    height: 100px;
    animation: diamondFloatRotate 6s infinite ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    will-change: transform;
}

.diamond-animated::after {
    content: '';
    position: absolute;
    inset: 10px;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.45) 0%, transparent 70%);
    filter: blur(15px);
    z-index: -1;
    border-radius: 50%;
}

.diamond-animated svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 5px rgba(244, 63, 94, 0.3));
}

@keyframes diamondFloatRotate {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-10px) scale(1.05);
    }
}

.grad-stop-1 {
    stop-color: #f43f5e;
}

.grad-stop-2 {
    stop-color: #fb7185;
}

.grad-stop-3 {
    stop-color: #e11d48;
}

.grad-stop-4 {
    stop-color: #be123c;
}

.ncoin-balance-text {
    text-align: center;
    z-index: 1;
}

.ncoin-balance-text .label {
    font-size: 13px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    display: block;
}

.ncoin-balance-text h1 {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--text-dim));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ncoin-balance-text .unit {
    font-size: 20px;
    font-weight: 600;
    color: var(--bg-accent);
    margin-left: 4px;
}

.ncoin-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.ncoin-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.ncoin-info-card .icon-wrap {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-wrap.earn {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.icon-wrap.spend {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.ncoin-info-card .text h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}

.ncoin-info-card .text p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.4;
}

.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 100px;
}

.transaction-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tr-info {
    display: flex;
    flex-direction: column;
}

.tr-title {
    font-weight: 600;
    font-size: 14px;
}

.tr-date {
    font-size: 11px;
    color: var(--text-muted);
}

.tr-amount {
    font-weight: 700;
    font-size: 15px;
}

.tr-amount.plus {
    color: var(--success);
}

.tr-amount.minus {
    color: var(--error);
}

.empty-state-mini {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
}

/* NCoin Payment Styles in Modal */
.ncoin-pay-option {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-accent-soft);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}

.ncoin-pay-option:active {
    transform: scale(0.98);
}

.ncoin-pay-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ncoin-pay-icon {
    width: 32px;
    height: 32px;
    background: var(--bg-accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.ncoin-pay-details span {
    display: block;
}

.ncoin-pay-details .label {
    font-size: 14px;
    font-weight: 600;
}

.ncoin-pay-details .balance {
    font-size: 12px;
    color: var(--text-dim);
}

.ncoin-pay-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
}

/* Instructions Styles */
.platform-slider-container {
    margin: 0 -16px 24px;
    padding: 10px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.platform-slider {
    display: flex;
    gap: 12px;
    width: max-content;
}

.platform-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 80px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.3s;
}

.platform-item.active {
    background: var(--bg-accent-soft);
    border-color: var(--bg-accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.platform-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.platform-icon svg {
    width: 24px;
    height: 24px;
}

.platform-item.active .platform-icon {
    color: var(--bg-accent);
}

.platform-icon.ios svg,
.platform-icon.mac svg {
    color: #fff;
}

.platform-icon.android svg {
    color: #3DDC84;
}

.platform-icon.windows svg {
    color: #00A4EF;
}

.platform-item span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
}

.platform-item.active span {
    color: white;
}

.platform-view {
    display: none;
    animation: slideUpFade 0.4s ease-out;
}

.platform-view.active {
    display: block;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.instruction-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.instruction-card.secondary {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.02);
}

.instr-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    min-height: 44px;
}

.client-info {
    flex: 1;
    min-width: 0;
}

.client-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.client-logo.happ {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

.client-logo.hiddify {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}

.client-logo-mini {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 10px;
    color: white;
}

.client-logo-mini.happ {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

.client-info h4 {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-info span {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dl-badge {
    margin-left: auto;
    padding: 8px 16px;
    background: var(--bg-accent);
    color: white;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.instr-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.instr-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.instr-step .step-num {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.instr-step .step-text {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.4;
}

.instr-step b {
    color: white;
}

.instr-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 10px;
}

.instr-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.btn-text {
    color: var(--bg-accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 24px;
    left: 16px;
    right: 16px;
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: 100px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 50;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    animation: fadeInModal 0.3s forwards;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-sheet {
    width: 100%;
    background: #111;
    border-radius: 24px 24px 0 0;
    padding: 12px 20px 48px;
    animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-handle {
    width: 40px;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 0 auto 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-circle {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 20px;
}

.modal-scroll-area {
    overflow-y: auto;
    padding-right: 4px;
}

/* Modal Inputs */
.modal-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    color: white;
    font-size: 16px;
    /* Prevents iOS auto-zoom */
    font-family: inherit;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--bg-accent);
    background: rgba(255, 255, 255, 0.08);
}

.modal-input::placeholder {
    color: var(--text-muted);
}

textarea.modal-input {
    resize: none;
}

.modal-field-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* App Selection Grid */
.app-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    padding: 10px 0;
}

.app-btn {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.app-btn:active {
    transform: scale(0.9);
}

.app-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.app-btn span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
}

.app-icon.hiddify {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}

.app-icon.v2rayng {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
}

.app-icon.v2raytun {
    background: linear-gradient(135deg, #10b981, #3b82f6);
}

.app-icon.streisand {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.app-icon.happ {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

.app-icon.v2box {
    background: linear-gradient(135deg, #64748b, #1e293b);
}

.app-btn.active-choice {
    transform: scale(1.05);
}

.app-btn.active-choice .app-icon {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.app-btn.active-choice span {
    color: white;
    font-weight: 700;
}

/* Download Cards */
.dl-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    text-decoration: none;
    color: white;
}

.dl-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-accent-soft);
    color: var(--bg-accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dl-meta {
    flex: 1;
}

.dl-platform {
    display: block;
    font-weight: 700;
    font-size: 15px;
}

.dl-client {
    color: var(--text-dim);
    font-size: 12px;
}

/* Toast */
/* Removed old styles - see end of file for new toast logic */

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-dim);
    margin-bottom: 32px;
}

.empty-state .action-btn {
    width: auto;
    padding: 14px 32px;
    margin: 0 auto;
}

/* Scroll Customization */
::-webkit-scrollbar {
    width: 0;
}

/* Tab Bar - Premium Design */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, rgba(15, 15, 15, 0.95) 0%, rgba(10, 10, 10, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding: 8px 16px 24px;
    z-index: 50;
}

.tab-indicator {
    position: absolute;
    top: 0;
    left: 25%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 0 0 4px 4px;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.5);
}

.tab-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    filter: blur(4px);
    animation: indicatorPulse 2s infinite;
}

@keyframes indicatorPulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.6;
    }
}

.tab-item {
    background: transparent;
    border: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px 0;
    position: relative;
}

.tab-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-item svg {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.icon-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(6px);
}

.tab-item.active {
    color: #fff;
}

.tab-item.active .tab-icon-wrapper {
    background: rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.tab-item.active svg {
    color: #3b82f6;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.tab-item.active .icon-glow {
    opacity: 1;
    animation: glowPulse 2s infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.tab-item:active .tab-icon-wrapper {
    transform: scale(0.92);
}

.tab-item span {
    position: relative;
    transition: all 0.3s ease;
}

.tab-item.active span {
    font-weight: 600;
    text-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

/* Views with Slide Animations */
#main-container {
    position: relative;
    overflow: hidden;
    padding: 16px;
}

.view {
    display: none;
    padding-bottom: 100px;
    animation: viewSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
    display: block;
}

.view.slide-out-left {
    animation: viewSlideOutLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.view.slide-out-right {
    animation: viewSlideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.view.slide-in-left {
    animation: viewSlideInLeft 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.slide-in-right {
    animation: viewSlideInRight 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes viewSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes viewSlideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

@keyframes viewSlideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

@keyframes viewSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes viewSlideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Section Header LG */
.section-header-lg {
    text-align: center;
    margin-bottom: 24px;
    margin-top: 10px;
}

.section-header-lg h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-header-lg p {
    color: var(--text-dim);
    font-size: 14px;
}

/* Referral Card */
.referral-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-glow-gold {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.ref-balance-info .label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ref-balance-info h1 {
    font-size: 28px;
    font-weight: 800;
    color: #ffd700;
    /* Gold */
}

.action-btn.sm {
    padding: 10px 20px;
    font-size: 13px;
    width: auto;
    border-radius: 12px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-box.blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.icon-box.green {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-text {
    display: flex;
    flex-direction: column;
}

.stat-text .val {
    font-size: 18px;
    font-weight: 700;
}

.stat-text .lbl {
    font-size: 11px;
    color: var(--text-dim);
}

/* Link Section */
.link-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--border);
}

.link-section h3 {
    font-size: 15px;
    margin-bottom: 12px;
    font-weight: 600;
}

.link-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 4px 4px 4px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.link-box span {
    color: var(--text-dim);
    font-family: monospace;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--bg-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.link-section .hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.link-section .hint span {
    color: var(--success);
    font-weight: 600;
}

/* Quick Actions in Home */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.quick-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 12px;
    padding: 12px;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.quick-btn:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

/* Enhanced Referral Section */
.stats-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.stats-grid-4 .stat-box {
    padding: 14px;
}

.stats-grid-4 .stat-text .val {
    font-size: 16px;
}

.stats-grid-4 .stat-text .lbl {
    font-size: 10px;
}

.icon-box.gold {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
}

.icon-box.purple {
    background: rgba(147, 51, 234, 0.15);
    color: #9333ea;
}

/* Info Section - How it works */
.info-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.info-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.info-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-num {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--bg-accent), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.step-text {
    font-size: 13px;
    color: var(--text-dim);
}

.step-text span {
    color: var(--success);
    font-weight: 600;
}

/* Full width button */
.action-btn.full {
    width: 100%;
    margin-top: 12px;
    flex-direction: row;
    gap: 8px;
}

/* Referrals List Section */
.referrals-list-section {
    margin-top: 20px;
    margin-bottom: 20px;
}

.referrals-list-section .section-header {
    margin-bottom: 12px;
}

.referrals-list-section .section-header h3 {
    font-size: 15px;
}

.referrals-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.referral-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.referral-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.referral-info {
    flex: 1;
}

.referral-name {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

.referral-date {
    font-size: 11px;
    color: var(--text-muted);
}

.referral-status {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.referral-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.referral-status.inactive {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.empty-referrals {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px dashed var(--border);
}

.empty-referrals p {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-dim);
}

.empty-referrals span {
    font-size: 12px;
    color: var(--text-muted);
}

/* Pagination Controls */
.pagination-footer {
    display: flex;
    justify-content: center;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 100px;
    border: 1px solid var(--border);
}

.pag-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pag-btn:not(:disabled):active {
    transform: scale(0.85);
    background: rgba(255, 255, 255, 0.15);
}

.pag-btn:disabled {
    opacity: 0.15;
    cursor: not-allowed;
}

.pag-num {
    font-size: 15px;
    font-weight: 700;
    color: white;
    min-width: 24px;
    text-align: center;
    opacity: 0.9;
}

/* Toast Popup - Premium Styling */
.toast-popup {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    opacity: 0;
    pointer-events: none;
}

.toast-popup:not(.hidden) {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-popup.success {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.15);
}

.toast-popup.warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.toast-content {
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.toast-popup.success .toast-content::before {
    content: '✓';
    margin-right: 8px;
    color: #10b981;
    font-weight: bold;
}