@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

/* Theme Variables */
:root, body.theme-default {
	--primary-color: #ff0040;
	--secondary-color: #ff4477;
	--success-color: #44ff44;
	--warning-color: #ffaa00;
	--error-color: #ff4444;
	--bg-color: #000;
	--bg-secondary: #0a0a0a;
	--text-dim: rgba(255, 0, 64, 0.6);
	--border-glow: rgba(255, 0, 64, 0.5);
	--scanline-color: rgba(0, 0, 0, 0.15);
}

body.theme-bunny {
	--primary-color: #ff69b4;
	--secondary-color: #ffb6db;
	--success-color: #98fb98;
	--warning-color: #ffd700;
	--error-color: #ff6b9d;
	--bg-color: #1a0a14;
	--bg-secondary: #2d1424;
	--text-dim: rgba(255, 105, 180, 0.6);
	--border-glow: rgba(255, 105, 180, 0.5);
	--scanline-color: rgba(255, 105, 180, 0.05);
}

body.theme-midnight {
	--primary-color: #00d9ff;
	--secondary-color: #66e0ff;
	--success-color: #00ff88;
	--warning-color: #ffcc00;
	--error-color: #ff3366;
	--bg-color: #000000;
	--bg-secondary: #0d0d0d;
	--text-dim: rgba(0, 217, 255, 0.6);
	--border-glow: rgba(0, 217, 255, 0.6);
	--scanline-color: rgba(0, 217, 255, 0.05);
}

body.theme-fallout {
	--primary-color: #00ff00;
	--secondary-color: #33ff33;
	--success-color: #00ff00;
	--warning-color: #ffff00;
	--error-color: #ff0000;
	--bg-color: #000000;
	--bg-secondary: #0a0a00;
	--text-dim: rgba(0, 255, 0, 0.6);
	--border-glow: rgba(0, 255, 0, 0.5);
	--scanline-color: rgba(0, 255, 0, 0.1);
}

body.theme-glassware {
	--primary-color: #d5eaff;
	--secondary-color: #b3c6ff;
	--success-color: #98ffc8;
	--warning-color: #fffabb;
	--error-color: #ff6b88;
	--bg-color: #05070c;
	--bg-secondary: #0a0f1a;
	--text-dim: rgba(213, 234, 255, 0.5);
	--border-glow: rgba(213, 234, 255, 0.5);
	--scanline-color: rgba(213, 234, 255, 0.06);
}

body.theme-obsidian {
	--primary-color: #ffa552;
	--secondary-color: #ffd8a8;
	--success-color: #66ff99;
	--warning-color: #ffc94d;
	--error-color: #ff442b;
	--bg-color: #050403;
	--bg-secondary: #0d0a07;
	--text-dim: rgba(255, 165, 82, 0.5);
	--border-glow: rgba(255, 165, 82, 0.5);
	--scanline-color: rgba(255, 165, 82, 0.05);
}

body.theme-lanternlight {
	--primary-color: #ffd38a;
	--secondary-color: #ffe9c2;
	--success-color: #b8ffb3;
	--warning-color: #ffdd66;
	--error-color: #ff6b4b;
	--bg-color: #1a140d;
	--bg-secondary: #261d12;
	--text-dim: rgba(255, 211, 138, 0.6);
	--border-glow: rgba(255, 211, 138, 0.5);
	--scanline-color: rgba(255, 211, 138, 0.04);
}

body.theme-vaporwave {
	--primary-color: #ff71ce;
	--secondary-color: #c199ff;
	--success-color: #7dffdc;
	--warning-color: #ffe08a;
	--error-color: #ff447a;
	--bg-color: #08000e;
	--bg-secondary: #12001e;
	--text-dim: rgba(255, 113, 206, 0.5);
	--border-glow: rgba(255, 113, 206, 0.5);
	--scanline-color: rgba(255, 113, 206, 0.04);
}

