* { box-sizing: border-box; }
body {
	margin: 0;
	display: grid;
	grid-template-columns: 32rem 1fr;
	height: 100vh;
	font: 14px/1.5 system-ui, sans-serif;
	color: #222;
}
[hidden] { display: none !important; }
aside {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: #1e1e1e;
	color: #ccc;
}
aside > header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .75rem 1.25rem;
	border-bottom: 1px solid #333;
}
aside > header strong { color: #fff; }
select, aside button, .actions a {
	font: inherit;
	font-size: 13px;
	padding: .25rem .625rem;
	border: 1px solid #444;
	border-radius: 4px;
	background: #2a2a2a;
	color: #ddd;
	cursor: pointer;
	text-decoration: none;
}
aside button:hover, .actions a:hover { background: #333; }
aside button:disabled { opacity: .4; cursor: default; }
/* the text takes what it needs, the editor the rest */
#lesson {
	flex: 0 1 auto;
	min-height: 8rem;
	overflow: auto;
	padding: 1.25rem 1.25rem .5rem;
}
#chapter { margin: 0; font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: .05em; }
#title { margin: .25rem 0 1rem; font-size: 20px; color: #fff; }
#text p { margin: 0 0 1em; }
#text a { color: #8ab4f8; }
#text a[href^="highlight:"] { text-decoration: underline dotted; text-underline-offset: 3px; }
#text code, #task code, #error code {
	font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace;
	background: #2c2c2c;
	padding: .1em .3em;
	border-radius: 3px;
}
#text pre {
	margin: 0 0 1em;
	padding: .75rem 1rem;
	border-radius: 4px;
	background: #111;
	overflow: auto;
	line-height: 1.6;
}
#text pre code { background: none; padding: 0; color: #abb2bf; }
#code {
	display: flex;
	flex-direction: column;
	flex: 1 1 14rem;
	min-height: 14rem;
	padding: 0 1.25rem;
}
#tabs { display: flex; gap: .25rem; margin-bottom: .5rem; }
#tabs button { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
#tabs button[aria-current="true"] { background: #fff; color: #111; border-color: #fff; }
.stage { position: relative; flex: 1; min-height: 0; }
#editor { height: 100%; }
#editor:not([data-enabled]) { opacity: .5; }
/* "Solve" animates over the editor, a click skips it */
#movie {
	position: absolute;
	inset: 0;
	overflow: hidden;
	border: 1px solid #333;
	border-radius: 4px;
	background: #111;
	font-size: 13px;
	cursor: pointer;
}
aside > footer { margin-top: auto; padding: .75rem 1.25rem 1rem; }
#error, #task { margin: 0 0 .5rem; font-size: 13px; }
#error { color: #f88; }
#error:empty { display: none; }
#task { color: #aaa; min-height: 1.5em; }
/* a failing check would only repeat the error */
#error:not(:empty) + #task:not([data-done]) { visibility: hidden; }
#task:not(:empty)::before { content: "○ "; }
#task[data-done] { color: #8c8; }
#task[data-done]::before { content: "✓ "; }
.actions { display: flex; gap: .375rem; }
.actions .spacer { flex: 1; }
.actions a[data-highlight] { background: #8c8; border-color: #8c8; color: #111; }
main { display: flex; flex-direction: column; min-width: 0; }
#bar {
	display: flex;
	gap: .375rem;
	padding: .5rem;
	background: #e8e8e8;
	border-bottom: 1px solid #d0d0d0;
}
#bar input, #bar button {
	font: inherit;
	font-size: 13px;
	padding: .25rem .625rem;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fff;
}
#bar input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
#bar button { cursor: pointer; }
.preview { position: relative; flex: 1; }
iframe { width: 100%; height: 100%; border: 0; display: block; }
#waiting {
	position: absolute;
	top: 1rem;
	left: 50%;
	transform: translateX(-50%);
	width: max-content;
	max-width: calc(100% - 2rem);
	margin: 0;
	padding: .5rem .875rem;
	border-radius: 6px;
	background: #1e1e1e;
	color: #fff;
	font-size: 13px;
	box-shadow: 0 2px 8px rgb(0 0 0 / .25);
}
#loading {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: #f5f5f5;
	color: #666;
}
