/* ==========================================================================
   Cero Kids – uses the Cero Portal theme tokens (--surface, --border, --muted…) with fallbacks.
   ========================================================================== */

.kids-page { --k-surface: var(--surface, #fff); --k-border: var(--border, #e2dfd7); --k-muted: var(--muted, #6a6a70); --k-radius: var(--radius-lg, 22px); }
.kids-hero__vi { display: inline-block; font-size: .55em; font-weight: 600; color: var(--k-muted); margin-left: 6px; letter-spacing: 0; }

/* ---------- hub tiles ---------- */
.kids-tiles { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 36px; }
.kids-tile {
	--accent: #f59e0b;
	display: flex; flex-direction: column; gap: 4px; padding: 22px 22px 24px; border-radius: var(--k-radius);
	background: var(--k-surface); border: 1px solid var(--k-border); color: inherit; text-decoration: none;
	border-top: 6px solid var(--accent); box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, .08));
	transition: transform .15s ease, box-shadow .15s ease;
}
.kids-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg, 0 20px 50px rgba(0, 0, 0, .14)); }
.kids-tile__icon { font-size: 2.8rem; line-height: 1.1; margin-bottom: 6px; }
.kids-tile__title { font-size: 1.3rem; font-weight: 750; }
.kids-tile__vi { color: var(--accent); font-weight: 700; }
.kids-tile__text { color: var(--k-muted); margin-top: 4px; }

