/* =========================================================
   Crayon Corner — online coloring tool
   ========================================================= */

.ct-page { padding: 40px 24px 64px; }
.ct-app [hidden] { display: none !important; }
.ct-intro { max-width: 760px; margin-bottom: 24px; }

.ct-app {
	background: #fff;
	border: 2.5px solid var(--ink);
	border-radius: var(--radius-sheet);
	box-shadow: var(--shadow-pop);
	padding: 18px;
}

/* ---------- Toolbar ---------- */

.ct-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}
.ct-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.ct-tool,
.ct-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-width: 44px;
	min-height: 44px;
	padding: 8px 14px;
	border: 2.5px solid var(--ink);
	border-radius: 12px 14px 11px 13px / 13px 11px 14px 12px;
	background: #fff;
	color: var(--ink);
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 0.9rem;
	cursor: pointer;
	box-shadow: 0 3px 0 rgba(45, 49, 66, 0.14);
	transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.ct-tool svg,
.ct-btn svg { width: 20px; height: 20px; }
.ct-tool:hover,
.ct-btn:hover { background: #FFF6DE; }
.ct-tool:active,
.ct-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(45, 49, 66, 0.14); }
.ct-tool.is-active { background: var(--yellow); }
.ct-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.ct-btn--primary { background: var(--yellow); }
.ct-btn--primary:hover { background: var(--yellow); transform: translateY(-2px); box-shadow: 0 5px 0 rgba(45, 49, 66, 0.14); }
.ct-btn--upload { cursor: pointer; }

.ct-size { display: inline-flex; align-items: center; gap: 8px; padding: 0 6px; }
.ct-size__label { font-family: var(--font-display); font-weight: 600; font-size: 0.85rem; }
.ct-size input[type="range"] { width: 110px; accent-color: var(--pink); }

/* ---------- Colors ---------- */

.ct-colorbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	padding: 12px 0 14px;
	border-top: 2px dashed rgba(45, 49, 66, 0.15);
	border-bottom: 2px dashed rgba(45, 49, 66, 0.15);
	margin-bottom: 14px;
}
.ct-palettes { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#ct-palette {
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 0.9rem;
	padding: 9px 12px;
	border: 2.5px solid var(--ink);
	border-radius: 10px 12px 9px 11px / 11px 9px 12px 10px;
	background: #fff;
	color: var(--ink);
}
.ct-swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.ct-swatch {
	width: 34px;
	height: 34px;
	border: 2.5px solid var(--ink);
	border-radius: 47% 53% 48% 52% / 52% 46% 54% 48%;
	cursor: pointer;
	padding: 0;
	transition: transform 0.12s ease;
}
.ct-swatch:hover { transform: scale(1.12); }
.ct-swatch.is-active {
	outline: 3px solid var(--pink);
	outline-offset: 2px;
	transform: scale(1.08);
}
.ct-custom { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.ct-custom input[type="color"] {
	width: 44px;
	height: 40px;
	border: 2.5px solid var(--ink);
	border-radius: 10px;
	background: #fff;
	padding: 2px;
	cursor: pointer;
}

/* ---------- Stage ---------- */

.ct-stage { display: flex; justify-content: center; }
.ct-canvas-wrap {
	position: relative;
	width: 100%;
	max-width: 620px;
	border: 2.5px solid var(--ink);
	border-radius: 10px 13px 9px 12px / 12px 9px 13px 10px;
	overflow: hidden;
	background: #fff;
	touch-action: none;
	cursor: crosshair;
}
.ct-canvas-wrap[data-tool="fill"] { cursor: cell; }
.ct-canvas-wrap[data-tool="eraser"] { cursor: grab; }
.ct-canvas-wrap canvas {
	display: block;
	width: 100%;
	height: auto;
}
#ct-lines {
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.ct-empty {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: rgba(255, 255, 255, 0.75);
	text-align: center;
	padding: 20px;
}
.ct-empty__msg {
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 1.1rem;
	color: var(--ink);
	margin: 0;
	max-width: 22em;
}
.ct-empty__icon { font-size: 2.2rem; }

/* ---------- Page picker ---------- */

.ct-pages { margin-top: 22px; }
.ct-pages__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}
.ct-pages__title { font-size: 1.15rem; margin: 0; }
.ct-pages__search {
	flex: 1;
	min-width: 200px;
	max-width: 340px;
	padding: 10px 18px;
	border: 2.5px solid var(--ink);
	border-radius: 999px;
	font-family: var(--font-body);
	font-size: 0.95rem;
	background: #fff;
}
.ct-pages__status { color: var(--ink-soft); margin: 10px 0 0; }
.ct-pages__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
	gap: 10px;
}
.ct-pages__item {
	padding: 0;
	border: 2.5px solid var(--ink);
	border-radius: 10px 12px 9px 11px / 11px 9px 12px 10px;
	overflow: hidden;
	background: #fff;
	cursor: pointer;
	aspect-ratio: 3 / 4;
	box-shadow: 0 3px 0 rgba(45, 49, 66, 0.12);
	transition: transform 0.15s ease;
}
.ct-pages__item:hover { transform: translateY(-3px); }
.ct-pages__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
	.ct-page { padding: 28px 16px 48px; }
	.ct-app { padding: 12px; }
	.ct-toolbar { justify-content: center; }
	.ct-tool__label { display: none; }
	.ct-btn span { display: none; }
	.ct-canvas-wrap { max-width: 100%; }
	.ct-size input[type="range"] { width: 90px; }
}
