/*
 * Estilos de los Juegos Lumbre (formato lumbre-game/1.0): galería /games, pantalla de juego,
 * el runtime y el motor «shop». Se cargan SÓLO en las vistas de /games y en los CTA de objeto/laboratorio.
 * Reutiliza los tokens de app.css (paleta, radios, espaciados) — no define colores propios.
 * Mobile-first: una columna en teléfono, dos en tableta+; controles grandes para táctil (§50/§51).
 */

/* Botón flotante de silencio compartido (lumbre-sound.js): una píldora discreta abajo a la derecha.
   Sin colores propios —todo tokens de app.css— y despejada de la barra segura del móvil. */
.lumbre-sound-toggle { position: fixed; right: 14px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; font-size: 14px; font-weight: 500; line-height: 1; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); cursor: pointer; }
.lumbre-sound-toggle:hover { border-color: var(--accent); color: var(--accent); }
.lumbre-sound-toggle.active { color: var(--accent); }
@media (max-width: 600px) { .lumbre-sound-toggle { right: 10px; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); padding: 7px 11px; font-size: 13px; } }

/* ---------- Galería /games ---------- */
.games-gallery { padding-top: var(--space-6); }
.game-filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: var(--space-5) 0; }
.game-filter-search { flex: 1 1 220px; }
.game-filter-search input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font-size: 16px; }
.game-filter-select select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); }
.game-filter-levels { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.games-gallery .chip-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.game-band { margin-top: var(--space-7); }
.game-band-head h2 { margin: 0; font: 400 24px/1.2 var(--font-reading); }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4); margin-top: var(--space-5); }
.game-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.game-card-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.game-card .generated-cover { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); aspect-ratio: 16 / 9; background: var(--accent-soft); color: var(--accent); font: 600 18px/1.2 var(--font-reading); text-align: center; padding: var(--space-4); }
.game-card-body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); flex: 1 1 auto; }
.game-card-body h3 { margin: 0; font: 400 20px/1.25 var(--font-reading); }
.game-card-body .button { margin-top: auto; }
.game-card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.game-card-meta .chip { font-size: 12px; }
.chip-engine { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ---------- Pantalla del juego ---------- */
.game-shell { padding-top: var(--space-6); padding-bottom: var(--space-8); }
.game-head { display: flex; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.game-head h1 { margin: 0 0 4px; font: 400 clamp(26px, 4vw, 36px)/1.15 var(--font-reading); }
.game-head > div { flex: 1 1 300px; min-width: 0; }
.game-icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent); }
.game-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space-2) 0 0; font-size: 13px; color: var(--muted); }

/* Pestañas de misiones */
.game-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); border-bottom: 1px solid var(--line); padding-bottom: var(--space-2); }
.game-tab { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius-pill, 999px); background: var(--surface); color: var(--ink); font: 600 15px/1 var(--font-reading); cursor: pointer; }
.game-tab:hover { border-color: var(--accent); color: var(--accent); }
.game-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.game-tab-done::after { content: " ✓"; color: var(--accent); font-weight: 700; }
.game-tab.active.game-tab-done::after { color: #fff; }

.game-missions { display: grid; gap: var(--space-5); }
.game-mission { display: grid; gap: var(--space-4); }
.game-mission-title { margin: 0; font: 400 22px/1.25 var(--font-reading); }
.game-goal { margin: 0; font-weight: 600; color: var(--ink); }
.game-instructions { margin: 0; color: var(--muted); line-height: 1.6; }
.game-mission-state { margin: 0; }

/* Pistas (§24) */
.game-hints { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-3) var(--space-4); }
.game-hints summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.game-hints ol { margin: var(--space-3) 0 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); }
.game-hints li[hidden] { display: none; }
.game-hints li.hint-revealed { animation: hint-in .25s ease; }
@keyframes hint-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Zona del motor y su relación con las guías OA */
.game-engine { min-height: 220px; }
.game-guide-blocks { border-top: 1px dashed var(--line); padding-top: var(--space-4); }
.game-note { color: var(--muted); margin: var(--space-3) 0 0; }
.game-error { color: var(--danger); }

