* {
    box-sizing: border-box;
}

/* Скрываем голубую подпись с названием при загрузке/ошибке картинок */
img {
    color: transparent;
    font-size: 0;
}

@keyframes img-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Плейсхолдер с анимацией пока грузятся картинки */
.card-logo-link,
.rec-card-logo-link {
    position: relative;
    overflow: hidden;
}
.card-logo-link::before,
.rec-card-logo-link::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(
        90deg,
        var(--color-gray) 0%,
        #f8f8f8 20%,
        var(--color-gray) 40%,
        var(--color-gray) 100%
    );
    background-size: 200% 100%;
    animation: img-shimmer 1.5s ease-in-out infinite;
}
body.dark-theme .card-logo-link::before,
body.dark-theme .rec-card-logo-link::before {
    background: linear-gradient(
        90deg,
        #333 0%,
        #404040 20%,
        #333 40%,
        #333 100%
    );
    background-size: 200% 100%;
}
.card-logo-link { min-width: 190px; min-height: 190px; }
.rec-card-logo-link { min-width: 72px; min-height: 72px; }

.card-logo-link img,
.rec-card-logo-link img {
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.25s ease-out;
}
.card-logo-link img.img-loaded,
.rec-card-logo-link img.img-loaded {
    opacity: 1;
}
.card-logo-link.img-loaded::before,
.rec-card-logo-link.img-loaded::before {
    display: none;
}

.site-detail-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(
        90deg,
        var(--color-gray) 0%,
        #f8f8f8 20%,
        var(--color-gray) 40%,
        var(--color-gray) 100%
    );
    background-size: 200% 100%;
    animation: img-shimmer 1.5s ease-in-out infinite;
}
body.dark-theme .site-detail-banner::before {
    background: linear-gradient(
        90deg,
        #333 0%,
        #404040 20%,
        #333 40%,
        #333 100%
    );
    background-size: 200% 100%;
}
.site-detail-banner img {
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.25s ease-out;
}
.site-detail-banner img.img-loaded {
    opacity: 1;
}
.site-detail-banner.img-loaded::before {
    display: none;
}

.banner-item {
    position: relative;
}
.banner-item::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(
        90deg,
        var(--color-gray) 0%,
        #f8f8f8 20%,
        var(--color-gray) 40%,
        var(--color-gray) 100%
    );
    background-size: 200% 100%;
    animation: img-shimmer 1.5s ease-in-out infinite;
}
body.dark-theme .banner-item::before {
    background: linear-gradient(
        90deg,
        #333 0%,
        #404040 20%,
        #333 40%,
        #333 100%
    );
    background-size: 200% 100%;
}
.banner-item img.banner-gif {
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.25s ease-out;
}
.banner-item img.banner-gif.img-loaded {
    opacity: 1;
}
.banner-item.img-loaded::before {
    display: none;
}

:root {
    --color-gray: #ebebeb;
}

body.dark-theme {
    --color-gray: #282828;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background: #fff;
    color: #000;
    min-height: 100vh;
    overflow-x: hidden;
}

.header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: #fff;
    color: #000;
    border-bottom: 1px solid var(--color-gray);
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: block;
}
.header-logo-dark {
    display: none;
}
body.dark-theme .header-logo-light {
    display: none;
}
body.dark-theme .header-logo-dark {
    display: block;
}

.logo-link {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #000;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-search {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    background: #fff;
    color: #000;
    font-size: 1rem;
}

.search-input:focus {
    border-color: #000;
    outline: none;
}

.search-input::placeholder {
    color: #666666;
}

.search-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--color-gray);
    background: #fff;
    color: #000;
    cursor: pointer;
}

.search-btn:hover {
    border-color: #000;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    color: #000;
    font-size: 0.9rem;
}

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

.user-menu-trigger {
    cursor: pointer;
    user-select: none;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    min-width: 150px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.user-menu-wrapper:hover .user-menu-dropdown,
.user-menu-dropdown:hover {
    display: block;
    pointer-events: auto;
    opacity: 1;
}

.user-menu-dropdown::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 0;
    right: 0;
    height: 0.5rem;
    background: transparent;
}

.user-menu-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #000;
    text-decoration: none;
    border-bottom: 1px solid var(--color-gray);
}

.user-menu-item:last-child {
    border-bottom: none;
}

.user-menu-item:hover {
    background: #f5f5f5;
}

.user-review-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid var(--color-gray);
    background: #fff;
    color: #000;
    transition: opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.btn:active {
    transform: scale(0.98);
}

.btn:hover {
    border-color: #000;
}

.btn-primary {
    background: #000;
    color: #fff;
    border-color: #000;
}

.btn-primary:hover {
    opacity: 0.9;
    color: #fff;
}

