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

.lucide-icon,
[data-icon] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: auto;
    height: auto;
}

.lucide-icon {
    max-width: 100%;
    max-height: 100%;
}

.lucide-icon svg,
[data-icon] svg {
    display: block;
    flex-shrink: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overscroll-behavior: none;
    overflow: hidden;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

html {
    height: 100%;
}

body {
    position: relative;
    font-family: var(--font-family-base);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    background-color: var(--color-bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
}

input, textarea {
    user-select: text;
    -webkit-user-select: text;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

*:focus,
*:focus-visible {
    outline: none;
}

.clear-btn {
    width: var(--icon-md);
    height: var(--icon-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border-radius: 0;
    color: var(--color-text-default);
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.clear-btn svg {
    width: var(--icon-md);
    height: var(--icon-md);
    display: block;
}

.has-value .clear-btn {
    opacity: 1;
    pointer-events: auto;
}

input, select {
    font-family: inherit;
}

.modal-close-btn,
.gift-info-close-btn {
    width: var(--icon-3xl);
    height: var(--icon-3xl);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.modal-close-btn .lucide-icon,
.modal-close-btn svg,
.gift-info-close-btn .lucide-icon,
.gift-info-close-btn svg {
    width: var(--icon-lg);
    height: var(--icon-lg);
}

.referral-copy-btn .lucide-icon,
.referral-copy-btn svg,
.referral-share-btn .lucide-icon,
.referral-share-btn svg,
.settings-item-info .lucide-icon,
.settings-item-info svg {
    width: var(--icon-md);
    height: var(--icon-md);
}

.loading-dots span {
    animation: loading-dot-fade 2.2s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.37s; }
.loading-dots span:nth-child(3) { animation-delay: 0.73s; }

@keyframes loading-dot-fade {
    0%, 100% { opacity: 0.2; }
    25% { opacity: 1; }
    50% { opacity: 0.2; }
    75% { opacity: 1; }
}

.app {
    min-height: 100vh;
    min-height: var(--tg-viewport-height, 100vh);
    max-height: 100vh;
    max-height: var(--tg-viewport-height, 100vh);
    width: 100%;
    max-width: var(--container-max, 540px);
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    padding-left: var(--tg-safe-area-inset-left, 0px);
    padding-right: var(--tg-safe-area-inset-right, 0px);
    padding-top: 0;
    overflow: hidden;
}

html.app-ready .app {
    visibility: visible;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; 
    -ms-overflow-style: none; 
    overscroll-behavior: none; 
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
    touch-action: pan-y; 
    -webkit-overflow-scrolling: touch; 
    box-sizing: border-box;
    position: relative;
}

.screen::-webkit-scrollbar {
    display: none; 
}

.screen.active {
    display: flex;
}

.screen:not(.active) * {
    animation-play-state: paused !important;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-3);
    padding-top: var(--space-3);
    margin-bottom: var(--space-1);
    position: relative;
}

@media (pointer: coarse) {
    .header {
        padding-top: calc(var(--safe-area-inset-top) + var(--height-button-md));
    }
}

.page-title,
.modal-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    line-height: var(--line-height-xl);
}

.header-status,
.header-version {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    line-height: var(--line-height-xs);
}

.version-text,
.status-text {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-default);
}

.status-dot {
    width: var(--icon-xs);
    height: var(--icon-xs);
    background: var(--color-status-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    text-transform: uppercase;
}

.main-content {
    flex: 1;
    padding: 0 var(--space-3);
    padding-bottom: var(--space-content-bottom);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

#screen-activity .main-content {
    padding-bottom: calc(var(--nav-height) + var(--safe-area-inset-bottom) + var(--activity-row-gap));
}

@media (pointer: coarse) {
    #screen-activity .main-content {
        padding-bottom: calc(var(--nav-height) + var(--safe-area-inset-bottom) + var(--activity-row-gap));
    }
}

body.tg-desktop #screen-activity .main-content {
    padding-bottom: calc(var(--nav-height) - var(--activity-row-gap));
}

#screen-activity .main-content::after {
    content: '';
    display: block;
}

#screen-overview .main-content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    min-width: 0;
    padding-bottom: calc(var(--space-5) + var(--nav-height) + var(--safe-area-inset-bottom));
}

#screen-overview .main-content::after {
    content: '';
    display: block;
}

body.tg-desktop #screen-overview .main-content {
    padding-bottom: calc(var(--space-5) + var(--nav-height));
}

#screen-overview {
    -webkit-overflow-scrolling: auto;
}

.section-label {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
}

.modal .section-label {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
}


.activity-stats-section {
    display: flex;
    flex-direction: column;
}

.activity-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    row-gap: var(--space-2);
    column-gap: var(--space-1);
}

