 /* ================= ОСНОВА ================= */
html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, sans-serif;
    background-color: #ffffee;
    color: #800000;
    margin: 0 auto;
    padding: 25px 10px 10px;
    max-width: 800px;
    line-height: 1.4;
}

/* ================= HEADER ================= */
header {
    margin-top: 30px;
    background-color: #F0E0D6;
    padding: 10px 15px;
    text-align: center;
}

header h2 {
    margin: 5px 0;
    font-size: 1.2em;
    color: #117743;
}

header a {
    color: #800000;
    text-decoration: none;
    font-weight: bold;
}

header a:hover {
    text-decoration: underline;
}

/* ================= ПОСТЫ ================= */
.post-container {
    display: flex;
    margin-bottom: 20px;
    border: 1px solid #D9BFB7;
    border-radius: 5px;
    padding: 10px;
    background: #f0e0d6;
}

.post-avatar-container {
    flex-shrink: 0;
    margin-right: 15px;
    width: 128px;
}

.post-avatar {
    width: 128px;
    height: 128px;
    object-fit: cover;
   
    display: block;
}

.post-content {
    flex-grow: 1;
    min-width: 0;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.post-num {
    font-weight: bold;
    color: #333;
    font-size: 9pt;
}

.post-date {
    color: #666;
    font-size: 9pt;
}

.post-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.vote-buttons, .fun-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.post-text {
    margin-top: 10px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* ================= ТЕКСТ И ФОРМАТИРОВАНИЕ ================= */
.quote {
    color: green;
}

.post b { font-weight: bold; }
.post i { font-style: italic; }
.post u { text-decoration: underline; }
.post s { text-decoration: line-through; }

.spoiler {
    background: #444;
    color: transparent;
    border-radius: 4px;
    padding: 0 6px;
    cursor: pointer;
    transition: color .2s ease;
}

.spoiler:hover {
    color: #fff;
}

.post-link {
    color: green;
    text-decoration: none;
    font-weight: bold;
}

.post-link:hover {
    text-decoration: underline;
}

.post a {
    color: #117743;
}

.post a:hover {
    text-decoration: underline;
}

/* ================= ФОРМА ================= */
.form {
    background-color: #f0e0d6;
    border: 2px solid #800000;
    padding: 20px;
    margin: 25px 0;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

.form textarea {
    width: 100%;
    height: 150px;
    padding: 8px;
    font-family: Arial, sans-serif;
    font-size: 10pt;
    border: 2px solid #a0a0a0;
    resize: vertical;
    box-sizing: border-box;
}

.form textarea:focus {
    border-color: #800000;
    outline: none;
    box-shadow: 0 0 5px rgba(128,0,0,0.3);
}

/* ================= КАПЧА ================= */
.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}
     .captcha-wrapper {
            display: flex;
            align-items: center;
            gap: 10px;
        }
.captcha-image {
            height: 40px;
            width: auto;
}

.captcha-left {
    display: flex;
    align-items: center;
    gap: 5px; /* Расстояние между картинкой и кнопкой обновления */
}

.captcha-center input {
    width: 120px;
    height: 32px;
    text-align: center;
    font-size: 16px;
    border: 1px solid #aaa;
    border-radius: 3px;
    margin-left: 0; /* Убираем левый отступ */
    padding: 0 5px;
}

.captcha-right {
    margin-left: auto; /* Прижимает кнопку отправки вправо */
}

.captcha-right button {
    height: 32px;
    padding: 0 12px;
    border: 1px solid #aaa;
    background: #eee;
    cursor: pointer;
    border-radius: 3px;
}

.captcha-right button:hover {
    background: #ddd;
}
body.dark-theme .captcha-wrapper {
    background: #2a2a2a;
}
body.dark-theme .captcha-input {
    background-color: #1e1e1e;
    color: #eeeeee;
    border-color: #555;
}
body.dark-theme .captcha-center input,
body.dark-theme .captcha-right button {
    background: #1e1e1e;
    color: #eee;
    border: 1px solid #555;
}

body.dark-theme .captcha-right button:hover {
    background: #333;
}
/* ================= КНОПКИ (ОБЩИЕ) ================= */
button, 
.vote-btn, 
.fun-btn, 
.reply-btn,
.hide-post-btn,
.show-post-btn {
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

button {
    background: linear-gradient(to bottom, #f5f5f5, #e0e0e0);
    border: 1px solid #888;
    font-weight: bold;
    padding: 6px 15px;
}

button:hover {
    background: linear-gradient(to bottom, #e8e8e8, #d0d0d0);
    border-color: #666;
}

.vote-btn, .fun-btn {
    padding: 2px 8px;
    background: none;
    border: none;
    white-space: nowrap;
}

.reply-btn {
    background: none;
    border: none;
    color: grey;
    padding: 2px 6px;
    margin: 0;
    text-decoration: none;
}

.reply-btn:hover {
    text-decoration: underline;
}

.hide-post-btn, .show-post-btn {
    border: none;
    padding: 3px 8px;
    color: white;
    margin-left: 8px;
}

.hide-post-btn {
    background: #ff6b6b;
}

.show-post-btn {
    background: #4CAF50;
}

/* ================= СОСТОЯНИЯ КНОПОК ================= */
/* Light theme - hover */
.vote-btn:hover,
.fun-btn:hover {
    background: #e8e8e8;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Active states */
.vote-btn.liked {
    background: #c6ffc6;
    color: #2e7d32;
}

.vote-btn.disliked {
    background: #ffc6c6;
    color: #c62828;
}

.fun-btn.active {
    background: #e0f7fa;
    color: #00796b;
}

.vote-count {
    margin-left: 3px;
    font-weight: bold;
}

/* ================= THEME BAR ================= */
#theme-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100% - 10px);
    margin-left: 5px;
    height: 25px;
    background-color: #F0E0D6;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    padding: 0 5px;
    font-size: 12px;
    box-sizing: border-box;
    z-index: 1000;
    border-radius: 0 0 5px 5px;
}

#theme-bar .bar-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
    color: #333;
}

#theme-bar button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    color: #333;
}

/* ================= ПРЕВЬЮ ================= */
.post-preview {
    background-color: #eeeeee;
    border: 1px solid #D9BFB7;
    padding: 10px;
    position: absolute;
    z-index: 100;
    max-width: 400px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    display: none;
}

 .post-replies {
    display: inline-block;
    margin-left: 15px;
    position: relative;
}

.replies-count {
    font-size: 13px;
    color: #0066cc;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 3px;
    transition: background 0.2s;
}

.replies-count:hover {
    background: rgba(0, 102, 204, 0.1);
}

.replies-preview {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 300px;
    max-width: 450px;
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: none;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    font-size: 13px;
    line-height: 1.4;
    margin-top: 5px;
}

body.dark-theme .replies-preview {
    background: #2d2d2d;
    border-color:  #E5E4E2;
    color: #e0e0e0;
}

.dark-theme .replies-preview div {
    border-bottom-color: #444 !important;
}

.dark-theme .replies-count {
    color: #ccffcc;
}

.gray-theme .replies-preview {
    background: #e6e6e6;
    border-color: #999;
}

.gray-theme .replies-count {
    color: #808080;
    font-size: 14px;
    font-weight: bold; /* или font-weight: 700; */
}


/* ================= СКРЫТЫЕ ПОСТЫ ================= */
/* Для залогиненных пользователей */

.submit-right {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.hidden-post {
    opacity: 0.6;
    background: #f9f9f9;
    border: 1px dashed #ccc;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

/* ================= ФОРМЫ ================= */
form {
    margin: 0;
    padding: 0;
}

#submitButton {
    margin-left: auto;
}

/* ================= ТЁМНАЯ ТЕМА ================= */
body.dark-theme {
    background-color: #1e1e1e;
    color: #eeeeee;
}

body.dark-theme header,
body.dark-theme .post-container,
body.dark-theme .form,
body.dark-theme #theme-bar {
    background-color: #2a2a2a;
}

body.dark-theme .form {
    border: 1px solid #333;
}

body.dark-theme textarea {
    background-color: #1e1e1e;
    color: #eeeeee;
    border-color: #444;
}

body.dark-theme .form textarea:focus {
    border-color: #666;
}

body.dark-theme #theme-bar button,
body.dark-theme #theme-bar .bar-btn {
    color: #eee;
}

body.dark-theme header a,
body.dark-theme .post-link {
    color: #a0b3c5;
}

body.dark-theme header a:hover,
body.dark-theme .post-link:hover {
    color: #85a5e0;
}

body.dark-theme button:not(.vote-btn):not(.fun-btn):not(.reply-btn) {
    background: #555;
    color: #eee;
    border-color: #777;
}

body.dark-theme .post-container {
    border-color: #444;
    color: #e0e0e0;
}

body.dark-theme .post-num {
    color: #e0e0e0;
}

body.dark-theme .post-date {
    color: #aaa;
}

body.dark-theme .vote-btn,
body.dark-theme .fun-btn,
body.dark-theme .reply-btn {
    color: #c0c0c0;
}

body.dark-theme .vote-btn:hover,
body.dark-theme .reply-btn:hover,
body.dark-theme .fun-btn:hover {
    background: #3a3a3a;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-theme .vote-btn.liked {
    background: #1b5e20;
    color: #a5d6a7;
}

body.dark-theme .vote-btn.disliked {
    background: #b71c1c;
    color: #ef9a9a;
}

body.dark-theme .fun-btn.active {
    background: #004d40;
    color: #80cbc4;
}

body.dark-theme .post-preview {
    background-color: #252020;
    color: #f0e0d6;
    border: 1px solid #5a2a2a;
    box-shadow: 0 0 10px rgba(0,0,0,0.7);
}

body.dark-theme .hidden-post {
    background: #333;
}

/* ================= АДАПТИВ ================= */
@media (max-width: 600px) {
    body {
        padding: 5px;
    }
    
    .post-container,
    .form {
        padding: 10px;
    }
    
    #theme-bar {
        gap: 10px;
        padding: 0 10px;
    }
    
    #theme-bar .bar-btn {
        padding: 2px 4px;
        font-size: 11px;
    }
    
    .post-avatar-container {
        width: 80px;
    }
    
    .post-avatar {
        width: 80px;
        height: 80px;
    }
    
    .captcha-row {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    #captchaImage {
        height: 40px;
    }
    
    .captcha-input {
        width: 100px;
    }
    
    #submitButton {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .post-container {
        flex-direction: column;
    }
    
    .post-avatar-container {
        margin-right: 0;
        margin-bottom: 10px;
        align-self: center;
    }
    
    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .post-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .captcha-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    #captchaImage {
        height: 50px;
        align-self: center;
    }
    
    #refreshCaptcha {
        align-self: center;
        padding: 6px 12px;
    }
    
    .captcha-input {
        width: 100%;
        box-sizing: border-box;
    }
    
    #submitButton {
        width: 100%;
        padding: 10px;
    }
}

