.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Tarjetas */
.card {
  position: relative;
  border: 1px solid #bbb;
  border-radius: 10px;
  padding: 14px;
  padding-bottom: 38px;
  background: #fafafa;
  transition: .2s;
}

/* Franja degradada de fondo */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px; /* franja superior */
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background: var(--card-color, linear-gradient(135deg, #2b6e83 0%, #1a4350 100%));
  opacity: 0.6; /* suave, no tapa contenido */
  z-index: 0;
}

/* Contenido por encima */
.card > * {
  position: relative;
  z-index: 1;
}

.card .title {
  display: block;
  align-items: center;
  width: 100%;
  min-height: 60px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0, 0, 0, 0.1); /* borde sutil */
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 8px;
  color: #333;
  overflow-wrap: break-word;
  text-overflow: ellipsis;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.12);
}

/* Contenido: emoji + descripción */
.card .inner {
    display: flex;
    flex-direction: row;
    gap: 0.7rem;
    align-items: center;
}

.card .inner .icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    width: 70px;
    text-align: center;
    color: #333;
}

.card .content {
    flex: 1;
}

.card .content p {
    margin: 0;
    line-height: 1.4;
}


/* Descripción */
.card .content {
    flex: 1;
}

.card .content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #333;
    text-align: justify;
}

/* Prompt y footer */
.prompt {
  max-height: 8.4em;
  overflow: hidden;
  mask-image: linear-gradient(#000 70%, transparent);
  transition: max-height .25s ease;
}

.prompt.expand {
  max-height: none;
  mask-image: none;
}

.card-footer {
  position: absolute;
  bottom: 8px;
  left: 12px;
}

.vermas {
  color: #3d4449;
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.vermas:hover {
  color: #3d4449;
}

.card.selected {
  outline: 1px solid rgba(43, 110, 131, 0.65);
  box-shadow: 0 0 8px rgba(43, 110, 131, 0.35);
  transition: box-shadow 0.3s ease, outline 0.3s ease;
}

@keyframes flash {
  0%, 100% { box-shadow: 0 0 8px rgba(43, 110, 131, 0.35); }
  50%      { box-shadow: 0 0 14px rgba(43, 110, 131, 0.55); }
}

.card.selected.flash {
  animation: flash 1.5s ease-in-out 2;
}

.cards-group-title {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0 12px 0;       
    width: 100%;
    border: 1px solid transparent;
    border-left-width: 6px;
    background:
        linear-gradient(#fff, #fff) padding-box,
        var(--bg-gradient) border-box;
    height: 50px; /* altura fija para centrar verticalmente */
}

/* Capa de gradiente de fondo */
.cards-group-title .bg-layer {
    position: absolute;
    inset: 0;                   
    z-index: 0;
    border-radius: 0px;          
    background: linear-gradient(135deg, rgba(0,176,255,0.3), rgba(41,121,255,0.3)); 
    opacity: 0.7;
}

/* Capa de texto */
.cards-group-title .text-layer {
    position: relative;
    z-index: 1;
    display: flex;              
    align-items: center;        /* centrado vertical */
    font-weight: 600;
    font-size: 0.9rem; 
    color: white;         
    text-align: left;                     
    padding: 6px 16px 0 16px;   /* padding superior 4px, horizontal 16px, sin padding inferior */
    height: 100%;               
}

.cards-group-title .text-layer h2 {
    color: #ffffff !important;
    font-family: inherit;
}

/* Responsive */
@media (max-width: 600px) {
    .cards-group-title .text-layer {
        font-size: 0.75rem;
        padding: 4px 12px 0 12px;
    }
}
