html,
body {
  height: 100%;
}

html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

body {
	font-size: 16px;
	line-height: 1.5;
	background-color: #e7dfd6;
	color: #444;
	font-family: 'Mali', sans-serif;
	accent-color: #b9946c;
}

.wrapper {
	width: 90%;
	max-width: 560px;
	margin: 0 auto;
}

.page {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 3em;
	min-height: 100vh;
	padding: 2em 0;
}

.word-list.show + .page {
	filter: blur(2px);
	pointer-events: none;
}

button,
input[type="submit"],
input[type="button"],
.button {
	cursor: pointer;
}

em[title] {
	text-decoration: underline dotted 1px;
	cursor: help;
}

h1,
h2,
.intro {
	text-align: center;
}

h1 {
	position: relative;
	margin: 0;
	font-size: 3em;
	font-weight: 300;
	line-height: 1;
}

h1 a {
	color: inherit;
	text-decoration: none;
}

h1 .author {
	position: absolute;
	top: 0.9em;
	font-size: 0.2em;
	font-weight: normal;
}

h2 {
	margin: 0;
	font-size: 1.5em;
	font-weight: normal;
	line-height: 1;
}

.intro {
	margin-bottom: 0;
}

form {
	display: flex;
	flex-direction: column;
	gap: 1.5em;
	padding: 2em;
	border-radius: 3px;
	box-shadow: 0 40px 60px #cfbfaf;
	border: 1px solid #eee8e2;
	/* background-color: #d3cdc6; */
}

fieldset {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	margin: 0;
	padding: 0;
	border: none;
}

legend {
	margin-bottom: 0.5em;
	font-weight: bold;
}

.languages {
	display: flex;
	gap: 1em;
	flex-wrap: wrap;
}

.filters fieldset,
.languages fieldset {
	flex: 1 1 max-content;
	gap: 1em;
	padding: 0.4em 1em 1em;
	border-radius: 3px;
	background-color: #fff;
}

.filters legend,
.languages legend {
	position: relative;
	left: 0;
	margin: 0;
	padding: 0.3em 0.7em;
	border-radius: 3px;
	background-color: #fff;
}

.checkboxes label {
	cursor: pointer;
}

.checkboxes label input {
	display: none;
}

.checkboxes label span {
	display: block;
	position: relative;
	min-height: 2em;
	padding: 0.3em 0.5em 0.4em 2.3em;
	border: 1px solid #b9946c;
	border-radius: 3px;
	line-height: 1.2;
}

.checkboxes legend label span {
	display: inline-block;
	border: none;
}

.checkboxes label span::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 1.8em;
	height: 100%;
	border-right: 1px solid #b9946c;
	border-radius: 2px 0 0 2px;
}

.checkboxes label input:checked + span::before {
	background-color: #b9946c;
}

.checkboxes label span::after {
	content: '';
	position: absolute;
	top: 7px;
	left: 10px;
	width: 7px;
	height: 14px;
	border: 2px solid #eee2d4;
	border-top: none;
	border-left: none;
	border-width: 3px;
	transform: rotate(45deg);
}

.checkboxes label input:checked + span::after {
	border-color: #fff;
}

.checkboxes label.small span {
	min-height: inherit;
	padding: 0;
}

.checkboxes label.small span::before {
	display: inline-block;
	position: relative;
	width: 13px;
	height: 13px;
	border: 1px solid #b9946c;
	border-radius: 3px;
}

.checkboxes label.small span::after {
	position: absolute;
	top: 5px;
	left: 4px;
	border-width: 2px;
	width: 5px;
	height: 8px;
}

.checkboxes label span sup {
	font-size: 0.65em;
}

.filters-container {
	width: min-content;
	padding: 0.5em;
	border: 1px solid #c4aa8d;
	border-radius: 3px;
}

.filters-container.open {
	width: auto;
	padding: 1em 1.2em;
}

.filters-container.empty {
	display: none;
}

.filters-toggle {
	display: block;
	width: 100%;
	padding: 0;
	border: none;
	background: none;
	text-align: inherit;
	color: #a08363;
	white-space: nowrap;
}

.filters-toggle::before {
	content: '\203A';
	display: inline-block;
	margin-right: 0.3em;
	transform: rotate(90deg);
}

.filters-container.open .filters-toggle::before {
	transform: rotate(-90deg);
}

.filters {
	display: none;
	flex-wrap: wrap;
	gap: 1em;
	margin-top: 1em;
}

.filters-container.open .filters {
	display: flex;
	flex-direction: column;
}

.filters fieldset legend {
	margin-bottom: 0.2em;
}

.list-options label {
	flex: 1 1 9em;
}

.list-options label span {
	display: block;
	margin-bottom: 0.3em;
}

