html {
    overflow-y: scroll;
    scroll-behavior: smooth;
}

/* Анимация прокрутки при предзагрузке */
.preload-scroll-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 1;
    transition: opacity 0.3s ease-out;
    pointer-events: none;
}

.preload-scroll-animation.fade-out {
    opacity: 0;
}

.scroll-indicator {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    border-top: 2px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.scroll-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.main-container {
    padding-top: 64px;
}

.product-type-filters-wrapper {
    display: block;
    width: 100%;
    max-width: 1082px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 16px;
    padding-top: 0;
    padding-left: 30px;
    padding-right: 12px;
    box-sizing: border-box;
}

.product-type-filters-wrapper .category-filters {
    padding-left: 0;
    margin-left: 0;
}

.category-filters-wrapper {
    display: block;
    width: 100%;
    max-width: 1082px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0;
    padding-top: 0;
    padding-left: 30px;
    padding-right: 12px;
    box-sizing: border-box;
}
.category-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    max-width: 1082px;
    box-sizing: border-box;
    padding-left: 0; /* на мобильных и десктопе начинаем от левого края обертки */
}
.category-filters::-webkit-scrollbar {
    display: none;
}
.category-btn {
    padding: 7px 18px;
    border: none;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(.4,0,.2,1);
    color: #222;
    white-space: nowrap;
    outline: none;
    margin-bottom: 2px;
}
.category-btn.selected {
    background: #f5f5f5;
    color: #000;
    font-weight: 500;
}
.category-btn:hover:not(.selected) {
    background: #f0f0f0;
    color: #111;
}
@media (max-width: 1100px) {
    .category-filters-wrapper, .category-filters, .beats-grid {
        max-width: 100vw;
    }
}
@media (max-width: 700px) {
    .product-type-filters-wrapper {
        padding-left: 26px;
        padding-right: 8px;
    }
    .product-type-filters-wrapper .category-filters {
        padding-left: 0;
        margin-left: 0;
    }
    .category-filters-wrapper {
        padding-top: 0;
        padding-left: 0;
        padding-right: 8px;
    }
    .category-filters {
        gap: 6px;
        padding-left: 0px;
        padding-right: 0;
        max-width: 100vw;
    }
    .category-btn {
        padding: 6px 12px;
        font-size: 0.97em;
    }
}
.filters-form {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 30px;
    align-items: center;
}
.filters-form select, .filters-form input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9em;
}
.filters-form .bpm-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
}
.filters-form .bpm-inputs input {
    width: 60px;
}
.filters-form button {
    padding: 8px 24px;
    border: none;
    border-radius: 8px;
    background-color: #000;
    color: #fff;
    font-family: inherit;
    font-size: 0.9em;
    cursor: pointer;
}
.beats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 32px;
    justify-content: center;
    margin-top: 0;
    max-width: 1082px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 64px;
    box-sizing: border-box;
    padding: 0 12px;
}
@media (max-width: 700px) {
    .beats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 12px;
        margin-left: auto;
        margin-right: auto;
        justify-items: stretch;
        padding: 0 8px;
    }
    html, body { overflow-x: hidden; }
}

.beat-card {
    background: #fff;
    border: none;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s;
    font-family: 'IBM Plex Mono', monospace;
    opacity: 0;
    transform: translateY(30px);
    animation: beat-fade-in 0.7s cubic-bezier(.4,0,.2,1) forwards;
    /* animation-play-state: paused; */
    margin: 0 !important;
    padding: 18px;
    box-sizing: border-box;
}
.beat-card.visible {
    opacity: 1;
    transform: translateY(0);
    /* animation-play-state: running; */
}
@keyframes beat-fade-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.beat-card:hover {
    border-color: #d0d0d0;
}
.beat-cover {
    position: relative;
}
.beat-cover .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.play-button .material-symbols-outlined {
    font-size: 36px;
}

