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

:root {
    --bg-page-start: #eef2ff;
    --bg-page-end: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --bg-upload: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --header-bg: #f1f5f9;
    --best-bg: #dcfce7;
    --best-text: #166534;
    --best-border: #22c55e;
    --our-border: #fbbf24;
    --our-bg: #fffbeb;
    --btn-primary: #005bff;
    --btn-primary-hover: #0040cc;
    --btn-reset: #ef4444;
    --btn-reset-hover: #dc2626;
    --btn-export: #10b981;
    --btn-export-hover: #059669;
    --badge-fbo-bg: #dcfce7;
    --badge-fbo-text: #166534;
    --badge-mixed-bg: #fef3c7;
    --badge-mixed-text: #92400e;
    --badge-fbs-bg: #fee2e2;
    --badge-fbs-text: #991b1b;
    --summary-bg: #ffffff;
    --winner-bg: #eef2ff;
    --shadow: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-card: 0 4px 12px rgba(0,0,0,0.08);
}

body.dark {
    --bg-page-start: #0f172a;
    --bg-page-end: #1e293b;
    --bg-card: #1e293b;
    --border: #334155;
    --border-strong: #475569;
    --bg-upload: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --header-bg: #334155;
    --best-bg: #14532d;
    --best-text: #86efac;
    --best-border: #22c55e;
    --our-border: #fbbf24;
    --our-bg: #3e2a1a;
    --btn-primary: #3b82f6;
    --btn-primary-hover: #60a5fa;
    --btn-reset: #ef4444;
    --btn-reset-hover: #f87171;
    --btn-export: #10b981;
    --btn-export-hover: #34d399;
    --badge-fbo-bg: #14532d;
    --badge-fbo-text: #86efac;
    --badge-mixed-bg: #713f12;
    --badge-mixed-text: #fde047;
    --badge-fbs-bg: #7f1d1d;
    --badge-fbs-text: #fca5a5;
    --summary-bg: #1e293b;
    --winner-bg: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-card: 0 4px 12px rgba(0,0,0,0.4);
}

/* ===== НАВИГАЦИОННОЕ МЕНЮ ===== */
.main-nav {
    background: var(--bg-card);
    border-radius: 60px;
    padding: 6px 12px;
    margin-bottom: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
}

.nav-link {
    padding: 10px 20px;
    border-radius: 40px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    background: transparent;
}

.nav-link:hover {
    background: var(--bg-upload);
    color: var(--btn-primary);
}

.nav-link.active {
    background: var(--btn-primary);
    color: white;
    box-shadow: var(--shadow);
}

@media (max-width: 768px) {
    .main-nav {
        border-radius: 20px;
        justify-content: center;
    }
    .nav-link {
        padding: 8px 14px;
        font-size: 12px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--bg-page-start) 0%, var(--bg-page-end) 100%);
    padding: 32px 24px;
    color: var(--text-primary);
    transition: background 0.3s, color 0.2s;
    min-height: 100vh;
}

.container { max-width: 1600px; margin: 0 auto; }

/* Header */
.header-row { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; gap: 16px; overflow: visible; }
.logo-area h1 { font-size: 42px; line-height: 1.18; padding-bottom: 5px; font-weight: 800; color: var(--text-primary); letter-spacing: -1px; margin: 0; background: linear-gradient(135deg, var(--btn-primary) 0%, #8b5cf6 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; overflow: visible; }
.header-controls { display: flex; gap: 12px; align-items: center; }
.theme-toggle { background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 40px; padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-primary); transition: all 0.2s; }
.theme-toggle:hover { border-color: var(--btn-primary); }
.sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; margin-top: 8px; padding-left: 4px; }

/* Upload Section */
.upload-section { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 32px; background: var(--bg-card); padding: 24px; border-radius: 20px; box-shadow: var(--shadow-card); border: 1px solid var(--border-strong); }
.upload-box { flex: 1; min-width: 200px; background: var(--bg-upload); padding: 16px; border-radius: 16px; border: 1px solid var(--border); transition: all 0.2s; }
.upload-box:hover { border-color: var(--btn-primary); transform: translateY(-2px); }
.upload-box h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.upload-box input { width: 100%; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; color: var(--text-primary); cursor: pointer; }
.button-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Buttons */
button { background: var(--btn-primary); color: white; border: none; padding: 10px 20px; border-radius: 40px; font-weight: 600; font-size: 13px; cursor: pointer; transition: all 0.2s; }
button:hover { background: var(--btn-primary-hover); transform: scale(1.02); }
.reset-btn { background: var(--btn-reset); }
.reset-btn:hover { background: var(--btn-reset-hover); }
.export-btn { background: var(--btn-export); }
.export-btn:hover { background: var(--btn-export-hover); }