.activity-stat-card {
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    padding: var(--space-4) var(--space-4);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.activity-stat-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.activity-stat-icon {
    width: var(--icon-2xl);
    height: var(--icon-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-selected);
    border-radius: var(--radius-2xl);
    color: var(--color-text-strong);
    flex-shrink: 0;
}

.activity-stat-card[data-stat="burn"] .activity-stat-icon {
    background: var(--color-event-burn-alpha);
    color: var(--color-event-burn);
}

.activity-stat-card[data-stat="upgrade"] .activity-stat-icon {
    background: var(--color-event-upgrade-alpha);
    color: var(--color-event-upgrade);
}

.activity-stat-card[data-stat="craft"] .activity-stat-icon {
    background: var(--color-event-craft-alpha);
    color: var(--color-event-craft);
}

.activity-stat-icon svg,
.activity-stat-icon .lucide-icon {
    width: var(--icon-lg);
    height: var(--icon-lg);
    flex-shrink: 0;
}

.activity-stat-value {
    margin-bottom: var(--space-1);
}

.activity-stat-change {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-medium);
    min-height: var(--line-height-xs);
}

.activity-stat-change {
    color: var(--color-text-default);
}

.activity-stat-change .lucide-icon,
.activity-stat-change svg {
    width: var(--icon-xs);
    height: var(--icon-xs);
}

.activity-stat-change-value {
    color: var(--color-text-default);
}

.activity-stat-value {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    min-height: var(--line-height-lg);
}

.activity-stat-value span {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
}

@keyframes activity-stat-live-pulse {
    0% { color: var(--color-text-strong); }
    45% { color: var(--color-text-accent); }
    100% { color: var(--color-text-strong); }
}

@keyframes activity-stat-live-pulse-delta {
    0% { color: var(--color-text-default); }
    45% { color: var(--color-text-accent); }
    100% { color: var(--color-text-default); }
}

.activity-stat-value span.stat-live-pulse {
    animation: activity-stat-live-pulse 0.9s ease-in-out forwards;
}

.activity-stat-change-value.stat-live-pulse {
    animation: activity-stat-live-pulse-delta 0.9s ease-in-out forwards;
}

.search-bar-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.search-results-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 0;
    width: 100%;
}

.search-results-section.is-no-data {
    justify-content: flex-start;
    align-items: stretch;
    min-height: var(--height-list-sm);
}

.search-results-section.is-no-data .gift-cards-container {
    display: none;
}

.search-results-section.is-no-data .infinite-scroll-sentinel {
    display: none !important;
}

.infinite-scroll-sentinel {
    width: 100%;
    min-height: 1px;
    pointer-events: none;
}

#giftCardsContainer.gift-cards-container,
.gift-cards-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
    align-self: stretch;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    row-gap: var(--space-1);
    column-gap: var(--space-1);
    padding-bottom: 0; 
}

#giftCardsContainer.gift-cards-container.gift-cards-virtualizer-root,
.gift-cards-virtualizer-root {
    display: block;
    position: relative;
    width: 100%;
    max-width: 100%; 
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
    align-self: stretch;
    box-sizing: border-box;
}

.gift-cards-virtualizer-wrapper {
    position: relative;
    width: 100%;
}

.gift-cards-virtualizer-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.gift-cards-virtualizer-window > * {
    pointer-events: auto;
}

.gift-cards-virtualizer-row {
    position: absolute;
    left: 0;
    width: 100%;
    box-sizing: border-box;
}

.gift-cards-virtualizer-row .gift-card {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.gift-cards-virtualizer {
    grid-column: 1 / -1;
    position: relative;
    width: 100%;
}

.gift-card {
    aspect-ratio: 1;
    width: 100%;
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    contain: layout style paint;
    content-visibility: auto;
    contain-intrinsic-size: auto 1px;
}

.gift-card-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    border-radius: var(--radius-pill);
}

.gift-card-patterns {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.gift-card-pattern {
    position: absolute;
    width: var(--space-0);
    height: var(--space-0);
    opacity: 0.1;
    background-color: var(--color-pattern-base);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.gift-card-dark .gift-card-pattern,
.gift-info-preview.gift-card-dark .gift-card-pattern,
.gift-card-patterns.gift-card-dark .gift-card-pattern,
.gift-info-patterns.gift-card-dark .gift-card-pattern {
    opacity: 0.2;
    background-color: var(--color-overlay-light-92);
}

.gift-card-pattern svg {
    width: 100% !important;
    height: 100% !important;
}

.gift-card-model {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 65%;
    height: 65%;
    z-index: 3;
}

.gift-card-model svg {
    width: 100% !important;
    height: 100% !important;
}

.search-row {
    display: flex;
    column-gap: var(--space-1);
    min-width: 0;
}

.search-row > * {
    min-width: 0;
}

.search-row .search-input {
    flex: 1;
}

.search-row .icon-circle-btn {
    color: var(--color-text-strong);
}

.icon-circle-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--icon-6xl);
    height: var(--icon-6xl);
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    color: var(--color-text-default);
    flex-shrink: 0;
    cursor: pointer;
    z-index: 10;
    pointer-events: auto;
}

