.ht-app {
	--ht-header-h: 56px;
	--ht-panel-w: 300px;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	background: var(--it-bg);
	color: var(--it-text);
	overflow: hidden;
}

.is-hidden {
	display: none !important;
}

.ht-header {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 20px;
	height: var(--ht-header-h);
	padding: 0 18px 0 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(10, 11, 13, 0.92);
	backdrop-filter: blur(12px);
}

.ht-header__start {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.ht-header__brand {
	display: inline-flex;
	flex-shrink: 0;
}

.ht-header__logo {
	display: block;
	width: 20px;
	height: auto;
	animation: it-logo-glitch 2s steps(1, end) infinite;
}

.ht-header__titles {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}

.ht-header__eyebrow {
	font-size: 0.65rem;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--it-muted);
}

.ht-header__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.1;
}

.ht-header__nav {
	display: flex;
	align-items: center;
	gap: 18px;
	margin-left: auto;
	font-size: 0.84rem;
}

.ht-header__nav a {
	color: var(--it-muted);
}

.ht-header__nav a:hover {
	color: var(--it-text);
}

.ht-header__actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

.ht-workspace {
	flex: 1;
	display: grid;
	grid-template-columns: var(--ht-panel-w) minmax(0, 1fr);
	min-height: 0;
}

.ht-panel {
	padding: 18px 16px 24px;
	border-right: 1px solid rgba(255, 255, 255, 0.08);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 120px),
		#0a0b0d;
	overflow-y: auto;
	overflow-x: hidden;
}

.ht-panel__section {
	margin-bottom: 22px;
}

.ht-panel__section--sliders {
	margin-bottom: 0;
}

.ht-panel__label {
	margin: 0 0 10px;
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--it-muted);
}

.ht-upload__input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.ht-upload__empty {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	padding: 14px;
	border: 1.5px dashed rgba(255, 255, 255, 0.12);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.02);
	transition: border-color 0.2s ease, background 0.2s ease;
}

.ht-upload.is-drag-over .ht-upload__empty,
.ht-viewport.is-drag-over .ht-viewport__empty {
	border-color: rgba(var(--it-accent-rgb), 0.45);
	background: rgba(var(--it-accent-rgb), 0.06);
}

.ht-upload__hint {
	margin: 0;
	font-size: 0.74rem;
	line-height: 1.45;
	color: var(--it-muted);
}

.ht-upload__loaded {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.03);
}

