/* style.css */

html {
	height: 100%;
	margin: 0;
	padding: 0;
}

body {
	margin: 0;
	padding: 2rem;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	background-color: var(--bg);
	color: var(--fg);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	text-align: center;
	box-sizing: border-box;
	overflow: auto;
	transition: background-color 0.3s ease, color 0.3s ease;
}

#top-stack {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-items: center;
	flex-grow: 1;

	*:first-child {
		margin-top: auto;
	}

	*:last-child {
		margin-bottom: auto;
	}
}

pre#output {
	font-size: 2rem;
	font-weight: 500;
	padding: 1rem 2rem;
	border-radius: 12px;
	background: var(--bg-alt);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
	word-break: break-word;
	white-space: pre-wrap;
	max-width: 90%;
	max-height: calc(100vh - 480px);
	overflow-y: auto;
	transition: background 0.3s ease, color 0.3s ease;
}

.buttons {
	display: flex;
	gap: 1rem;
	margin-top: 1rem;
}

button,
a.btn {
	padding: 0.6rem 1.2rem;
	font-size: 1rem;
	font-weight: 500;
	background-color: transparent;
	color: inherit;
	border: 2px solid currentColor;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: none;
	display: inline-block;
}

button:hover,
a.btn:hover {
	background-color: rgba(0, 0, 0, 0.05);
	/* Light overlay for light mode */
}

#char-options {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1rem;
	margin-top: 1rem;
	margin-bottom: 1.5rem;
	font-size: 0.95rem;
	text-align: left;
}

.custom-checkbox {
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.custom-checkbox input {
	display: none;
	/* Hide actual checkbox */
}

.custom-checkbox .box {
	font-family: monospace;
	font-size: 1.1rem;
	display: inline-block;
	width: 1.2rem;
	text-align: center;
	border: 2px solid currentColor;
	border-radius: 4px;
	line-height: 1.1rem;
	height: 1.2rem;
}

.custom-checkbox input:checked+.box::before {
	content: "x";
}

.custom-checkbox input:not(:checked)+.box::before {
	content: " ";
}

.custom-checkbox input:disabled+.box,
.custom-checkbox input:disabled+.box+* {
	opacity: 0.4;
	cursor: not-allowed;
}

#bottom-stack {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: end;
	height: 96px;
	gap: 0.5rem;
	z-index: 20;
}

.recent-container {
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, transform 0.3s ease;
	max-width: 90vw;
	width: 400px;
	background-color: var(--bg-alt);
	color: var(--fg);
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.recent-container * {
	height: 0;
}

.recent-container.show {
	opacity: 1;
	visibility: visible;
	padding: 1rem;
}

.recent-container.show * {
	height: auto;
}

.recent-container ul {
	list-style: none;
	padding: 0;
	margin: 0;
	max-height: calc(100vh - 240px);
	overflow-y: auto;
}

.recent-container li {
	padding: 0;
	border-bottom: 1px solid var(--border);
}

.recent-container li:first-child {
	border-top: none;
}

.recent-container li:last-child {
	border-bottom: none;
}


.recent-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	padding: 0.6rem 0;
	text-align: center;
}

.recent-item .text {
	word-wrap: break-word;
	white-space: normal;
	width: 100%;
	font-size: 1rem;
}

.recent-item .time {
	font-size: 0.85rem;
	color: var(--text-muted, #777);
	opacity: 0.7;
}

footer {
	text-align: center;
	font-size: 0.9rem;
	opacity: 0.6;
}

footer a {
	color: inherit;
	text-decoration: underline;
}

/* Slider container */
.slider-group {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-top: 1rem;
}

/* Slider element */
input[type="range"] {
	-webkit-appearance: none;
	width: 200px;
	height: 1rem;
	background-color: var(--bg);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

/* Track */
input[type="range"]::-webkit-slider-runnable-track {
	height: 0.5rem;
	background: var(--border);
	border-radius: 4px;
}
input[type="range"]::-moz-range-track {
	height: 0.5rem;
	background: var(--border);
	border-radius: 4px;
}

/* Thumb (the knob) */
input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 1.2rem;
	height: 1.2rem;
	background-color: var(--fg);
	border: none;
	border-radius: 50%;
	margin-top: -0.35rem; /* to center thumb vertically */
	transition: background-color 0.2s ease;
}
input[type="range"]::-moz-range-thumb {
	width: 1.2rem;
	height: 1.2rem;
	background-color: var(--fg);
	border: none;
	border-radius: 50%;
	cursor: pointer;
}

/* Focus ring removal */
input[type="range"]:focus {
	outline: none;
}

/* Optional: hover effect */
input[type="range"]:hover::-webkit-slider-thumb {
	background-color: var(--fg-alt);
}

/* Dark/light theme variables */
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #121212;
		--fg: #eee;
		--fg-alt: #ccc;
		--border: #333;
		--bg-alt: #1e1e1e;
	}
}

@media (prefers-color-scheme: light) {
	:root {
		--bg: #f9f9f9;
		--fg: #222;
		--fg-alt: #444;
		--border: #ccc;
		--bg-alt: #ececec;
	}
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
	button:hover,
	a.btn:hover {
		background-color: rgba(255, 255, 255, 0.1);
		/* Light overlay for dark mode */
	}
}