body {
	background: var(--bg-color);
	font-family: 'Share Tech Mono', monospace;
	overflow: hidden;
	height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* CRT Container */
.crt-container {
	position: relative;
	width: 90vw;
	height: 85vh;
	max-width: 1200px;
	background: var(--bg-secondary);
	border: 2px solid var(--primary-color);
	box-shadow:
		0 0 20px var(--border-glow),
		inset 0 0 30px var(--border-glow);
	border-radius: 8px;
	overflow: hidden;
}

/* CRT Effects */
.crt-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background:
		linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
		linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
	background-size: 100% 2px, 3px 100%;
	pointer-events: none;
	z-index: 10;
	animation: flicker 0.15s infinite;
}

.scanlines {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: repeating-linear-gradient(
		0deg,
		var(--scanline-color),
		var(--scanline-color) 1px,
		transparent 1px,
		transparent 2px
	);
	pointer-events: none;
	z-index: 9;
}

.vignette {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
	pointer-events: none;
	z-index: 8;
}

/* Terminal */
.terminal-wrapper {
	position: relative;
	width: 100%;
	height: 100%;
	padding: 20px;
	z-index: 1;
}

.terminal-header {
	display: flex;
	justify-content: space-between;
	padding: 10px 15px;
	background: var(--border-glow);
	border: 1px solid var(--primary-color);
	margin-bottom: 15px;
	color: var(--primary-color);
	font-size: 14px;
	letter-spacing: 2px;
	text-shadow: 0 0 10px var(--primary-color);
}

.terminal-status {
	animation: blink 2s infinite;
}

.terminal-content {
	height: calc(100% - 60px);
	overflow-y: scroll;
	padding: 15px;
	color: var(--primary-color);
	text-shadow: 0 0 5px var(--primary-color);
	font-size: 16px;
	line-height: 1.6;
	scroll-behavior: smooth;
}

.terminal-content::-webkit-scrollbar {
	width: 8px;
}

.terminal-content::-webkit-scrollbar-track {
	background: var(--border-glow);
}

.terminal-content::-webkit-scrollbar-thumb {
	background: var(--primary-color);
	box-shadow: 0 0 5px var(--primary-color);
}

.boot-sequence p {
	margin: 5px 0;
	animation: fadeIn 0.5s ease-in;
}

/* Output */
#output {
	margin: 0;
	padding: 0;
}

#output p {
	margin: 5px 0;
	white-space: pre-wrap;
	word-wrap: break-word;
}

#output p:first-child {
	margin-top: 0;
}

.error {
	color: var(--error-color);
	text-shadow: 0 0 5px var(--error-color);
}

.text-success {
	color: var(--success-color);
	text-shadow: 0 0 5px var(--success-color);
}

.warning {
	color: var(--warning-color);
	text-shadow: 0 0 5px var(--warning-color);
}

.dim {
	opacity: 0.6;
	color: var(--text-dim);
}

/* Color Tag System */
.color-red {
	color: var(--error-color);
	text-shadow: 0 0 5px var(--error-color);
}

.color-green {
	color: var(--success-color);
	text-shadow: 0 0 5px var(--success-color);
}

.color-yellow {
	color: var(--warning-color);
	text-shadow: 0 0 5px var(--warning-color);
}

.color-cyan {
	color: #00FFFF;
	text-shadow: 0 0 5px #00FFFF;
}

.color-magenta {
	color: #ff00ff;
	text-shadow: 0 0 5px #ff00ff;
}

.color-dim {
	opacity: 0.6;
	color: var(--text-dim);
}

.color-primary {
	color: var(--primary-color);
	text-shadow: 0 0 5px var(--primary-color);
}

/* Effect System */
.effect-glitch {
	display: inline-block;
	animation: glitch 0.3s infinite;
}