.ht-upload__thumb {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.ht-upload__name {
	display: block;
	font-size: 0.8rem;
	font-weight: 500;
	word-break: break-all;
	margin-bottom: 3px;
}

.ht-upload__change {
	font-size: 0.76rem;
	color: var(--it-accent);
	cursor: pointer;
}

.ht-upload__change:hover {
	text-decoration: underline;
}

.ht-segment {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	padding: 4px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(255, 255, 255, 0.03);
}

.ht-segment__btn {
	padding: 9px 8px;
	border: none;
	border-radius: 7px;
	background: transparent;
	color: var(--it-muted);
	font: inherit;
	font-size: 0.78rem;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.ht-segment__btn:hover {
	color: var(--it-text);
	background: rgba(255, 255, 255, 0.06);
}

.ht-segment__btn.is-active {
	color: var(--it-text);
	background: rgba(var(--it-accent-rgb), 0.18);
	box-shadow: inset 0 0 0 1px rgba(var(--it-accent-rgb), 0.25);
}

.ht-colors {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: 8px;
	align-items: end;
	margin-bottom: 12px;
}

.ht-colors__pick {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ht-colors__pick-label {
	font-size: 0.72rem;
	color: var(--it-muted);
}

.ht-colors__pick input[type="color"] {
	width: 100%;
	height: 34px;
	padding: 2px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.03);
	cursor: pointer;
}

.ht-colors__swap {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	margin-bottom: 1px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.03);
	color: var(--it-muted);
	cursor: pointer;
}

.ht-colors__swap:hover {
	color: var(--it-text);
	border-color: rgba(255, 255, 255, 0.16);
}

.ht-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.ht-presets__btn {
	width: 28px;
	height: 28px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 999px;
	background: transparent;
	cursor: pointer;
}

.ht-presets__btn span {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(135deg, var(--a) 0 50%, var(--b) 50% 100%);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.ht-presets__btn.is-active {
	border-color: var(--it-accent);
}

.ht-slider {
	--ht-slider-track-h: 2px;
	--ht-slider-track: #666;
	--ht-slider-thumb-size: 18px;
	--ht-slider-thumb-radius: 3px;
	--ht-slider-thumb: #d4d4d4;
	margin-bottom: 14px;
}

.ht-slider__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
	font-size: 0.78rem;
}

.ht-slider__head label {
	color: var(--it-muted);
}

.ht-slider__head output {
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 0.74rem;
	color: var(--it-text);
}

.ht-slider input[type="range"] {
	display: block;
	width: 100%;
	height: var(--ht-slider-thumb-size);
	margin: 0;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.ht-slider input[type="range"]::-webkit-slider-runnable-track {
	height: var(--ht-slider-track-h);
	border: none;
	border-radius: 0;
	background: var(--ht-slider-track);
}

.ht-slider input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: var(--ht-slider-thumb-size);
	height: var(--ht-slider-thumb-size);
	margin-top: calc((var(--ht-slider-track-h) - var(--ht-slider-thumb-size)) / 2);
	border: none;
	border-radius: var(--ht-slider-thumb-radius);
	background: var(--ht-slider-thumb);
	cursor: pointer;
}

.ht-slider input[type="range"]::-moz-range-track {
	height: var(--ht-slider-track-h);
	border: none;
	border-radius: 0;
	background: var(--ht-slider-track);
}

.ht-slider input[type="range"]::-moz-range-progress {
	height: var(--ht-slider-track-h);
	border: none;
	border-radius: 0;
	background: var(--ht-slider-track);
}

.ht-slider input[type="range"]::-moz-range-thumb {
	width: var(--ht-slider-thumb-size);
	height: var(--ht-slider-thumb-size);
	border: none;
	border-radius: var(--ht-slider-thumb-radius);
	background: var(--ht-slider-thumb);
	cursor: pointer;
}

.ht-slider input[type="range"]:focus {
	outline: none;
}

.ht-slider input[type="range"]:focus-visible::-webkit-slider-thumb {
	outline: 2px solid rgba(255, 255, 255, 0.22);
	outline-offset: 2px;
}

.ht-slider input[type="range"]:focus-visible::-moz-range-thumb {
	outline: 2px solid rgba(255, 255, 255, 0.22);
	outline-offset: 2px;
}

.ht-stage {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
	background:
		radial-gradient(ellipse 80% 60% at 50% 0%, rgba(220, 38, 38, 0.04), transparent 55%),
		radial-gradient(ellipse 60% 50% at 80% 100%, rgba(8, 145, 178, 0.04), transparent 55%),
		linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
		#08090b;
	background-size: auto, auto, 24px 24px, 24px 24px, auto;
}

.ht-stage__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 10px 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	background: rgba(0, 0, 0, 0.28);
}

.ht-view-tabs {
	display: inline-flex;
	padding: 3px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(255, 255, 255, 0.03);
}

.ht-view-tabs__btn {
	padding: 6px 12px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--it-muted);
	font-size: 0.78rem;
	font-weight: 500;
	cursor: pointer;
}

.ht-view-tabs__btn.is-active {
	background: rgba(255, 255, 255, 0.1);
	color: var(--it-text);
}