.btn-outline {
    background: #fff;
    color: #000;
    border-color: var(--color-gray);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline:hover {
    border-color: #000;
    transform: translateY(-1px);
}

.theme-toggle {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle img {
    width: 20px;
    height: 20px;
    display: block;
}

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
}

.auth-form .btn-auth-submit {
    margin-top: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.auth-switch {
    margin-top: 1rem;
    margin-bottom: 0;
}

.auth-switch-text {
    text-align: center;
}

.auth-switch-text a {
    color: inherit;
    text-decoration: underline;
}

.auth-switch-text a:hover {
    text-decoration: none;
}

.btn-small {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: #fff;
    color: #d00;
    border-color: #d00;
}

.btn-danger:hover {
    background: #d00;
    color: #fff;
    border-color: #a00;
}

.btn-icon {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #000;
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
}

.btn-icon:hover {
    background: #000;
    border-color: #000;
}

.btn-icon:hover img {
    filter: brightness(0) invert(1);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.link-online-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 5px;
    height: 5px;
    background: #22c55e;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
}

body.dark-theme .link-online-dot {
    border-color: rgba(255,255,255,0.2);
}

.banners-section-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem 0;
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
}

/* Блок сообщений: та же ширина, что и баннеры (гифки) над ним */
.announcements-section-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem 0.35rem;
    width: 100%;
    box-sizing: border-box;
}
.announcement-block {
    position: relative;
    padding: 0.6rem 2.25rem 0.6rem 0.85rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    background: var(--announcement-bg, #fff);
    font-size: 0.9375rem;
    line-height: 1.45;
}
.announcement-block:last-child {
    margin-bottom: 0;
}
body.dark-theme .announcement-block {
    --announcement-bg: #1e1e1e;
    border-color: var(--color-gray);
}
.announcement-close {
    position: absolute;
    top: 0.4rem;
    right: 0.45rem;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: none;
    font-size: 20px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.dark-theme .announcement-close {
    color: #aaa;
}
.announcement-close:hover {
    color: #000;
}
body.dark-theme .announcement-close:hover {
    color: #fff;
}
.announcement-content {
    font-size: 0.9375rem;
    line-height: 1.45;
    color: inherit;
}
body.dark-theme .announcement-content {
    color: inherit;
}
/* Выделение цветом фона — ровно по тексту, без скругления; текст всегда белый */
.announcement-highlight {
    color: #fff !important;
    padding: 0 0.12em;
    border-radius: 0;
}

.main {
    padding: 0.5rem 1.5rem 1rem;
    max-width: 1400px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

.flash {
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    margin-bottom: 1rem;
    animation: slideInDown 0.35s ease-out;
}

.layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    padding: 1rem;
}

.filter-form .filter-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

.filter-form .filter-title:first-child {
    margin-top: 0;
}

.filter-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0;
    cursor: pointer;
}

.filter-option span {
    min-width: 0;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex-shrink: 0;
    border: 1px solid var(--color-gray);
    accent-color: #000;
    background: #fff;
}

.filter-option input[type="checkbox"]:checked,
.filter-option input[type="radio"]:checked {
    accent-color: #000;
}

.filter-form .btn:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

.filters-toggle {
    display: none;
}

.filter-form .filters-close {
    display: none;
}

.content {
    flex: 1;
    min-width: 0;
    animation: fadeIn 0.35s ease-out;
}

.banners-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px 5px;
    margin-bottom: 0;
    width: 100%;
}

.banner-item {
    display: block;
    overflow: hidden;
    text-decoration: none;
}