.icon-circle-btn svg,
.icon-circle-btn .lucide-icon {
    width: var(--icon-lg);
    height: var(--icon-lg);
    flex-shrink: 0;
}

.scroll-to-top-btn {
    position: fixed;
    right: max(var(--space-3), calc(50vw - var(--container-max, 540px) / 2 + var(--space-3)));
    bottom: calc(var(--space-5) + var(--nav-height) + var(--safe-area-inset-bottom));
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: var(--color-surface-selected);
    color: var(--color-text-strong);
}

.scroll-to-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.filter-badge {
    position: absolute;
    top: calc(-0.5 * var(--space-1));
    right: calc(-0.5 * var(--space-1));
    min-width: var(--icon-lg);
    height: var(--icon-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-1);
    background: var(--color-surface-cta);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    pointer-events: none;
}

.activity-live {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-status-error-alpha-10);
    border-radius: var(--radius-pill);
}

.live-dot {
    width: var(--icon-xs);
    height: var(--icon-xs);
    background: var(--color-status-error);
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 var(--color-status-error-alpha-40);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 0 var(--space-0) transparent;
    }
}

.live-text {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-status-error);
    text-transform: uppercase;
}

.promo-banner {
    width: 100%;
    background: linear-gradient(to right, var(--color-brand-dark) 0%, var(--color-brand) 50%, var(--color-brand-dark) 100%);
    border-radius: var(--radius-pill);
    padding: var(--space-4) var(--space-4);
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    backdrop-filter: blur(var(--space-1));
    -webkit-backdrop-filter: blur(var(--space-1));
    position: relative;
    z-index: 1;
}

.promo-banner-content {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    width: 100%;
}

.promo-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.promo-banner-title {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    margin-bottom: var(--space-1);
}

.promo-banner-subheading {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
}

.promo-banner .info-capsule {
    margin-top: var(--space-2);
    width: fit-content;
    pointer-events: none;
}

.promo-banner-lottie {
    width: var(--size-banner-lottie);
    height: var(--size-banner-lottie);
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.promo-banner-lottie canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.activity-full-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.search-input {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    height: var(--height-button-md);
    padding: 0 var(--space-4);
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    color: var(--color-text-muted);
}

.search-input svg {
    color: var(--color-text-default);
    flex-shrink: 0;
    display: block;
    width: var(--icon-md);
    height: var(--icon-md);
}

.search-input.has-value .clear-btn {
    opacity: 1;
    pointer-events: auto;
}

.search-input input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    padding-right: calc(var(--icon-lg) + var(--space-1));
}

.search-input .clear-btn {
    position: absolute;
    right: var(--space-4);
}

.search-input input::placeholder {
    color: var(--color-text-default);
}

.activity-feed {
    display: flex;
    flex-direction: column;
}

.activity-feed:has(.no-data-message) {
    min-height: var(--height-list-sm);
}

.activity-feed-top {
    display: flex;
    flex-direction: column;
    gap: var(--activity-row-gap);
    margin-bottom: var(--activity-row-gap);
}

.activity-feed-tail {
    position: relative;
    min-height: 0;
    flex-shrink: 0;
}

.activity-feed-tail-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.activity-feed-tail-window > * {
    pointer-events: auto;
}

.activity-infinite-sentinel {
    width: 100%;
    height: 1px;
    min-height: 1px;
    flex-shrink: 0;
    pointer-events: none;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-surface-default);
    border-radius: var(--radius-full);
    padding: var(--space-4) var(--space-4);
    min-height: var(--activity-row-height);
    box-sizing: border-box;
    cursor: pointer;
}

.activity-icon-wrapper {
    width: var(--icon-6xl);
    height: var(--icon-6xl);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.activity-gift-preview {
    width: var(--icon-6xl);
    height: var(--icon-6xl);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--radius-pill);
}

.activity-gift-preview .gift-card-model {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: var(--icon-4xl);
    height: var(--icon-4xl);
    z-index: 2;
}

.activity-gift-preview .gift-card-model img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.activity-icon-wrapper.upgrade-success {
    color: var(--color-event-upgrade);
}

.activity-icon-wrapper.activity-event-craft {
    color: var(--color-event-craft);
}

.activity-icon-wrapper.activity-event-burn {
    color: var(--color-event-burn);
}

.activity-icon-wrapper:has(.activity-gift-preview) {
    background: var(--color-surface-selected);
}

.activity-details {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.activity-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
}

.activity-title-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-0);
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
}

.activity-gift-name {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    flex-shrink: 0;
    white-space: nowrap;
}

