:root {
	color-scheme: light;
	--paper: #fff7fb;
	--paper-deep: #ffe5ef;
	--ink: #392d43;
	--muted: #8e788d;
	--line: #f3cbdc;
	--accent: #ed4f91;
	--serif: "Fredoka", "Trebuchet MS", sans-serif;
	--sans: "Nunito", "Trebuchet MS", sans-serif;
}

* {
	box-sizing: border-box;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

input, textarea {
	-webkit-user-select: text;
	user-select: text;
}

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 14px;
	-webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell { height: 100%; min-height: 360px; display: flex; flex-direction: column; }

.topbar {
	height: 66px;
	flex: 0 0 66px;
	display: grid;
	grid-template-columns: 1fr minmax(200px, 1fr) 1fr;
	align-items: center;
	padding: 0 25px;
	background: #ed5a98;
	border-bottom: 3px solid #d94584;
	position: relative;
	z-index: 2;
}

.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: #fff; text-decoration: none; font-weight: 900; font-size: 16px; letter-spacing: 0; }
.brand-light { color: #ffe3ef; font-weight: 700; }
.brand-mark { height: 25px; width: 25px; position: relative; display: block; }
.brand-mark i { display: block; position: absolute; width: 13px; height: 16px; border-radius: 70% 35% 65% 45%; border: 2px solid #fff; transform: rotate(-28deg); background: #57bfc0; }
.brand-mark i:nth-child(1) { left: 1px; top: 7px; background: #ffd858; transform: rotate(-54deg); }
.brand-mark i:nth-child(2) { left: 7px; top: 4px; background: #85d878; transform: rotate(-12deg); }
.brand-mark i:nth-child(3) { left: 13px; top: 1px; background: #71a2fa; transform: rotate(24deg); }

.board-title-wrap { justify-self: center; display: flex; align-items: center; flex-direction: column; gap: 2px; min-width: 0; }
.board-title { width: 220px; border: 0; outline: 0; text-align: center; background: transparent; color: #fff; font-family: var(--serif); font-weight: 600; font-size: 18px; padding: 2px 5px; border-radius: 6px; }
.board-title:focus { background: #ffffff24; }
.save-state { display: flex; align-items: center; gap: 5px; color: #ffeaf2; font-size: 11px; font-weight: 700; }
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: #b7f58a; }

.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.icon-button, .export-button, .zoom-button, .zoom-readout, .fit-button, .tool-button { display: grid; place-items: center; border: 0; cursor: pointer; }
.icon-button { width: 38px; height: 38px; background: #ffffff26; color: #fff; border-radius: 9px; }
.icon-button:hover:not(:disabled) { background: #ffffff42; color: #fff; }
.icon-button:disabled { opacity: .35; cursor: default; }
.icon-button svg, .export-button svg, .fit-button svg, .tool-button svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; width: 18px; height: 18px; }
.top-divider { height: 22px; width: 1px; background: #ffffff52; margin: 0 5px; }
.export-button { display: flex; gap: 8px; align-items: center; height: 40px; padding: 0 15px; border: 2px solid #fff1aa; border-radius: 10px; background: #ffdf62; color: #54374b; font-size: 13px; font-weight: 900; transition: transform .15s ease, background .15s ease; }
.export-button:hover { background: #ffe98f; transform: translateY(-1px); }
.export-button svg { width: 16px; height: 16px; }

.workspace { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--paper); }
#canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#canvas.is-panning { cursor: grabbing; }
#canvas.is-hand { cursor: grab; }
#canvas.is-fill { cursor: cell; }
#canvas.is-select { cursor: crosshair; }
#canvas.is-moving-selection { cursor: move; }

.tool-rail {
	position: absolute; left: 20px; top: 20px; z-index: 1;
	display: flex; align-items: center; flex-direction: column; gap: 10px;
	width: 58px; padding: 10px 0; background: #fff;
	border: 2px solid #f3cadb; border-radius: 12px;
	box-shadow: 0 5px 0 #e9bdd0, 0 8px 18px #9a49721a;
}
.tool-group { display: flex; flex-direction: column; gap: 4px; }
.tool-button { width: 42px; height: 42px; border-radius: 10px; color: #886f87; background: transparent; position: relative; }
.tool-button:hover { background: #fff0f6; color: var(--ink); }
.tool-button.active { color: #fff; background: var(--accent); box-shadow: 0 3px 0 #c83b78; }
.tool-button.active::after { content: ""; position: absolute; right: -10px; width: 3px; height: 19px; border-radius: 3px; background: #ffc94f; }
.tool-button svg { width: 20px; height: 20px; }
.rail-rule { width: 26px; height: 2px; background: #f4d9e4; }

.settings-panel {
	position: absolute; z-index: 1; top: 20px; left: 92px; width: 260px;
	padding: 15px 16px 13px; background: #fff; border: 2px solid #f3cadb; border-radius: 12px;
	box-shadow: 0 5px 0 #e9bdd0, 0 8px 18px #9a49721a; transition: opacity .15s ease, transform .15s ease;
}
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 0 12px; border-bottom: 2px solid #f9e5ee; font-family: var(--serif); font-size: 20px; color: #d83e80; }
.panel-indicator { display: block; width: 10px; height: 10px; border: 2px solid white; border-radius: 50%; background: #76c967; box-shadow: 0 0 0 1px #76c967; }
.setting-block { padding-top: 13px; }
.setting-label { display: flex; justify-content: space-between; align-items: center; color: #795f78; font-size: 12px; font-weight: 800; }
.setting-label output, #color-value { color: #d44783; font-variant-numeric: tabular-nums; font-weight: 900; }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-items: center; gap: 10px 4px; margin-top: 11px; }
.swatch { width: 34px; height: 34px; background: var(--swatch); border: 2px solid #fff; border-radius: 50%; padding: 0; cursor: pointer; position: relative; box-shadow: 0 1px 3px #50334d33; transition: transform .12s ease; }
.swatch:hover { transform: scale(1.12); }
.swatch.selected::after { content: ""; position: absolute; inset: -5px; border: 2px solid var(--swatch); border-radius: 50%; }
.custom-color { display: grid; place-items: center; height: 34px; width: 34px; position: relative; border: 2px solid #fff; border-radius: 50%; background: #ffe0ed; cursor: pointer; color: #c9437c; box-shadow: 0 1px 3px #50334d33; }
.custom-color input { position: absolute; width: 34px; height: 34px; inset: 0; opacity: 0; cursor: pointer; }
.custom-color svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.brush-type-block { padding-top: 15px; }
.brush-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.brush-type-button { min-width: 0; min-height: 49px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; border: 2px solid transparent; border-radius: 8px; background: #fff5f9; color: #805f7c; font-size: 10px; line-height: 1; font-weight: 900; cursor: pointer; }
.brush-type-button:hover { background: #ffebf3; }
.brush-type-button.selected { border-color: #ee7dae; background: #ffe5f0; color: #be3372; }
.brush-sample {
	display: block;
	width: 22px;
	height: 22px;
	filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.08));
	color: #1f1a23;
	opacity: 0.96;
}

.brush-type-button .brush-sample {
	opacity: 1;
}

.brush-type-button .brush-sample path,
.brush-type-button .brush-sample rect,
.brush-type-button .brush-sample circle,
.brush-type-button .brush-sample line,
.brush-type-button .brush-sample polyline,
.brush-type-button .brush-sample polygon {
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	fill: currentColor;
}
.size-block { padding-top: 16px; }
input[type="range"] { appearance: none; display: block; width: 100%; height: 8px; margin: 14px 0 8px; border-radius: 99px; background: #f5d9e5; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 22px; height: 22px; border: 3px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 4px #73345155; }
input[type="range"]::-moz-range-thumb { width: 17px; height: 17px; border: 3px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 4px #73345155; }
.range-captions { display: flex; justify-content: space-between; color: #a3829c; font-size: 10px; font-weight: 700; }
.panel-foot { display: flex; align-items: center; gap: 4px; white-space: nowrap; margin-top: 14px; padding-top: 10px; border-top: 2px solid #f9e5ee; font-size: 10px; color: #987f94; font-weight: 700; }
.keycap { font-size: 10px; padding: 2px 5px; min-width: 19px; text-align: center; border: 1px solid #f0cfdd; border-radius: 5px; background: #fff5f9; color: #8d5d7b; }
.foot-dot { margin: 0 1px; }

.canvas-status { position: absolute; left: 22px; bottom: 17px; display: flex; gap: 7px; align-items: center; font-size: 11px; color: #a27f98; font-variant-numeric: tabular-nums; pointer-events: none; font-weight: 700; }
.status-crosshair { font-size: 16px; color: #ed77aa; }
.zoom-controls { display: flex; align-items: center; position: absolute; right: 20px; bottom: 17px; padding: 4px; height: 42px; background: #fff; border: 2px solid #f3cadb; border-radius: 10px; box-shadow: 0 3px 0 #e9bdd0; }
.zoom-button { width: 34px; height: 32px; background: transparent; color: #805e7d; border-radius: 7px; font-size: 21px; line-height: 1; font-weight: 800; }
.zoom-button:hover, .fit-button:hover { background: #fff0f6; }
.zoom-readout { width: 50px; height: 32px; background: transparent; color: #805e7d; font-size: 11px; font-weight: 900; font-variant-numeric: tabular-nums; }
.zoom-divider { height: 21px; width: 2px; background: #f3dce6; margin: 0 4px; }
.fit-button { width: 34px; height: 32px; background: transparent; color: #805e7d; border-radius: 7px; }
.fit-button svg { width: 16px; height: 16px; }

button:focus-visible, input:focus-visible { outline: 3px solid #4d9cf0; outline-offset: 2px; }

@media (max-width: 640px) {
	.topbar { height: 58px; flex-basis: 58px; padding: 0 12px; grid-template-columns: 1fr auto; }
	.brand { font-size: 13px; gap: 7px; }
	.brand-mark { transform: scale(.88); transform-origin: left center; width: 22px; }
	.board-title-wrap { display: none; }
	.top-actions { gap: 3px; }
	.export-button { width: 38px; padding: 0; justify-content: center; }
	.export-button span { display: none; }
	.top-divider { margin: 0 2px; }
	.tool-rail { top: auto; bottom: 68px; left: 50%; transform: translateX(-50%); width: auto; height: 48px; flex-direction: row; padding: 0 8px; gap: 8px; }
	.tool-group { flex-direction: row; gap: 3px; }
	.rail-rule { width: 1px; height: 22px; }
	.tool-button { width: 38px; height: 38px; }
	.tool-button.active::after { right: auto; bottom: -8px; width: 16px; height: 3px; }
	.settings-panel { left: 12px; top: 12px; width: 196px; padding: 11px 12px 9px; }
	.panel-heading { padding-bottom: 9px; }
	.setting-block { padding-top: 10px; }
	.swatches { gap: 8px 2px; }
	.swatch, .custom-color { width: 30px; height: 30px; }
	.custom-color input { width: 30px; height: 30px; }
	.size-block { padding-top: 13px; }
	.panel-foot { display: none; }
	.canvas-status { left: 13px; bottom: 18px; }
	.zoom-controls { right: 12px; bottom: 13px; }
}

@media (max-width: 380px) {
	.settings-panel { width: 180px; }
	.swatches { gap: 7px 1px; }
	.swatch, .custom-color { width: 27px; height: 27px; }
	.custom-color input { width: 27px; height: 27px; }
}
