:root {
    /* Новая палитра на основе скриншота */
    --primary: #0066FF; /* Яркий синий из дизайна */
    --primary-hover: #0052CC;
    --bg-gradient: #F5F7FB; /* Очень мягкий светло-серый/голубоватый фон */
    --card-bg: #ffffff;
    --card-dark: #F8FAFC;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --header-bg: rgba(255, 255, 255, 0.85); /* Полупрозрачность для эффекта стекла */
    --header-text: #0F172A;
    --radius: 18px; /* Увеличенный радиус как на скрине */
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.03); /* Мягкие "парящие" тени */
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
    --accent-green: #0066FF; /* Заменили на синий для галочек */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background: var(--bg-gradient);
    color: var(--text-main); 
    line-height: 1.6; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--header-text); letter-spacing: -0.02em; }
a { text-decoration: none; color: var(--primary); transition: all 0.25s ease; }
a:hover { color: var(--primary-hover); }
ul { list-style: none; }

.icon { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -0.125em; fill: currentColor; }

/* Header */
.site-header { 
    background: var(--header-bg); 
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    backdrop-filter: blur(12px); /* Современный эффект размытия */
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-container { 
    max-width: 1200px; margin: 0 auto; padding: 14px 20px; 
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 15px; 
}
.logo { font-size: 1.4rem; font-weight: 800; color: var(--header-text); display: flex; align-items: center; gap: 8px; letter-spacing: -0.03em;}
.logo:hover { color: var(--primary); }

/* Search */
.search-wrapper { flex-grow: 1; max-width: 450px; position: relative; display: none; }
@media(min-width: 768px) { .search-wrapper { display: block; } }
.search-input { 
    width: 100%; padding: 12px 40px 12px 20px; 
    border-radius: 100px; /* Круглый инпут */
    border: 1px solid transparent; 
    background: #F1F5F9; outline: none; font-size: 0.95rem; color: var(--text-main); transition: all 0.3s ease;
}
.search-input:focus { 
    background: #ffffff; 
    border-color: var(--primary); 
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.15); 
}
.search-btn { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; transition: color 0.2s;}
.search-btn:hover { color: var(--primary); }
.search-results { 
    position: absolute; top: 100%; left: 0; right: 0; background: #ffffff; 
    border: 1px solid var(--border-color); border-radius: 16px; margin-top: 12px; 
    box-shadow: var(--shadow-md); max-height: 350px; overflow-y: auto; display: none; 
}
.search-results.active { display: block; }
.search-item { display: block; padding: 14px 20px; border-bottom: 1px solid var(--border-color); color: var(--text-main); transition: background 0.2s;}
.search-item:hover { background-color: #F8FAFC; }
.search-item-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; color: var(--text-main); }
.search-item-desc { font-size: 0.8rem; color: var(--text-muted); }

/* Nav Buttons */
.header-nav { display: flex; align-items: center; gap: 20px; }
.nav-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 6px; font-size: 0.95rem; transition: color 0.2s;}
.nav-btn:hover { color: var(--primary); }
.btn-primary { 
    background-color: var(--primary); color: #fff; padding: 10px 24px; 
    border-radius: 100px; /* Кнопка-таблетка как на скрине */
    font-weight: 600; border: none; cursor: pointer; 
    display: flex; align-items: center; gap: 8px; transition: all 0.2s ease; 
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}
.btn-primary:hover { background-color: var(--primary-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 102, 255, 0.3); }

/* Layout */
.layout-container { max-width: 1200px; margin: 30px auto 40px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 30px; flex-grow: 1; width: 100%; }
@media(min-width: 860px) { .layout-container { flex-direction: row; } }
.main-content { flex-grow: 1; width: 100%; }
@media(min-width: 860px) { .main-content { width: 72%; } }
.sidebar { width: 100%; display: flex; flex-direction: column; gap: 20px; }
@media(min-width: 860px) { .sidebar { width: 28%; } }

