/*
 | Cartas de MindBlock Play (bloques y funciones que se ganan en cada nivel).
 | Se usan en la ruta (play.path) y en la ventana de victoria del juego (simulator.mission),
 | por eso traen sus propios colores y su propia versión del bloque.
 */
.pl-cards {
    --ink: #0F1733; --soft: #4A5372; --mute: #8A94B8; --bg: #F6F7FB; --card: #FFFFFF; --line: #E2E6F1;
    --yellow: #FFC233; --blue: #3158DD; --green: #17784E; --orange: #C2410C; --purple: #6A43C9; --teal: #0F7C80; --code: #0F1733;
    --display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
    font-family: Inter, system-ui, sans-serif; color: var(--ink);
}
.pl-cards .pl-blk { color: #fff; padding: 4px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--blue); align-self: center; }
.pl-cards .pl-blk.is-loop, .pl-cards .pl-blk.is-cond { flex-direction: column; align-items: stretch; gap: 6px; padding: 6px 6px 7px 10px; }
.pl-cards .pl-blk.is-loop { background: var(--orange); }
.pl-cards .pl-blk.is-cond { background: var(--purple); }
.pl-cards .pl-blk.is-loop > span, .pl-cards .pl-blk.is-cond > span { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pl-cards .pl-blk.is-sensor { background: var(--teal); border-radius: 999px; }
.pl-cards .pl-val { background: #fff; color: var(--ink); border-radius: 999px; padding: 0 6px; font-weight: 700; }
/* Caja de herramientas como colección de cartas */
.pl-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
.pl-cards .pl-card { --tone: var(--blue); position: relative; display: grid; grid-template-rows: auto 1fr auto auto; border: 2px solid var(--ink); border-radius: 14px; background: var(--card); box-shadow: 0 4px 0 var(--ink); overflow: hidden; text-align: center; }
.pl-cards .pl-card.is-control { --tone: var(--orange); }
.pl-cards .pl-card.is-sensor { --tone: var(--teal); }
.pl-card-top { display: flex; align-items: center; justify-content: space-between; padding: 5px 6px 5px 10px; background: var(--tone); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pl-card-top b { display: grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); color: var(--ink); font-size: 12px; box-shadow: inset 0 -2px 0 rgba(15, 23, 51, .2); }
.pl-card-art { position: relative; display: grid; place-items: center; min-height: 86px; padding: 12px 8px; background: radial-gradient(circle at 50% 40%, #fff 0, #EEF2FB 70%); border-bottom: 2px dashed var(--line); }
.pl-card-art .pl-blk { box-shadow: 0 2px 0 rgba(15, 23, 51, .3); font-size: 12px; text-align: start; max-width: 100%; }
.pl-card-art .pl-blk .pl-val { padding: 0 6px; }
.pl-card-art .pl-blk.is-loop, .pl-card-art .pl-blk.is-cond { min-width: 96px; }
.pl-card-slot { display: block; height: 12px; margin-inline-start: 6px; border-radius: 4px; background: rgba(255, 255, 255, .35); }
.pl-card-art code { display: block; max-width: 100%; padding: 6px 8px; border-radius: 8px; background: var(--code); color: #8FB0FF; font: 600 11px/1.4 ui-monospace, Consolas, monospace; white-space: normal; word-break: break-word; direction: ltr; text-align: left; }
.pl-cards .pl-card.is-control .pl-card-art code { color: #FFC233; }
.pl-cards .pl-card.is-sensor .pl-card-art code { color: #7EE2B8; }
.pl-card-name { padding: 6px 6px 0; font-size: 13px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.pl-card-foot { padding: 2px 6px 8px; font-size: 11px; font-weight: 700; color: var(--green); }
/* Por ganar: silueta con «?» */
.pl-cards .pl-card.is-locked { background: var(--bg); border-style: dashed; box-shadow: none; }
.pl-cards .pl-card.is-locked .pl-card-top { background: #C9D0E0; }
.pl-cards .pl-card.is-locked .pl-card-art > :not(.pl-card-q) { filter: brightness(0); opacity: .12; }
.pl-cards .pl-card.is-locked .pl-card-name { color: var(--mute); }
.pl-cards .pl-card.is-locked .pl-card-foot { color: var(--mute); }
.pl-card-q { position: absolute; inset: 0; display: grid; place-items: center; font: 800 34px var(--display); color: #B7C0D6; }
/* La siguiente carta: brilla para que dé ganas de ir por ella */
.pl-cards .pl-card.is-next { border: 2px dashed var(--yellow); background: #FFFBEF; animation: pl-card-glow 1.8s ease-in-out infinite; }
.pl-cards .pl-card.is-next .pl-card-top { background: var(--yellow); color: var(--ink); }
.pl-cards .pl-card.is-next .pl-card-top b { background: #fff; }
.pl-cards .pl-card.is-next .pl-card-q { color: var(--yellow); }
.pl-cards .pl-card.is-next .pl-card-foot { color: #9A6A00; }
@keyframes pl-card-glow { 50% { box-shadow: 0 0 0 5px rgba(255, 194, 51, .35); } }
/* Recién ganada: se «recoge» con un toque */
.pl-cards .pl-card.is-new { cursor: pointer; animation: pl-card-bob 1.4s ease-in-out infinite; box-shadow: 0 4px 0 var(--ink), 0 0 0 4px rgba(255, 194, 51, .6), 0 0 26px rgba(255, 194, 51, .7); }
.pl-cards .pl-card.is-new .pl-card-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, .55) 50%, transparent 62%); background-size: 260% 100%; animation: pl-card-shine 1.6s linear infinite; }
.pl-cards .pl-card.is-new:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.pl-card-new { position: absolute; z-index: 2; top: 30px; inset-inline-end: -4px; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 999px; background: var(--red, #E5484D); color: #fff; font-size: 11px; font-weight: 800; transform: rotate(8deg); }
.pl-card-take { margin: 0 8px 8px; padding: 5px; border: 2px solid var(--ink); border-radius: 9px; background: var(--yellow); color: var(--ink); font-size: 13px; font-weight: 800; box-shadow: 0 3px 0 var(--ink); }
.pl-cards .pl-card.is-new .pl-card-foot { display: none; }
.pl-cards .pl-card.is-taking { animation: pl-card-take .7s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes pl-card-bob { 50% { transform: translateY(-4px) rotate(-1.5deg); } }
@keyframes pl-card-shine { from { background-position: 130% 0; } to { background-position: -130% 0; } }
@keyframes pl-card-take { 0% { transform: scale(1); } 35% { transform: scale(1.18) rotate(-6deg) translateY(-10px); } 70% { transform: scale(.92) rotate(2deg); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .pl-cards .pl-card.is-new, .pl-cards .pl-card.is-next, .pl-cards .pl-card.is-taking, .pl-cards .pl-card.is-new .pl-card-art::after { animation: none; }
}

.pl-card-art .pl-blk { justify-content: center; gap: 4px 5px; line-height: 1.25; }
.pl-card-art .pl-blk.is-loop > span:first-child, .pl-card-art .pl-blk.is-cond > span:first-child { justify-content: flex-start; }
.pl-blk-v { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.pl-cards .pl-card.is-new .pl-card-art { padding-top: 28px; }
.pl-card-new { top: 34px; inset-inline-end: 8px; transform: rotate(6deg); }

/* La ruta: una carta ganada que no se recogió en el juego entra sola a la caja */
.pl-cards .pl-card.is-arriving { animation: pl-card-arrive .8s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes pl-card-arrive { 0% { opacity: 0; transform: translateY(-18px) scale(.7) rotate(-8deg); } 60% { opacity: 1; transform: translateY(3px) scale(1.06) rotate(2deg); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .pl-cards .pl-card.is-arriving { animation: none; } }
