/* RATING — страница «Топ и рейтинг» (/rating), «Как считается» (/rating/how), карточки рейтинга в профиле и на странице
 * тайтла, бейджи места (Rating::bookBadge / userBadge). Цвета — токены темы; медали — от --rating (золото),
 * --muted-foreground (серебро) и тёплого оттенка (бронза). */

:root {
	--rt-gold: var(--rating);
	--rt-gold-ink: var(--rating-text);
	--rt-silver: oklch(0.68 0.01 250);
	--rt-bronze: oklch(0.62 0.11 55);
	--rt-bronze-ink: oklch(0.5 0.1 55);
}
:root[data-theme="dark"] { --rt-silver: oklch(0.8 0.01 250); --rt-bronze: oklch(0.72 0.11 55); --rt-bronze-ink: oklch(0.78 0.1 55); }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) { --rt-silver: oklch(0.8 0.01 250); --rt-bronze: oklch(0.72 0.11 55); --rt-bronze-ink: oklch(0.78 0.1 55); }
}

.nf-rt { max-width: 1080px; margin: 0 auto; min-width: 0; }
.nf-rt-head { margin-bottom: 18px; }

/* ------------------------------------------------ вкладки «Тайтлы / Участники» */
.nf-rt-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 4px; background: var(--card); margin-bottom: 14px; }
.nf-rt-tabs a { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 11px 14px; border-radius: var(--radius); color: var(--muted-foreground); font-weight: 650; font-size: 15px; }
.nf-rt-tabs a:hover { color: var(--foreground); background: var(--muted); text-decoration: none; }
.nf-rt-tabs a.is-active { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--elev-1); }
.nf-rt-tabs a small { font-size: 12px; font-weight: 600; opacity: .7; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ подвкладки и период */
.nf-rt-sub { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.nf-rt-sub .nb-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; font-size: 13px; }
.nf-rt-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 16px; }
.nf-rt-bar p { margin: 0; color: var(--muted-foreground); font-size: 13.5px; max-width: 68ch; }
.nf-rt-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; flex: none; }
.nf-rt-seg a { padding: 6px 12px; font-size: 13px; color: var(--muted-foreground); font-weight: 550; }
.nf-rt-seg a + a { border-left: 1px solid var(--border); }
.nf-rt-seg a:hover { color: var(--foreground); background: var(--muted); text-decoration: none; }
.nf-rt-seg a.on { background: var(--primary); color: var(--primary-foreground); }

/* ------------------------------------------------ «Вы на N месте» */
.nf-rt-me { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--radius-lg);
	border: 1px solid color-mix(in oklab, var(--rating) 40%, var(--border)); background: color-mix(in oklab, var(--rating) 8%, var(--card)); }
.nf-rt-me.is-out { border-color: var(--border); background: var(--card); }
.nf-rt-me > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nf-rt-me b { font-size: 14.5px; }
.nf-rt-me span { font-size: 12.5px; color: var(--muted-foreground); }
.nf-rt-me .nb-btn { flex: none; }
.nf-rt-me-ico { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 999px; background: var(--muted); color: var(--rt-gold-ink); }

/* ------------------------------------------------ подиум */
.nf-rt-podium { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.nf-rt-pod { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 14px 16px;
	border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); min-width: 0; --medal: var(--rt-silver); }
.nf-rt-pod.is-p1 { order: 2; padding-top: 30px; padding-bottom: 22px; --medal: var(--rt-gold);
	border-color: color-mix(in oklab, var(--rating) 45%, var(--border));
	background: linear-gradient(180deg, color-mix(in oklab, var(--rating) 13%, var(--card)) 0%, var(--card) 70%); box-shadow: var(--elev-2); }
.nf-rt-pod.is-p2 { order: 1; }
.nf-rt-pod.is-p3 { order: 3; --medal: var(--rt-bronze); }
.nf-rt-medal { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 3px;
	min-width: 30px; height: 26px; padding: 0 9px; border-radius: 999px; background: var(--medal); color: var(--background);
	font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; box-shadow: var(--elev-1); justify-content: center; }