/* Relacionados (§18) y pie */
.game-related { margin-top: var(--space-6); padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.game-related h2 { margin: 0 0 var(--space-3); font: 400 19px/1.3 var(--font-reading); }
.game-related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.game-related-link { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink); text-decoration: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.game-related-link:hover { border-color: var(--accent); color: var(--accent); }
.game-related-kind { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.game-related-reason { font-size: 12px; color: var(--muted); }
/* «Siguientes pasos» que game.js monta en el momento de completar misión/mundo (NextStep via data-next). */
.game-next-panel { margin-top: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.game-next-panel h3 { margin: 0 0 var(--space-2); font-size: 16px; }
.game-next-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.game-next-panel a { display: block; padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.game-next-panel a:hover { border-color: var(--accent); }
.game-next-panel small { display: block; color: var(--muted); font-size: 12px; }
.game-foot { margin-top: var(--space-6); border-top: 1px solid var(--line); padding-top: var(--space-4); }

/* ---------- Motor «shop» (Mercado Lumbre) ---------- */
.shop-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.shop-goal { font-weight: 600; line-height: 1.5; }
.shop-goal-text { margin: 0; }
.shop-stage, .shop-panel { display: grid; gap: var(--space-3); }
.shop-panel h4, .shop-stage h4 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.shop-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--space-3); }
.shop-item { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 76px; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; text-align: left; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.shop-item:hover, .shop-item:focus-visible { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.shop-item-emoji { display: grid; place-items: center; width: 52px; height: 52px; font-size: 32px; line-height: 1; border-radius: var(--radius-md); background: var(--accent-soft); }
.shop-item-name { font-weight: 600; }
.shop-item-price { color: var(--accent); font-weight: 800; border: 1.5px dashed currentColor; border-radius: 999px; padding: 1px 9px; }
.shop-add { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; }

.shop-basket-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.shop-basket-list li { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.shop-row-emoji { font-size: 24px; line-height: 1; }
.shop-row-name { flex: 1 1 auto; font-weight: 600; }
.shop-row-total { margin: 0; font-weight: 700; font-size: 18px; color: var(--ink); }

.shop-qty-row { display: flex; align-items: center; gap: var(--space-2); }
.shop-qty { flex: 1 1 auto; }
.shop-qty-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 20px; cursor: pointer; }

.shop-money.inline { font-weight: 700; }
.shop-input { width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font-size: 20px; font-weight: 700; }
.shop-input:focus { border-color: var(--accent); outline: none; }
.shop-answer { display: grid; gap: 6px; }

/* Dinero dibujado por el motor. Excepción deliberada a «no defino colores propios":
   cada denominación necesita distinguirse de un vistazo, igual que los billetes reales.
   Son colores abstractos, no fotografías de billetes (ver cabecera de la definición). */
.shop-pile { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.shop-bill { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 96px; height: 54px; border-radius: 8px; border: 2px solid rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .28), 0 2px 0 rgba(0, 0, 0, .14); background: var(--bill-bg, linear-gradient(135deg, #6b7f8f, #465663)); color: #fff; font: 800 15px/1 var(--font-reading); }
.shop-bill b { font-size: 21px; letter-spacing: .02em; }
.shop-bill i { font-style: normal; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.bill-20 { --bill-bg: linear-gradient(135deg, #4b83b3, #2c567c); }
.bill-50 { --bill-bg: linear-gradient(135deg, #d98324, #9c5a10); }
.bill-100 { --bill-bg: linear-gradient(135deg, #c0533f, #83301f); }
.bill-200 { --bill-bg: linear-gradient(135deg, #6c8f3c, #43601e); }
.bill-500 { --bill-bg: linear-gradient(135deg, #3f6fae, #274a7c); }
.bill-1000 { --bill-bg: linear-gradient(135deg, #7d5ba6, #533a73); }
.shop-coin { display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 6px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .22); box-shadow: inset 0 2px 2px rgba(255, 255, 255, .6), inset 0 -3px 4px rgba(0, 0, 0, .22), 0 2px 0 rgba(0, 0, 0, .12); background: var(--coin-bg, radial-gradient(circle at 32% 28%, #ffe9a8, #e0ac3f 58%, #a8741c)); color: var(--coin-ink, #5b430f); font: 800 17px/1 var(--font-reading); }
.coin-1, .coin-2, .coin-5, .coin-10 { --coin-bg: radial-gradient(circle at 32% 28%, #f6f8fa, #bfc8d3 58%, #7f8b99); --coin-ink: #39424e; }

.shop-piece-sm { transform: scale(.72); margin: -6px -8px; }
.shop-denoms { display: flex; flex-wrap: wrap; gap: 2px; }
.shop-denom { padding: 0; border: none; background: none; cursor: pointer; border-radius: 10px; transition: transform .12s ease; }
.shop-denom:hover, .shop-denom:focus-visible { transform: translateY(-3px) scale(1.04); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.shop-used { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.shop-used-chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 8px; border-radius: var(--radius-pill, 999px); background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.shop-used-n { font-weight: 800; }
.shop-rm { width: 22px; height: 22px; border: none; border-radius: 50%; background: var(--accent); color: #fff; cursor: pointer; line-height: 1; }

.shop-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.shop-feedback { margin: 0; min-height: 24px; font-weight: 600; }
.shop-feedback.good { color: var(--accent); }
.shop-feedback.bad { color: var(--danger); }
.shop-win { animation: shop-pop .5s ease; }
@keyframes shop-pop { 0% { transform: scale(1); } 40% { transform: scale(1.01); } 100% { transform: scale(1); } }
.shop-confetti { position: absolute; top: -16px; width: 10px; height: 16px; border-radius: 3px; opacity: .95; pointer-events: none; z-index: 5; animation: shop-fall 1.3s ease-in forwards; }
@keyframes shop-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(440px) rotate(620deg); opacity: 0; } }

/* ---------- Motor «sound-match» (Caja de sonidos para pequeños) ---------- */
.snd-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-5) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.snd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.snd-goal { margin: 0; font-weight: 600; line-height: 1.5; font-size: 18px; flex: 1 1 240px; }
.snd-stars { display: flex; gap: 4px; font-size: 24px; color: var(--line); }
.snd-star.on { color: #f4b400; animation: snd-starpop .4s ease; }
@keyframes snd-starpop { 0% { transform: scale(0.3); } 60% { transform: scale(1.4); } 100% { transform: scale(1); } }
.snd-listen-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.snd-listen { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 28px; border: none; border-radius: var(--radius-pill, 999px); background: var(--accent); color: #fff; font: 700 20px/1 var(--font-reading); cursor: pointer; box-shadow: var(--shadow-sm); }
.snd-listen:hover { filter: brightness(1.05); }
.snd-listen:active { transform: translateY(1px); }
.snd-ear { font-size: 26px; }
.snd-ring { position: absolute; inset: -6px; border-radius: inherit; border: 3px solid var(--accent); opacity: 0; pointer-events: none; }
.snd-ring-on { animation: snd-ring .5s ease-out; }
@keyframes snd-ring { 0% { opacity: .8; transform: scale(.96); } 100% { opacity: 0; transform: scale(1.18); } }
.snd-replay-note { color: var(--muted); }
.snd-stage { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-3); }
.snd-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 128px; padding: var(--space-4); border: 3px solid var(--snd-color, var(--accent)); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.snd-card:hover, .snd-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-md, var(--shadow-sm)); outline: none; }
.snd-card.snd-active { background: color-mix(in srgb, var(--snd-color, var(--accent)) 18%, var(--surface)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--snd-color, var(--accent)) 45%, transparent), var(--shadow-md, var(--shadow-sm)); transform: translateY(-3px) scale(1.03); }
.snd-card.snd-jump { animation: snd-jump .32s ease; }
@keyframes snd-jump { 0% { transform: translateY(0); } 30% { transform: translateY(-10px) rotate(-4deg); } 60% { transform: translateY(0) rotate(3deg); } 100% { transform: translateY(0) rotate(0); } }
.snd-glyph { font-size: 54px; line-height: 1; }
.snd-name { font-weight: 700; font-size: 17px; color: var(--ink); text-align: center; }
.snd-num { min-height: 96px; border: 3px solid var(--accent); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); font: 800 44px/1 var(--font-reading); cursor: pointer; transition: transform .12s ease, background .12s ease; }
.snd-num:hover, .snd-num:focus-visible { transform: translateY(-3px); outline: none; }
.snd-num.snd-num-pick { background: var(--accent); color: #fff; animation: snd-jump .3s ease; }
.snd-status { margin: 0; min-height: 26px; font-weight: 600; font-size: 17px; }
.snd-status.good { color: var(--accent); }
.snd-status.bad { color: var(--danger); }
.snd-progress { margin: 0; }
.snd-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.snd-done { display: grid; gap: var(--space-2); justify-items: center; text-align: center; padding: var(--space-5); border-radius: var(--radius-lg); background: var(--accent-soft); }
.snd-done-emoji { font-size: 64px; line-height: 1; animation: snd-starpop .5s ease; }
.snd-done-score { margin: 0; font: 700 24px/1.2 var(--font-reading); color: var(--ink); }
.snd-done-note { margin: 0; }
.snd-shake { animation: snd-shake .4s ease; }
@keyframes snd-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.snd-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: snd-fall 1s ease-in forwards; }
@keyframes snd-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(340px) rotate(540deg); opacity: 0; } }

/* Tableta+: recuadros aún más grandes para deditos pequeños. */
@media (min-width: 720px) {
    .snd-stage { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .snd-card { min-height: 156px; }
    .snd-glyph { font-size: 68px; }
}

/* ---------- Motor «match» (Relación / emparejamiento) ---------- */
.match-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.match-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.match-board { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-4); }
.match-col { display: grid; gap: var(--space-2); align-content: start; }
.match-col-title { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.match-card { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: 600 16px/1.25 var(--font-reading); text-align: left; cursor: pointer; transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease; touch-action: manipulation; }
.match-card:hover:not(:disabled), .match-card:focus-visible { border-color: var(--accent); transform: translateY(-2px); outline: none; }
.match-emoji { font-size: 28px; line-height: 1; flex: 0 0 auto; }
.match-img { width: 44px; height: 44px; object-fit: cover; border-radius: var(--radius-sm, 8px); flex: 0 0 auto; }
.match-text { flex: 1 1 auto; }
.match-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.match-done { border-color: var(--ok, var(--accent)); background: color-mix(in srgb, var(--ok, var(--accent)) 14%, var(--surface)); color: var(--muted); cursor: default; opacity: .92; }
.match-done .match-text::after { content: " ✓"; color: var(--ok, var(--accent)); font-weight: 800; }
.match-pop { animation: match-pop .45s ease; }
@keyframes match-pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
.match-shake { animation: match-shake .4s ease; }
@keyframes match-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.match-bad { border-color: var(--danger); }
.match-feedback { margin: 0; min-height: 24px; font-weight: 600; }
.match-feedback.good { color: var(--ok, var(--accent)); }
.match-feedback.bad { color: var(--danger); }
.match-feedback.hint { color: var(--muted); }
.match-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.match-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.match-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: match-fall 1s ease-in forwards; }
@keyframes match-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(340px) rotate(540deg); opacity: 0; } }
/* Tableta+: tarjetas más holgadas para dedo y lectura cómoda. */
@media (min-width: 720px) {
    .match-board { gap: var(--space-4) var(--space-6); }
    .match-card { min-height: 64px; font-size: 17px; }
    .match-emoji { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
    .match-card, .match-card:hover, .match-pop, .match-shake, .match-win { animation: none !important; transition: none !important; transform: none !important; }
    .match-confetti { display: none !important; }
}

/* ---------- Motor «memory» (Memoria de parejas) ---------- */
.mem-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.mem-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.mem-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--space-3); }
.mem-card { position: relative; aspect-ratio: 3 / 4; min-height: 96px; display: grid; place-items: center; padding: 8px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); cursor: pointer; transition: transform .12s ease, border-color .12s ease, background .12s ease; touch-action: manipulation; }
.mem-card:hover:not(:disabled), .mem-card:focus-visible { border-color: var(--accent); transform: translateY(-2px); outline: none; }
.mem-back { font: 800 30px/1 var(--font-reading); color: var(--muted); }
.mem-front { position: absolute; inset: 6px; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.mem-emoji { font-size: 40px; line-height: 1; }
.mem-text { font: 600 15px/1.2 var(--font-reading); }
.mem-open { background: var(--accent-soft); border-color: var(--accent); }
.mem-open .mem-back { display: none; }
.mem-open .mem-front { display: flex; }
.mem-matched { border-color: var(--ok, var(--accent)); background: color-mix(in srgb, var(--ok, var(--accent)) 14%, var(--surface)); cursor: default; opacity: .9; }
.mem-pop { animation: mem-pop .45s ease; }
@keyframes mem-pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
.mem-wrong { border-color: var(--danger); animation: mem-shake .4s ease; }
@keyframes mem-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.mem-status { margin: 0; min-height: 24px; font-weight: 600; }
.mem-status.good { color: var(--ok, var(--accent)); }
.mem-status.bad { color: var(--danger); }
.mem-status.hint { color: var(--muted); }
.mem-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.mem-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.mem-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: mem-fall 1s ease-in forwards; }
@keyframes mem-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* ---------- Motor «sort» (Clasificar) ---------- */
.sort-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.sort-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.sort-pool { display: flex; flex-wrap: wrap; gap: var(--space-2); min-height: 60px; padding: var(--space-3); border: 2px dashed var(--line); border-radius: var(--radius-md); background: var(--surface); }
.sort-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 8px 14px; border: 2px solid var(--line); border-radius: var(--radius-pill, 999px); background: var(--bg); color: var(--ink); font: 600 15px/1.2 var(--font-reading); cursor: pointer; transition: transform .12s ease, border-color .12s ease, background .12s ease; touch-action: manipulation; }
.sort-chip:hover:not(:disabled), .sort-chip:focus-visible { border-color: var(--accent); transform: translateY(-2px); outline: none; }
.sort-chip-emoji { font-size: 22px; line-height: 1; }
.sort-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.sort-placed { border-color: var(--ok, var(--accent)); background: color-mix(in srgb, var(--ok, var(--accent)) 14%, var(--surface)); cursor: default; opacity: .92; }
.sort-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); }
.sort-bin { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; transition: border-color .12s ease, background .12s ease; min-height: 120px; }
.sort-bin:hover, .sort-bin:focus-within { border-color: var(--accent); }
.sort-bin-head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.sort-bin-emoji { font-size: 24px; line-height: 1; }
.sort-bin-slots { display: flex; flex-wrap: wrap; gap: var(--space-2); align-content: flex-start; flex: 1 1 auto; }
.sort-pop { animation: sort-pop .45s ease; }
@keyframes sort-pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
.sort-shake { animation: sort-shake .4s ease; }
@keyframes sort-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.sort-status { margin: 0; min-height: 24px; font-weight: 600; }
.sort-status.good { color: var(--ok, var(--accent)); }
.sort-status.bad { color: var(--danger); }
.sort-status.hint { color: var(--muted); }
.sort-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.sort-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.sort-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: sort-fall 1s ease-in forwards; }
@keyframes sort-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* ---------- Motor «order» (Ordenar secuencia) ---------- */
.ord-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.ord-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.ord-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.ord-row { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); transition: border-color .12s ease, background .12s ease; }
.ord-pos { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; }
.ord-body { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; font: 600 16px/1.3 var(--font-reading); }
.ord-emoji { font-size: 24px; line-height: 1; }
.ord-move { flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; }
.ord-btn { width: 40px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm, 8px); background: var(--bg); color: var(--ink); font-size: 13px; cursor: pointer; touch-action: manipulation; }
.ord-btn:hover, .ord-btn:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.ord-ok { border-color: var(--ok, var(--accent)); background: color-mix(in srgb, var(--ok, var(--accent)) 12%, var(--surface)); }
.ord-no { border-color: color-mix(in srgb, var(--danger) 60%, var(--line)); }
.ord-shake { animation: ord-shake .4s ease; }
@keyframes ord-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.ord-status { margin: 0; min-height: 24px; font-weight: 600; }
.ord-status.good { color: var(--ok, var(--accent)); }
.ord-status.bad { color: var(--danger); }
.ord-status.hint { color: var(--muted); }
.ord-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.ord-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.ord-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: ord-fall 1s ease-in forwards; }
@keyframes ord-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* ---------- Motor «quiz» (Pregunta con ambientación) ---------- */
.qz-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.qz-progress { margin: 0; font-weight: 600; color: var(--muted); font-size: 14px; }
.qz-card { display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.qz-prompt { margin: 0; font: 400 22px/1.35 var(--font-reading); }
.qz-options { display: grid; gap: var(--space-2); }
.qz-opt { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--bg); color: var(--ink); font: 600 16px/1.25 var(--font-reading); text-align: left; cursor: pointer; transition: transform .12s ease, border-color .12s ease, background .12s ease; touch-action: manipulation; }
.qz-opt:hover:not(:disabled), .qz-opt:focus-visible { border-color: var(--accent); transform: translateY(-2px); outline: none; }
.qz-opt-key { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; }
.qz-opt-text { flex: 1 1 auto; }
.qz-right { border-color: var(--ok, var(--accent)); background: color-mix(in srgb, var(--ok, var(--accent)) 16%, var(--surface)); }
.qz-right .qz-opt-key { background: var(--ok, var(--accent)); color: #fff; }
.qz-wrong { border-color: var(--danger); opacity: .7; }
.qz-pop { animation: qz-pop .45s ease; }
@keyframes qz-pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
.qz-shake { animation: qz-shake .4s ease; }
@keyframes qz-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.qz-explain { margin: 0; min-height: 24px; line-height: 1.5; font-weight: 600; }
.qz-explain.good { color: var(--ok, var(--accent)); }
.qz-explain.bad { color: var(--danger); }
.qz-explain.hint { color: var(--muted); }
.qz-next { justify-self: start; }
.qz-hint { justify-self: start; }
.qz-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.qz-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: qz-fall 1s ease-in forwards; }
@keyframes qz-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }
@media (min-width: 720px) {
    .qz-options { grid-template-columns: 1fr 1fr; }
}

/* ---------- Motor «wordsearch» (Sopa de letras) ---------- */
.ws-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.ws-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.ws-board { display: grid; gap: 4px; max-width: 460px; margin: 0 auto; }
.ws-cell { aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm, 8px); background: var(--surface); color: var(--ink); font: 700 clamp(13px, 4.2vw, 20px)/1 var(--font-reading); text-transform: uppercase; cursor: pointer; transition: background .1s ease, border-color .1s ease, transform .1s ease; touch-action: manipulation; }
.ws-cell:hover, .ws-cell:focus-visible { border-color: var(--accent); outline: none; }
.ws-picked { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.ws-found { background: color-mix(in srgb, var(--ok, var(--accent)) 22%, var(--surface)); border-color: var(--ok, var(--accent)); color: var(--ink); cursor: default; }
.ws-hint { animation: ws-hint 1.6s ease; }
@keyframes ws-hint { 0%,100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 55%, transparent); } }
.ws-pop { animation: ws-pop .4s ease; }
@keyframes ws-pop { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
.ws-no { background: color-mix(in srgb, var(--danger) 20%, var(--surface)); border-color: var(--danger); }
.ws-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); justify-content: center; }
.ws-word { padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-pill, 999px); background: var(--surface); font: 700 14px/1 var(--font-reading); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.ws-word.ws-done { text-decoration: line-through; color: var(--muted); border-color: var(--ok, var(--accent)); background: color-mix(in srgb, var(--ok, var(--accent)) 14%, var(--surface)); }
.ws-status { margin: 0; min-height: 24px; font-weight: 600; text-align: center; }
.ws-status.good { color: var(--ok, var(--accent)); }
.ws-status.bad { color: var(--danger); }
.ws-status.hint { color: var(--muted); }
.ws-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }
.ws-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.ws-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: ws-fall 1s ease-in forwards; }
@keyframes ws-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* ---------- Motor «puzzle» (Rompecabezas) ---------- */
.pz-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.pz-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.pz-stage { display: flex; justify-content: center; }
.pz-board { display: grid; gap: 6px; width: fit-content; margin: 0 auto; }
.pz-cell { aspect-ratio: 1 / 1; width: min(26vw, 108px); display: grid; place-items: center; padding: 0; border: 2px solid var(--line); border-radius: var(--radius-md); background-color: var(--surface); background-repeat: no-repeat; color: var(--ink); cursor: pointer; overflow: hidden; transition: transform .1s ease, border-color .1s ease, box-shadow .1s ease; touch-action: manipulation; }
.pz-cell:hover, .pz-cell:focus-visible { border-color: var(--accent); outline: none; }
.pz-emoji { font-size: clamp(26px, 9vw, 46px); line-height: 1; }
.pz-tiletext { font: 700 14px/1.1 var(--font-reading); padding: 4px; text-align: center; }
.pz-empty { border-style: dashed; background-color: transparent; }
.pz-correct { border-color: color-mix(in srgb, var(--ok, var(--accent)) 60%, var(--line)); }
.pz-picked { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); transform: scale(1.05); }
.pz-status { margin: 0; min-height: 24px; font-weight: 600; text-align: center; }
.pz-status.good { color: var(--ok, var(--accent)); }
.pz-status.bad { color: var(--danger); }
.pz-status.hint { color: var(--muted); }
.pz-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }
.pz-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.pz-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: pz-fall 1s ease-in forwards; }
@keyframes pz-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* ---------- Motor «hotspot» (Puntos por descubrir) ---------- */
.hs-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-5) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.hs-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.hs-stage { display: flex; justify-content: center; }
.hs-svg { width: 100%; max-width: 860px; height: auto; display: block; border-radius: var(--radius-md); background: var(--surface); touch-action: manipulation; }
.hs-spot { cursor: pointer; outline: none; }
.hs-ring { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 3; stroke-dasharray: 5 5; }
.hs-q { font: 800 26px/1 var(--font-reading); fill: var(--accent); pointer-events: none; }
.hs-emoji { font-size: 40px; pointer-events: none; }
.hs-label { font: 700 17px/1 var(--font-reading); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.hs-spot:focus-visible .hs-ring { stroke-width: 5; }
.hs-spot.hs-on .hs-ring { stroke-dasharray: 0; fill: color-mix(in srgb, var(--ok, var(--accent)) 20%, transparent); stroke: var(--ok, var(--accent)); }
.hs-spot.hs-on.hs-pop { animation: hs-pop .4s ease; transform-box: fill-box; transform-origin: center; }
@keyframes hs-pop { 0% { transform: scale(1); } 45% { transform: scale(1.16); } 100% { transform: scale(1); } }
.hs-spot.hs-no { animation: hs-shake .4s ease; }
@keyframes hs-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 60% { transform: translateX(6px); } }
.hs-spot.hs-hint .hs-ring { animation: hs-hint 1.8s ease; }
@keyframes hs-hint { 0%,100% { stroke-width: 3; } 50% { stroke-width: 8; } }
.hs-status { margin: 0; min-height: 24px; font-weight: 600; text-align: center; }
.hs-status.good { color: var(--ok, var(--accent)); }
.hs-status.bad { color: var(--danger); }
.hs-status.hint { color: var(--muted); }
.hs-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }
.hs-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.hs-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: hs-fall 1s ease-in forwards; }
@keyframes hs-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* ---------- Motor «map» (Toca el lugar) ---------- */
.mp-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-5) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.mp-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.mp-ask { margin: 0; padding: 10px 16px; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent); font: 700 20px/1.4 var(--font-reading); text-align: center; }
.mp-prog { margin: 0; text-align: center; color: var(--muted); font-weight: 600; font-size: 14px; }
.mp-stage { display: flex; justify-content: center; }
.mp-svg { width: 100%; max-width: 860px; height: auto; display: block; border-radius: var(--radius-md); background: linear-gradient(180deg, #eaf4ff, #f6fbff); touch-action: manipulation; }
.mp-link { stroke: color-mix(in srgb, var(--accent) 40%, var(--line)); stroke-width: 4; stroke-dasharray: 2 10; stroke-linecap: round; }
.mp-region { cursor: pointer; outline: none; }
.mp-node { fill: var(--surface); stroke: var(--accent); stroke-width: 3; transition: transform .12s ease; transform-box: fill-box; transform-origin: center; }
.mp-region:hover .mp-node, .mp-region:focus-visible .mp-node { stroke-width: 5; }
.mp-emoji { font-size: 30px; pointer-events: none; }
.mp-label { font: 700 15px/1 var(--font-reading); fill: var(--ink); pointer-events: none; }
.mp-region.mp-hit .mp-node { fill: color-mix(in srgb, var(--ok, var(--accent)) 26%, var(--surface)); stroke: var(--ok, var(--accent)); }
.mp-region.mp-no .mp-node { animation: mp-shake .4s ease; }
@keyframes mp-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 60% { transform: translateX(6px); } }
.mp-region.mp-hint .mp-node { animation: mp-hint 1.8s ease; }
@keyframes mp-hint { 0%,100% { stroke-width: 3; } 50% { stroke-width: 9; } }
.mp-status { margin: 0; min-height: 24px; font-weight: 600; text-align: center; }
.mp-status.good { color: var(--ok, var(--accent)); }
.mp-status.bad { color: var(--danger); }
.mp-status.hint { color: var(--muted); }
.mp-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }
.mp-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.mp-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: mp-fall 1s ease-in forwards; }
@keyframes mp-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* ---------- Motor «ecosystem» (Simulación de cadena trófica) ---------- */
.eco-game { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-5) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.eco-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.eco-season { margin: 0; text-align: center; color: var(--muted); font-weight: 700; }
.eco-board { display: grid; gap: var(--space-3); }
.eco-row { display: grid; grid-template-columns: minmax(110px, auto) 1fr auto; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.eco-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.eco-barrow { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.eco-bar { display: flex; flex-wrap: wrap; gap: 1px; min-height: 26px; flex: 1; }
.eco-bar.eco-hint { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; animation: eco-pulse 1.6s ease; }
@keyframes eco-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.eco-pip { font-size: 18px; line-height: 1; }
.eco-pip-none { opacity: .6; }
.eco-num { font: 800 16px/1 var(--font-reading); color: var(--accent); min-width: 22px; text-align: right; }
.eco-ctrl { display: flex; gap: 6px; }
.eco-step { width: 44px; height: 44px; border: 2px solid var(--accent); border-radius: var(--radius-md); background: var(--surface); color: var(--accent); font: 800 22px/1 var(--font-reading); cursor: pointer; touch-action: manipulation; }
.eco-step:hover, .eco-step:focus-visible { background: var(--accent-soft); outline: none; }
.eco-step:active { transform: translateY(1px); }
.eco-status { margin: 0; min-height: 24px; font-weight: 600; text-align: center; }
.eco-status.good { color: var(--ok, var(--accent)); }
.eco-status.bad { color: var(--danger); }
.eco-status.hint { color: var(--muted); }
.eco-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }
.eco-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.eco-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: eco-fall 1s ease-in forwards; }
@keyframes eco-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }
@media (max-width: 560px) { .eco-row { grid-template-columns: 1fr auto; } .eco-name { grid-column: 1 / -1; } }