.banner-item img.banner-gif {
    width: 100%;
    height: auto;
    display: block;
    vertical-align: top;
    max-width: none;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.banner-default {
    cursor: default;
}

.admin-banners-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.admin-banner-item {
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-banner-preview {
    width: 100%;
    height: auto;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
}

.admin-banner-info {
    font-size: 0.9rem;
}

.admin-banner-link {
    color: #666666;
    word-break: break-all;
    margin-top: 0.25rem;
}

.admin-banner-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-banner-empty {
    opacity: 0.7;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    min-width: 0;
}

.card {
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    min-width: 0;
    animation: fadeInUp 0.5s ease-out both;
}
.cards .card:nth-child(1) { animation-delay: 0s; }
.cards .card:nth-child(2) { animation-delay: 0.04s; }
.cards .card:nth-child(3) { animation-delay: 0.08s; }
.cards .card:nth-child(4) { animation-delay: 0.12s; }
.cards .card:nth-child(5) { animation-delay: 0.16s; }
.cards .card:nth-child(6) { animation-delay: 0.2s; }
.cards .card:nth-child(7) { animation-delay: 0.24s; }
.cards .card:nth-child(8) { animation-delay: 0.28s; }
.cards .card:nth-child(n+9) { animation-delay: 0.32s; }

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-logo-link {
    display: block;
    margin-bottom: 1rem;
}

.card-logo-link:hover {
    outline: none;
}

.card-logo {
    width: 190px;
    height: 190px;
    object-fit: contain;
    border-radius: 8px;
}

.card-name {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.card-name-link {
    color: inherit;
    text-decoration: none;
}

.card-name-link:hover {
    text-decoration: underline;
}

.card-category {
    font-size: 0.9rem;
    color: #666666;
    margin-bottom: 1rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    align-self: stretch;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    text-align: center;
}

.card-actions {
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.empty {
    color: #666666;
    padding: 2rem;
}

.site-detail {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.site-detail-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
    grid-template-rows: auto 1fr;
    column-gap: 1.5rem;
    row-gap: 0.5rem;
    align-items: start;
    max-width: 100%;
    min-width: 0;
}

.site-detail-banner-wrap {
    max-width: 100%;
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
}

.site-detail-top .site-detail-banner {
    margin-bottom: 0;
}

.site-detail-recommendations {
    grid-column: 2;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 400px;
}

.site-detail-main {
    max-width: 100%;
    min-width: 0;
    grid-column: 1;
    grid-row: 2;
}

.site-detail-recommendations-title {
    font-size: 1.5rem;
    margin: 0 0 0.75rem;
    color: #000;
}

.rec-cards,
.rec-cards-extra {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rec-cards-extra {
    margin-top: 0.75rem;
}

.rec-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 10px;
    align-items: flex-start;
    min-width: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeInUp 0.4s ease-out both;
}
.rec-cards .rec-card:nth-child(1) { animation-delay: 0s; }
.rec-cards .rec-card:nth-child(2) { animation-delay: 0.05s; }
.rec-cards .rec-card:nth-child(3) { animation-delay: 0.1s; }
.rec-cards .rec-card:nth-child(4) { animation-delay: 0.15s; }
.rec-cards .rec-card:nth-child(5) { animation-delay: 0.2s; }
.rec-cards .rec-card:nth-child(n+6) { animation-delay: 0.25s; }
.rec-cards-extra .rec-card:nth-child(1) { animation-delay: 0s; }
.rec-cards-extra .rec-card:nth-child(2) { animation-delay: 0.05s; }
.rec-cards-extra .rec-card:nth-child(n+3) { animation-delay: 0.1s; }
.rec-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.rec-card-logo-link {
    flex-shrink: 0;
}

.rec-card-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.rec-card-body {
    flex: 1;
    min-width: 0;
}

.rec-card-name {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.rec-card-name-link {
    color: inherit;
    text-decoration: none;
}

.rec-card-name-link:hover {
    text-decoration: underline;
}

.rec-card-category {
    font-size: 0.9rem;
    color: #666666;
    margin-bottom: 0.4rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.rec-card-rating {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.rec-card-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.rec-card-actions .btn-icon {
    width: 38px;
    height: 38px;
}

.rec-card-actions .btn-icon img {
    width: 18px;
    height: 18px;
}

.rec-more-wrap {
    margin: 0.75rem 0 0;
    flex-shrink: 0;
}

.rec-more-wrap .rec-more {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.rec-empty {
    font-size: 0.9rem;
    margin: 0;
}

.site-detail-mobile-tabs {
    display: none;
}

.site-detail-tab {
    font-size: 1rem;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    border: none;
    background: none;
    padding: 0;
}

.site-detail-tab:hover {
    text-decoration: underline;
}

.site-detail-tab.is-active {
    font-weight: 600;
}

@media (max-width: 960px) {
    .site-detail-top {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .site-detail-banner-wrap {
        max-width: none;
        grid-column: 1;
        grid-row: 1;
    }
    .site-detail-main {
        grid-column: 1;
        grid-row: 2;
    }
    .site-detail-recommendations {
        width: 100%;
        max-width: none;
        grid-column: 1;
        grid-row: 3;
    }
    .site-detail-mobile-tabs {
        display: flex;
        align-items: baseline;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    .site-detail-top .site-detail-recommendations {
        display: none;
    }
    .site-detail-top.rec-tab-active .site-detail-recommendations {
        display: flex;
    }
    .site-detail-top.rec-tab-active .reviews {
        display: none;
    }
    .reviews h2 {
        display: none;
    }
    .site-detail-recommendations-title {
        display: none;
    }
    .rec-cards,
    .rec-cards-extra {
        width: 100%;
    }
    .rec-card {
        width: 100%;
        box-sizing: border-box;
    }
}

.site-detail-banner {
    position: relative;
    width: 100%;
    aspect-ratio: 1280 / 739;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-gray);
}

.site-detail-logo-large {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.site-detail-logo-large-fallback {
    object-fit: cover;
}

.site-detail-head {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-gray);
    align-items: flex-start;
}

.site-detail-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--color-gray);
    flex-shrink: 0;
}

.site-detail-meta {
    flex: 1;
}

.site-detail-name {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
}

.site-detail-name-above-banner {
    margin-bottom: 0.75rem;
}

.site-detail-type,
.site-detail-aggregator {
    color: #666666;
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.site-detail-desc {
    margin: 0 0 1rem;
    line-height: 1.5;
}

.site-detail-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.site-detail-stats-strip {
    height: 1px;
    background: var(--color-gray);
    margin: 1.5rem 0;
}

.site-link-stats {
    margin-bottom: 1.5rem;
}

.site-availability-badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.site-availability--ok {
    background: #22c55e;
    color: #fff;
}

.site-availability--fail {
    background: #dc2626;
    color: #fff;
}

.site-availability--none {
    background: #6b7280;
    color: #fff;
}

.site-stats-graph-wrap {
    margin-bottom: 1rem;
}

.site-stats-graph-row {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.site-stats-graph {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    padding: 0.75rem;
    background: #fafafa;
    overflow: hidden;
}

.site-stats-graph-chart {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.site-stats-y-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    flex-shrink: 0;
    font-size: 0.65rem;
    color: #666;
    transform: rotate(90deg);
    white-space: nowrap;
}

body.dark-theme .site-stats-y-label {
    color: #888;
}

.site-stats-graph-svg {
    flex: 1;
    min-width: 0;
    height: 120px;
    display: block;
    overflow: hidden;
}

.site-stats-grid line {
    stroke: var(--color-gray);
    stroke-opacity: 0.65;
    stroke-width: 0.7;
}

body.dark-theme .site-stats-grid line {
    stroke-opacity: 0.45;
}

.site-stats-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #666;
    padding-left: 0.25rem;
}

body.dark-theme .site-stats-y-axis {
    color: #888;
}

.site-stats-graph {
    color: #000;
}

.site-stats-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.site-stats-point {
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1;
    cursor: pointer;
}

.site-stats-tooltip {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    background: #333;
    color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

body.dark-theme .site-stats-tooltip {
    background: #444;
    color: #eee;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

body.dark-theme .site-stats-graph {
    background: #1a1a1a;
    border-color: var(--color-gray);
    color: #fff;
}

.site-stats-graph-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    margin-right: 2.5rem;
    padding: 0 0.25rem;
    font-size: 0.7rem;
    color: #666;
}

body.dark-theme .site-stats-graph-labels {
    color: #888;
}

.site-stats-graph-label {
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-stats-graph-labels--by-time {
    position: relative;
    min-height: 1.2em;
    margin-right: 0;
}

.site-stats-graph-labels--by-time .site-stats-graph-label {
    position: absolute;
    flex: none;
    transform: translateX(-50%);
    text-align: center;
}

.site-stats-row {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    overflow: hidden;
}

.site-stats-cell {
    flex: 1;
    min-width: 80px;
    padding: 0.65rem 0.75rem;
    border-right: 1px solid var(--color-gray);
    text-align: center;
}

.site-stats-cell:last-child {
    border-right: none;
}

.site-stats-cell-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.site-stats-cell-sub {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.15rem;
}

body.dark-theme .site-stats-cell-sub {
    color: #888;
}

.site-stats-cell-value {
    font-size: 1rem;
    margin-top: 0.2rem;
}

.site-stats-empty {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

body.dark-theme .site-stats-empty {
    color: #888;
}

.icon-tor,
.icon-browser {
    display: inline-block;
}

.reviews h2 {
    margin: 0 0 1rem;
    font-size: 1.2rem;
}

.review-form {
    margin-bottom: 1.5rem;
}

.rating-input {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.star-rating {
    display: flex;
    flex-direction: row-reverse;
    gap: 0.2rem;
}

.star-rating input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.star-rating label {
    font-size: 1.8rem;
    color: #fff;
    -webkit-text-stroke: 1px #000;
    cursor: pointer;
    transition: color 0.2s;
    user-select: none;
    line-height: 1;
    display: inline-block;
}

.star-rating label:hover,
.star-rating label:hover ~ label {
    color: #000;
    -webkit-text-stroke: 1px #000;
}

.star-rating input[type="radio"]:checked ~ label {
    color: #000;
    -webkit-text-stroke: 1px #000;
}

.rating-hint {
    font-size: 0.85rem;
    color: #666666;
}

.review-textarea-wrap {
    margin-bottom: 0.5rem;
}

.review-form textarea {
    width: 100%;
    height: 5rem;
    padding: 0.75rem;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    font-family: inherit;
    margin-bottom: 0;
    resize: none;
    overflow-y: auto;
    background: #fff;
}

.review-form textarea:focus {
    border-color: #000;
    outline: none;
}

.review-form-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.review-textarea-wrap .review-char-count {
    display: block;
    font-size: 0.85rem;
    color: #666666;
    margin-top: 0.35rem;
}

.review-char-count {
    font-size: 0.85rem;
    color: #666666;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.review-item {
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    animation: fadeInUp 0.35s ease-out both;
}
.reviews-list .review-item:nth-child(1) { animation-delay: 0s; }
.reviews-list .review-item:nth-child(2) { animation-delay: 0.04s; }
.reviews-list .review-item:nth-child(3) { animation-delay: 0.08s; }
.reviews-list .review-item:nth-child(4) { animation-delay: 0.12s; }
.reviews-list .review-item:nth-child(5) { animation-delay: 0.16s; }
.reviews-list .review-item:nth-child(n+6) { animation-delay: 0.2s; }

.review-item-user {
    border-color: #000;
    border-width: 2px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.review-author {
    font-weight: 600;
}

.review-rating {
    font-size: 1rem;
}

.review-rating .star-filled {
    color: #000;
    -webkit-text-stroke: 0;
}

.review-rating .star-empty {
    color: #fff;
    -webkit-text-stroke: 1px #000;
}

.review-text {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

.card-rating .star-filled,
.site-detail-rating .star-filled,
.rec-card-rating .star-filled {
    color: #000;
    -webkit-text-stroke: 0;
}

.card-rating .star-empty,
.site-detail-rating .star-empty,
.rec-card-rating .star-empty {
    color: #fff;
    -webkit-text-stroke: 1px #000;
}

.review-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.review-date {
    font-size: 0.8rem;
    color: #666666;
}

.hint {
    font-size: 0.85rem;
    color: #666666;
    display: block;
    margin-top: 0.25rem;
}

.auth-page,
.admin-form-page,
.error-page {
    max-width: 600px;
    margin: 2rem auto;
}

.error-page {
    text-align: center;
}

.error-page h1 {
    margin-bottom: 1rem;
}

.error-page p {
    margin-bottom: 1rem;
    color: #666666;
}

.admin-form-page p a {
    color: #000;
    text-decoration: none;
}

.admin-form-page p a:hover {
    text-decoration: underline;
}

.auth-page h1,
.admin-form-page h1 {
    margin-bottom: 1rem;
}

.manage-sites-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}
.manage-sites-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}
.manage-site-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
}
.manage-site-name {
    flex: 1;
}
.admin-form-page .referral-section .hint {
    margin-bottom: 0.5rem;
}

.referral-section .link-row + .links-title {
    margin-top: 1.25rem;
}

.auth-form,
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.auth-form label,
.admin-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="url"],
.admin-form input[type="file"],
.admin-form select,
.admin-form textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    color: #000;
    font-family: inherit;
}

.auth-form input:focus,
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    border-color: #000;
    outline: none;
}

.admin-form textarea {
    resize: vertical;
    font-family: inherit;
}

.announcement-form-highlight {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.announcement-form-highlight .hint {
    margin: 0;
}
.announcement-form-highlight input[type="color"] {
    width: 2.5rem;
    height: 2rem;
    padding: 2px;
    border: 1px solid var(--color-gray);
    border-radius: 6px;
    cursor: pointer;
}

/* Кнопка «Предложить сайт» в шапке */
.header-btn-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
}
.header-btn-add img {
    display: block;
}

body.dark-theme .header-btn-add img {
    filter: brightness(0) invert(1);
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    animation: fadeIn 0.2s ease-out;
}
.modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 520px;
    width: 100%;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    position: relative;
    padding: 1.5rem;
    animation: scaleIn 0.25s ease-out;
}
body.dark-theme .modal-box {
    background: #1e1e1e;
    color: #fff;
}
.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0.25rem;
}
body.dark-theme .modal-close {
    color: #aaa;
}
.modal-close:hover {
    color: #000;
}
body.dark-theme .modal-close:hover {
    color: #fff;
}
.modal-title {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}
.modal-suggest-site .admin-form {
    margin-bottom: 0;
    gap: 0;
}

.modal-suggest-site #suggest-step1 > * + * {
    margin-top: 1.75rem;
}

.modal-suggest-site #suggest-step1 label,
.modal-suggest-site #suggest-step1 .types-section {
    margin-bottom: 0;
}

.modal-suggest-site #suggest-step1 .btn-primary {
    margin-top: 0.5rem;
}

.modal-suggest-site #suggest-step2 .links-title:first-child {
    margin-bottom: 0.5rem;
}

.modal-suggest-site #suggest-step2 .hint {
    margin-bottom: 1rem;
}

.modal-suggest-site #suggest-step2 .links-section {
    margin-bottom: 2rem;
}

