.memory-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: none;
  height: 100%;
  position: relative;
  background: white;
  padding: 18px 18px 25px 18px;
  border-radius: 2px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  --tilt: 0deg;
  transform: rotate(var(--tilt));
}

.memory-card .card-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.memory-content-wrapper {
  background: linear-gradient(135deg, #475766 0%, #2f3b46 55%, #4d5d6b 100%);
  padding: 22px;
  border-radius: 3px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
  flex: 1;
}

.memory-content-wrapper .memory-content {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #f8f9fa;
  font-weight: 400;
  margin-bottom: 1rem;
  flex-grow: 1;
  font-family: "Georgia", "Times New Roman", serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.memory-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0.6rem;
}

.metadata-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.5rem;
  border-radius: 14px;
  font-size: 0.52rem;
  font-weight: 600;
  background-color: rgba(255, 255, 255, 0.15);
  color: #e8edf2;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.metadata-badge svg,
.badge svg {
  width: 10px;
  height: 10px;
  opacity: 0.9;
}

.metadata-badge .metadata-emoji {
  width: 8px;
  height: 8px;
  object-fit: contain;
  display: inline-block;
  flex: 0 0 auto;
  transform: scale(2);
  transform-origin: center;
  margin-right: 0.2rem;
}

.memory-footer,
.memory-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  padding-top: 0.6rem;
  border-top: 2px solid rgba(255, 255, 255, 0.15);
}

.memory-year {
  font-size: 0.6rem;
  color: #e8edf2;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.memory-year svg {
  width: 12px;
  height: 12px;
}

.memory-likes {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6rem;
  color: #e8edf2;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.memory-likes svg {
  width: 12px;
  height: 12px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

.memory-actions {
  margin-top: auto;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
}

.memory-actions button {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.58rem;
  transition: all 0.2s ease;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  color: #f8f9fa;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.memory-actions button svg {
  width: 12px;
  height: 12px;
}

.memory-actions button:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.memory-actions button.active {
  border-color: rgba(214, 225, 234, 0.86);
  background: rgba(116, 134, 149, 0.72);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(20, 31, 41, 0.34);
}

.memory-actions button.active:hover {
  background: rgba(133, 151, 166, 0.8);
  box-shadow: 0 6px 16px rgba(20, 31, 41, 0.42);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.memory-likes.pulse {
  animation: pulse 0.3s ease-in-out;
}

.stretched-link::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 65px;
  left: 0;
  z-index: 1;
  content: "";
}

@media (max-width: 767px) {
  .memory-card {
    padding: 14px 14px 20px;
    transform: none;
  }

  .memory-content-wrapper {
    min-height: 240px;
    padding: 18px;
  }

  .memory-content-wrapper .memory-content {
    font-size: 0.98rem;
    line-height: 1.6;
  }

  .memory-actions {
    justify-content: flex-end;
  }

  .memory-actions button {
    max-width: min(100%, 11rem);
    white-space: normal;
  }
}