/* ---------- Motor «explore» (Mundo de descubrimiento) ---------- */
.ex-world { position: relative; overflow: hidden; display: grid; gap: var(--space-4); padding: var(--space-5) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.ex-goal { margin: 0; font-weight: 600; line-height: 1.5; }
.ex-nav { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ex-chip { padding: 8px 16px; border: 2px solid var(--line); border-radius: var(--radius-pill, 999px); background: var(--surface); color: var(--ink); font: 700 14px/1.2 var(--font-reading); cursor: pointer; touch-action: manipulation; transition: border-color .12s ease, background .12s ease; }
.ex-chip:hover, .ex-chip:focus-visible { border-color: var(--accent); outline: none; }
.ex-chip.ex-current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ex-chip.ex-done { border-color: color-mix(in srgb, var(--ok, var(--accent)) 55%, var(--line)); color: var(--ok, var(--accent)); }
.ex-stage { display: grid; gap: var(--space-3); }
.ex-scene-title { margin: 0; font: 600 18px/1.3 var(--font-reading); color: var(--ink); }
.ex-host { display: grid; }
.ex-status { margin: 0; min-height: 22px; font-weight: 600; text-align: center; color: var(--muted); }
.ex-status.good { color: var(--ok, var(--accent)); }
.ex-win { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.ex-confetti { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; opacity: .9; pointer-events: none; animation: ex-fall 1s ease-in forwards; }
@keyframes ex-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* ---------- Accesibilidad: sin movimiento en los motores nuevos ---------- */
@media (prefers-reduced-motion: reduce) {
    .mem-card, .mem-card:hover, .mem-pop, .mem-wrong, .mem-win,
    .sort-chip, .sort-chip:hover, .sort-pop, .sort-shake, .sort-win,
    .ord-row, .ord-shake, .ord-win,
    .ws-cell, .ws-cell:hover, .ws-pop, .ws-no, .ws-hint, .ws-win,
    .pz-cell, .pz-cell:hover, .pz-picked, .pz-win,
    .hs-spot, .hs-spot.hs-on.hs-pop, .hs-spot.hs-no, .hs-spot.hs-hint .hs-ring, .hs-win,
    .mp-region, .mp-region.mp-no .mp-node, .mp-region.mp-hint .mp-node, .mp-win,
    .eco-step, .eco-step:active, .eco-bar.eco-hint, .eco-win,
    .ex-chip, .ex-chip:hover, .ex-win,
    .qz-opt, .qz-opt:hover, .qz-pop, .qz-shake, .qz-win { animation: none !important; transition: none !important; transform: none !important; }
    .mem-confetti, .sort-confetti, .ord-confetti, .ws-confetti, .pz-confetti, .hs-confetti, .mp-confetti, .eco-confetti, .ex-confetti, .qz-confetti { display: none !important; }
}

/* ---------- CTA inversos (objeto → jugar, laboratorio → aplicar) ---------- */
.lo-play, .lab-apply { margin-top: var(--space-6); padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.lo-play-title, .lab-apply h2 { margin: 0 0 var(--space-2); font: 400 20px/1.3 var(--font-reading); }
.lo-play-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.lo-play-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; text-decoration: none; color: var(--ink); background: var(--bg); }
.lo-play-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.lo-play-card .generated-cover { aspect-ratio: 16 / 9; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.lo-play-info { display: flex; flex-direction: column; gap: 4px; padding: var(--space-3); }
.lo-play-info em { font-style: normal; color: var(--accent); font-weight: 600; font-size: 14px; }
.lab-apply-grid { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-3); }
.lab-apply-card { display: inline-flex; align-items: center; gap: var(--space-2); padding: 10px 16px; border: 1px solid var(--accent); border-radius: var(--radius-pill, 999px); color: var(--accent); text-decoration: none; font-weight: 600; }
.lab-apply-card:hover { background: var(--accent-soft); }

/* ---------- Practicar y jugar: interruptor Juegos | Laboratorios y muestra de laboratorios ---------- */
.play-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 10px; margin: 18px 0 4px; }
.play-switch-item { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); transition: border-color .15s, background .15s; }
.play-switch-item > svg { flex-shrink: 0; margin-top: 2px; color: var(--muted); }
.play-switch-item strong { display: block; font-size: 16px; }
.play-switch-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.play-switch-item:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.play-switch-item.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.play-switch-item.is-on > svg { color: var(--accent); }

.play-mini { margin: 18px 0 6px; padding: 16px 18px; border: 1px dashed var(--line); border-radius: var(--radius-md); background: var(--bg); }
.play-mini-title, .play-band-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.play-mini-title > svg, .play-band-title > svg { color: var(--accent); }
.play-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 10px; margin-bottom: 10px; }
.play-mini-card { display: flex; flex-direction: column; gap: 4px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); transition: border-color .15s, transform .15s; }
.play-mini-card:hover { border-color: var(--accent); color: var(--ink); }
.play-mini-card strong { font-size: 14.5px; }
.play-mini-card small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.play-mini-go { display: inline-flex; align-items: center; gap: 5px; margin-top: auto; padding-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--accent); }

