*, *::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;
}

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;
}

.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,
.modal-close-btn--overlay {
    width: var(--icon-3xl);
    height: var(--icon-3xl);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.modal-close-btn .lucide-icon,
.modal-close-btn svg,
.modal-close-btn--overlay .lucide-icon,
.modal-close-btn--overlay svg {
    width: var(--icon-md);
    height: var(--icon-md);
}

.modal-close-btn--overlay {
    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;
}

.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,
.modal-content,
body.tg-desktop #giftInfoModal .gift-info-modal,
.compose-modal-overlay .modal {
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative;
}

.screen::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.compose-modal-overlay .modal::-webkit-scrollbar,
body.tg-desktop #giftInfoModal .gift-info-modal::-webkit-scrollbar,
.gift-info-details::-webkit-scrollbar,
.filter-option-list::-webkit-scrollbar,
.filter-tabs::-webkit-scrollbar {
    display: none;
}

.screen.active {
    display: flex;
    flex: 1 1 0;
    min-height: 0;
}

.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 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
    line-height: var(--line-height-xl);
}

.modal-title {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
}

.header-status {
    display: flex;
    align-items: center;
    gap: var(--space-0);
    padding: var(--space-1) var(--space-2);
    background: var(--color-brand-alpha-15);
    border-radius: var(--radius-pill);
    line-height: var(--line-height-xs);
}

.header-balance {
    display: inline-flex;
    align-items: center;
    gap: var(--space-0);
    padding: var(--space-1) var(--space-2);
    padding-left: var(--space-1);
    background: var(--color-surface-default);
    border-radius: var(--radius-pill);
    line-height: 1;
    border: none;
    cursor: pointer;
    font: inherit;
}

.header-balance-ton-icon,
.header-balance .header-balance-ton-icon svg {
    width: var(--icon-md);
    height: var(--icon-md);
    flex-shrink: 0;
    color: var(--color-text-strong);
}

.balance-value {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-strong);
}

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

#screen-overview .header-status .status-dot {
    width: var(--icon-xs);
    height: var(--icon-xs);
    flex-shrink: 0;
    background: var(--color-text-brand);
    border-radius: var(--radius-full);
    box-shadow: 0 0 0 0 var(--color-brand-alpha-15);
    animation: brand-capsule-dot-pulse 2s ease-in-out infinite;
}

@keyframes brand-capsule-dot-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 var(--color-brand-alpha-8);
    }
    50% {
        opacity: 0.72;
        box-shadow: 0 0 0 var(--space-0) var(--color-brand-alpha-25);
    }
}

@keyframes live-capsule-dot-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 var(--color-status-error-alpha-15);
    }
    50% {
        opacity: 0.72;
        box-shadow: 0 0 0 var(--space-0) var(--color-status-error-alpha-15);
    }
}

.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) + var(--space-1));
    }
}

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,
#screen-store .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;
}

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

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

#screen-wallet .main-content > * {
    flex-shrink: 0;
}

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

body.tg-desktop #screen-wallet .main-content {
    padding-bottom: 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);
}
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;
}

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

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

.content-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);
}
.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-muted);
    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;
}

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;
}