@media (max-width: 360px) {
    #captchaImage {
        height: 40px;
    }
    
    .vote-buttons,
    .fun-buttons {
        gap: 3px;
    }
}

/* ================= СЕРАЯ ТЕМА ================= */
body.gray-theme {
    background-color: #e6e6e6;
    color: #222;
}

body.gray-theme header,
body.gray-theme .post-container,
body.gray-theme .form,
body.gray-theme #theme-bar {
    background-color: #d6d6d6;
}

body.gray-theme .form {
    border: 2px solid #555;
}

body.gray-theme textarea {
    background-color: #f2f2f2;
    color: #222;
    border-color: #999;
}

body.gray-theme .form textarea:focus {
    border-color: #666;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

body.gray-theme #theme-bar button,
body.gray-theme #theme-bar .bar-btn {
    color: #222;
}

body.gray-theme header a,
body.gray-theme .post-link {
    color: #444;
}

body.gray-theme header a:hover,
body.gray-theme .post-link:hover {
    color: #000;
}

body.gray-theme button:not(.vote-btn):not(.fun-btn):not(.reply-btn) {
    background: linear-gradient(to bottom, #eeeeee, #cccccc);
    color: #222;
    border-color: #777;
}

body.gray-theme .post-container {
    border-color: #aaa;
    color: #222;
}

body.gray-theme .post-num {
    color: #222;
}

body.gray-theme .post-date {
    color: #555;
}

body.gray-theme .vote-btn,
body.gray-theme .fun-btn,
body.gray-theme .reply-btn {
    color: #222;
}

body.gray-theme .vote-btn:hover,
body.gray-theme .fun-btn:hover {
    background: #cfcfcf;
    color: #000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

body.gray-theme .vote-btn.liked {
    background: #b6e3b6;
    color: #1b5e20;
}

body.gray-theme .vote-btn.disliked {
    background: #e3b6b6;
    color: #7f1d1d;
}

body.gray-theme .fun-btn.active {
    background: #cce7ea;
    color: #004d40;
}

body.gray-theme .post-preview {
    background-color: #dddddd;
    color: #222;
    border: 1px solid #aaa;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

body.gray-theme .hidden-post {
    background: #dcdcdc;
}

body.gray-theme .quote {
    color: #2e7d32;
}

body.gray-theme .spoiler {
    background: #777;
}

body.gray-theme .spoiler:hover {
    color: #fff;
}

body.gray-theme .hide-post-btn,
body.gray-theme .ban-btn,
body.gray-theme .show-post-btn {
    background: none;
    border: none;
    padding: 2px 6px;
}

body .hide-post-btn,
body .ban-btn,
body .show-post-btn {
    background: none;
    color:#000;
    border: none;
    padding: 2px 6px;
}

body.dark-theme .hide-post-btn,
body.dark-theme .ban-btn,
body.dark-theme .show-post-btn {
    background: none;
    border: none;
    padding: 2px 6px;
}