@keyframes glitch {
	0% {
		transform: translate(0);
		text-shadow: 0 0 5px var(--primary-color);
	}
	20% {
		transform: translate(-2px, 1px);
		text-shadow: -2px 0 5px var(--error-color);
	}
	40% {
		transform: translate(2px, -1px);
		text-shadow: 2px 0 5px var(--success-color);
	}
	60% {
		transform: translate(-1px, 2px);
		text-shadow: 0 2px 5px var(--warning-color);
	}
	80% {
		transform: translate(1px, -2px);
		text-shadow: 1px -2px 5px var(--secondary-color);
	}
	100% {
		transform: translate(0);
		text-shadow: 0 0 5px var(--primary-color);
	}
}

.effect-scramble,
.effect-scramble-section,
.effect-scramble-partial {
	display: inline-block;
	font-family: 'Share Tech Mono', monospace;
	transition: none;
}

.corrupted {
	color: var(--error-color);
	text-shadow: 0 0 3px var(--error-color);
	font-weight: bold;
}

/* Pagination */
.terminal-content.pagination-active {
	overflow-y: hidden !important;
}

#paginationContainer {
	overflow: hidden;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.pagination-prompt {
	position: fixed;
	bottom: 40px;
	left: 50%;
	transform: translateX(-50%);
	background: transparent !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	color: var(--primary-color);
	z-index: 1000;
}

.pagination-status {
	color: var(--warning-color);
	text-shadow: none !important;
	font-weight: normal;
	background: transparent !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
}

.pagination-help {
	color: var(--primary-color);
	opacity: 0.6;
	text-shadow: none !important;
	background: transparent !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
}

.end-of-output {
	color: var(--warning-color);
	text-shadow: 0 0 5px var(--warning-color);
	font-style: italic;
	margin-top: 10px;
}

/* Input Line & Prompt - must be pixel-perfect to prevent text jumping */
.input-line {
	display: block;
	margin: 5px 0;
	padding: 0;
	position: relative;
	min-height: 26px;
	line-height: 1.6;
	font-size: 16px;
	white-space: nowrap;
}

.output-line {
	display: block;
	margin: 5px 0;
	padding: 0;
	position: relative;
	min-height: 26px;
	line-height: 1.6;
	font-size: 16px;
	white-space: nowrap;
}

.prompt,
.output-prompt {
	color: var(--primary-color);
	margin: 0;
	padding: 0;
	text-shadow: 0 0 5px var(--primary-color);
	white-space: nowrap;
	font-family: 'Share Tech Mono', monospace;
	font-size: 16px;
	line-height: 1.6;
	vertical-align: baseline;
	display: inline;
	margin-right: 0;
}

.prompt::after,
.output-prompt::after {
	content: ' ';
	white-space: pre;
}

.command-input {
	position: fixed !important;
	left: -9999px !important;
	top: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none !important;

	font-family: 'Share Tech Mono', monospace;
	font-size: 16px;
	line-height: 1.6;
	white-space: pre;
	letter-spacing: normal;
	word-spacing: normal;
}

.input-mirror {
	color: var(--primary-color);
	font-family: 'Share Tech Mono', monospace;
	font-size: 16px;
	text-shadow: 0 0 5px var(--primary-color);

	line-height: 1.6;
	vertical-align: baseline;
	display: inline;

	letter-spacing: normal;
	word-spacing: normal;
	white-space: pre;
	text-rendering: geometricPrecision;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;

	margin: 0;
	padding: 0;
	border-width: 0;

	box-sizing: border-box;
	text-indent: 0;

	position: relative;
}

.input-mirror::after {
	content: '';
	display: inline-block;
	width: 8px;
	height: 18px;
	background-color: var(--primary-color);
	margin-left: 2px;
	vertical-align: baseline;
	position: relative;
	top: 2px;
	animation: blink 1s infinite;
	box-shadow: 0 0 5px var(--primary-color);
}

.input-mirror:empty::after {
	margin-left: 0;
}

