.grid-container { display: grid; grid-template-columns: repeat(auto-fill, var(--card-w)); gap: 35px; justify-content: center; padding-bottom: 80px; }

/* CARD MASTERPIECE */
.card { width: var(--card-w); height: var(--card-h); perspective: 2000px; cursor: pointer; position: relative; }
.js-tilt { transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d; }
.card-inner { position: relative; width: 100%; height: 100%; transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1); transform-style: preserve-3d; }
.card.is-flipped .card-inner { transform: rotateY(180deg); }

.card-front, .card-back { 
    position: absolute; width: 100%; height: 100%; backface-visibility: hidden; 
    border-radius: var(--card-radius); 
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    display: flex; flex-direction: column; 
    overflow: hidden; 
    border: none; 
    transform: translateZ(0);
}

.shine {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: translateX(-100%); transition: transform 0.6s; pointer-events: none; z-index: 50;
}
.card:hover .shine { transform: translateX(100%); }

.quick-edit-btn { 
    position: absolute; top: 12px; right: 12px; z-index: 100; 
    width: 36px; height: 36px; background: #fff; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    border: 1px solid var(--border); cursor: pointer; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); font-size: 16px;
    opacity: 0; transform: scale(0.8); transition: all 0.3s;
}
.card:hover .quick-edit-btn { opacity: 1; transform: scale(1); }

/* 1. SEÇÃO SUPERIOR (ÁREA DO BADGE) - SINCRONIZADO À ESQUERDA */
.cat-badge-container { 
    height: 45px; 
    padding-left: 20px; /* Alinhamento inicial */
    display: flex;
    align-items: center; 
    justify-content: flex-start; /* Força o badge para a esquerda */
    position: relative;
    z-index: 10;
}
.cat-badge { display: inline-block; padding: 5px 12px; border-radius: 100px; font-size: var(--f-size-cat); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

/* 2. RIBBON (TÍTULO) - SINCRONIZADO À ESQUERDA COM COMPENSAÇÃO DE SANGRIA */
.card-ribbon {
    position: relative; 
    width: calc(100% + 2px); 
    margin-left: -1px;
    margin-top: -1px; 
    height: 45px; 
    display: flex;
    align-items: center; 
    padding-left: 21px; /* 21px - 1px (margin) = 20px reais, sincronizando com o Badge */
    padding-right: 20px;
    font-weight: 800; 
    z-index: 5; 
    font-size: var(--f-size-item); 
    line-height: 1.2; 
    box-sizing: border-box;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.05);
}

/* 3. CONTAINER DA IMAGEM */
.img-container { 
    flex: 1;
    width: calc(100% + 2px);
    margin-left: -1px;
    margin-top: -1px; 
    display: flex; align-items: center; justify-content: center; 
    overflow: hidden; 
    position: relative;
    background: transparent;
    z-index: 1;
}

.mode-icon img { 
    width: var(--card-img-size); height: var(--card-img-size); object-fit: contain; 
    transform: translateZ(0);
}

.mode-photo img { 
    width: 100%; height: 100%; object-fit: cover; 
    transform: scale(1.01) translateZ(0);
}

.flip-hint { position: absolute; bottom: 12px; right: 15px; font-size: 16px; color: #cbd5e1; opacity: 0.4; z-index: 20; }

/* CARD BACK */
.card-back { transform: rotateY(180deg) translateZ(0); background: #fdfdfe !important; }
.back-header { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid #f1f5f9; background: #fff; }
.back-header img { width: 35px; height: 35px; object-fit: contain; border-radius: 6px; }
.back-header strong { font-size: calc(var(--f-size-item) * 0.85); font-weight: 800; }
.back-content { padding: 20px; flex: 1; overflow-y: auto; font-size: var(--f-size-desc); line-height: 1.7; color: #475569; }