/* ============================================
           CSS CUSTOM PROPERTIES — LIGHT / DARK THEME
           ============================================ */
        :root {
            /* Accent — фирменный синий DongFeng */
            --accent: #007AFF;
            --accent-hover: #0063D1;
            --accent-soft: rgba(0, 122, 255, 0.10);

            /* Radius — iOS style */
            --radius-sm: 10px;
            --radius-md: 16px;
            --radius-lg: 22px;
            --radius-xl: 28px;

            /* Typography — системный стек Apple */
            --font: -apple-system, BlinkMacSystemFont, "SF Pro Display",
                    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            --font-mono: "SF Mono", "Fira Code", monospace;

            /* Transitions */
            --ease: cubic-bezier(0.4, 0, 0.2, 1);
            --speed: 0.3s;
        }

        /* ---------- LIGHT THEME ---------- */
        [data-theme="light"] {
            --bg-primary: #F2F2F7;
            --bg-secondary: #FFFFFF;
            --bg-tertiary: #F9F9FB;
            --bg-elevated: #FFFFFF;

            --text-primary: #1C1C1E;
            --text-secondary: #6E6E73;
            --text-tertiary: #AEAEB2;

            --border: rgba(0, 0, 0, 0.08);
            --border-strong: rgba(0, 0, 0, 0.15);

            --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
            --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.06);
            --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);

            --glass-bg: rgba(255, 255, 255, 0.72);
            --glass-border: rgba(255, 255, 255, 0.5);

            --tag-bg: #F2F2F7;
            --tag-text: #6E6E73;

            --badge-bg: #FF3B30;
            --badge-text: #FFFFFF;

            --hero-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --hero-overlay: rgba(0, 0, 0, 0.35);

            --input-bg: #F2F2F7;
            --input-border: rgba(0, 0, 0, 0.1);

            --divider: rgba(0, 0, 0, 0.06);

            --scrollbar-thumb: rgba(0, 0, 0, 0.15);
            --scrollbar-track: transparent;
        }

        /* ---------- DARK THEME ---------- */
        [data-theme="dark"] {
            --bg-primary: #000000;
            --bg-secondary: #1C1C1E;
            --bg-tertiary: #2C2C2E;
            --bg-elevated: #2C2C2E;

            --text-primary: #F5F5F7;
            --text-secondary: #98989D;
            --text-tertiary: #636366;

            --border: rgba(255, 255, 255, 0.08);
            --border-strong: rgba(255, 255, 255, 0.15);

            --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
            --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.3);
            --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);

            --glass-bg: rgba(28, 28, 30, 0.72);
            --glass-border: rgba(255, 255, 255, 0.08);

            --tag-bg: #2C2C2E;
            --tag-text: #98989D;

            --badge-bg: #FF453A;
            --badge-text: #FFFFFF;

            --hero-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
            --hero-overlay: rgba(0, 0, 0, 0.4);

            --input-bg: #2C2C2E;
            --input-border: rgba(255, 255, 255, 0.1);

            --divider: rgba(255, 255, 255, 0.06);

            --scrollbar-thumb: rgba(255, 255, 255, 0.2);
            --scrollbar-track: transparent;
        }

        /* ============================================
           RESET & BASE
           ============================================ */
        *, *::before, *::after {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html {
            scroll-behavior: smooth;
            -webkit-text-size-adjust: 100%;
        }

        body {
            font-family: var(--font);
            background: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.55;
            font-size: 16px;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            transition: background var(--speed) var(--ease),
                        color var(--speed) var(--ease);
            min-height: 100vh;
        }

        /* Scrollbar */
        ::-webkit-scrollbar { width: 8px; }
        ::-webkit-scrollbar-track { background: var(--scrollbar-track); }
        ::-webkit-scrollbar-thumb {
            background: var(--scrollbar-thumb);
            border-radius: 4px;
        }

        a {
            color: var(--accent);
            text-decoration: none;
            transition: color var(--speed) var(--ease);
        }
        a:hover { color: var(--accent-hover); }

        img { max-width: 100%; display: block; }

        /* ============================================
           LAYOUT
           ============================================ */
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        .section {
            padding: 48px 0;
        }

        .section-title {
            font-size: 28px;
            font-weight: 700;
            letter-spacing: -0.5px;
            margin-bottom: 8px;
        }

        .section-subtitle {
            font-size: 16px;
            color: var(--text-secondary);
            margin-bottom: 32px;
        }

        /* ============================================
           HEADER — Glassmorphism
           ============================================ */
        .header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            background: var(--glass-bg);
            backdrop-filter: blur(24px) saturate(180%);
            -webkit-backdrop-filter: blur(24px) saturate(180%);
            border-bottom: 0.5px solid var(--border);
            transition: background var(--speed) var(--ease);
        }

        .header-inner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            height: 64px;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 20px;
            font-weight: 700;
            color: var(--text-primary);
            letter-spacing: -0.3px;
        }

        .logo-icon {
            width: 36px;
            height: 36px;
            background: var(--accent);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 800;
            font-size: 16px;
        }

        .logo span {
            color: var(--text-secondary);
            font-weight: 400;
            font-size: 14px;
            margin-left: -4px;
        }

        /* Navigation */
        .nav {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .nav-link {
            padding: 8px 16px;
            border-radius: var(--radius-sm);
            font-size: 15px;
            font-weight: 500;
            color: var(--text-secondary);
            transition: all var(--speed) var(--ease);
            position: relative;
        }

        .nav-link:hover {
            color: var(--text-primary);
            background: var(--accent-soft);
        }

        .nav-link.active {
            color: var(--accent);
            background: var(--accent-soft);
        }

        /* Header actions */
        .header-actions {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .btn-search {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: none;
            background: var(--input-bg);
            color: var(--text-secondary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all var(--speed) var(--ease);
            font-size: 18px;
        }

        .btn-search:hover {
            background: var(--accent-soft);
            color: var(--accent);
        }

        .btn-new-topic {
            padding: 10px 20px;
            border-radius: var(--radius-sm);
            border: none;
            background: var(--accent);
            color: white;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all var(--speed) var(--ease);
            font-family: var(--font);
        }

        .btn-new-topic:hover {
            background: var(--accent-hover);
            transform: scale(1.02);
        }

        .btn-new-topic:active {
            transform: scale(0.98);
        }

        /* Theme toggle */
        .theme-toggle {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: none;
            background: var(--input-bg);
            color: var(--text-secondary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            transition: all var(--speed) var(--ease);
        }

        .theme-toggle:hover {
            background: var(--accent-soft);
            color: var(--accent);
        }

        /* Mobile menu button */
        .menu-toggle {
            display: none;
            width: 40px;
            height: 40px;
            border-radius: var(--radius-sm);
            border: none;
            background: var(--input-bg);
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 20px;
            align-items: center;
            justify-content: center;
        }

        /* ============================================
           HERO SECTION
           ============================================ */
        .hero {
            margin-top: 64px;
            padding: 80px 0 64px;
            background: var(--hero-gradient);
            position: relative;
            overflow: hidden;
        }

        .hero::before {
            content: '';
            position: absolute;
            inset: 0;
            background: var(--hero-overlay);
        }

        .hero-content {
            position: relative;
            z-index: 1;
            text-align: center;
            color: white;
        }

        .hero h1 {
            font-size: 48px;
            font-weight: 800;
            letter-spacing: -1.5px;
            line-height: 1.1;
            margin-bottom: 16px;
        }

        .hero h1 em {
            font-style: normal;
            opacity: 0.8;
        }

        .hero p {
            font-size: 18px;
            opacity: 0.85;
            max-width: 560px;
            margin: 0 auto 32px;
            line-height: 1.6;
        }

        .hero-stats {
            display: flex;
            justify-content: center;
            gap: 48px;
            margin-top: 40px;
        }

        .hero-stat {
            text-align: center;
        }

        .hero-stat-value {
            font-size: 36px;
            font-weight: 800;
            letter-spacing: -1px;
        }

        .hero-stat-label {
            font-size: 14px;
            opacity: 0.7;
            margin-top: 4px;
        }

        /* ============================================
           CATEGORIES / MODELS
           ============================================ */
        .categories-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 16px;
        }

        .category-card {
            background: var(--bg-secondary);
            border-radius: var(--radius-md);
            padding: 24px 20px;
            border: 1px solid var(--border);
            transition: all var(--speed) var(--ease);
            cursor: pointer;
            text-align: center;
        }

        .category-card:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
            border-color: var(--accent);
        }

        .category-icon {
            width: 56px;
            height: 56px;
            border-radius: 16px;
            background: var(--accent-soft);
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 14px;
            font-size: 24px;
        }

        .category-card h3 {
            font-size: 16px;
            font-weight: 700;
            margin-bottom: 4px;
            letter-spacing: -0.2px;
        }

        .category-card p {
            font-size: 13px;
            color: var(--text-secondary);
        }

        .category-count {
            display: inline-block;
            margin-top: 10px;
            padding: 4px 10px;
            border-radius: 20px;
            background: var(--tag-bg);
            font-size: 12px;
            font-weight: 600;
            color: var(--tag-text);
        }

        /* ============================================
           BLOG POSTS (ex-forum topics)
           ============================================ */
        .posts-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
            gap: 20px;
        }

        .post-card {
            background: var(--bg-secondary);
            border-radius: var(--radius-lg);
            border: 1px solid var(--border);
            overflow: hidden;
            transition: all var(--speed) var(--ease);
        }

        .post-card:hover {
            box-shadow: var(--shadow-lg);
            transform: translateY(-3px);
        }

        .post-card-image {
            width: 100%;
            height: 200px;
            object-fit: cover;
            background: var(--bg-tertiary);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-tertiary);
            font-size: 48px;
            position: relative;
            overflow: hidden;
        }

        .post-card-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .post-card-badge {
            position: absolute;
            top: 14px;
            left: 14px;
            padding: 5px 12px;
            border-radius: 20px;
            background: var(--accent);
            color: white;
            font-size: 12px;
            font-weight: 700;
            backdrop-filter: blur(10px);
        }

        .post-card-body {
            padding: 20px;
        }

        .post-card-meta {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
        }

        .post-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--accent-soft);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: 700;
            color: var(--accent);
            flex-shrink: 0;
        }

        .post-author-info {
            flex: 1;
            min-width: 0;
        }

        .post-author {
            font-size: 14px;
            font-weight: 600;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .post-date {
            font-size: 12px;
            color: var(--text-tertiary);
        }

        .post-card h3 {
            font-size: 18px;
            font-weight: 700;
            letter-spacing: -0.3px;
            margin-bottom: 8px;
            line-height: 1.35;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .post-card h3 a {
            color: var(--text-primary);
        }

        .post-card h3 a:hover {
            color: var(--accent);
        }

        .post-excerpt {
            font-size: 14px;
            color: var(--text-secondary);
            line-height: 1.6;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
            margin-bottom: 16px;
        }

        .post-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 16px;
        }

        .post-tag {
            padding: 4px 10px;
            border-radius: 20px;
            background: var(--tag-bg);
            font-size: 12px;
            font-weight: 500;
            color: var(--tag-text);
            transition: all var(--speed) var(--ease);
        }

        .post-tag:hover {
            background: var(--accent-soft);
            color: var(--accent);
        }

        .post-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-top: 14px;
            border-top: 1px solid var(--divider);
        }

        .post-stats {
            display: flex;
            gap: 16px;
        }

        .post-stat {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 13px;
            color: var(--text-tertiary);
        }

        .post-stat svg {
            width: 16px;
            height: 16px;
            opacity: 0.6;
        }

        .post-read-more {
            font-size: 14px;
            font-weight: 600;
            color: var(--accent);
            display: flex;
            align-items: center;
            gap: 4px;
        }

        /* ============================================
           PINNED / IMPORTANT POSTS
           ============================================ */
        .pinned-section {
            margin-bottom: 40px;
        }

        .pinned-card {
            background: var(--bg-secondary);
            border-radius: var(--radius-lg);
            border: 1px solid var(--border);
            padding: 20px 24px;
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 12px;
            transition: all var(--speed) var(--ease);
        }

        .pinned-card:hover {
            box-shadow: var(--shadow-sm);
            border-color: var(--border-strong);
        }

        .pinned-icon {
            width: 44px;
            height: 44px;
            border-radius: 12px;
            background: #FF9500;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            flex-shrink: 0;
        }

        .pinned-info {
            flex: 1;
            min-width: 0;
        }

        .pinned-info h4 {
            font-size: 15px;
            font-weight: 600;
            margin-bottom: 2px;
        }

        .pinned-info h4 a {
            color: var(--text-primary);
        }

        .pinned-info h4 a:hover {
            color: var(--accent);
        }

        .pinned-info p {
            font-size: 13px;
            color: var(--text-secondary);
        }

        .pinned-badge {
            padding: 4px 10px;
            border-radius: 20px;
            background: #FF9500;
            color: white;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            flex-shrink: 0;
        }

        /* ============================================
           ONLINE USERS / ACTIVITY
           ============================================ */
        .activity-bar {
            background: var(--bg-secondary);
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
            padding: 20px 24px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 16px;
        }

        .activity-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .online-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: #34C759;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.6; transform: scale(1.2); }
        }

        .activity-text {
            font-size: 14px;
            color: var(--text-secondary);
        }

        .activity-text strong {
            color: var(--text-primary);
        }

        .activity-right {
            display: flex;
            gap: -8px;
        }

        .online-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: var(--accent-soft);
            border: 2px solid var(--bg-secondary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 600;
            color: var(--accent);
            margin-left: -8px;
        }

        .online-avatar:first-child { margin-left: 0; }

        .online-more {
            background: var(--bg-tertiary);
            color: var(--text-secondary);
            font-size: 11px;
        }

        /* ============================================
           SIDEBAR LAYOUT (для страницы блога)
           ============================================ */
        .content-layout {
            display: grid;
            grid-template-columns: 1fr 320px;
            gap: 32px;
        }

        .sidebar {
            display: flex;
            flex-direction: column;
            gap: 24px;
        }

        .sidebar-widget {
            background: var(--bg-secondary);
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
            padding: 20px;
        }

        .sidebar-widget h3 {
            font-size: 16px;
            font-weight: 700;
            margin-bottom: 16px;
            letter-spacing: -0.2px;
        }

        .popular-list {
            list-style: none;
        }

        .popular-list li {
            padding: 12px 0;
            border-bottom: 1px solid var(--divider);
            display: flex;
            align-items: flex-start;
            gap: 12px;
        }

        .popular-list li:last-child {
            border-bottom: none;
            padding-bottom: 0;
        }

        .popular-rank {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            background: var(--tag-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 13px;
            font-weight: 700;
            color: var(--text-tertiary);
            flex-shrink: 0;
        }

        .popular-rank.top { background: var(--accent-soft); color: var(--accent); }

        .popular-info h4 {
            font-size: 14px;
            font-weight: 600;
            line-height: 1.35;
            margin-bottom: 2px;
        }

        .popular-info h4 a { color: var(--text-primary); }
        .popular-info h4 a:hover { color: var(--accent); }

        .popular-info p {
            font-size: 12px;
            color: var(--text-tertiary);
        }

        /* Tags cloud */
        .tags-cloud {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .tag-item {
            padding: 6px 14px;
            border-radius: 20px;
            background: var(--tag-bg);
            font-size: 13px;
            font-weight: 500;
            color: var(--tag-text);
            transition: all var(--speed) var(--ease);
            cursor: pointer;
        }

        .tag-item:hover {
            background: var(--accent-soft);
            color: var(--accent);
        }

        /* ============================================
           FOOTER
           ============================================ */
        .footer {
            background: var(--bg-secondary);
            border-top: 1px solid var(--border);
            padding: 48px 0 32px;
            margin-top: 64px;
        }

        .footer-grid {
            display: grid;
            grid-template-columns: 2fr 1fr 1fr 1fr;
            gap: 40px;
            margin-bottom: 40px;
        }

        .footer-brand p {
            font-size: 14px;
            color: var(--text-secondary);
            margin-top: 12px;
            line-height: 1.6;
        }

        .footer-col h4 {
            font-size: 14px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-tertiary);
            margin-bottom: 16px;
        }

        .footer-col ul {
            list-style: none;
        }

        .footer-col li {
            margin-bottom: 10px;
        }

        .footer-col a {
            font-size: 15px;
            color: var(--text-secondary);
        }

        .footer-col a:hover {
            color: var(--accent);
        }

        .footer-bottom {
            padding-top: 24px;
            border-top: 1px solid var(--divider);
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 13px;
            color: var(--text-tertiary);
        }

        /* ============================================
           RESPONSIVE
           ============================================ */
        @media (max-width: 1024px) {
            .content-layout {
                grid-template-columns: 1fr;
            }
            .sidebar {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
            }
            .footer-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .nav { display: none; }
            .menu-toggle { display: flex; }
            .btn-new-topic span { display: none; }

            .hero h1 { font-size: 32px; }
            .hero p { font-size: 16px; }
            .hero-stats { gap: 24px; }
            .hero-stat-value { font-size: 28px; }

            .section { padding: 32px 0; }
            .section-title { font-size: 22px; }

            .posts-grid {
                grid-template-columns: 1fr;
            }

            .categories-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .sidebar {
                grid-template-columns: 1fr;
            }

            .footer-grid {
                grid-template-columns: 1fr;
                gap: 24px;
            }

            .footer-bottom {
                flex-direction: column;
                gap: 12px;
                text-align: center;
            }

            .activity-bar {
                flex-direction: column;
                align-items: flex-start;
            }

            .pinned-card {
                flex-direction: column;
                align-items: flex-start;
            }
        }

        @media (max-width: 480px) {
            .categories-grid {
                grid-template-columns: 1fr;
            }

            .hero-stats {
                flex-direction: column;
                gap: 16px;
            }
        }

        /* ============================================
           MOBILE NAV OVERLAY
           ============================================ */
        .mobile-nav {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 999;
            background: var(--glass-bg);
            backdrop-filter: blur(24px);
            -webkit-backdrop-filter: blur(24px);
            padding: 80px 24px 24px;
        }

        .mobile-nav.open {
            display: block;
        }

        .mobile-nav .nav-link {
            display: block;
            padding: 14px 0;
            font-size: 18px;
            border-bottom: 1px solid var(--divider);
        }

        .mobile-nav-close {
            position: absolute;
            top: 16px;
            right: 20px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: none;
            background: var(--input-bg);
            color: var(--text-secondary);
            font-size: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* ============================================
           UTILITY
           ============================================ */
        .text-center { text-align: center; }
        .mt-1 { margin-top: 8px; }
        .mt-2 { margin-top: 16px; }
        .mt-3 { margin-top: 24px; }
        .mt-4 { margin-top: 32px; }
        .mb-2 { margin-bottom: 16px; }
        .mb-3 { margin-bottom: 24px; }

        .divider {
            height: 1px;
            background: var(--divider);
            margin: 32px 0;
        }

        /* Animations on scroll */
        .fade-in {
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
        }

        .fade-in.visible {
            opacity: 1;
            transform: translateY(0);
        }


/* ============================================
   ADD COMMENT FORM — iOS Minimal Style
   Для файла: addcomments.tpl (DLE)
   ============================================ */

/* ---------- CONTAINER ---------- */
.addcomment {
    margin: 24px 0;
    background: var(--bg-card);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all var(--speed) var(--ease);
}

.addcomment:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

/* ---------- COLLAPSIBLE HEADER ---------- */
.plus_icon {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    transition: background var(--speed) var(--ease);
}

.plus_icon:hover {
    background: var(--accent-soft);
}

.plus_icon::before {
    content: "💬";
    font-size: 18px;
    transition: transform var(--speed) var(--ease);
}

.plus_icon.active::before {
    transform: rotate(45deg);
}

.plus_icon span {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
}

/* ---------- FORM CONTAINER ---------- */
.box_in {
    padding: 20px;
    display: none; /* JS toggles this */
    animation: slideDown 0.3s var(--ease) both;
}

.box_in.visible {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.box_in h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* ---------- FORM LIST ---------- */
.ui-form {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ui-form > li {
    margin-bottom: 16px;
}

.ui-form > li:last-child {
    margin-bottom: 0;
}

/* ---------- COMBO FIELDS (name + email) ---------- */
.form-group.combo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.combo_field {
    position: relative;
}

/* ---------- INPUTS ---------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    transition: all var(--speed) var(--ease);
    -webkit-appearance: none;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
    opacity: 1;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
    border-color: #FF3B30;
}

input:invalid:not(:placeholder-shown):focus {
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.15);
}

/* Textarea specifics */
textarea {
    min-height: 140px;
    resize: vertical;
    max-height: 400px;
}

/* ---------- LABELS ---------- */
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: -0.1px;
}

label[for] {
    cursor: pointer;
}

/* ---------- DLE EDITOR WRAPPER ---------- */
#comment-editor {
    /* Стили для контейнера редактора */
}

#comment-editor .dle-wysiwyg,
#comment-editor .bb-editor {
    border: 1px solid var(--border) !important;
    border-radius: var(--r-sm) var(--r-sm) 0 0 !important;
    background: var(--bg-input) !important;
}

#comment-editor .dle-wysiwyg textarea,
#comment-editor .bb-editor textarea {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    min-height: 180px !important;
}