.beat-card img {
    width: 100%;
    aspect-ratio: 1/1;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
    display: block;
    border: 1px solid #eee; /* Добавлена легкая обводка */
}
@media (max-width: 700px) {
    .beat-card img {
        aspect-ratio: 1/1;
        width: 100%;
        height: auto;
        border-radius: 8px;
    }
}
.beat-info {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.beat-text {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-bottom: 12px;
    padding: 10px 0 12px 0;
}
.beat-title {
    font-size: 1em;
    font-weight: 500;
    margin: 0 0 4px 0;
    white-space: pre-line;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #000;
    text-decoration: none;
    min-height: 2.6em;
    max-height: 2.6em;
}
.beat-user {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #888;
    font-size: 0.93em;
    margin: 0;
    min-height: 28px;
    max-height: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.beat-info {
    min-height: 92px;
    max-height: 92px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.beat-title-link {
    flex-shrink: 0;
}
.beat-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 0;
    width: 100%;
}
.price-btn {
    flex-grow: 1;
    padding: 10px 12px;
    border: 1px solid #DEDEDE;
    border-radius: 5%;
    background-color: #fff;
    text-align: center;
    text-decoration: none;
    color: #000;
    font-weight: 500;
    font-size: 1.1em;
    transition: background-color 0.2s;
    height: 42px;
    min-width: 42px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}
.price-btn:hover {
    background-color: #f5f5f5;
}
.favorite-btn {
    background: #fff;
    border: none;
    border-radius: 6px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
    text-decoration: none;
    color: #000;
}
.favorite-btn:hover {
    background-color: #f5f5f5;
}
.favorite-btn .material-symbols-outlined {
    font-size: 1.4em;
}
.favorite-btn.favorited {
    color: #e54b4b;
}
.favorite-btn.add-to-cart-async {
    border: 1px solid #DEDEDE;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    max-width: 42px;
    max-height: 42px;
    border-radius: 5%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0;
}

/* Player styles */
.player-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 1072px;
    width: calc(100% - 30px);
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    z-index: 1000;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'IBM Plex Mono', monospace;
    transition: bottom 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Close button for player */
.player-close {
    position: absolute;
    top: -34px;
    right: 6px;
    background: none;
    border: none;
    color: #000;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.player-close:hover {
    background-color: #f5f5f5;
}

.player-content {
    display: flex;
    align-items: center;
    width: 100%;
    cursor: pointer;
}

.player-beat-link {
    display: flex;
    align-items: center;
    flex-grow: 1;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.player-beat-link:hover {
    text-decoration: none;
    color: inherit;
}

.player-cover {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 15px;
    background-color: #f0f0f0;
}

.player-info {
    flex-grow: 1;
    margin-right: 20px;
}

.player-title {
    font-size: 1em;
    font-weight: 500;
    margin: 0;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-artist {
    font-size: 0.85em;
    color: #888;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 500px;
    flex-grow: 1;
    justify-content: flex-end;
}

.player-play-pause-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

.player-play-pause-button .material-symbols-outlined {
    font-size: 40px;
}

.current-time, .duration {
    font-size: 0.9em;
    color: #555;
    min-width: 40px;
    text-align: center;
}

.progress-bar {
    flex-grow: 1;
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    margin: 0 10px;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
}

.progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
}

.player-volume-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.player-volume-button:hover {
    background-color: #f5f5f5;
}

.player-volume-button .material-symbols-outlined {
    font-size: 24px;
    color: #000;
    line-height: 1;
}

.volume-bar {
    width: 80px;
    height: 6px;
    background: #000 !important;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    margin-left: 8px;
}
.volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #000 !important;
    cursor: pointer;
}
.volume-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #000 !important;
    cursor: pointer;
}
.volume-bar::-ms-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #000 !important;
    cursor: pointer;
}
.volume-bar::-ms-fill-lower {
    background: #000 !important;
}
.volume-bar::-ms-fill-upper {
    background: #000 !important;
}

@media (max-width: 768px) {
    .player-container {
        padding: 8px 15px;
        bottom: 0;
        width: calc(100% - 20px);
        border-radius: 12px;
    }

    .player-cover {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }

    .player-info {
        margin-right: 10px;
    }

    .player-title {
        font-size: 0.9em;
    }

    .player-artist {
        font-size: 0.8em;
    }

    .player-controls {
        gap: 10px;
        width: auto;
        max-width: none;
    }

    .player-play-pause-button .material-symbols-outlined {
        font-size: 32px;
    }

    .current-time, .duration {
        font-size: 0.8em;
    }

    .progress-bar {
        height: 4px;
    }

    .progress-bar::-webkit-slider-thumb,
    .progress-bar::-moz-range-thumb {
        width: 12px;
        height: 12px;
    }

    .volume-bar {
        width: 60px;
    }

    .player-container .volume-bar {
        display: none;
    }
}