.activity-id {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

.activity-meta-row {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.activity-meta-row .meta-capsule {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.activity-meta-row .meta-capsule-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--font-size-sm);
    height: var(--font-size-sm);
    flex-shrink: 0;
}

.activity-meta-row .meta-capsule-icon svg {
    width: 100%;
    height: 100%;
}

.activity-time {
    font-family: var(--font-family-base);
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-default);
    flex-shrink: 0;
    align-self: center;
    margin-left: auto;
}

.activity-item.activity-item--no-attributes {
    background: var(--color-surface-muted);
}

.activity-item.activity-removing {
    animation: activitySlideOut 0.2s ease forwards;
    pointer-events: none;
}

@keyframes activitySlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(var(--space-1));
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
        overflow: hidden;
    }
}

.activity-feed-status {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5) 0;
    color: var(--color-text-default);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
    font-weight: var(--font-weight-medium);
}

.activity-feed-status .loading-text {
    display: flex;
    align-items: baseline;
}

body.screen-settings-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    left: 0;
    top: 0;
}

body.screen-settings-active #screen-settings {
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

#screen-settings .settings-section .section-label {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    padding: var(--space-3) var(--space-4);
    color: var(--color-text-default);
    width: 100%;
    text-align: left;
}

.settings-item.toggle {
    padding: 0 var(--space-4);
    height: var(--height-button-md);
}

.settings-item-info {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex: 1;
}

.settings-item-info span {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
}

.settings-item-value {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.settings-item-value span {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-default);
}

#currentLanguage {
    color: var(--color-text-accent);
}

.settings-arrow {
    width: var(--icon-lg);
    height: var(--icon-lg);
    color: var(--color-text-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-switch {
    width: var(--icon-5xl);
    height: var(--height-button-sm);
    background: var(--color-surface-selected);
    border-radius: var(--radius-2xl);
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box;
}

.toggle-switch.active {
    background: var(--color-surface-cta);
}

.toggle-handle {
    width: calc(var(--height-button-sm) - 2 * var(--radius-xs));
    height: calc(var(--height-button-sm) - 2 * var(--radius-xs));
    background: var(--color-overlay-light-92);
    border-radius: 50%;
    transition: transform 0.2s ease;
    position: absolute;
    top: var(--radius-xs);
    left: var(--radius-xs);
    box-sizing: border-box;
}

.toggle-switch.active .toggle-handle {
    transform: translateX(calc(var(--icon-5xl) - var(--height-button-sm)));
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-overlay-dark);
    backdrop-filter: blur(var(--space-0));
    -webkit-backdrop-filter: blur(var(--space-0));
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-out, visibility 0s linear 0.2s;
    padding-top: 0;
    will-change: opacity;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
    touch-action: none;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease-out, visibility 0s linear 0s;
}

.modal-overlay:not(.active) {
    transition: opacity 0.2s ease-out, visibility 0s linear 0.2s;
}

.modal {
    width: 100%;
    max-width: var(--container-max, 540px);
    height: auto;
    max-height: 90vh;
    background: var(--color-bg-base);
    border-radius: var(--modal-radius) var(--modal-radius) 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
    overflow: hidden;
    will-change: transform;
    contain: layout style;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}
.modal-overlay:not(.active) .modal {
    transform: translateY(100%);
}

@media (pointer: coarse) {
    #overviewFiltersModal {
        padding-top: calc(var(--safe-area-inset-top) + var(--height-button-md));
    }
    #overviewFiltersModal .modal {
        height: 100%;
        max-height: 100%;
    }
}

body.tg-desktop #overviewFiltersModal {
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

body.tg-desktop #overviewFiltersModal .modal {
    width: 100%;
    max-width: var(--container-max, 540px);
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
}

#activityFiltersModal .modal {
    margin: 0;
}

#activityFiltersModal .modal-content {
    gap: var(--space-5);
    padding-bottom: var(--space-5);
}

body.tg-desktop #activityFiltersModal {
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

body.tg-desktop #activityFiltersModal .modal {
    width: 100%;
    max-width: var(--container-max, 540px);
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
}

#languageModal .modal {
    margin: 0;
}

#languageModal .modal-content {
    padding: var(--space-5) var(--space-3);
    padding-bottom: var(--space-5);
}

#referralModal .modal {
    margin: 0;
}

#referralModal .modal-content {
    padding: var(--space-5) 0;
    padding-bottom: var(--space-5);
    flex: 0 0 auto;
}

.referral-info-section {
    display: flex;
    flex-direction: column;
    padding-left: var(--space-3);
    padding-right: var(--space-3);
}

.referral-content-card {
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    padding: var(--space-4) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.referral-header-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.referral-soon-capsule {
    align-self: flex-start;
    color: var(--color-brand);
    background: var(--color-brand-alpha-15);
    white-space: nowrap;
}

.referral-content-title {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    margin: 0;
}

.referral-percent {
    color: var(--color-brand);
}

.referral-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    row-gap: var(--space-1);
    column-gap: var(--space-1);
}

