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

:root {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-card: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #666666;
    --accent: #0088ff;
    --accent-hover: #006dd9;
    --border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: #000000;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px;
}


.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a1a1a;
    border-bottom: none;
    border-radius: 0 0 16px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.username {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.balance-block {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: 10px;
    padding: 0;
    position: relative;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 136, 255, 0.05) 25%, rgba(0, 136, 255, 0.12) 55%, transparent 100%);
}

.balance {
    font-size: 14px;
    font-weight: 600;
    color: #0088ff;
    padding: 8px 12px 8px 16px;
    white-space: nowrap;
    position: relative;
    background: transparent;
}

.btn-refill {
    padding: 8px 16px;
    background: #0088ff;
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    margin-left: 4px;
}

.btn-refill:hover {
    background: #006dd9;
}

.btn-refill:active {
    transform: translateY(0);
}


.filters {
    display: flex;
    gap: 10px;
    padding: 14px 16px 2px 16px;
    background: #0d0d0d;
}

.filter-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 12px 18px;
    background: #1a1a1a;
    border: none;
    border-radius: 10px;
    color: #666666;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-toggle svg {
    width: 14px;
    height: 14px;
    color: #666666;
}

.filter-toggle:hover {
    background: #252525;
}

.sort-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: #1a1a1a;
    border: none;
    border-radius: 10px;
    color: #666666;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn svg {
    width: 14px;
    height: 14px;
    color: #666666;
    transition: transform 0.3s;
}

.sort-btn.desc svg {
    transform: rotate(180deg);
}

.sort-btn:active {
    transform: scale(0.98);
}

.sort-btn:hover {
    background: #252525;
}


.content {
    flex: 1;
    padding: 2px 16px 16px 16px;
    overflow-y: auto;
    background: #0d0d0d;
}

.gifts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}


.gift-card {
    background: #1a1a1a;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.gift-card:active {
    transform: scale(0.98);
}

.gift-card.in-cart .gift-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 1;
}

.gift-card.in-cart .gift-image img {
    filter: blur(3px);
}

.cart-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    z-index: 2;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.gift-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.gift-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.2s;
}

.gift-info {
    padding: 12px;
    background: #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.gift-details {
    flex: 1;
    min-width: 0;
}

.gift-name {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gift-id {
    font-size: 12px;
    color: #666666;
    margin-bottom: 4px;
}

.gift-price {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.cart-btn {
    width: 40px;
    height: 40px;
    background: #0088ff;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cart-btn.remove {
    background: #ef4444;
}

.cart-btn:active {
    transform: scale(0.9);
}

.cart-btn svg {
    width: 18px;
    height: 18px;
    color: white;
}


.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #1a1a1a;
    border-top: none;
    padding: 8px 0;
    z-index: 100;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    color: #666666;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.nav-btn svg {
    width: 24px;
    height: 24px;
    transition: all 0.3s;
}

.nav-btn span {
    font-size: 11px;
    font-weight: 500;
}

.nav-btn.active {
    color: #0088ff;
}

.nav-btn.active svg {
    filter: none;
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-icon-wrap {
    position: relative;
}

.badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

.badge:empty {
    display: none;
}


.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    padding: 20px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--bg-card);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-hint {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: white;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s;
}

.input-wrap input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.currency {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    pointer-events: none;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


@media (max-width: 480px) {
    .header {
        padding: 12px 16px;
    }

    .username {
        font-size: 14px;
    }

    .balance {
        font-size: 16px;
    }

    .btn-refill {
        padding: 8px 16px;
        font-size: 13px;
    }

    .content {
        padding: 16px;
    }

    .gifts-grid {
        gap: 12px;
    }
}


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

.gift-card {
    animation: fadeIn 0.4s ease-out;
}

.gift-card:nth-child(odd) {
    animation-delay: 0.05s;
}

.gift-card:nth-child(even) {
    animation-delay: 0.1s;
}