/* Toolbar редактора */
#comment-editor .editor-toolbar,
#comment-editor .bb_bar {
    background: var(--bg-elevated) !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: var(--r-sm) var(--r-sm) 0 0 !important;
    padding: 6px 8px !important;
}

#comment-editor .editor-toolbar button,
#comment-editor .bb_bar button,
#comment-editor .editor-toolbar a,
#comment-editor .bb_bar a {
    border: 1px solid var(--border) !important;
    background: var(--bg-card) !important;
    color: var(--text-secondary) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    margin: 0 2px !important;
    font-size: 12px !important;
    transition: all var(--speed) var(--ease) !important;
}

#comment-editor .editor-toolbar button:hover,
#comment-editor .bb_bar button:hover,
#comment-editor .editor-toolbar a:hover,
#comment-editor .bb_bar a:hover {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    background: var(--accent-soft) !important;
}

/* ---------- IMAGE UPLOADER ---------- */
.comments-image-uploader-area {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.comments-image-uploader-area a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    padding: 6px 12px;
    border-radius: var(--r-sm);
    background: var(--accent-soft);
    transition: all var(--speed) var(--ease);
}

.comments-image-uploader-area a:hover {
    background: var(--accent);
    color: white;
    text-decoration: none;
}

#hidden-image-uploader {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}

