*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
	background: #fff;
	color: #1a1a1a;
	min-height: 100vh;
	display: flex;
	justify-content: center;
	padding: 2.5rem 1.25rem;
}

.container {
	width: 100%;
	max-width: 620px;
	min-height: calc(100vh - 5rem);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
}

.page-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	width: 100%;
}

h1 {
	color: #1a1a1a;
	font-size: 1.65rem;
	font-weight: 700;
	letter-spacing: -.02em;
}

.home-link {
	font-size: .75rem;
	color: #bbb;
	text-decoration: none;
	flex-shrink: 0;
}

.home-link:hover {
	color: #888;
}

/* --- Intro --- */
#intro {
	color: #999;
	font-size: .9rem;
	line-height: 1.5;
	width: 100%;
	margin-top: -.5rem;
}

/* --- Input sections --- */
.input-section {
	width: 100%;
}

.input-section label {
	display: block;
	color: #888;
	font-size: .7rem;
	font-weight: 600;
	margin-bottom: .35rem;
	text-transform: uppercase;
	letter-spacing: .08em;
}

.input-section .hint {
	font-weight: 400;
	opacity: .5;
	text-transform: none;
	letter-spacing: 0;
}

.input-section input {
	width: 100%;
	max-width: 360px;
	padding: .6rem .75rem;
	font-size: 1.75rem;
	font-family: inherit;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #fff;
	color: #1a1a1a;
	text-transform: uppercase;
	letter-spacing: .12em;
	outline: none;
	transition: border-color .2s;
}

.input-section input::placeholder {
	color: #ccc;
}

.input-section input:focus {
	border-color: #1a1a1a;
	box-shadow: none;
}

/* --- Tile section --- */
.tile-section {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: .75rem;
}

.tile-rack {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: left;
	min-height: 64px;
	padding: .5rem;
	background: #f7f7f7;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	width: 100%;
	align-self: stretch;
}

.tile-toolbar {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: .75rem;
	width: 100%;
	align-self: stretch;
}

.tile-toolbar .input-section--contains {
	flex: 1;
	min-width: 0;
	max-width: 200px;
}

.tile-toolbar .input-section--contains input {
	font-size: 1.1rem;
	max-width: 100%;
	padding: .35rem .5rem;
}

.tile-toolbar .input-section--contains label {
	font-size: .65rem;
}

.tile-toolbar-buttons {
	display: flex;
	gap: .5rem;
	align-items: flex-end;
	flex-shrink: 0;
}

