:root {
	--bg: #000000;
	--phosphor: #33ff33; /* classic green phosphor */
	--cols: 80; /* fallback columns count (in ch units) */
	--caret-width: 8px; /* custom caret width */
}

/* vietnamese */
@font-face {
	font-family: 'VT323';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/VT323-Regular.ttf') format('truetype');
	unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
	font-family: 'VT323';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/VT323-Regular.ttf') format('truetype');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
	font-family: 'VT323';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/VT323-Regular.ttf') format('truetype');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* accessibility helper */
.sr-only {
	position: absolute !important;
	height: 1px;
	width: 1px;
	overflow: hidden;
	clip: rect(1px,1px,1px,1px);
	white-space: nowrap;
	border: 0;
	padding: 0;
	margin: -1px;
}

* {
	box-sizing: border-box
}

html, body {
	height: 100%;
	margin: 0;
	font-family: 'VT323', monospace, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	text-shadow: 0 0 4px rgba(51, 255, 51, 0.55);
	background: var(--bg);
	color: var(--phosphor);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-size: 25px; /* single global size for everything */
	user-select: none;
}

/* terminal viewport */
#terminal {
	max-width: 1000px;
	margin: 32px;
	padding: 18px;
	height: calc(100vh - 64px); /* fill viewport (minus 32px top/bottom margin) so it scrolls internally */
	background: transparent;
	border: none;
	overflow: auto;
	position: relative;
	z-index: 2;
	overscroll-behavior: none;
	-ms-overflow-style: none; /* IE/Edge */
	scrollbar-width: none; /* Firefox */
}

#terminal::-webkit-scrollbar {
	display: none;
}
/* WebKit */

/* lines */
.line {
	display: flex;
	align-items: baseline;
	gap: 12px;
	white-space: pre-wrap;
	font-size: inherit;
	line-height: 1.2;
	position: relative;
	z-index: 1;
	letter-spacing: 0.6px;
}

/* prevent text selection for terminal output (but keep input selectable) */
#terminal .content,
#terminal .muted,
#terminal .line {
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* prompt */
.prompt {
	color: var(--phosphor);
	font-weight: inherit;
	display: inline-flex;
	align-items: baseline;
	font-size: inherit;
	line-height: inherit;
}

.content {
	color: var(--phosphor);
	text-shadow: inherit;
	font-size: inherit;
	line-height: inherit;
	word-break: break-word;
	display: inline-block;
	vertical-align: baseline;
	max-width: calc(100% - 48px);
}

/* input area */
.input-line {
	display: flex;
	gap: 0px;
	align-items: baseline;
	position: relative; /* needed so fake caret can be positioned inside */
}

/* make input take a width based on the exact character grid (ch units) */
#cmd-input {
	background: transparent;
	border: none;
	color: var(--phosphor);
	font: inherit;
	font-size: inherit;
	text-shadow: inherit;
	line-height: inherit;
	caret-color: transparent; /* hide native caret (we use custom caret) */
	padding: 0; /* small right padding, no top/bottom padding */
	margin: 0;
	outline: none;
	box-shadow: none;
	-webkit-appearance: none;
	vertical-align: baseline;
	flex: 0 0 auto;
	width: calc(var(--cols) * 1ch);
	max-width: 100%;
	min-width: 4ch;
	height: 1.2em;
	overflow: hidden;
	text-overflow: ellipsis;
	-webkit-user-select: none; /* Safari */
	-moz-user-select: none; /* Firefox */
	-ms-user-select: none; /* IE10+/Edge */
	user-select: none; /* Standard */
	/* Removes the highlight background color if they try to select anyway */
	&::selection

{
	background: transparent;
	color: inherit; /* Keeps your font color unchanged */
}

&::-moz-selection {
	background: transparent;
	color: inherit;
}

}

/* custom blinking caret */
#fake-caret {
	position: absolute;
	top: 0;
	left: 0;
	width: var(--caret-width);
	height: calc(1.0em); /* slightly taller than line */
	background: var(--phosphor);
	box-shadow: 0 0 6px rgba(51,255,51,0.55), inset 0 0 2px rgba(255,255,255,0.06);
	border-radius: 1px;
	transform: translateY(6%); /* tweak vertical align */
	pointer-events: none;
	z-index: 3;
	opacity: 1;
	-webkit-user-select: none;
	user-select: none;
	animation: caret-blink 1s steps(1) infinite;
}

/* blink steps so caret toggle is crisp */
@keyframes caret-blink {
	0%, 50% {
		opacity: 1;
	}

	50.01%, 100% {
		opacity: 0;
	}
}

/* muted */
.muted {
	color: var(--phosphor);
	text-shadow: inherit;
}

/* effects canvas overlay (single layer) */
#effects-canvas {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none; /* never block input */
	z-index: 999;
	opacity: 0.45; /* tune final intensity here */
	mix-blend-mode: screen; /* subtle blending with UI */
}

/* --- VHS shader mode (set by effects.js when WebGL is available) --- */
/* The DOM terminal stays fully interactive but invisible; the shaded
   mirror on the canvas becomes the visible picture. Without WebGL the
   class is never added and the plain terminal remains visible. */
body.vhs-enabled #terminal {
	opacity: 0;
}

body.vhs-enabled #effects-canvas {
	opacity: 1;
	mix-blend-mode: normal;
}

/* responsive */
@media (max-width:600px) {
	html, body {
		font-size: inherit
	}

	#terminal {
		margin: 10px;
		padding: 12px;
		height: calc(100vh - 20px);
	}

	:root {
		--cols: 48;
	}
}

/* Lock the page itself (no body scroll), but let #terminal be the scroll container. */
html, body {
	overflow: hidden;
}
