:root {
	--ink: #151618;
	--muted: #667085;
	--line: rgba(21, 22, 24, 0.12);
	--paper: #f7f5ef;
	--panel: rgba(255, 255, 255, 0.88);
	--panel-strong: #ffffff;
	--night: #161823;
	--teal: #0f766e;
	--blue: #2563eb;
	--coral: #ef6f61;
	--gold: #c9972d;
	--violet: #7c3aed;
	--shadow: 0 22px 70px rgba(18, 22, 31, 0.16);
	--radius: 8px;
	color-scheme: light;
}

* {
	box-sizing: border-box;
}

html {
	min-height: 100%;
	background: #ede8dc;
}

body {
	min-height: 100vh;
	margin: 0;
	color: var(--ink);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	background:
		linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 28%),
		linear-gradient(315deg, rgba(239, 111, 97, 0.13), transparent 30%),
		#f4f0e6;
	letter-spacing: 0;
}

a {
	color: inherit;
	text-decoration: none;
}

button,
input,
select {
	font: inherit;
}

button,
.button,
input[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 16px;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: var(--ink);
	color: #fff;
	cursor: pointer;
	font-weight: 760;
	line-height: 1;
	transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 26px rgba(21, 22, 24, 0.14);
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.28);
	outline-offset: 2px;
}

.button-secondary {
	background: #fff;
	color: var(--ink);
	border-color: var(--line);
}

.button-ghost {
	background: rgba(255, 255, 255, 0.62);
	color: var(--ink);
	border-color: var(--line);
}

.button-coral {
	background: var(--coral);
}

.app-shell {
	display: grid;
	grid-template-columns: 280px minmax(0, 1fr);
	min-height: 100vh;
}

.sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	padding: 22px;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.74)),
		rgba(255, 255, 255, 0.86);
	border-right: 1px solid var(--line);
	backdrop-filter: blur(22px);
	overflow-y: auto;
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 28px;
}

.brand-mark {
	width: 44px;
	height: 44px;
	border-radius: 8px;
	background:
		linear-gradient(90deg, transparent 42%, #fff 42% 58%, transparent 58%),
		linear-gradient(0deg, transparent 42%, #fff 42% 58%, transparent 58%),
		linear-gradient(135deg, var(--teal), var(--blue) 48%, var(--coral));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38), 0 16px 34px rgba(37, 99, 235, 0.28);
}

.brand-name {
	display: block;
	font-size: 1.02rem;
	font-weight: 860;
}

.brand-subtitle {
	display: block;
	margin-top: 2px;
	color: var(--muted);
	font-size: 0.82rem;
}

.nav-list {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nav-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 44px;
	padding: 0 12px;
	border: 1px solid transparent;
	border-radius: var(--radius);
	color: #3a3f49;
	font-weight: 720;
}

.nav-link:hover,
.nav-link.is-active {
	background: #fff;
	border-color: var(--line);
	box-shadow: 0 14px 30px rgba(21, 22, 24, 0.08);
}

.nav-link small {
	color: var(--muted);
	font-weight: 700;
}

.sidebar-footer {
	display: grid;
	gap: 10px;
	margin-top: 28px;
	padding-top: 18px;
	border-top: 1px solid var(--line);
}

.main-panel {
	min-width: 0;
	padding: 24px;
}

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
}

.eyebrow {
	margin: 0 0 8px;
	color: var(--teal);
	font-size: 0.76rem;
	font-weight: 860;
	letter-spacing: 0;
	text-transform: uppercase;
}

h1,
h2,
h3,
p {
	margin-top: 0;
}

h1 {
	max-width: 860px;
	margin-bottom: 8px;
	font-size: clamp(2rem, 3.6vw, 4.5rem);
	line-height: 0.95;
	letter-spacing: 0;
}

.lead {
	max-width: 780px;
	margin-bottom: 0;
	color: #4b5563;
	font-size: 1.04rem;
	line-height: 1.65;
}

.db-alert {
	margin: 0 0 18px;
	padding: 12px 14px;
	border: 1px solid rgba(239, 111, 97, 0.28);
	border-radius: var(--radius);
	background: rgba(239, 111, 97, 0.1);
	color: #8f2c23;
	font-weight: 760;
}

