*,
*::before,
*::after {
	box-sizing: border-box;
	margin    : 0;
	padding   : 0;
}

:root {
	--bg        : #0d0d0f;
	--surface   : #141416;
	--surface2  : #1c1c1f;
	--surface3  : #252528;
	--border    : #2a2a2e;
	--text      : white;
	--text-dim  : #c9c9d1;
	--text-muted: #8a8a8f;
	--accent    : #7c6cfa;
	--accent2   : #fa6c9a;
}

.app {
	background           : var(--bg);
	color                : var(--text);
	font-size            : 12px;
	overflow             : hidden;
	display              : grid;
	grid-template-columns: 1fr 300px;
	height               : 100vh;
}

/* ─── CANVAS ZONE ─── */
.canvas-zone {
	position      : relative;
	display       : flex;
	flex-direction: column;
	overflow      : hidden;
	background    : var(--bg);
}

.canvas-header {
	display        : flex;
	align-items    : center;
	justify-content: space-between;
	padding        : 16px 20px;
	border-bottom  : 1px solid var(--border);
	flex-shrink    : 0;
}

.canvas-title {
	font-size     : 28px;
	font-weight   : 700;
	color         : var(--text);
	line-height: 1.1;
}

.canvas-subtitle {
	font-size : 16px;
	color     : var(--text-dim);
	margin-top: 2px;
}

.canvas-actions {
	display: flex;
	gap    : 8px;
}

.btn {
	padding       : 7px 14px;
	border-radius : 6px;
	border        : 1px solid var(--border);
	background    : var(--surface2);
	color         : var(--text-dim);

	font-size     : 11px;
	cursor        : pointer;
	transition    : all 0.15s;
	letter-spacing: 0.03em;
}

.btn:hover {
	color       : var(--text);
	border-color: var(--accent);
	background  : var(--surface3);
}

.btn-primary {
	background  : var(--accent);
	border-color: var(--accent);
	color       : #fff;
}

.btn-primary:hover {
	opacity: 0.85;
	color  : #fff;
}

.canvas-wrap {
	flex           : 1;
	display        : flex;
	align-items    : center;
	justify-content: center;
	padding        : 32px;
	position       : relative;
}

#gradient-canvas {
	border-radius: 12px;
	cursor       : crosshair;
	box-shadow   : 0 0 0 1px var(--border), 0 32px 80px rgba(0, 0, 0, 0.6);
	display      : block;
}

/* ─── PANEL ─── */
.panel {
	background    : var(--surface);
	border-left   : 1px solid var(--border);
	display       : flex;
	flex-direction: column;
	overflow      : hidden;
}

.panel-header {
	padding      : 16px 20px;
	border-bottom: 1px solid var(--border);
	flex-shrink  : 0;
}

.panel-title {
	font-family   : 'Syne', sans-serif;
	font-size     : 13px;
	font-weight   : 700;
	letter-spacing: 0.05em;
}

.panel-body {
	flex           : 1;
	overflow-y     : auto;
	padding        : 12px;
	scrollbar-width: thin;
	scrollbar-color: var(--border) transparent;
}

.panel-footer {
	padding    : 12px;
	border-top : 1px solid var(--border);
	flex-shrink: 0;
}

/* ─── GLOBAL BLUR ─── */
.global-blur {
	background   : var(--surface2);
	border-radius: 8px;
	padding      : 12px 14px;
	margin-bottom: 10px;
	border       : 1px solid var(--border);
}

.global-blur-label {
	display        : flex;
	justify-content: space-between;
	align-items    : center;
	margin-bottom  : 8px;
}

.label-text {
	color         : var(--text-dim);
	font-size     : 10px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.label-value {
	color    : var(--accent);
	font-size: 11px;
}

input[type=range] {
	-webkit-appearance: none;
	width             : 100%;
	height            : 4px;
	border-radius     : 2px;
	background        : var(--border);
	outline           : none;
	cursor            : pointer;
}

input[type=range]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width             : 14px;
	height            : 14px;
	border-radius     : 50%;
	background        : var(--accent);
	border            : 2px solid var(--bg);
	cursor            : pointer;
	box-shadow        : 0 0 0 1px var(--accent);
}

/* ─── LAYER CARDS ─── */
.layer-card {
	background   : var(--surface2);
	border       : 1px solid var(--border);
	border-radius: 10px;
	margin-bottom: 8px;
	overflow     : hidden;
	transition   : border-color 0.2s;
}

.layer-card.active {
	border-color: var(--accent);
}

.layer-card.hidden-layer {
	opacity: 0.4;
}

.layer-head {
	display    : flex;
	align-items: center;
	gap        : 8px;
	padding    : 10px 12px;
	cursor     : pointer;
	user-select: none;
}

.layer-index {
	font-size  : 10px;
	color      : var(--text-muted);
	width      : 14px;
	flex-shrink: 0;
}