/* Table */
.table-wrapper { overflow-x: auto; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--bg-card); box-shadow: var(--shadow-card); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { background: var(--header-bg); color: var(--text-primary); font-weight: 600; padding: 12px 8px; border-bottom: 1px solid var(--border); text-align: center; font-size: 11px; white-space: nowrap; }
td { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
tr:hover { background: var(--bg-upload); }

/* Product cell */
.product-cell { text-align: left; min-width: 200px; max-width: 250px; }
.product-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; word-break: break-word; line-height: 1.4; max-height: 2.8em; }
.product-link { color: var(--text-primary); text-decoration: none; font-weight: 500; }
.product-link:hover { color: var(--btn-primary); text-decoration: underline; }

/* Highlights */
.best { background: var(--best-bg); color: var(--best-text); font-weight: 600; border-left: 2px solid var(--best-border); }
.our-product-row { background: var(--our-bg); border-left: 3px solid var(--our-border); }

/* Badges */
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; }
.badge-fbo { background: var(--badge-fbo-bg); color: var(--badge-fbo-text); }
.badge-mixed { background: var(--badge-mixed-bg); color: var(--badge-mixed-text); }
.badge-fbs { background: var(--badge-fbs-bg); color: var(--badge-fbs-text); }

/* Score and Diff */
.score { font-weight: 700; color: var(--text-primary); font-size: 15px; }
.diff { display: block; font-size: 9px; margin-top: 3px; }
.diff-negative { color: var(--btn-reset); }
.diff-positive { color: var(--best-text); }
.diff-neutral { color: var(--text-muted); }

/* Summary */
.summary { margin-top: 28px; background: var(--summary-bg); border: 1px solid var(--border-strong); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-card); }
.summary h3 { font-size: 16px; font-weight: 600; margin-bottom: 10px; color: var(--text-primary); }
.winner-text { font-size: 15px; font-weight: 600; background: var(--winner-bg); display: inline-block; padding: 6px 16px; border-radius: 30px; margin-top: 6px; color: var(--text-primary); }
hr { margin: 16px 0; border: none; border-top: 1px solid var(--border); }
.metric-note { font-size: 11px; color: var(--text-muted); margin-top: 12px; padding: 10px; background: var(--bg-upload); border-radius: 10px; }

/* Responsive */
@media (max-width: 1200px) { th, td { font-size: 10px; padding: 8px 4px; } .product-cell { min-width: 160px; } }
@media (max-width: 768px) { body { padding: 16px; } .upload-section { flex-direction: column; } .header-row { flex-direction: column; align-items: flex-start; } .logo-area h1 { font-size: 42px; line-height: 1.18; padding-bottom: 5px; font-weight: 800; color: var(--text-primary); letter-spacing: -1px; margin: 0; background: linear-gradient(135deg, var(--btn-primary) 0%, #8b5cf6 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; overflow: visible; } }

/* ===== LDA polish v25: более собранный интерфейс ===== */
:root {
    --lda-radius-lg: 18px;
    --lda-radius-md: 14px;
    --lda-radius-sm: 10px;
    --shadow-card: 0 14px 34px rgba(15, 23, 42, 0.08);
    --shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

body.dark {
    --shadow-card: 0 14px 34px rgba(0, 0, 0, 0.35);
    --shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.main-nav,
.upload-section,
.table-wrapper,
.summary,
.feature-card,
.author-section,
.lda-tool-promo,
.help-hero,
.help-card,
.help-cta,
.help-video-card,
.reviews-section,
.under-dev-hero,
.under-dev-card,
.under-dev-tool {
    border-radius: var(--lda-radius-lg) !important;
}

.nav-link,
.author-link,
.author-badge,
.help-badge,
.lda-promo-btn,
button,
.theme-toggle,
.badge,
.winner-text,
input,
select,
textarea,
.upload-box,
.flow-step {
    border-radius: var(--lda-radius-md) !important;
}

button:hover, .feature-card:hover, .author-link:hover, .lda-promo-btn:hover {
    transform: translateY(-2px);
}

.main-nav {
    padding: 8px;
    align-items: center;
}

.nav-link.nav-disabled,
.nav-link.nav-disabled:hover {
    opacity: .58;
    background: var(--bg-upload);
    color: var(--text-muted);
}

.nav-link.nav-disabled::after {
    content: ' скоро';
    font-size: 10px;
    opacity: .8;
}

.coming-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-upload);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
    margin-top: 12px;
}

.feature-card.in-dev {
    cursor: pointer;
    opacity: .86;
}

.feature-card.in-dev .emoji {
    filter: grayscale(.2);
}

.feature-card.in-dev:hover {
    border-color: var(--border-strong);
}

.brand-subtitle { margin: 4px 0 0; color: var(--text-secondary); font-size: 14px; line-height: 1.35; font-weight: 500; letter-spacing: -0.1px; }
.logo-area { overflow: visible; padding-bottom: 2px; }
@media (max-width: 768px) { .brand-subtitle { font-size: 12px; } }
