:root {
    --primary-color: #000000;
    --secondary-color: #1a1a1a;
    --accent-color: #007aff;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --border-color: #2c2c2e;
    --card-bg: #1c1c1e;
    --modal-bg: rgba(0, 0, 0, 0.8);
    --content-max-width: 600px;
    --balance-color: #34c759;
    --profile-bg: rgba(28, 28, 30, 0.9);
    --clear-filters-bg: #ff3b30;
    --modal-skeleton-bg: rgba(255, 255, 255, 0.08);
    --modal-skeleton-shimmer-start: rgba(255, 255, 255, 0.15);
    --modal-skeleton-shimmer-mid: rgba(255, 255, 255, 0.25);
    --modal-skeleton-shimmer-end: rgba(255, 255, 255, 0.15);
    --modal-skeleton-border: rgba(255, 255, 255, 0.06);
    --modal-skeleton-value-bg: rgba(255, 255, 255, 0.03);
    --modal-skeleton-label-bg: rgba(255, 255, 255, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--primary-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.5; transform: scale(0.95); }
}
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.top-section {
    position: relative;
    min-height: 65px;
    padding: 16px;
    margin-top: 0;
}

.banner-container {
    width: 100%;
    margin-top: 90px;
    display: flex;
    justify-content: center;
}
.banner-container:empty { display: none; }
.site-banner {
    width: 100%;
    max-width: 800px;
    height: auto;
    max-height: 150px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.site-banner[src*="no_img"] { display: none; }

.profile-container {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    align-items: center;
    background: var(--profile-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 50px;
    padding: 8px 12px 8px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    max-width: 200px;
    z-index: 100;
    transition: all 0.3s ease;
}
.profile-container:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}
.profile-info {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.profile-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
    flex-shrink: 0;
}
.profile-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.profile-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
    line-height: 1.2;
}
.profile-balance {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.2;
}
.balance-value {
    font-weight: 600;
    color: var(--balance-color);
}
.balance-currency {
    font-size: 13px;
    color: var(--balance-color);
    font-weight: 600;
}
.profile-refresh-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
}
.profile-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
}
.profile-refresh-btn:active { transform: none !important; }
.profile-refresh-btn.balance-loading svg {
    animation: spin 1s linear infinite;
    color: var(--accent-color);
}
.profile-refresh-btn.balance-loading {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
}
.profile-refresh-btn.balance-success svg { color: #34c759 !important; }
.profile-refresh-btn.balance-error svg { color: #ff3b30 !important; }

.content-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 0 0 0;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
#mainContent {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    touch-action: pan-y;
    will-change: transform;
}

.main-container {
    width: 100%;
    margin: 0 auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.main-container-inner {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
}
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.container-inner {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
}
.hidden { display: none !important; }

.clear-filters-section {
    width: 100%;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease-out;
}
.clear-filters-btn {
    width: 100%;
    padding: 10px 16px;
    background-color: var(--clear-filters-bg);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
}
.clear-filters-btn:hover {
    background-color: #ff2d23;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
}
.clear-filters-btn:active {
    transform: translateY(0);
    background-color: #ff1f15;
}
.clear-filters-icon { flex-shrink: 0; }
.clear-filters-btn span { font-weight: 500; }

.filter-section, .sort-section, .refresh-section {
    width: 100%;
    margin-bottom: 16px;
}
.filter-wrapper {
    background-color: var(--secondary-color);
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
}
.filter-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
}
.filter-row:last-child { border-bottom: none; }
.filter-btn {
    flex: 1;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-right: 1px solid var(--border-color);
    min-height: 60px;
    transition: opacity 0.2s;
}
.filter-btn.disabled { opacity: 0.5; cursor: not-allowed; }
.filter-btn:last-child { border-right: none; }
.filter-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}
.filter-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: block;
}
.filter-value {
    font-size: 16px;
    font-weight: 500;
    display: block;
}
.filter-image {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}
.chevron-icon {
    color: var(--text-secondary);
    margin-left: 8px;
    flex-shrink: 0;
}
.sort-btn {
    width: 100%;
    padding: 16px;
    background-color: var(--secondary-color);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sort-icon {
    margin-right: 8px;
    color: var(--text-secondary);
}
.refresh-btn {
    width: 100%;
    padding: 14px 16px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    height: 48px;
    min-height: 48px;
    overflow: hidden;
}
.refresh-btn:hover { opacity: 0.9; }
.refresh-btn:active { opacity: 0.8; transform: none !important; }
.refresh-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.refresh-icon {
    margin-right: 8px;
    color: var(--text-primary);
    width: 22px;
    height: 22px;
    opacity: 0.95;
    display: block;
    flex-shrink: 0;
}
.refresh-btn span {
    display: inline-block;
    line-height: 1;
    font-size: 16px;
    font-weight: 600;
    transition: opacity 0.2s;
    min-width: 70px;
    text-align: center;
}
.refresh-btn span::before { content: none; }
.refresh-btn.gifts-loading .refresh-icon {
    animation: spin 1s linear infinite;
    color: var(--text-primary);
}
.refresh-btn.gifts-loading { opacity: 0.9; }
.refresh-btn.gifts-success .refresh-icon { color: #34c759 !important; }
.refresh-btn.gifts-error .refresh-icon { color: #ff3b30 !important; }
.refresh-btn.gifts-success::after,
.refresh-btn.gifts-error::after { content: none; }
.refresh-btn,
.refresh-btn.gifts-loading,
.refresh-btn.gifts-success,
.refresh-btn.gifts-error {
    height: 48px !important;
    min-height: 48px !important;
    padding: 14px 16px !important;
}
.profile-refresh-btn,
.profile-refresh-btn.balance-loading,
.profile-refresh-btn.balance-success,
.profile-refresh-btn.balance-error {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
}

.nft-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}
.nft-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    opacity: 0;
    transform: translateY(10px);
}
.nft-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.nft-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.nft-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background-color: var(--secondary-color);
    transition: transform 0.3s ease;
}
.nft-card:hover .nft-image { transform: scale(1.03); }
.nft-info { padding: 12px; }
.nft-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nft-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-color);
}
.nft-price.unavailable {
    color: var(--text-secondary);
    font-size: 14px;
}
.market-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
    grid-column: 1 / -1;
    animation: fadeIn 0.5s ease-out;
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.observer-target {
    height: 20px;
    width: 100%;
    grid-column: 1 / -1;
}
.pagination-info {
    text-align: center;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    grid-column: 1 / -1;
}
.loading { padding: 40px; text-align: center; color: var(--text-secondary); }
.error { padding: 40px; text-align: center; color: #ff3b30; }

.loading-cards-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    animation: pulse 1.5s ease-in-out infinite;
}
.loading-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    height: 260px;
}
.loading-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--card-bg) 0%, var(--secondary-color) 50%, var(--card-bg) 100%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite linear;
}
.loading-image {
    width: 100%;
    height: 180px;
    background-color: var(--secondary-color);
    position: relative;
    overflow: hidden;
}
.loading-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--secondary-color) 0%, rgba(255, 255, 255, 0.1) 50%, var(--secondary-color) 100%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite linear;
}
.loading-info {
    padding: 12px;
    position: relative;
    overflow: hidden;
}
.loading-line {
    background-color: var(--secondary-color);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.loading-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--secondary-color) 0%, rgba(255, 255, 255, 0.1) 50%, var(--secondary-color) 100%);
    background-size: 200px 100%;
    animation: shimmer 1.5s linear infinite;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: var(--modal-bg);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-sheet {
    background-color: var(--primary-color);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 600; }
