@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&display=swap');

* {
	margin    : 0;
	padding   : 0;
	box-sizing: border-box;
}

:root {
	--bg-deep     : #0a0e1a;
	--bg-base     : #0f172a;
	--bg-panel    : rgb(205, 205, 205);
	--bg-input    : #1e293b;
	--border      : #1e293b;
	--border-mid  : #334155;
	--text        : #222;
	--text-dim    : #333;
	--text-muted  : #fefefe;
	--accent      : #3b82f6;
	--accent-light: #93c5fd;
	--purple      : #a78bfa;
	--green       : #4ade80;
	--amber       : #f59e0b;
	--mono        : "Ubuntu Mono", monospace;
}

#rightpart {
	min-height : 100vh;
	background : white;
	color      : var(--text);
	font-family: var(--mono);
	padding    : 24px 16px;
}

header {
	text-align   : center;
	margin-bottom: 32px;
}

header h1 {
	font-size              : 26px;
	font-weight            : 700;
	background             : linear-gradient(135deg, #043877, #270788, #032d61);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip        : text;
	margin-bottom          : 0;
	padding                : 0;
}

header p {
	color         : #222;
	font-size     : 14px;
	margin-top    : 0px;
	letter-spacing: 0.05em;
}

.layout {
	display        : flex;
	gap            : 24px;
	max-width      : 920px;
	margin         : 0 auto;
	flex-wrap      : wrap;
	justify-content: center;
	padding-top    : 0;
	margin-top     : 0;
}

/* ── Controls Panel ── */
.controls {
	width        : 310px;
	flex-shrink  : 0;
	background   : #eee;
	border-radius: 12px;
	border       : 1px solid var(--border);
	padding      : 20px;
}

.section-label {
	font-size     : .9rem;
	color         : #333;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-bottom : 10px;
	display       : block;
}

.field-label {
	font-size     : 11px;
	font-weight   : 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color         : #333;
}

.divider {
	height    : 1px;
	background: linear-gradient(90deg, transparent, var(--border-mid), transparent);
	margin    : 16px 0;
}

/* Position selector */
.position-grid {
	display              : grid;
	grid-template-columns: 1fr 1fr;
	gap                  : 6px;
	margin-top           : 10px;
}

.pos-btn {
	position     : relative;
	padding      : 10px 8px;
	border-radius: 8px;
	border       : 1px solid var(--border-mid);
	background   : rgba(30, 41, 59, 0.5);
	cursor       : pointer;
	font-family  : var(--mono);
	font-size    : 13px;
	font-weight  : 600;
	display      : flex;
	align-items  : center;
	gap          : 8px;
	transition   : all 0.15s ease;
	color     : white;
}

.pos-btn:hover {
	background: rgba(30, 41, 59, 0.8);
}

.pos-btn.active {
	border    : 2px solid var(--accent);
	background: rgba(30, 41, 59, 0.8);
	color     : white;
}

.pos-btn svg rect.indicator {
	fill   : #fff;
	opacity: 0.7;
}

.pos-btn svg rect.outline {
	stroke: #fff;
}

.pos-btn.active svg rect.indicator {
	fill: rgb(197, 229, 197);
}

.pos-btn.active svg rect.outline {
	stroke: rgb(197, 229, 197);
}

/* Slider groups */
.slider-group {
	margin-bottom: 16px;
}

.slider-header {
	display        : flex;
	justify-content: space-between;
	align-items    : baseline;
	margin-bottom  : 6px;
}

.slider-value {
	font-size    : 14px;
	font-weight  : 700;
	color        : white;
	background   : var(--bg-input);
	padding      : 2px 8px;
	border-radius: 4px;
}

.slider-value .unit {
	color      : var(--text-muted);
	font-size  : 10px;
	margin-left: 2px;
}

.slider-row {
	display    : flex;
	align-items: center;
	gap        : 8px;
}

.slider-row input[type="range"] {
	flex        : 1;
	accent-color: var(--accent);
	height      : 6px;
	cursor      : pointer;
}

.slider-row input[type="number"] {
	font-size: .85rem;
	width        : 60px;
	padding      : 4px 6px;
	background   : var(--bg-input);
	border       : 1px solid var(--border-mid);
	border-radius: 4px;
	color        : white;
	font-family  : var(--mono);
	text-align   : center;
}

.slider-row input[type="number"]:focus {
	outline: 1px solid var(--accent);
}

/* Color row */
.color-row {
	display      : flex;
	align-items  : center;
	gap          : 10px;
	margin-bottom: 8px;
}

.color-row input[type="color"] {
	width        : 32px;
	height       : 24px;
	border       : 1px solid var(--border-mid);
	border-radius: 4px;
	cursor       : pointer;
	background   : none;
	padding      : 0;
}

.color-row .color-hex {
	font-size: 12px;
	color    : var(--text-muted);
}

/* Checkbox */
.check-row {
	display    : flex;
	align-items: center;
	gap        : 8px;
	cursor     : pointer;
	margin-top : 8px;
	font-size  : 11px;
	color      : #333;
}

.check-row input {
	accent-color: var(--accent);
}

/* ── Preview Panel ── */
.preview-panel {
	flex     : 1;
	min-width: 320px;
}

.card {
	background   : #eee;
	border-radius: 12px;
	border       : 1px solid var(--border);
	padding      : 20px;
	margin-bottom: 16px;
}

.card-title {
	font-size     : .9rem;
	color         : #222;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-bottom : 12px;
}

.preview-container {
	display        : flex;
	justify-content: center;
	align-items    : center;
	min-height     : 200px;
}

.preview-wrapper {
	position: relative;
}

.checkerboard {
	position     : absolute;
	inset        : 0;
	border-radius: 4px;
	overflow     : hidden;
	background-image:
		linear-gradient(45deg, var(--bg-input) 25%, transparent 25%),
		linear-gradient(-45deg, var(--bg-input) 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, var(--bg-input) 75%),
		linear-gradient(-45deg, transparent 75%, var(--bg-input) 75%);
	background-size    : 16px 16px;
	background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
	opacity            : 0.5;
}

.preview-wrapper svg {
	position: relative;
	display : block;
}

/* Code blocks */
.code-header {
	display        : flex;
	justify-content: space-between;
	align-items    : center;
	margin-bottom  : 10px;
}

.copy-btn {
	padding      : 4px 12px;
	border-radius: 6px;
	border       : 1px solid var(--border-mid);
	background   : rgba(30, 41, 59, 0.8);
	color        : white;
	cursor       : pointer;
	font-family  : var(--mono);
	font-size    : 11px;
	transition   : all 0.2s ease;
}

.copy-btn:hover {
	background: green;
	color     : rgb(244, 244, 207);
}

.copy-btn.copied {
	background  : forestgreen;
	color       : white;
	border-color: green;
}

pre {
	margin       : 0;
	padding      : 12px;
	background   : var(--bg-deep);
	border-radius: 8px;
	overflow     : auto;
	font-family  : var(--mono);
	font-size    : 11px;
	line-height  : 1.6;
	white-space  : pre-wrap;
	word-break   : break-all;
}

pre.code-svg {
	color     : white;
	max-height: 160px;
}

pre.code-path {
	color     : rgb(248, 234, 248);
	max-height: 100px;
}

/* Reference card */
.ref-card {
	margin-top   : 16px;
	padding      : 14px;
	background   : rgba(217, 217, 217, 0.05);
	border-radius: 10px;
	border       : 1px solid rgba(59, 130, 246, 0.15);
}

.ref-card .card-title {
	font-size: .9rem;
	color        : #222;
	margin-bottom: 8px;
}

.ref-card code {
	color: purple;
}

.ref-card .convex {
	color: green;
}

.ref-card .concave {
	color: orangered;
}

.ref-card p {
	font-size  : 11px;
	line-height: 1.8;
	color      : var(--text-dim);
}