:root {
	--terminal-surface: #1e1e1e;
	color-scheme: dark;
	font-family:
		Inter,
		ui-sans-serif,
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		'Segoe UI',
		sans-serif;
	background: #080b0d;
	color: #e4ebe7;
}

* {
	box-sizing: border-box;
}

html,
body {
	min-height: 100%;
	margin: 0;
}

body {
	min-height: 100vh;
	min-height: 100dvh;
	overflow: hidden;
	background:
		radial-gradient(circle at 20% -10%, rgba(215, 255, 98, 0.09), transparent 34rem),
		radial-gradient(circle at 90% 110%, rgba(100, 201, 202, 0.07), transparent 32rem), #080b0d;
}

button,
a {
	font: inherit;
}

.shell {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	gap: 14px;
	width: 100%;
	max-width: 100vw;
	height: 100vh;
	height: 100dvh;
	margin: 0 auto;
	padding: 18px;
	overflow: hidden;
}

.chrome {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-width: 0;
}

.identity {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.mark {
	display: grid;
	width: 38px;
	height: 38px;
	place-items: center;
	border: 1px solid rgba(215, 255, 98, 0.38);
	border-radius: 10px;
	background: rgba(215, 255, 98, 0.08);
	color: #d7ff62;
	font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
	font-weight: 700;
}

h1,
p {
	margin: 0;
}

h1 {
	font-size: 15px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.identity p,
footer {
	color: #829089;
	font-size: 11px;
	letter-spacing: 0.04em;
}

.header-actions {
	display: flex;
	min-width: 0;
	align-items: center;
	gap: 16px;
}

.theme-toggle {
	display: flex;
	overflow: hidden;
	border: 1px solid #293238;
	border-radius: 7px;
}

.theme-toggle button {
	padding: 6px 9px;
	border: 0;
	border-right: 1px solid #293238;
	background: #101417;
	color: #829089;
	cursor: pointer;
	font-size: 11px;
}

.theme-toggle button:last-child {
	border-right: 0;
}

.theme-toggle button[aria-pressed='true'] {
	background: #26313a;
	color: #e4ebe7;
}

.runtime-state {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #a7b1ac;
	font-size: 12px;
	white-space: nowrap;
}

.pulse {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #d7ff62;
	box-shadow: 0 0 12px rgba(215, 255, 98, 0.7);
}

.terminal-frame {
	--terminal-padding: 12px;
	position: relative;
	min-height: 0;
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
	border: 1px solid #293238;
	border-radius: 14px;
	background: var(--terminal-surface);
	box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.terminal-titlebar {
	display: flex;
	height: 36px;
	align-items: center;
	gap: 7px;
	padding: 0 13px;
	border-bottom: 1px solid #222b30;
	background: #151a1e;
}

.window-controls {
	display: flex;
	align-items: center;
	gap: 7px;
}

.window-controls span {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #39444a;
}

.window-controls span:first-child {
	background: #ff6b68;
}

.window-controls span:nth-child(2) {
	background: #e9cf72;
}

.window-controls span:nth-child(3) {
	background: #87d27c;
}

.terminal-titlebar strong {
	margin-left: auto;
	color: #65736d;
	font:
		500 10px/1 'JetBrains Mono',
		'SFMono-Regular',
		Consolas,
		monospace;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

body[data-terminal-theme='mac'] .terminal-titlebar {
	position: relative;
	justify-content: flex-start;
	background: #292929;
}

body[data-terminal-theme='mac'] .terminal-titlebar strong {
	position: absolute;
	left: 50%;
	margin: 0;
	transform: translateX(-50%);
	color: #bdbdbd;
	text-transform: none;
}

body[data-terminal-theme='mac'] {
	--terminal-surface: #1e1e1e;
}

body[data-terminal-theme='windows'] {
	--terminal-surface: #012456;
}

body[data-terminal-theme='windows'] .terminal-titlebar {
	flex-direction: row-reverse;
	padding-right: 0;
	background: #012456;
}

body[data-terminal-theme='windows'] .terminal-titlebar strong,
body[data-terminal-theme='linux'] .terminal-titlebar strong {
	margin-right: auto;
	margin-left: 0;
	color: #f1f1f1;
	text-transform: none;
}

body[data-terminal-theme='windows'] .window-controls {
	align-self: stretch;
	gap: 0;
}

body[data-terminal-theme='windows'] .window-controls span {
	display: grid;
	width: 42px;
	height: 100%;
	place-items: center;
	border-radius: 0;
	background: transparent;
	color: white;
}

body[data-terminal-theme='windows'] .window-controls span::after {
	font:
		13px/1 'Segoe UI Symbol',
		sans-serif;
}

body[data-terminal-theme='windows'] .window-controls span:first-child::after {
	content: '—';
}

body[data-terminal-theme='windows'] .window-controls span:nth-child(2)::after {
	content: '□';
}

body[data-terminal-theme='windows'] .window-controls span:nth-child(3)::after {
	content: '×';
	font-size: 20px;
	font-weight: 300;
}

body[data-terminal-theme='windows'] .window-controls span:nth-child(3):hover {
	background: #c42b1c;
}

body[data-terminal-theme='linux'] {
	--terminal-surface: #300a24;
}

body[data-terminal-theme='linux'] .terminal-titlebar {
	flex-direction: row-reverse;
	background: #2c001e;
}

body[data-terminal-theme='linux'] .window-controls span {
	background: #5e5c64;
}

body[data-terminal-theme='linux'] .window-controls span:first-child {
	background: #e95420;
}

#terminal {
	position: absolute;
	inset: calc(36px + var(--terminal-padding)) var(--terminal-padding) var(--terminal-padding);
	padding: 0;
	max-width: 100%;
	overflow: hidden;
	background: var(--terminal-surface);
}

#terminal .xterm {
	height: 100%;
	max-width: 100%;
}

#terminal .xterm-viewport {
	scrollbar-width: none;
	-ms-overflow-style: none;
}

#terminal .xterm-viewport::-webkit-scrollbar {
	display: none;
}

