:root {
	color-scheme: light dark;
	--bg: #f6f6f6;
	--fg: #1a1a1a;
	--muted: #666;
	--border: #ccc;
	--input: #fff;
	--btn: #1a1a1a;
	--btn-fg: #fff;
	--row: transparent;
	--row-alt: color-mix(in srgb, var(--fg) 4%, transparent);
	--accent: #017ea8;
	--accent-hover: #0693c6;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #121212;
		--fg: #e8e8e8;
		--muted: #999;
		--border: #333;
		--input: #1c1c1c;
		--btn: #e8e8e8;
		--btn-fg: #121212;
		--accent: #71c5e0;
		--accent-hover: #b4e1f2;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	font-family: ui-sans-serif, sans-serif;
	font-size: 1rem;
	font-weight: 300;
	line-height: 1.45;
	background: var(--bg);
	color: var(--fg);
}

main {
	max-width: 52rem;
	width: 100%;
	margin: 0 auto;
	padding: 2rem 1rem 1rem;
	flex: 1 0 auto;
}

h1 {
	margin: 0 0 1rem;
	font-size: 1.25rem;
	font-weight: 600;
}

form {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

@media (max-width: 36rem) {
	form {
		flex-direction: column;
	}

	form > input {
		flex: none;
		width: 100%;
	}

	form > button {
		align-self: center;
		margin-top: 0.5rem;
	}
}

input {
	flex: 1 1 16rem;
	min-width: 0;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 4px;
	background: var(--input);
	color: var(--fg);
	font: inherit;
}

button {
	padding: 0.55rem 0.9rem;
	border: 1px solid var(--border);
	border-radius: 4px;
	background: var(--btn);
	color: var(--btn-fg);
	font: inherit;
	line-height: inherit;
	cursor: pointer;
}

button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

a {
	color: var(--accent);
	text-decoration: underline;
	text-underline-offset: 0.1em;
}

a:hover {
	color: var(--accent-hover);
}

#status {
	margin: 0.85rem 0 0;
	color: var(--muted);
}

#status[data-error="true"] {
	color: #c0392b;
}

@media (prefers-color-scheme: dark) {
	#status[data-error="true"] {
		color: #ff8a80;
	}
}

#results {
	margin-top: 1.5rem;
}

.results-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.75rem;
}

.meta {
	display: grid;
	gap: 0.25rem;
	min-width: 0;
	flex: 1 1 auto;
	color: var(--muted);
}

.meta strong {
	color: var(--fg);
	font-weight: 500;
}

.toolbar {
	display: flex;
	flex-shrink: 0;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: flex-end;
	align-items: center;
}

@media (max-width: 36rem) {
	.results-header {
		flex-direction: column;
		align-items: stretch;
	}

	.toolbar {
		justify-content: center;
	}
}

.toolbar a {
	padding: 0.55rem 0.9rem;
	font: inherit;
	line-height: inherit;
	text-decoration: underline;
	text-underline-offset: 0.1em;
}

table {
	width: 100%;
	min-width: 32rem;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 0 -0.25rem;
	padding: 0 0.25rem;
}

th,
td {
	padding: 0.45rem 0.5rem;
	border-bottom: 1px solid var(--border);
	text-align: left;
	vertical-align: top;
}

th {
	font-weight: 500;
	color: var(--muted);
}

tbody tr:nth-child(even) {
	background: var(--row-alt);
}

td:first-child,
th:first-child {
	width: 2.5rem;
	color: var(--muted);
}

td.isrc {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	white-space: nowrap;
}

td.duration {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	color: var(--muted);
}

td.links {
	white-space: nowrap;
	text-align: right;
	font-weight: 300;
}

td.links a {
	color: var(--muted);
	margin-left: 0.65rem;
}

td.links a:first-child {
	margin-left: 0;
}

td.links a:hover {
	color: var(--fg);
}

footer {
	padding: 1rem 1rem 2.5rem;
	text-align: center;
	flex-shrink: 0;
}

footer a {
	color: var(--muted);
	text-decoration: none;
}

footer a:hover {
	color: var(--fg);
}

#copy-dialog {
	width: min(36rem, calc(100vw - 2rem));
	max-height: calc(100vh - 2rem);
	padding: 1rem;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--bg);
	color: var(--fg);
}

#copy-dialog::backdrop {
	background: color-mix(in srgb, #000 45%, transparent);
}

#copy-dialog-hint {
	margin: 0 0 0.6rem;
	color: var(--muted);
}

#copy-dialog-text {
	display: block;
	width: 100%;
	max-height: min(50vh, 20rem);
	margin: 0 0 0.75rem;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 4px;
	background: var(--input);
	color: var(--fg);
	font: inherit;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.85rem;
	line-height: 1.4;
	resize: vertical;
	overflow: auto;
}

#copy-dialog form {
	display: flex;
	justify-content: flex-end;
}