.list-options input {
	width: 100%;
	max-width: 100%;
	padding: 0.8em 1em;
	border: none;
	border-radius: 3px;
}

.list-options input[name="seed"] {
	text-transform: uppercase;
}

.pre-results {
	text-align: center;
}

.refreshing .pre-results {
	opacity: 0.5;
	transition: all 0.5s;
}

.action-buttons {
	display: flex;
	gap: 0.5em;
}

.action-buttons button {
	border: 1px solid #444;
	border-radius: 3px;
	background-color: #444;
	color: #fff;
}

.share {
	padding: 0.5em 1em;
}

.share svg {
	display: block;
	width: auto;
	height: 1.5em;
}

.submit {
	flex: 1;
	padding: 1em;
	font-weight: bold;
	text-transform: uppercase;
}

.submit[disabled] {
	opacity: 0.5;
	pointer-events: none;
}

.refreshing .submit {
	background: none;
	transition: all 0.5s;
	color: #444;
}

.refreshing .submit::before {
	content: '';
	display: inline-block;
	width: 0.7em;
	height: 0.7em;
	margin-right: 0.5em;
	border: 2px solid;
	border-left: none;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0); }
	100% { transform: rotate(360deg); }
}

footer {
	font-weight: 300;
	text-align: center;
	font-size: 0.85em;
}

footer a {
	color: inherit;
}


.word-list {
	display: none;
	position: fixed;
	z-index: 2;
	top: 44%;
	left: 50%;
	width: 90%;
	max-width: 560px;
	border-radius: 3px;
	box-shadow: 0 0 0 800px #e7dfd6, 0 0 60px rgba(0,0,0,0.2);
	background-color: #fff;
	transform: translate(-50%, -50%);
}

.word-list.show {
	display: block;
}

.word-list .close {
	position: absolute;
	bottom: 100%;
	padding: 0;
	border: none;
	background: none;
	color: #9e876d;
	right: 0;
	font-size: 3em;
	line-height: 0.9;
}

.word-list-page-title {
	position: absolute;
	bottom: 100%;
	padding-bottom: 0.4em;
	font-size: 0.9em;
	color: #9e876d;
}

.word-list-inner {
	overflow-y: auto;
	max-height: calc(100vh - 8em);
	padding: 1em 2em 1em;
}

.word-list .words {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 2em;
	text-align: center;
}

.word-list .words li {
	position: relative;
	margin: 0.3em 0 0;
	padding: 0.2em 1em 0;
	border-top: 1px solid #ecece2;
}

.word-list .words li:first-child {
	margin-top: 0;
	padding-top: 0;
	border: none;
}

.word-list .words .word {
	margin: 0 auto;
}

.word-list.hide-words .words .word-details,
.word-list.hide-words .words .word {
	filter: blur(10px);
	font-weight: bold;
}

.word-list .words .number {
	opacity: 0.4;
	position: absolute;
	left: 0;
	top: 50%;
	margin-top: -1ex;
	font-size: 0.6em;
	font-weight: 300;
}

.word-list .words .number::after {
	content: '.';
}

.word-list .words .word-details {
	display: none;
	font-size: 0.47em;
	font-weight: 300;
}

.word-list.show-details .word-details {
	display: block;
}

.word-list .words .word-tags:not(:empty)::before {
	content: ' ' '\2022' ' ';
}

.word-list nav {
	display: flex;
	gap: 1em;
	flex-wrap: wrap;
	position: absolute;
	top: 100%;
	width: 100%;
	padding-top: 1em;
}

.word-list nav button {
	flex: 1 1 max-content;
	padding: 1em 0.5em;
	border: 1px solid #9e876d61;
	border-radius: 3px;
	background: none;
	color: #9e876d;
}

.word-list.hide-words .toggle-words {
	border-color: #9e876d;
	box-shadow: 0 0 0 1px #9e876d;
}

.word-list.hide-words .toggle-words span:first-of-type,
.word-list .toggle-words span:last-of-type {
	display: none;
}

.word-list.hide-words .toggle-words span:last-of-type {
	display: inline;
}

@media (max-width: 600px) {
	form {
		padding: 0;
		border: none;
		box-shadow: none;
	}

	.filters-container.open {
		padding: 0 0 0 1em;
		border: none;
		border-left: 2px solid #c4aa8d;
		border-radius: 0;
	}

	.action-buttons {
		position: sticky;
		bottom: 0;
		left: 0;
		width: 100%;
		gap: 5px;
		padding: 5px 0;
		background-color: #e7dfd6;
	}
}

@media (max-width: 360px) {
	.word-list .prev-page span,
	.word-list .next-page span {
		display: none;
	}
}
