/* A neutral for text, surfaces and bar tracks, blue for links, and four status steps for the bars and result squares
   (render.mjs standing()); dark mode takes a softer green, which also stands further from the red for colorblind
   readers. Three type sizes: 20, 16, 14. */
:root {
	color-scheme: light dark;
	--bg: #ffffff;
	--panel: #f3f3f1;
	--ink: #1c1c1c;
	--track: #dededa;
	--link: #1f6fcc;
	--mark: rgba(196, 43, 43, 0.2);
	--good: #0aac23;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	background: var(--bg);
	color: var(--ink);
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #191919;
		--panel: #242424;
		--ink: #ececec;
		--track: #3a3a3a;
		--link: #6aabf1;
		--mark: rgba(220, 60, 61, 0.4);
		--good: #3daa52;
	}
}

/* (the footer sits at the bottom of a short page) */
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
header, main, footer { box-sizing: border-box; width: 100%; max-width: 1008px; margin: 0 auto; padding: 0 24px; }
main { flex: 1 0 auto; }
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 24px; }
main { padding-top: 32px; padding-bottom: 48px; }
footer { padding-bottom: 32px; font-size: 14px; }

a { color: var(--link); text-underline-offset: 3px; }
p { margin: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }

.site { font-size: 16px; font-weight: 700; margin: 0; color: var(--ink); text-decoration: none; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 4px 12px; border-radius: 6px; text-decoration: none; font-weight: 700; }
.tabs a[aria-current="page"] { background: var(--link); color: var(--bg); }

.crumbs ol { display: flex; flex-wrap: wrap; align-items: baseline; }
.crumbs li + li::before { content: "\203A"; padding: 0 8px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* A row is the name, the bar, the share and N / M; the bars line up down a list. */
.row {
	display: grid;
	grid-template-columns: minmax(10ch, 16rem) minmax(4rem, 1fr) 5ch var(--count, 12ch);
	align-items: center;
	gap: 16px;
	padding: 10px 12px;
	border-radius: 6px;
	color: var(--ink);
}
.row .name { margin: 0; font-size: inherit; overflow-wrap: break-word; min-width: 0; }
.row .share { font-weight: 700; text-align: right; }
.row .count { text-align: right; white-space: nowrap; }
.row .share, .row .count { font-variant-numeric: tabular-nums; }
.row .note { grid-column: 2 / -1; }
.row > .name:only-child { grid-column: 1 / -1; }
/* A case that matches or not as a whole: a red square where it differs, as on a results page. */
.row .differs, .fold .matches { display: inline-block; width: 12px; height: 12px; border-radius: 2px; background: #c42b2b; }
.row .differs { grid-column: -2; justify-self: end; }
.row:has(> .differs) > .name { grid-column: 1 / -2; }
.fold .matches { background: var(--good); margin-left: 12px; vertical-align: -1px; }
a.row { text-decoration: none; }
a.row .name { color: var(--link); }
a.row:hover { background: var(--panel); }
a.row:focus-visible, summary.row:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.own { margin: 16px 0 8px; }
.own .row { padding-left: 0; padding-right: 0; }
.own .name { font-size: 20px; font-weight: 700; line-height: 1.3; }
.rule { font-size: 14px; margin: 0 0 24px; }
.rows { margin: 16px -12px 0; }

.bar { display: block; height: 10px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; min-width: 4px; border-radius: 0 4px 4px 0; }
/* A bar's standing (render.mjs STANDING_COLORS): the same four steps in light and dark. */
.bar.good > span { background: var(--good); }
.bar.warning > span { background: #fbc531; }
.bar.serious > span { background: #f07a2a; }
.bar.critical > span { background: #c42b2b; }

/* A group's cases: the ones that differ in two columns, then the matching ones folded into one row. */
.cases { font-size: 14px; columns: 2 20rem; column-gap: 32px; margin: 0 -8px; }
.cases li { break-inside: avoid; }
.cases .row { grid-template-columns: minmax(12ch, 1fr) 4.5rem 5ch var(--count, 9ch); gap: 12px; padding: 4px 8px; }
.cases .bar { height: 6px; }
.more { font-size: 14px; padding: 4px 0; }
.fold { margin-top: 16px; }
.fold > .row, .fold.row { display: block; margin: 0 -12px; }
summary.row { cursor: pointer; list-style: none; }
summary.row::-webkit-details-marker { display: none; }
summary.row .name::before { content: "+"; display: inline-block; width: 1.25em; font-weight: 700; }
details[open] > summary.row .name::before { content: "\2212"; }
summary.row .name { color: var(--link); }
summary.row:hover { background: var(--panel); }
.names { font-size: 14px; columns: 14rem; column-gap: 32px; padding: 4px 0 8px 1.25em; }
.names li { break-inside: avoid; padding: 2px 0; overflow-wrap: break-word; }
.names a, .cases a { text-decoration: none; }

/* A case's results: one square per result, in order. */
.results { display: flex; flex-wrap: wrap; gap: 2px; margin: 24px 0 16px; }
.results > * { display: block; width: 12px; height: 12px; border-radius: 2px; background: var(--good); }
.results > a { background: #c42b2b; }
.results > *:hover, .results > .picked { outline: 2px solid var(--ink); outline-offset: 1px; }
.readout { display: block; font-size: 14px; padding: 8px 12px; margin-bottom: 16px; background: var(--panel); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.readout:empty { display: none; }

/* Roblox's line beside the engine's, for each result that differs. */
.pairs { width: calc(100% + 8px); margin: 8px -4px 0; border-collapse: separate; border-spacing: 4px; table-layout: fixed; font-size: 14px; }
.pairs th { text-align: left; font-weight: 700; padding: 0 12px; }
.pairs td { background: var(--panel); padding: 8px 12px; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; }
.pairs td:first-child { border-radius: 6px 0 0 6px; }
.pairs td:last-child { border-radius: 0 6px 6px 0; }
.pairs tr:target td { background: var(--track); }
/* (the differing words: grey in Roblox's line, red in the engine's) */
mark { background: var(--mark); color: inherit; border-radius: 2px; }
.pairs td:first-child mark { background: var(--track); }
.source { font-size: 14px; margin-top: 24px; overflow-wrap: anywhere; }

@media (max-width: 640px) {
	header, main, footer { padding-left: 16px; padding-right: 16px; }
	header { padding-top: 16px; }
	main { padding-top: 24px; }
	.row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 12px; }
	.row .bar { grid-column: 1 / -1; grid-row: 2; }
	.row .note { grid-column: 2 / -1; }
	.cases .row { grid-template-columns: minmax(12ch, 1fr) 3rem 5ch var(--count, 9ch); gap: 8px; }
	.cases .row .bar { grid-column: auto; grid-row: auto; }
	.pairs, .pairs tbody, .pairs tr, .pairs td { display: block; width: auto; margin: 0; }
	.pairs thead { display: none; }
	.pairs tr { margin-bottom: 8px; }
	.pairs td { border-radius: 0; }
	.pairs td + td { margin-top: 2px; }
	.pairs td:first-child { border-radius: 6px 6px 0 0; }
	.pairs td:last-child { border-radius: 0 0 6px 6px; }
	.pairs td { position: relative; padding-left: calc(20px + 4em); min-height: 1.5em; }
	.pairs td::before { content: attr(data-side); position: absolute; left: 12px; font-weight: 700; }
}
