:root {
    --bg:           #0f1117;
    --card:         #161b22;
    --surface:      #0d1117;
    --muted:        #8b949e;
    --accent:       #58a6ff;
    --success:      #2ea043;
    --gread_success:#166534;
    --warning:      #d29922;
    --danger:       #da3633;
    --glass:        rgba(255,255,255,0.04);
    --border:       rgba(255,255,255,0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    background: radial-gradient(circle at 20% 10%, #1a2330 0%, #0f1117 40%),
                radial-gradient(circle at 80% 90%, #16213a 0%, #0f1117 50%);
    color: #e6edf3;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.container {
    max-width: 940px;
    margin: 36px auto;
    padding: 20px;
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
}

h1 {
    text-align: center;
    margin: 10px 0 28px;
    font-weight: 700;
    color: var(--success);
    text-shadow: 0 0 28px rgba(46,160,67,0.45);
    font-size: clamp(1.3rem, 4vw, 1.9rem);
    letter-spacing: -0.2px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 18px;
    min-width: 0;
}
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

/* ── Карточки ── */
.card {
    background: rgba(22, 27, 34, 0.90);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
    overflow: hidden;
    width: 100%;
}
@media (min-width: 601px) and (prefers-reduced-motion: no-preference) {
    .card { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
}
@media (hover: hover) {
    .card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.45); }
}

.section-title { color: var(--accent); margin: 0 0 13px; font-size: 13px; font-weight: 600; }

/* ── Строки форм ── */
.so-row, .sor-row, .soch-row {
    display: flex; gap: 8px; align-items: center;
    margin-bottom: 10px; min-width: 0; width: 100%;
}
#addForm  { display: flex; gap: 8px; flex: 1; align-items: center; min-width: 0; }
#addForm input { flex: 1; min-width: 0; }
#sorForm  { display: flex; gap: 8px; flex: 1; align-items: center; min-width: 0; }
#sorForm input { flex: 1; min-width: 0; }
.soch-inputs { display: flex; gap: 8px; flex: 1; min-width: 0; }
.soch-inputs input { flex: 1; min-width: 0; }

/* ── Инпуты ── */
input[type="number"],
input[type="text"] {
    background: var(--surface);
    border: 1px solid #23262b;
    color: #e6edf3;
    padding: 10px 13px;
    border-radius: 10px;
    width: 100%; outline: none;
    font-size: 16px; /* ≥16px чтобы iOS не делал zoom */
    min-height: 48px; /* увеличенная touch-зона */
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input[type="number"]::placeholder,
input[type="text"]::placeholder { color: var(--muted); font-size: 14px; }
input[type="number"]:focus,
input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88,166,255,0.12); }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ── Кнопки ── */
.btn {
    background: linear-gradient(135deg, #3fb950, #2ea043);
    color: #fff; border: none;
    padding: 10px 16px; border-radius: 10px;
    cursor: pointer; font-weight: 600; font-size: 14px;
    letter-spacing: 0.2px; white-space: nowrap;
    min-height: 48px; /* увеличенная touch-зона */
    touch-action: manipulation;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    will-change: transform;
    /* Убираем задержку тапа */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
@media (hover: hover) {
    .btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(63,185,80,0.35); }
}
.btn:active { transform: scale(0.97); }

.btn.delete {
    background: linear-gradient(135deg, #da3633, #b32b27);
    padding: 6px 11px; min-height: 38px; font-size: 16px; border-radius: 8px;
}

.ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--muted); font-weight: 600;
}
@media (hover: hover) {
    .ghost:hover { border-color: rgba(255,255,255,0.18); color: #e6edf3; box-shadow: none; }
}

/* ── Чипы ── */
.list {
    display: flex; flex-wrap: wrap; gap: 7px;
    margin-top: 8px; min-width: 0; max-width: 100%; width: 100%; overflow: hidden;
}
.list-item {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 8px 13px; border-radius: 10px;
    background: var(--glass); border: 1px solid rgba(88,166,255,0.10);
    color: #e6edf3; font-weight: 600; font-size: 15px;
    opacity: 0; transform: translateY(7px) scale(0.97);
    transition: transform 280ms cubic-bezier(.2,.9,.25,1), opacity 240ms ease;
    will-change: transform, opacity;
}
.list-item.enter    { opacity: 1; transform: translateY(0) scale(1); }
.list-item.removing {
    opacity: 0; transform: translateY(-6px) scale(0.97);
    transition: transform 200ms ease, opacity 200ms ease;
}

/* ── Результат ── */
.result-big {
    text-align: center; font-size: 52px; font-weight: 800;
    margin-bottom: 10px; letter-spacing: 0.5px;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}
.result-danger    { color: var(--danger);  text-shadow: 0 0 28px rgba(218,54,51,0.45); }
.result-warning   { color: var(--warning); text-shadow: 0 0 28px rgba(210,153,34,0.45); }
.result-good      { color: var(--success); text-shadow: 0 0 28px rgba(46,160,67,0.45); }
.result-excellent { color: #22c55e; text-shadow: 0 0 24px rgba(22,197,94,0.55), 0 0 48px rgba(22,101,52,0.35); }

.subtitle { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; line-height: 1.5; }

.official-link {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; margin: 0 0 14px; padding: 10px 18px;
    background: #3cb648; color: #fff; border-radius: 12px;
    text-decoration: none; font-weight: 700; font-size: 13px;
    letter-spacing: 0.1px; min-height: 48px;
    box-shadow: 0 2px 12px rgba(60,182,72,0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    border: 1.5px solid rgba(255,255,255,0.12);
    -webkit-tap-highlight-color: transparent;
}
.official-link .bilim-logo {
    display: flex; align-items: center; justify-content: center;
    background: #fff; border-radius: 6px; width: 28px; height: 28px; flex-shrink: 0; padding: 3px;
}
.official-link .bilim-logo svg { width: 20px; height: 20px; display: block; }
.official-link .link-text { display: flex; flex-direction: column; gap: 1px; text-align: left; }
.official-link .link-text-top  { font-size: 10px; font-weight: 500; opacity: 0.82; line-height: 1; }
.official-link .link-text-main { font-size: 13px; font-weight: 700; line-height: 1.2; }
.official-link:hover  { transform: translateY(-2px); background: #2da83a; box-shadow: 0 6px 22px rgba(60,182,72,0.38); }
.official-link:active { transform: scale(0.98); }

/* ── Прогресс ── */
.progress-wrap {
    background: var(--surface); padding: 12px; border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.03);
}
.progress-bar { height: 8px; background: #1c2128; border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.progress-fill {
    width: 0%; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, #2ea043, #3fb950, #58a6ff);
    transition: width 0.65s cubic-bezier(.2,.9,.25,1);
    will-change: width;
}

/* ── Тренд ── */
.trend-box {
    background: #070b11; border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    position: relative; overflow: hidden;
    max-height: 320px;
    transition: max-height 400ms cubic-bezier(.2,.9,.25,1), opacity 280ms ease, padding 280ms ease;
    opacity: 1; padding: 10px; margin-bottom: 12px;
}
.trend-box::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% -10%, rgba(88,166,255,0.09) 0%, transparent 65%);
    pointer-events: none;
}
.trend-box.collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; pointer-events: none; }

.trend-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 8px; color: var(--muted); }
.trend-header-left { display: flex; align-items: center; gap: 10px; }

