:root {
    --hl-primary: #e91e63;
    --hl-primary-light: #f06292;
    --hl-bg: #121212;
    --hl-text: #e5e5e5;
    --hl-text-light: #b3b3b3;
    --hl-border: #333333;
    --hl-bg-secondary: #1e1e1e;
    --hl-dark-bg: #1e1e1e;
    --hl-dark-text: #ffffff;
    --hl-dark-text-secondary: #b3b3b3;
    --hl-dark-border: #333333;
    --hl-dark-hover: rgba(233, 30, 99, 0.2);
}

/* Светлая тема */
[data-theme="light"] {
    --hl-bg: #fafafa;
    --hl-text: #1a1a1a;
    --hl-text-light: #666666;
    --hl-border: #e0e0e0;
    --hl-bg-secondary: #ffffff;
    --hl-dark-bg: #1e1e1e;
    --hl-dark-text: #ffffff;
    --hl-dark-text-secondary: #cccccc;
    --hl-dark-border: #333333;
    --hl-dark-hover: rgba(233, 30, 99, 0.1);
}

/* Общая обёртка — просто отступы, без пузырька */
.discussion-zone {
    max-width: none;
    margin: 40px auto 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--hl-text);
    background: transparent;
}

/* Большой пузырёк со списком комментариев (включая заголовок и пагинацию) */
.thread-container {
    background: var(--hl-bg-secondary);
    border: 1px solid var(--hl-border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: 40px;
}

[data-theme="light"] .thread-container {
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-color: #e0e0e0;
}

/* Заголовок внутри пузырька списка */
.thread-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--hl-border);
}

.discussion-count-title {
    font-size: 1.8rem;
    color: var(--hl-text);
    margin: 0;
    font-weight: 600;
}

.thread-chain {
    display: flex;
    flex-direction: column;
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
}

.comment-wrapper {
    width: 100%;
}

/* Комментарий */
.comment-item {
    display: flex;
    gap: 15px;
    background: var(--hl-bg-secondary);
    border: 1px solid var(--hl-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    color: var(--hl-text);
}

.comment-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Threading */
.comment-item.depth-2 {
    margin-left: 60px;
    border-left: 3px solid var(--hl-primary);
    padding-left: 20px;
    background: var(--hl-dark-bg);
}

[data-theme="light"] .comment-item.depth-2 {
    background: #f8faff;
}

.comment-item.depth-3,
.comment-item.depth-4,
.comment-item.depth-5 {
    margin-left: 120px;
    border-left: 3px solid var(--hl-primary);
    padding-left: 20px;
}

.children {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--hl-border);
}

.comment-avatar {
    flex-shrink: 0;
}

.comment-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--hl-border);
}

.comment-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 10px;
}

.comment-author-name {
    font-weight: 600;
    color: var(--hl-text);
    font-size: 1rem;
    line-height: 1.2;
}

.comment-content {
    color: var(--hl-text-light);
    line-height: 1.6;
    font-size: 1rem;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.comment-meta {
    font-size: 0.85rem;
    color: var(--hl-text-light);
}

.comment-date {
    background: var(--hl-bg-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid var(--hl-border);
}

/* Кастомная пагинация комментариев (ваш дизайн) */
.custom-pagination-wrapper {
    display: flex;
    justify-content: center;
    margin: 30px 0 10px;
    width: 100%;
}

.custom-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 0;
}

.custom-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.07);
    color: #d0d0d0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease,
        transform 0.2s ease,
        box-shadow 0.25s ease;
    user-select: none;
}

.custom-page-btn:hover:not(.disabled):not(.active) {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.custom-page-btn.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    font-weight: 600;
}

.custom-page-btn.disabled {
    opacity: 0.4;
    pointer-events: none !important;
    transform: none !important;
    box-shadow: none !important;
}

.custom-page-btn.prev,
.custom-page-btn.next {
    font-size: 32px;
    min-width: 56px;
    line-height: 1;
}

.custom-page-btn.prev .arrow,
.custom-page-btn.next .arrow {
    display: inline-block;
    line-height: 1;
}

.custom-page-btn.prev .arrow {
    transform: translate(-1px, -3px);
}

.custom-page-btn.next .arrow {
    transform: translate(1px, -3px);
}

/* Светлая тема для пагинации */
[data-theme="light"] .custom-page-btn {
    background: rgba(0, 0, 0, 0.05);
    color: #666666;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .custom-page-btn:hover:not(.disabled):not(.active) {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: #1a1a1a;
}

