:root {
	--bg: #f6f7fb;
	--surface: #ffffff;
	--text: #0f1115;
	--muted: #6b7280;
	--line: #e6e8ee;
	--accent: #4f46e5;
	--accent-soft: #eef0ff;
	--ok: #0f9d58;
	--ok-soft: #e8f7ef;
	--radius: 14px;
	--shadow: 0 1px 2px rgba(15, 17, 21, .04), 0 8px 24px rgba(15, 17, 21, .06);
}

* { box-sizing: border-box; }

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.55;
	font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

main {
	max-width: 1120px;
	margin: 0 auto;
	padding: 40px 24px 80px;
}

/* Шапка страницы */
header.hero {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 28px;
}

header.hero h1 {
	margin: 0;
	font-size: 30px;
	line-height: 1.2;
	letter-spacing: -0.02em;
	font-weight: 650;
}

header.hero p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
	max-width: 760px;
}

/* Карточки */
article {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px 22px;
	margin: 0 0 16px;
}

article h3 {
	margin: 0 0 14px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .01em;
	color: var(--muted);
	text-transform: uppercase;
}

h2 {
	font-size: 22px;
	letter-spacing: -0.01em;
	margin: 32px 0 6px;
	font-weight: 640;
}

/* Выбор теста */
.picker {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.picker label {
	font-size: 13px;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: .04em;
}

select {
	appearance: none;
	min-width: 560px;
	max-width: 100%;
	padding: 12px 42px 12px 16px;
	font: inherit;
	font-size: 14px;
	color: var(--text);
	background: var(--surface)
		url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E")
		right 14px center / 16px no-repeat;
	border: 1px solid var(--line);
	border-radius: 10px;
	box-shadow: 0 1px 2px rgba(15, 17, 21, .04);
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s;
}

select:hover { border-color: #c9ccd6; }
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Бейджи и подписи */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	background: var(--ok-soft);
	color: var(--ok);
}

.verdict {
	margin: 0 0 18px;
	padding: 14px 16px;
	border-radius: 12px;
	background: var(--accent-soft);
	border: 1px solid #dfe3ff;
	font-size: 14px;
}

.verdict b { color: var(--accent); }

.muted { color: var(--muted); font-size: 13px; }

code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .88em;
	background: #f1f2f6;
	border-radius: 6px;
	padding: 1px 6px;
}

/* Таблицы */
table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 13px;
}

thead th {
	position: sticky;
	top: 0;
	background: #fbfbfd;
	color: var(--muted);
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .03em;
	border-bottom: 1px solid var(--line);
	padding: 10px 12px;
	white-space: nowrap;
}

tbody td {
	padding: 9px 12px;
	border-bottom: 1px solid #f1f2f6;
	white-space: nowrap;
	text-align: right;
	vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbff; }

th:first-child, td:first-child,
th:nth-child(2), td:nth-child(2) { text-align: left; }

tr.best td {
	background: var(--ok-soft);
	font-weight: 600;
}

tr.best td:first-child::after {
	content: "лучший";
	display: inline-block;
	margin-left: 10px;
	padding: 2px 8px;
	border-radius: 999px;
	background: #fff;
	color: var(--ok);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
}

/* Графики */
.chart { height: 320px; }

/* Термины и дефолты */
dl.grid {
	display: grid;
	grid-template-columns: minmax(140px, max-content) 1fr;
	gap: 10px 20px;
	margin: 0;
	font-size: 14px;
}

dl.grid dt { font-weight: 600; color: var(--text); }
dl.grid dd { margin: 0; color: #374151; }

.test { display: none; }
.test.active { display: block; }

@media (max-width: 720px) {
	main { padding: 24px 16px 56px; }
	select { min-width: 0; width: 100%; }
	dl.grid { grid-template-columns: 1fr; }
}

/* Заголовки таблицы как кнопки сортировки */
th button {
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	color: inherit;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
}

th button::after {
	content: " \2195";
	opacity: .35;
	font-size: 11px;
}

th button.sorted[data-dir="asc"]::after {
	content: " \25B2";
	opacity: 1;
	color: var(--accent);
}

th button.sorted[data-dir="desc"]::after {
	content: " \25BC";
	opacity: 1;
	color: var(--accent);
}

/* Лучшее значение в колонке */
td.best-cell {
	font-weight: 700;
	color: #0f9d58;
}

/* Строки в пределах 5 % от лучшего веса */
tr.near-best td {
	background: #f3fbf6;
}

tr.near-best:hover td {
	background: #eaf7ef;
}

/* Победитель: вся строка жирная */
tr.best td {
	font-weight: 700;
}

/* Ссылки на документацию и Topvisor в шапке */
.brands {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	align-items: center;
	margin-bottom: 14px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	text-decoration: none;
	color: var(--muted);
	transition: color .15s;
}

.brand:hover {
	color: var(--text);
}

.brand img {
	height: 20px;
	width: auto;
	display: block;
}