/* ---------- gallery ---------- */
.kids-section { margin-bottom: 32px; }
.kids-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.kids-section__title { font-size: 1.35rem; font-weight: 750; margin: 0 0 14px; }
.kids-section__title small { font-size: .7em; font-weight: 600; color: var(--k-muted); margin-left: 4px; }
.kids-gallery { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.kids-pic {
	display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 12px 14px; border-radius: var(--radius, 14px);
	background: var(--k-surface); border: 1px solid var(--k-border); color: inherit; text-decoration: none; text-align: center;
	transition: transform .15s ease, box-shadow .15s ease;
}
.kids-pic:hover { transform: translateY(-2px); box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, .08)); }
.kids-pic img { width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; background: #fff; margin-bottom: 6px; }
.kids-pic__title { font-weight: 700; }
.kids-pic__vi { color: var(--k-muted); font-size: .9rem; }

/* ---------- coloring ---------- */
.kc { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.kc__paper { margin: 0; background: #fff; border-radius: var(--k-radius); border: 1px solid var(--k-border); padding: 12px; box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, .08)); }
.kc__paper svg { display: block; width: 100%; height: auto; max-height: 72vh; touch-action: manipulation; }
.kc-region { cursor: pointer; transition: fill .12s ease; }
.kc-region:hover { filter: brightness(.94); }
.kc__paper svg [fill="none"], .kc__paper svg [fill="#222"] { pointer-events: none; }
.kc__hint { color: var(--k-muted); font-size: .9rem; text-align: center; margin: 8px 0 0; }
.kc__tools { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 16px; padding: 16px; background: var(--k-surface); border: 1px solid var(--k-border); border-radius: var(--k-radius); }
.kc__palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.kc__color {
	position: relative; box-sizing: border-box; aspect-ratio: 1; width: 100%; padding: 0; border-radius: 50%; cursor: pointer;
	background: var(--c); border: 2px solid rgba(0, 0, 0, .15); transition: transform .1s ease;
}
.kc__color:hover { transform: scale(1.08); }
.kc__color.is-active { box-shadow: 0 0 0 3px var(--k-surface), 0 0 0 6px var(--text, #1d1d1f); transform: scale(1.05); }
.kc__color:focus-visible { outline: 3px solid var(--primary, #3b4fd8); outline-offset: 3px; }
.kc__color--custom { display: grid; place-items: center; overflow: hidden; background: conic-gradient(#ef4444, #facc15, #22c55e, #3b82f6, #8b5cf6, #ef4444); }
.kc__color--custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.kc__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kc__actions .fc-btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
.kc__actions .fc-btn[disabled] { opacity: .45; cursor: default; }
.kc__blank { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--k-muted); width: 100%; }
.kc__nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 24px; }

@media (max-width: 860px) {
	.kc { grid-template-columns: 1fr; }
	.kc__tools { position: static; }
	.kc__palette { grid-template-columns: repeat(9, 1fr); }
}
@media (max-width: 480px) {
	.kc__palette { grid-template-columns: repeat(6, 1fr); }
	.kc__paper { padding: 6px; }
}

/* ---------- writing sheets ---------- */
.kw { display: grid; gap: 24px; grid-template-columns: 360px minmax(0, 1fr); align-items: start; }
.kw__form {
	display: flex; flex-direction: column; gap: 14px; padding: 18px; position: sticky; top: 16px;
	background: var(--k-surface); border: 1px solid var(--k-border); border-radius: var(--k-radius);
}
.kw__group { border: 0; margin: 0; padding: 0; }
.kw__group legend, .kw__field > span { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; }
.kw__choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kw__choice { position: relative; display: flex; cursor: pointer; }
.kw__choice input { position: absolute; opacity: 0; }
.kw__choice span { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--k-border); background: var(--surface-2, #efede7); }
.kw__choice small { color: var(--k-muted); font-size: .78rem; line-height: 1.3; }
.kw__choice input:checked + span { border-color: var(--primary, #3b4fd8); background: var(--primary-soft, #e7eafd); }
.kw__choice input:focus-visible + span { outline: 3px solid var(--primary, #3b4fd8); outline-offset: 2px; }
.kw__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.kw__field { display: block; }
.kw__field[hidden] { display: none; }
.kw__field select, .kw__field input[type="text"], .kw__field textarea {
	width: 100%; font: inherit; color: var(--text, #1d1d1f); background: var(--surface-2, #efede7);
	border: 1px solid var(--k-border); border-radius: 10px; padding: 8px 10px;
}
.kw__field textarea { resize: vertical; min-height: 90px; }
.kw__check { display: flex; align-items: center; gap: 8px; font-size: .92rem; padding-bottom: 8px; }
.kw__actions { display: flex; align-items: center; gap: 12px; }
.kw__count { color: var(--k-muted); font-size: .9rem; }
.kw__tip { margin: 0; color: var(--k-muted); font-size: .82rem; }
.kw__sheets { display: flex; flex-direction: column; gap: 20px; }
.kw-sheet { display: block; width: 100%; height: auto; background: #fff; border-radius: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 10px 30px rgba(0, 0, 0, .1); }

@media (max-width: 900px) {
	.kw { grid-template-columns: 1fr; }
	.kw__form { position: static; }
}

/* ---------- printing: only #kids-print (built by the scripts) ---------- */
.kids-print { display: none; }
@media print {
	@page { size: A4; margin: 0; }
	body.kids-printing { background: #fff !important; margin: 0; }
	body.kids-printing > *:not(#kids-print) { display: none !important; }
	body.kids-printing .kids-print { display: block; }
	.kids-print--sheets svg { display: block; width: 210mm; height: 297mm; break-after: page; page-break-after: always; }
	.kids-print--sheets svg:last-child { break-after: auto; page-break-after: auto; }
	.kids-print--picture { padding: 15mm; text-align: center; }
	.kids-print--picture svg { display: block; width: 180mm; height: 180mm; margin: 20mm auto 0; }
	.kids-print__caption { font: 14pt/1.4 sans-serif; color: #555; margin-top: 10mm; }
}

/* ---------- printable paper (templates/paper.php) ---------- */
.kp .kw__form { max-height: calc(100vh - 32px); overflow-y: auto; }
.kp__types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kp__type { position: relative; display: flex; cursor: pointer; }
.kp__type input { position: absolute; opacity: 0; }
.kp__type > span {
	flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 8px; text-align: center;
	border-radius: 10px; border: 2px solid var(--k-border); background: var(--surface-2, #efede7); font-size: .78rem; line-height: 1.25;
}
.kp__type b { font-weight: 650; }
.kp__type small { display: none; }
.kp__thumb { width: 100%; max-width: 64px; aspect-ratio: 1; background: #fff; border-radius: 6px; }
.kp__type input:checked + span { border-color: var(--primary, #3b4fd8); background: var(--primary-soft, #e7eafd); }
.kp__type input:focus-visible + span { outline: 3px solid var(--primary, #3b4fd8); outline-offset: 2px; }
.kp__num { display: flex; gap: 6px; }
.kp__num input { flex: 1; min-width: 0; }
.kp__num select { width: auto; }
.kp__colors { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kp__colors input[type="color"] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--k-border); border-radius: 8px; background: var(--surface-2, #efede7); }
.kp__swatch { width: 22px; height: 22px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid rgba(0, 0, 0, .12); cursor: pointer; }
.kp__actions .fc-btn { flex: 1; justify-content: center; }
.kp .kw__sheets { align-items: center; }
.kp .kw-sheet { max-height: 85vh; width: auto; max-width: 100%; }
@media (max-width: 900px) {
	.kp .kw__form { max-height: none; overflow: visible; }
	.kp .kw-sheet { width: 100%; max-height: none; }
}

/* ---------- coloring ages ---------- */
.kids-ages { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 28px; }
.kids-ages__item {
	display: flex; flex-direction: column; gap: 1px; padding: 9px 16px; border-radius: 14px; text-decoration: none; color: inherit;
	background: var(--k-surface); border: 2px solid var(--k-border); line-height: 1.25;
}
.kids-ages__item small { color: var(--k-muted); font-size: .8rem; }
.kids-ages__item:hover { border-color: var(--primary, #3b4fd8); }
.kids-ages__item.is-active { border-color: var(--primary, #3b4fd8); background: var(--primary-soft, #e7eafd); }
.kids-pic { position: relative; }
.kids-age {
	display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
	background: #fef3c7; color: #92400e;
}
.kids-age--kid { background: #dcfce7; color: #166534; }
.kids-age--big { background: #ede9fe; color: #5b21b6; }
.kids-view-picture .fc-page__head .kids-age { margin-top: 4px; font-size: .85rem; }

/* ---------- uploaded pictures: paint bucket (assets/js/coloring-canvas.js) ---------- */
.kc__canvas { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; margin: 0 auto; cursor: crosshair; touch-action: manipulation; background: #fff; }
.kc:not(.is-ready) .kc__canvas { min-height: 300px; background: #fff linear-gradient(90deg, #fff, #f2f2f2, #fff) 0 0 / 200% 100%; animation: kc-load 1.2s linear infinite; }
@keyframes kc-load { to { background-position: -200% 0; } }
@media print { .kids-print--picture img { display: block; width: 180mm; max-height: 230mm; object-fit: contain; margin: 10mm auto 0; } }

/* ---------- locked coloring pages (guests, see Cero Accounts) ---------- */
.kids-pic__lock { position: absolute; top: 10px; right: 10px; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 4px rgba(0, 0, 0, .18); font-size: 1.05rem; color: var(--btn, #db2777); }
/* Locked thumbnails: blurred, a little clearer on hover so kids can still see what is inside. */
.kids-pic.is-locked img { opacity: .75; filter: blur(5px) grayscale(.2); transform: scale(1.02); transition: filter .25s ease, opacity .25s ease; }
.kids-pic.is-locked:hover img, .kids-pic.is-locked:focus-visible img { filter: blur(2.5px) grayscale(.1); opacity: .9; }
.kids-pic.is-locked { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .kids-pic.is-locked img { transition: none; } }
.kids-locked {
	display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 28px; align-items: center; padding: 24px;
	background: var(--k-surface); border: 1px solid var(--k-border); border-radius: var(--k-radius); box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, .08));
}
.kids-locked__pic { position: relative; background: #fff; border-radius: 14px; overflow: hidden; }
.kids-locked__pic img { display: block; width: 100%; height: auto; opacity: .6; filter: blur(7px); transform: scale(1.06); }
.kids-locked__pic::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255, 255, 255, .15), rgba(255, 255, 255, .55)); }
.kids-locked__icon { z-index: 1; }
.kids-locked__icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; color: var(--btn, #db2777); }
.kids-locked__title { font-size: 1.4rem; font-weight: 750; margin: 0 0 8px; }
.kids-locked__body p { color: var(--k-muted); margin: 0 0 10px; }
.kids-locked__body .fc-btn { margin: 6px 0 4px; }
.kids-locked__free { font-size: .92rem; }
@media (max-width: 700px) { .kids-locked { grid-template-columns: 1fr; text-align: center; } .kids-locked__pic { max-width: 240px; margin: 0 auto; } }