.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.search-input {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
}
.collection-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}
.collection-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}
.collection-item:hover { background-color: var(--secondary-color); }
.collection-item.selected { background-color: rgba(0, 122, 255, 0.1); }
.collection-image {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.collection-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.collection-checkbox.selected {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}
.collection-checkbox.selected::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}
.collection-info { flex: 1; min-width: 0; }
.collection-name {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.collection-details,
.collection-floor {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.collection-floor.empty {
    color: var(--text-secondary);
    opacity: 0.6;
}
.sort-list { padding: 8px 0; }
.sort-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}
.sort-item:hover { background-color: var(--secondary-color); }
.sort-item.selected { background-color: rgba(0, 122, 255, 0.1); }
.sort-name { font-size: 16px; }
.apply-btn {
    margin: 16px;
    padding: 14px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.apply-btn:hover { opacity: 0.9; }

#sortModal .modal-sheet {
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
#sortModal .modal-header { flex-shrink: 0; }
#sortModal .sort-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    padding: 0;
}
#sortModal .apply-btn {
    margin: 16px;
    padding: 14px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    display: block;
    width: calc(100% - 32px);
    flex-shrink: 0;
}
#sortModal .apply-btn:hover { opacity: 0.9; }
#sortModal .apply-btn:active { transform: scale(0.98); }

.buy-modal-sheet {
    max-width: 450px !important;
    width: 95% !important;
    max-height: 85vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}
