* {
	box-sizing: border-box;
}

html {
	background: #e6ebf2;
}

body {
	margin: 0 auto;
	padding: 24px;
	max-width: 920px;
	min-height: 100vh;
	font-family: Arial, sans-serif;
	background: #ffffff;
	color: #1f2937;
	border-left: 1px solid #cbd5e1;
	border-right: 1px solid #cbd5e1;
	box-shadow:
		-12px 0 24px rgba(15, 23, 42, 0.08),
		12px 0 24px rgba(15, 23, 42, 0.08);
}

header {
	text-align: center;
	margin-top: 1em;
	margin-bottom: 2em;

	p.before-h1 {
		margin: 0;
		font-size: 0.8em;
	}

	h1 {
		text-align: center;
		font-size: 2.5em;
		margin: 0;
	}

	p.after-h1 {
		margin: 0;
		font-size: 2em;
	}
}

div {
	margin: 12px 0;
}

div.container {
	width: min(100%, 380px);
	margin: 0;
	border: 1px solid #d1d5db;
	border-radius: 12px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
	overflow: hidden;
	padding: 0;
	background: #ffffff;
}

.tables-row {
	display: flex;
	justify-content: center;
	gap: 40px;
	align-items: flex-start;
	flex-wrap: wrap;
}

.control-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.bottom-center {
	text-align: center;
}

.bottom-center .control-row {
	justify-content: center;
}

.small-input {
	width: 76px;
	padding: 7px 8px;
	border: 1px solid #94a3b8;
	border-radius: 8px;
	background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
	color: #0f172a;
	font-weight: 600;
	text-align: center;
}

.small-input:hover {
	border-color: #64748b;
	background: #ffffff;
}

.small-input:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.actions {
	display: flex;
	flex-direction: row;
	justify-content: center;
	text-align: center;
	margin: 0;
	padding: 8px 12px;
	background: #f8fafc;
	border-top: 1px solid #e5e7eb;
}

.table-caption {
	text-align: center;
	font-weight: 600;
	margin-bottom: 8px;
}

.container .table-caption {
	margin: 0;
	padding: 12px 16px;
	background: #f8fafc;
	border-bottom: 1px solid #e5e7eb;
	font-size: 0.95rem;
	letter-spacing: 0.01em;
	color: #374151;
}

.settings {
	margin-top: 16px;
	margin-left: auto;
	margin-right: auto;
	padding: 12px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	background: #f8fafc;
	width: fit-content;
}

.settings-table {
	width: 100%;
	border-collapse: collapse;
}

.settings-table th,
.settings-table td {
	padding: 8px 10px;
}

.settings-table th {
	width: 75%;
	text-align: left;
	font-weight: 500;
}

.settings-table td {
	text-align: right;
}

.settings-table .small-input {
	width: 88px;
}

.settings-actions {
	display: flex;
	justify-content: center;
	margin-top: 10px;

	button {
		background: grey;
		border: 0;
	}
}

button {
	margin: 5px;
	padding: 8px 12px;
	border: 1px solid #3f7f5f;
	border-radius: 8px;
	background: #4f9a70;
	color: #ffffff;
	font-weight: 600;
	cursor: pointer;
}

button:hover {
	background: #3f7f5f;
	border-color: #3f7f5f;
}

button:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(79, 154, 112, 0.35);
}

.btn-clear {
	border-color: #5f8f74;
	border-width: 2px;
	background: #ffffff;
	color: #2f6a49;
}

.btn-clear:hover {
	border-color: #3f7f5f;
	background: #ecf7f0;
}

.btn-clear:focus-visible {
	box-shadow: 0 0 0 3px rgba(95, 143, 116, 0.3);
}

.xtable {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
	margin-top: 0;
}

.xtable th,
.xtable td {
	padding: 4px 3px;
	text-align: center;
}

.xtable th:first-child,
.xtable td:first-child {
	width: 32px;
}

.xtable th {
	background: #64748b;
	color: #ffffff;
	font-size: 1.1em;
	letter-spacing: 0.03em;
	height: 2em;
}

.xtable tbody tr:nth-child(odd) td {
	background: #f8fafc;
}

.xtable tbody tr:nth-child(even) td {
	background: #eef2f7;
}

.xtable input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	width: 28px;
	height: 28px;
	margin: 0;
	border: 2px solid #afafaf;
	border-radius: 6px;
	background: #ffffff;
	color: #afafaf;
	cursor: pointer;
	position: relative;
	vertical-align: middle;
	overflow: hidden;

	&:hover {
		border-color: #818181;
	}
}

.xtable input[type="checkbox"]:checked {
	border-color: #5a5a5a;
	background: #dbeafe;
	color: #5a5a5a;
}

.xtable input[type="checkbox"]:checked::before,
.xtable input[type="checkbox"]:checked::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: calc(100% + 8px);
	height: 3px;
	background: currentColor;
	border-radius: 999px;
	transform-origin: center;
}

.xtable input[type="checkbox"]:checked::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.xtable input[type="checkbox"]:checked::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.xtable input[type="checkbox"]:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 1px;
}

.xtable input[type="checkbox"].match,
.xtable input[type="checkbox"].match:checked {
	background: #bbf7d0;
	border-color: #22c55e;
	color: #22c55e;
}

.xtable input[type="checkbox"].mismatch,
.xtable input[type="checkbox"].mismatch:checked {
	background: #fecaca;
	border-color: #ef4444;
	color: #ef4444;
}

#result {
	font-size: 1.1rem;
	font-weight: 700;
	padding: 10px 12px;
	border-radius: 8px;
	background: #e0f2fe;
	display: inline-block;
}

@media (max-width: 900px) {
	.tables-row {
		gap: 12px;
	}

	div.container {
		width: 100%;
	}
}

@media (pointer: coarse) {
	.xtable td {
		-webkit-user-select: none;
		user-select: none;
	}

	.xtable input[type="checkbox"] {
		-webkit-tap-highlight-color: transparent;
	}
}