[data-theme="light"] .custom-page-btn.active {
    background: rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}

/* Форма комментария — отдельный пузырёк */
#respond {
    background: var(--hl-bg-secondary);
    border: 1px solid var(--hl-border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] #respond {
    background: #f9fafb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-color: #e0e0e0;
}

#reply-title {
    font-size: 1.6rem;
    color: var(--hl-text);
    margin: 0 0 25px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--hl-border);
}

#respond .comment-form {
    margin: 0;
    padding: 0;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comment-input-group {
    margin-bottom: 20px;
}

.comment-input-name label,
.comment-input-message label {
    display: block;
    font-weight: 600;
    color: var(--hl-text);
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.required-mark {
    color: #ef4444;
}

.comment-input-name input,
.comment-input-message textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--hl-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    background: var(--hl-bg-secondary);
    color: var(--hl-text);
}

.comment-input-name input:focus,
.comment-input-message textarea:focus {
    outline: none;
}

.comment-input-message textarea {
    resize: none;
    min-height: 120px;
}

.comment-submit-btn {
    background: var(--hl-bg-secondary);
    color: #ffffff;
    border: 1px solid var(--hl-border);
    border-radius: 12px;
    padding: 14px 28px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    max-width: 250px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.comment-submit-btn:hover {
    background: #232323;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.comment-submit-btn:active {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .comment-submit-btn {
    color: #1a1a1a;
    background: var(--hl-bg-secondary);
    border-color: #d0d0d0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.20);
}

[data-theme="light"] .comment-submit-btn:hover {
    background: #fafafa;
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.18);
}

.closed-thread-notice {
    text-align: center;
    padding: 30px;
    background: var(--hl-bg-secondary);
    border: 1px solid var(--hl-border);
    border-radius: 12px;
    color: var(--hl-text-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}


/* Базовый алерт */
.discussion-alert {
    position: fixed;
    top: 20px;
    left: 50%;                  /* добавлено */
    transform: translateX(-50%) translateY(-30px); /* центрирование + анимация входа */
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    font-weight: 600;
    font-size: 15px;
    min-width: 280px;
    max-width: 90%;
    text-align: center;         /* текст внутри уже по центру */
    color: white;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Появление */
.discussion-alert.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Исчезновение */
.discussion-alert.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px);
}

/* Цвета */
.discussion-success-alert {
    background: #10b981;
}

.discussion-error-alert {
    background: #ef4444;
}

/* Мобильная версия: по центру */
@media (max-width: 768px) {
    .discussion-alert {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(-30px);
        min-width: auto;
        width: calc(100% - 40px);
        max-width: 400px;
    }

    .discussion-alert.show {
        transform: translateX(-50%) translateY(0);
    }

    .discussion-alert.hide {
        transform: translateX(-50%) translateY(-30px);
    }
}

/* Скрытие ненужных WP-элементов */
#wp-comment-cookies-consent,
.wp-comment-cookies-consent,
.comment-form-cookies-consent,
.comment-notes,
.comment-reply-link,
.comment-reply-btn,
#cancel-comment-reply-link {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .discussion-zone {
        margin-top: 10px;
    }

    .thread-container,
    #respond,
    .closed-thread-notice {
        padding: 20px;
        border-radius: 10px;
    }

    .thread-container {
        margin-bottom: 30px;
    }

    .thread-chain {
        gap: 15px;
    }

    .comment-item {
        padding: 15px;
        gap: 12px;
        align-items: flex-start;
    }

    .comment-avatar img {
        width: 40px;
        height: 40px;
    }

    .comment-item.depth-2,
    .comment-item.depth-3,
    .comment-item.depth-4,
    .comment-item.depth-5 {
        margin-left: 0;
        padding-left: 20px;
        border-left: 2px solid var(--hl-primary);
    }

    .comment-content {
        margin-bottom: 12px;
        font-size: 1rem;
        line-height: 1.5;
    }

    .comment-submit-btn {
        width: 100%;
        max-width: none;
    }

    .discussion-count-title,
    #reply-title {
        font-size: 1.4rem;
    }

    .custom-pagination {
        flex-wrap: wrap;
        gap: 8px;
    }
}
.form-submit {
    text-align: center;
    margin: 0;
    padding: 0;
}

.comment-submit-btn {
    display: block;
    margin: 0 auto;
    align-self: unset; /* убираем старый align-self, он не работает из-за вложенности в <p> */
}