.buy-modal-sheet .buy-modal-content {
    overflow-y: auto !important;
    flex: 1 !important;
    padding: 16px !important;
}
#buyModal .modal-sheet {
    max-height: 85vh !important;
    overflow: hidden !important;
}
.gift-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}
.buy-gift-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.gift-info {
    text-align: center;
    margin-bottom: 12px;
}
.gift-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.gift-number {
    font-size: 13px;
    color: var(--accent-color);
    font-weight: 500;
}
#giftFooter {
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    background: var(--primary-color);
    flex-shrink: 0;
    display: none;
}
#funpayCommand {
    margin-top: 12px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    text-align: left;
    padding: 0;
    line-height: 1.5;
    color: var(--text-primary);
    background: transparent;
    width: 100%;
    box-sizing: border-box;
}

.star-gift-modal-sheet {
    max-width: 420px !important;
    width: 92% !important;
}
.star-gift-modal-content {
    padding: 20px 16px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.star-gift-modal-image {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 14px;
    background: var(--secondary-color);
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    margin-bottom: 14px;
}
.star-gift-modal-name {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 18px;
    line-height: 1.3;
    word-break: break-word;
}
.quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}
.qty-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--secondary-color);
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
    padding: 0;
}
.qty-btn:hover {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
}
.qty-btn:active { transform: scale(0.94); }
.qty-input {
    width: 90px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--secondary-color);
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
    outline: none;
    transition: border-color 0.2s;
}
.qty-input:focus { border-color: var(--accent-color); }
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.total-price-row {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.total-price-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1.1;
}
.star-gift-buy-btn {
    width: 100%;
    padding: 15px;
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.star-gift-buy-btn:hover { opacity: 0.9; }
.star-gift-buy-btn:active { transform: scale(0.98); }
.star-gift-buy-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.bottom-tabs {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    background: var(--primary-color);
    padding: 8px 16px calc(44px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color);
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
    width: 100%;
}
.bottom-tabs .section-tabs {
    margin-bottom: 0;
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
}
.section-tabs {
    width: 100%;
    background: var(--secondary-color);
    border-radius: 12px;
    padding: 4px;
    display: flex;
    gap: 4px;
    position: relative;
    overflow: hidden;
}
.section-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s cubic-bezier(0.34, 1.2, 0.64, 1),
                color 0.25s ease,
                box-shadow 0.25s ease;
    text-align: center;
    position: relative;
    z-index: 2;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.section-tab .tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.25s;
    object-fit: contain;
}
.section-tab.active .tab-icon { opacity: 1; }
.section-tab.active {
    background: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}
.section-tab:active { transform: scale(0.96); }
.section-tab .tab-label {
    display: flex;
    align-items: center;
    gap: 6px;
}
@media (hover: hover) and (pointer: fine) {
    .section-tab:not(.active):hover {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-primary);
    }
    [data-theme="light"] .section-tab:not(.active):hover {
        background: rgba(0, 0, 0, 0.03);
    }
}

.star-gifts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px;
    width: 100%;
}
.star-gift-card {
    height: 150px;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    background-color: var(--card-bg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    padding: 10px 2px 2px 2px;
}
.star-gift-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.star-gift-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.star-gift-card .gift-image {
    flex: 1;
    min-height: 0;
    width: 80%;
    height: 80%;
    object-fit: contain !important;
    background-color: var(--secondary-color);
    transition: transform 0.3s ease;
    display: block;
    margin: auto auto 6px;
}
.star-gift-card:hover .gift-image { transform: scale(1.03); }
.star-gift-card .gift-info {
    flex-shrink: 0;
    padding: 10px 0 0;
    text-align: center;
    background: transparent;
    line-height: 1.0;
    margin-top: auto;
}
.star-gift-card .gift-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-color);
}
.star-gifts-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
    grid-column: 1 / -1;
    animation: fadeIn 0.5s ease-out;
}
.star-gifts-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

