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

html,
body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(to bottom, #2d2d35 0%, #000000 100%);
    color: #f5f5f7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

#fallingCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    pointer-events: none;
}

.falling-item {
    position: fixed;
    z-index: 4;
    width: var(--fall-size, 38px);
    height: var(--fall-size, 38px);
    pointer-events: none;
    will-change: transform, opacity;
}

.falling-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.48));
}

.falling-item.is-fallback {
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.48);
}

.falling-item.is-fallback.gold { background: #e5b72d; }
.falling-item.is-fallback.diamond { background: #54d9f4; transform: rotate(45deg); }
.falling-item.is-fallback.emerald { background: #29ca69; transform: rotate(45deg); }

#pageLoading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #2d2d35 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

#pageLoading.hidden {
    opacity: 0;
    pointer-events: none;
}

#pageLoading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#pageLoading .loading-text {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin-top: 16px;
}

#pageLoading .loading-sub {
    color: #8a8a92;
    font-size: 11px;
    margin-top: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#homeContent {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

#homeContent.visible {
    display: flex;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, #86efac, #22c55e);
    padding: 8px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    flex-shrink: 0;
    min-height: 50px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-brand:hover { transform: scale(1.03); }
.nav-brand:active { transform: scale(0.95); }

.nav-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-btn,
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    min-height: 42px;
    padding: 9px 17px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: none;
    font-family: inherit;
}

.nav-btn {
    background: transparent;
    color: #fff;
    border: 1px solid #fff;
}

.nav-btn:hover {
    background: rgba(255,255,255,.2);
    transform: translateY(-2px) scale(1.04);
}

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

.auth-btn {
    background: #fff;
    color: #22c55e;
    border: 1px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.auth-btn:hover {
    background: #f0fdf4;
    transform: translateY(-2px) scale(1.04);
}

.auth-btn:active { transform: scale(0.92); }

.avatar-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
    min-height: 38px;
    padding: 5px 10px 5px 6px;
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: transparent;
    border: none;
}

.avatar-wrapper:hover {
    transform: translateY(-2px) scale(1.04);
}

.avatar-wrapper:active {
    transform: scale(0.92);
}

.avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 28px;
    flex-shrink: 0;
    overflow: hidden;
    transition: all 0.25s ease;
}

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

.avatar-wrapper:hover .avatar-img {
    border-color: #fff;
    transform: scale(1.05);
}

.avatar-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    max-width: 82px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-balance {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #facc15;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.user-balance strong {
    color: #fef3c7;
}

.user-balance img {
    width: 16px;
    height: 16px;
    display: block;
    flex: 0 0 16px;
    image-rendering: pixelated;
}

.avatar-wrapper .tooltip {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
}

.avatar-wrapper:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.container {
    max-width: 1200px;
    margin: 16px auto;
    padding: 0 12px;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 5;
}

.slider-container {
    position: relative;
    width: 100%;
    max-width: 750px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
    aspect-ratio: 3 / 1;
    background-color: #000;
}

.home-products {
    width: 100%;
    max-width: 1200px;
    margin: 22px auto 0;
}

.home-category {
    margin-top: 20px;
}

.home-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.home-category-head h2 {
    color: #fff;
    font-size: 18px;
}

.home-category-head a {
    color: #86efac;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.home-product-row {
    --home-card-gap: 14px;
    --home-row-gaps: 42px;
    display: flex;
    gap: var(--home-card-gap);
    overflow: hidden;
    position: relative;
    isolation: isolate;
}

.home-product-card {
    overflow: hidden;
    min-width: 0;
    flex: 0 0 calc((100% - var(--home-row-gaps)) / 3.4);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.045);
    color: #f5f5f7;
    text-decoration: none;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.home-product-card:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(34,197,94,0.26);
    box-shadow: 0 14px 32px rgba(0,0,0,0.3);
}

.home-product-card:active {
    transform: scale(0.96);
}

.home-product-card.peek-card {
    opacity: 1;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 14%, rgba(0,0,0,0.68) 27%, transparent 40%);
    mask-image: linear-gradient(to right, #000 0%, #000 14%, rgba(0,0,0,0.68) 27%, transparent 40%);
}

.home-product-card.peek-card:hover {
    opacity: 1;
}