.referral-stat-card {
    background: var(--color-surface-selected);
    border-radius: var(--radius-pill);
    padding: var(--space-4) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.referral-stat-card--muted {
    background: var(--color-surface-selected);
}

.referral-stat-value {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
}

.referral-stat-value > span:last-child {
    font-weight: var(--font-weight-semibold);
}

.referral-stat-value .lucide-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.referral-copy-btn,
.referral-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    border: none;
    cursor: pointer;
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-semibold);
    transition: all 0.2s ease;
}

.referral-copy-btn--round {
    width: var(--height-button-md);
    height: var(--height-button-md);
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color-surface-default);
    color: var(--color-text-strong);
    padding: 0;
}

.referral-copy-btn--round .lucide-icon,
.referral-copy-btn--round svg {
    width: var(--icon-lg);
    height: var(--icon-lg);
}

.referral-copy-btn--round.referral-copy-btn--muted {
    color: var(--color-text-muted);
}

.referral-copy-btn--round.referral-copy-btn--muted .lucide-icon,
.referral-copy-btn--round.referral-copy-btn--muted svg {
    color: var(--color-text-muted);
}

.referral-share-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-cta);
    border-radius: var(--radius-pill);
    color: var(--color-text-strong);
    min-width: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-3);
    border-bottom: var(--border-width-thin) solid var(--color-surface-default);
    touch-action: none;
    overscroll-behavior: none;
}

.modal-close-btn {
    background: var(--color-surface-default);
    color: var(--color-text-strong);
    transition: all 0.2s ease;
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: var(--space-5) 0;
    padding-top: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

.modal-footer {
    display: flex;
    column-gap: var(--space-1);
    padding-top: var(--space-3);
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    padding-bottom: calc(var(--space-3) + var(--safe-area-inset-bottom));
    border-top: var(--border-width-thin) solid var(--color-surface-default);
    flex-shrink: 0;
    background: var(--color-bg-base);
    touch-action: none;
    overscroll-behavior: none;
}

#giftInfoModal {
    align-items: flex-end;
    padding-top: 0;
    padding-bottom: 0;
}

#giftInfoModal .gift-info-modal {
    width: 100%;
    max-width: var(--container-max, 540px);
    height: auto;
    max-height: calc(100vh - var(--safe-area-inset-bottom));
    border-radius: var(--modal-radius) var(--modal-radius) 0 0;
    margin: 0;
    margin-bottom: 0;
    align-self: flex-end;
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
}

#giftInfoModal.active .gift-info-modal {
    transform: translateY(0);
}

#giftInfoModal:not(.active) .gift-info-modal {
    transform: translateY(100%);
}

body.tg-desktop #giftInfoModal {
    padding-top: 0;
    padding-bottom: 0;
    align-items: center;
    justify-content: center;
}

body.tg-desktop .gift-info-modal {
    width: auto;
    min-width: var(--modal-min-width);
    max-width: var(--container-max, 540px);
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding-bottom: 0;
    margin: 0;
}

.gift-info-visual {
    background: transparent;
    padding: 0;
    border-radius: var(--modal-radius) var(--modal-radius) 0 0;
    position: relative;
    margin: 0;
    margin-bottom: var(--space-5);
    flex-shrink: 0;
    overflow: hidden;
}

.gift-info-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: var(--space-3) var(--space-3) var(--space-3);
    align-items: stretch;
}

.gift-info-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.gift-info-header-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-1);
}

.gift-info-header-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-1);
}

.gift-info-preview-wrapper {
    width: var(--height-list-sm);
    height: var(--height-list-sm);
    margin: 0 auto;
    position: relative;
    flex-shrink: 0;
}

.gift-info-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: var(--color-surface-selected);
}

.gift-info-patterns {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
}

.info-capsule {
    height: var(--icon-3xl);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-overlay-light-10);
    backdrop-filter: blur(var(--space-1));
    -webkit-backdrop-filter: blur(var(--space-1));
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    white-space: nowrap;
}

.info-capsule .lucide-icon,
.info-capsule svg {
    color: var(--color-text-strong);
}

.gift-info-event-badge {
    display: none;
}

.gift-info-close-btn {
    background: var(--color-overlay-light-10);
    backdrop-filter: blur(var(--space-1));
    -webkit-backdrop-filter: blur(var(--space-1));
    color: var(--color-text-strong);
    transition: all 0.2s ease;
    margin-left: auto;
}

