@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Ysabeau+SC:wght@1..1000&display=swap');

/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Nunito", sans-serif;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-elements);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffae5d;
}

:root {
    --bg-dark: #121212;
    --bg-elements: #1e1e1e;
    --bg-elements-light: #2a2a2a;
    --primary: #ff9e44;
    --primary-glow: rgba(255, 158, 68, 0.15);
    --text-primary: #f5f5f5;
    --text-secondary: #aaaaaa;
    --transition: all 0.3s ease;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate {
    opacity: 0;
    animation: fadeIn 0.56s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.delay-1 { animation-delay: 0.04s; }
.delay-2 { animation-delay: 0.08s; }
.delay-3 { animation-delay: 0.12s; }
.delay-4 { animation-delay: 0.16s; }
.delay-5 { animation-delay: 0.2s; }

/* Шапка */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background-color: var(--bg-elements);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: 1px;
    font-family: "Ysabeau SC", sans-serif;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.nav-links a:hover {
    color: var(--primary);
    background: var(--primary-glow);
}

.user-menu {
    position: relative;
    display: inline-block;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.avatar:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

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

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-elements-light);
    width: 200px;
    border-radius: 8px;
    padding: 0.5rem 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 101;
}

.user-menu:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.dropdown a:hover {
    background-color: var(--primary-glow);
    color: var(--primary);
}

.dropdown a i {
    width: 20px;
    text-align: center;
}

/* Основной контент */
.main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0.8rem;
}

.photo-viewer {
    max-width: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: var(--bg-elements);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.56s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    overflow: visible; /* Предотвращаем обрезку модального окна */
}

.image-container {
    width: 100%;
    max-height: 65vh;
    overflow: hidden;
    border-radius: 8px;
    background-color: var(--bg-elements-light);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--primary-glow);
}

.main-image {
    width: 100%;
    max-height: 65vh;
    object-fit: contain;
    display: block;
    transition: var(--transition);
}

.main-image:hover {
    transform: none;
}

.photo-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 0.8rem;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.author-info .avatar-container {
    position: relative;
    display: inline-block;
    border-radius: 50%;
}

.author-info .avatar-frame {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

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

.author-info .avatar-container.online::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
    border: 1px solid var(--text-primary);
    z-index: 10;
}

.author-info .avatar-container.offline::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #ccc;
    border-radius: 50%;
    border: 1px solid var(--text-primary);
    z-index: 10;
}

.author-info a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.author-info a:hover {
    color: var(--primary);
}

.user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.user-badge {
    background: var(--primary);
    color: var(--bg-dark);
    border-radius: 16px;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    transition: var(--transition);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(255, 158, 68, 0.3);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.no-badge {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 8px;
}

.photo-caption {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.4rem 0;
}

.photo-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 100;
}

.like-button,
.favorite-button,
.share-button,
.download-button,
.delete-button {
    background: var(--bg-elements-light);
    border: none;
    border-radius: 18px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(5px);
    transition: var(--transition);
}

.like-button.liked {
    background: var(--primary);
    color: var(--bg-dark);
}

.like-button.liked .heart-icon {
    color: #e0245e;
}

.favorite-button.favorited {
    background: var(--primary);
    color: var(--bg-dark);
}

.like-button:hover,
.favorite-button:hover,
.share-button:hover,
.download-button:hover,
.delete-button:hover {
    background: var(--primary-glow);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255, 158, 68, 0.25);
}

.heart-icon,
.favorite-icon,
.share-icon,
.download-icon,
.delete-icon {
    font-size: 0.95rem;
}

.photo-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: fadeIn 0.56s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.12s;
    text-align: right;
    margin-left: auto;
}

.photo-navigation {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1rem;
    position: relative;
    z-index: 50;
}

.nav-button {
    background: var(--primary);
    border: none;
    border-radius: 18px;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    color: var(--bg-dark);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.nav-button:hover {
    background: #ffae5d;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(255, 158, 68, 0.25);
}

/* Модальное окно для скачивания */
.download-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000; /* Высокий z-index для модального окна */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.download-modal.show {
    display: flex;
    opacity: 1;
}

.download-modal__content {
    background: var(--bg-elements);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.56s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    position: relative;
}

.download-modal__title {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.download-modal__options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.download-modal__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--bg-elements-light);
    border-radius: 8px;
    transition: var(--transition);
}

.download-modal__option:hover:not(.disabled) {
    background: var(--primary-glow);
    color: var(--primary);
}

.download-modal__option.disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.download-modal__option .unavailable {
    color: #ff4444;
    font-size: 0.8rem;
    font-weight: 400;
}

