/* Juegos para Niñas — mobile first, no framework. Colours come from the logo. */
:root {
	--pink: #e28ca6;        /* logo background */
	--magenta: #ce2fca;     /* logo flowers */
	--magenta-dark: #a3127f;
	--plum: #4a1446;
	--text: #4a2346;
	--soft: #fbe3f3;
	--line: #f2c4e2;
	--bg: #fef4fe;
	--yellow: #ffcc00;
	--teal: #00b386;
	--radius: 18px;
	--font: ui-rounded, "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-fun: "Comic Sans MS", "Chalkboard SE", "Comic Neue", ui-rounded, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.5 var(--font);
}
img { max-width: 100%; height: auto; }
a { color: var(--magenta-dark); }
a:hover { color: var(--magenta); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
h1, h2 { font-family: var(--font-fun); line-height: 1.2; color: var(--magenta-dark); }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.25rem; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { background: var(--pink); border-bottom: 4px solid var(--yellow); }
.header-bar {
	display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
	max-width: 1240px; margin: 0 auto; padding: 8px 12px;
}
.logo { flex: 1; min-width: 0; display: block; line-height: 0; }
.logo img { width: auto; max-width: 100%; height: auto; max-height: 44px; }
.menu-btn, .menu-close {
	flex: none; width: 44px; height: 44px; border: 0; border-radius: 14px;
	background: rgba(255, 255, 255, .35); color: var(--plum); cursor: pointer;
	display: grid; place-items: center;
}
.menu-btn:hover { background: rgba(255, 255, 255, .6); }
.search { position: relative; flex: 1 1 100%; }
.search input {
	width: 100%; height: 44px; padding: 0 48px 0 18px;
	border: 2px solid #fff; border-radius: 999px; background: #fff;
	font: inherit; color: var(--text);
	-webkit-appearance: none; appearance: none;
}
.search input:focus { border-color: var(--magenta); outline: none; }
.search button {
	position: absolute; right: 4px; top: 4px; width: 36px; height: 36px;
	border: 0; border-radius: 50%; background: var(--magenta); color: #fff; cursor: pointer;
	display: grid; place-items: center;
}
.search button svg { width: 20px; height: 20px; }

/* Category menu: horizontal chips; a drawer on small screens when JS is available */
.cat-nav { background: #fff; border-bottom: 1px solid var(--line); }
.cat-nav-head { display: none; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cat-nav .chips { max-width: 1240px; margin: 0 auto; padding: 8px 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chip {
	display: inline-block; padding: 5px 13px; white-space: nowrap;
	border: 2px solid var(--line); border-radius: 999px; background: #fff;
	color: var(--magenta-dark); font-weight: 700; font-size: .92rem; text-decoration: none;
	transition: background-color .15s, color .15s, border-color .15s;
}
.chip:hover, .chip[aria-current="page"] { background: var(--magenta); border-color: var(--magenta); color: #fff; }

@media (max-width: 759px) {
	.js .cat-nav {
		position: fixed; z-index: 1000; top: 0; bottom: 0; left: 0;
		width: min(84vw, 320px); overflow-y: auto; border: 0;
		transform: translateX(-105%); visibility: hidden;
		transition: transform .25s ease, visibility .25s;
		box-shadow: 6px 0 30px rgba(74, 20, 70, .25);
	}
	.js.nav-open .cat-nav { transform: none; visibility: visible; }
	.js .cat-nav-head {
		display: flex; align-items: center; justify-content: space-between;
		padding: 10px 12px 10px 18px; background: var(--pink);
		font: 700 1.2rem var(--font-fun); color: var(--plum);
	}
	.menu-close { font-size: 28px; line-height: 1; }
	.js .cat-nav .chips { display: grid; grid-template-columns: 1fr 1fr; padding: 14px; gap: 8px; }
	.js .cat-nav .chip { display: block; text-align: center; padding: 9px 8px; }
	.nav-open body { overflow: hidden; }
	.nav-backdrop { position: fixed; inset: 0; z-index: 999; background: rgba(74, 20, 70, .45); }
	.nav-backdrop[hidden] { display: none; }
}
html:not(.js) .menu-btn { display: none; }

@media (min-width: 760px) {
	.header-bar { flex-wrap: nowrap; gap: 20px; padding: 10px 16px; }
	.menu-btn, .nav-backdrop { display: none; }
	.logo { flex: none; }
	.logo img { max-height: 64px; }
	.search { flex: 0 1 380px; margin-left: auto; }
	.cat-nav .chips { flex-wrap: wrap; justify-content: center; padding: 10px 16px; }
}

/* ---------- Page ---------- */
.main { max-width: 1240px; margin: 0 auto; padding: 16px 12px 32px; }
@media (min-width: 760px) { .main { padding: 20px 16px 40px; } }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; }
.page-info { margin: 0; color: #8a5a85; font-weight: 600; }
.section { margin: 0 0 28px; }
.section-title { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 4px #ffe680; }
.btn {
	display: inline-block; padding: 10px 20px; border-radius: 999px;
	background: var(--magenta); color: #fff; font-weight: 700; text-decoration: none;
}
.btn:hover { background: var(--magenta-dark); color: #fff; }
.more { text-align: center; margin: 18px 0 0; }
.notice { background: #fff8d9; border: 2px solid var(--yellow); border-radius: var(--radius); padding: 14px 18px; }

/* ---------- Game cards ---------- */
.cards {
	list-style: none; margin: 0; padding: 0;
	display: grid; gap: 12px;
	grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));  /* 2 columns on phones, 7 at full width */
}
.card {
	display: flex; flex-direction: column; height: 100%;
	background: #fff; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden;
	color: var(--text); text-decoration: none;
	box-shadow: 0 3px 0 var(--line);
	transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--magenta); box-shadow: 0 6px 0 #e9a6d6; color: var(--magenta-dark); }
.card picture, .tile picture { display: block; aspect-ratio: 1; background: var(--soft); }
.card img, .tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-title {
	margin: 8px 10px 10px; text-align: center; font-weight: 700; font-size: .95rem; line-height: 1.25;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	min-height: 2.5em;
}
.cards-small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.cards-small .card-title { font-size: .85rem; }
@media (min-width: 1000px) { .cards-small { grid-template-columns: repeat(6, 1fr); } }
.cards-ad { grid-column: 1 / -1; }

/* Category tiles (home) */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { position: relative; display: block; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--line); }
.tile span {
	position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 8px; text-align: center;
	background: linear-gradient(transparent, rgba(74, 20, 70, .85));
	color: #fff; font: 700 1.05rem var(--font-fun);
}
.tile:hover { border-color: var(--magenta); }

/* Intro text */
.intro { background: #fff; border: 2px dashed var(--line); border-radius: var(--radius); padding: 10px 16px; margin: 0 0 18px; line-height: 1.6; }
.intro-text { margin: 0; }
/* Collapsed to three lines until "Leer más" (site.js adds the button only when the text is longer). */
.js .intro-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.js .intro.is-open .intro-text { display: block; }
.intro-more { margin-top: 4px; padding: 2px 0; border: 0; background: none; color: var(--magenta-dark); font: inherit; font-weight: 700; cursor: pointer; }
.intro-more:hover { text-decoration: underline; }

/* Pager */
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 22px 0 0; }
.pager a, .pager span {
	min-width: 42px; height: 42px; padding: 0 10px; border-radius: 999px;
	display: grid; place-items: center; font-weight: 700; text-decoration: none;
}
.pager a { background: #fff; border: 2px solid var(--line); }
.pager a:hover { border-color: var(--magenta); }
.pager span[aria-current] { background: var(--magenta); color: #fff; }
.pager .pager-gap { min-width: 0; padding: 0 2px; }
.pager .pager-step { font-size: 1.4rem; }

/* ---------- Ads (only printed when a slot id is configured) ---------- */
.ad { margin: 0 0 24px; text-align: center; }
.ad-top { min-height: 116px; }
.ad-grid, .ad-game { min-height: 296px; }
.cards-ad .ad { margin: 4px 0; }
.ad-label { display: block; font-size: .7rem; color: #a07a9c; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Game page ---------- */
.crumbs { font-size: .9rem; margin-bottom: 6px; color: #8a5a85; }
.crumbs a { font-weight: 600; text-decoration: none; }
.crumbs span[aria-hidden] { margin: 0 4px; }
.game-title { margin-bottom: 12px; font-size: 1.6rem; }

/* The stage keeps the game's aspect ratio and fits both the width and the height of the screen. */
.player-wrap {
	--ar: 1.3333;
	width: min(100%, calc((100vh - 76px) * var(--ar)));   /* 76px: controls bar + margin */
	width: min(100%, calc((100svh - 76px) * var(--ar)));
	min-width: min(100%, 300px);
	margin: 0 auto 18px;
}
.player {
	position: relative; aspect-ratio: var(--ar);
	background: radial-gradient(circle at 50% 40%, var(--magenta), var(--plum) 75%);
	border-radius: var(--radius) var(--radius) 0 0; overflow: hidden;
}
.player ruffle-player { display: block; width: 100%; height: 100%; }
.player-start {
	position: absolute; inset: 0; width: 100%; border: 0; padding: 0; background: none; cursor: pointer;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%;
	color: var(--plum); font: inherit;
}
.player-start picture { height: 52%; aspect-ratio: 1; }
.player-start img { height: 100%; width: auto; border-radius: var(--radius); border: 4px solid #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.player-play {
	display: inline-flex; align-items: center; gap: 6px; padding: 10px 26px 10px 20px;
	border-radius: 999px; background: var(--yellow); box-shadow: 0 4px 0 #c99a00;
	font: 700 clamp(1.1rem, 3vw, 1.6rem) var(--font-fun);
	transition: transform .15s;
}
.player-play svg { fill: currentColor; stroke: none; width: 1.3em; height: 1.3em; }
.player-start:hover .player-play { transform: scale(1.06); }
.player-start.is-loading .player-play { opacity: .7; }
.player-bar {
	display: flex; align-items: center; gap: 6px; padding: 6px 8px;
	background: var(--plum); color: #fff; border-radius: 0 0 var(--radius) var(--radius);
}
.pbtn {
	height: 40px; min-width: 40px; padding: 0 8px; border: 0; border-radius: 12px;
	background: transparent; color: #fff; cursor: pointer; font: 600 .9rem var(--font);
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.pbtn:hover { background: rgba(255, 255, 255, .16); }
.pbtn-wide { margin-left: auto; }
.pbtn .i-off, .pbtn[aria-pressed="true"] .i-on { display: none; }
.pbtn[aria-pressed="true"] .i-off { display: block; }
#volume { width: 96px; accent-color: var(--yellow); }
.player-hint { display: none; flex: 1; min-width: 0; font-size: .78rem; line-height: 1.2; opacity: .8; }
@media (pointer: coarse) { .player-hint { display: block; } }
@media (max-width: 420px) { .pbtn-wide span { display: none; } #volume { width: 64px; } }

/* Fullscreen: the browser's own, or a full-window fallback (iPhone has no fullscreen API) */
.player-wrap.is-fs {
	position: fixed; inset: 0; z-index: 2000; width: 100%; min-width: 0; margin: 0;
	display: flex; flex-direction: column; background: #000;
}
.player-wrap:fullscreen { width: 100%; display: flex; flex-direction: column; background: #000; }
.player-wrap:-webkit-full-screen { width: 100%; display: flex; flex-direction: column; background: #000; }
.player-wrap.is-fs .player, .player-wrap:fullscreen .player { flex: 1; aspect-ratio: auto; border-radius: 0; }
.player-wrap:-webkit-full-screen .player { flex: 1; aspect-ratio: auto; border-radius: 0; }
.player-wrap.is-fs .player-bar, .player-wrap:fullscreen .player-bar { border-radius: 0; }
.player-wrap:-webkit-full-screen .player-bar { border-radius: 0; }

.game-info { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 4px 18px 14px; margin-bottom: 26px; }
.game-info p { line-height: 1.6; }
.chips-tags { margin-top: 10px; }

/* ---------- Search / 404 ---------- */
.search-cats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; font-weight: 600; }
.search-cats .chips-tags { margin: 0; }
.not-found { text-align: center; padding: 10px 0 24px; }
.not-found-code { margin: 0; font: 700 4.5rem/1 var(--font-fun); color: var(--yellow); -webkit-text-stroke: 2px var(--magenta-dark); }
.search-big { max-width: 480px; margin: 18px auto; }
.search-big input { border-color: var(--line); padding-right: 104px; }
.search-big button { width: auto; padding: 0 16px; border-radius: 999px; font: 700 1rem var(--font); }

/* ---------- Footer ---------- */
.site-footer { background: var(--pink); color: var(--plum); text-align: center; padding: 18px 12px; border-top: 4px solid var(--yellow); font-size: .92rem; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--plum); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; }
}