[data-theme="light"] {
    --primary-color: #f2f2f7;
    --secondary-color: #e5e5ea;
    --text-primary: #000000;
    --text-secondary: #8e8e93;
    --border-color: #d1d1d6;
    --card-bg: #ffffff;
    --profile-bg: rgba(255, 255, 255, 0.9);
    --modal-bg: rgba(0, 0, 0, 0.5);
    --balance-color: #34c759;
    --modal-skeleton-bg: rgba(0, 0, 0, 0.08);
    --modal-skeleton-shimmer-start: rgba(0, 0, 0, 0.12);
    --modal-skeleton-shimmer-mid: rgba(0, 0, 0, 0.2);
    --modal-skeleton-shimmer-end: rgba(0, 0, 0, 0.12);
    --modal-skeleton-border: rgba(0, 0, 0, 0.06);
    --modal-skeleton-value-bg: rgba(0, 0, 0, 0.03);
    --modal-skeleton-label-bg: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .profile-container {
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .profile-container:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .profile-refresh-btn:hover { background: rgba(0, 0, 0, 0.05); }
[data-theme="light"] .profile-refresh-btn.balance-loading { background: rgba(0, 0, 0, 0.05); }
[data-theme="light"] .site-banner { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); }
[data-theme="light"] .nft-card { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); }
[data-theme="light"] .nft-card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); }
[data-theme="light"] .filter-wrapper { background-color: var(--secondary-color); }
[data-theme="light"] .sort-btn { background-color: var(--secondary-color); }
[data-theme="light"] .modal-sheet { background-color: var(--primary-color); }
[data-theme="light"] .search-input {
    background-color: var(--secondary-color);
    color: var(--text-primary);
}
[data-theme="light"] .collection-item:hover { background-color: var(--secondary-color); }
[data-theme="light"] .collection-item.selected { background-color: rgba(0, 122, 255, 0.1); }
[data-theme="light"] .sort-item:hover { background-color: var(--secondary-color); }
[data-theme="light"] .sort-item.selected { background-color: rgba(0, 122, 255, 0.1); }
[data-theme="light"] .loading-card { background-color: var(--card-bg); }
[data-theme="light"] .loading-image,
[data-theme="light"] .loading-line { background-color: var(--secondary-color); }
[data-theme="light"] .loading-image::after,
[data-theme="light"] .loading-line::after {
    background: linear-gradient(90deg,
        var(--secondary-color) 0%,
        rgba(0, 0, 0, 0.08) 50%,
        var(--secondary-color) 100%);
    background-size: 200px 100%;
}
[data-theme="light"] .clear-filters-btn { box-shadow: 0 2px 8px rgba(255, 59, 48, 0.25); }
[data-theme="light"] .clear-filters-btn:hover { box-shadow: 0 4px 12px rgba(255, 59, 48, 0.35); }
[data-theme="light"] .star-gift-card { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); }
[data-theme="light"] .star-gift-card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); }
[data-theme="light"] .star-gift-card .gift-info { background: transparent; }
[data-theme="light"] .star-gift-modal-image { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); }
[data-theme="light"] .qty-btn:hover {
    background: var(--accent-color);
    color: #ffffff;
}

@media (hover: none) and (pointer: coarse) and (max-width: 480px) {
    .top-section { margin-top: 60px; }
}
@media (hover: none) and (pointer: coarse) and (max-width: 360px) {
    .top-section { margin-top: 60px; }
}
@media (hover: hover) and (pointer: fine) {
    .top-section { margin-top: 0 !important; }
}

@media (max-width: 480px) {
    .profile-container {
        top: 12px;
        right: 12px;
        padding: 6px 10px 6px 6px;
        max-width: 180px;
    }
    .profile-name { font-size: 13px; max-width: 70px; }
    .profile-balance { font-size: 14px; }
    .profile-photo { width: 32px; height: 32px; }
    .balance-currency { font-size: 12px; }
    .banner-container { margin-top: 60px; }
    .site-banner { max-height: 100px; border-radius: 12px; }
    .clear-filters-btn { padding: 9px 14px; font-size: 13px; }
    .clear-filters-icon { width: 14px; height: 14px; }
    .nft-grid { gap: 10px; }
    .nft-info { padding: 10px; }
    .nft-name { font-size: 12px; }
    .nft-price { font-size: 14px; }
    .buy-gift-image { width: 150px; height: 150px; }
    .star-gift-modal-image { width: 120px; height: 120px; }
    .qty-input { width: 80px; }
}

@media (max-width: 360px) {
    .profile-container { max-width: 160px; }
    .profile-name { max-width: 60px; font-size: 12px; }
    .profile-photo { width: 30px; height: 30px; }
    .balance-value { font-size: 13px; }
    .site-banner { max-height: 80px; }
    .clear-filters-btn { padding: 8px 12px; font-size: 12px; }
    .star-gift-modal-image { width: 100px; height: 100px; }
    .qty-btn { width: 44px; height: 44px; font-size: 22px; }
    .qty-input { width: 70px; height: 44px; font-size: 18px; }
}

@media (min-width: 768px) {
    .main-container,
    .container {
        padding-left: max(16px, calc((100% - var(--content-max-width)) / 2));
        padding-right: max(16px, calc((100% - var(--content-max-width)) / 2));
    }
    .nft-grid { gap: 16px; }
    .profile-container { top: 16px; right: 24px; }
    .banner-container { margin-top: 80px; }
    .site-banner { max-height: 160px; }
    .clear-filters-section { margin-bottom: 14px; }
    .clear-filters-btn { padding: 11px 18px; font-size: 15px; }
}

@media (min-width: 1024px) {
    :root { --content-max-width: 600px; }
    .nft-grid { gap: 16px; }
    .profile-container { max-width: 220px; }
    .profile-name { max-width: 100px; }
    .banner-container { margin-top: 90px; }
    .site-banner { max-height: 180px; }
}