.nf-rt-pod-cover { width: 96px; display: block; }
.nf-rt-pod.is-p1 .nf-rt-pod-cover { width: 118px; }
.nf-rt-pod-cover .nb-cover { box-shadow: var(--elev-2); }
.nf-rt-pod-cover .nb-cover .ph { font-size: 30px; }
.nf-rt-pod-ava { display: block; border-radius: 999px; box-shadow: 0 0 0 3px var(--medal), var(--elev-2); }
.nf-rt-pod-ava .nb-avatar { width: 72px !important; height: 72px !important; font-size: 28px !important; }
.nf-rt-pod.is-p1 .nf-rt-pod-ava .nb-avatar { width: 88px !important; height: 88px !important; font-size: 34px !important; }
.nf-rt-pod-title { font-weight: 700; font-size: 15px; line-height: 1.3; color: var(--foreground); max-width: 100%;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.nf-rt-pod-title:hover { text-decoration: none; color: var(--link); }
.nf-rt-pod-meta { font-size: 12px; color: var(--muted-foreground); display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.nf-rt-pod-score { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.nf-rt-pod-score b { font-size: 26px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.nf-rt-pod.is-p1 .nf-rt-pod-score b { font-size: 32px; color: var(--rt-gold-ink); }
.nf-rt-pod-score b .nb-rating { font-size: inherit; }
.nf-rt-pod-score small { color: var(--muted-foreground); font-size: 12px; }
.nf-rt-pod-facts { font-size: 12px; color: var(--muted-foreground); line-height: 1.45; }

/* ------------------------------------------------ список */
.nf-rt-list { list-style: none; margin: 0; padding: 6px; }
.nf-rt-row { display: grid; grid-template-columns: 52px 50px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); }
.nf-rt-row.is-person { grid-template-columns: 52px 44px minmax(0, 1fr) auto; }
.nf-rt-row + .nf-rt-row { border-top: 1px solid var(--border); }
.nf-rt-row:hover { background: var(--muted); }
.nf-rt-row.is-me, .nf-rt-row:target { background: color-mix(in oklab, var(--rating) 11%, transparent); }
.nf-rt-place { display: flex; flex-direction: column; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.nf-rt-place b { font-size: 18px; font-weight: 800; color: var(--muted-foreground); line-height: 1.1; }
.nf-rt-cover { display: block; width: 50px; }
.nf-rt-cover .nb-cover { border-radius: var(--radius); }
.nf-rt-cover .nb-cover .ph { font-size: 18px; }
.nf-rt-cover .nb-cover .ph small { display: none; }
.nf-rt-ava { display: block; line-height: 0; }
.nf-rt-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nf-rt-body .t { font-weight: 650; font-size: 15px; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; min-width: 0; }
.nf-rt-body a.t { display: block; }
.nf-rt-body .t a { color: var(--foreground); overflow: hidden; text-overflow: ellipsis; }
.nf-rt-body a.t:hover, .nf-rt-body .t a:hover { color: var(--link); text-decoration: none; }
.nf-rt-body .m { font-size: 12.5px; color: var(--muted-foreground); display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.nf-rt-body .f { font-size: 12px; color: var(--muted-foreground); }
.nf-rt-body .f .nb-rating svg, .nf-rt-pod-facts .nb-rating svg { width: 12px; height: 12px; }
.nf-rt-ready { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.nf-rt-ready .nb-progress { display: inline-block; width: 46px; height: 4px; }
.nf-rt-ready .nb-progress > i { background: var(--success); }
.nf-rt-score { text-align: right; min-width: 72px; display: flex; flex-direction: column; align-items: flex-end; }
.nf-rt-score b { font-size: 19px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nf-rt-score small { font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; }

/* ------------------------------------------------ фон строк и подиума: баннер тайтла или размытая обложка (Rating::rowArt)
 * Картинка лежит под содержимым (z-index: -1 внутри isolation) и вёрстку не двигает; сверху — градиент цвета карточки:
 * плотный под местом, обложкой и названием, к баллу справа прозрачнее (там баннер виден лучше всего), за баллом — мягкое
 * пятно. Текст поверх картинки — с ореолом цвета карточки, мелкие подписи чуть контрастнее обычного. */
.nf-rt-row.has-art, .nf-rt-pod.has-art { position: relative; isolation: isolate; }
.nf-rt-art { position: absolute; inset: 0; z-index: -1; overflow: hidden; border-radius: inherit; background: var(--card-solid); pointer-events: none; }
.nf-rt-art img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.nf-rt-art.is-cover img { left: -32px; top: -32px; width: calc(100% + 64px); height: calc(100% + 64px); object-position: 50% 35%; filter: blur(24px) saturate(1.4); opacity: .75; }
.nf-rt-art::after { content: ""; position: absolute; inset: 0; transition: opacity .2s ease; }
.nf-rt-row .nf-rt-art::after {
	background:
		radial-gradient(130px 85% at calc(100% - 52px) 50%, color-mix(in oklab, var(--card-solid) 55%, transparent), transparent),
		linear-gradient(90deg,
			var(--card-solid) 0%,
			color-mix(in oklab, var(--card-solid) 94%, transparent) 28%,
			color-mix(in oklab, var(--card-solid) 80%, transparent) 54%,
			color-mix(in oklab, var(--card-solid) 48%, transparent) 80%,
			color-mix(in oklab, var(--card-solid) 30%, transparent) 100%);
}
.nf-rt-row.has-art + .nf-rt-row, .nf-rt-row + .nf-rt-row.has-art { border-top: 0; margin-top: 5px; }	/* полосы с картинками не сливаются (без рамки: скругление фона совпадает со строкой) */
.nf-rt-row.has-art:hover .nf-rt-art::after { opacity: .9; }
.nf-rt-row.has-art:target { box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--rating) 70%, transparent); }
.nf-rt-row.has-art .nf-rt-body .t, .nf-rt-row.has-art .nf-rt-score { text-shadow: 0 0 2px var(--card-solid), 0 0 10px var(--card-solid); }
.nf-rt-row.has-art .nf-rt-body .m, .nf-rt-row.has-art .nf-rt-body .f, .nf-rt-row.has-art .nf-rt-score small { color: color-mix(in oklab, var(--foreground) 74%, transparent); }
/* подиум: баннер — верхней частью карточки (его пропорция ближе к баннеру — меньше обрезка), книзу уходит в цвет карточки */
.nf-rt-pod .nf-rt-art.is-banner img { height: 72%; }
.nf-rt-pod .nf-rt-art::after {
	background: linear-gradient(180deg,
		color-mix(in oklab, var(--card-solid) 28%, transparent) 0%,
		color-mix(in oklab, var(--card-solid) 52%, transparent) 26%,
		color-mix(in oklab, var(--card-solid) 86%, transparent) 50%,
		var(--card-solid) 70%);
}
.nf-rt-pod.is-p1 .nf-rt-art::after {
	background:
		linear-gradient(180deg, color-mix(in oklab, var(--rating) 16%, transparent) 0%, transparent 75%),
		linear-gradient(180deg,
			color-mix(in oklab, var(--card-solid) 28%, transparent) 0%,
			color-mix(in oklab, var(--card-solid) 52%, transparent) 26%,
			color-mix(in oklab, var(--card-solid) 86%, transparent) 50%,
			var(--card-solid) 70%);
}
.nf-rt-pod.has-art .nf-rt-pod-title { text-shadow: 0 0 2px var(--card-solid), 0 0 10px var(--card-solid); }
@media (prefers-reduced-transparency: reduce) { .nf-rt-art img { opacity: .45; } }
@media (prefers-contrast: more), (forced-colors: active), print { .nf-rt-art { display: none; } }

/* стрелки места */
.nf-rt-move { display: inline-flex; align-items: center; gap: 1px; font-size: 11px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.nf-rt-move.is-up { color: var(--success); }
.nf-rt-move.is-down { color: var(--destructive); }
.nf-rt-move.is-same { color: var(--muted-foreground); opacity: .6; }
.nf-rt-move.is-new { color: var(--rt-gold-ink); text-transform: uppercase; font-size: 9.5px; letter-spacing: .04em; }

/* роль участника */
.nf-rt-role { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--secondary); color: var(--foreground); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.nf-rt-role[data-role="translator"] { background: color-mix(in oklab, var(--translator) 16%, transparent); color: var(--translator); }
.nf-rt-role[data-role="critic"] { background: color-mix(in oklab, var(--rating) 18%, transparent); color: var(--rating-text); }
.nf-rt-role[data-role="commentator"] { background: color-mix(in oklab, var(--link) 14%, transparent); color: var(--link); }
.nf-rt-role[data-role="reader"] { background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); }

/* пагинация и подвал */
.nf-rt-pager { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin: 18px 0 0; }
.nf-rt-pager a, .nf-rt-pager span { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--border); color: var(--foreground); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.nf-rt-pager a:hover { background: var(--muted); text-decoration: none; }
.nf-rt-pager .is-active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); font-weight: 700; }
.nf-rt-pager .gap { border: 0; min-width: 16px; padding: 0; color: var(--muted-foreground); }
.nf-rt-foot { margin: 20px 0 0; font-size: 12.5px; color: var(--muted-foreground); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nf-rt-empty { margin-top: 6px; }

/* ------------------------------------------------ бейджи места */
.nf-rt-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; line-height: 1.5;
	background: var(--secondary); color: var(--foreground); white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: middle; }
.nf-rt-badge small { font-weight: 600; opacity: .75; font-size: 11px; }
a.nf-rt-badge:hover { text-decoration: none; background: var(--accent); color: var(--foreground); }
.nf-rt-badge.is-top10 { background: color-mix(in oklab, var(--rating) 14%, transparent); color: var(--rating-text); }
.nf-rt-badge.is-top1 { background: color-mix(in oklab, var(--rt-gold) 26%, transparent); color: var(--rt-gold-ink); }
.nf-rt-badge.is-top2 { background: color-mix(in oklab, var(--rt-silver) 26%, transparent); color: var(--foreground); }
.nf-rt-badge.is-top3 { background: color-mix(in oklab, var(--rt-bronze) 24%, transparent); color: var(--rt-bronze-ink); }

/* ------------------------------------------------ карточки (тайтл, профиль) */
.nf-rt-card .nf-rt-big { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.nf-rt-card .nf-rt-place-big { width: 58px; height: 58px; flex: none; border-radius: var(--radius-lg); display: grid; place-items: center; align-content: center;
	background: var(--muted); font-variant-numeric: tabular-nums; }
.nf-rt-card .nf-rt-place-big small { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.nf-rt-card .nf-rt-place-big b { font-size: 22px; font-weight: 800; line-height: 1.05; }
.nf-rt-card .nf-rt-place-big.is-top { background: color-mix(in oklab, var(--rating) 18%, transparent); color: var(--rt-gold-ink); }
.nf-rt-card .nf-rt-big-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted-foreground); }
.nf-rt-card .nf-rt-big-txt b { font-size: 17px; color: var(--foreground); font-variant-numeric: tabular-nums; }
.nf-rt-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.nf-rt-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; font-size: 12.5px; }
.nf-rt-bars li span { color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf-rt-bars li em { font-style: normal; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.nf-rt-bars li .nb-progress { grid-column: 1 / -1; height: 4px; }
.nf-rt-bars li .nb-progress > i { background: var(--rating); }
.nf-rt-bars li.is-pen .nb-progress > i { background: var(--destructive); }
.nf-rt-card .nf-rt-note { font-size: 12px; color: var(--muted-foreground); margin: 10px 0 0; line-height: 1.5; }
.nf-rt-card .nf-rt-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; }
.nf-rt-card .nf-rt-links a { display: inline-flex; align-items: center; gap: 4px; }
.nf-rt-card .nf-rt-roles { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.nf-rt-card .nf-rt-roles .nf-rt-role b { font-variant-numeric: tabular-nums; }
.nf-rt-card details summary { cursor: pointer; font-size: 12.5px; color: var(--muted-foreground); margin-top: 10px; }
.nf-rt-card details[open] summary { margin-bottom: 8px; }

/* ------------------------------------------------ «Как считается» */
.nf-rt-how { max-width: 900px; margin: 0 auto; }
.nf-rt-how section { margin: 0 0 30px; }
.nf-rt-how h2 { font-size: 21px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.nf-rt-how h3 { font-size: 16px; margin: 18px 0 8px; }
.nf-rt-how p, .nf-rt-how li { line-height: 1.6; }
.nf-rt-how .nf-rt-formula { contain: inline-size; font-family: var(--font-serif); font-size: 15.5px; padding: 12px 16px; border-left: 3px solid var(--rating); background: var(--muted); border-radius: 0 var(--radius) var(--radius) 0; margin: 10px 0 14px; overflow-x: auto; }
.nf-rt-how .nb-table-wrap { overflow-x: auto; contain: inline-size; }
.nf-rt-how table { width: 100%; }
.nf-rt-how td.num, .nf-rt-how th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nf-rt-how th.num { white-space: nowrap; }
.nf-rt-how td.num { min-width: 96px; max-width: 260px; }
.nf-rt-how td small { display: block; color: var(--muted-foreground); font-size: 12px; line-height: 1.45; margin-top: 2px; }
.nf-rt-how .nf-rt-toc { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 24px; }
.nf-rt-how .nf-rt-weightbar { display: inline-block; vertical-align: middle; width: 60px; height: 5px; margin-right: 6px; }
.nf-rt-how .nf-rt-weightbar > i { background: var(--rating); }

/* ------------------------------------------------ телефон */
@media (max-width: 720px) {
	.nf-rt-sub { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
	.nf-rt-sub::-webkit-scrollbar { display: none; }
	.nf-rt-sub .nb-chip { flex: none; }
	.nf-rt-podium { grid-template-columns: 1fr 1fr; gap: 20px 10px; align-items: stretch; }
	.nf-rt-pod.is-p1 { order: 0; grid-column: 1 / -1; }
	.nf-rt-pod.is-p2 { order: 1; }
	.nf-rt-pod.is-p3 { order: 2; }
	.nf-rt-pod { padding: 20px 10px 12px; }
	.nf-rt-pod-cover { width: 76px; }
	.nf-rt-pod.is-p1 .nf-rt-pod-cover { width: 96px; }
	.nf-rt-pod-score b { font-size: 21px; }
	.nf-rt-pod.is-p1 .nf-rt-pod-score b { font-size: 27px; }
	.nf-rt-list { padding: 4px; }
	.nf-rt-row { grid-template-columns: 34px 40px minmax(0, 1fr) auto; gap: 9px; padding: 9px 6px; }
	.nf-rt-row.is-person { grid-template-columns: 34px 36px minmax(0, 1fr) auto; }
	.nf-rt-row .nf-rt-ava .nb-avatar { width: 36px !important; height: 36px !important; font-size: 14px !important; }
	.nf-rt-cover { width: 40px; }
	.nf-rt-place b { font-size: 15px; }
	.nf-rt-body .t { font-size: 14px; }
	.nf-rt-body .f { display: none; }
	.nf-rt-score { min-width: 0; }
	.nf-rt-score b { font-size: 16px; }
	.nf-rt-tabs a { padding: 10px 8px; font-size: 14px; }
	.nf-rt-me { flex-wrap: wrap; }
	.nf-rt-me .nb-btn { margin-left: 48px; }
}
