.comments-section {
    min-width: 0;
    max-width: 920px;
    margin: 44px auto 40px auto;
    padding: 28px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.24);
}

body.light-mode .comments-section {
    background: rgba(255,255,255,0.94);
    color: #0a0a1a;
    border-color: rgba(0,0,0,0.12);
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.comments-header > div {
    min-width: 0;
}

.comments-header h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffa502, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.comments-header p {
    line-height: 1.5;
    color: rgba(255,255,255,0.82);
}

body.light-mode .comments-header p {
    color: #3d3d4d;
}

.comments-status {
    flex: 0 0 auto;
    max-width: 260px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,165,2,0.16);
    color: #ffd18a;
    font-size: 0.86rem;
    font-weight: 800;
    text-align: center;
}

body.light-mode .comments-status {
    color: #7a3d00;
    background: rgba(255,165,2,0.18);
}

.comments-form {
    display: grid;
    min-width: 0;
    gap: 10px;
    margin-bottom: 20px;
}

.comments-form label,
.comment-edit-label {
    font-weight: 800;
}

.comments-form textarea,
.comment-edit-input {
    width: 100%;
    min-height: 112px;
    resize: vertical;
    padding: 14px 16px;
    border: 2px solid rgba(255,255,255,0.18);
    border-radius: 18px;
    background: rgba(10,10,26,0.64);
    color: white;
    font: inherit;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

body.light-mode .comments-form textarea,
body.light-mode .comment-edit-input {
    background: #ffffff;
    color: #0a0a1a;
    border-color: #dfe3ee;
}

.comments-form textarea:focus,
.comment-edit-input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 4px rgba(255,107,107,0.18);
}

.comments-form textarea:disabled,
.comment-edit-input:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.comments-form-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    min-height: 24px;
}

.comments-error {
    color: #ffb4bc;
    font-size: 0.9rem;
    font-weight: 800;
}

body.light-mode .comments-error {
    color: #a7222f;
}

.comment-counter {
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: 800;
    color: #ffa502;
}

#comment-submit,
.comments-load-more,
.comment-action,
.comment-menu-toggle,
.comment-confirm-action {
    border: 0;
    border-radius: 999px;
    padding: 10px 18px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

#comment-submit,
.comments-load-more,
.comment-confirm-action[data-action="confirm-delete"],
.comment-action[data-action="save-edit"] {
    justify-self: start;
    background: linear-gradient(135deg, #ff4757, #ffa502);
    color: white;
    box-shadow: 0 8px 18px rgba(255,71,87,0.28);
}

.comment-action,
.comment-menu-toggle,
.comment-confirm-action {
    background: rgba(255,255,255,0.12);
    color: inherit;
    border: 1px solid rgba(255,255,255,0.16);
}

body.light-mode .comment-action,
body.light-mode .comment-menu-toggle,
body.light-mode .comment-confirm-action {
    background: #f1f2f6;
    border-color: #dde0ea;
}

#comment-submit:hover,
.comments-load-more:hover,
.comment-action:hover,
.comment-menu-toggle:hover,
.comment-confirm-action:hover {
    transform: translateY(-2px);
}

#comment-submit:disabled,
.comments-load-more:disabled,
.comment-action:disabled,
.comment-menu-toggle:disabled,
.comment-confirm-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.comments-feed-status {
    min-height: 26px;
    margin: 12px 0 16px 0;
    color: rgba(255,255,255,0.76);
    font-weight: 700;
}

body.light-mode .comments-feed-status {
    color: #4c4d5f;
}

.comments-list {
    display: grid;
    min-width: 0;
    gap: 14px;
}

.comment-item {
    min-width: 0;
    padding: 16px;
    border-radius: 18px;
    background: rgba(10,10,26,0.52);
    border: 1px solid rgba(255,255,255,0.12);
}

body.light-mode .comment-item {
    background: #ffffff;
    border-color: rgba(0,0,0,0.09);
}

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

.comment-author-line {
    min-width: 0;
}

.comment-author {
    display: block;
    max-width: 34ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 900;
    color: #ffa502;
}

.comment-date {
    display: inline-block;
    margin-top: 3px;
    color: rgba(255,255,255,0.62);
    font-size: 0.82rem;
}

body.light-mode .comment-date {
    color: #5b5d70;
}

.comment-edited {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(112,161,255,0.16);
    color: #b8d0ff;
    font-size: 0.75rem;
    font-weight: 800;
}

body.light-mode .comment-edited {
    color: #244a91;
}

.comment-content {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.55;
}

.comment-actions,
.comment-edit-actions,
.comment-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.comment-actions {
    position: relative;
    justify-content: flex-end;
}

.comment-menu-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 999px;
    font-size: 1.35rem;
    line-height: 1;
}

.comment-actions-menu {
    position: static;
    z-index: 4;
    display: grid;
    min-width: 150px;
    width: 100%;
    gap: 6px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 8px;
    background: #17172b;
    box-shadow: 0 14px 32px rgba(0,0,0,0.32);
}

body.light-mode .comment-actions-menu {
    background: #ffffff;
    border-color: #dde0ea;
}

.comment-actions-menu .comment-action {
    width: 100%;
    justify-content: flex-start;
    border-radius: 8px;
    text-align: left;
}

.comment-actions-menu .comment-action[data-action="delete"],
.comment-confirm-action[data-action="confirm-delete"] {
    background: #b4232f;
    color: #fff;
    box-shadow: none;
}

.comment-edit {
    display: grid;
    gap: 10px;
}

.comment-edit-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.comment-confirm {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255,71,87,0.12);
    border: 1px solid rgba(255,71,87,0.24);
}

.comment-confirm p {
    margin-bottom: 10px;
    font-weight: 800;
}

.comments-load-more {
    margin-top: 18px;
}

.comments-toast-region {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 2200;
    display: grid;
    gap: 10px;
    width: min(340px, calc(100vw - 36px));
}

.comments-toast {
    padding: 12px 16px;
    border-radius: 16px;
    background: #1e1e2f;
    color: white;
    border-left: 5px solid #ff6b6b;
    box-shadow: 0 12px 28px rgba(0,0,0,0.28);
    font-weight: 800;
}

.comments-toast[data-type="success"] {
    border-left-color: #2ed573;
}

body.light-mode .comments-toast {
    background: #ffffff;
    color: #0a0a1a;
}

@media (max-width: 900px) {
    .comments-header {
        display: grid;
    }

    .comments-status {
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .comments-section {
        padding: 22px 16px;
        margin-top: 28px;
    }

    .comment-header {
        display: grid;
    }

    .comment-actions {
        width: 100%;
        justify-content: flex-start;
    }

    #comment-submit,
    .comments-load-more,
    .comment-action,
    .comment-confirm-action {
        width: 100%;
    }

    .comments-form-meta,
    .comment-edit-meta {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    #comment-submit,
    .comments-load-more,
    .comment-action,
    .comment-confirm-action {
        transition: none;
    }
}
