.logic-library-main { padding: clamp(28px, 5vw, 52px) 20px 60px; }

.logic-library-header {
    width: min(1050px, 100%);
    margin: 0 auto 28px;
}

.logic-library-header > a {
    display: inline-block;
    margin-bottom: 22px;
    color: var(--color-brand);
    font-size: .9rem;
    font-weight: 700;
    text-underline-offset: 3px;
}

.logic-library-header h1 {
    margin: 0;
    color: var(--color-brand-strong);
    font-size: clamp(2rem, 5vw, 3.2rem);
}

.logic-library-header p:last-child {
    max-width: 720px;
    margin: 12px 0 0;
    color: var(--color-muted);
    line-height: 1.55;
}

.logic-card-grid {
    width: min(1050px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.logic-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 5px solid #8c3f2c;
    border-radius: 14px;
    box-shadow: var(--shadow-card);
}

.logic-card > img,
.logic-card-art img {
    width: 100%;
    aspect-ratio: 2.2 / 1;
    display: block;
    object-fit: cover;
    filter: grayscale(1);
    border-bottom: 1px solid var(--color-border);
}

.logic-card-art {
    position: relative;
    aspect-ratio: 2.2 / 1;
    overflow: hidden;
    border-bottom: 1px solid var(--color-border);
}

.logic-card-art img {
    height: 100%;
    border-bottom: 0;
}

.card-firefly {
    position: absolute;
    width: 5px;
    height: 5px;
    background: #ffe77a;
    border-radius: 50%;
    box-shadow: 0 0 5px 2px rgba(255, 230, 91, .75), 0 0 12px 4px rgba(224, 182, 45, .35);
    animation: card-firefly-glow 2.4s ease-in-out infinite alternate;
    pointer-events: none;
}

.card-firefly-1 { top: 30%; left: 14%; animation-delay: -.5s; }
.card-firefly-2 { top: 62%; left: 29%; animation-delay: -1.7s; }
.card-firefly-3 { top: 22%; left: 54%; animation-delay: -2.1s; }
.card-firefly-4 { top: 55%; left: 73%; animation-delay: -.9s; }
.card-firefly-5 { top: 36%; left: 88%; animation-delay: -3s; }

@keyframes card-firefly-glow {
    0%, 28% { opacity: .08; transform: translateY(2px) scale(.75); }
    72%, 100% { opacity: 1; transform: translateY(-3px) scale(1.15); }
}

.logic-card.featured { border-top-color: #6b3473; }
.logic-card.featured img { filter: none; }

.logic-card:not(.featured) img {
    transition: filter .22s ease;
}

.logic-card:not(.featured) img:hover,
.logic-card:not(.featured):focus-within img {
    filter: none;
}

@media (prefers-reduced-motion: reduce) {
    .card-firefly { display: none; }
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.featured-label {
    padding: 4px 8px;
    color: #fff;
    background: #6b3473;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.logic-card-copy {
    height: 100%;
    padding: 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.difficulty {
    padding: 4px 8px;
    color: var(--color-brand-strong);
    background: #f6eadb;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.logic-card h2 { margin: 13px 0 9px; font-size: 1.35rem; }
.logic-card p { margin: 0 0 20px; color: var(--color-muted); line-height: 1.5; }

.logic-card a {
    margin-top: auto;
    padding: 10px 14px;
    color: #fff;
    background: var(--color-brand);
    border-radius: 8px;
    font-size: .92rem;
    font-weight: 800;
    text-decoration: none;
}

.logic-card a:hover, .logic-card a:focus-visible { background: var(--color-brand-strong); }
.collection-note { margin: 30px auto 0; color: var(--color-muted); font-size: .88rem; text-align: center; }

@media (max-width: 720px) {
    .logic-library-main { padding-inline: 12px; }
    .logic-card-grid { grid-template-columns: 1fr; }
}