.layer-swatch {
	width        : 28px;
	height       : 28px;
	border-radius: 6px;
	border       : none;
	cursor       : pointer;
	flex-shrink  : 0;
	outline      : none;
	box-shadow   : inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.layer-name {
	flex       : 1;
	font-size  : 11px;
	color      : var(--text);
}

.layer-actions {
	display: flex;
	gap    : 4px;
}

.icon-btn {
	width          : 26px;
	height         : 26px;
	border-radius  : 5px;
	border         : 1px solid transparent;
	background     : transparent;
	color          : var(--text-muted);
	cursor         : pointer;
	display        : flex;
	align-items    : center;
	justify-content: center;
	font-size      : 13px;
	transition     : all 0.15s;
	line-height    : 1;
}

.icon-btn:hover {
	color       : var(--text);
	background  : var(--surface3);
	border-color: var(--border);
}

.icon-btn.danger:hover {
	color       : #fa6c6c;
	border-color: #fa6c6c44;
}

.layer-controls {
	padding       : 0 12px 12px;
	display       : flex;
	flex-direction: column;
	gap           : 10px;
}

.control-row {
	display       : flex;
	flex-direction: column;
	gap           : 6px;
}

.control-label {
	display        : flex;
	justify-content: space-between;
	align-items    : center;
}

.xy-inputs {
	display              : grid;
	grid-template-columns: 1fr 1fr;
	gap                  : 6px;
}

.xy-field {
	display      : flex;
	align-items  : center;
	background   : var(--surface3);
	border       : 1px solid var(--border);
	border-radius: 6px;
	overflow     : hidden;
}

.xy-field label {
	padding     : 0 8px;
	color       : var(--text-muted);
	font-size   : 10px;
	border-right: 1px solid var(--border);
	flex-shrink : 0;
	user-select : none;
}

.xy-field input[type=number] {
	background : transparent;
	border     : none;
	outline    : none;
	color      : var(--text);
	font-size  : 11px;
	padding    : 5px 8px;
	width      : 100%;
}

/* ─── ADD BUTTON ─── */
.add-layer-btn {
	width         : 100%;
	padding       : 10px;
	border-radius : 8px;
	border        : 1px dashed var(--border);
	background    : transparent;
	color         : var(--text-dim);

	font-size     : 11px;
	cursor        : pointer;
	transition    : all 0.2s;
	letter-spacing: 0.05em;
}

.add-layer-btn:hover {
	border-color: var(--accent);
	color       : var(--accent);
	background  : rgba(124, 108, 250, 0.05);
}

.add-layer-btn:disabled {
	opacity: 0.3;
	cursor : not-allowed;
}

/* ─── CSS OUTPUT ─── */
.css-output {
	background   : var(--bg);
	border-radius: 8px;
	border       : 1px solid var(--border);
	padding      : 12px;
	font-size    : 10px;
	color        : var(--text-dim);
	line-height  : 1.6;
	white-space  : pre-wrap;
	word-break   : break-all;
	max-height   : 120px;
	overflow-y   : auto;
	cursor       : text;
	user-select  : all;
}

.output-label {
	font-size     : 10px;
	color         : var(--text-muted);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin-bottom : 6px;
}

/* ─── CANVAS OVERLAY ─── */
.overlay-canvas {
	position      : absolute;
	border-radius : 12px;
	pointer-events: none;
}

/* ─── TOOLTIP ─── */
.tooltip {
	position      : fixed;
	background    : var(--surface3);
	border        : 1px solid var(--border);
	border-radius : 6px;
	padding       : 5px 10px;
	font-size     : 11px;
	color         : var(--text);
	pointer-events: none;
	z-index       : 100;
	display       : none;

}

.mode-hint {
	font-size     : 10px;
	color         : var(--text-muted);
	text-align    : center;
	padding       : 6px 0 0;
	letter-spacing: 0.05em;
}

/* ─── RATIO CONTROLS ─── */
.ratio-bar {
	display      : flex;
	align-items  : center;
	gap          : 10px;
	padding      : 8px 20px;
	border-bottom: 1px solid var(--border);
	background   : var(--surface);
	flex-shrink  : 0;
}

.ratio-label {
	font-size     : 10px;
	color         : var(--text-muted);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	flex-shrink   : 0;
}

.ratio-presets {
	display  : flex;
	gap      : 4px;
	flex-wrap: wrap;
}

.ratio-btn {
	padding       : 4px 9px;
	border-radius : 5px;
	border        : 1px solid var(--border);
	background    : transparent;
	color         : var(--text-dim);

	font-size     : 10px;
	cursor        : pointer;
	transition    : all 0.15s;
	letter-spacing: 0.02em;
}

.ratio-btn:hover {
	color       : var(--text);
	border-color: var(--accent);
}

.ratio-btn.active {
	background  : var(--accent);
	border-color: var(--accent);
	color       : #fff;
}

.ratio-divider {
	width      : 1px;
	height     : 18px;
	background : var(--border);
	flex-shrink: 0;
}

.ratio-custom {
	display    : flex;
	align-items: center;
	gap        : 5px;
}

.ratio-input-wrap {
	display      : flex;
	align-items  : center;
	background   : var(--surface2);
	border       : 1px solid var(--border);
	border-radius: 5px;
	overflow     : hidden;
}

.ratio-input-wrap label {
	padding     : 0 6px;
	color       : var(--text-muted);
	font-size   : 10px;
	border-right: 1px solid var(--border);
	user-select : none;
}

.ratio-input-wrap input[type=number] {
	background : transparent;
	border     : none;
	outline    : none;
	color      : var(--text);
	font-size  : 10px;
	padding    : 4px 6px;
	width      : 44px;
}

.ratio-sep {
	color    : var(--text-muted);
	font-size: 11px;
}