*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #999999;
    --border: #eaeaea;
    --border-light: #eeeeee;
    --accent: #ff3b80;
    --tag-bg: #f5f5f5;
    --hover-bg: #f5f5f5;
    --panel-bg: #fafafa;
    --max-width: 680px;
    --side-padding: 16px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0d0d;
        --text: #e8e8e8;
        --text-secondary: #aaaaaa;
        --text-muted: #666666;
        --border: #1f1f1f;
        --border-light: #1a1a1a;
        --tag-bg: #1a1a1a;
        --hover-bg: #1a1a1a;
        --panel-bg: #111111;
    }
}

html { overflow-x: hidden; }

body { font-size: 22px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* Шапка */
.main-header {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px var(--side-padding) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.burger-btn { margin-top: 0;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    font-size: 20px; background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 0; line-height: 1;
}
.logo { font-size: 20px; font-weight: 700; color: var(--text); text-decoration: none; line-height: 1; }
.login-btn { display: flex; align-items: center; color: var(--text-muted); padding: 0; }
.login-btn svg { width: 20px; height: 20px; }

/* Бургер-меню */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 99; }
.overlay.active { display: block; }
.side-menu {
    position: fixed; top: 0; left: -280px; width: 260px; height: 100vh;
    background: var(--bg); border-right: 1px solid var(--border); z-index: 100;
    transition: left 0.3s ease; padding: 24px 16px; display: flex; flex-direction: column; gap: 4px;
}
.side-menu.active { left: 0; }
.side-menu a, .side-menu button {
    display: flex; align-items: center; gap: 10px; text-align: left;
    padding: 10px 12px; font-size: 15px; color: var(--text-secondary);
    text-decoration: none; background: none; border: none; cursor: pointer;
    border-radius: 6px; font-family: inherit;
}
.side-menu a:hover, .side-menu button:hover { background: var(--hover-bg); color: var(--text); }
.side-menu .menu-close { align-self: flex-end; font-size: 18px; padding: 6px 10px; }
.side-menu svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Контент */
main { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--side-padding); }

/* Кнопка подписки */
.subscribe-bar { padding: 12px 0 8px; }
.subscribe-btn {
    display: block; width: 100%; padding: 8px; font-size: 13px; font-weight: 500;
    font-family: inherit; color: var(--text-secondary); background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.subscribe-btn:hover { border-color: var(--text-muted); color: var(--text); }
.subscribe-btn.subscribed { border-color: var(--border); color: var(--text-secondary); }

/* Лента */
#feed { }
.post-card {
    display: block; text-decoration: none; color: inherit;
    padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.post-card:first-of-type { border-top: none; }
.post-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.post-title { font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--text); flex: 1; }
.post-date { font-size: 14px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.post-excerpt {
    font-size: 15px; color: var(--text-secondary); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden;
}

/* Иконки действий */
.post-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.post-action {
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
    color: var(--text-muted); text-decoration: none; cursor: pointer;
    background: none; border: none; padding: 4px 0; font-family: inherit; white-space: nowrap;
}
.post-action svg { width: 15px; height: 15px; flex-shrink: 0; }
.post-action-count { font-size: 13px; }

/* Страница поста */
.post-image { width: 100%; height: auto; background: var(--border); margin: 20px 0; }
.post-body { font-size: 22px; font-size: 17px; color: var(--text-secondary); line-height: 1.7; }
.post-body p { margin-bottom: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tags a {
    font-size: 13px; color: var(--text-muted); text-decoration: none;
    background: var(--tag-bg); padding: 3px 10px; border-radius: 4px;
}

/* Комментарии */
.comments-title { font-size: 18px; font-weight: 700; margin: 32px 0 16px; padding-top: 24px; border-top: 1px solid var(--border); }
.comment { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-author { font-size: 14px; font-weight: 600; }
.comment-time { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.comment-text { font-size: 15px; color: var(--text-secondary); margin-top: 4px; }
.comment-form { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.comment-form-textarea {
    width: 100%; min-height: 44px; padding: 10px 14px;
    font-family: inherit; font-size: 15px; line-height: 1.5; color: var(--text);
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    resize: none; outline: none; overflow: hidden;
}
.comment-form-submit {
    width: 100%; padding: 12px; font-family: inherit; font-size: 14px; font-weight: 600;
    color: #fff; background: #1a1a1a; border: none; border-radius: 8px; cursor: pointer;
}
@media (prefers-color-scheme: dark) {
    .comment-form-submit { background: #e8e8e8; color: #0d0d0d; }
}
.comment-form-name-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; overflow: hidden; }
.comment-form-name-wrap.visible { grid-template-rows: 1fr; }
.comment-form-name-inner { min-height: 0; overflow: hidden; }
.comment-form-name {
    width: 100%; padding: 10px 14px; font-family: inherit; font-size: 14px;
    color: var(--text); background: var(--panel-bg); border: 1px solid var(--border);
    border-radius: 8px; outline: none;
}
.hidden { display: none !important; }

/* Навигация поста */
.post-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; border-top: 1px solid var(--border); background: var(--bg); z-index: 10;
    transform: translateY(100%); transition: transform 0.3s ease;
}
.post-nav.visible { transform: translateY(0); }
.post-nav-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px; font-size: 14px; font-family: inherit; color: var(--text-secondary);
    text-decoration: none; background: var(--bg); border: none; cursor: pointer;
}
.post-nav-btn:first-child { border-right: 1px solid var(--border); }
.post-nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Кнопка удаления комментария */
.comment-delete { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0 4px; }

/* Подвал */
footer { max-width: var(--max-width); margin: 0 auto; padding: 48px var(--side-padding) 32px; font-size: 14px; color: var(--text-muted); }

/* Формы */
form { margin-top: 24px; }
textarea, input[type="text"] {
    width: 100%; padding: 8px 12px; font-family: inherit; font-size: 14px;
    border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text);
}
button, .btn {
    padding: 8px 16px; font-family: inherit; font-size: 14px; font-weight: 600;
    border: none; border-radius: 4px; cursor: pointer; background: #1a1a1a; color: #fff; margin-top: 8px;
}

/* Мобильные */
@media (max-width: 680px) {
    .post-header { flex-direction: column; gap: 2px; }
    .post-title { font-size: 18px; }
    .post-excerpt { font-size: 14px; }
    .post-body { font-size: 22px; font-size: 16px; }
    article .post-header { flex-direction: column; gap: 2px; }
    article .post-header h1 { font-size: 24px; }
    footer { padding: 32px var(--side-padding) 24px; }
    .post-image, article img {
        width: calc(100% + 32px); margin-left: -16px; margin-right: -16px;
        max-width: calc(100% + 32px); height: auto; background: none;
    }
}

.menu-user { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px; }
.menu-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--hover-bg); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.menu-avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu-avatar svg { width: 20px; height: 20px; color: var(--text-muted); }
.menu-nick { font-size: 16px; font-weight: 600; color: var(--text); }

.main-header {
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