.command-output {
	color: var(--primary-color);
	font-family: 'Share Tech Mono', monospace;
	font-size: 16px;
	text-shadow: 0 0 5px var(--primary-color);

	line-height: 1.6;
	vertical-align: baseline;
	display: inline;

	letter-spacing: normal;
	word-spacing: normal;
	white-space: pre;
	text-rendering: geometricPrecision;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;

	margin: 0;
	padding: 0;
	border-width: 0;

	box-sizing: border-box;

	text-indent: 0;
}

.cursor {
	display: none !important;
}

/* Animations */
@keyframes blink {
	0%, 49% { opacity: 1; }
	50%, 100% { opacity: 0; }
}

@keyframes flicker {
	0% { opacity: 0.97; }
	50% { opacity: 1; }
	100% { opacity: 0.97; }
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(-5px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.ascii-art {
	color: var(--primary-color);
	text-shadow: 0 0 8px var(--primary-color);
	font-size: 12px;
	line-height: 1.2;
	margin: 10px 0;
}

/* Links */
a {
	color: var(--primary-color) !important;
	text-decoration: none;
	border-bottom: 1px solid var(--primary-color);
	transition: all 0.3s;
	text-shadow: 0 0 5px var(--primary-color) !important;
}

a:hover {
	color: var(--secondary-color) !important;
	text-shadow: 0 0 10px var(--secondary-color) !important;
	border-bottom-color: var(--secondary-color);
}

.glitch {
	animation: glitch 0.3s;
}

@keyframes glitch {
	0% { transform: translate(0); }
	20% { transform: translate(-2px, 2px); }
	40% { transform: translate(-2px, -2px); }
	60% { transform: translate(2px, 2px); }
	80% { transform: translate(2px, -2px); }
	100% { transform: translate(0); }
}

/* Boot Screen */
.boot-screen {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: var(--bg-color);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	transition: opacity 1s ease-out;
}

.boot-screen.fade-out {
	opacity: 0;
	pointer-events: none;
}

.boot-content {
	text-align: center;
	padding: 40px;
	max-width: 800px;
	width: 90%;
}

.boot-logo {
	margin-bottom: 40px;
	opacity: 0;
	animation: bootLogoAppear 1s ease-out forwards;
}

.ascii-logo {
	color: var(--primary-color);
	text-shadow: 0 0 20px var(--primary-color);
	font-size: 10px;
	line-height: 1.1;
	animation: glow-pulse 2s ease-in-out infinite;
}

.boot-text {
	color: var(--primary-color);
	text-shadow: 0 0 10px var(--primary-color);
	font-size: 14px;
	min-height: 120px;
	text-align: left;
	margin-bottom: 30px;
	letter-spacing: 1px;
	line-height: 1.8;
}

.boot-text .boot-line {
	display: block;
	opacity: 0;
	animation: fadeIn 0.3s ease-out forwards;
}

.boot-progress {
	width: 100%;
	height: 4px;
	background: var(--border-glow);
	border: 1px solid var(--primary-color);
	box-shadow: 0 0 10px var(--border-glow);
	position: relative;
	overflow: hidden;
}

.progress-bar {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
	box-shadow: 0 0 20px var(--primary-color);
	transition: width 0.1s linear;
	position: relative;
}

.progress-bar::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	width: 30px;
	height: 100%;
	background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4));
	opacity: 0.8;
}

@keyframes bootLogoAppear {
	0% {
		opacity: 0;
		transform: scale(0.8);
	}
	50% {
		opacity: 0.5;
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes glow-pulse {
	0%, 100% {
		text-shadow: 0 0 20px var(--primary-color), 0 0 30px var(--primary-color);
	}
	50% {
		text-shadow: 0 0 30px var(--primary-color), 0 0 40px var(--primary-color), 0 0 50px var(--primary-color);
	}
}

#mainTerminal {
	transition: opacity 1.5s ease-in;
}

/* Responsive */
@media (max-width: 768px) {
	.terminal-content {
		font-size: 14px;
	}

	.terminal-header {
		font-size: 12px;
		letter-spacing: 1px;
	}
}