.workspace-grid {
	display: grid;
	grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
	gap: 18px;
	align-items: start;
}

.workspace-panel,
.canvas-panel,
.admin-panel {
	border: 1px solid rgba(21, 22, 24, 0.1);
	border-radius: var(--radius);
	background: var(--panel);
	box-shadow: var(--shadow);
	backdrop-filter: blur(18px);
}

.workspace-panel {
	overflow: clip;
}

.panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 16px 12px;
	border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3 {
	margin: 0;
	font-size: 1rem;
}

.panel-kicker {
	color: var(--muted);
	font-size: 0.82rem;
	font-weight: 720;
}

.control-tabs {
	display: flex;
	gap: 6px;
	padding: 12px;
	border-bottom: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.5);
	overflow-x: auto;
}

.tab-button {
	min-height: 38px;
	white-space: nowrap;
	padding: 0 12px;
	background: transparent;
	color: #424854;
	border-color: transparent;
	box-shadow: none;
}

.tab-button:hover {
	box-shadow: none;
}

.tab-button.is-active {
	background: var(--ink);
	color: #fff;
}

.tab-panel {
	display: none;
	padding: 16px;
}

.tab-panel.is-active {
	display: block;
}

.control-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}

.field {
	display: grid;
	gap: 8px;
}

.field label,
.field-label {
	color: #313640;
	font-size: 0.78rem;
	font-weight: 840;
	text-transform: uppercase;
	letter-spacing: 0;
}

.field input,
.field select {
	width: 100%;
	min-height: 42px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.86);
	color: var(--ink);
	padding: 0 12px;
}

.field input[type="color"] {
	height: 42px;
	padding: 4px;
}

.field input[type="range"] {
	padding: 0;
	accent-color: var(--teal);
}

.field-wide {
	grid-column: 1 / -1;
}

.field-row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 10px;
	align-items: end;
}

.range-value {
	min-width: 44px;
	min-height: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: #fff;
	font-weight: 820;
}

.preset-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.preset-button {
	justify-content: flex-start;
	min-height: 58px;
	background: #fff;
	color: var(--ink);
	border-color: var(--line);
	box-shadow: none;
}

.preset-button.is-active {
	border-color: rgba(15, 118, 110, 0.42);
	box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.26), 0 14px 30px rgba(15, 118, 110, 0.1);
}

.swatch {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 0 0 1px rgba(21, 22, 24, 0.12);
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 16px;
	border-top: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.62);
}

.hide {
	display: none !important;
}

.canvas-panel {
	min-width: 0;
	overflow: hidden;
}

.canvas-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.65);
}

.canvas-toolbar h2 {
	margin: 0;
	font-size: 1rem;
}

.status-pill {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	padding: 0 10px;
	border: 1px solid rgba(15, 118, 110, 0.2);
	border-radius: 999px;
	background: rgba(15, 118, 110, 0.08);
	color: #0f5f59;
	font-size: 0.78rem;
	font-weight: 820;
}

.canvas-stage {
	position: relative;
	display: grid;
	place-items: center;
	min-height: clamp(360px, 68vh, 860px);
	padding: clamp(14px, 2vw, 28px);
	background:
		linear-gradient(90deg, rgba(21, 22, 24, 0.035) 1px, transparent 1px),
		linear-gradient(0deg, rgba(21, 22, 24, 0.035) 1px, transparent 1px),
		#f9f7f0;
	background-size: 28px 28px;
}

.maze-canvas {
	display: block;
	width: min(100%, 860px);
	height: auto;
	max-height: 78vh;
	border-radius: var(--radius);
	box-shadow: 0 24px 70px rgba(21, 22, 24, 0.22);
	background: #fff;
}

.stats-strip {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	border-top: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.76);
}

.stat {
	padding: 12px 16px;
	border-right: 1px solid var(--line);
}

.stat:last-child {
	border-right: 0;
}

.stat span {
	display: block;
	color: var(--muted);
	font-size: 0.72rem;
	font-weight: 820;
	text-transform: uppercase;
}