#hidden-image-uploader input[type="file"] {
    width: 100%;
    padding: 8px 0;
}

/* ---------- SUBSCRIPTION CHECKBOX ---------- */
.ui-form li input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: var(--accent);
    cursor: pointer;
    vertical-align: middle;
}

.ui-form li label:has(input[type="checkbox"]),
.ui-form li input[type="checkbox"] + label {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0;
}

/* ---------- CAPTCHA / SECURITY CODE ---------- */
.c-captcha {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}

.c-captcha img {
    max-width: 100%;
    height: auto;
    border-radius: var(--r-sm);
    background: var(--bg-card);
    padding: 4px;
}

.c-captcha input {
    max-width: 200px;
}

/* Refresh captcha button */
.c-captcha a[href*="sec_code"],
.c-captcha .reload-captcha {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.c-captcha a[href*="sec_code"]:hover,
.c-captcha .reload-captcha:hover {
    color: var(--accent);
}

/* ---------- QUESTION FIELD ---------- */
.form-group.question {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}

.form-group.question label {
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.form-group.question input {
    max-width: 300px;
}

/* ---------- SUBMIT BUTTON ---------- */
.form_submit {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

.btn.btn-big {
    padding: 12px 28px;
    border-radius: var(--r-sm);
    border: none;
    background: var(--accent);
    color: white;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 160px;
    justify-content: center;
}

.btn.btn-big b {
    font-weight: inherit;
}

.btn.btn-big:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.btn.btn-big:active {
    transform: scale(0.98);
}

.btn.btn-big:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ---------- GUEST HINT ---------- */
[not-logged] + .guest-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: -8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--r-sm);
    border-left: 3px solid var(--accent);
}

/* ---------- ERROR / SUCCESS MESSAGES ---------- */
.addcomment .error,
.addcomment .info,
.addcomment .success {
    padding: 12px 16px;
    border-radius: var(--r-sm);
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 3px solid;
}

.addcomment .error {
    background: rgba(255, 59, 48, 0.1);
    border-color: #FF3B30;
    color: #FF3B30;
}

.addcomment .info {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.addcomment .success {
    background: rgba(52, 199, 89, 0.15);
    border-color: #34C759;
    color: #34C759;
}

/* ---------- RECAPTCHA / G-RECAPTCHA ---------- */
.addcomment .g-recaptcha,
.addcomment [data-recaptcha] {
    margin: 8px 0;
    display: flex;
    justify-content: center;
}

/* ============================================
   RESPONSIVE: МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================ */

@media (max-width: 768px) {
    .addcomment {
        margin: 16px -16px; /* на всю ширину экрана */
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .box_in {
        padding: 16px;
    }
    
    .form-group.combo {
        grid-template-columns: 1fr; /* столбцом на мобильных */
        gap: 10px;
    }
    
    .c-captcha {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .c-captcha input {
        max-width: 100%;
    }
    
    .form_submit {
        align-items: stretch;
    }
    
    .btn.btn-big {
        width: 100%;
        padding: 14px;
        font-size: 16px; /* чуть крупнее для тача */
    }
    
    /* Увеличиваем тач-таргеты */
    input, textarea, button, .plus_icon {
        min-height: 44px; /* Apple HIG minimum */
    }
    
    .plus_icon {
        padding: 18px 20px;
    }
}

@media (max-width: 480px) {
    .box_in h3 {
        font-size: 17px;
    }
    
    input, textarea {
        font-size: 16px; /* предотвращает зум на iOS при фокусе */
    }
    
    .comments-image-uploader-area a {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   DARK THEME: коррекции
   ============================================ */

[data-theme="dark"] .plus_icon:hover {
    background: rgba(0, 122, 255, 0.08);
}

[data-theme="dark"] .comments-image-uploader-area a {
    background: rgba(0, 122, 255, 0.15);
}

[data-theme="dark"] .comments-image-uploader-area a:hover {
    background: var(--accent);
}

[data-theme="dark"] #hidden-image-uploader {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .form-group.question {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .c-captcha {
    background: var(--bg-tertiary);
}

/* ============================================
   ACCESSIBILITY: focus-visible
   ============================================ */

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
.plus_icon:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   JS TOGGLE: классы для управления
   ============================================ */

/* Добавляйте эти классы через JS при открытии формы */
.addcomment.expanded .plus_icon {
    border-bottom-color: var(--accent);
}

.addcomment.expanded .plus_icon::before {
    content: "−";
    font-weight: 300;
    font-size: 20px;
}

.addcomment.expanded .box_in {
    display: block;
}

/* Анимация появления формы */
.addcomment.expanded .box_in {
    animation: slideDown 0.25s var(--ease) both;
}



.fullstory ul {margin-left: 1rem;}
.fullstory ol {margin-left: 1rem;}
.fullstory hr {display: none;}
.fullstory img {max-width: 100%; height: auto;}


/* ============================================
   TABLES IN .fullstory — iOS Minimal Style
   ============================================ */

/* Контейнер для горизонтального скролла на мобильных */
.fullstory .table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 20px 0;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    -webkit-overflow-scrolling: touch; /* плавный скролл на iOS */
}

/* Базовые стили таблицы */
.fullstory table {
    width: 100%;
    border-collapse: separate; /* важно для border-radius */
    border-spacing: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-card);
}

/* Заголовок таблицы */
.fullstory thead {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.fullstory thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.fullstory thead th:first-child {
    border-top-left-radius: var(--r-md);
}

.fullstory thead th:last-child {
    border-top-right-radius: var(--r-md);
}

/* Тело таблицы */
.fullstory tbody tr {
    border-bottom: 1px solid var(--divider);
    transition: background var(--speed) var(--ease);
}

.fullstory tbody tr:last-child {
    border-bottom: none;
}

.fullstory tbody tr:hover {
    background: var(--accent-soft);
}

.fullstory tbody td {
    padding: 12px 16px;
    vertical-align: top;
}

/* Первая и последняя ячейки строки — скругление */
.fullstory tbody tr:first-child td:first-child {
    border-top-left-radius: var(--r-md);
}
.fullstory tbody tr:first-child td:last-child {
    border-top-right-radius: var(--r-md);
}
.fullstory tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--r-md);
}
.fullstory tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--r-md);
}