.play-band-title { margin: 26px 0 12px; font-size: 18px; }
/* «Más filtros»: dificultad y mecánica fuera del camino principal, pero accesibles. */
.game-more { margin-top: 10px; }
.game-more > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; list-style: none; }
.game-more > summary::-webkit-details-marker { display: none; }
.game-more > summary:hover { border-color: var(--accent); color: var(--accent); }
.game-more[open] > summary { border-color: var(--accent); color: var(--accent); }
.game-more > .game-filter-select { display: block; margin-top: 10px; max-width: 280px; }

/* ---------- Tableta+: dos columnas en el motor ---------- */
@media (min-width: 720px) {
    .shop-game { grid-template-columns: 1.4fr 1fr; align-items: start; grid-template-areas: "goal goal" "stage panel" "feedback feedback" "actions actions"; }
    .shop-goal { grid-area: goal; }
    .shop-stage { grid-area: stage; }
    .shop-panel { grid-area: panel; }
    .shop-feedback { grid-area: feedback; }
    .shop-actions { grid-area: actions; }
}

/* ---------- Accesibilidad: sin movimiento para quien lo pida ---------- */
@media (prefers-reduced-motion: reduce) {
    .shop-item, .shop-item:hover, .shop-win, .shop-denom:hover, .game-hints li.hint-revealed { animation: none !important; transition: none !important; transform: none !important; }
    .shop-confetti { display: none !important; }
    .snd-card, .snd-card:hover, .snd-card.snd-jump, .snd-num.snd-num-pick, .snd-star.on, .snd-shake, .snd-confetti, .snd-ring-on, .snd-done-emoji { animation: none !important; transition: none !important; transform: none !important; }
    .snd-confetti { display: none !important; }
}
