/*
 * PuzzlesJunior — public stylesheet (2026 redesign).
 * Shared by the sibling sites: change the brand tokens in :root (or load a small
 * brand.css after this file) and keep the components below unchanged.
 * Sections: tokens · base · header · layout/hero · sections & tiles · navigation ·
 * game page · forms & cards · ranking · footer · responsive.
 */

/* ---------- Brand tokens ---------- */
:root {
	--green: #93a50f;
	--green-light: #bdc92c;
	--green-dark: #5f7409;
	--stripes: url("/images/bg.jpg");
	--paper: #fbf4e6;
	--paper-edge: #e8d9bd;
	--card: #fff;
	--wood: #f3dca6;
	--wood-dark: #d6ad62;
	--ink: #5a2e0c;
	--ink-soft: #7a5638;
	--sun: #f9dd49;
	--sun-dark: #d9b223;
	--orange: #f4bc21;
	--piece-green: #879a0a;
	--piece-red: #b51e1f;
	--piece-yellow: #e9c52e;
	--piece-blue: #225771;
	--focus: #1b6fd1;
	--radius: 18px;
	--radius-lg: 28px;
	--page-width: 1180px;
	--font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Varela Round", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--shadow: 0 4px 0 rgba(90, 46, 12, .12), 0 12px 28px rgba(90, 46, 12, .12);
	--icon-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%235a2e0c' d='M8.5 5.5v13l10.5-6.5z'/%3E%3C/svg%3E");
	--icon-home: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%235a2e0c' d='M12 3 2 12h3v9h5v-6h4v6h5v-9h3z'/%3E%3C/svg%3E");
	--icon-piece: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23879a0a' stroke='%235f7409' stroke-width='1.5' d='M4 10h7a3.2 3.2 0 1 1 6 0h7v7a3.2 3.2 0 1 1 0 6v5H4z'/%3E%3C/svg%3E");
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	font: 600 17px/1.5 var(--font);
	color: var(--ink);
	background: var(--green) var(--stripes) repeat;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.visually-hidden {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
	position: absolute; left: 12px; top: -100px; z-index: 100;
	background: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 800;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons ---------- */
.cta {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-height: 52px; padding: 8px 22px; border: 0; border-radius: 999px;
	font: 800 18px/1.15 var(--font); text-decoration: none; cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease;
}
.cta:hover { transform: translateY(-2px); }
.cta:active { transform: translateY(2px); }
.cta--create {
	background: var(--sun); color: var(--ink); padding-left: 8px;
	box-shadow: 0 5px 0 var(--sun-dark), 0 8px 18px rgba(60, 40, 0, .2);
}
.cta--create img { width: 44px; height: 44px; margin: -8px 0; }
.cta--play {
	background: var(--green-dark); color: #fff; font-size: 20px; min-height: 58px; padding: 10px 30px;
	box-shadow: 0 5px 0 #3f4e05, 0 8px 18px rgba(60, 40, 0, .2);
}
.cta--back { background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--paper-edge); }
.cta--small {
	min-height: 42px; padding: 6px 16px; font-size: 16px;
	background: var(--wood); color: var(--ink); box-shadow: 0 3px 0 var(--wood-dark);
}

/* ---------- Header ---------- */
.site-header {
	background: linear-gradient(var(--green-light), var(--green) 70%);
	box-shadow: 0 4px 0 rgba(60, 70, 0, .35);
}
.site-header__inner {
	max-width: var(--page-width); margin: 0 auto; padding: 10px 16px;
	display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
}
.brand { display: block; line-height: 0; }
.brand img { width: 250px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .18)); }
.search {
	order: 2; flex: 1 1 300px; min-width: 0; max-width: 520px; margin-left: auto;
	display: flex; align-items: center; padding: 4px;
	background: #fff; border-radius: 999px;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, .12), 0 4px 0 var(--green-dark);
}
.search:focus-within { outline: 4px solid var(--focus); outline-offset: 2px; }
.search input {
	flex: 1; min-width: 0; border: 0; background: transparent; outline: 0;
	font: 700 18px var(--font); color: var(--ink); padding: 10px 14px;
}
.search input::placeholder { color: #9b7b5c; opacity: 1; }
.search__button {
	flex: none; width: 50px; height: 50px; border: 0; border-radius: 50%; cursor: pointer;
	display: grid; place-items: center; color: var(--ink);
	background: var(--orange); box-shadow: 0 3px 0 var(--sun-dark);
}
.site-header .cta--create { order: 3; }

/* ---------- Layout & hero ---------- */
.site-main { max-width: var(--page-width); margin: 0 auto; padding: 18px 12px 0; }
.hero {
	position: relative; display: flex; align-items: flex-end; gap: 12px;
	padding: 26px clamp(12px, 3vw, 32px) 0;
	background: var(--paper); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.ribbon {
	flex: 1; margin: 0; padding: 14px 24px; text-align: center;
	font-size: clamp(24px, 4.2vw, 36px); font-weight: 900; color: #fff;
	text-shadow: 0 2px 0 rgba(60, 50, 0, .55);
	background: linear-gradient(var(--green-light), var(--green) 55%, #7d9009);
	border-radius: 18px;
	box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35), 0 6px 0 #6b7d07;
}
.hero__mascot, .hero__boxes { position: absolute; bottom: -8px; pointer-events: none; }
.hero__mascot { right: clamp(4px, 2vw, 30px); width: clamp(110px, 18vw, 210px); }
.hero__boxes { left: clamp(4px, 2vw, 30px); width: clamp(60px, 8vw, 96px); }
.hero:has(.hero__mascot) .ribbon { padding-inline: clamp(70px, 14vw, 200px); }
.page {
	background: var(--paper); padding: 20px clamp(12px, 3vw, 32px) 32px;
	border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: var(--shadow);
}
.hero + .page { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.page--game { border-radius: var(--radius-lg); }
.page--narrow > * { max-width: 780px; margin-left: auto; margin-right: auto; }

/* ---------- Sections & tiles ---------- */
.section { margin-top: 26px; }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section__head .section__title { margin: 0; }
.section__title {
	display: flex; align-items: center; gap: 10px; margin: 0 0 12px;
	font-size: clamp(21px, 3vw, 27px); font-weight: 900;
}
.section__title::before {
	content: ""; flex: none; width: 34px; height: 34px;
	background: var(--icon-piece) center / contain no-repeat;
}
.tiles {
	list-style: none; margin: 0; padding: 0;
	display: grid; gap: clamp(12px, 2vw, 22px);
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
}
.tiles > li { min-width: 0; }
.tiles > li:nth-child(4n+1) { --piece: var(--piece-green); }
.tiles > li:nth-child(4n+2) { --piece: var(--piece-red); }
.tiles > li:nth-child(4n+3) { --piece: var(--piece-yellow); }
.tiles > li:nth-child(4n+4) { --piece: var(--piece-blue); }
.tile {
	display: flex; flex-direction: column; height: 100%; overflow: hidden;
	background: var(--card); border-radius: var(--radius); text-decoration: none;
	box-shadow: 0 5px 0 var(--wood-dark), 0 10px 20px rgba(90, 46, 12, .12);
	transition: transform .2s ease, box-shadow .2s ease;
}
.tile:hover, .tile:focus-visible {
	transform: translateY(-4px) rotate(-.6deg);
	box-shadow: 0 9px 0 var(--wood-dark), 0 18px 28px rgba(90, 46, 12, .18);
}
.tile__img { position: relative; display: block; aspect-ratio: 6 / 5; background: #efe5d2; }
.tile__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile__label {
	flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
	min-height: 56px; padding: 8px 12px;
	font-size: 17px; font-weight: 800; line-height: 1.2;
	background: linear-gradient(#f8e7bd, var(--wood));
	border-top: 5px solid var(--piece, var(--piece-green));
	overflow-wrap: anywhere;
}
.tile__play {
	position: absolute; right: 10px; bottom: 10px; width: 46px; height: 46px; border-radius: 50%;
	background: var(--sun) var(--icon-play) 58% 50% / 26px no-repeat;
	box-shadow: 0 3px 0 var(--sun-dark), 0 4px 10px rgba(0, 0, 0, .25);
	transition: transform .2s ease;
}
.tile:hover .tile__play { transform: scale(1.12); }
.tiles--featured { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.tiles--banners { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.tiles--banners .tile__img { aspect-ratio: 300 / 53; }
.tiles--rail .tile__label { font-size: 16px; min-height: 50px; }

.about {
	margin-top: 32px; padding: 20px 24px; border-radius: var(--radius);
	background: #fff; color: var(--ink-soft); font-weight: 500;
}
.about h2 { margin-top: 0; color: var(--ink); font-size: 22px; }
.about .cta { margin-top: 8px; }
.empty { text-align: center; padding: 24px 12px; font-size: 20px; }
.empty p { max-width: 520px; margin: 10px auto 0; }
.back { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 30px 0 0; }

/* ---------- Breadcrumbs & pager ---------- */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 18px; padding: 0; }
.crumbs li { display: flex; align-items: center; }
.crumbs li + li::before { content: "›"; margin: 0 6px 0 2px; font-size: 24px; color: var(--ink-soft); }
.crumbs a, .crumbs span {
	display: inline-flex; align-items: center; min-height: 42px; padding: 6px 15px;
	border-radius: 999px; background: #fff; text-decoration: none;
	box-shadow: 0 3px 0 var(--paper-edge);
}
.crumbs a:hover { background: var(--wood); }
.crumbs span[aria-current] { background: var(--wood); }
.crumbs__home { width: 46px; justify-content: center; background: #fff var(--icon-home) center / 24px no-repeat !important; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 30px 0 6px; }
.pager form { display: inline; margin: 0; }
.pager__page, .pager__step {
	display: inline-grid; place-items: center; min-width: 54px; height: 54px; padding: 0 16px;
	border: 0; border-radius: 16px; background: #fff; color: var(--ink); cursor: pointer;
	font: 900 20px var(--font); text-decoration: none; box-shadow: 0 4px 0 var(--paper-edge);
}
.pager__step { display: inline-flex; gap: 6px; }
.pager__page[aria-current] { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.pager a:hover, .pager button:hover { background: var(--wood); }

/* ---------- Game page ---------- */
.game-title { margin: 0 0 14px; text-align: center; font-size: clamp(21px, 3vw, 30px); font-weight: 900; }
.game-hint { margin: 12px 0 0; text-align: center; color: var(--ink-soft); }
.share { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 16px 0 0; }
.share__label { color: var(--ink-soft); }
.share__btn { padding: 7px 14px; border-radius: 999px; color: #fff; font-size: 15px; font-weight: 800; text-decoration: none; }
.share__btn--fb { background: #1765cc; }
.share__btn--x { background: #222; }
.share__btn--pin { background: #c5001c; }
.share__btn--wa { background: #0f7a5b; }

/* ---------- Cards & forms ---------- */
.card { background: var(--card); border-radius: var(--radius-lg); padding: clamp(18px, 4vw, 34px); box-shadow: var(--shadow); }
.challenge { display: grid; gap: 14px; max-width: 540px; margin: 10px auto 24px; text-align: center; }
.challenge label { font-size: 26px; font-weight: 900; }
.field { margin: 0 0 24px; padding: 0; border: 0; min-width: 0; }
.field__label { display: block; margin: 0 0 8px; padding: 0; font-size: 19px; font-weight: 900; }
input[type="text"], input[type="email"], input.copy {
	width: 100%; padding: 13px 16px; border: 3px solid var(--paper-edge); border-radius: 14px;
	font: 700 18px var(--font); color: var(--ink); background: #fff;
}
input[type="text"]:focus, input[type="email"]:focus { border-color: var(--green); outline: none; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span {
	display: inline-flex; align-items: center; justify-content: center; gap: 4px;
	min-width: 58px; min-height: 54px; padding: 8px 16px; border-radius: 16px; cursor: pointer;
	background: var(--paper); border: 3px solid var(--paper-edge); font-weight: 800;
}
.pill input:checked + span { background: var(--green); border-color: var(--green-dark); color: #fff; }
.pill input:focus-visible + span { outline: 4px solid var(--focus); outline-offset: 2px; }
.pills--cards .pill { flex: 1 1 220px; display: flex; }
.pills--cards .pill span { flex: 1; flex-direction: column; align-items: flex-start; text-align: left; font-weight: 600; }
.pills--cards strong { font-size: 19px; }
.upload { position: relative; display: inline-block; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload:focus-within .cta { outline: 4px solid var(--focus); outline-offset: 3px; }
.upload__preview img { display: block; max-width: min(100%, 360px); margin-top: 14px; border-radius: 14px; box-shadow: var(--shadow); }
.note { margin: 8px 0 0; color: var(--ink-soft); font-size: 15px; font-weight: 500; }
.alert { margin: 0 0 18px; padding: 12px 18px 12px 36px; border: 3px solid #f0aca1; border-radius: 14px; background: #fde8e4; color: #8a1c10; }
.alert:empty { display: none; }
div.alert { padding-left: 18px; }
.steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 22px; padding: 0; }
.steps li {
	counter-increment: step; position: relative; padding: 14px 16px 14px 62px;
	background: #fff; border-radius: var(--radius); box-shadow: 0 4px 0 var(--paper-edge);
}
.steps li::before {
	content: counter(step); position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
	display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
	background: var(--sun); font-weight: 900;
}
.create .cta--play { width: 100%; }
.loader {
	width: 46px; height: 46px; margin: 14px auto; border-radius: 50%;
	border: 6px solid var(--paper-edge); border-top-color: var(--green); animation: spin 1s linear infinite;
}
.loader[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.success { display: grid; justify-items: center; gap: 12px; text-align: center; }
.success h2 { margin: 0; font-size: 28px; }
.success label { margin-top: 10px; }
.copy { text-align: center; font-size: 16px; }

/* ---------- Ranking ---------- */
.ranking__puzzle { display: flex; align-items: center; gap: 14px; margin: 0 auto 14px; font-size: 21px; font-weight: 900; text-decoration: none; }
.ranking__puzzle img { border-radius: 14px; box-shadow: var(--shadow); }
.ranking { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.ranking th { padding: 0 14px; text-align: left; font-size: 15px; color: var(--ink-soft); }
.ranking th:last-child, .ranking td:last-child { text-align: right; }
.ranking td { padding: 12px 14px; background: #fff; font-size: 18px; }
.ranking td:first-child { width: 72px; text-align: center; font-weight: 900; border-radius: 14px 0 0 14px; }
.ranking td:last-child { border-radius: 0 14px 14px 0; }
.ranking__top--1 td:first-child { background: var(--sun); }
.ranking__top--2 td:first-child { background: #e1e5ea; }
.ranking__top--3 td:first-child { background: #f2c497; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 70px; background: linear-gradient(#73880a, #55660a); color: #fff; }
.site-footer__inner { max-width: var(--page-width); margin: 0 auto; padding: 0 16px 30px; text-align: center; }
.site-footer__mascot { display: block; margin: -52px auto 0; }
.site-footer__tagline { margin: 6px 0 0; font-size: 18px; }
.site-footer__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; margin: 12px 0; }
.site-footer a { color: #fff; padding: 8px 2px; text-underline-offset: 4px; }
.site-footer__copy { margin: 0; font-size: 14px; font-weight: 500; opacity: .9; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
	body { font-size: 16px; }
	.site-header__inner { padding: 8px 12px 12px; gap: 10px; }
	.brand img { width: 150px; }
	.site-header .cta--create { order: 2; margin-left: auto; min-height: 46px; padding: 6px 14px 6px 6px; font-size: 15px; gap: 6px; }
	.site-header .cta--create img { width: 38px; height: 38px; }
	.search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
	.site-main { padding: 12px 8px 0; }
	.hero { padding-top: 18px; }
	.hero__boxes { display: none; }
	.hero:has(.hero__mascot) .ribbon { padding: 12px 104px 12px 16px; text-align: left; }
	.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tiles--banners { grid-template-columns: 1fr; }
	.tile__label { font-size: 16px; min-height: 52px; padding: 6px 8px; }
	.tile__play { width: 40px; height: 40px; right: 8px; bottom: 8px; background-size: 22px; }
	/* Rails scroll sideways on small screens. */
	.tiles--rail {
		grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 44%;
		overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 14px; margin: 0 -2px;
	}
	.tiles--rail > li { scroll-snap-align: start; }
	.pager__page, .pager__step { min-width: 48px; height: 48px; font-size: 18px; }
	.section__head { flex-wrap: wrap; }
}
@media (max-width: 380px) {
	.brand img { width: 120px; }
	.site-header .cta--create span { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