.t-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.t-legend-line { width: 14px; height: 2px; border-radius: 2px; flex-shrink: 0; }
.t-legend-line.solid  { background: #58a6ff; }
.t-legend-line.dashed { background: repeating-linear-gradient(90deg, #3fb950 0, #3fb950 4px, transparent 4px, transparent 7px); }

#aiAccuracy { font-weight: 700; color: var(--accent); font-size: 13px; }
#trendContainer { height: 145px; }
#trendChart { display: block; height: 100%; width: 100%; }

.trend-label { text-align: center; font-size: 12px; font-weight: 600; margin-top: 6px; color: var(--accent); }
.trend-hint  { display: none; text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; }
.trend-box.collapsed + .trend-hint { display: block; }

/* ── Разбивка весов ── */
.breakdown {
    display: flex; align-items: center; gap: 0;
    padding: 12px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.break-card {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 4px 8px;
    border-right: 1px solid rgba(255,255,255,0.05);
    background: transparent; border-radius: 0;
}
.break-card:last-child { border-right: none; }
.break-title {
    color: var(--muted); font-size: 10px; font-weight: 700;
    letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 0; line-height: 1;
}
.break-value { font-weight: 700; font-size: 15px; color: #e6edf3; line-height: 1.1; }
.break-card .small { display: none; }

[data-theme="light"] .breakdown { border-top-color: rgba(0,0,0,0.07); }
[data-theme="light"] .break-card { border-right-color: rgba(0,0,0,0.06); }
[data-theme="light"] .break-value { color: #0f172a; }

.small { font-size: 13px; color: var(--muted); line-height: 1.6; }
.card h2 { font-size: 16px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }

footer {
    margin-top: 36px; padding: 18px 0; text-align: center;
    color: #444d56; font-size: 13px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
footer a { color: var(--accent); text-decoration: none; }

.soch-tooltip { color: var(--accent); cursor: pointer; font-size: 12px; position: relative; }
.soch-tooltip-text {
    visibility: hidden; position: absolute; top: 22px; left: 0;
    background: #0d1117; padding: 6px 10px; border-radius: 8px;
    font-size: 12px; color: #e6edf3; border: 1px solid #23262b;
    white-space: nowrap; max-width: calc(100vw - 40px); z-index: 10;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.soch-tooltip:hover .soch-tooltip-text { visibility: visible; }

/* ══════════════════════
   МОБИЛЕ — УЛУЧШЕННЫЙ
   ══════════════════════ */
@media (max-width: 600px) {
    .container { margin: 12px auto; padding: 10px; }
    h1 { font-size: 1.25rem; margin-bottom: 16px; letter-spacing: -0.3px; }
    .card { padding: 14px; border-radius: 14px; }
    .card:hover { transform: none; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

    /* Инпуты — крупнее, удобнее */
    input[type="number"],
    input[type="text"] {
        font-size: 16px; /* обязательно, иначе iOS делает zoom */
        min-height: 50px;
        padding: 12px 14px;
        border-radius: 10px;
    }

    /* Кнопки — минимум 48px */
    .btn {
        min-height: 48px;
        font-size: 14px;
        padding: 12px 16px;
        border-radius: 10px;
    }

    /* Чипы — удобнее тапать */
    .list-item {
        padding: 10px 14px;
        font-size: 15px;
        border-radius: 10px;
    }
    .list-item .btn.delete {
        min-height: 34px;
        width: 34px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Формы */
    .so-row   { flex-direction: column; align-items: stretch; gap: 10px; }
    #addForm  { flex-wrap: nowrap; gap: 8px; }
    #addForm input { min-width: 0; }
    #clearSoBtn { width: 100%; }

    .sor-row  { flex-direction: column; align-items: stretch; gap: 10px; }
    #sorForm  { flex-wrap: nowrap; gap: 6px; }
    #sorForm input { flex: 1; min-width: 0; }
    #sorForm .btn  { flex-shrink: 0; }
    #clearSorsBtn  { width: 100%; }

    .soch-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .soch-inputs { gap: 6px; }
    #clearSochBtn { width: 100%; }

    /* Результат */
    .result-big { font-size: 44px; margin-bottom: 8px; }

    /* Тренд */
    #trendContainer { height: 120px !important; }
    .breakdown { gap: 4px; }
    .break-card  { flex: 1; }
    .break-value { font-size: 14px; }
    .break-title { font-size: 9px; }
    .t-legend  { display: none; }
    .progress-wrap { padding: 10px; border-radius: 10px; }
    .trend-box { border-radius: 8px; }
    .trend-label { font-size: 11px; }
    #aiAccuracy { font-size: 12px; }
    .grade-badge { font-size: 11px; padding: 3px 10px; margin-bottom: 8px; }
    .progress-bar { height: 6px; margin-bottom: 10px; }

    /* BilimLand link */
    .official-link { min-height: 48px; padding: 10px 14px; gap: 8px; }
    .official-link .bilim-logo { width: 26px; height: 26px; }
    .official-link .link-text-main { font-size: 12px; }

    /* content-visibility для секций ниже fold */
    .faq-card { content-visibility: auto; contain-intrinsic-size: 0 300px; }
    .articles-card { content-visibility: auto; contain-intrinsic-size: 0 200px; }

    /* Сброс и шэр */
    #resetAllBtn { font-size: 14px; min-height: 48px; }
    .share-btn   { font-size: 13px; min-height: 48px; }
}

@media (max-width: 380px) {
    .result-big { font-size: 38px; }
    .card { padding: 12px 13px; }
    .btn { font-size: 13px; padding: 10px 12px; }
    input[type="number"],
    input[type="text"] { font-size: 16px; min-height: 48px; }
}

@media (max-width: 320px) {
    .container { padding: 8px; }
    .card { padding: 10px 11px; }
}

/* ── FAQ ── */
.faq-card h2 { margin-bottom: 16px; }
.faq-list { display: flex; flex-direction: column; gap: 6px; }

.faq-item {
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px; overflow: hidden;
    transition: border-color 0.2s ease;
}
.faq-item.open { border-color: rgba(88,166,255,0.25); }

.faq-q {
    width: 100%; display: flex; align-items: center;
    justify-content: space-between; gap: 12px; padding: 14px 16px;
    background: transparent; border: none; cursor: pointer;
    color: #e6edf3; font-size: 14px; font-weight: 600;
    text-align: left; line-height: 1.4;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 48px; /* touch-зона */
}
.faq-q:hover { background: rgba(255,255,255,0.04); }
.faq-item.open .faq-q { color: var(--accent); background: rgba(88,166,255,0.05); }

.faq-chevron {
    width: 16px; height: 16px; flex-shrink: 0; color: var(--muted);
    transition: transform 0.25s cubic-bezier(.2,.9,.25,1), color 0.15s ease;
}
.faq-item.open .faq-chevron { transform: rotate(180deg); color: var(--accent); }

.faq-a {
    max-height: 0; overflow: hidden;
    transition: max-height 0.3s cubic-bezier(.2,.9,.25,1), padding 0.25s ease;
    padding: 0 16px;
}
.faq-a p { font-size: 13px; color: var(--muted); line-height: 1.7; padding-bottom: 14px; }
.faq-a strong { color: #c9d1d9; }
.faq-item.open .faq-a { max-height: 200px; padding-top: 0; }

@media (max-width: 600px) {
    .faq-q { font-size: 13px; padding: 12px 14px; }
    .faq-a p { font-size: 13px; }
}

/* ── Карточки статей ── */
.articles-grid { display: flex; flex-direction: column; gap: 8px; }

.article-card {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px; text-decoration: none;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    touch-action: manipulation;
    min-height: 60px; /* touch-зона */
    -webkit-tap-highlight-color: transparent;
}
.article-card:hover { border-color: rgba(88,166,255,0.25); background: rgba(88,166,255,0.04); transform: translateX(3px); }

.article-card__icon {
    width: 44px; height: 44px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: rgba(88,166,255,0.10); border: 1px solid rgba(88,166,255,0.25);
    color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.3px;
}
.article-card__body  { flex: 1; min-width: 0; }
.article-card__title { font-size: 14px; font-weight: 600; color: #e6edf3; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-card__desc  { font-size: 12px; color: var(--muted); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-card__arrow { color: var(--muted); font-size: 16px; flex-shrink: 0; transition: color 0.15s, transform 0.15s; }
.article-card:hover .article-card__arrow { color: var(--accent); transform: translateX(2px); }

@media (max-width: 600px) {
    .article-card__desc { display: none; }
    .article-card__icon { width: 40px; height: 40px; font-size: 10px; }
    .article-card__title { font-size: 13px; }
    .article-card { padding: 10px 12px; }
}

/* ── Анимации ── */
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%  { transform: translateX(-5px); }
    40%  { transform: translateX(5px); }
    60%  { transform: translateX(-3px); }
    80%  { transform: translateX(3px); }
}
.shake { animation: shake 0.3s ease; }

.input-error-banner {
    display: flex; align-items: center; gap: 8px; margin-top: 8px;
    padding: 9px 13px;
    background: rgba(218,54,51,0.10); border: 1px solid rgba(218,54,51,0.35);
    border-radius: 10px; color: #ff7070; font-size: 13px; font-weight: 500;
    animation: errIn 0.22s cubic-bezier(.2,.9,.25,1);
    width: 100%; box-sizing: border-box;
}
.input-error-banner--hide { animation: errOut 0.22s ease forwards; }
.input-error-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; min-width: 17px;
    background: var(--danger); border-radius: 50%;
    color: #fff; font-size: 10px; font-weight: 800; line-height: 1;
}
@keyframes errIn  { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes errOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-4px); } }

/* ── Офлайн-баннер ── */
.offline-banner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: #b45309; color: #fef3c7;
    text-align: center; font-size: 13px; font-weight: 600;
    padding: 8px 16px; letter-spacing: 0.2px;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ── Grade badge ── */
.grade-badge {
    display: block; text-align: center; margin: 0 auto 12px;
    padding: 5px 16px; border-radius: 20px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.3px; width: fit-content;
}
.badge-empty     { background: rgba(139,148,158,0.10); color: var(--muted);  border: 1px solid rgba(139,148,158,0.2); }
.badge-danger    { background: rgba(218,54,51,0.12);   color: #ff7070;        border: 1px solid rgba(218,54,51,0.35); }
.badge-warning   { background: rgba(210,153,34,0.12);  color: #e3b341;        border: 1px solid rgba(210,153,34,0.35); }
.badge-good      { background: rgba(46,160,67,0.12);   color: #56d364;        border: 1px solid rgba(46,160,67,0.35); }
.badge-excellent { background: rgba(34,197,94,0.15);   color: #4ade80;        border: 1px solid rgba(34,197,94,0.4); }

/* ══════════════════════════════════════════════
   СВЕТЛАЯ ТЕМА
   ══════════════════════════════════════════════ */
[data-theme="light"] {
    --bg:      #f0f4f8; --card: #ffffff; --surface: #e8eef4;
    --muted:   #64748b; --accent: #2563eb; --success: #16a34a;
    --gread_success: #bbf7d0; --warning: #d97706; --danger: #dc2626;
    --glass:   rgba(0,0,0,0.04); --border: rgba(0,0,0,0.08);
}
[data-theme="light"] body {
    background: radial-gradient(circle at 20% 10%, #dbeafe 0%, #f0f4f8 40%),
                radial-gradient(circle at 80% 90%, #d1fae5 0%, #f0f4f8 50%);
    color: #0f172a;
}
[data-theme="light"] h1 { color: #0f172a; }
[data-theme="light"] .card { background: #ffffff; border-color: rgba(0,0,0,0.08); box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
[data-theme="light"] .card:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.13); }
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="text"] { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }
[data-theme="light"] input[type="number"]::placeholder,
[data-theme="light"] input[type="text"]::placeholder { color: #94a3b8; }
[data-theme="light"] input[type="number"]:focus,
[data-theme="light"] input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
[data-theme="light"] .ghost { border-color: rgba(0,0,0,0.12); color: #64748b; }
[data-theme="light"] .ghost:hover { border-color: rgba(0,0,0,0.25); color: #0f172a; }
[data-theme="light"] .list-item { background: rgba(37,99,235,0.06); border-color: rgba(37,99,235,0.15); color: #0f172a; }
[data-theme="light"] .subtitle { color: #64748b; }
[data-theme="light"] .progress-wrap { background: #f1f5f9; border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .progress-bar  { background: #e2e8f0; }
[data-theme="light"] .trend-box     { background: #f8fafc; border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .trend-header  { color: #475569; }
[data-theme="light"] .trend-hint    { color: #94a3b8; }
[data-theme="light"] .trend-label   { color: #475569; }
[data-theme="light"] #aiAccuracy    { color: var(--accent); }
[data-theme="light"] .breakdown     { background: transparent; border-top: 1px solid rgba(0,0,0,0.07); }
[data-theme="light"] .break-card    { background: #f1f5f9; border: 1px solid rgba(0,0,0,0.07); border-radius: 10px; padding: 8px 12px; }
[data-theme="light"] .break-title   { color: #64748b; }
[data-theme="light"] .break-value   { color: #0f172a; }
[data-theme="light"] .section-title { color: var(--accent); }
[data-theme="light"] .faq-item { border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .faq-item.open { border-color: rgba(37,99,235,0.25); }
[data-theme="light"] .faq-q { color: #0f172a; }
[data-theme="light"] .faq-q:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .faq-item.open .faq-q { color: var(--accent); background: rgba(37,99,235,0.04); }
[data-theme="light"] .faq-a p { color: #475569; }
[data-theme="light"] .faq-a strong { color: #1e293b; }
[data-theme="light"] .article-card { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.07); }
[data-theme="light"] .article-card:hover { border-color: rgba(37,99,235,0.3); background: rgba(37,99,235,0.04); }
[data-theme="light"] .article-card__title { color: #0f172a; }
[data-theme="light"] .article-card__desc  { color: #64748b; }
[data-theme="light"] .badge-empty { background: rgba(100,116,139,0.08); color: #64748b; border-color: rgba(100,116,139,0.2); }
[data-theme="light"] footer { color: #64748b; }
[data-theme="light"] footer a { color: var(--accent); }

/* ── Кнопка темы ── */
.theme-btn {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--glass);
    cursor: pointer; font-size: 16px; flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    -webkit-tap-highlight-color: transparent; line-height: 1;
    touch-action: manipulation;
    min-height: 38px; /* touch-зона достаточная вместе с паддингом */
}
.theme-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.theme-btn:active { transform: scale(0.93); }
[data-theme="light"] .theme-btn:hover { background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.15); }

/* ── Логотип-заголовок ── */
.site-title { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin: 8px 0 28px; }
.site-title__logo { display: flex; align-items: center; gap: 10px; }
.site-title__logo svg { width: 36px; height: 36px; flex-shrink: 0; display: block; margin-top: 2px; }
.site-title__name {
    font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 800; color: #fff;
    line-height: 1; margin: 0; letter-spacing: -0.02em;
    text-shadow: 0 0 12px rgba(88,166,255,0.55), 0 0 32px rgba(88,166,255,0.25), 0 0 64px rgba(60,182,72,0.12);
}
.site-title__name span { color: #3cb648; margin-left: -0.02em; }
[data-theme="light"] .site-title__name { color: #0f172a; }
.site-title__sub { font-size: clamp(0.8rem, 2.5vw, 0.95rem); color: var(--muted); font-weight: 500; letter-spacing: 0.1px; }

/* ── Reveal ── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.45s ease, transform 0.45s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── Splash ── */
#splash {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 24px;
    background: #0d1117; transition: opacity 400ms ease, transform 400ms ease;
}
[data-theme="light"] #splash { background: #f0f4f8; }
#splash.hidden { opacity: 0; transform: scale(1.03); pointer-events: none; }
#splash .splash-logo { display: flex; align-items: center; gap: 14px; animation: splash-pop 0.45s cubic-bezier(.34,1.56,.64,1) both; justify-content: center; width: 100%; padding: 0 20px; box-sizing: border-box; }
#splash .splash-logo svg { width: 48px; height: 48px; flex-shrink: 0; filter: drop-shadow(0 0 14px rgba(60,182,72,0.5)); }
#splash .splash-name { font-size: 2rem; font-weight: 800; letter-spacing: -1px; color: #fff; line-height: 1; }
[data-theme="light"] #splash .splash-name { color: #0f172a; }
#splash .splash-name span { color: #3cb648; }
#splash .splash-tagline { font-size: 13px; color: var(--muted); margin-top: 2px; font-weight: 400; }
#splash .splash-bar-wrap { width: 140px; height: 3px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; animation: splash-pop 0.45s 0.1s cubic-bezier(.34,1.56,.64,1) both; }
[data-theme="light"] #splash .splash-bar-wrap { background: rgba(0,0,0,0.08); }
#splash .splash-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #3cb648, #58a6ff); border-radius: 99px; animation: splash-fill 1.4s 0.1s cubic-bezier(.2,.9,.25,1) forwards; }
@keyframes splash-fill { from { width: 0%; } to { width: 100%; } }
@keyframes splash-pop  { from { opacity: 0; transform: scale(0.75) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ══════════════════════════════════════════════
   ТОПБАР
   ══════════════════════════════════════════════ */
/* ══════════════════════════════════════════
   UNIFIED TOPBAR v1.6.3
   ══════════════════════════════════════════ */
#topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; height: 52px; gap: 8px;
    background: rgba(13,17,23,0.97);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
[data-theme="light"] #topbar { background: rgba(240,244,248,0.97); border-bottom-color: rgba(0,0,0,0.08); }

/* ── Logo ── */
.topbar-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; text-decoration: none; }
.topbar-logo svg { width: 22px; height: 22px; display: block; }
.topbar-logo__name { font-size: 15px; font-weight: 800; color: #e6edf3; letter-spacing: -0.3px; line-height: 1; white-space: nowrap; }
.topbar-logo__name span { color: #3cb648; }
[data-theme="light"] .topbar-logo__name { color: #0f172a; }

/* BilimExam logo variant */
.topbar-logo--exam .topbar-logo__name { color: #a78bfa; }
.topbar-logo--exam .topbar-logo__name span { color: #c4b5fd; }
[data-theme="light"] .topbar-logo--exam .topbar-logo__name { color: #7c3aed; }
[data-theme="light"] .topbar-logo--exam .topbar-logo__name span { color: #6d28d9; }

/* ── Center ── */
.topbar-center { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: center; }

/* Методика МОН — subtle pill */
.topbar-official-link {
    display: flex; align-items: center; gap: 5px; padding: 5px 10px;
    border-radius: 8px; border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03); color: #8b949e;
    font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent; min-height: 34px;
}
.topbar-official-link:hover { color: #c9d1d9; border-color: rgba(255,255,255,0.14); background: rgba(255,255,255,0.06); }
[data-theme="light"] .topbar-official-link { border-color: rgba(0,0,0,0.08); background: rgba(0,0,0,0.03); color: #64748b; }
[data-theme="light"] .topbar-official-link:hover { color: #334155; border-color: rgba(0,0,0,0.14); background: rgba(0,0,0,0.06); }

/* Статьи — branded blue pill */
.topbar-articles-btn {
    display: flex; align-items: center; gap: 5px; padding: 5px 11px;
    border-radius: 8px; border: 1.5px solid rgba(88,166,255,0.3);
    background: rgba(88,166,255,0.08); color: #58a6ff;
    font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent; min-height: 34px;
}
.topbar-articles-btn:hover { background: rgba(88,166,255,0.16); border-color: rgba(88,166,255,0.5); color: #79b8ff; transform: translateY(-1px); }
.topbar-articles-btn:active { transform: scale(0.97); }
.topbar-articles-btn.active { background: rgba(88,166,255,0.15); border-color: rgba(88,166,255,0.55); color: #79b8ff; }
[data-theme="light"] .topbar-articles-btn { border-color: rgba(37,99,235,0.3); background: rgba(37,99,235,0.07); color: #2563eb; }
[data-theme="light"] .topbar-articles-btn:hover { background: rgba(37,99,235,0.13); border-color: rgba(37,99,235,0.5); color: #1d4ed8; }
[data-theme="light"] .topbar-articles-btn.active { background: rgba(37,99,235,0.12); border-color: rgba(37,99,235,0.5); color: #1d4ed8; }

/* ── Right ── */
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* BilimExam button — purple */
.topbar-exam-btn {
    display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 7px;
    border-radius: 8px; border: 1.5px solid rgba(167,139,250,0.3);
    background: rgba(167,139,250,0.08); text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent; min-height: 34px;
}
.topbar-exam-btn:hover { background: rgba(167,139,250,0.15); border-color: rgba(167,139,250,0.5); transform: translateY(-1px); }
.topbar-exam-btn:active { transform: scale(0.97); }
.topbar-exam-btn__icon { font-size: 14px; line-height: 1; display: flex; align-items: center; }
.topbar-exam-btn__text { font-size: 12px; font-weight: 600; color: #a78bfa; letter-spacing: -0.2px; white-space: nowrap; }
.topbar-exam-btn__text b { font-weight: 800; }
[data-theme="light"] .topbar-exam-btn { border-color: rgba(124,58,237,0.25); background: rgba(124,58,237,0.06); }
[data-theme="light"] .topbar-exam-btn:hover { background: rgba(124,58,237,0.12); border-color: rgba(124,58,237,0.45); }
[data-theme="light"] .topbar-exam-btn__text { color: #7c3aed; }

/* BilimCalc button — green */
.topbar-calc-btn {
    display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 7px;
    border-radius: 8px; border: 1.5px solid rgba(60,182,72,0.3);
    background: rgba(60,182,72,0.08); text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent; min-height: 34px;
}
.topbar-calc-btn:hover { background: rgba(60,182,72,0.15); border-color: rgba(60,182,72,0.5); transform: translateY(-1px); }
.topbar-calc-btn:active { transform: scale(0.97); }
.topbar-calc-btn__icon { display: flex; align-items: center; line-height: 1; }
.topbar-calc-btn__text { font-size: 12px; font-weight: 600; color: #3cb648; letter-spacing: -0.2px; white-space: nowrap; }
.topbar-calc-btn__text b { font-weight: 800; }
[data-theme="light"] .topbar-calc-btn { border-color: rgba(22,163,74,0.28); background: rgba(22,163,74,0.06); }
[data-theme="light"] .topbar-calc-btn:hover { background: rgba(22,163,74,0.12); border-color: rgba(22,163,74,0.45); }
[data-theme="light"] .topbar-calc-btn__text { color: #16a34a; }

/* ── Убрать выделение при тапе ── */
*, button, a, input, .btn, .ghost, .faq-q,
.article-card, .mobile-nav__item,
.topbar-official-link, .topbar-logo, .topbar-articles-btn, [role="button"] {
    -webkit-tap-highlight-color: transparent !important;
}

/* ── Адаптивность ──
   Десктоп: всё видно с текстом
   Мобайл (<600px): логотип без текста, центр виден, кнопка приложения без текста
────────────────────────────────── */
@media (max-width: 600px) {
    #topbar { padding: 0 12px; gap: 6px; }
    .topbar-logo__name { display: none; }
    .topbar-exam-btn__text { display: none; }
    .topbar-exam-btn { padding: 5px 7px; }
    .topbar-calc-btn__text { display: none; }
    .topbar-calc-btn { padding: 5px 7px; }
    .topbar-official-link { padding: 5px 7px; font-size: 11px; gap: 4px; }
    .topbar-articles-btn { padding: 5px 9px; font-size: 11px; gap: 4px; }
    .topbar-center { gap: 5px; }
}

/* ── Кнопка Поделиться ── */
.share-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; font-size: 13px;
    color: var(--accent) !important;
    border-color: rgba(88,166,255,0.2) !important;
    transition: border-color 0.15s, color 0.15s, background 0.15s !important;
}
.share-btn:hover {
    border-color: rgba(88,166,255,0.45) !important;
    background: rgba(88,166,255,0.06) !important;
    transform: none !important; box-shadow: none !important;
}
[data-theme="light"] .share-btn {
    color: var(--accent) !important;
    border-color: rgba(37,99,235,0.2) !important;
}

/* ── Кнопка Сбросить всё ── */
#resetAllBtn {
    color: var(--danger) !important;
    border-color: rgba(218,54,51,0.25) !important;
}
#resetAllBtn:hover {
    border-color: rgba(218,54,51,0.5) !important;
    background: rgba(218,54,51,0.06) !important;
    color: #ff7070 !important;
    transform: none !important; box-shadow: none !important;
}

html { touch-action: pan-x pan-y; }

.list-empty {
    width: 100%; text-align: center; font-size: 12px; color: var(--muted);
    padding: 10px 0 4px; opacity: 0.65; pointer-events: none;
    font-style: italic; letter-spacing: 0.1px;
}

/* ── mobile-nav item exam accent ── */
.mobile-nav__item--exam { color: #a78bfa !important; }
.mobile-nav__item--exam.active { color: #a78bfa !important; }
.mobile-nav__item--exam.active .mobile-nav__icon { transform: scale(1.15) translateY(-1px); }
.mobile-nav__item--exam.active::before { background: #a78bfa !important; }