/* Ссылки в таблицах */
.fullstory table a {
    color: var(--accent);
    text-decoration: none;
    word-break: break-word;
}
.fullstory table a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Код и pre в ячейках */
.fullstory table code,
.fullstory table pre {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-input);
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}
.fullstory table pre {
    padding: 10px 12px;
    overflow-x: auto;
    margin: 4px 0;
}

/* Статусы / бейджи в ячейках */
.fullstory table .badge,
.fullstory table .tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-tag);
    color: var(--text-secondary);
}
.fullstory table .badge.success {
    background: rgba(52, 199, 89, 0.15);
    color: #34C759;
}
.fullstory table .badge.warning {
    background: rgba(255, 149, 0, 0.15);
    color: #FF9500;
}
.fullstory table .badge.error {
    background: rgba(255, 59, 48, 0.15);
    color: #FF3B30;
}

/* Числовые данные — выравнивание вправо */
.fullstory table td.numeric,
.fullstory table th.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Изображения в ячейках */
.fullstory table img {
    max-width: 100%;
    height: auto;
    border-radius: var(--r-sm);
    display: block;
}

/* ============================================
   RESPONSIVE: МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================ */

/* Вариант 1: Горизонтальный скролл (универсальный) */
@media (max-width: 768px) {
    .fullstory .table-wrapper {
        margin: 16px -16px; /* на всю ширину экрана с учётом padding контейнера */
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .fullstory table {
        font-size: 14px; /* чуть мельче на мобильных */
    }
    
    .fullstory thead th,
    .fullstory tbody td {
        padding: 10px 14px;
    }
}

/* Вариант 2: Карточная вёрстка для очень узких экранов (опционально) */
/* Раскомментируйте, если хотите альтернативное отображение таблиц на <480px */
/*
@media (max-width: 480px) {
    .fullstory .table-wrapper {
        overflow: visible;
    }
    
    .fullstory table,
    .fullstory thead,
    .fullstory tbody,
    .fullstory th,
    .fullstory td,
    .fullstory tr {
        display: block;
    }
    
    .fullstory thead {
        position: absolute;
        left: -9999px;
        top: -9999px;
    }
    
    .fullstory tbody tr {
        margin-bottom: 16px;
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        background: var(--bg-card);
        padding: 12px;
    }
    
    .fullstory tbody td {
        padding: 8px 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
    }
    
    .fullstory tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 13px;
        min-width: 120px;
        flex-shrink: 0;
    }
    
    .fullstory tbody td:last-child {
        border-bottom: none;
    }
}
*/

/* ============================================
   DARK THEME: коррекции (если нужно)
   ============================================ */
[data-theme="dark"] .fullstory table {
    /* Дополнительные тени для глубины в тёмной теме */
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

[data-theme="dark"] .fullstory tbody tr:hover {
    background: rgba(0, 122, 255, 0.08); /* чуть прозрачнее в тёмной теме */
}

/* ============================================
   ДОПОЛНИТЕЛЬНЫЕ МОДИФИКАТОРЫ
   ============================================ */

/* Компактная таблица */
.fullstory table.table-compact thead th,
.fullstory table.table-compact tbody td {
    padding: 8px 12px;
    font-size: 14px;
}

/* Таблица с полосами (zebra) */
.fullstory table.table-striped tbody tr:nth-child(even) {
    background: var(--bg-tertiary);
}
.fullstory table.table-striped tbody tr:hover {
    background: var(--accent-soft) !important; /* приоритет ховеру */
}

/* Таблица без границ (минимализм) */
.fullstory table.table-borderless {
    border: none;
    background: transparent;
}
.fullstory table.table-borderless thead {
    background: transparent;
    border-bottom: 1px solid var(--border);
}
.fullstory table.table-borderless tbody tr {
    border-bottom: 1px solid var(--divider);
}
.fullstory table.table-borderless tbody tr:last-child {
    border-bottom: none;
}

/* ============================================
   ПРИМЕР ИСПОЛЬЗОВАНИЯ В КОНТЕНТЕ
   ============================================ */
/*
В редакторе DLE оборачивайте таблицы в .table-wrapper:

<div class="table-wrapper">
  <table class="table-striped">
    <thead>
      <tr>
        <th>Адаптер</th>
        <th>Протокол</th>
        <th>Цена</th>
        <th>Статус</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td data-label="Адаптер">Wizcar T01</td>
        <td data-label="Протокол">CarbitLink → CarPlay</td>
        <td data-label="Цена" class="numeric">~2 500 ₽</td>
        <td data-label="Статус"><span class="badge success">✓ Проверено</span></td>
      </tr>
    </tbody>
  </table>
</div>
*/

.fullstory, .fullstory *, .comment-body {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

/* 📱 МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 480px) {
    .comment-body {
        max-width: 82vw;
    }
}




/* ============================================
   CSS VARIABLES — LIGHT / DARK THEME
   ============================================ */
:root {
    /* Brand */
    --accent: #007AFF;
    --accent-hover: #0063D1;
    --accent-soft: rgba(0, 122, 255, 0.12);
    --accent-gradient: linear-gradient(135deg, #007AFF, #5AC8FA);

    /* iOS-style radius */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 24px;
    --r-full: 999px;

    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", monospace;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --speed: 0.25s;
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
    --bg: #F2F2F7;
    --bg-card: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-input: #F2F2F7;
    --bg-tag: #E5E5EA;

    --text: #1C1C1E;
    --text-secondary: #6E6E73;
    --text-tertiary: #AEAEB2;
    --text-inverse: #FFFFFF;

    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --divider: rgba(0, 0, 0, 0.06);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

    --glass: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);

    --badge-bg: #FF3B30;
    --badge-tg: #0088CC;
    --badge-site: var(--accent);

    --scrollbar: rgba(0, 0, 0, 0.12);
}

/* ========== DARK THEME ========== */
[data-theme="dark"] {
    --bg: #000000;
    --bg-card: #1C1C1E;
    --bg-elevated: #2C2C2E;
    --bg-input: #2C2C2E;
    --bg-tag: #3A3A3C;

    --text: #F5F5F7;
    --text-secondary: #98989D;
    --text-tertiary: #636366;
    --text-inverse: #1C1C1E;

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --divider: rgba(255, 255, 255, 0.06);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);

    --glass: rgba(28, 28, 30, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);

    --badge-bg: #FF453A;
    --badge-tg: #0088CC;
    --badge-site: var(--accent);

    --scrollbar: rgba(255, 255, 255, 0.18);
}


/* ============================================
   TOPIC HEADER
   ============================================ */
.topic-header {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    margin: 16px 0 20px;
    overflow: hidden;
}

.topic-meta-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.model-badge {
    padding: 4px 10px;
    border-radius: var(--r-full);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
}

.topic-stats {
    display: flex;
    gap: 16px;
    margin-left: auto;
}

.topic-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topic-title {
    padding: 20px 16px 12px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.topic-author-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 16px;
}

.author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.author-info {
    flex: 1;
    min-width: 0;
}

.author-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.author-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.topic-date {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-left: auto;
    flex-shrink: 0;
}

/* ============================================
   TOPIC CONTENT
   ============================================ */
.topic-content {
    padding: 0 16px 20px;
    font-size: 17px;
    line-height: 1.65;
    color: var(--text);
}

.topic-content p {
    margin-bottom: 16px;
}

.topic-content p:last-child {
    margin-bottom: 0;
}

.topic-content strong {
    font-weight: 600;
}

.topic-content em {
    font-style: italic;
    color: var(--text-secondary);
}

.topic-content ul, .topic-content ol {
    margin: 12px 0 12px 24px;
}

.topic-content li {
    margin-bottom: 6px;
}

.topic-content a {
    word-break: break-word;
}

.topic-content blockquote {
    margin: 16px 0;
    padding: 14px 16px;
    border-left: 3px solid var(--accent);
    background: var(--bg-input);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    font-size: 15px;
    color: var(--text-secondary);
}

.topic-content blockquote p {
    margin-bottom: 8px;
}

.topic-content blockquote p:last-child {
    margin-bottom: 0;
}

.topic-content code, .topic-content pre {
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 6px;
}

.topic-content pre {
    padding: 14px;
    overflow-x: auto;
    margin: 16px 0;
}

/* Video embed placeholder */
.video-embed {
    margin: 20px 0;
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--bg-input);
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    border: 1px dashed var(--border);
}

.video-embed svg {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Tags */
.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 20px;
}

.topic-tag {
    padding: 5px 12px;
    border-radius: var(--r-full);
    background: var(--bg-tag);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--speed) var(--ease);
}

