:root {
	--bg-color: #0C011F;
	--main-color: #EC0123;
	--alert-color: rgb(255, 0, 0);
	--dim-color: #6D0122;
	--highlight-color: #AB0120;
	--font-stack: 'Terminus', 'Fira Code', 'Courier New', monospace;
	--crt-flicker: 0.03;
	--page-padding: clamp(16px, 4vw, 40px);
	--grid-gap: clamp(12px, 2vw, 20px);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	cursor: text;
	/* I-Beam cursor for text selection */

}

html {
	height: 100%;
	width: 100%;
	/* Prevent text selection on the entire page */
	user-select: none;
	-webkit-user-select: none;

}

body {
	width: 100%;
	height: 100%;
	background-color: var(--bg-color);
	background-repeat: repeat;
	color: var(--main-color);
	font-family: var(--font-stack);
	overflow: hidden;
	display: flex;
	flex: calc(100vh - var(--page-padding) * 2) 1 0;
	flex-direction: column;
	padding: var(--page-padding);
	font-size: clamp(13px, 1.2vw, 14px);
	line-height: 1.5;
	text-shadow: hsl(from var(--dim-color) (0.5) 0.5) 0px 1px 2px;
	text-decoration: wavy;
	text-decoration-color: var(--dim-color);
	transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, text-shadow 0.2s ease-in-out, text-decoration 0.2s ease-in-out;
	position: relative;
	user-select: none;
	-webkit-user-select: none;
}

/* --- CRT SCANLINES OVERLAY --- */
body::before {
	position: absolute;
	inset: 1px;
	background: linear-gradient(rgba(0, 0, 0, 0.1) 50%, transparent 50%), linear-gradient(90deg, rgba(0, 0, 0, 0.1) 50%, transparent 50%);
	background-repeat: repeat;
	background-size: 100% 2px, 2px 100%;
	content: "";
	pointer-events: none;
	transform: translateZ(1px);
	transition: opacity 0.2s ease-in-out;
}

/* --- LAYOUT --- */
#header {
	border-bottom: 1px solid var(--dim-color);
	padding-bottom: 10px;
	margin-bottom: clamp(20px, 4vw, 40px);
	text-transform: uppercase;
	letter-spacing: clamp(1px, 0.3vw, 2px);
}

#clock {
	font-weight: bold;
}

#main-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--grid-gap);
	flex-grow: 1;
	min-height: 0;
	overflow-y: auto;
	padding-right: 10px;
	align-content: start;
}

.sector {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.sector-title {
	color: color(from var(--main-color) var(--dim-color) var(--highlight-color) / 0.8);
	margin-bottom: 15px;
	border-bottom: 1px dashed var(--dim-color);
	display: inline-block;
	width: 100%;
	padding-bottom: 5px;
	font-size: clamp(0.85rem, 1vw, 1rem);
}

a {
	color: var(--main-color);
	text-decoration: wavy;
	text-decoration-color: var(--dim-color);
	transition: all 0.2s ease-in-out;
	text-shadow: hsl(from var(--dim-color) (0.5) 0.5) 0px 1px 2px;
	display: inline-block;
	background-color: transparent;
	cursor: pointer;
	transform: translateX(0);
	z-index: 1;
}

a:hover {
	background-color: var(--highlight-color);
	color: var(--bg-color);
	text-shadow: none;
	transform: translateX(5px);
	opacity: 1;
	padding-left: 10px;
	transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out, opacity 0.2s ease-in-out, padding-left 0.2s ease-in-out;
	/* Slide effect */
}

a:focus-visible {
	outline: 1px dashed var(--main-color);
	outline-offset: 2px;
	transition: outline 0.2s ease-in-out;
	opacity: 1;

}

a::before {
	content: "./";
	color: var(--dim-color);
	vertical-align: middle;
	margin-right: 5px;
}

img,
video,
canvas,
svg {
	max-width: 100%;
	height: auto;
}

iframe {
	max-width: 100%;
}

/* --- INPUT AREA --- */
#input-zone {
	margin-top: auto;
	border-top: 1px solid var(--dim-color);
	padding-top: clamp(14px, 2vw, 20px);
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.prompt-sign {
	margin-right: 10px;
	font-weight: bold;
	flex: 0 0 auto;
}

#cmd {
	background: transparent;
	border: none;
	color: var(--main-color);
	font-family: var(--font-stack);
	font-size: clamp(16px, 2vw, 18px);
	flex: 1 1 220px;
	min-width: 0;
	width: 100%;
	outline: none;
	text-shadow: hsl(from var(--dim-color) (0.5) 0.5) 0px 1px 2px;
	text-transform: lowercase;
	user-select: text;
	-webkit-user-select: text;
}

@keyframes flicker {
	0% {
		opacity: 0.97;
	}

	5% {
		opacity: 0.95;
	}

	10% {
		opacity: 0.9;
	}

	15% {
		opacity: 0.95;
	}

	20% {
		opacity: 0.99;
	}

	100% {
		opacity: 0.94;
	}
}

#container {
	animation: flicker 0.15s infinite;
	z-index: 1;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	position: relative;
}

@media (max-width: 900px) {
	body {
		padding: clamp(14px, 3vw, 24px);
	}

	#main-grid {
		grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	}
}

@media (max-width: 720px) {
	#header {
		flex-direction: column;
	}

	#clock {
		width: 100%;
	}

	#main-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		padding-right: 0;
	}

	#input-zone {
		align-items: flex-start;
	}
}

@media (max-width: 520px) {
	body {
		padding: 14px;
		font-size: 13px;
	}

	#main-grid {
		grid-template-columns: 1fr;
		gap: 14px;
	}

	#input-zone {
		gap: 6px;
	}

	.prompt-sign {
		margin-right: 0;
	}

	a:hover {
		padding-left: 6px;
	}
}

@media (max-width: 740px) and (orientation: portrait) {
	#main-grid {
		grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
		grid-auto-flow: column;
		grid-auto-rows: min-content;
		padding-right: 0;
	}

	#main-grid>.sector:nth-child(1) {
		grid-column: 1;
		grid-row: 1;
	}

	#main-grid>.sector:nth-child(2) {
		grid-column: 1;
		grid-row: 2;
	}

	#main-grid>.sector:nth-child(3) {
		grid-column: 1;
		grid-row: 3;
	}

	#main-grid>.sector-rawlogs {
		grid-column: 2;
		grid-row: 1 / span 3;
		min-height: 0;
	}

	#main-grid>.sector-rawlogs #logs {
		height: 100%;
		min-height: 0;
		overflow-y: auto;
	}
}