/* --- Tile --- */
.tile {
	position: relative;
	width: 54px;
	height: 54px;
	background: linear-gradient(160deg, #f2e4c5, #e4d2a4);
	border: 2px solid #c9b07a;
	border-radius: 5px;
	box-shadow:
		0 1px 3px rgba(0,0,0,.15),
		inset 0 1px 0 rgba(255,255,255,.5);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	user-select: none;
	transition: transform .1s, box-shadow .15s;
	font-size: 1.5rem;
	font-weight: 700;
	color: #2a1800;
	text-transform: uppercase;
}

.tile:hover {
	transform: translateY(-2px);
	box-shadow:
		0 3px 8px rgba(0,0,0,.18),
		inset 0 1px 0 rgba(255,255,255,.5);
}

.tile .tile-letter {
	line-height: 1;
}

.tile .tile-points {
	position: absolute;
	bottom: 2px;
	right: 4px;
	font-size: .55rem;
	font-weight: 600;
	color: #8a7040;
}

.tile .tile-actions {
	position: absolute;
	top: -8px;
	right: -8px;
	display: none;
	gap: 2px;
}

.tile:hover .tile-actions {
	display: flex;
}

.tile-action-btn {
	width: 18px;
	height: 18px;
	border: none;
	border-radius: 50%;
	font-size: .6rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.tile-action-btn.clear-btn {
	background: #c9b07a;
	color: #fff;
}

.tile-action-btn.remove-btn {
	background: #c44;
	color: #fff;
}

.tile-action-btn:hover {
	opacity: .8;
}

/* Search blurb */
.search-blurb {
	width: 100%;
	color: #999;
	font-size: .85rem;
	font-style: italic;
	line-height: 1.5;
	padding: .5rem 0;
	background: none;
	border-radius: 0;
	border-top: 1px solid #eee;
}

/* Board (extra) tiles */
.tile.board-tile {
	background: linear-gradient(160deg, #d2e2d8, #b8d0c0);
	border-color: #88a890;
}

.tile.board-tile .tile-points {
	color: #5a7a62;
}

/* Blank tile */
.tile.blank-tile {
	color: #bbb;
	font-style: italic;
}

/* Dragging */
.tile.dragging {
	opacity: .3;
	transform: scale(.95);
}

.tile.drag-over {
	border-color: #1a1a1a;
	box-shadow: 0 0 0 2px rgba(26,26,26,.15);
}

/* Tile editing */
.tile.editing {
	border-color: #1a1a1a;
	box-shadow: 0 0 0 2px rgba(26,26,26,.12);
}

.tile .tile-input {
	width: 100%;
	height: 100%;
	border: none;
	background: transparent;
	text-align: center;
	font-size: 1.6rem;
	font-weight: 700;
	color: #2a1800;
	text-transform: uppercase;
	outline: none;
	caret-color: #1a1a1a;
}

/* --- Buttons --- */
.btn {
	border: none;
	border-radius: 6px;
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s, transform .1s, opacity .15s;
}

.btn:active {
	transform: scale(.97);
}

.btn-clear {
	padding: .45rem .75rem;
	font-size: .75rem;
	background: transparent;
	color: #aaa;
	border: 1px solid #ddd;
}

.btn-clear:hover {
	color: #666;
	border-color: #aaa;
}

.btn-add {
	padding: .45rem 1rem;
	font-size: .75rem;
	background: #fff;
	color: #666;
	border: 1px solid #ddd;
}

.btn-add:hover {
	background: #f5f5f5;
	color: #333;
}

.btn-search {
	padding: .65rem 2rem;
	font-size: .95rem;
	background: #1a1a1a;
	color: #fff;
	letter-spacing: .04em;
	align-self: flex-end;
}

.btn-search:hover {
	background: #333;
}

/* --- Results --- */
.results-section {
	width: 100%;
}

.results-section h2 {
	color: #999;
	font-size: .75rem;
	font-weight: 600;
	margin-bottom: .75rem;
	text-transform: uppercase;
	letter-spacing: .08em;
}

.results-group {
	margin-bottom: 1rem;
}

.results-group-header {
	color: #000;
	font-size: .7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	padding: .5rem 0 .3rem;
	border-bottom: 1px solid #eee;
}

.results-list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	padding-top: 6px;
}

.results-list li {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	padding: .45rem .75rem;
	background: #fafafa;
	border: 1px solid #eee;
	border-radius: 5px;
	font-size: 1rem;
	margin: 2px;
	min-width: calc(var(--word-chars) * 1ch + 4.5rem);
}

.results-list .word {
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #1a1a1a;
}

.results-list .word span {
	display: inline;
}

.results-list .letter-locked {
	text-decoration: underline;
	text-decoration-color: #c9b07a;
	text-underline-offset: 3px;
	text-decoration-thickness: 2px;
}

.results-list .letter-blank {
	/* color: #bbb; */
	color: deeppink;
}

.results-list .letter-board {
	color: #5a9a68;
}

.results-list .score {
	font-size: .8rem;
	color: #aaa;
	font-weight: 600;
	white-space: nowrap;
}

.results-empty {
	color: #999;
	font-size: .9rem;
	font-style: italic;
	padding: .75rem 0;
	line-height: 1.5;
}

/* Responsive */
@media (max-width: 480px) {
	.tile {
		width: 40px;
		height: 42px;
		font-size: 1.4rem;
	}

	.tile .tile-input {
		font-size: 1.2rem;
	}

	h1 {
		font-size: 1.35rem;
	}

	.tile-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.tile-toolbar .input-section--contains {
		max-width: 100%;
	}

	.tile-toolbar-buttons {
		justify-content: flex-end;
	}

	.tile .tile-actions {
		display: flex;
	}

	.results-list {
		flex-direction: column;
		flex-wrap: nowrap;
	}

	.results-list li {
		justify-content: space-between;
		min-width: 0;
	}
}

#results-wrapper {
	flex-grow: 1;
	width: 100%;
}

footer {
	margin-top: auto;
	padding-top: 3rem;
}

footer p {
	color: #ccc;
	font-size: .65rem;
	line-height: 1.6;
}