.boot {
	--boot-progress: 4%;
	position: absolute;
	inset: 36px 0 0;
	display: grid;
	place-items: center;
	background: rgba(16, 20, 23, 0.94);
	backdrop-filter: blur(8px);
	opacity: 1;
	transition:
		opacity 300ms ease,
		visibility 300ms ease;
}

.boot.hidden {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.boot-card {
	width: min(420px, calc(100% - 48px));
}

.boot-label {
	color: #d7ff62;
	font:
		600 12px/1 'JetBrains Mono',
		'SFMono-Regular',
		Consolas,
		monospace;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.progress {
	height: 2px;
	margin: 18px 0 12px;
	overflow: hidden;
	background: #273036;
}

.progress i {
	display: block;
	width: var(--boot-progress);
	height: 100%;
	background: #d7ff62;
	box-shadow: 0 0 14px rgba(215, 255, 98, 0.8);
	transition: width 350ms ease;
}

.boot-card p {
	min-height: 34px;
	color: #829089;
	font-size: 13px;
	line-height: 1.5;
}

.boot.failed .boot-label,
.boot.failed .boot-card p {
	color: #ff8b88;
}

.boot.failed .progress i {
	background: #ff6b68;
}

#restart {
	margin-top: 18px;
	padding: 9px 13px;
	border: 1px solid #526067;
	border-radius: 7px;
	background: #1a2226;
	color: #e4ebe7;
	cursor: pointer;
}

#restart:hover {
	border-color: #d7ff62;
	color: #d7ff62;
}

footer {
	display: flex;
	min-width: 0;
	justify-content: flex-start;
	padding: 0 2px;
}

footer a {
	color: #a7b1ac;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

footer a:hover {
	color: #d7ff62;
}

@media (max-width: 650px) {
	.shell {
		gap: 6px;
		padding: 6px;
	}

	.identity p,
	.runtime-state {
		display: none;
	}

	.header-actions {
		gap: 6px;
	}

	.theme-toggle button {
		min-height: 34px;
		padding: 5px 7px;
		font-size: 10px;
		touch-action: manipulation;
	}

	.terminal-frame {
		--terminal-padding: 6px;
		border-radius: 9px;
	}

	footer {
		display: none;
	}
}

@media (max-width: 650px) and (orientation: portrait) {
	.mark {
		width: 34px;
		height: 34px;
	}

	.theme-toggle button:not([aria-pressed='true']) {
		display: none;
	}
}