.modal-suggest-site #suggest-step2 .links-section .links-title {
    margin-bottom: 0.5rem;
}

.modal-suggest-site #suggest-step2 > .hint:last-of-type {
    margin-bottom: 0;
}

.modal-suggest-site #suggest-step2 > div:last-of-type {
    margin-top: 2rem;
}

.suggest-form-error {
    color: #c00;
    font-size: 0.95rem;
    margin: 0 0 1rem 0;
}

/* Попап «Сообщение при входе» */
.welcome-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.welcome-popup-overlay.is-visible {
    display: flex !important;
    animation: fadeIn 0.25s ease-out;
}
.welcome-popup-overlay.is-visible .welcome-popup-box {
    animation: scaleIn 0.3s ease-out;
}
.welcome-popup-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    max-width: 720px;
    width: 100%;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 2.5rem 2.5rem 1.75rem;
}
body.dark-theme .welcome-popup-box {
    background: #1e1e1e;
    color: #fff;
}
.welcome-popup-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: none;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.dark-theme .welcome-popup-close {
    color: #aaa;
}
.welcome-popup-close:hover {
    color: #000;
}
body.dark-theme .welcome-popup-close:hover {
    color: #fff;
}
.welcome-popup-title {
    margin: 0 2rem 1.25rem 0;
    font-size: 1.85rem;
}
.welcome-popup-content {
    margin-bottom: 1.75rem;
    line-height: 1.6;
    font-size: 1.25rem;
}
.welcome-popup-content .welcome-popup-img,
.welcome-popup-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5rem 0;
}
.welcome-popup-highlight {
    color: #fff !important;
    padding: 0 0.12em;
    border-radius: 0;
}
.welcome-popup-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}
.welcome-popup-footer .btn-primary {
    width: 100%;
    padding: 0.9rem 1.5rem;
    font-size: 1.2rem;
    border-radius: 9999px;
}
.btn-welcome-ok {
    background: #0ea5e9 !important;
    border-color: #0ea5e9 !important;
    color: #fff !important;
}
.btn-welcome-ok:hover {
    background: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #fff !important;
}
body.dark-theme .btn-welcome-ok {
    background: #0ea5e9 !important;
    border-color: #0ea5e9 !important;
    color: #fff !important;
}
body.dark-theme .btn-welcome-ok:hover {
    background: #38bdf8 !important;
    border-color: #38bdf8 !important;
    color: #fff !important;
}
.welcome-popup-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: #666;
    cursor: pointer;
}
.welcome-popup-checkbox input[type="checkbox"] {
    accent-color: #000;
}
body.dark-theme .welcome-popup-checkbox {
    color: #aaa;
}
body.dark-theme .welcome-popup-checkbox input[type="checkbox"] {
    accent-color: #fff;
}