.download-modal__close {
    background: var(--primary);
    border: none;
    border-radius: 18px;
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    color: var(--bg-dark);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.download-modal__close:hover {
    background: #ffae5d;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(255, 158, 68, 0.25);
}

/* Комментарии только под фотографиями */
.photo-comments {
    max-width: 100%;
    padding: 1.5rem;
    background: var(--bg-elements);
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    animation: fadeIn 0.56s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.photo-comments__title {
    margin: 0 0 1rem;
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 650;
    line-height: 1.25;
}

.photo-comments__count {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
}

.photo-comments__form {
    margin-bottom: 1rem;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.photo-comments__textarea,
.photo-comment__edit-textarea {
    display: block;
    width: 100%;
    min-height: 84px;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--ui-color-border);
    border-radius: var(--ui-radius-control);
    outline: none;
    background: var(--bg-elements-light);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color var(--ui-motion-fast) var(--ui-motion-ease), box-shadow var(--ui-motion-fast) var(--ui-motion-ease);
}

.photo-comments__textarea:focus,
.photo-comment__edit-textarea:focus {
    border-color: var(--primary);
    outline: var(--ui-focus-outline);
    outline-offset: var(--ui-focus-offset);
    box-shadow: none;
}

.photo-comments__form-controls,
.photo-comment__edit-controls {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.65rem;
}

.photo-comments__submit,
.photo-comment__save {
    min-height: var(--ui-control-height);
    padding: 0.45rem 1.05rem;
    border: 0;
    border-radius: var(--ui-radius-control);
    background: var(--primary);
    color: var(--bg-dark);
    cursor: pointer;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    transition: background-color var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease);
}

@media (hover: hover) and (pointer: fine) {
    .photo-comments__submit:hover,
    .photo-comment__save:hover {
        background: var(--ui-color-accent-hover);
        transform: translateY(-1px);
    }
}

.photo-comments__submit:disabled,
.photo-comment__save:disabled,
.photo-comment__action:disabled {
    cursor: wait;
    opacity: 0.6;
}

.photo-comments__message {
    min-height: 1.25rem;
    margin-top: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.photo-comment__edit-status {
    margin-top: 0.35rem;
    color: #ff9a9a;
    font-size: 0.8rem;
}

.photo-comment__edit-status:empty {
    display: none;
}

.photo-comments__message.is-success {
    color: #9dce9f;
}

.photo-comments__message.is-error {
    color: #ff9a9a;
}

.photo-comments__notice {
    margin: 0.75rem 0 1rem;
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    font-size: 0.88rem;
    text-align: center;
}

.photo-comments__notice a,
.photo-comment__author {
    color: var(--text-primary);
    text-decoration: none;
}

.photo-comments__notice a:hover,
.photo-comment__author:hover {
    color: var(--primary);
}

.photo-comments__list {
    display: flex;
    flex-direction: column;
}

.photo-comment {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 0.8rem;
    padding: 0.95rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 180ms cubic-bezier(0.22, 1, 0.36, 1), background-color 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.photo-comment:first-child {
    border-top: 0;
}

.photo-comment__avatar-frame.avatar-frame {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
}

.photo-comment__avatar-link {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
}

.photo-comment__avatar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.photo-comment__body {
    min-width: 0;
}

.photo-comment__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.25rem 0.65rem;
    position: static;
    top: auto;
    z-index: auto;
    width: auto;
    min-width: 0;
    min-height: 0;
    margin: 0 0 0.25rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.photo-comment__author {
    overflow-wrap: anywhere;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
}

.photo-comment__date {
    color: var(--text-secondary);
    font-size: 0.76rem;
    white-space: nowrap;
}

.photo-comment__text {
    margin: 0;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    word-break: normal;
    font-size: 0.9rem;
    line-height: 1.55;
}

.photo-comment__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.photo-comment__action,
.photo-comment__cancel {
    min-height: 28px;
    padding: 0.15rem 0.1rem;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.2;
    transition: color 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.photo-comment__action:hover,
.photo-comment__cancel:hover {
    color: var(--primary);
}

.photo-comment__action--delete:hover {
    color: #ff9a9a;
}

.photo-comment__action-separator {
    color: #666;
    font-size: 0.8rem;
}

.photo-comment__editor {
    margin-top: 0.55rem;
}

.photo-comment__editor[hidden] {
    display: none;
}

.photo-comment__edit-textarea {
    min-height: 76px;
}

.photo-comment.is-editing .photo-comment__text,
.photo-comment.is-editing .photo-comment__actions {
    display: none;
}

.photo-comments__empty {
    padding: 1.2rem 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.88rem;
    text-align: center;
}

.photo-comments__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.photo-comment.is-new,
.photo-comment.is-updated {
    animation: photo-comment-arrive 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.photo-comment.is-removing {
    opacity: 0;
    transform: translateY(-4px);
}

@keyframes photo-comment-arrive {
    from {
        opacity: 0;
        transform: translateY(-6px);
        background: var(--primary-glow);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        background: transparent;
    }
}

/* Связанные посты */
.related-posts-section {
    max-width: 100%;
    padding: 1.5rem;
    background: var(--bg-elements);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.56s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    margin-top: 1.5rem;
}

.related-posts__title {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.related-posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.related-post {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-elements-light);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.related-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 158, 68, 0.2);
}

.related-post:hover .post-image {
    transform: scale(1.05);
}

.post-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: var(--transition);
}

.subscribers-only-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    background: var(--bg-elements-light);
    border-radius: 8px;
}

.subscribers-only-placeholder i {
    font-size: 2rem;
    color: #FFD700;
    margin-bottom: 0.5rem;
}

.subscribers-only-placeholder p {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.subscribers-only {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #FFD700;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.2rem;
    border-radius: 50%;
}

.post-author {
    position: absolute;
    bottom: 3px;
    right: 10px;
}

.post-author .author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
    object-fit: cover;
}

.related-posts__empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
    background: var(--bg-elements-light);
    border-radius: 8px;
}

/* Подвал */
footer {
    background-color: var(--bg-elements);
    padding: 2rem 5%;
    margin-top: 4rem;
    text-align: center;
}

.copyright {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Адаптивность */
@media (max-width: 992px) {
    .main {
        padding: 1.5rem 0.8rem;
    }

    .photo-viewer {
        padding: 1rem;
    }

    .image-container {
        max-height: 60vh;
    }

    .photo-comments {
        padding: 1rem;
    }

    .related-posts-section {
        padding: 1rem;
        margin-top: 1rem;
    }

    .related-posts {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links a:not(:last-child) {
        display: none;
    }

    .photo-info {
        padding: 0 0.5rem;
    }

    .author-info .avatar-frame {
        width: 36px;
        height: 36px;
    }

    .author-info .avatar-container.online::after,
    .author-info .avatar-container.offline::after {
        width: 8px;
        height: 8px;
        bottom: 1px;
        right: 1px;
    }

    .user-badges {
        gap: 6px;
        margin-top: 6px;
    }

    .user-badge {
        padding: 3px 6px;
        font-size: 0.75rem;
    }

    .no-badge {
        font-size: 0.75rem;
        margin-top: 6px;
    }

    .author-info a {
        font-size: 0.9rem;
    }

    .photo-meta {
        gap: 0.6rem;
        justify-content: flex-start;
    }

    .like-button,
    .favorite-button,
    .share-button,
    .download-button,
    .delete-button {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    .heart-icon,
    .favorite-icon,
    .share-icon,
    .download-icon,
    .delete-icon {
        font-size: 0.9rem;
    }

    .photo-date {
        font-size: 0.85rem;
        text-align: center;
        margin-left: 0;
        width: 100%;
    }

    .photo-navigation {
        flex-direction: row;
        gap: 0.6rem;
    }

    .nav-button {
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
    }

    .photo-comments__textarea {
        min-height: 90px;
        font-size: 0.85rem;
    }

    .photo-comment__text {
        font-size: 0.85rem;
    }

    .photo-comment__date {
        font-size: 0.75rem;
    }

    .photo-comment__avatar-frame.avatar-frame {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .photo-comment {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .related-posts {
        grid-template-columns: repeat(2, 1fr);
    }

    .related-post .post-author .author-avatar {
        width: 36px;
        height: 36px;
    }

    .download-modal__content {
        padding: 1rem;
        max-width: 350px;
    }

    .download-modal__title {
        font-size: 1.1rem;
    }

    .download-modal__option {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }

    .download-modal__option .unavailable {
        font-size: 0.75rem;
    }

    .download-modal__close {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .main {
        padding: 1rem 0.5rem;
    }

    .photo-viewer {
        padding: 0.8rem;
        border-radius: 8px;
    }

    .image-container {
        max-height: 55vh;
    }

    .photo-comments {
        padding: 0.8rem;
    }

    .related-posts-section {
        padding: 0.8rem;
        margin-top: 0.8rem;
    }

    .related-posts__title {
        font-size: 1.2rem;
    }

    .related-posts {
        grid-template-columns: 1fr;
    }

    .related-post .post-author .author-avatar {
        width: 32px;
        height: 32px;
    }

    .subscribers-only-placeholder i {
        font-size: 1.8rem;
    }

    .subscribers-only-placeholder p {
        font-size: 0.8rem;
    }

    .subscribers-only {
        font-size: 0.9rem;
    }

    .author-info .avatar-frame {
        width: 32px;
        height: 32px;
    }

    .author-info .avatar-container.online::after,
    .author-info .avatar-container.offline::after {
        width: 6px;
        height: 6px;
    }

    .user-badges {
        gap: 5px;
        margin-top: 5px;
    }

    .user-badge {
        padding: 2px 5px;
        font-size: 0.7rem;
    }

    .no-badge {
        font-size: 0.7rem;
        margin-top: 5px;
    }

    .author-info a {
        font-size: 0.85rem;
    }

    .photo-caption {
        font-size: 0.9rem;
    }

    .photo-date {
        font-size: 0.8rem;
    }

    .photo-comments__title {
        font-size: 1.2rem;
    }

    .photo-comment__avatar-frame.avatar-frame {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .photo-comment {
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 0.65rem;
    }

    .like-button,
    .favorite-button,
    .share-button,
    .download-button,
    .delete-button {
        padding: 3px 6px;
        font-size: 0.75rem;
    }

    .heart-icon,
    .favorite-icon,
    .share-icon,
    .download-icon,
    .delete-icon {
        font-size: 0.85rem;
    }

    .nav-button {
        padding: 0.3rem 0.8rem;
        font-size: 0.75rem;
    }

    .download-modal__content {
        padding: 0.8rem;
        max-width: 300px;
    }

    .download-modal__title {
        font-size: 1rem;
    }

    .download-modal__option {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .download-modal__option .unavailable {
        font-size: 0.7rem;
    }

    .download-modal__close {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 430px) {
    .photo-comments {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .photo-comments__form {
        padding: 0.7rem;
    }

    .photo-comments__textarea,
    .photo-comment__edit-textarea {
        min-height: 78px;
        padding: 0.65rem 0.7rem;
        font-size: 16px;
    }

    .photo-comment {
        padding: 0.85rem 0;
    }

    .photo-comment__header {
        display: grid;
        gap: 0.1rem;
    }

    .photo-comment__date {
        white-space: normal;
    }

    .photo-comment__action,
    .photo-comment__cancel {
        min-height: 36px;
    }

    .photo-comments__submit,
    .photo-comment__save {
        min-height: 42px;
    }
}

/* Осторожная UI/UX-полировка страницы просмотра фото */
body.view-record-page .photo-viewer,
body.view-record-page .photo-date,
body.view-record-page .photo-comments,
body.view-record-page .related-posts-section,
body.view-record-page .download-modal__content {
    animation-duration: var(--ui-motion-entrance);
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

body.view-record-page .main-image-link {
    display: block;
    border-radius: inherit;
    cursor: zoom-in;
}

body.view-record-page .main-image {
    height: auto;
    transition: none;
}

body.view-record-page .main-image:hover {
    transform: none;
}

body.view-record-page .author-info,
body.view-record-page .user-badges {
    min-width: 0;
}

body.view-record-page .author-info {
    flex-wrap: wrap;
}

body.view-record-page .user-badge {
    max-width: min(100px, 100%);
}

body.view-record-page .photo-meta {
    gap: 0.55rem;
}

body.view-record-page .photo-delete-form {
    display: flex;
    margin: 0;
}

body.view-record-page .like-button,
body.view-record-page .favorite-button,
body.view-record-page .share-button,
body.view-record-page .download-button,
body.view-record-page .delete-button {
    min-height: var(--ui-control-height);
    padding: 0.48rem 0.78rem;
    display: inline-flex;
    justify-content: center;
    gap: 0.38rem;
    flex: 0 0 auto;
    white-space: nowrap;
    line-height: 1.1;
    transition: color var(--ui-motion-fast) var(--ui-motion-ease),
        background-color var(--ui-motion-fast) var(--ui-motion-ease),
        border-color var(--ui-motion-fast) var(--ui-motion-ease),
        box-shadow var(--ui-motion-fast) var(--ui-motion-ease),
        transform var(--ui-motion-fast) var(--ui-motion-ease),
        opacity var(--ui-motion-fast) var(--ui-motion-ease);
}

body.view-record-page .like-button:active,
body.view-record-page .favorite-button:active,
body.view-record-page .share-button:active,
body.view-record-page .download-button:active,
body.view-record-page .delete-button:active {
    animation: none;
    transform: translateY(0);
}

body.view-record-page .like-button.is-loading,
body.view-record-page .favorite-button.is-loading,
body.view-record-page .share-button.is-loading {
    opacity: 0.64;
    cursor: wait;
}

body.view-record-page .like-button.is-loading:hover,
body.view-record-page .favorite-button.is-loading:hover,
body.view-record-page .share-button.is-loading:hover {
    transform: none;
    box-shadow: none;
}

body.view-record-page .delete-button {
    color: #d8b8b8;
    background: rgba(255, 90, 90, 0.045);
    border: 1px solid rgba(255, 107, 107, 0.32);
    box-shadow: none;
}

body.view-record-page .delete-button:hover {
    color: #ff8585;
    background: rgba(255, 90, 90, 0.11);
    border-color: rgba(255, 107, 107, 0.7);
    box-shadow: 0 3px 10px rgba(125, 20, 20, 0.18);
    transform: translateY(-1px);
}

body.view-record-page .delete-button:focus-visible {
    color: #ff8585;
    background: rgba(255, 90, 90, 0.11);
    border-color: rgba(255, 107, 107, 0.7);
}

body.view-record-page .photo-actions-status {
    flex: 1 0 100%;
    color: #ffb36b;
    font-size: 0.82rem;
    line-height: 1.35;
}

body.view-record-page .photo-navigation {
    margin-top: 1rem;
}

body.view-record-page .nav-button {
    min-height: 44px;
    padding: 0.62rem 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1.1;
    transition: color 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

body.view-record-page .photo-comments {
    margin-top: 1.15rem;
}

body.view-record-page .download-modal {
    transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

body.view-record-page .download-modal__option.disabled {
    pointer-events: none;
}

body.view-record-page .like-button:focus-visible,
body.view-record-page .favorite-button:focus-visible,
body.view-record-page .share-button:focus-visible,
body.view-record-page .download-button:focus-visible,
body.view-record-page .delete-button:focus-visible,
body.view-record-page .nav-button:focus-visible,
body.view-record-page .main-image-link:focus-visible,
body.view-record-page .download-modal__option:focus-visible,
body.view-record-page .download-modal__close:focus-visible,
body.view-record-page .password-form input:focus-visible,
body.view-record-page .password-form button:focus-visible {
    outline: var(--ui-focus-outline);
    outline-offset: var(--ui-focus-offset);
    box-shadow: 0 0 0 3px rgba(18, 18, 18, 0.88);
}

body.view-record-page .main-image-link:focus-visible {
    outline-offset: -4px;
    box-shadow: inset 0 0 0 3px rgba(18, 18, 18, 0.88);
}

html:has(body.view-record-page #picnic-cookie-consent:not([hidden])) {
    scroll-padding-bottom: calc(12rem + env(safe-area-inset-bottom, 0px));
}

body.view-record-page:has(#picnic-cookie-consent:not([hidden])) .main {
    padding-bottom: calc(12rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 992px) {
    body.view-record-page .main-image {
        max-height: 60vh;
    }
}

@media (max-width: 768px) {
    body.view-record-page .main-image {
        max-height: 60vh;
    }

    body.view-record-page .like-button,
    body.view-record-page .favorite-button,
    body.view-record-page .share-button,
    body.view-record-page .download-button,
    body.view-record-page .delete-button {
        min-height: 42px;
        padding: 0.48rem 0.68rem;
        font-size: 0.78rem;
    }

    body.view-record-page .nav-button {
        min-height: 44px;
        padding: 0.62rem 1rem;
    }
}

@media (max-width: 576px) {
    body.view-record-page .main-image {
        max-height: 55vh;
    }
}

@media (max-width: 520px) {
    html:has(body.view-record-page #picnic-cookie-consent:not([hidden])) {
        scroll-padding-bottom: calc(19rem + env(safe-area-inset-bottom, 0px));
    }

    body.view-record-page:has(#picnic-cookie-consent:not([hidden])) .main {
        padding-bottom: calc(19rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 430px) {
    body.view-record-page .photo-meta {
        gap: 0.5rem;
    }

    body.view-record-page .photo-navigation {
        width: 100%;
    }

    body.view-record-page .nav-button {
        flex: 1 1 8rem;
        max-width: 12rem;
        min-height: 44px;
        padding: 0.62rem 0.8rem;
        font-size: 0.78rem;
    }

    body.view-record-page .user-badges {
        gap: 4px;
    }

    body.view-record-page .user-badge {
        max-width: 100%;
        overflow-wrap: anywhere;
        text-overflow: clip;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    html:has(body.view-record-page) {
        scroll-behavior: auto;
    }

    body.view-record-page .animate,
    body.view-record-page .photo-viewer,
    body.view-record-page .photo-date,
    body.view-record-page .photo-comments,
    body.view-record-page .photo-comment,
    body.view-record-page .photo-comment.is-new,
    body.view-record-page .photo-comment.is-updated,
    body.view-record-page .related-posts-section,
    body.view-record-page .download-modal__content,
    body.view-record-page .photo-comments__submit,
    body.view-record-page .photo-comment__save {
        animation: none !important;
        opacity: 1;
        transform: none !important;
    }

    body.view-record-page .main-image,
    body.view-record-page .like-button,
    body.view-record-page .favorite-button,
    body.view-record-page .share-button,
    body.view-record-page .download-button,
    body.view-record-page .delete-button,
    body.view-record-page .nav-button,
    body.view-record-page .download-modal,
    body.view-record-page .download-modal__option,
    body.view-record-page .download-modal__close,
    body.view-record-page .related-post,
    body.view-record-page .post-image,
    body.view-record-page .photo-comment {
        transition: none !important;
    }

    body.view-record-page .like-button:hover,
    body.view-record-page .favorite-button:hover,
    body.view-record-page .share-button:hover,
    body.view-record-page .download-button:hover,
    body.view-record-page .delete-button:hover,
    body.view-record-page .nav-button:hover,
    body.view-record-page .related-post:hover,
    body.view-record-page .related-post:hover .post-image {
        transform: none !important;
    }
}
/* Базовые стили для рамки */

.avatar-frame:hover {
  transform: scale(1.05);
}

/* Улучшенные стили для анимированных рамок */
.avatar-frame.frame-animated {
  animation-duration: 3s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

/* Золотая рамка */
.avatar-frame.frame-golden {
  background: linear-gradient(45deg, #ffd700, #daa520, #ffd700);
  padding: 6px;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.avatar-frame.frame-golden:hover {
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
}

/* Серебряная рамка */
.avatar-frame.frame-silver {
  background: linear-gradient(45deg, #c0c0c0, #a9a9a9, #c0c0c0);
  padding: 6px;
  box-shadow: 0 0 15px rgba(192, 192, 192, 0.5);
}

.avatar-frame.frame-silver:hover {
  box-shadow: 0 0 25px rgba(192, 192, 192, 0.8);
}

/* Хрустальная рамка */
.avatar-frame.frame-crystal {
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
  padding: 4px;
  backdrop-filter: blur(5px);
}

.avatar-frame.frame-crystal:hover {
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
}

/* Ледяной лайм */
.avatar-frame.frame-ice-lime {
  background: rgba(180, 255, 220, 0.3);
  border: 2px solid rgba(186, 255, 221, 0.9);
  box-shadow: 0 0 20px rgba(180, 255, 220, 0.4);
  padding: 4px;
  backdrop-filter: blur(4px);
}

.avatar-frame.frame-ice-lime:hover {
  box-shadow: 0 0 30px rgba(180, 255, 220, 0.8);
}

/* Северное сияние */
.avatar-frame.frame-aurora {
  background: rgba(122, 255, 240, 0.15);
  border: 2px solid rgba(170, 130, 255, 0.9);
  box-shadow: 0 0 20px rgba(140, 220, 255, 0.4);
  padding: 4px;
  backdrop-filter: blur(4px);
}

.avatar-frame.frame-aurora:hover {
  box-shadow: 0 0 30px rgba(170, 130, 255, 0.8);
}

/* Северный мох */
.avatar-frame.frame-north-moss {
  background: linear-gradient(135deg, #3a6f62, #285349);
  padding: 6px;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(60, 120, 100, 0.5);
}

.avatar-frame.frame-north-moss:hover {
  box-shadow: 0 0 25px rgba(60, 120, 100, 0.8);
}

/* Снежный вуаль */
.avatar-frame.frame-snow-veil {
  background: linear-gradient(135deg, #dff4ff, #b6deef);
  padding: 6px;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(180, 230, 255, 0.5);
}

.avatar-frame.frame-snow-veil:hover {
  box-shadow: 0 0 25px rgba(180, 230, 255, 0.8);
}

/* Лавандовый лёд */
.avatar-frame.frame-lavender-ice {
  background: linear-gradient(135deg, #9fa8e8, #7f89c9);
  padding: 6px;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(150, 160, 230, 0.5);
}

.avatar-frame.frame-lavender-ice:hover {
  box-shadow: 0 0 25px rgba(150, 160, 230, 0.8);
}


/* Огненная анимированная рамка */
.avatar-frame.frame-fire {
  background: linear-gradient(45deg, #ff6b00, #ff0000, #ff6b00);
  background-size: 200% 200%;
  animation: flameAnimation 2s ease infinite;
  padding: 6px;
  box-shadow: 0 0 20px rgba(255, 107, 0, 0.7);
}

.avatar-frame.frame-fire:hover {
  box-shadow: 0 0 30px rgba(255, 107, 0, 0.9);
  animation-duration: 1.5s;
}

@keyframes flameAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Ледяная анимированная рамка */
.avatar-frame.frame-ice {
  background: linear-gradient(45deg, #00ffff, #00bfff, #00ffff);
  background-size: 200% 200%;
  animation: iceAnimation 3s ease infinite;
  padding: 6px;
  box-shadow: 0 0 20px rgba(0, 191, 255, 0.7);
}

.avatar-frame.frame-ice:hover {
  box-shadow: 0 0 30px rgba(0, 191, 255, 0.9);
  animation-duration: 2s;
}

@keyframes iceAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Радужная анимированная рамка */
.avatar-frame.frame-rainbow {
  background: linear-gradient(45deg, #ff0000, #ff9900, #ffff00, #00ff00, #00ffff, #0000ff, #9900ff, #ff0000);
  background-size: 400% 400%;
  animation: rainbowAnimation 5s linear infinite;
  padding: 6px;
}

.avatar-frame.frame-rainbow:hover {
  animation-duration: 3s;
}

@keyframes rainbowAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Космическая анимированная рамка */
.avatar-frame.frame-nebula {
  background: linear-gradient(45deg, #0a0a2a, #1a1a4a, #0a0a2a);
  background-size: 200% 200%;
  animation: nebulaAnimation 15s ease infinite;
  padding: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(75, 0, 130, 0.6);
}

.avatar-frame.frame-nebula:hover {
  box-shadow: 0 0 35px rgba(128, 0, 255, 0.8);
}

/* Создаем множество звезд */
.avatar-frame.frame-nebula::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.9) 0.5px, transparent 1px),
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.8) 0.7px, transparent 1.2px),
    radial-gradient(circle at 50% 60%, rgba(255, 255, 255, 0.9) 0.6px, transparent 1.1px),
    radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.7) 0.8px, transparent 1.3px),
    radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.6) 1px, transparent 1.5px),
    radial-gradient(circle at 15% 75%, rgba(255, 255, 255, 0.8) 0.5px, transparent 1px),
    radial-gradient(circle at 85% 35%, rgba(255, 255, 255, 0.9) 0.7px, transparent 1.2px),
    radial-gradient(circle at 25% 90%, rgba(255, 255, 255, 0.7) 0.6px, transparent 1.1px),
    radial-gradient(circle at 65% 15%, rgba(255, 255, 255, 0.8) 0.8px, transparent 1.3px),
    radial-gradient(circle at 95% 65%, rgba(255, 255, 255, 0.6) 1px, transparent 1.5px);
  animation: starsTwinkle 8s ease-in-out infinite;
  opacity: 0.7;
  z-index: 1;
}

/* Дополнительный слой звезд */
.avatar-frame.frame-nebula::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  background: 
    radial-gradient(circle at 5% 25%, rgba(255, 255, 255, 0.4) 0.3px, transparent 0.8px),
    radial-gradient(circle at 35% 45%, rgba(255, 255, 255, 0.3) 0.4px, transparent 0.9px),
    radial-gradient(circle at 55% 65%, rgba(255, 255, 255, 0.5) 0.2px, transparent 0.7px),
    radial-gradient(circle at 75% 85%, rgba(255, 255, 255, 0.4) 0.5px, transparent 1px),
    radial-gradient(circle at 85% 5%, rgba(255, 255, 255, 0.3) 0.6px, transparent 1.1px),
    radial-gradient(circle at 20% 70%, rgba(255, 255, 255, 0.5) 0.3px, transparent 0.8px),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.4) 0.4px, transparent 0.9px),
    radial-gradient(circle at 30% 95%, rgba(255, 255, 255, 0.3) 0.2px, transparent 0.7px),
    radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.5) 0.5px, transparent 1px),
    radial-gradient(circle at 90% 60%, rgba(255, 255, 255, 0.4) 0.6px, transparent 1.1px);
  animation: starsTwinkle 12s ease-in-out infinite reverse;
  opacity: 0.5;
  z-index: 1;
}

@keyframes nebulaAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes starsTwinkle {
  0%, 100% {
    opacity: 0.5;
    transform: translate(0, 0) scale(1);
  }
  25% {
    opacity: 0.8;
    transform: translate(-2px, -2px) scale(1.02);
  }
  50% {
    opacity: 0.6;
    transform: translate(2px, 2px) scale(0.98);
  }
  75% {
    opacity: 0.9;
    transform: translate(-1px, 1px) scale(1.01);
  }
}

.avatar-frame.frame-nebula .user-avatar {
  position: relative;
  z-index: 2;
}

/* Рамка с древними рунами */
.avatar-frame.frame-ancient {
  background: linear-gradient(45deg, #8B4513, #A0522D, #8B4513);
  padding: 8px;
  border: 2px solid #5D4037;
  box-shadow: 0 0 15px rgba(139, 69, 19, 0.7);
  position: relative;
  overflow: hidden;
}

.avatar-frame.frame-ancient:hover {
  box-shadow: 0 0 25px rgba(139, 69, 19, 0.9);
}

.avatar-frame.frame-ancient::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255, 215, 0, 0.1) 2px, rgba(255, 215, 0, 0.1) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255, 215, 0, 0.1) 2px, rgba(255, 215, 0, 0.1) 4px);
  border-radius: 50%;
  opacity: 0.7;
}

.avatar-frame.frame-ancient::after {
  content: '最高の';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 215, 0, 0.3);
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 8px;
  z-index: 1;
}

/* Электрическая рамка */
.avatar-frame.frame-abyss {
  background: #0a0a2a;
  padding: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(0, 195, 255, 0.5);
  border: 1px solid rgba(0, 195, 255, 0.3);
}

.avatar-frame.frame-abyss:hover {
  box-shadow: 0 0 25px rgba(0, 195, 255, 0.8);
}

/* Галактическая рамка */
.avatar-frame.frame-galaxy {
  background: #000;
  padding: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(128, 0, 255, 0.7);
}

.avatar-frame.frame-galaxy:hover {
  box-shadow: 0 0 30px rgba(128, 0, 255, 0.9);
}

.avatar-frame.frame-galaxy::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at center, transparent 30%, rgba(75, 0, 130, 0.8) 70%),
    repeating-conic-gradient(
      from 0deg,
      transparent 0deg 10deg,
      rgba(148, 0, 211, 0.7) 10deg 20deg,
      transparent 20deg 30deg,
      rgba(75, 0, 130, 0.7) 30deg 40deg
    );
  animation: galaxySpin 15s linear infinite;
  opacity: 0.8;
  z-index: 1;
}

.avatar-frame.frame-galaxy::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: galaxyPulse 5s ease-in-out infinite alternate;
  z-index: 1;
}

@keyframes galaxySpin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes galaxyPulse {
  0% {
    opacity: 0.3;
  }
  100% {
    opacity: 0.7;
  }
}

/* Адаптивность для рамок */
@media (max-width: 576px) {
  .avatar-frame {
    padding: 3px;
  }
  
  .avatar-frame.frame-golden,
  .avatar-frame.frame-silver,
  .avatar-frame.frame-fire,
  .avatar-frame.frame-ice,
  .avatar-frame.frame-rainbow,
  .avatar-frame.frame-electric {
    padding: 4px;
  }

  .avatar-frame.frame-nebula,
  .avatar-frame.frame-galaxy {
    padding: 5px;
  }

  .avatar-frame.frame-ancient {
    padding: 6px;
  }

  .avatar-frame.frame-ancient::after {
    font-size: 16px;
    letter-spacing: 4px;
  }
  
  .avatar-frame.frame-nebula::before,
  .avatar-frame.frame-nebula::after {
    animation-duration: 10s;
  }
  
  .avatar-frame.frame-abyss::before,
  .avatar-frame.frame-abyss::after {
    animation-duration: 2.5s;
  }
}

/* Убедимся, что аватар всегда поверх рамки */
.avatar-frame .user-avatar {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}


/* Северное Дыхание */
.avatar-frame.frame-northbreath {
  background: linear-gradient(160deg, #6bd3ff, #5860ff, #8b9bff, #6bd3ff);
  border: 2px solid rgba(180, 220, 255, 0.8);
  box-shadow: 0 0 20px rgba(130, 160, 255, 0.5);
  padding: 4px;
  animation: auroraMove 8s ease-in-out infinite;
  border-radius: 50%;
  background-size: 400% 400%; /* Увеличиваем размер градиента */
}

@keyframes auroraMove {
  0% { 
    background-position: 0% 50%;
    filter: hue-rotate(0deg);
  }
  25% {
    background-position: 50% 100%;
  }
  50% { 
    background-position: 100% 50%;
    filter: hue-rotate(30deg);
  }
  75% {
    background-position: 50% 0%;
  }
  100% { 
    background-position: 0% 50%;
    filter: hue-rotate(0deg);
  }
}

.avatar-frame.frame-northbreath:hover {
  box-shadow: 0 0 35px rgba(160, 200, 255, 1);
  animation-duration: 4s; /* Ускоряем анимацию при наведении */
}

/* Новогодняя ёлка */
.avatar-frame.frame-christmas-tree {
  background: linear-gradient(135deg, #004d00, #006600, #004d00);
  padding: 6px;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(0, 77, 0, 0.5);
  position: relative;
  overflow: hidden;
}
.avatar-frame.frame-christmas-tree::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 215, 0, 0.8) 2px, transparent 3px),
    radial-gradient(circle at 50% 50%, rgba(255, 0, 0, 0.8) 2px, transparent 3px),
    radial-gradient(circle at 80% 70%, rgba(0, 191, 255, 0.8) 2px, transparent 3px);
  animation: lightsBlink 2s ease-in-out infinite;
  opacity: 0.7;
  z-index: 1;
}
.avatar-frame.frame-christmas-tree:hover {
  box-shadow: 0 0 25px rgba(0, 77, 0, 0.8);
  animation-duration: 1.5s;
}
@keyframes lightsBlink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
.avatar-frame.frame-christmas-tree .user-avatar {
  z-index: 2;
}

/* Праздничные огни */
.avatar-frame.frame-holiday-lights {
  background: #000;
  padding: 6px;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  position: relative;
  overflow: hidden;
}
.avatar-frame.frame-holiday-lights::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, #ff0000, #ffff00, #00ff00, #0000ff, #ff0000);
  background-size: 400% 400%;
  animation: lightsGradient 4s linear infinite;
  opacity: 0.6;
  z-index: 1;
}
.avatar-frame.frame-holiday-lights:hover {
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
  animation-duration: 2s;
}
@keyframes lightsGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.avatar-frame.frame-holiday-lights .user-avatar {
  z-index: 2;
}

/* Зимний лёд */
.avatar-frame.frame-winter-ice {
  background: rgba(173, 216, 230, 0.3);
  border: 2px solid rgba(135, 206, 235, 0.9);
  box-shadow: 0 0 20px rgba(135, 206, 235, 0.4);
  padding: 4px;
  backdrop-filter: blur(5px);
}
.avatar-frame.frame-winter-ice:hover {
  box-shadow: 0 0 30px rgba(135, 206, 235, 0.8);
}

/* Structured Frame Config V1 belongs to reward_renderer.css. Legacy
   .frame-{frame_key} selectors above remain the authoritative NULL-config path. */
/* Shared Reward Renderer. Legacy frame selectors remain in avatar_frames.css. */
.reward-badge { display:inline-flex; align-items:center; gap:.34em; max-width:100%; min-height:1.85em; padding:.28em .64em; border-radius:999px; background:rgba(255,255,255,.2); color:inherit; font:inherit; font-size:.82em; font-weight:700; line-height:1.2; vertical-align:middle; }
.reward-badge__emoji { flex:none; font-family:"Segoe UI Emoji","Apple Color Emoji","Noto Color Emoji",sans-serif; }
.reward-badge__label { min-width:0; overflow-wrap:anywhere; }
.reward-badge--compact { font-size:.74em; padding:.22em .5em; }
.reward-badge--shop-preview { color:#21160b; background:rgba(255,255,255,.62); }
.reward-frame-wrapper.reward-frame--structured { box-sizing:border-box; border-radius:50%; }
.avatar-frame.reward-frame { border-radius:50%; background:var(--reward-frame-color-1); border:var(--reward-frame-border-width) solid var(--reward-frame-color-1); box-shadow:0 0 calc(8px + (var(--reward-frame-glow-opacity) * 20px)) var(--reward-frame-color-1); padding:4px; }
.avatar-frame.reward-frame--gradient,
.avatar-frame.reward-frame--animated-gradient { background:linear-gradient(135deg,var(--reward-frame-color-1),var(--reward-frame-color-2),var(--reward-frame-color-3)); }
.avatar-frame.reward-frame--dual-gradient { background:linear-gradient(45deg,var(--reward-frame-color-1),var(--reward-frame-color-2)),linear-gradient(225deg,var(--reward-frame-color-2),var(--reward-frame-color-3)); }
.avatar-frame.reward-frame--glow,
.avatar-frame.reward-frame--pulse { box-shadow:0 0 calc(12px + (var(--reward-frame-glow-opacity) * 24px)) var(--reward-frame-color-1); }
.avatar-frame.reward-frame--animation-pulse { animation:reward-frame-pulse 1.8s ease-in-out infinite; }
.avatar-frame.reward-frame--animation-rotate { animation:reward-frame-rotate 3.2s linear infinite; }
.avatar-frame.reward-frame--animation-shimmer { animation:reward-frame-shimmer 2.4s ease-in-out infinite; }
.avatar-frame.reward-frame--animation-rainbow { animation:reward-frame-hue 3s linear infinite; }
@keyframes reward-frame-pulse { 50% { transform:scale(1.035); } }
@keyframes reward-frame-rotate { to { transform:rotate(360deg); } }
@keyframes reward-frame-shimmer { 50% { filter:brightness(1.25); } }
@keyframes reward-frame-hue { to { filter:hue-rotate(360deg); } }
.reward-frame-wrapper.reward-frame--profile-large { width:102px; height:102px; }
.reward-frame-wrapper.reward-frame--avatar { width:100%; height:100%; }
.reward-frame--compact { width:40px; height:40px; }
.reward-frame-wrapper.reward-frame--shop-preview { width:74px; height:74px; }
.reward-theme-product-preview { display:block; width:clamp(4.5rem,10vw,6rem); aspect-ratio:1; border:1px solid rgba(255,255,255,.25); border-radius:.9rem; background:linear-gradient(135deg,var(--reward-theme-color-1),var(--reward-theme-color-2) 52%,var(--reward-theme-color-3)); box-shadow:0 .7rem 1.4rem rgba(0,0,0,.24); }
.reward-folder-header-preview { display:block; width:100%; min-width:0; overflow:hidden; border:1px solid var(--folder-header-border); border-radius:1rem; color:var(--folder-header-text-primary); background:linear-gradient(135deg,var(--folder-header-bg-1),var(--folder-header-bg-2) 52%,var(--folder-header-bg-3)); box-shadow:0 .8rem 1.8rem rgba(0,0,0,.22); }
.reward-folder-header-preview--glow-soft { box-shadow:0 0 1.4rem color-mix(in srgb,var(--folder-header-glow) 34%,transparent),0 .8rem 1.8rem rgba(0,0,0,.22); }
.reward-folder-header-preview--glow-medium { box-shadow:0 0 2rem color-mix(in srgb,var(--folder-header-glow) 52%,transparent),0 .8rem 1.8rem rgba(0,0,0,.22); }
.reward-folder-header-preview__cover { display:block; height:3.7rem; background:linear-gradient(135deg,rgba(255,255,255,.18),rgba(255,255,255,.03)),radial-gradient(circle at 80% 25%,var(--folder-header-accent),transparent 28%); border-bottom:1px solid var(--folder-header-border); }
.reward-folder-header-preview__body { display:flex; align-items:flex-end; justify-content:space-between; gap:.7rem; padding:.75rem; }
.reward-folder-header-preview__identity { display:flex; align-items:center; min-width:0; gap:.58rem; }
.reward-folder-header-preview__frame.avatar-frame { flex:0 0 2.55rem; width:2.55rem; height:2.55rem; padding:2px; background:linear-gradient(135deg,#F5A65B,#B46024); border:2px solid rgba(255,255,255,.78); box-shadow:0 0 .7rem rgba(245,166,91,.35); }
.reward-folder-header-preview__avatar { display:grid; width:100%; height:100%; place-items:center; border-radius:50%; background:#2B211D; color:#FFF7EA; font-weight:800; }
.reward-folder-header-preview__copy { display:grid; min-width:0; gap:.16rem; }
.reward-folder-header-preview__copy strong { overflow:hidden; color:var(--folder-header-text-primary); font-size:.86rem; line-height:1.15; text-overflow:ellipsis; white-space:nowrap; }
.reward-folder-header-preview__copy small { color:var(--folder-header-text-secondary); font-size:.69rem; }
.reward-folder-header-preview__copy .reward-badge { width:max-content; max-width:100%; font-size:.58rem; }
.reward-folder-header-preview__accent { width:max-content; max-width:100%; padding:.16rem .42rem; border-radius:999px; color:var(--folder-header-accent-text); background:var(--folder-header-accent); font-size:.56rem; font-style:normal; font-weight:800; }
.reward-folder-header-preview__controls { display:flex; flex:0 0 auto; align-items:center; gap:.35rem; }
.reward-folder-header-preview__controls > span { display:inline-flex; min-height:1.85rem; align-items:center; justify-content:center; padding:.3rem .55rem; border-radius:.55rem; color:var(--folder-header-control-text); background:var(--folder-header-control-bg); font-size:.64rem; font-weight:750; }
.reward-folder-background-preview { display:block; width:100%; min-height:7.5rem; overflow:hidden; border:1px solid rgba(255,255,255,.2); border-radius:1rem; background:var(--folder-surface-bg-1); box-shadow:inset 0 1px rgba(255,255,255,.08),0 .7rem 1.4rem rgba(0,0,0,.2); }
.reward-folder-surface--solid { background:var(--folder-surface-bg-1); }
.reward-folder-surface--gradient,.reward-folder-surface--animated_gradient { background:linear-gradient(135deg,var(--folder-surface-bg-1),var(--folder-surface-bg-2),var(--folder-surface-bg-3)); }
/* Shared folder aurora: two container-relative layers keep previews and public folders visually aligned. */
.reward-folder-surface--animated_gradient { position:relative; isolation:isolate; }
.reward-folder-aurora-layer { display:block; position:absolute; inset:0; z-index:0; overflow:hidden; pointer-events:none; }
.reward-folder-surface--animated_gradient:not(.folder-page-surface)::before,.reward-folder-surface--animated_gradient:not(.folder-page-surface)::after,.reward-folder-aurora-layer::before,.reward-folder-aurora-layer::after { content:""; position:absolute; inset:-16%; z-index:0; pointer-events:none; background-repeat:no-repeat; }
.reward-folder-surface--animated_gradient:not(.folder-page-surface)::before,.reward-folder-aurora-layer::before { background:radial-gradient(ellipse 52% 42% at 24% 22%,color-mix(in srgb,var(--folder-surface-bg-2) 92%,transparent) 0%,color-mix(in srgb,var(--folder-surface-bg-2) 55%,transparent) 36%,transparent 74%),radial-gradient(ellipse 42% 34% at 78% 74%,color-mix(in srgb,var(--folder-surface-bg-1) 68%,transparent) 0%,transparent 76%); animation:reward-folder-aurora-one 24s cubic-bezier(.42,.08,.52,.94) infinite; }
.reward-folder-surface--animated_gradient:not(.folder-page-surface)::after,.reward-folder-aurora-layer::after { background:radial-gradient(ellipse 56% 44% at 76% 30%,color-mix(in srgb,var(--folder-surface-bg-3) 94%,transparent) 0%,color-mix(in srgb,var(--folder-surface-bg-3) 58%,transparent) 38%,transparent 76%),radial-gradient(ellipse 38% 32% at 28% 82%,color-mix(in srgb,var(--folder-surface-bg-2) 58%,transparent) 0%,transparent 78%); animation:reward-folder-aurora-two 32s cubic-bezier(.34,.1,.58,.93) infinite; }
.reward-folder-surface--animated_gradient > :not(.reward-folder-aurora-layer) { position:relative; z-index:1; }
.reward-folder-background-preview__content { display:grid; gap:.48rem; padding:1rem; }
.reward-folder-background-preview__content i { display:block; height:.55rem; border-radius:999px; background:rgba(255,255,255,.15); }
.reward-folder-background-preview__content i:nth-child(1) { width:48%; height:1.1rem; }
.reward-folder-background-preview__content i:nth-child(2) { width:76%; }
.reward-folder-background-preview__content i:nth-child(3) { width:62%; }
@keyframes reward-folder-aurora-one { 0%,100% { transform:translate3d(-8%,-5%,0) scale(1.03); } 35% { transform:translate3d(10%,4%,0) scale(1.08); } 70% { transform:translate3d(2%,13%,0) scale(1.05); } }
@keyframes reward-folder-aurora-two { 0%,100% { transform:translate3d(9%,11%,0) scale(1.06); } 40% { transform:translate3d(-8%,1%,0) scale(1.02); } 75% { transform:translate3d(6%,-9%,0) scale(1.09); } }
@media (max-width:430px) { .reward-badge { white-space:normal; } }
@media (max-width:430px) { .reward-folder-header-preview__body { align-items:flex-start; flex-direction:column; } .reward-folder-header-preview__controls { width:100%; } }
@media (prefers-reduced-motion:reduce) { .reward-folder-surface--animated_gradient:not(.folder-page-surface)::before,.reward-folder-surface--animated_gradient:not(.folder-page-surface)::after,.reward-folder-aurora-layer::before,.reward-folder-aurora-layer::after { animation:none; } }
