:root {
	color-scheme: light dark;
	--missing: light-dark(#d4d4d8, #3f3f46);
	--present: light-dark(#2563eb, #3b82f6);
	--unique: light-dark(#d4a017, #eab308);
	--unique-text: light-dark(#a16207, #eab308);
	--error: light-dark(#b91c1c, #f87171);
	font-family: system-ui, sans-serif;
	line-height: 1.5;
}

[hidden] {
	/* biome-ignore lint/complexity/noImportantStyles: hidden doit l'emporter sur les display des composants. */
	display: none !important;
}

body {
	margin: 0;
	padding: 1rem;
}

main {
	max-width: 90em;
	margin-inline: auto;
}

button,
.button {
	display: inline-block;
	padding: 0.4rem 0.8rem;
	border: 1px solid currentColor;
	border-radius: 0.3rem;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

button:disabled {
	cursor: progress;
	opacity: 0.7;
}

.button:focus-within {
	outline: 2px solid var(--present);
}

/* Masqué visuellement mais toujours accessible au clavier. */
.button input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

svg {
	width: 1.25em;
	height: 1.25em;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.legend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem 0.6rem;
	font-size: 0.9rem;
}

.swatch {
	display: inline-block;
	width: 1rem;
	height: 0.6rem;
	border-radius: 0.2rem;
}

.swatch.missing {
	background: var(--missing);
}
.swatch.present {
	background: var(--present);
}
.swatch.unique {
	background: var(--unique);
}

#problems,
.error {
	color: var(--error);
}

/* Titre | barre | gain | action, colonnes partagées via subgrid avec la sous-vue des sources. */
.group {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 4.5rem 1.75rem;
	column-gap: 0.75rem;
	align-items: center;
	margin-top: 1rem;
}

.details,
.details > * {
	grid-column: 1 / -1;
}

.toggle {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.2rem 0;
	border: none;
	font-weight: 600;
	text-align: left;
}

/* Titre sur une ligne en vue repliée, en entier en vue dépliée. */
.toggle .name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.toggle[aria-expanded="true"] .name {
	white-space: normal;
	overflow-wrap: anywhere;
}

.toggle svg {
	transition: transform 0.15s;
}

.toggle[aria-expanded="true"] svg {
	transform: rotate(90deg);
}

.track {
	height: 0.9rem;
	border-radius: 0.2rem;
	background: var(--missing);
}

.group > .track,
.group > progress {
	grid-column: 2;
}

.gain {
	color: var(--unique-text);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.action {
	display: flex;
	justify-content: center;
}

.action button {
	display: flex;
	padding: 0.2rem;
	border: none;
}

.group > progress {
	width: 100%;
	height: 0.4rem;
}

.details {
	display: grid;
	grid-template-columns: subgrid;
}

/* Sous-vue : chemin sous le titre, barre sous celle du résultat. */
.details > .sources {
	grid-column: 1 / 3;
	display: grid;
	grid-template-columns: subgrid;
	row-gap: 0.3rem;
	align-items: center;
}

.details {
	padding: 0.3rem 0 0.5rem;
}

.hash {
	margin: 0 0 0.3rem 1.55rem;
	font-family: monospace;
	font-size: 0.8rem;
	overflow-wrap: anywhere;
	opacity: 0.7;
}

.path {
	padding-left: 1.55rem;
	overflow: hidden;
	font-size: 0.85rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.status {
	margin: 0.5rem 0 0 1.55rem;
	font-size: 0.9rem;
}