/* Кнопка «Наверх» */
.btn-scroll-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s, transform 0.2s;
}
.btn-scroll-top:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}
.btn-scroll-top img {
    display: block;
}
body.dark-theme .btn-scroll-top {
    background: #2a2a2a;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
body.dark-theme .btn-scroll-top:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}
body.dark-theme .btn-scroll-top img {
    filter: brightness(0) invert(1);
}

.links-section,
.types-section {
    margin-bottom: 1rem;
}

.type-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.type-row input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}

.type-row input:focus {
    border-color: #000;
    outline: none;
}

.btn-add-type {
    margin-top: 0.25rem;
}

/* Общий размер кнопок минуса в форме сайта (категории и ссылки) */
.btn-remove-type,
.btn-remove-link {
    flex-shrink: 0;
    min-width: 2.25rem;
    width: 2.25rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    background: #fff;
    color: #000;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    box-sizing: border-box;
}

.btn-remove-type:hover,
.btn-remove-link:hover {
    border-color: #000;
}

.btn-remove-link.btn-danger {
    background: #fff;
    color: #d00;
    border-color: #d00;
}

.btn-remove-link.btn-danger:hover {
    background: #d00;
    color: #fff;
    border-color: #a00;
}

#site-types-container .type-row:first-child .btn-remove-type,
#suggest-types-container .type-row:first-child .btn-remove-type {
    display: none;
}

.links-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.link-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.link-row input {
    flex: 1;
    border: 1px solid var(--color-gray);
}