.stat strong {
	display: block;
	margin-top: 4px;
	font-size: 1rem;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.admin-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 18px;
}

.admin-hero {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 18px;
	align-items: end;
	padding: 22px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.82);
	box-shadow: var(--shadow);
}

.admin-hero h1 {
	font-size: clamp(1.8rem, 3vw, 3.4rem);
}

.metric-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
}

.metric {
	padding: 16px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.86);
}

.metric span {
	display: block;
	color: var(--muted);
	font-size: 0.76rem;
	font-weight: 820;
	text-transform: uppercase;
}

.metric strong {
	display: block;
	margin-top: 8px;
	font-size: clamp(1.4rem, 2.6vw, 2.4rem);
}

.admin-tabs {
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr);
	gap: 18px;
	align-items: start;
}

.tab-sidebar {
	position: sticky;
	top: 24px;
	display: grid;
	gap: 8px;
	padding: 10px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.78);
	box-shadow: 0 16px 50px rgba(21, 22, 24, 0.1);
}

.admin-tab-button {
	justify-content: flex-start;
	background: transparent;
	color: #333944;
	border-color: transparent;
	box-shadow: none;
}

.admin-tab-button.is-active {
	background: var(--ink);
	color: #fff;
}

.admin-panel {
	display: none;
	padding: 18px;
}

.admin-panel.is-active {
	display: block;
}

.admin-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
}

.setting-line {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
}

.setting-line:last-child {
	border-bottom: 0;
}

.badge {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 0 9px;
	border-radius: 999px;
	background: rgba(37, 99, 235, 0.1);
	color: #1d4ed8;
	font-size: 0.76rem;
	font-weight: 820;
}

.drawing-shell {
	min-height: 100vh;
	padding: 18px;
}

.drawing-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.84);
	box-shadow: 0 16px 46px rgba(21, 22, 24, 0.12);
}

.drawing-stage {
	width: min(100%, 1100px);
	margin: 0 auto;
	padding: 16px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.9);
	box-shadow: var(--shadow);
}

jl-coloringbook {
	display: block;
	width: 100%;
}

.gallery-page {
	min-height: 100vh;
	padding: 18px;
}

.gallery-shell {
	width: min(100%, 1280px);
	margin: 0 auto;
}

.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 14px;
	margin-top: 18px;
}

.gallery-item {
	display: block;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.88);
	box-shadow: 0 16px 42px rgba(21, 22, 24, 0.12);
}

.gallery-item img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	background: #fff;
}

.gallery-caption {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px;
	color: #333944;
	font-size: 0.86rem;
	font-weight: 780;
}

@media (max-width: 1100px) {
	.app-shell {
		grid-template-columns: 1fr;
	}

	.sidebar {
		position: static;
		height: auto;
		padding: 14px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.nav-list {
		grid-auto-flow: column;
		grid-auto-columns: minmax(142px, 1fr);
		overflow-x: auto;
	}

	.sidebar-footer {
		display: none;
	}

	.workspace-grid {
		grid-template-columns: 1fr;
	}

	.canvas-stage {
		min-height: 52vh;
	}

	.admin-tabs {
		grid-template-columns: 1fr;
	}

	.tab-sidebar {
		position: static;
		grid-template-columns: repeat(4, minmax(150px, 1fr));
		overflow-x: auto;
	}
}

@media (max-width: 760px) {
	.main-panel {
		padding: 14px;
	}

	.topbar,
	.canvas-toolbar,
	.admin-hero,
	.drawing-toolbar {
		align-items: stretch;
		flex-direction: column;
	}

	.admin-hero {
		display: flex;
	}

	.workspace-panel,
	.canvas-panel,
	.admin-panel,
	.admin-hero,
	.drawing-stage {
		border-radius: 8px;
	}

	.control-grid,
	.preset-grid,
	.metric-grid,
	.admin-grid,
	.stats-strip {
		grid-template-columns: 1fr;
	}

	.stat {
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.stat:last-child {
		border-bottom: 0;
	}

	.actions {
		display: grid;
		grid-template-columns: 1fr;
	}

	button,
	.button,
	input[type="submit"] {
		width: 100%;
	}
}
