:root
{
	color-scheme: light dark;
	font-family: system-ui, sans-serif;
	line-height: 1.5;
	--background: #ECE7DC;
	--panel: #FFFDF8;
	--text: #25231F;
	--muted: #686258;
	--border: #B8AFA0;
	--accent: #315C3B;
	--accent-hover: #24472D;
	--button: #EEE9DF;
	--console: #171A17;
	--console-text: #E8EFE7;
	--focus: #B05827;
}

*
{
	box-sizing: border-box;
}

body
{
	min-height: 100vh;
	margin: 0;
	padding: clamp(1rem, 4vw, 3rem);
	background: var(--background);
	color: var(--text);
}

textarea#worksheet
{
	width: 100%;
	min-height: 30rem;
	padding: 0.75rem;

	font: 0.75rem monospace;

	color: black;
	background: white;
	border: 1px solid #808080;

	overflow-y: scroll;
	overflow-x: auto;
	resize: vertical;

	box-sizing: border-box;

	color-scheme: light;
}

button,
input,
{
	font: inherit;
}

.calculator-panel
{
	width: min(100%, 64rem);
	margin: 0 auto;
	padding: clamp(1.25rem, 4vw, 2.5rem);
	border: 1px solid var(--border);
	border-radius: 0.8rem;
	background: var(--panel);
	box-shadow: 0 0.8rem 2.5rem rgb(45 38 27 / 12%);
}

header
{
	max-width: 48rem;
}

.eyebrow
{
	margin: 0 0 0.25rem;
	color: var(--accent);
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

h1
{
	margin: 0;
	font-family: Georgia, serif;
	font-size: clamp(2rem, 6vw, 3.4rem);
	line-height: 1.1;
}

.introduction
{
	margin: 0.8rem 0 0;
	color: var(--muted);
	font-size: 1.05rem;
}

.controls
{
	display: grid;
	grid-template-columns: repeat(2, minmax(9rem, 13rem)) 1fr;
	gap: 1rem;
	align-items: end;
	margin: 2rem 0 0;
}

.field
{
	display: grid;
	gap: 0.35rem;
}

.field label,
.worksheet-label
{
	font-weight: 700;
}

input
{
	width: 100%;
	padding: 0.62rem 0.72rem;
	border: 1px solid var(--border);
	border-radius: 0.35rem;
	background: var(--panel);
	color: var(--text);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 1rem;
}

.actions
{
	display: flex;
	gap: 0.65rem;
	flex-wrap: wrap;
}

button
{
	min-height: 2.75rem;
	padding: 0.6rem 1rem;
	border: 1px solid var(--border);
	border-radius: 0.35rem;
	background: var(--button);
	color: var(--text);
	font-weight: 700;
	cursor: pointer;
}

button:hover
{
	filter: brightness(0.96);
}

button.primary
{
	border-color: var(--accent);
	background: var(--accent);
	color: white;
}

button.primary:hover
{
	background: var(--accent-hover);
}

button:disabled
{
	opacity: 0.55;
	cursor: progress;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible
{
	outline: 3px solid color-mix(in srgb, var(--focus) 65%, transparent);
	outline-offset: 2px;
}

.status
{
	min-height: 1.5em;
	margin: 0.75rem 0;
	color: var(--muted);
}

.worksheet-label
{
	display: block;
	margin-bottom: 0.35rem;
}

.worksheet
{
	display: block;
	width: 100%;
	height: clamp(22rem, 55vh, 38rem);
	resize: vertical;
	padding: 1rem;
	border: 1px solid #000;
	border-radius: 0.35rem;
	background: var(--console);
	color: var(--console-text);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: clamp(0.72rem, 2vw, 0.94rem);
	line-height: 1.35;
	white-space: pre;
	tab-size: 4;
}

.worksheet-description
{
	margin: 0.45rem 0 0;
	color: var(--muted);
	font-size: 0.9rem;
}

footer
{
	margin-top: 2rem;
	border-top: 1px solid var(--border);
	padding-top: 1rem;
	color: var(--muted);
	font-size: 0.85rem;
	text-align: center;
}

@media (max-width: 48rem)
{
	.controls
	{
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.actions
	{
		grid-column: 1 / -1;
	}
}

@media (max-width: 30rem)
{
	body
	{
		padding: 0;
	}

	.calculator-panel
	{
		min-height: 100vh;
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}

	.controls
	{
		grid-template-columns: 1fr;
	}

	.actions
	{
		grid-column: auto;
	}

	.actions button
	{
		flex: 1;
	}
}

@media (prefers-color-scheme: dark)
{
	:root
	{
		--background: #171915;
		--panel: #22251F;
		--text: #F0EEE7;
		--muted: #BBB5AA;
		--border: #5C6257;
		--accent: #71A87B;
		--accent-hover: #5E9368;
		--button: #343830;
		--console: #0D0F0D;
		--console-text: #E8EFE7;
		--focus: #E49962;
	}

	button.primary
	{
		color: #101510;
	}
}


.about
{
	margin-top: 1.5rem;
}

.about h2
{
	font-size: 1.1rem;
	margin-bottom: 0.5rem;
}

.about p
{
	margin: 0.6rem 0;
	line-height: 1.5;
}
