/**
 * Responsive application shell. Desktop is a centered terminal-like column;
 * narrow viewports use the full width. Does not emulate 640x476.
 */

#app {
	min-height: 100dvh;
	display: flex;
	justify-content: center;
	align-items: stretch;
	background: var(--color-bg);
	color: var(--color-text);
}

.app-shell {
	width: min(var(--app-max-width), 100%);
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

.app-shell.retro-panel {
	height: 100dvh;
	min-height: 100dvh;
}

.app-shell > .retro-panel-body {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 0;
}

.screen {
	width: 100%;
	display: flex;
	justify-content: center;
}

.screen-header,
.screen-status,
.screen-footer {
	padding: 1ch;
	min-height: calc(1lh + 2ch);
}

.screen-header {
	text-align: center;
}

.screen-header h1 {
	color: var(--color-title);
}

.screen-status {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: var(--space-3);
	padding-top: calc(1ch + 1lh);
	color: var(--color-status);
	min-width: 0;
}

.screen-status [data-status-left],
.screen-status [data-status-right] {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.screen-status [data-status-left] {
	flex: 1 1 auto;
}

.screen-status [data-status-right] {
	flex: 0 1 auto;
	text-align: right;
	color: var(--color-status-intense);
}

.screen-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	padding: 1ch;
	min-height: 0;
	overflow: hidden;
}

.screen-panels {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-4);
	flex: 1;
	min-height: 0;
}

.screen-panels-clarify {
	gap: 2rem;
}

.screen-footer {
	color: var(--color-accent);
}

.responsive-copy-mobile {
	display: none;
}

.scroll-region {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding-inline-start: 2ch;
	position: relative;
	scrollbar-width: thin;
	scrollbar-color: var(--color-text) var(--color-bg);
}

.scroll-region:focus-visible::before {
	content: ">" / "";
	display: block;
	position: sticky;
	top: 0;
	left: 0;
	width: 0;
	height: 0;
	transform: translateX(-1.5ch);
	color: var(--color-title);
	z-index: 1;
	pointer-events: none;
}

.scroll-region p + p {
	margin-top: var(--space-3);
}

.screen-body-split {
	gap: var(--space-3);
	padding: 1ch;
}

.screen-body-split .screen-panels {
	flex: 1 1 auto;
	min-height: 0;
}

.split-pane {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

.split-pane .scroll-region {
	flex: 1 1 auto;
	min-height: 0;
}

.screen-actions {
	flex: 0 0 auto;
	width: 100%;
	max-width: 100%;
}

@media (max-width: 640px) {
	.responsive-copy-desktop {
		display: none;
	}

	.responsive-copy-mobile {
		display: inline;
	}

	.app-shell {
		width: 100%;
	}

	.screen-panels {
		grid-template-columns: 1fr;
	}

	.screen-panels-clarify {
		gap: var(--space-4);
	}

	.screen-body-split {
		overflow: auto;
	}

	.screen-body-split .screen-panels {
		flex: 0 0 auto;
		min-height: 0;
	}

	.screen-body-split .split-pane {
		overflow: visible;
		height: auto;
		min-height: 0;
	}

	.screen-body-split .split-pane .scroll-region {
		flex: 0 0 auto;
		overflow: visible;
		min-height: 0;
	}

	.screen-body-split .split-pane-preview .scroll-region,
	.screen-body-split .split-pane-inspector .scroll-region,
	.screen-body-split .split-pane-lesson-summary .scroll-region {
		overflow: auto;
		max-height: none;
	}
}