.gift-info-preview {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-info-preview .gift-card-model {
    width: var(--size-gift-preview);
    height: var(--size-gift-preview);
    top: auto;
    left: auto;
    transform: none;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.gift-info-name-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    flex-wrap: nowrap;
    pointer-events: none;
}

.gift-info-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    margin: 0;
    padding: 0;
    line-height: var(--line-height-lg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gift-info-id {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.gift-info-details {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--color-bg-base);
    margin: 0 var(--space-3);
    overflow: visible;
    flex-shrink: 0;
}

.gift-info-details::-webkit-scrollbar {
    display: none;
}

.gift-info-table-wrap {
    border-radius: var(--radius-pill);
    overflow: hidden;
    width: 100%;
    border: var(--border-width-thin) solid var(--color-surface-selected);
}

.gift-info-details-inner {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0;
    width: 100%;
    background: transparent;
}

.gift-info-pending-message {
    display: none;
    position: relative;
    border: none;
    border-radius: var(--radius-pill);
    padding: var(--space-3); 
    width: 100%;
    min-height: var(--min-height-pending-block);
    background: transparent;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.gift-info-modal.is-pending .gift-info-pending-message {
    display: flex;
}

.gift-info-modal.is-pending .gift-info-table-wrap {
    display: none;
}

.gift-info-pending-message .loading-text {
    display: inline-flex;
    align-items: baseline;
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
}

.gift-info-preview .gift-info-pending-lottie {
    width: var(--size-gift-preview);
    height: var(--size-gift-preview);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-info-preview .gift-info-pending-lottie canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.gift-info-preview .gift-info-pending-emoji {
    font-size: var(--font-size-emoji-hero);
    opacity: 0.6;
}

.gift-info-row {
    display: contents;
}

.gift-info-label {
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-default);
    padding: var(--space-2) var(--space-3);
    min-height: var(--height-table-row);
    background: var(--color-surface-default);
    border-right: var(--border-width-thin) solid var(--color-surface-selected);
    border-bottom: var(--border-width-thin) solid var(--color-surface-selected);
}

.gift-info-value {
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    min-height: var(--height-table-row);
    min-width: 0;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    text-align: left;
    background: transparent;
    border-bottom: var(--border-width-thin) solid var(--color-surface-selected);
}

.gift-info-row:first-child .gift-info-label,
.gift-info-row:first-child .gift-info-value {
    border-top: none;
}

.gift-info-row:last-child .gift-info-label,
.gift-info-row:last-child .gift-info-value {
    border-bottom: none;
}

/* Спалений гіфт: рядок owner прихований — прибираємо верхню лінію у першого видимого рядка */
.gift-info-table-wrap.is-burned .gift-info-row:nth-child(2) .gift-info-label,
.gift-info-table-wrap.is-burned .gift-info-row:nth-child(2) .gift-info-value {
    border-top: none;
}

.gift-info-value .gift-info-owner-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gift-info-owner-name-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    overflow: hidden;
}

.gift-info-owner-name-wrapper .gift-info-owner-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gift-info-owner-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gift-info-owner-badge svg {
    width: var(--icon-base);
    height: var(--icon-base);
}

.gift-info-owner-badge svg path:first-of-type {
    stroke: var(--color-text-accent);
}

.gift-info-owner-badge svg path:last-of-type {
    stroke: var(--color-text-strong);
}

.gift-info-owner-name {
    color: var(--color-text-strong);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gift-info-owner-link {
    color: var(--color-text-accent);
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.gift-info-owner-text {
    color: var(--color-text-strong);
}

.gift-info-row[data-row="owner"] .gift-info-value {
    gap: var(--space-1);
    max-width: 100%;
    overflow: hidden;
}

.gift-info-value .gift-info-name {
    margin-right: var(--space-1);
}

.meta-capsule,
.gift-info-meta {
    display: inline-block;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-medium);
    padding: var(--space-0) var(--space-2);
    border-radius: var(--radius-2xl);
    vertical-align: middle;
    box-sizing: border-box;
}

.meta-capsule[data-event="burn"] {
    color: var(--color-event-burn);
    background: var(--color-event-burn-alpha);
}

.meta-capsule[data-event="upgrade"] {
    color: var(--color-event-upgrade);
    background: var(--color-event-upgrade-alpha);
}

.meta-capsule[data-event="craft"] {
    color: var(--color-event-craft);
    background: var(--color-event-craft-alpha);
}

.gift-info-meta {
    color: var(--color-text-default);
    background: var(--color-surface-selected);
}

.gift-info-meta[data-rarity="legendary"] {
    color: var(--color-rarity-legendary);
    background: var(--color-rarity-legendary-alpha);
}

.gift-info-meta[data-rarity="epic"] {
    color: var(--color-rarity-epic);
    background: var(--color-rarity-epic-alpha);
}

.gift-info-meta[data-rarity="rare"] {
    color: var(--color-rarity-rare);
    background: var(--color-rarity-rare-alpha);
}

.gift-info-meta[data-rarity="uncommon"] {
    color: var(--color-rarity-uncommon);
    background: var(--color-rarity-uncommon-alpha);
}

.gift-info-value .gift-info-meta:empty {
    display: none;
}

#giftInfoModal .modal-footer {
    margin-top: var(--space-5);
}

#giftInfoModal .modal-footer .gift-info-action-btn {
    flex: 1;
    width: 100%;
}

.gift-info-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-cta);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.modal-reset-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: none;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
}