.link-row input:focus {
    border-color: #000;
    outline: none;
}

.btn-add-link {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    background: #fff;
    color: #000;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-add-link:hover {
    border-color: #000;
}

.admin-page {
    max-width: 800px;
}

.moderation-meta {
    font-size: 0.85rem;
    color: #666;
}
body.dark-theme .moderation-meta {
    color: #aaa;
}

.admin-page h1 {
    margin-bottom: 1rem;
}

.admin-search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    max-width: 400px;
}
.admin-search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    font-size: 1rem;
}
.admin-pin-badge {
    font-size: 0.75rem;
    color: #666;
    font-weight: normal;
}
.admin-btn-pin {
    padding: 0.35rem;
}
.admin-btn-pin img {
    display: block;
    opacity: 0.8;
}
.admin-btn-pin:hover img {
    opacity: 1;
}
body.dark-theme .admin-btn-pin img {
    filter: brightness(0) invert(1);
}
body.dark-theme .admin-pin-badge {
    color: #aaa;
}
body.dark-theme .admin-list-title,
body.dark-theme .empty-sub {
    color: #888888;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    min-width: 0;
}

.admin-item-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--color-gray);
}

.admin-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
}
.admin-item-types {
    word-break: break-word;
    overflow-wrap: break-word;
}

.admin-item-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-item-drag-handle {
    cursor: grab;
    color: #666666;
    font-size: 1rem;
    user-select: none;
    padding: 0 0.25rem;
}
.admin-item-drag-handle:active {
    cursor: grabbing;
}
.admin-item-drag-handle-disabled {
    cursor: default;
    opacity: 0.4;
    pointer-events: none;
}
.admin-item-draggable.admin-item-dragging {
    opacity: 0.6;
}
.admin-list-title {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.5rem;
    color: #333;
}
.admin-list-title:first-of-type {
    margin-top: 0.5rem;
}
.empty-sub {
    color: #888;
    font-size: 0.95rem;
}

/* Реферальные ссылки (админка) */
.admin-referral-page {
    max-width: 900px;
}
.admin-referral-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1rem;
}
.admin-referral-form-block {
    flex: 0 0 280px;
    min-width: 260px;
}
.admin-referral-form .hint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.35rem;
}
body.dark-theme .admin-referral-form .hint {
    color: #888;
}
.admin-referral-list-block {
    flex: 1;
    min-width: 280px;
}
.admin-referral-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.admin-referral-card {
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.admin-referral-card-head {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.admin-referral-card-name {
    font-size: 1rem;
    color: #333;
}
.admin-referral-card-stats {
    font-size: 0.9rem;
    color: #666;
}
body.dark-theme .admin-referral-card {
    background: #1e1e1e;
    border-color: var(--color-gray);
}
body.dark-theme .admin-referral-card-name {
    color: #fff;
}
body.dark-theme .admin-referral-card-stats {
    color: #888;
}
.admin-referral-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.admin-referral-loading {
    padding: 1rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}
body.dark-theme .admin-referral-loading {
    color: #888;
}

/* Анимация подгрузки на главной (бесконечная прокрутка) */
.infinite-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #666;
    font-size: 0.95rem;
}
.infinite-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #333;
    border-radius: 50%;
    animation: infinite-loading-spin 0.7s linear infinite;
}
.infinite-loading-text {
    font-variant-numeric: tabular-nums;
}
@keyframes infinite-loading-spin {
    to { transform: rotate(360deg); }
}
body.dark-theme .infinite-loading {
    color: #aaa;
}
body.dark-theme .infinite-loading-spinner {
    border-color: #444;
    border-top-color: #ccc;
}

.admin-diagnostic-hint {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1rem;
}
.admin-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}
.admin-inline-form label { margin-bottom: 0; }
.admin-ping-links-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}
.admin-ping-link-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-gray);
    font-size: 0.9rem;
}
.admin-ping-link-item a { word-break: break-all; }
.admin-ping-link-type {
    font-weight: 600;
    min-width: 5rem;
    color: #333;
}
body.dark-theme .admin-ping-link-type { color: #ddd; }
.link-checks-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.link-checks-block h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
}
.link-checks-block h3 a {
    word-break: break-all;
}
.admin-table.link-checks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table.link-checks-table th,
.admin-table.link-checks-table td {
    padding: 0.4rem 0.75rem;
    text-align: left;
    border: 1px solid var(--color-gray);
}
.admin-table.link-checks-table th {
    background: rgba(0,0,0,0.05);
}
.link-checks-table tr.check-ok {
    background: rgba(0,128,0,0.08);
}
.link-checks-table tr.check-fail {
    background: rgba(200,0,0,0.06);
}
body.dark-theme .admin-table.link-checks-table th {
    background: rgba(255,255,255,0.06);
}
body.dark-theme .link-checks-table tr.check-ok {
    background: rgba(0,180,0,0.12);
}
body.dark-theme .link-checks-table tr.check-fail {
    background: rgba(255,80,80,0.1);
}

.admin-user-item .admin-item-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}
.admin-user-meta {
    font-size: 0.9rem;
    color: #666666;
}
.admin-pagination {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-gray);
}
.admin-pagination-info {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: #666666;
}
.admin-pagination-links {
    margin: 0;
}
.admin-pagination-links .btn {
    margin-right: 0.5rem;
}
.admin-form-checkbox {
    flex-direction: row !important;
    align-items: center;
}
.admin-form-checkbox input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin-right: 0.5rem;
}

body.dark-theme .admin-user-meta,
body.dark-theme .admin-pagination-info {
    color: #888888;
}
body.dark-theme .admin-pagination {
    border-top-color: var(--color-gray);
}