/* Sidebar Cards */
.card { background: var(--card-bg); border: none; border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm); transition: transform 0.3s ease; }
.card-dark { background: var(--card-dark); border: 1px solid var(--border-color); }
.widget-title { font-size: 1.15rem; border-bottom: none; padding-bottom: 0; margin-bottom: 20px; color: var(--header-text); font-weight: 700; }
.stat-list li { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-weight: 500; border: 1px solid var(--border-color); border-radius: 12px; margin-bottom: 8px; font-size: 0.95rem; transition: all 0.2s; }
.stat-list li:hover { border-color: var(--primary); background: #F5F9FF; }
.stat-list li:last-child { margin-bottom: 0; }
.stat-list li span:first-child { color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.stat-list li span:first-child::before { content: "✓"; color: var(--accent-green); font-weight: bold; font-size: 1.1rem; }
.stat-list li span:last-child { color: var(--primary); font-weight: 700; }
.random-links li { margin-bottom: 12px; font-weight: 500; font-size: 0.95rem; line-height: 1.4; padding-left: 12px; border-left: 2px solid var(--border-color); transition: border-color 0.2s;}
.random-links li:hover { border-left-color: var(--primary); }

/* Index Post List */
.page-title { font-size: 2rem; margin-bottom: 24px; color: var(--header-text); font-weight: 800; letter-spacing: -0.03em;}
.post-list { display: grid; grid-template-columns: 1fr; gap: 16px; }

.post-item { 
    background: var(--card-bg); border: 1px solid transparent; 
    border-radius: var(--radius); padding: 24px; 
    display: flex; flex-direction: column; transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
/* Стилизация под элементы списка из макета */
.post-item:hover { border-color: rgba(0, 102, 255, 0.3); background-color: #FAFCFF; transform: translateY(-2px); box-shadow: var(--shadow-md); }

.post-item-top { display: flex; gap: 16px; margin-bottom: 16px; align-items: center; }
.post-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; background: #E2E8F0; flex-shrink: 0; }
.post-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; line-height: 1.3; letter-spacing: -0.01em;}
.post-title a { color: var(--header-text); }
.post-title a:hover { color: var(--primary); }
.post-desc { font-size: 1rem; color: var(--text-muted); margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag { background-color: #EBF3FF; color: var(--primary); font-size: 0.8rem; font-weight: 600; padding: 6px 12px; border-radius: 100px; border: none; transition: background 0.2s; }
.tag:hover { background-color: #D6E6FF; }

.post-meta { display: flex; flex-wrap: wrap; gap: 20px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; align-items: center; padding-top: 16px; border-top: 1px solid #F1F5F9; }
.meta-item { display: flex; align-items: center; gap: 6px; }

/* Pagination - стилизована под виджет календаря из макета */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 40px; }
.page-link { padding: 10px 16px; border: none; background: #ffffff; color: var(--text-muted); border-radius: 14px; font-weight: 600; transition: all 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.page-link:hover { background: #F1F5F9; color: var(--text-main); transform: translateY(-1px); }
.page-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3); }

/* Single Post View */
.breadcrumb { font-size: 0.9rem; margin-bottom: 24px; color: var(--text-muted); font-weight: 500; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.post-main-title { font-size: 2.2rem; margin-bottom: 24px; word-break: break-word; color: var(--header-text); letter-spacing: -0.03em; }

/* Message Blocks - стилизация ближе к чат-бабблам */
.message-block { 
    background: var(--card-bg); border: none; 
    border-radius: var(--radius); margin-bottom: 20px; display: flex; flex-direction: column; 
    box-shadow: var(--shadow-sm); overflow: hidden;
}
@media(min-width: 640px) { .message-block { flex-direction: row; } }

.user-panel { 
    background: #ffffff; padding: 24px 20px; border-bottom: 1px solid var(--border-color); 
    display: flex; flex-direction: row; align-items: center; gap: 15px; 
}
@media(min-width: 640px) { 
    .user-panel { 
        width: 180px; border-bottom: none; border-right: 1px solid #F1F5F9; 
        flex-direction: column; text-align: center; flex-shrink: 0; 
        background: #FAFCFF; /* Легкий оттенок для сайдбара пользователя */
    } 
}
.user-panel img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 12px; }
.user-name-side { font-weight: 700; font-size: 1.05rem; color: var(--header-text); margin-bottom: 4px; word-wrap: break-word;}
.user-stats { font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; font-weight: 500; }

.message-content { padding: 24px; flex-grow: 1; display: flex; flex-direction: column; justify-content: flex-start; }
.message-header { display: flex; justify-content: space-between; margin-bottom: 20px; align-items: center; flex-wrap: wrap; gap: 10px; }
.message-date { font-size: 0.85rem; color: var(--text-muted); display:flex; align-items:center; gap: 6px; font-weight: 500;}
.message-header a { color: var(--text-muted); }
.message-header a:hover { color: var(--primary); }
.message-text { font-size: 1.05rem; line-height: 1.7; color: var(--text-main); word-wrap: break-word; }

.badge { background: #EBF3FF; color: var(--primary); font-size: 0.75rem; padding: 4px 10px; border-radius: 8px; font-weight: 700; margin-top: 6px; display: inline-block;}
.reply-badge { font-size: 0.8rem; background: #F8FAFC; border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 14px; border-radius: 100px; margin-bottom: 16px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }

.message-block.op-post { box-shadow: 0 0 0 2px var(--primary), var(--shadow-md); }

.comments-header { font-size: 1.5rem; font-weight: 800; margin: 48px 0 24px 0; color: var(--header-text); padding-bottom: 16px; letter-spacing: -0.02em;}
.comment { margin-bottom: 20px; scroll-margin-top: 100px; }

.cta-box { background: var(--primary); border: none; border-radius: var(--radius); padding: 40px 24px; text-align: center; margin-top: 48px; color: #ffffff; box-shadow: var(--shadow-md); }
.cta-title { font-size: 1.5rem; margin-bottom: 12px; color: #ffffff; font-weight: 800; letter-spacing: -0.02em;}
.cta-text { font-size: 1.05rem; color: rgba(255, 255, 255, 0.9); margin-bottom: 0; }

/* Footer */
.site-footer { background: #ffffff; border-top: 1px solid var(--border-color); color: var(--text-muted); padding: 48px 20px; margin-top: auto; font-size: 0.95rem;}
.footer-container { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 40px; }
@media(min-width: 768px) { .footer-container { grid-template-columns: repeat(3, 1fr); } }
.footer-title { color: var(--header-text); font-size: 1.15rem; margin-bottom: 20px; font-weight: 800; letter-spacing: -0.01em;}
.footer-text { line-height: 1.7; }