.modal-reset-btn.is-empty {
    color: var(--color-text-muted);
    cursor: default;
}


.modal-apply-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-cta);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    transition: all 0.2s ease;
}

.language-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.language-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
}

.language-item-label {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.language-flag {
    width: var(--icon-lg);
    height: var(--icon-lg);
    flex-shrink: 0;
    border-radius: var(--radius-xs);
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.language-flag svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.language-name {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
}

.language-radio {
    width: var(--icon-lg);
    height: var(--icon-lg);
    border-radius: 50%;
    border: var(--border-width-thick) solid var(--color-surface-selected);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: none;
}

.language-radio::after {
    content: '';
    width: var(--icon-xs);
    height: var(--icon-xs);
    border-radius: 50%;
    background: transparent;
    transition: none;
}

.language-item.active .language-radio {
    border-color: var(--color-surface-cta);
}

.language-item.active .language-radio::after {
    background: var(--color-surface-cta);
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding-left: var(--space-3);
    padding-right: var(--space-3);
}

.filter-type-buttons,
.supply-buttons,
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    row-gap: var(--space-2);
    column-gap: var(--space-1);
}

.filter-type-btn,
.supply-btn,
.preset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-default);
}

.filter-type-btn.active,
.supply-btn.active,
.preset-btn.active {
    background: var(--color-surface-selected);
    color: var(--color-text-strong);
}

.filter-type-btn .lucide-icon,
.filter-type-btn svg,
.supply-btn .lucide-icon,
.supply-btn svg,
.preset-btn .lucide-icon,
.preset-btn svg {
    width: var(--icon-md);
    height: var(--icon-md);
}

.preset-section-hint {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin: 0;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    color: var(--color-text-default);
}

.preset-section-hint .lucide-icon,
.preset-section-hint svg {
    width: var(--icon-xs);
    height: var(--icon-xs);
    flex-shrink: 0;
    color: var(--color-text-default);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.input-clear-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.input-clear-wrapper .range-input {
    width: 100%;
    padding-right: calc(var(--space-4) + var(--icon-lg) + var(--space-1));
}

.input-clear-wrapper .clear-btn {
    position: absolute;
    right: var(--space-4);
}

.range-input {
    flex: 1;
    min-width: 0;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-default);
    border: none;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    outline: none;
    transition: all 0.2s ease;
}

.range-input::placeholder {
    color: var(--color-text-default);
}


.range-separator {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.filter-selects {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-dropdown {
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    width: 100%;
    min-width: 0;
    position: relative;
    contain: layout style;
}   

.filter-dropdown.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.filter-dropdown.disabled .dropdown-toggle {
    cursor: not-allowed;
}

.dropdown-arrow {
    width: var(--icon-lg);
    height: var(--icon-lg);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dropdown-arrow svg {
    transition: transform 0.1s ease-out;
}

.filter-dropdown.open .dropdown-arrow svg {
    transform: rotate(180deg);
}

.filter-dropdown.open .dropdown-menu {
    max-height: var(--height-list-md);
    opacity: 1;
    pointer-events: auto;
    padding: 0 0 var(--space-3) 0;
    visibility: visible;
}

.filter-select-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: transparent;
}

.filter-select-btn--muted {
    cursor: default;
    background: var(--color-surface-muted);
    border-radius: var(--radius-pill);
}

.filter-select-btn--muted .filter-select-label {
    color: var(--color-text-muted);
}

.filter-select-btn--muted .filter-select-value {
    color: var(--color-text-default);
}

.filter-select-btn--muted .dropdown-arrow,
.filter-select-btn--muted .dropdown-arrow svg {
    color: var(--color-text-muted);
}


.filter-select-label {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-default);
}

.filter-select-value {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    margin-right: auto;
}

.filter-dropdown .filter-select-btn svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: none;
}

.dropdown-menu {
    flex-direction: column;
    gap: var(--space-3);
    padding: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    width: 100%;
    min-width: 0;
    contain: layout style;
    visibility: hidden;
    transition: none;
}

.dropdown-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    height: var(--height-button-md);
    padding: 0 var(--space-4);
    background: var(--color-surface-selected);
    border-radius: var(--radius-pill);
    margin: 0 var(--space-4) var(--space-3) var(--space-4);
    width: calc(100% - calc(var(--space-4) * 2));
    min-width: 0;
    box-sizing: border-box;
    transition: opacity 0.2s ease, margin 0.2s ease, height 0.2s ease;
    opacity: 1;
}

.dropdown-search.has-value .clear-btn {
    opacity: 1;
    pointer-events: auto;
}

.dropdown-search svg {
    color: var(--color-text-default);
    flex-shrink: 0;
}