.ht-stage__meta {
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 0.72rem;
	color: var(--it-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ht-viewport {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.ht-viewport__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: min(420px, 100%);
	padding: 40px 24px;
	border: 1.5px dashed rgba(255, 255, 255, 0.1);
	border-radius: 16px;
	text-align: center;
	color: var(--it-muted);
	transition: border-color 0.2s ease, background 0.2s ease;
}

.ht-viewport__empty-icon {
	color: rgba(255, 255, 255, 0.35);
}

.ht-viewport__empty-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	color: var(--it-text);
}

.ht-viewport__empty-hint {
	margin: 0;
	font-size: 0.84rem;
	line-height: 1.5;
}

.ht-viewport__frames {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	max-height: 100%;
}

.ht-compare {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ht-compare__stage {
	position: relative;
	display: inline-block;
	line-height: 0;
	max-width: 100%;
	max-height: calc(100vh - var(--ht-header-h) - 120px);
	max-height: calc(100dvh - var(--ht-header-h) - 120px);
	--ht-compare-split: 50%;
	touch-action: none;
	user-select: none;
}

.ht-compare__stage.is-dragging {
	cursor: ew-resize;
}

body.ht-compare-dragging {
	cursor: ew-resize;
	user-select: none;
}

.ht-compare__canvas {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - var(--ht-header-h) - 120px);
	max-height: calc(100dvh - var(--ht-header-h) - 120px);
	width: auto;
	height: auto;
}

.ht-compare__before {
	position: absolute;
	top: 0;
	left: 0;
	width: var(--ht-compare-split);
	height: 100%;
	overflow: hidden;
	z-index: 1;
}

.ht-compare__before .ht-compare__canvas {
	position: absolute;
	top: 0;
	left: 0;
	max-width: none;
	max-height: none;
}

.ht-compare__divider {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--ht-compare-split);
	z-index: 2;
	width: 2px;
	transform: translateX(-50%);
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
	cursor: ew-resize;
	touch-action: none;
}

.ht-compare__divider::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: -14px;
	right: -14px;
}

.ht-compare__handle {
	position: absolute;
	top: 50%;
	left: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 2px solid rgba(255, 255, 255, 0.92);
	border-radius: 50%;
	background: rgba(8, 9, 11, 0.42);
	color: #fff;
	backdrop-filter: blur(6px);
	transform: translate(-50%, -50%);
	cursor: ew-resize;
	touch-action: none;
}

.ht-compare__handle:focus {
	outline: none;
}

.ht-compare__handle:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.45);
	outline-offset: 3px;
}

.ht-compare__handle-icon {
	width: 22px;
	height: 22px;
}

.ht-compare--result .ht-compare__before,
.ht-compare--result .ht-compare__divider {
	display: none;
}

.ht-compare--source .ht-compare__canvas[data-ht-canvas] {
	visibility: hidden;
}

.ht-compare--source .ht-compare__before {
	position: absolute;
	inset: 0;
	width: 100%;
	overflow: visible;
}

.ht-compare--source .ht-compare__before .ht-compare__canvas {
	position: static;
	width: auto !important;
	height: auto !important;
	max-width: 100%;
	max-height: calc(100vh - var(--ht-header-h) - 120px);
	max-height: calc(100dvh - var(--ht-header-h) - 120px);
}

.ht-compare--source .ht-compare__divider {
	display: none;
}

.ht-canvas {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - var(--ht-header-h) - 120px);
	max-height: calc(100dvh - var(--ht-header-h) - 120px);
	width: auto;
	height: auto;
}

.ht-export {
	position: relative;
}

.ht-export__caret {
	width: 12px;
	height: 12px;
	margin-left: 2px;
}

.ht-export__menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 30;
	min-width: 168px;
	padding: 6px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	background: #12141a;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.ht-export__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 10px 12px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--it-text);
	font-size: 0.84rem;
	cursor: pointer;
}

.ht-export__item:hover {
	background: rgba(255, 255, 255, 0.06);
}

.ht-export__item-ext {
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 0.72rem;
	color: var(--it-muted);
}

.ht-buffer,
.ht-source-buffer {
	position: absolute;
	left: -9999px;
	top: -9999px;
}

.ht-toast {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 50;
	padding: 12px 16px;
	border-radius: 10px;
	border: 1px solid rgba(var(--it-accent-rgb), 0.25);
	background: rgba(14, 16, 20, 0.94);
	color: var(--it-text);
	font-size: 0.84rem;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

@media (max-width: 960px) {
	.ht-workspace {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr;
	}

	.ht-panel {
		max-height: 42vh;
		border-right: 0;
		border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	}

	.ht-header__nav {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ht-header__logo {
		animation: none;
	}
}