@media (max-width: 500px) {
    .player-info {
        display: none;
    }
    .player-controls {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile responsive styles */
@media (max-width: 1200px) {
    .beats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    .beat-info {
        min-height: auto;
        max-height: none;
    }
}

@media (max-width: 900px) {
    .beats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .beat-card img {
    }
}

@media (max-width: 600px) {
    .beats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 12px;
        margin-top: 16px;
        padding: 0 8px;
    }
    .beat-card {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }
    .beat-card img {
    }
    .beat-info {
        padding: 8px 10px;
        min-height: auto;
        max-height: none;
    }
    .beat-title {
        font-size: 0.9em;
    }
    .beat-user {
        font-size: 0.8em;
    }
    .price-btn {
        height: 32px;
        min-width: 32px;
        font-size: 0.9em;
        padding: 0 8px;
    }
    .favorite-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
    }
    .favorite-btn .material-symbols-outlined {
        font-size: 1.1em;
    }

    .category-filters {
        gap: 8px;
        padding-left: 18px;
        padding-right: 0;
        margin-bottom: 16px;
    }

    .category-btn {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .filters-form {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }

    .filters-form select, .filters-form input {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    .filters-form button {
        padding: 6px 20px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .beats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 10px;
        padding: 0 6px;
    }

    .beat-card img { display: block; }

    .beat-info {
        padding: 6px 8px;
        min-height: auto;
        max-height: none;
    }

    .beat-title {
        font-size: 0.85em;
    }

    .beat-user {
        font-size: 0.75em;
    }

    .price-btn {
        padding: 5px 6px;
        font-size: 0.85em;
    }

    .favorite-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
    }

    .favorite-btn .material-symbols-outlined {
        font-size: 1em;
    }

    .play-button {
        width: 45px;
        height: 45px;
    }

    .play-button .material-symbols-outlined {
        font-size: 26px;
    }

    .category-filters {
        gap: 6px;
        padding-left: 24px;
        padding-right: 0;
    }

    .category-btn {
        padding: 5px 10px;
        font-size: 0.85em;
    }

    /* Modal responsive styles removed */
}

/* Player responsive styles for mobile */
.player-container {
    padding: 6px 12px;
    bottom: 0;
    width: calc(100% - 16px);
    border-radius: 12px;
}

.player-cover {
    width: 32px;
    height: 32px;
    margin-right: 8px;
}

.player-title {
    font-size: 0.85em;
}

.player-artist {
    font-size: 0.75em;
}

.player-controls {
    gap: 8px;
}

.player-play-pause-button .material-symbols-outlined {
    font-size: 28px;
}

.current-time, .duration {
    font-size: 0.75em;
    min-width: 35px;
}

.progress-bar {
    height: 3px;
    margin: 0 6px;
}

.progress-bar::-webkit-slider-thumb,
.progress-bar::-moz-range-thumb {
    width: 10px;
    height: 10px;
}

.volume-bar {
    width: 50px;
    margin-left: 6px;
}

.player-volume-button {
    width: 28px;
    height: 28px;
}

.player-volume-button .material-symbols-outlined {
    font-size: 20px;
}

/* Modal responsive styles */
.category-filters-wrapper, .category-filters {
    opacity: 0;
    transform: translateY(20px);
    animation: fade-in-up 0.7s cubic-bezier(.4,0,.2,1) forwards;
}
.category-filters-wrapper.visible, .category-filters.visible {
    opacity: 1;
    transform: translateY(0);
}
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для ссылок в уведомлении */
.alert.alert-info a {
    color: #007bff;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.alert.alert-info a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.alert.alert-info a:active {
    color: #004085;
}

#beat-scroll-status {
    display: block;
    text-align: center;
    margin: 20px auto;
    font-size: 1em;
    color: #555;
    font-weight: 500;
    width: 100%;
}

/* Центрирование и анимация иконки подгрузки */
.infinite-scroll-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    width: 100%;
    color: #666;
}

.infinite-scroll-loader .material-symbols-outlined {
    font-size: 32px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

img.lazy {
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  filter: blur(4px);
}

img:not(.lazy) {
  opacity: 1;
  filter: blur(0);
}

/* Стили для карточек пользователей */
.user-card {
    background: #fff;
    border: none;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s;
    font-family: 'IBM Plex Mono', monospace;
    opacity: 0;
    transform: translateY(30px);
    animation: beat-fade-in 0.7s cubic-bezier(.4,0,.2,1) forwards;
    margin: 0 !important;
    padding: 18px;
    box-sizing: border-box;
}

.user-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.user-card:hover {
    border-color: #d0d0d0;
}

.user-card .beat-cover img {
    width: 100%;
    aspect-ratio: 1/1;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
    display: block;
    border: 1px solid #eee;
}
