:root {
	color-scheme: light;
	--paper: #fffef8;
	--ink: #1c1917;
	--muted: #57534e;
	--line: #d6d3d1;
	--panel: #ffffff;
	--accent: #9a3412;
	--accent-ink: #fffef8;
	--soft: #f4f1ea;
}

* {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--soft);
	color: var(--ink);
	font: 400 16px/1.45 system-ui, sans-serif;
}

button,
input {
	font: inherit;
}

button {
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid var(--ink);
	border-radius: 6px;
	background: var(--panel);
	color: var(--ink);
	cursor: pointer;
}

button:focus-visible,
input:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

button[aria-pressed="true"] {
	background: var(--ink);
	color: var(--paper);
}

.top,
.layout {
	width: min(1100px, calc(100% - 32px));
	margin-inline: auto;
}

.top {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	align-items: end;
	padding: 24px 0 16px;
}

h1,
h2,
p {
	margin: 0;
}

h1 {
	font-size: 28px;
	font-weight: 500;
	letter-spacing: 0;
}

h2 {
	font-size: 16px;
	font-weight: 500;
	margin-bottom: 8px;
}

.lede,
#status {
	color: var(--muted);
}

#status {
	max-width: 360px;
	text-align: right;
}

.layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 280px;
	gap: 16px;
	padding-bottom: 32px;
}

.board-panel,
.side {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.side {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 16px;
}

.prompt {
	font-size: 28px;
	font-weight: 500;
}

.stage {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	min-height: 240px;
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: 8px;
	touch-action: none;
	overflow: hidden;
}

.stage canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.tools {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.tool-row,
.colors,
.guess-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.swatch {
	width: 44px;
	padding: 0;
	border-radius: 50%;
}

.swatch[data-color="#1c1917"] { background: #1c1917; }
.swatch[data-color="#b91c1c"] { background: #b91c1c; }
.swatch[data-color="#1d4ed8"] { background: #1d4ed8; }
.swatch[data-color="#15803d"] { background: #15803d; }
.swatch[data-color="#c2410c"] { background: #c2410c; }

.swatch[aria-pressed="true"] {
	outline: 2px solid var(--ink);
	outline-offset: 2px;
}

.scoreboard {
	width: 100%;
	border-collapse: collapse;
}

.scoreboard th,
.scoreboard td {
	padding: 3px 0;
	vertical-align: baseline;
}

.scoreboard th {
	color: var(--muted);
	font-size: 13px;
	font-weight: 500;
	text-align: left;
}

.scoreboard th:nth-child(n + 2),
.scoreboard td:nth-child(n + 2) {
	width: 1%;
	padding-left: 10px;
	text-align: right;
	white-space: nowrap;
}

.guesses {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.guesses li {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
}

.reply {
	color: var(--accent);
	font-size: 14px;
}

.guesses {
	max-height: 240px;
	overflow: auto;
	list-style: decimal;
	padding-left: 18px;
}

.you {
	font-weight: 500;
}

label {
	display: block;
	margin-bottom: 6px;
}

input {
	width: 100%;
	min-height: 44px;
	padding: 8px 10px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--panel);
	color: var(--ink);
}

.guess-row input {
	flex: 1;
}

.guess-error {
	color: var(--accent);
	margin-bottom: 8px;
}

.overlay {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 16px;
	background: rgba(28, 25, 23, 0.35);
}

.overlay[hidden] {
	display: none;
}

.card {
	width: min(360px, 100%);
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
	background: var(--panel);
	border-radius: 8px;
}

.card button {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-ink);
}

@media (max-width: 800px) {
	.top {
		flex-direction: column;
		align-items: start;
	}

	#status {
		max-width: none;
		text-align: left;
	}

	.layout {
		grid-template-columns: 1fr;
	}
}