.home-product-image {
    aspect-ratio: 16 / 11;
    background: linear-gradient(135deg, rgba(34,197,94,0.16), rgba(255,255,255,0.04)), #202128;
    background-size: cover;
    background-position: center;
}

.home-product-body {
    padding: 12px;
}

.home-product-card.is-text-only {
    border-left: 3px solid rgba(34,197,94,0.72);
}

.home-product-card.is-text-only .home-product-body {
    min-height: 116px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.home-product-body strong {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.home-product-body span {
    display: block;
    margin-top: 4px;
    color: #86efac;
    font-size: 13px;
    font-weight: 800;
}

.slider-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-link {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 1;
    transform: translateX(0) scale(1);
    transition: opacity 0.32s ease, transform 0.32s ease, filter 0.25s ease;
    color: #fff;
    text-decoration: none;
}

.slider-container.is-switching .video-link {
    opacity: 0;
    transform: translateX(-14px) scale(0.985);
}

.slider-container.is-entering .video-link {
    animation: heroEnter 0.38s ease both;
}

.video-link:hover { filter: brightness(1.05); }
.video-link:active { filter: brightness(0.85); }

.video-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background-color: #000;
}

.video-thumb.is-youtube-hq-thumbnail {
    transform: scale(1.3334);
}

.video-title-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.85));
    padding: 10px 16px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

.slider-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 10;
}

.dot {
    width: 7px;
    height: 7px;
    border: 0;
    padding: 0;
    background: rgba(255,255,255,.4);
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dot:hover {
    background: rgba(255,255,255,.7);
    transform: scale(1.3);
}

.dot:active { transform: scale(0.7); }

.dot.active {
    width: 16px;
    border-radius: 3px;
    background: #fff;
}

.hero-arrow {
    position: absolute;
    top: 50%;
    z-index: 12;
    width: 34px;
    height: 46px;
    border: 0;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,0.35);
    color: #fff;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.hero-prev { left: 10px; }
.hero-next { right: 10px; }

.slider-container:hover .hero-arrow,
.hero-arrow:focus-visible {
    opacity: 1;
}

.hero-arrow:hover {
    background: rgba(34,197,94,0.58);
    transform: translateY(-50%) scale(1.04);
}

.hero-arrow:active {
    transform: translateY(-50%) scale(0.94);
}

.logo-fallback,
.logo-fallback-img {
    object-fit: contain;
    background-size: contain;
    background-repeat: no-repeat;
    background-color: #050505;
}

.footer {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 7px 10px;
    font-size: 9px;
    color: #6e6e73;
    flex-shrink: 0;
    margin-top: auto;
    background: rgba(255,255,255,0.025);
}

@keyframes heroEnter {
    from {
        opacity: 0;
        transform: translateX(16px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@media (max-width: 768px) {
    .nav-bar { padding: 6px 10px; min-height: 48px; }
    .nav-logo { height: 34px; }
    .nav-right { gap: 6px; }
    .nav-btn,
    .auth-btn {
        padding: 7px 11px !important;
        font-size: 11px !important;
        border-radius: 8px !important;
        min-height: 34px;
        min-width: 54px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .avatar-wrapper { min-height: 34px; padding: 4px 8px 4px 5px; gap: 6px; border-radius: 8px; }
    .avatar-img { width: 28px; height: 28px; font-size: 12px; line-height: 28px; }
    .avatar-name { font-size: 12px; max-width: 60px; }
    .user-balance { font-size: 12px; gap: 2px; }
    .container { margin: 10px auto; padding: 0 8px; }
    .home-products { margin-top: 14px; }
    .home-product-row { --home-card-gap: 9px; --home-row-gaps: 27px; }
    .video-title-overlay { font-size: 13px; padding: 10px 14px; }
    .slider-dots { bottom: 6px; gap: 6px; }
    .dot { width: 7px; height: 7px; }
    .dot.active { width: 14px; }
    .hero-arrow { opacity: 1; width: 30px; height: 40px; font-size: 28px; }
    .footer { font-size: 8px; padding: 5px 8px; }
}

@media (max-width: 380px) {
    .nav-btn,
    .auth-btn {
        font-size: 10px !important;
        padding: 5px 8px !important;
        min-height: 30px;
        min-width: 42px;
    }
    .nav-logo { height: 30px; }
    .avatar-img { width: 24px; height: 24px; font-size: 10px; line-height: 24px; }
    .avatar-name { font-size: 10px; max-width: 35px; }
}