.topic-tag:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Topic actions */
.topic-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 20px;
    border-top: 1px solid var(--divider);
    margin-top: 12px;
    padding-top: 16px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   COMMENTS SECTION
   ============================================ */
.comments-section {
    margin-top: 24px;
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.comments-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.comments-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Source filter tabs */
.source-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--r-sm);
    margin-bottom: 16px;
}

.source-tab {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    text-align: center;
}

.source-tab.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.source-tab[data-source="telegram"].active {
    color: var(--badge-tg);
}

/* Comment card */
.comment {
    background: var(--bg-card);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
    transition: all var(--speed) var(--ease);
    position: relative;
}

.comment:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.comment.from-telegram {
    border-left: 3px solid var(--badge-tg);
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.comment-author {
    flex: 1;
    min-width: 0;
}

.comment-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.source-badge {
    padding: 2px 8px;
    border-radius: var(--r-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.source-badge.telegram {
    background: var(--badge-tg);
    color: white;
}

.source-badge.site {
    background: var(--badge-site);
    color: white;
}

.comment-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: auto;
    flex-shrink: 0;
}

.comment-body {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 12px;
}

.comment-body p {
    margin-bottom: 10px;
}

.comment-body p:last-child {
    margin-bottom: 0;
}

.comment-body blockquote {
    margin: 10px 0;
    padding: 10px 14px;
    border-left: 2px solid var(--accent);
    background: var(--bg-input);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.comment-body a {
    word-break: break-word;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--divider);
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
}

.reaction-btn:hover, .reaction-btn.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.reply-btn {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
}

.reply-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* Nested replies */
.comment-replies {
    margin-top: 12px;
    margin-left: 20px;
    padding-left: 14px;
    border-left: 2px solid var(--divider);
}

/* Comment form */
.comment-form {
    background: var(--bg-card);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    padding: 16px;
    margin-top: 20px;
}

.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color var(--speed) var(--ease);
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.btn-primary {
    padding: 10px 24px;
    border-radius: var(--r-sm);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    font-family: var(--font);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Login prompt */
.login-prompt {
    text-align: center;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
}

.login-prompt a {
    font-weight: 600;
}

/* ============================================
   FOOTER
   ============================================ */
.topic-footer {
    margin-top: 32px;
    padding: 20px 16px;
    background: var(--bg-card);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.topic-footer a {
    font-weight: 500;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .topic-title {
        font-size: 20px;
        padding: 16px 16px 10px;
    }

    .topic-content {
        font-size: 16px;
        padding: 0 16px 16px;
    }

    .comment-replies {
        margin-left: 12px;
        padding-left: 10px;
    }

    .topic-stats {
        display: none; /* скрываем на очень маленьких экранах */
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s var(--ease) both;
}

.fade-in:nth-child(2) { animation-delay: 0.05s; }
.fade-in:nth-child(3) { animation-delay: 0.1s; }
.fade-in:nth-child(4) { animation-delay: 0.15s; }
.fade-in:nth-child(5) { animation-delay: 0.2s; }

/* ============================================
   UTILITIES
   ============================================ */
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.divider {
    height: 1px;
    background: var(--divider);
    margin: 20px 0;
}




.tags-cloud a,
.post-tags a {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--tag-bg);
    font-size: 13px;
    font-weight: 500;
    color: var(--tag-text);
    transition: all var(--speed) var(--ease);
    cursor: pointer;
}
.post-tags,
.topic-tags {color: transparent;}

.topic-tags a {
    padding: 5px 12px;
    border-radius: var(--r-full);
    background: var(--bg-tag);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--speed) var(--ease);
}


/* ============================================
   COMMENTS — iOS Minimal Style (DLE 19.1)
   ============================================ */

/* ---------- COMMENT CARD ---------- */
.comment {
    background: var(--bg-card);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
    transition: all var(--speed) var(--ease);
    position: relative;
}

.comment:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.comment.from-telegram {
    border-left: 3px solid #0088CC;
}

/* ---------- COMMENT HEADER ---------- */
.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

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

.comment-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    transition: border-color var(--speed) var(--ease);
}

.comment-avatar:hover img {
    border-color: var(--accent);
}

.avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid var(--border);
}

.comment-author-info {
    flex: 1;
    min-width: 0;
}

.comment-author-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.comment-author-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.source-badge {
    padding: 2px 8px;
    border-radius: var(--r-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.source-badge.site {
    background: var(--badge-site);
    color: white;
}

.source-badge.telegram {
    background: #0088CC;
    color: white;
}

.online-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34C759;
    display: inline-block;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.comment-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ---------- NEWS TITLE (for lastcomments) ---------- */
.comment-news-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--divider);
}

.comment-news-title a {
    color: var(--text);
}

.comment-news-title a:hover {
    color: var(--accent);
}

/* ---------- COMMENT BODY ---------- */
.comment-body {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 12px;
}

.comment-body p {
    margin-bottom: 10px;
}

.comment-body p:last-child {
    margin-bottom: 0;
}

.comment-body blockquote {
    margin: 10px 0;
    padding: 10px 14px;
    border-left: 3px solid var(--accent);
    background: var(--bg-input);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ---------- COMMENT ACTIONS ---------- */
.comment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--divider);
    margin-top: 12px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    font-family: var(--font);
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.action-btn .action-text {
    display: none; /* Скрываем текст на мобильных, показываем только эмодзи */
}

@media (min-width: 768px) {
    .action-btn .action-text {
        display: inline;
    }
}

/* Специфичные стили для кнопок */
.reply-btn:hover {
    border-color: #007AFF;
    color: #007AFF;
    background: rgba(0, 122, 255, 0.1);
}

.complaint-btn:hover {
    border-color: #FF9500;
    color: #FF9500;
    background: rgba(255, 149, 0, 0.1);
}

.delete-btn:hover {
    border-color: #FF3B30;
    color: #FF3B30;
    background: rgba(255, 59, 48, 0.1);
}

.edit-btn:hover {
    border-color: #34C759;
    color: #34C759;
    background: rgba(52, 199, 89, 0.1);
}

/* ---------- COMMENT RATING ---------- */
.comment-rating {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Type 1: Stars */
.rate-stars {
    font-size: 14px;
    color: #FFB800;
    letter-spacing: 2px;
}

/* Type 2: Like */
.rate-like,
.rate-plus-minus,
.rate-likes-dislikes {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
}

.reaction-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.reaction-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
    cursor: default;
}

.reaction-btn .count {
    font-weight: 600;
}

.like-btn:hover:not(:disabled),
.like-btn.active {
    border-color: #34C759;
    color: #34C759;
    background: rgba(52, 199, 89, 0.1);
}

.minus-btn:hover:not(:disabled),
.minus-btn.active,
.dislike-btn:hover:not(:disabled),
.dislike-btn.active {
    border-color: #FF3B30;
    color: #FF3B30;
    background: rgba(255, 59, 48, 0.1);
}

.likes-count,
.dislikes-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.likes-count {
    color: #34C759;
}

.dislikes-count {
    color: #FF3B30;
}

/* ---------- NESTED REPLIES ---------- */
.comment-replies {
    margin-top: 16px;
    margin-left: 24px;
    padding-left: 16px;
    border-left: 2px solid var(--divider);
}

.comment-replies .comment {
    margin-bottom: 10px;
    padding: 12px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .comment {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .comment-avatar img,
    .avatar-placeholder {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .comment-author-name {
        font-size: 14px;
    }
    
    .comment-body {
        font-size: 14px;
    }
    
    .comment-actions {
        gap: 4px;
    }
    
    .action-btn {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .comment-replies {
        margin-left: 12px;
        padding-left: 10px;
    }
}

@media (max-width: 480px) {
    .comment-header {
        gap: 8px;
    }
    
    .comment-avatar img,
    .avatar-placeholder {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .comment-author-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .comment-date {
        font-size: 11px;
    }
    
    .action-btn {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .reaction-btn {
        padding: 3px 6px;
        font-size: 12px;
    }
}

/* ---------- DARK THEME CORRECTIONS ---------- */
[data-theme="dark"] .comment {
    background: var(--bg-card);
}

[data-theme="dark"] .comment:hover {
    background: var(--bg-elevated);
}

[data-theme="dark"] .action-btn:hover {
    background: rgba(0, 122, 255, 0.08);
}

[data-theme="dark"] .reaction-btn:hover:not(:disabled) {
    background: rgba(0, 122, 255, 0.08);
}

[data-theme="dark"] .reaction-btn.active {
    background: rgba(0, 122, 255, 0.12);
}

/* ---------- ACCESSIBILITY ---------- */
.action-btn:focus-visible,
.reaction-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


.rate_like-dislike {
    display: flex;
    align-items: center;
    justify-content: center;
}
.rate_like-dislike .plus_icon {
    border-bottom: 0px;
}