:root {
	color-scheme: light dark;
	font-family: Inter, system-ui, sans-serif;
	--bg: #ececf1;
	--panel: rgba(248, 248, 250, 0.78);
	--panel-strong: rgba(255, 255, 255, 0.92);
	--line: rgba(60, 60, 67, 0.12);
	--text: #111214;
	--muted: #6e6e73;
	--accent: #111214;
	--canvas: #ffffff;
	--shadow: 0 10px 30px rgba(17, 18, 20, 0.1);
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	width: 100%;
	height: 100%;
}

body {
	min-height: 100vh;
	overflow: hidden;
	background: var(--bg);
	color: var(--text);
}

button,
input {
	font: inherit;
}

button {
	cursor: pointer;
}

.app-header,
.dock,
.board__badge {
	transition: opacity 150ms ease, transform 150ms ease;
}

body.is-drawing .app-header,
body.is-drawing .dock,
body.is-drawing .board__badge {
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
}

.app {
	width: 100vw;
	height: 100vh;
	position: relative;
}

.app-header {
	position: fixed;
	top: 1rem;
	left: 1rem;
	right: 1rem;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.app-header__identity {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	padding: 0.75rem 0.95rem;
	background: var(--panel);
	backdrop-filter: blur(20px);
	border: 1px solid var(--line);
	border-radius: 20px;
	box-shadow: var(--shadow);
}

.app-icon {
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 14px;
	background: #ffffff;
	border: 1px solid rgba(60, 60, 67, 0.08);
	display: grid;
	place-items: center;
	color: #ff9f0a;
	flex: 0 0 auto;
}

.app-header__eyebrow {
	margin: 0 0 0.16rem;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
}

.app-header__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: -0.03em;
}

.app-header__actions {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.45rem;
	background: var(--panel);
	backdrop-filter: blur(20px);
	border: 1px solid var(--line);
	border-radius: 18px;
	box-shadow: var(--shadow);
}

.header-button,
.tool-chip {
	border: 1px solid var(--line);
	background: var(--panel-strong);
	color: var(--text);
	transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.header-button {
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border-radius: 14px;
	display: inline-grid;
	place-items: center;
}

.header-button--primary {
	background: #111214;
	border-color: #111214;
	color: #ffffff;
}

.board {
	position: relative;
	width: 100%;
	height: 100%;
}

.board__badge {
	position: fixed;
	left: 50%;
	top: 1.1rem;
	transform: translateX(-50%);
	z-index: 15;
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.65rem 0.9rem;
	background: rgba(255, 255, 255, 0.8);
	backdrop-filter: blur(18px);
	border: 1px solid var(--line);
	border-radius: 999px;
	font-size: 0.82rem;
	box-shadow: var(--shadow);
}

.status-dot {
	width: 0.55rem;
	height: 0.55rem;
	border-radius: 50%;
	background: #ff9f0a;
}

.canvas-shell {
	position: fixed;
	inset: 0;
	background: var(--canvas);
	overflow: hidden;
}

#drawingCanvas {
	display: block;
	width: 100%;
	height: 100vh;
	touch-action: none;
	cursor: crosshair;
}

.dock {
	position: fixed;
	left: 1rem;
	right: 1rem;
	bottom: 1rem;
	z-index: 20;
	padding: 0.7rem;
	background: var(--panel);
	backdrop-filter: blur(24px);
	border: 1px solid var(--line);
	border-radius: 26px;
	box-shadow: var(--shadow);
	display: grid;
	gap: 0.7rem;
}

.dock__tools {
	display: flex;
	gap: 0.45rem;
	overflow-x: auto;
	scrollbar-width: none;
}

.dock__tools::-webkit-scrollbar {
	display: none;
}

.tool-chip {
	padding: 0.62rem 0.8rem;
	min-width: 4.6rem;
	border-radius: 16px;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	font-size: 0.74rem;
	font-weight: 600;
	white-space: nowrap;
	flex: 0 0 auto;
}

.tool-chip.is-active {
	background: #111214;
	border-color: #111214;
	color: #ffffff;
}

.dock__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
}

.swatches {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	flex-wrap: wrap;
}

.swatch {
	width: 1.9rem;
	height: 1.9rem;
	padding: 0;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.95);
	background: var(--swatch);
	box-shadow: 0 0 0 1px rgba(17, 18, 20, 0.12);
	position: relative;
	flex: 0 0 auto;
}

.swatch.is-active::after {
	content: '';
	position: absolute;
	inset: -0.22rem;
	border-radius: 50%;
	border: 1.5px solid #111214;
}

.swatch--picker {
	overflow: hidden;
	background: conic-gradient(from 180deg, #ff3b30, #ff9f0a, #ffd60a, #34c759, #30b0c7, #0a84ff, #bf5af2, #ff375f, #ff3b30);
}

.swatch__input {
	opacity: 0;
	width: 100%;
	height: 100%;
	cursor: pointer;
}

.size-control {
	display: grid;
	grid-template-columns: auto minmax(160px, 240px) auto;
	align-items: center;
	gap: 0.7rem;
	min-width: min(100%, 360px);
}

.size-control__label {
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted);
}

.size-control__range {
	accent-color: #111214;
}

.size-control__value {
	min-width: 2rem;
	text-align: right;
	font-size: 0.82rem;
	font-weight: 700;
}

.header-button:hover,
.tool-chip:hover,
.swatch:hover {
	transform: translateY(-1px);
}

.lucide {
	width: 0.95rem;
	height: 0.95rem;
	stroke-width: 2.1;
}

@media (max-width: 860px) {
	.app-header {
		gap: 0.75rem;
	}

	.app-header__identity {
		padding: 0.7rem 0.85rem;
	}

	.app-header__title {
		font-size: 0.98rem;
	}

	.dock {
		left: 0.75rem;
		right: 0.75rem;
		bottom: 0.75rem;
	}

	.size-control {
		grid-template-columns: 1fr;
		min-width: 100%;
	}
}

@media (max-width: 640px) {
	.app-header {
		top: 0.7rem;
		left: 0.7rem;
		right: 0.7rem;
	}

	.board__badge {
		top: 4.9rem;
		max-width: calc(100vw - 1.4rem);
	}

	.app-header__eyebrow {
		display: none;
	}

	.tool-chip {
		min-width: 4.2rem;
		padding: 0.58rem 0.72rem;
	}

	.dock {
		padding: 0.62rem;
		border-radius: 22px;
	}
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #1c1d20;
		--panel: rgba(34, 34, 38, 0.76);
		--panel-strong: rgba(44, 45, 50, 0.92);
		--line: rgba(255, 255, 255, 0.08);
		--text: #f5f5f7;
		--muted: #a1a1aa;
		--canvas: #ffffff;
		--shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
	}

	body {
		background: #1b1c1f;
	}

	.app-icon {
		background: rgba(255, 255, 255, 0.08);
		border-color: rgba(255, 255, 255, 0.06);
	}

	.header-button--primary,
	.tool-chip.is-active {
		background: #f5f5f7;
		border-color: #f5f5f7;
		color: #111214;
	}

	.board__badge {
		background: rgba(44, 45, 50, 0.86);
	}

	.size-control__range {
		accent-color: #f5f5f7;
	}

	.swatch.is-active::after {
		border-color: #f5f5f7;
	}
}