.dropdown-search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-strong);
    padding-right: calc(var(--icon-lg) + var(--space-1));
}

.dropdown-search .clear-btn {
    position: absolute;
    right: var(--space-4);
}

.dropdown-search input::placeholder {
    color: var(--color-text-default);
}

.dropdown-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-height: var(--height-list-sm);
    max-height: var(--height-list-sm); 
    overflow-y: auto;
    overscroll-behavior: contain; 
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 var(--space-4);
    content-visibility: auto;
    contain-intrinsic-size: 0 var(--intrinsic-list-height);
    contain: layout style paint;
    padding-top: 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    transform: translateZ(0);
    will-change: scroll-position;
}

.dropdown-items::-webkit-scrollbar {
    display: none;
}

.dropdown-models-sentinel {
    height: 1px;
    width: 100%;
    visibility: hidden;
    pointer-events: none;
    flex-shrink: 0;
}

.dropdown-item {
    width: 100%;
    padding: 0;
    background: transparent;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    font-weight: var(--font-weight-medium);
    text-align: left;
    contain: layout style;
}

.dropdown-item-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--space-2);
}

.dropdown-item-left {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
}

.dropdown-item-icon-wrapper {
    width: var(--icon-6xl);
    height: var(--icon-6xl);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-selected);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.dropdown-item-icon {
    width: var(--icon-4xl);
    height: var(--icon-4xl);
    flex-shrink: 0;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.dropdown-item-icon.lottie-icon {
    background: transparent;
}

.dropdown-item-icon.lottie-icon svg {
    width: var(--icon-4xl) !important;
    height: var(--icon-4xl) !important;
}

.dropdown-item-icon.lottie-icon[data-type="symbol"] {
    filter: brightness(0) invert(1);
}

.dropdown-item-icon.backdrop-circle {
    width: var(--icon-6xl);
    height: var(--icon-6xl);
    border-radius: var(--radius-pill);
}

.dropdown-item-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
}

.dropdown-item-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
}

.dropdown-item-text {
    font-size: var(--font-size-md);
    line-height: var(--line-height-md);
    color: var(--color-text-strong);
    min-width: 0;
}

.dropdown-item-meta {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
    color: var(--color-text-default);
}

.dropdown-item-meta--legendary {
    color: var(--color-rarity-legendary);
}

.dropdown-item-meta--epic {
    color: var(--color-rarity-epic);
}

.dropdown-item-meta--rare {
    color: var(--color-rarity-rare);
}

.dropdown-item-meta--uncommon {
    color: var(--color-rarity-uncommon);
}

.dropdown-item-right {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-shrink: 0;
}

.checkbox {
    width: var(--icon-lg);
    height: var(--icon-lg);
    border: var(--border-width-thick) solid var(--color-surface-selected);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dropdown-item.active .checkbox {
    background: var(--color-surface-cta);
    border-color: var(--color-surface-cta);
}

.checkbox svg,
.checkbox .lucide-icon {
    opacity: 0;
    color: var(--color-text-strong);
    transition: none;
    width: var(--icon-xs);
    height: var(--icon-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-item.active .checkbox svg,
.dropdown-item.active .checkbox .lucide-icon {
    opacity: 1;
}


.filter-tabs {
    display: flex;
    gap: var(--space-1);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: var(--space-1);
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-default);
    white-space: nowrap;
    transition: all 0.2s ease;
}


.filter-tab.active {
    background: var(--color-surface-cta);
    color: var(--color-text-strong);
}

.bottom-nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    max-width: var(--container-max, 540px);
    margin: 0 auto;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: var(--space-3);
    padding-bottom: calc(var(--space-3) + var(--safe-area-inset-bottom));
    padding-left: max(var(--space-3), var(--safe-area-inset-left));
    padding-right: max(var(--space-3), var(--safe-area-inset-right));
    background: var(--color-bg-base);
    border-top: var(--border-width-thin) solid var(--color-surface-default);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: var(--radius-xl);
    color: var(--color-text-default);
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.nav-item.active {
    color: var(--color-surface-cta);
}

.nav-item svg,
.nav-item .lucide-icon {
    width: var(--icon-2xl);
    height: var(--icon-2xl);
    flex-shrink: 0;
}

:root {
    --tg-viewport-height: 100vh;
    --tg-viewport-stable-height: 100vh;
}

body.tg-mobile {
    touch-action: pan-y;
}


body.tg-desktop {
    cursor: default;
}

body.tg-desktop .screen {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: auto;
    touch-action: auto;
}

@media (max-width: var(--breakpoint-xxs)) {
    .filter-type-buttons,
    .supply-buttons,
    .preset-buttons {
        flex-direction: column;
    }
}

.no-data-message[hidden] {
    display: none !important;
}

.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: center;
    gap: var(--space-3);
    color: var(--color-text-strong);
    font-size: var(--font-size-md);
    text-align: center;
    width: 100%;
}