@media (max-width: 1100px) {
    .cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Мобильная адаптация: фильтры в кнопке, 2 карточки в ряд */
@media (max-width: 768px) {
    .header {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .header-actions {
        margin-left: auto;
    }
    .banners-section-wrapper,
    .announcements-section-wrapper {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .banners-section {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        margin-bottom: 0;
    }
    .banners-section .banner-item {
        width: 100%;
    }
    .banners-section .banner-item img.banner-gif {
        width: 100%;
        height: auto;
        display: block;
    }
    .main {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .layout {
        flex-direction: column;
        position: relative;
        width: 100%;
        box-sizing: border-box;
    }
    .filters-toggle {
        display: inline-flex;
        justify-content: center;
        width: 100%;
        margin-bottom: 0.5rem;
        box-sizing: border-box;
    }
    .sidebar {
        display: none;
        width: 100%;
        background: #fff;
        border: 1px solid var(--color-gray);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 0.5rem;
        box-sizing: border-box;
    }
    .layout--filters-open .sidebar {
        display: block;
    }
    .layout--filters-open .filters-toggle {
        display: none;
    }
    .filter-form .filters-close {
        display: block;
        margin-top: 0.75rem;
    }
    .content {
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.9rem;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }
    .card {
        padding: 1.1rem;
        min-width: 0;
        overflow: hidden;
        box-sizing: border-box;
    }
    .card-logo-link {
        margin-bottom: 0.65rem;
        min-width: 160px;
        min-height: 160px;
    }
    .card-logo {
        width: 160px;
        height: 160px;
        max-width: 100%;
        object-fit: contain;
    }
    .card-name {
        font-size: 1.08rem;
        line-height: 1.35;
    }
    .card-category {
        font-size: 0.95rem;
        margin-bottom: 0.6rem;
    }
    .card-rating {
        font-size: 1.1rem !important;
        margin-bottom: 0.5rem !important;
    }
    .card-actions {
        gap: 0.5rem;
    }
    .card-actions .btn-icon {
        width: 42px;
        height: 42px;
    }
    .card-actions .btn-icon img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 600px) {
    .header {
        flex-wrap: wrap;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .header-actions {
        margin-left: auto;
    }
    .header-search {
        order: 3;
        width: 100%;
        max-width: none;
    }
    .banners-section-wrapper,
    .announcements-section-wrapper {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }
    .card {
        padding: 0.95rem;
    }
    .card-logo-link {
        min-width: 140px;
        min-height: 140px;
    }
    .card-logo {
        width: 140px;
        height: 140px;
        object-fit: contain;
    }
    .card-name {
        font-size: 1rem;
    }
    .card-category {
        font-size: 0.9rem;
    }
    .card-rating {
        font-size: 1.05rem !important;
    }
    .card-actions .btn-icon {
        width: 38px;
        height: 38px;
    }
    .card-actions .btn-icon img {
        width: 19px;
        height: 19px;
    }
}

/* Тёмная тема */
body.dark-theme {
    background: #1e1e1e;
    color: #fff;
}

body.dark-theme .header {
    background: #1e1e1e;
    color: #fff;
    border-bottom-color: var(--color-gray);
}

body.dark-theme .logo-link {
    color: #fff;
}

body.dark-theme .search-input {
    background: #1e1e1e;
    color: #fff;
    border-color: var(--color-gray);
}

body.dark-theme .search-input::placeholder {
    color: #888888;
}

body.dark-theme .search-input:focus {
    border-color: #fff;
}

body.dark-theme .search-btn {
    background: #1e1e1e;
    color: #fff;
    border-color: var(--color-gray);
}

body.dark-theme .search-btn:hover {
    border-color: #fff;
    background: var(--color-gray);
}

body.dark-theme .user-name {
    color: #fff;
}

body.dark-theme .user-menu-dropdown {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .user-menu-item {
    color: #fff;
    border-bottom-color: var(--color-gray);
}

body.dark-theme .user-menu-item:hover {
    background: #333;
}

body.dark-theme .user-review-section {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .btn {
    background: #1e1e1e;
    color: #fff;
    border-color: var(--color-gray);
}

body.dark-theme .btn:hover {
    border-color: #fff;
    background: var(--color-gray);
}

body.dark-theme .btn-primary {
    background: #fff;
    color: #000;
    border-color: var(--color-gray);
}

body.dark-theme .btn-primary:hover {
    opacity: 0.9;
    border-color: #fff;
    background: #333;
    color: #fff;
}

body.dark-theme .btn-outline {
    background: #1e1e1e;
    color: #fff;
    border-color: var(--color-gray);
}

body.dark-theme .btn-outline:hover {
    border-color: #fff;
    background: var(--color-gray);
}

body.dark-theme .theme-toggle img {
    filter: brightness(0) invert(1);
}

body.dark-theme .btn-icon img {
    filter: brightness(0) invert(1);
}

body.dark-theme .site-detail-links img {
    filter: brightness(0) invert(1);
}

body.dark-theme .btn-icon {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .btn-icon:hover {
    background: #fff;
    border-color: #fff;
}

body.dark-theme .btn-icon:hover img {
    filter: brightness(0) invert(0);
}

body.dark-theme .flash {
    background: #1e1e1e;
    color: #fff;
    border-color: var(--color-gray);
}

body.dark-theme .sidebar {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .filter-form .btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

body.dark-theme .filter-option input[type="checkbox"],
body.dark-theme .filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex-shrink: 0;
    border-color: var(--color-gray);
    accent-color: #fff;
}

body.dark-theme .card {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .card:hover {
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.14), 0 0 24px rgba(0, 0, 0, 0.08), 0 0 36px rgba(0, 0, 0, 0.05);
}

body.dark-theme .card-name-link {
    color: #fff;
}

body.dark-theme .card-category {
    color: #888888;
}


body.dark-theme .empty {
    color: #888888;
}

body.dark-theme .error-page p {
    color: #888888;
}

body.dark-theme .site-detail-banner {
    background: #1a1a1a;
}

body.dark-theme .site-detail-head {
    border-bottom-color: var(--color-gray);
}

body.dark-theme .site-detail-recommendations-title {
    color: #fff;
}

body.dark-theme .site-detail-tab {
    color: inherit;
}

body.dark-theme .rec-card {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .rec-card-name-link {
    color: #fff;
}

body.dark-theme .rec-card-category {
    color: #888888;
}

body.dark-theme .site-detail-logo {
    border-color: var(--color-gray);
}

body.dark-theme .site-detail-type,
body.dark-theme .site-detail-aggregator {
    color: #888888;
}

body.dark-theme .review-form textarea {
    background: #1e1e1e;
    color: #fff;
    border-color: var(--color-gray);
}

body.dark-theme .review-form textarea:focus {
    border-color: #fff;
}

body.dark-theme .review-char-count {
    color: #999999;
}

body.dark-theme .review-item {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .review-item-user {
    border-color: #fff;
    border-width: 2px;
}

body.dark-theme .star-rating label {
    color: transparent;
    -webkit-text-stroke: 1px #fff;
}

body.dark-theme .star-rating label:hover,
body.dark-theme .star-rating label:hover ~ label,
body.dark-theme .star-rating input[type="radio"]:checked ~ label {
    color: #fff;
    -webkit-text-stroke: 1px #fff;
}

body.dark-theme .review-rating .star-empty,
body.dark-theme .card-rating .star-empty,
body.dark-theme .site-detail-rating .star-empty,
body.dark-theme .rec-card-rating .star-empty {
    color: transparent;
    -webkit-text-stroke: 1px #fff;
}

body.dark-theme .review-rating .star-filled,
body.dark-theme .card-rating .star-filled,
body.dark-theme .site-detail-rating .star-filled,
body.dark-theme .rec-card-rating .star-filled {
    color: #fff;
    -webkit-text-stroke: 1px #fff;
}

body.dark-theme .hint {
    color: #888888;
}

body.dark-theme .auth-form input,
body.dark-theme .auth-form input[type="password"],
body.dark-theme .admin-form input,
body.dark-theme .admin-form input[type="password"],
body.dark-theme .admin-form select,
body.dark-theme .admin-form textarea {
    background: #1e1e1e;
    color: #fff;
    border-color: var(--color-gray);
}

body.dark-theme .admin-form-page p a {
    color: #fff;
}

body.dark-theme .admin-form-page p a:hover {
    color: #fff;
}

body.dark-theme .manage-sites-list li {
    border-bottom-color: var(--color-gray);
}

body.dark-theme .auth-form input:focus,
body.dark-theme .admin-form input:focus,
body.dark-theme .admin-form select:focus,
body.dark-theme .admin-form textarea:focus {
    border-color: #fff;
}

body.dark-theme .link-row input,
body.dark-theme .type-row input {
    border-color: var(--color-gray);
    background: #1e1e1e;
    color: #fff;
}

body.dark-theme .type-row input:focus {
    border-color: #fff;
}

body.dark-theme .link-row input:focus {
    border-color: #fff;
}

body.dark-theme .btn-add-link,
body.dark-theme .btn-remove-link,
body.dark-theme .btn-remove-type {
    background: #1e1e1e;
    color: #fff;
    border-color: var(--color-gray);
}

body.dark-theme .btn-add-link:hover,
body.dark-theme .btn-remove-link:hover,
body.dark-theme .btn-remove-type:hover {
    border-color: #fff;
    background: var(--color-gray);
}

body.dark-theme .btn-remove-link.btn-danger {
    background: #1e1e1e;
    color: #f66;
    border-color: #d00;
}

body.dark-theme .btn-remove-link.btn-danger:hover {
    background: #d00;
    color: #fff;
    border-color: #a00;
}

body.dark-theme .admin-item {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .admin-item-logo {
    border-color: var(--color-gray);
}

.admin-announcements-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}
.admin-announcement-block {
    width: 100%;
    max-width: 560px;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.admin-announcement-block-content {
    font-size: 0.95rem;
    line-height: 1.4;
    color: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}
.admin-announcement-block-actions {
    display: flex;
    gap: 0.5rem;
}
.admin-announcement-block-add {
    align-items: center;
    justify-content: center;
    min-height: 80px;
}
.admin-announcement-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-size: 28px;
    line-height: 1;
    color: #666;
    border: 2px dashed var(--color-gray);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}
.admin-announcement-plus:hover {
    border-color: #000;
    color: #000;
}
body.dark-theme .admin-announcement-block {
    background: #1e1e1e;
    border-color: var(--color-gray);
}
body.dark-theme .admin-announcement-plus {
    color: #aaa;
    border-color: var(--color-gray);
}
body.dark-theme .admin-announcement-plus:hover {
    border-color: #fff;
    color: #fff;
}

body.dark-theme .admin-banner-item {
    background: #1e1e1e;
    border-color: var(--color-gray);
}

body.dark-theme .admin-banner-preview {
    border-color: var(--color-gray);
}

body.dark-theme .admin-banner-link {
    color: #888888;
}
