/**
 * Universal teletext remote (CSS recreation of remote.webp + RGYB buttons).
 */

.retrotext-remote {
	flex: 0 0 auto;
	width: 118px;
	filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5));
}

.retrotext-remote__body {
	background: linear-gradient(180deg, #3a3a3a 0%, #2b2b2b 8%, #242424 100%);
	border: 1px solid #1a1a1a;
	border-radius: 4px;
	padding: 8px 8px 0;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.08),
		inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

/* IR window */
.retrotext-remote__ir {
	position: relative;
	height: 10px;
	margin-bottom: 8px;
	border-radius: 2px;
	background: linear-gradient(180deg, #a01818, #6b0000);
	box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

.retrotext-remote__led {
	position: absolute;
	top: 2px;
	right: 4px;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #ff2222;
	box-shadow: 0 0 4px #ff0000;
}

/* Number keypad */
.retrotext-remote__keypad {
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin-bottom: 8px;
}

.retrotext-remote__row {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 3px;
}

.retrotext-remote__key {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 22px;
	padding: 2px 0;
	border: none;
	border-radius: 2px;
	background: linear-gradient(180deg, #b8b8b8 0%, #9e9e9e 45%, #888 100%);
	color: #222;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	box-shadow:
		0 1px 0 #666,
		inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.retrotext-remote__key:hover {
	background: linear-gradient(180deg, #ccc, #aaa);
}

.retrotext-remote__key:active {
	transform: translateY(1px);
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.retrotext-remote__key--wide {
	min-height: 20px;
	font-size: 7px;
	letter-spacing: 0.04em;
}

.retrotext-remote__key--power {
	margin-bottom: 4px;
}

/* Middle section */
.retrotext-remote__mid {
	margin-bottom: 8px;
}

.retrotext-remote__left {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

/* Teletext colour buttons under POWER */
.retrotext-remote__colors {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 3px;
	margin-top: 2px;
}

/* P- / P+ back-forward row under colours */
.retrotext-remote__nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 3px;
	margin-top: 2px;
}

.retrotext-remote__key--nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-height: 22px;
	padding: 2px 4px;
}

.retrotext-remote__nav-arrow {
	font-size: 11px;
	line-height: 1;
	color: #222;
}

.retrotext-remote__nav-label {
	font-size: 7px;
	letter-spacing: 0.05em;
}

.retrotext-remote__color {
	width: 100%;
	aspect-ratio: 1;
	min-height: 16px;
	border: 1px solid rgba(0, 0, 0, 0.35);
	border-radius: 2px;
	cursor: pointer;
	padding: 0;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.35),
		0 1px 0 rgba(0, 0, 0, 0.4);
}

.retrotext-remote__color:active {
	transform: translateY(1px);
}

.retrotext-remote__color--red {
	background: linear-gradient(180deg, #ff4444, #cc0000);
}

.retrotext-remote__color--green {
	background: linear-gradient(180deg, #44ff44, #00aa00);
}

.retrotext-remote__color--yellow {
	background: linear-gradient(180deg, #ffff66, #cccc00);
}

.retrotext-remote__color--blue {
	background: linear-gradient(180deg, #4488ff, #0044cc);
}

.retrotext-remote__key--enter {
	font-size: 7px;
	letter-spacing: 0.05em;
}

.retrotext-remote__key--spacer {
	visibility: hidden;
	pointer-events: none;
	background: transparent;
	box-shadow: none;
}

/* Bottom blank panel */
.retrotext-remote__panel {
	height: 52px;
	margin: 0 -8px;
	border-radius: 0 0 3px 3px;
	background: linear-gradient(180deg, #2e2e2e, #252525);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* Desktop — 1.5× remote size */
@media (min-width: 901px) {
	.retrotext-remote {
		width: 177px;
	}

	.retrotext-remote__body {
		padding: 12px 12px 0;
		border-radius: 6px;
	}

	.retrotext-remote__ir {
		height: 15px;
		margin-bottom: 12px;
		border-radius: 3px;
	}

	.retrotext-remote__led {
		top: 3px;
		right: 6px;
		width: 8px;
		height: 8px;
	}

	.retrotext-remote__keypad {
		gap: 4.5px;
		margin-bottom: 12px;
	}

	.retrotext-remote__row {
		gap: 4.5px;
	}

	.retrotext-remote__key {
		min-height: 33px;
		font-size: 13.5px;
		border-radius: 3px;
	}

	.retrotext-remote__key--wide {
		min-height: 30px;
		font-size: 10.5px;
	}

	.retrotext-remote__key--nav {
		min-height: 33px;
		gap: 6px;
	}

	.retrotext-remote__nav-arrow {
		font-size: 16px;
	}

	.retrotext-remote__nav-label {
		font-size: 10.5px;
	}

	.retrotext-remote__mid {
		margin-bottom: 12px;
	}

	.retrotext-remote__left {
		gap: 4.5px;
	}

	.retrotext-remote__nav {
		gap: 4.5px;
		margin-top: 4px;
	}

	.retrotext-remote__color {
		min-height: 24px;
		border-radius: 3px;
	}

	.retrotext-remote__key--enter {
		font-size: 10.5px;
	}

	.retrotext-remote__panel {
		height: 78px;
		margin: 0 -12px;
	}
}

/* Phone landscape — wide remote under TV */
@media (max-width: 900px) and (orientation: landscape) {
	.retrotext-remote {
		width: min(100%, 720px);
		max-width: 100%;
	}

	.retrotext-remote__body {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: flex-start;
		justify-content: center;
		gap: 6px 10px;
		padding: 6px 8px;
	}

	.retrotext-remote__ir {
		flex: 1 1 100%;
		height: 6px;
		margin-bottom: 0;
		order: 0;
	}

	.retrotext-remote__keypad {
		flex: 0 0 auto;
		margin-bottom: 0;
		order: 1;
	}

	.retrotext-remote__mid {
		flex: 1 1 180px;
		margin-bottom: 0;
		order: 2;
		min-width: 160px;
	}

	.retrotext-remote__panel {
		display: none;
	}

	.retrotext-remote__key {
		min-height: 20px;
		font-size: 8px;
	}

	.retrotext-remote__key--wide {
		min-height: 18px;
		font-size: 6px;
	}

	.retrotext-remote__color {
		min-height: 14px;
	}
}
